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
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
|
SWIG (Simplified Wrapper and Interface Generator)
The Stable Development Branch
=============================
In this CVS branch "rel-1-3", fixes in the SWIG core and improvements
to the language modules take place, starting from the stable release
1.3.6.
Eventually this branch will be merged back to the trunk of the CVS
tree (maybe).
Version 1.3.18 (In progress)
============================
Due to the size of the CHANGES file, please add change entries to the
file CHANGES.current. It will be merged into this file before
release. -- Dave
Version 1.3.17 (November 22, 2002)
==================================
11/19/2002: beazley
Fixed [ 613922 ] preprocessor errors with HAVE_LONG_LONG.
11/19/2002: beazley
Fixed [ 615480 ] mzscheme SWIG_MustGetPtr_.
11/19/2002: beazley
Fixed [ 635119 ] SWIG_croak causes compiler warning.
11/16/2002: cheetah (William Fulton)
[Java] Added typemaps for pointers to class members.
11/15/2002: cheetah (William Fulton)
[Java] Bug fix: Overloaded C++ functions which cannot be overloaded in Java
once again issue a warning.
11/14/2002: cheetah (William Fulton)
[Java] Handling of NULL pointers is improved. A java null object will now
be translated to and from a NULL C/C++ pointer by default. Previously when
wrapping:
class SomeClass {...};
void foo(SomeClass *s);
and it was called from Java with null:
modulename.foo(null)
a Java NullPointerException was thrown. Extra typemaps had to be written in
order to obtain a NULL pointer to pass to functions like this one. Now the
default wrapping will detect 'null' and translate it into a NULL pointer.
Also if a function returns a NULL pointer, eg:
SomeClass *bar() { return NULL; }
Then this used to be wrapped with a SomeClass proxy class holding a NULL
pointer. Now null is returned instead. These changes are subtle but useful.
The original behaviour can be obtained by using the original typemaps:
%typemap(javaout) SWIGTYPE {
return new $&javaclassname($jnicall, true);
}
%typemap(javaout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
return new $javaclassname($jnicall, $owner);
}
%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
protected static long getCPtr($javaclassname obj) {
return obj.swigCPtr;
}
%}
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11/12/2002: beazley
Fixed problem with abstract methods and signatures. For example:
class abstract_foo {
public:
virtual int meth(int meth_param) = 0;
};
class abstract_bar : public abstract_foo {
public:
int meth(int meth_param_1, int meth_param_2) { return 0; }
};
In this case, abstract_bar is still abstract.
Fixes [ 628438 ] Derived abstract class not abstract.
Reported and patched by Scott Michel.
11/11/2002: beazley
Fixed a matching problem with typemaps and array dimensions. For example, if you
had this:
typedef char blah[20];
and a typemap:
%typemap() char [ANY] {
... $1_dim0 ...
}
then $1_dim* variables weren't be expanded properly. It should work now.
Problem reported by Pankaj Kumar Goel.
11/07/2002: mkoeppe
Added an experimental new module that dumps SWIG's parse
tree as (Common) Lisp s-expressions. The module is
invoked with SWIG's -sexp command-line switch. The output
can be read into Common Lisp. There is (prototype)
example Lisp code that generates Foreign Function Interface
definitions for use with Kevin Rosenberg's UFFI.
*** EXPERIMENTAL NEW FEATURE ***
11/07/2002: mkoeppe
Removed duplicate declaration of "cpp_template_decl" in
parser.y; bison 1.75 complained.
11/06/2002: cheetah (William Fulton)
[Java] Default primitive array handling has changed like arrays of classes.
C primitive arrays are no longer wrapped by a Java array but with a pointer
(type wrapper class). Again the changes have been made for efficiency reasons.
The original typemaps have been moved into arrays_java.i, so the original
behaviour can be obtained merely including this file:
%include "arrays_java.i"
The array support functions are no longer generated by default. They are only
generated when including this file, thus this often unused code is only
generated when specifically requiring this type of array support.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11/05/2002: ljohnson (Lyle Johnson)
[Ruby] Added support for nested module declarations (as was
previously added for the Perl module). So a %module directive
of the form:
%module "Outer::Inner::Foo"
will nest everything as (in Ruby code):
module Outer
module Inner
module Foo
# stuff goes here
end
end
end
11/05/2002: mkoeppe
[MzScheme] Add an argument (-declaremodule) that generates
code to correctly declare a primitive module extension.
Patch submitted by Bruce Butterfield.
11/02/2002: cheetah (William Fulton)
[Java] Added patch submitted by Michael Cahill to remove unused parameter
warnings for the jenv and cls parameters. This patch also also allows one
to use "void" in the jni typemap for any type without code being generated
attempting to return a value.
10/29/2002: cheetah (William Fulton)
[Java] Array handling is different. Arrays of classes are no longer wrapped
with proxy arrays, eg wrapping
class X {...};
X foo[10];
used to be wrapped with these Java getters and setters:
public static void setFoo(X[] value) {...}
public static X[] getFoo() {...}
This approach is very inefficient as the entire array is copied numerous
times on each invocation of the getter or setter. These arrays are now
wrapped with a pointer so it is only possible to access the first array element
using a proxy class:
public static void setFoo(X value) {...}
public static X getFoo() {...}
Arrays of enums have also been similarly changed. This behaviour is now like the
other SWIG language's implementation and the array library should be used to
access the other elements. The original behaviour can be achieved using the
macros and typemaps in arrays_java.i, for example:
%include "arrays_java.i"
JAVA_ARRAYSOFCLASSES(X)
class X {...};
X foo[10];
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
10/29/2002: cheetah (William Fulton)
[Java] Two new typemaps javain and javaout for generating the proxy class
and type wrapper class method calls to the JNI class. The new typemaps are
really used for transforming the jstype (used in proxy class and type wrapper
classes) to the jtype (used in the JNI class) and visa versa. A javain typemap
is required whenever an in typemap is written and similarly javaout for an out
typemap. An example is probably best to show them working:
%typemap(javain) Class "Class.getCPtr($javainput)"
%typemap(javain) unsigned short "$javainput"
%typemap(javaout) Class * {
return new Class($jnicall, $owner);
}
%inline %{
class Class {};
Class * bar(Class cls, unsigned short ush) { return new Class(); };
%}
The generated proxy code is then:
public static Class bar(Class cls, int ush) {
return new Class(exampleJNI.bar(Class.getCPtr(cls), ush), false);
}
Some new special variables have been introduced in order to use these typemaps.
Here $javainput has been replaced by 'cls' and 'ush'. $jnicall has been replaced by
the native method call, 'exampleJNI.bar(...)' and $owner has been replaced by 'false'.
$javainput is analogous to the $input special variable. It is replaced by the parameter name.
$jnicall is analogous to $action in %exception. It is replaced by the call to the native
method in the JNI class.
$owner is replaced by either true if %newobject has been used otherwise false.
The java.swg file contains default javain and javout typemaps which will produce the same code
as previously. This change is only of concern to those who have written their own typemaps as
you will then most likely have to write your own javain and javaout typemaps.
The javaout typemap also makes it possible to use a Java downcast to be used on abstract
proxy base classes. See the Java documentation on dynamic_cast.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
10/24/2002: ttn
[Methodology] Upgaded to libtool 1.4.3, presumably w/ better
support for newish platforms (like MacOS X).
10/21/2002: ttn
Fixed Runtime/Makefile.in bug -- thanks to Richard Calmbach.
10/18/2002: ttn
Fixed typo in doh.h -- thanks to Max Horn.
Version 1.3.16 (October 14, 2002)
=================================
10/13/2002: beazley
Fixed bug with %extend directive and %feature reported
by William Fulton.
10/13/2002: beazley
Added OpenVMS build directory (vms). Contributed by
Jean-François Pieronne.
10/09/2002: cheetah (William Fulton)
[Java] Added throws clause to the native functions in the JNI class.
The throws clause is the same as the one generated for proxy functions
and module class functions.
09/27/2002: beazley
Fixed some problems with the %import directive and classes that
were defined but not wrapped. Problem reported by Leslie Brooks,
Gerry Woods, and others.
09/23/2002: cheetah (William Fulton)
[Java] Some error checking added:
1) OutOfMemoryException check in the char * typemaps.
2) As SWIG treats pointers, references and passing by value all the
same, it is possible to pass a NULL pointer to a function that expects
an object passed by value or by reference. A NullPointerException is
now thrown under this scenario.
09/20/2002: ttn
[Methodology] Reworked "make clean" and "make install"
to be more table driven.
[Docs] Explain how to extend "make install" w/ extra-install.list.
09/15/2002: beazley
Deprecation of the "ignore" typemap. The "ignore" typemap has
been deprecated in favor of a generalization of the "in" typemap.
To ignore an argument, use something like this instead:
%typemap(in,numinputs=0) int *output (int temp) {
$1 = &temp;
}
This change fixes a number of subtle bugs related to the interaction
of the "in" and "ignore" typemaps (which were supposed to be
mutually exclusive).
The use of the numinputs argument is reserved for future expansion.
Currently, values >1 will generate an error. However, future
releases of SWIG may utilize that to support multi-input typemaps.
%typemap(ignore) still works, but generates a warning message and is
translated to %typemap(in,numinputs=0).
*** POTENTIAL INCOMPATIBILITY ***
*** NEW FEATURE ***
09/15/2002: beazley
Fixed segmentation fault for unnamed structures. For example:
typedef struct {
} *blah;
Reported by Roger Gibson.
Note: we might be able to generate wrappers in special cases.
09/13/2002: beazley
Minor modification to generated wrapper functions. Pointer arguments are now
always set to an initial value of 0. Simplifies typemap writing and cleanup
code (since you can rely on zero-value initialization). This also greatly
reduces the need to ever write an "arginit" typemap.
09/12/2002: beazley
Minor enhancement to smart-pointer support. If operator->()
is part of an ignored base class like this,
%ignore Bar;
class Foo {
public:
int blah();
};
class Bar { /* Ignored */
public:
...
Foo *operator->();
...
};
class Spam : public Bar { };
then methods from Foo are still available. For example,
>>> s = Spam()
>>> s.blah()
0
>>>
The only catch is that the operator->() itself is not available
(since it wasn't wrapped). Therefore, there won't be any
__deref__() operation unless it is explicitly added to Spam
(either using %extend or just placing operator->() in the
definition of Spam).
09/11/2002: ttn
[Methodology] Reworked "make check" to be more table driven.
[Docs] Docuemented methodology in Manual/Extending.html.
09/11/2002: ttn
[Docs] Prefixed Manual/*.html with "<!DOCTYPE html ...>" to
pander dotingly to (over-)sensitive editors.
09/10/2002: ttn
[Guile] Converted Examples/guile/simple "make check"
behavior to actually check execution results. Reduced
iteration counts so that the test doesn't take too long.
09/10/2002: beazley
SWIG-1.3.15 released.
Version 1.3.15 (September 9, 2002)
==================================
09/09/2002: beazley
Fixed nasty runtime type checking bug with subtypes and inheritance
and templates.
09/09/2002: cheetah (William Fulton)
[Java] Java exception classes for a method's throws clause can be generated by
specifying them in a comma separated list in the throws attribute in any one
of the following typemaps: in, out, check, freearg, argout and throws. A classic
example would be to convert C++ exceptions into a standard Java exception:
%typemap(throws, throws="java.io.IOException") file_exception {
jclass excep = jenv->FindClass("java/io/IOException");
if (excep)
jenv->ThrowNew(excep, _e.what());
return $null; // or use SWIG_fail
}
class file_exception {...};
void open(const char *filename) throw(file_exception);
The Java method will then be declared with a throws clause:
public static void open(String filename) throws java.io.IOException {...}
09/08/2002: mkoeppe
* [Guile] Improved the documentation system. The arglist no
longer gets cluttered with type specification, making it
more readable. (Also the ILISP function C-u M-x
`arglist-lisp' RET works better this way.) The types of
arguments are explained in an extra sentence after the
arglist.
There are now two documentation-related typemap arguments:
%typemap(in, doc="$NAME is a vector of integers",
arglist="$name") int *VECTOR { ... }
The "arglist" texts of all arguments of a function make up
its arglist in the documentation. The "doc" texts of all
arguments are collected to make a sentence that describes
the types of the arguments. Reasonable defaults are
provided.
As usual, $name is substituted by the name of the
argument. The new typemap variable $NAME is like $name,
but marked-up as a variable. This means that it is
upper-cased; in TeXinfo mode ("-procdocformat texinfo") it
comes out as @var{name}.
The directives %values_as_list, %values_as_vector,
%multiple_values now also have an effect on the
documentation. (This is achieved via the new pragmas
return_nothing_doc, return_one_doc, return_multi_doc.)
Documentation has also improved for variables that are
wrapped as procedures-with-setters (command-line switch
"-emit-setters").
* [Guile] Emit constants as _immutable_ variables. (This
was broken recently.)
09/07/2002: mkoeppe
[Guile] Updated the typemaps in list-vector.i.
09/07/2002: mkoeppe
Short-circuit the typechecks for overloaded functions.
(The changes in code generation are visible in the new
testcase "overload_complicated".)
09/06/2002: cheetah (William Fulton)
[Java] Solution for [ 596413 ]
New typemap so that the Java proxy classes and type wrapper classes
wrapper constructor modifier can be tailored by users. The default value is
protected. Normally SWIG generates a constructor like this which can only
be accessed within one package:
protected Bar(long cPtr, boolean cMemoryOwn) {
...
}
If you are using SWIG across multiple packages or want to use this constructor
anyway, it can now be accessed outside the package. To modify use for example:
%typemap(javaptrconstructormodifiers) SWIGTYPE "public"
to change to public for all proxy classes and similarly for all type wrapper classes:
%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "public"
09/06/2002: cheetah (William Fulton)
[Java] Added throws typemaps for the Java module. C++ exceptions get converted into
java.lang.RuntimeException Java exceptions.
Warning: This may change from java.lang.Runtime exception in the future.
09/05/2002: cheetah (William Fulton)
[Java] Fix for variables declared as references.
09/05/2002: beazley
Fixed [ 605162 ] Typemap local variables. Reported by Lyle Johnson.
09/05/2002: ljohnson (Lyle Johnson)
[Ruby] More updates to the Ruby module documentation, including
a new typemap example that demonstrates how to collect key-value
pairs from an argument list into a Hash.
09/05/2002: beazley
Fixed bug with template expansion and constructors.
template<class T> class Foo {
public:
Foo<T>() { }
};
The extra <T> in the constructor was carried through in the
name--causing runtime problems in generated modules.
Reported by Jordi Arnabat Benedicto.
09/05/2002: mkoeppe
[Guile] Support overloading.
09/04/2002: ljohnson (Lyle Johnson)
[Ruby] Updated typemaps for long long and unsigned long long types
to use Ruby 1.7 support for these types when available.
09/04/2002: ljohnson (Lyle Johnson)
[Ruby] Added output typemaps for const reference to primitive
types.
09/04/2002: mkoeppe
[Guile] Fix pass-by-value typemaps. Reported by Arno
Peters via Debian bugtracking (#156902), patch by Torsten
Landschoff <torsten@debian.org>.
09/03/2002: samjam (Sam Liddicott)
Better reference support.
Functions that want a void** can take a NULL by reference and
the void* will be made for you and then passed-by-reference
Also all integer-class native types can be passed by reference
where an int* or int& etc is needed
09/03/2002: beazley
Changed the evaluation order of preprocessor macro arguments.
Arguments are now expanded by the preprocessor *before* they
are passed to macro expansion. This fixes a subtle expansion
bug reported by Anthony Heading.
09/03/2002: beazley
Fixed the file include order (again, apparently). See 2/27/99.
09/02/2002: beazley
[Perl] Better exception handling support. Since Perl error handling
relies on setjmp/longjmp, wrapper functions have been modified slightly
to provide an extra block scope:
XS(foo) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
/* Normal wrapper function here */
...
SWIG_croak("An error occurred\n");
...
XSRETURN(argvi); /* Successful return */
fail:
/* cleanup code */
}
croak(_swig_err);
}
The macro SWIG_croak(x) sets the value of _swigerr to x and
executes a "goto fail". The whole wrapper function is enclosed
block scope to provide proper cleanup of C++ objects. Since
croak executes a longjmp(), there is no way to properly reclaim
resources if this executes in the same scope as the wrapper
function.
The _swigmsg[] variable is normally unused, but can be used
to store small error messages using sprintf or snprintf. It
has a capacity of at least 256 bytes (SWIG_MAX_ERRMSG).
09/02/2002: beazley
[Tcl] Added better support for exceptions. Instead of returning TCL_ERROR,
use the macro SWIG_fail to return with an error. This ensures that
arguments are properly cleaned up. Exception specifiers are now
handled by default.
09/02/2002: ljohnson (Lyle Johnson)
[Ruby] The type-checking system for the Ruby module has had a flaw
in that some types which should be considered equivalent
weren't. This bug was best demonstrated by the inherit_missing.i
test suite case, which defines a base class "Foo" that is
subclassed by "Bar". The "Foo" class isn't actually wrapped (i.e.
it's not directly accessible from Ruby) but we'd still like to be
able to pass "Bar" instances to functions expecting Foos and have
that work; it wasn't. The revised implementation (similar to that
used for some other language modules) adds a new instance variable
(__swigtype__) to each object that indicates its SWIG type;
that is, each "Bar" instance will now have a string instance
variable called "__swigtype__" whose value is "_p_Bar".
Unless developers were taking advantage of this low-level
implementation detail, they shouldn't notice any compatibility
problems; nevertheless, I'm marking it as a "potential
incompatibility".
*** POTENTIAL INCOMPATIBILITY ***
09/01/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed SF Bug #603199.
08/08/2002: cheetah (William Fulton)
[Java] Added OUTPUT, INPUT and INOUT typemaps in typemaps.i for C++
references.
08/27/2002: mkoeppe
[Guile] Fixed error in "lib_std_vector" testcase and
compiler warning in "lib_cdata" testcase.
08/27/2002: ljohnson (Lyle Johnson)
[Ruby] Added the "%mixin" directive, which allows the user to
specify a comma-separated list of module names to mix-in to a
class. So, for example, if you'd like to specify that Ruby's
Enumerable module should be mixed-in to your class Foo, you'd
write:
%mixin Foo "Enumerable";
or to specify that the modules Fee, Fie and Fo should be mixed
in to Foo:
%mixin Foo "Fee,Fie,Fo";
*** NEW FEATURE ***
08/27/2002: ljohnson (Lyle Johnson)
[Ruby] Modified the %alias directive so that multiple aliases
can be specified for an instance method by using a comma-separated
list of aliases.
08/27/2002: ljohnson (Lyle Johnson)
[Ruby] Added "throw" typemaps for the Ruby module.
08/26/2002: beazley
Two new command line options for printing dependencies.
'swig -M' lists all file dependencies. 'swig -MM' lists
dependencies, but excludes files in the SWIG library.
Example:
% swig -M -python example.i
example_wrap.cxx: \
/u0/beazley/Projects/lib/swig1.3/swig.swg \
/u0/beazley/Projects/lib/swig1.3/python/python.swg \
example.i \
example.h
% swig -MM -python example.i
example_wrap.cxx: \
example.i \
example.h
*** NEW FEATURE ***
08/26/2002: beazley
Fixed [ 597599 ] union in class: incorrect scope.
Reported by Art Yerkes.
08/26/2002: beazley
Fixed [ 600132 ] Default argument with namespace.
Reported by Shibukawa Yoshiki.
08/24/2002: beazley
Automatic C++ exception handling enabled for all language modules. This is
pretty simple. If you have a class like this:
class Foo {
};
class Bar {
public:
void blah() throw(Foo);
}
then the generated wrapper code looks like this:
wrap_Bar_blah() {
...
try {
arg1->blah();
}
catch (Foo &_e) {
/* "throw" typemap code inserted. $1 = _e */
}
catch (...) {
throw;
}
}
The "throw" typemap can be used to raise an error in the target
language. It can do anything. Here is a very simple example:
%typemap("throw") Foo {
PyErr_SetString(PyExc_RuntimeError, "Foo exception");
return NULL;
}
To make this work in each language module, simply define a few default
"throw" typemaps for SWIGTYPE, SWIGTYPE *, int, const char *, and a
few common exception types. That's all there is to it.
Automatic exception handling can be disabled using -noexcept or
setting the NoExcept global variable to 1.
*** NEW FEATURE ***
08/23/2002: beazley
[ Python ]
Automatic translation of C++ exception specifications into error handling code.
For example:
class Foo {
};
class Bar {
public:
void blah() throw(Foo);
}
In this case, Foo is wrapped as a classic-style class (compatible
with exception handling). Furthermore, you can write Python code
like this:
b = Bar()
try:
b.blah();
except Foo,e: # Note use of exception class here!
# Handle Foo error
...
The object "e" in the exception handler is just a wrapped Foo
object. Access it like a normal object.
If an exception is not wrapped as a class, a RuntimeError
exception is raised. The argument to this exception is
the exception object. For example:
class Bar {
public:
void blah() throw(int);
}
b = Bar()
try:
b.blah();
except RuntimeError,e:
print e.args[0] # Integer exception value
Comments:
- If a class is used as an exception, it *must* be wrapped
as a Python classic-style class (new classes don't work).
- Automatic exception handling is compatible with %exception.
- Use -noexcept to turn off this feature.
- The newly introduced "throw" typemap is used to raise
Python errors (naturally).
*** EXPERIMENTAL NEW FEATURE ***
08/23/2002: beazley
Information from throw() specifiers is now stored in the parse
tree. For example:
class Foo {
public:
int blah() throw(spam,bar);
}
The stored information is fully corrected for namespaces and works
with templates. Uses will follow.
08/22/2002: beazley
Exception handling code is no longer applied to member access
function. For example, in this code
%exception {
try {
$action
} catch(whatever) {
...
}
}
class Foo {
public:
int x;
...
}
The exception handling code is not applied to accessor functions
for Foo::x. This should reduce the amount of extra code
generated.
Caveat: Exception handling code *is* used when attributes are
accessed through a smart-pointer or a synthesized attributed
added with %extend is used.
08/22/2002: beazley
Made more patches to hopefully eliminate problems when compiling SWIG
as a 64-bit executable.
08/22/2002: beazley
Fixed a bug with const reference members, variables, and static members.
For example:
class Foo {
public:
static const int &ref;
};
SWIG was trying to generate "set" functions which wouldn't compile.
08/21/2002: beazley
Made the warning message for "Class X might abstract" off by default.
Enable with -Wall.
08/21/2002: beazley
Refined handling of const and non-const overloaded methods. If
a class defines a method like this:
class Foo {
public:
int bar(int);
int bar(int) const;
}
Then the non-const method is *always* selected in overloading and
the const method silently discarded. If running with -Wall, a warning
message will be generated.
08/19/2002: beazley
Better support for using declarations and inheritance. Consider this:
class Foo {
public:
int blah(int x);
};
class Bar {
public:
double blah(double x);
};
class FooBar : public Foo, public Bar {
public:
char *blah(char *x);
using Foo::blah;
using Bar::blah;
};
Now SWIG wraps FooBar::blah as an overloaded method that uses all
accessible versions of blah(). See section 15.2.2 in Stroustrup, 3rd Ed.
SWIG also supports access change through using declarations. For example:
class Foo {
protected:
int x;
int blah(int x);
};
class Bar : public Foo {
public:
using Foo::x;
using Foo::blah;
};
Caveat: SWIG does not actually check to see if declarations imported
via 'using' are in the inheritance hierarchy. If this occurs, the
wrapper code won't compile anyways---not sure it's worth worrying about.
08/18/2002: beazley
Modified overloading dispatch to not include nodes with an "error" attribute.
A language module can set this if a node couldn't be wrapped and you don't want
it included in the dispatch function.
08/18/2002: beazley
Enhancement to overloaded function dispatch. The dispatcher is now aware of
inheritance relationships. For example:
class Foo { };
class Bar : public Foo { };
void spam(Foo *f);
void spam(Bar *b);
In this case, the dispatcher re-orders the functions so that spam(Bar *b) is
checked first---it is more specific than spam(Foo *f).
08/17/2002: beazley
Added -Werror command line option. If supplied, warning messages are treated
as errors and SWIG will return a non-zero exit code.
08/17/2002: beazley
Fixed [ 596135 ] Typedef of reference can't compile. For example:
typedef int &IntRef;
void foo(IntRef i);
SWIG-1.3.14 generated code that wouldn't compile.
Version 1.3.14 (August 12, 2002)
================================
08/11/2002: mmatus
Static const members initialized during declaration, and
only them, ie:
struct A
{
static const int a = 1 ; // this one
static const int b; // not this one
};
are emitted like constants (equivalent to enums or
explicit %constant).
This is because they cannot be added directly to 'cvar'
since they lack the needed reference (well, you can force
them to have a real reference, but in an ugly way which
goes completely again the original purpose of initialize
them during declaration, you also have to deal with extra
linking matters, and it take a while to figure out what is
the problem and how to solve it).
Please test it with your preferred target language, and
not only the code generation, but really run the example
in the test-suite (static-const-member-2.i) because the
problem and the solution cannot be "fully" appreciated
until you try to load the module and run it.
In some target languages (python specially), this can
produces a difference in the way that the static constant
members 'a' and 'b' are internally wrapped. Hopefully,
they still can be accessed in the same way.
08/11/2002: mmatus
[python] Now static const members can be accessed in a more
natural way, ie, if you have
struct A
{
typedef unsigned int viewflags;
static const viewflags forward_field = 0;
static const viewflags backward_field;
};
now you can do:
print A.backward_field
and also
a = A()
print a.forward_field
Note that if the static const members don't have an
initializer (like backward_field), still you can access
them in the same way in the python side, but the
implementation is a quite different: backward_field will
still appear in the cvar entity, and also, you are
responsible to initialize it in some code unit, and link it
properly. forward_field, by the other hand, will not
appear in the cvar entity but only as a A member, similar
to what happen with enum or %constant members.
08/11/2002: mmatus
[python] Common code in the __setattr__/__getattr__ now
goes to two "free" methods at the beginning of the proxy
file, from where each class use it. This change reduces
the size of the proxy file, specially if you wrap a lot of
small classes in one module (up to 33% in some cases),
making it faster to load too.
08/09/2002: beazley
[Perl5] If a function that returns char * returns NULL,
undef is returned to the Perl interpreter.
08/09/2002: beazley
Fix to conversion operators and namespaces. For example:
namespace ns {
struct Foo { };
struct Bar {
operator Foo*();
};
}
In the wrapper code, SWIG was using ->operator Foo*()
when it should have been using ->operator ns::Foo*().
Note: if using %rename with a conversion operator, you
might have to do this:
%rename(toFooPtr) ns::operator ns::Foo*();
// ^^^^ note extra qualifier
namespace ns {
...
08/09/2002: beazley
[Python] Minor enhancement to 'const' variable declarations.
Normally const declarations are wrapped as read-only variables
accessible only through the cvar attribute (see SWIG.html for
a discussion of why). However, in many programs, "const"
declarations may just be constants---making the cvar. access
awkward. To fix this, "const" declarations are now available
both through cvar. and as a simple name. For example:
const int FOO = 42;
In Python:
>>> print example.cvar.FOO
42
>>> print example.FOO
42
Note: There are cases where the value of a "const" variable
might change. For example:
char *const BAR = "Hello World";
In this case, the pointer itself can not change, but the
data being pointed to could be modified. In these situations,
cvar.BAR should be accessed to obtained the current value.
08/08/2002: beazley
[Python] Fixed generation of the proxy code (.py files) to more
closely follow the order of declarations as they appear in
the .i file. In the past, all of the class wrappers appeared
first, followed by function stubs, inserted Python code, and
other details.
08/08/2002: cheetah (William Fulton)
[Java] Proxy method _delete() changed to delete(). There shouldn't ever
be a wrapped function called delete() as it is a C++ keyword and there
is no such thing as a member function in C.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
Backwards compatibility can be achieved by adding the function back in
for all proxy classes:
%typemap(javacode) SWIGTYPE %{
public void _delete() {
delete();
}
%}
Java backwards compatibility summary
------------------------------------
There are a number of changes that have been made in improving the Java module
for ver 1.3.14. If at all possible change your code to take advantages of the
improvements. If you were using proxy classes you may not notice any backwards
compatibility issues. Here is an example which will help with most backwards
compatibility problems where it is not possible to modify the code that uses
the generated output:
Replace:
%module modulename
With:
%module (jniclassname="modulename") modulename;
%typemap(javacode) SWIGTYPE %{
public long getCPtr$javaclassname() {
return swigCPtr;
}
public void _delete() {
delete();
}
%}
%pragma(java) jniclassclassmodifiers="public";
The proxy constructors that took parameters (long cPtr, boolean cMemoryOwn)
were public and are now protected. If you were making use of these then you'll
have to modify your code and the best solution would be to use the new type
wrapper classes.
The other main areas are the pragmas and global variable wrapping. Replace
the pragmas with one of the new directives or typemaps mentioned below and use
%rename on the variables.
If you were not using proxy classes, you will have to define a jstype typemap
as well as a jtype typemap.
08/08/2002: cheetah (William Fulton)
[Java] Fix for wrapping two dimension array variables.
08/07/2002: beazley
[Python,Tcl]
Object management now has a much better sense of ownership.
Ownership bits is changed whenever an object is stored in a
global variable or structure member. For example:
struct Foo {
int val;
Foo *next;
};
Now in Python
>>> f = Foo()
>>> f.thisown
1
>>> g = Foo()
>>> g.next = f # Assign a pointer
>>> f.thisown # Notice ownership change
0
>>>
This scheme is mostly a conservative heuristic designed to
provide segmentation faults. It could cause a memory leak
if ownership is changed unnecessarily. In this case, you can
either write a typemap (that doesn't change ownership), or
manually set the thisown attribute back to 1.
08/07/2002: beazley
[Tcl] Major usability improvements to the object interface.
Suppose you had code like this:
struct Foo {
int x;
int spam();
};
void blah(Foo *f);
In past versions of SWIG, you could create objects and use
them like this:
% Foo f
% f configure -x 3
% f spam
37
The only problem is that if you tried to call blah(), it didn't
work:
% blah f
Type Error. Expected _p_Foo
%
Instead, you had to do this:
% blah [f cget -this]
SWIG now automatically extracts the -this pointer, avoiding this
problem. This means that saying "blah f" is perfectly legal and
everything will still work normally.
Caveat: Since pointer strings start with a leading underscore (_),
don't use this in object names. For example:
% Foo _f
% blah _f # Potential crash
Objects now have a -thisown attribute that shows the ownership.
This builds upon the CHANGES 11/24/2001 entry.
08/07/2002: samjam, Sam Liddicott
Properly implemented pointer system using php resources.
Still need to work out whether or not to let script-users call
destructors directly
08/06/2002: beazley
Upgraded mzscheme module to support version 201 and added
overloading support.
08/05/2002: beazley
Added parsing support for extra grouping (in very limited cases).
For example:
typedef int (FuncPtr)(int, double);
*** EXPERIMENTAL ***
08/03/2002: ljohnson (Lyle Johnson)
[Ruby] Updates to typemaps.i as those done previously for Perl,
Python and Tcl modules. Now supports reference types with INPUT,
OUTPUT and INOUT typemaps.
08/02/2002: beazley
New library file cstring.i added. Provides macros for
manipulating char * data.
08/02/2002: beazley
Deprecated the %new directive. Use %newobject instead. For
example:
%newobject foo;
...
char *foo();
%newobject follows the same rules as %rename, %ignore, %feature,
etc.
*** POTENTIAL INCOMPATIBILITY ***
08/01/2002: cheetah (William Fulton)
[Java] New attribute 'jniclassname' for the module directive allows a way of
changing the JNI class name from the default which uses the modulename with JNI
appended after it.
%module (jniclassname="name") modulename
If 'name' is the same as 'modulename' then the module class name gets changed
from 'modulename' to modulenameModule.
08/01/2002: beazley
Fixed problem with file include order. Language specific
directories should take precedence over generic directories.
For example: "swig_lib/python/foo.i" should be loaded before
"swig_lib/foo.i". I thought this was the case already, but
apparently it has been broken for quite some time.
08/01/2002: beazley
Added std_deque.i library file. Work in progress.
08/01/2002: beazley
[Python,Tcl,Perl]
Improvements to typemaps.i. INPUT/INOUT typemaps perform better
error checking. Typemaps are now supplied for references like
int &OUTPUT, double &INOUT, etc.
08/01/2002: beazley
[Python] Deprecated the T_* and L_* typemaps in typemaps.i.
Multiple return values are always placed in a tuple. Deprecated
the BOTH typemaps. This is now INOUT (e.g., int *INOUT).
*** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
08/01/2002: beazley
Deprecated the array.i, carray.i, and timer.i library files.
08/01/2002: beazley
Deprecated the pointer.i library file. Use cpointer.i instead.
*** POTENTIAL INCOMPATIBILITY ***
08/01/2002: cheetah (William Fulton)
[Java] For consistency the global variable getters and setters use the JavaBean
property design pattern like member variables always have. This means if you are
wrapping a variable called foo, the getter is called getFoo() and the setter is
called setFoo(). Before the recent changes to the Java module the getters and
setters were called get_foo() and set_foo(). If you really want the original
function names use the %rename directive like this: %rename(_foo) Foo;
07/31/2002: beazley
Fixed casting problem with multiple inheritance. If you had this,
class foo {};
class bar : public foo {};
class baz : public foo {};
class spam : public bar, public baz {};
then the wrappers wouldn't compile due to an ambiguous cast.
Reported by Art Yerkes.
07/30/2002: cheetah (William Fulton)
[Java] Due to new static typechecking all pointers held in a Java long are part of
the internal workings and this pointer value in the Java long has become abstracted
data. The type wrapper constructor and getCPtr() methods are as such protected.
If you need to mess around with pointers from Java or for example create a proxy
class or type wrapper class around a null pointer, add a function/constructor
to do so with the %javacode typemap. You can also make getCPtr() public again with
the %javagetcptr typemap.
07/30/2002: cheetah (William Fulton)
[Java] Fixes for %typemap(ignore). In particular when ignoring the last parameter
in a function. Also for all parameters in constructors. These mods have also fixed
multi-argument typemaps for proxy classes - SF 581791.
07/30/2002: cheetah (William Fulton)
[Java] %newobject (replacement for %new) now implemented for Java.
07/29/2002: beazley
Fixed problem with typemap copies, %apply, and %clear inside
C++ namespaces.
07/28/2002: cheetah (William Fulton)
[Java] The JNI class now has package access as the class modifier
has been changed from "public" to nothing. This has been done
as this class is now more for the internal workings of SWIG since the module
class has static type checking for all types.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
Backwards compatibility can be achieved by using the %jniclassclassmodifier
pragma to change it back to "public".
07/28/2002: cheetah (William Fulton)
[Java] Proxy/Shadow classes are generated by default. The -proxy and
-shadow command line options are deprecated. If you want to use the
low-level functional interface then use the new -noproxy commandline option.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/28/2002: cheetah (William Fulton)
[Java] Remaining pragmas shakeup. These were the remaining pragmas and their
new names where changed:
modulebase
modulecode
moduleclassmodifiers
moduleimport => moduleimports
moduleinterface => moduleinterfaces
The moduleimports works slightly differently to how the moduleimport pragma worked.
Now it actually takes code which gets placed before the class definition so the
whole import statement has to be given, for example:
%pragma(java) moduleimports=%{
import java.io.*;
import java.math.*;
%}
The moduleinterfaces is slightly different to the old moduleinterface in that if
more than one interface is required they must be comma separated in one use of
the pragma, for example:
%pragma(java) moduleinterfaces="Serializable, MyInterface"
These last two pragmas are consistent with the javainterfaces and javaimports
typemap.
A similar set of pragmas has been introduced, namely:
jniclassbase
jniclasscode
jniclassclassmodifiers
jniclassimport
jniclassinterface
These work in the same way as their module counterparts. Note that previously
the moduleXXX pragmas worked on the old module class which is now called the
JNI class (the class with the native functions). The jniclassXXX pragmas now
work on the new module class (the class that has all the global functions and
global variable getters and setters when using proxy classes, plus all other
remaining functions when using the low-level procedural interface).
In summary the contents of the pragmas make up a class like this:
<jniclassimports>
<jniclassmodifiers> class modulename extends <jniclassbase> implements <jniclassinterfaces> {
<jniclasscode>
... SWIG generated functions ...
}
}
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/28/2002: cheetah (William Fulton)
[Java] Deprecated modulemethodmodifiers pragma and replaced with
a better %feature based directive called %javamethodmodifiers.
A useful example would be for synchronisation in multi-threaded apps:
%javamethodmodifiers foo(int a) "public synchronized";
Changes this function from the default ("public") to "public synchronized".
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/26/2002: beazley
Several directives now allow optional configuration parameters.
These include:
%module(name="value", name="value", ...) modulename
%import(name="value", ...) "filename.i"
%extend(name="value", ...) classname {
...
}
These currently have no effect and are reserved for
future expansion.
07/26/2002: beazley
Enhancements to smart-pointer handling. SWIG only provides
extra support for a smart-pointer if operator->() returns
a proper pointer. For example:
Foo *operator->();
If operator->() returns an object by value or reference,
then SWIG examines the returned object to see if it also
implements operator->(). If so, SWIG chases operator->()
until it can find one that returns a pointer. This allows
cases like this to work:
class Foo {
public:
void blah();
};
class Bar {
...
Foo *operator->();
...
};
class Spam {
...
Bar operator->();
...
};
For example:
>>> s = Spam()
>>> s.blah() # Invokes Foo::blah()
The s.blah() call actually invokes:
((s.operator->()).operator->())->blah();
07/26/2002: beazley
Fixed a bug with typedef and references. For example:
typedef Foo & FooRef;
FooRef blah();
Previous versions of SWIG generated code that wouldn't
compile.
07/25/2002: beazley
Wrapping of static methods has been improved in proxy classes. In older
versions of SWIG, if you had this:
class Foo {
public:
static void bar();
};
The static method was only available as a function Foo_bar(). For example:
>>> Foo_bar()
Now, the static method can also be invoked through an instance like this:
>>> f = Foo()
>>> f.bar() # Invokes static method
This works with all versions of Python. Additionally, for Python-2.2,
the static method can be invoked as:
>>> Foo.bar()
The old-style function is still support for backwards compatibility. If
you care about making your code across different versions of Python,
either use Foo_bar() or access the method through an instance.
07/25/2002: beazley
Changes to the Python module. Proxy classes now utilize new Python-2.2
features including properties and static methods. However, these features
are supported in a way that provides backwards compatibility with older
Python versions. In other words, proxy classes work with all versions
of Python and only use new features when running on Python-2.2.
07/25/2002: beazley
Modified %extend so that overloaded methods can be added. For example:
%extend Foo {
void bar(int x) { };
void bar(char *s) { };
...
}
This works with both C++ *and* C.
07/24/2002: cheetah (William Fulton)
[Java] More new typemaps so that the Java proxy classes and type wrapper classes
can be further tailored by users. These are the default code for generating the
finalize() methods (proxy classes only) and the getCPtr() methods for proxy
classes and type wrapper classes:
%typemap(javafinalize) SWIGTYPE %{
protected void finalize() {
_delete();
}
%}
%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
public static long getCPtr($javaclassname obj) {
return obj.swigCPtr;
}
%}
The javagetcptr typemap will enable users to handle Java null by overriding
this typemap - a requested feature.
The -nofinalize commandline option has been deprecated. The javafinalize
typemap is more powerful as it will allow the removal of the finalize methods
for all or any one or more particular proxy class.
07/23/2002: cheetah (William Fulton)
[Java] The getCPtrXXX() function has been changed to a static function and
is now of the form:
protected static long getCPtr(XXX obj) {...}
This is a requested change which will allow Java null pointers to be used as null
can be passed in for obj. However, to achieve this the appropriate code must be
written using the new javagetcptr typemap directive.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
Backwards compatibility can be achieved by adding this function back in using the
new javacode typemap:
%typemap(javacode) SWIGTYPE %{
// SWIG-1.3.12 and SWIG-1.3.13
public long getCPtr$javaclassname() {
return swigCPtr;
}
// SWIG-1.3.11 and earlier
public long getCPtr() {
return swigCPtr;
}
%}
07/23/2002: cheetah (William Fulton)
[Java] New directive to control constant code generation - %javaconst.
The default handling for handling constants is to get the value through
a JNI call, eg
#define YELLOW 5
#define BIG 1234LL
results in:
public final static int YELLOW = modulename.get_YELLOW();
public final static long BIG = modulename.get_BIG();
Earlier versions of the Java module initialised the value using the C value:
public final static int YELLOW = 5;
public final static long BIG = 1234LL;
This works in most cases, but the value for BIG won't compile as 1234LL is not
valid Java code and this is one of the reasons why the default is now to get the
values through a JNI call. The side effect is that these 'constants' cannot be used
in switch statements. The %javaconst directive allows one to specify the
way the constant value is initialised and works like other %feature
directives, eg
%javaconst(0); // all constants from this point on are initialised using the C value
%javaconst(1) BIG; // just BIG initialised using JNI call (must be parsed before BIG is defined)
07/23/2002: beazley
*** IMPORTANT CHANGES TO THE PYTHON MODULE ***
(1) The Python module now enables shadow/proxy classes by default.
This means that two files are always created by SWIG. For
instance, if you have this:
// file: foo.i
%module foo
...
Then swig generates two files "foo_wrap.c" and "foo.py".
(2) The name of the low-level C extension module has been changed
to start with a leading underscore. This means that you have
to compile the module as follows:
$ cc -c -I/usr/local/include/python2.2 foo_wrap.c
$ cc -shared foo_wrap.o $(OBJS) -o _foo.so
^^^^
note extra underscore
This naming scheme is consistent with other Python modules that
utilize extension code. For instance, the socket module consists
of "_socket.so" and "socket.py". In previous versions of SWIG,
the shared object file was named "foocmodule.so".
(3) A new directive can be used to insert Python code into
the corresponding .py file. For example:
%pythoncode %{
def foo():
print "Hello World"
%}
This directive allows you to create modules as a mix of C and Python.
Python code is seamlessly added to the module.
(4) The -shadow command line option is deprecated. This is turned on
by default.
(5) To disable the generation of the extra python file, use the "-noproxy"
command line option.
*** POTENTIAL INCOMPATIBILITY ***
This change will likely break the build environment of projects that
utilize shadow classes. To fix this, you probably only need to
change the name of the target .so file. For example, if you have
Makefile information like this:
TARGET = examplecmodule.so
Just change it to:
TARGET = _example.so
*** DOCUMENTATION UPDATE ***
The file Doc/Manual/Python.html has been updated to describe these changes.
07/23/2002: beazley
Added -noextern option. If supplied, SWIG will not generate
extra extern declarations. This is sometimes an issue on
non-unix platforms.
07/23/2002: beazley
Added a warning for ignored friend functions.
07/23/2002: beazley
Fixed [ 574498 ] -proxy and %include "pointer.i" clash.
Reported by David Creasy.
07/23/2002: beazley
Fixed [ 576103 ] global destruction warning with shadow.
Perl extensions should no longer report the warning
"Use of uninitialized value during global destruction."
when running with "perl -w". Reported by
Brett Williams.
07/23/2002: beazley
In C++ mode, SWIG now always defines namespace std. By default,
it's empty. However, this will silence errors from programs
that include statements such as "using namespace std;".
This fixes Bug [ 584017 ] using namespace std generates error.
Reported by Joseph Winston.
07/22/2002: beazley
Added a new warning message for %apply. If you use %apply but no typemaps
are defined, you will get a warning message. This should help with
problems like this:
%apply char *OUTPUT { ... };
In old versions of SWIG, this silently did nothing. Now you get an error like this:
file:line. Warning. Can't apply (char *OUTPUT). No typemaps are defined.
07/22/2002: cheetah (William Fulton)
[Java] Started Java pragma deprecation. Replacements use %typemap based
directives and enable proxy classes and the new type wrapper classes to be
tailored in various ways. These are the new typemaps:
%typemap(javabase) - base (extends) for Java class
%typemap(javaclassmodifiers) - class modifiers for the Java class: default is "public"
%typemap(javacode) - java code is copied verbatim to the Java class
%typemap(javaimports) - import statements for Java class
%typemap(javainterfaces) - interfaces (extends) for Java class
And these are the %pragma directives being deprecated:
allshadowbase
allshadowclassmodifiers
allshadowcode
allshadowimport
allshadowinterface
shadowbase
shadowclassmodifiers
shadowcode
shadowimport
shadowinterface
Note that it is possible to target a particular proxy class:
%typemap(javaimports) Foo "import java.util.*";
or a particular type wrapper class:
%typemap(javaimports) double* "import java.math.*";
Note that $javaclassname in these typemaps are substituted with either the proxy
classname when using proxy classes or the SWIGTYPE class name.
07/18/2002: cheetah (William Fulton)
[Java] Java module overhaul to implement static type checking of all
types.
1) Changes when using Java Proxy classes
----------------------------------------
Previously when wrapping global functions:
class SomeClass{};
void foo(SomeClass* s);
SomeClass* bar();
The native method prototypes used a long for pointers and looked like this:
public class modulename {
...
public final static native void foo(long jarg1);
public final static native long bar();
}
and unlike member functions of a C++ class there was no wrapper around the native calls
to make the use of them more user friendly. They would be used from Java like this:
SomeClass s = new SomeClass(modulename.bar(), false);
modulename.foo(s.getCPtrSomeClass());
Note that the following will have the same effect, but then it would not have
been possible to call any proxy member functions in SomeClass:
long s = modulename.bar();
modulename.foo(s);
Now wrapper functions are generated:
public class modulename {
public static void foo(SomeClass s) {
// calls the native function
}
public static SomeClass bar() {
// calls the native function
}
}
Which means these functions can now be used more naturally with proxy classes:
SomeClass s = modulename.bar();
modulename.foo(s);
2) Changes when not using Java Proxy classes
--------------------------------------------
The so called low-level interface was rather low-level indeed. The
new static type checking implementation makes it less so but it remains a
functional interface to the C/C++ world. Proxy classes are the obvious way to use
SWIG generated code, but for those who want a functional interface all non-primitive
types now have a simple Java class wrapper around the C/C++ type. Pointers and
references to primitive types are also wrapped by type wrapper classes. The type
wrapper classnames are based on the SWIG descriptors used by the other language
modules. For example:
C/C++ type Java type wrapper class name
---------- ----------------------------
int* SWIGTYPE_p_int
double** SWIGTYPE_p_p_double
SomeClass* SWIGTYPE_p_SomeClass
SomeClass& SWIGTYPE_p_SomeClass
SomeClass SWIGTYPE_p_SomeClass
Note that everything wrapped by SWIG is accessed via a pointer even when wrapping
functions that pass by value or reference. So the previous example would now be
used like this:
SWIGTYPE_p_SomeClass s = example.bar();
example.foo(s);
Note that typedefs that SWIG knows about are resolved, so that if one has
class Foo{};
typedef Foo Bar;
then any use of Bar will require one to use SWIGTYPE_p_Foo;
Some considerations:
Make sure you make a firm decision to use either proxy classes or the functional
interface early on as the classnames are different.
3) Pointers and non-parsed types
--------------------------------
Sometimes SWIG cannot generate a proxy class. This occurs when the definition of
a type is not parsed by SWIG, but is then used as a variable or a parameter.
For example,
void foo(Snazzy sds);
If SWIG has not parsed Snazzy it handles it simply as a pointer to a Snazzy.
The Java module gives it a type wrapper class around the pointer and calls it
SWIGTYPE_p_Snazzy. In other words it handles it in the same manner as types are
handled in the low-level functional interface. This approach is used for all
non-proxy classes, eg all pointer to pointers and pointers to primitive types.
4) Backwards compatibility
-----------------------
Backwards compatibility is not an issue if you have been using proxy classes and
no global variables/functions. Otherwise some changes will have to be made.
The native methods still exist but they are now in a JNI class, which is called
modulenameJNI. As this class is really part of the internal workings,
it should not be required so the class has become protected. Some pragmas/directives
will hopefully be added to help with backwards compatibility.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/18/2002: beazley
Modified wrapping of uninstantiated templates returned by
value. Just to be safe, they are now wrapped by SwigValueWrapper<>
just in case they don't define a default constructor. This
would be used if you had code like this
Foo<int> blah();
void moreblah(Foo<int> x);
but you didn't instantiate Foo<int> using %template.
We should probably add a warning for this.
07/17/2002: beazley
Added an error check to detect shadowed template paramaters.
For example:
template<class T> class Foo {
public:
int T;
};
This results in an error, not a warning. This warning is
also needed to fix some rather insidious problems like
this:
struct T {
int blah;
};
template<class T> class Foo {
public:
typedef T Traits; // Which T is this????
};
In this case, the template parameter T shadows the outer
structure (which is what you want).
07/16/2002: beazley
Improved support for templates with integer arguments. SWIG is
much more aware of situations such as this:
const int Size = 100;
%template(Foo100) Foo<100>;
void bar(Foo<Size> *x); // Knows that Foo<Size> is the same as Foo<100>;
07/15/2002: beazley
Fixed bug with %feature/%ignore/%rename and namespaces.
For example:
%ignore Foo::Bar
namespace Foo {
class Bar {
...
};
}
Reported by Marcelo Matus.
07/09/2002: beazley
Added parsing support for constructors that try to catch
exceptions in initializers. For example:
class Foo {
Bar b;
public:
Foo(int x) try
: b(x) { ... }
catch(int) {
...
}
}
This has no effect on the generated wrappers. However, the try and catch
parts of the declaration are ignored. See Stroustrup, 3rd Ed, section
14.4.6.1 for details.
07/06/2002: beazley
Fixed bug in template symbol table management. This fixes
two bugs. First, mixing abstract methods, templates, and
inheritance no longer generates a failed assertion.
template <class T>
class A {
public:
virtual void foo() = 0;
};
template <class T>
class B : public A<T>
{
};
%template(A_int) A<int>;
%template(B_int) B<int>;
This fix also fixes a subtle problem with default values and
templates. For example:
template <class C>
struct B {
typedef unsigned int size_type;
static const size_type nindex = static_cast<size_type>(-1);
void foo(size_type index = nindex);
};
Bugs reported by Marcelo Matus.
07/05/2002: ljohnson (Lyle Johnson)
[Ruby] Changed the definition of the SWIG_ConvertPtr() function
for the SWIG/Ruby runtime support so that it looks like the
Python version. If the last argument (flags) is non-zero,
SWIG_ConvertPtr() will raise an exception for type mismatches
as before. If flags is zero, this function will return -1 for
type mismatches without raising an exception.
*** POTENTIAL INCOMPATIBILITY FOR RUBY MODULE ***
07/04/2002: beazley
Overloaded functions/methods/constructors now work in many language
modules. The support is completely transparent--just call the
function normally and SWIG will dispatch to the correct implementation.
There are a variety of issues associated with this. Please refer
to the overloading section of Doc/Manual/SWIGPlus.html for details.
*** NEW FEATURE ***
07/04/2002: beazley
Fixed a bug with namespaces, enums, and templates. For example:
namespace hello {
enum Hello { Hi, Hola };
template <Hello H>
struct traits
{
typedef double value_type;
};
traits<Hi>::value_type say_hi()
{
return traits<Hi>::value_type(1);
}
}
SWIG wasn't generating wrappers that properly qualified
traits<Hi>. Reported by Marcelo Matus.
06/30/2002: beazley
Supplied array variable typemaps for Tcl module. If you have a
variable like this:
int foo[10];
then a set function like this is generated:
void foo_set(int *x) {
memmove(foo,x,10*sizeof(int));
}
06/30/2002: beazley
New %fragment directive. When writing typemaps, it can be easy to
get carried away and write a lot of code. However, doing so causes
tremendous code bloat. A common way to solve this is to write
helper functions. For example:
%{
void some_helper_function() {
...
}
%}
%typemap(in) type {
some_helper_function(...);
}
The only problem with this is that the wrapper file gets polluted
with helper functions even if they aren't used. To fix this,
a new fragment directive is available. For example:
%fragment("type_helper","header") %{
void some_helper_function() {
...
}
%}
%typemap(in, fragment="type_header") type {
some_helper_function(...);
}
In this case, the code fragment is only emitted if the typemap is
actually used. A similar capability is provided for declaration
annotation and the %feature directive. For example:
%feature("fragment","type_header") SomeDeclaration;
The first argument to %fragment is the fragment name. The second argument
is the file section where the fragment should be emitted.
The primary use of this directive is for writers of language modules
and advanced users wanting to streamline typemap code.
*** EXPERIMENTAL NEW FEATURE ***
06/30/2002: beazley
Supplied memberin typemaps for all arrays in an attempt to eliminate
confusion about their use.
06/29/2002: beazley
Experimental support for smart-pointers. When a class defines
operator->() like this
class Foo {
...
Bar *operator->();
...
};
SWIG locates class Bar and tries to wrap its member variables and
methods as part of Foo. For example, if Bar was defined like this:
class Bar {
public:
int x;
int spam();
};
You could do this (in the target language):
f = Foo()
f.x = 4 # Accesses Bar::x
f.spam() # Accesses Bar::spam
The primary use of this feature is to emulate the behavior of C++
smart-pointers---which allow attributes to accessed transparently
through operator->.
This feature is supported automatically in SWIG---no special directives
are needed. To disable this behavior. Use %ignore to ignore
operator->.
*** NEW FEATURE ***
06/26/2002: beazley
Deprecated the %except directive. %exception should be used instead.
06/25/2002: beazley
Major cleanup of the modules directory. Eliminated most
header files, consolidated module code into single files.
06/24/2002: beazley
Reworked the instantiation of language modules. All language
modules must now define a factory function similar to this:
extern "C" Language *
swig_python(void) {
return new PYTHON();
}
This function is then placed in a table and associated with
a command line option in swigmain.cxx.
This approach has a number of benefits. It decouples the
SWIG main program from having to know about the class
definitions for each module. Also, by using a factory
function, it will be easier to implement dynamic loading
of modules (simply load the file and invoke the factory
function).
06/24/2002: beazley
Fixed syntax error for reference conversions. For example:
operator Foo &();
06/24/2002: beazley
Fixed syntax error for operator new[] and operator delete[].
06/24/2002: beazley
Fixed code generation problem for constants and default arguments
involving templates.
06/19/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed a bug for the '-feature' command line argument;
that setting was effectively being ignored and so the feature
name was always set equal to the module name.
06/17/2002: beazley
Fixed problems with static members and enums in templates.
Version 1.3.13 (June 17, 2002)
==============================
06/16/2002: beazley
Fixed a bug with __FILE__ expansion in the preprocessor. On Windows,
the backslash (\) is now converted to (\\) in the string literal
used for __FILE__. Reported by Steve Glaser.
06/14/2002: beazley
Fixed warning message about 'name private in this context'. The
warning is only generated for public methods. Reported by
Scott Michel.
06/14/2002: beazley
Fixed some problems related to template instantiation
and namespaces. When SWIG expands a template, it does
so with fully resolved types. For example, if you have this:
template<class T> class foo { };
typedef double Double;
%template(foo_d) foo<Double>;
then, it is handled as foo<double> in the typesystem.
This fixes a number of subtle problems with inheritance
and templates.
06/14/2002: ljohnson (Lyle Johnson)
[Ruby] Added missing bool typemaps for INPUT, OUTPUT and
INOUT in Lib/ruby/typemaps.i.
05/29/2002: cheetah (William Fulton)
[Java] Fix for a couple of broken pragmas.
05/29/2002: cheetah (William Fulton)
Fix for unnecessary cast when wrapping global variable where
the type is not parsed by SWIG - Java variables example
failure as reported by Larry Virden.
06/10/2002: beazley
Modified %template to allow for empty instantiations.
%template() foo<int,int>;
This registers foo<int,int> with the type system, but
doesn't wrap it (same as %ignore). This may only be a
temporary measure. SWIG might be able to automatically
instantiate templates in certain cases.
06/10/2002: beazley
Fixed function prototype problems with Tcl 8.4
06/09/2002: beazley
Fixed problem with templates and location of base classes.
This one is a little mind-bending, but here is an example
that illustrates:
template <class ArgType, class ResType>
struct traits
{
typedef ArgType arg_type;
typedef ResType res_type;
};
template <class ArgType, class ResType>
struct Function
{
};
template <class AF, class AG>
struct Class : Function<typename traits<AF, AG>::arg_type,
typename traits<AF, AG>::res_type>
{
};
%template(traits_dd) traits <double, double>;
%template(Function_dd) Function <double, double>;
%template(Class_dd) Class <double, double>;
In this example, the base class of 'Class' is determined from
the Function template, but the types are obtained through typedefs.
Because of this, SWIG could not locate the wrapped base class
(Function<double,double>). Should be fixed in 1.3.13 even
though I can think of a million other things that might
also be broken.
06/07/2002: beazley
Fixed a problem with conversion operators. If you had an
operator like this,
operator double() const;
SWIG was ommitting the "const" qualifier. This affected
%rename and other directives. Reported by Zhong Ren.
06/07/2002: beazley
Lessened the strictness of abstract class checking. If
you have code like this:
class Foo {
public:
virtual int method() = 0;
};
class Bar : public Foo {
public:
Bar();
~Bar();
};
SWIG will go ahead and generate constructor/destructors
for Bar. However, it will also generate a warning message
that "Bar" might be abstract (since method() isn't defined).
In SWIG-1.3.12, SWIG refused to generate a constructor at all.
06/07/2002: beazley
Change to %template directive. If you specify something like this:
%template(vi) std::vector<int>;
It is *exactly* the same as this:
namespace std {
%template(vi) vector<int>;
}
SWIG-1.3.12 tried to instantiate the template outside of the namespace
using some trick. However, this was extremely problematic and full
holes. This version is safer.
06/07/2002: beazley
Fixed bug with scope qualification and templates. For example:
A<B::C>::DD
Before, this was separated as scopes A<B, C>, and DD. Fixed now.
06/06/2002: beazley
Allow the following syntax:
class A { };
struct B : A { ... };
A base class without a specifier is assumed to be public for a struct.
06/06/2002: beazley
Fixed syntax error with template constructor initializers.
Reported by Marcelo Matus.
06/06/2002: beazley
Fixed bug with default template arguments.
Reported by Marcelo Matus.
06/05/2002: beazley
Fixed subtle problems with %rename directive and template
expansion.
Code like this should now work:
%rename(blah) foo<double>::method;
...
template<class T> class foo {
public:
void method();
};
%template(whatever) foo<double>;
06/05/2002: beazley
Resolved some tricky issues of multi-pass compilation and
and inheritance. The following situation now generates
an error:
class Foo : public Bar {
...
};
class Bar {
...
};
The following code generates a warning about incomplete classes.
class Bar;
class Foo : public Bar { };
The following code generates a warning about an undefined class.
class Foo : public Bar { }; // Bar undefined
This fixes a failed assertion bug reported by Jason Stewart.
06/05/2002: ljohnson
[Ruby] Added a warning message for the Ruby module about the lack
of support for multiple inheritance. Only the first base class
listed is used and the others are ignored. (Reported by Craig
Files).
06/03/2002: beazley
Fixed a bug with struct declarations and typedef. For example:
typedef struct Foo Foo;
struct Foo {
...
};
A few other subtle struct related typing problems were
also resolved.
Version 1.3.12 (June 2, 2002)
=============================
05/30/2002: beazley
Fixed problem related to forward template class declarations and
namespaces. Bug reported by Marcelo Matus.
05/30/2002: beazley
Added 'make uninstall' target. Contributed by Joel Reed.
05/29/2002: beazley
Fixed rather insidious bug with %rename, %feature and template specialization.
For example:
%exception vector::__getitem__ {
... some exception ...
}
template<class T> class vector {
...
T __getitem__(int index); // Fine
...
};
template<> class vector<int> {
...
T __getitem__(int index); // Oops.
...
};
Now, the %exception directive (and other features) should correctly apply to
both vector and specializations.
05/29/2002: beazley
Subtle changes to %template() directive. Template arguments are now
reduced to primitive types in template matching. For example:
template<class T> class vector<T *> {
... partial specialization ...
}
typedef int *IntPtr; // Gross typedef
// Gets the above partial specialization
%template(vectorIntPtr) vector<IntPtr>;
This change is extremely subtle, but it fixes a number of potential
holes in Luigi's STL library modules. For example:
typedef int Integer;
%template(vectori) vector<int>;
05/29/2002: beazley
Fixed rather insidious typemap bug related to const. const
was being discarded through typedefs.
05/29/2002: ljohnson (Lyle Johnson)
[Ruby] Added input typemaps for const references to primitive
types (in Lib/ruby/ruby.swg).
05/29/2002: cheetah (William Fulton)
[Java] The java arrray support functions are enclosed by
a SWIG_NOARRAYS #define. Useful if not using arrays and
it is desirable to minimise the amount of compiled code.
05/29/2002: cheetah (William Fulton)
[Java] Enums were not renamed when using %name or %rename
fix.
05/28/2002: ljohnson
[Ruby] Modified the name of the wrapper functions for the
"new" singleton method and "initialize" instance method for
consistency with the other language modules. The wrapper name
for the function that implements "new" is alloc_classname and
the wrapper name for the function that implements "initialize"
is new_classname.
05/27/2002: beazley
Changes to runtime. Pointer conversion/creation functions
now almost always have an extra "flags" argument. For
example:
SWIG_ConvertPtr(obj, void **, swig_type_info *ty, int flags);
^^^^^^^^^^
This extra parameter is reserved for future expansion and will
be used for more control over pointers in future versions.
05/27/2002: beazley
Fix for C++ classes with private assignment operators. It
is now possible to safely return objects like this by value.
Caveat: the class must provide a copy constructor.
05/26/2002: beazley
-proxy option added to many language modules. This is the
same as -shadow. We are merely changing terminology.
05/26/2002: beazley
[perl] Fixed some inconsistencies in the -package option.
-package merely sets the package name to be used on the
wrappers. It does not change the name of the shared library
file or the name of the generated .pm file. This was
broken at some point, but works again now.
05/25/2002: beazley
[perl] Fixed [ 475452 ] memory leak in return-by-value.
Problem related to static member variables returning newly
allocated objects. Reported by Roy Lecates.
05/25/2002: beazley
[perl] Fixed [ 513134 ] %BLESSEDMEMBERS isn't always right.
Reported by Fleur Diana Dragan.
05/25/2002: beazley
Fixed [ 540735 ] -importall and the -I option.
05/25/2002: beazley
[guile] Fixed [ 532723 ] Default arg for char* can SegV.
Error in guile module. Reported by Brett Williams.
05/25/2002: beazley
Subtle change to typemap application code. The "freearg"
typemap must exactly match up with the "in" or "ignore"
typemap. For example:
%typemap(in) (char *data, int len) { ... };
%typemap(freearg) char *data { ... };
void foo(char *data, int len);
In this case, the "in" typemap is applied, but the
freearg typemap is not. This is because the freearg
typemap doesn't match up with the input argument sequence.
05/25/2002: beazley
Fixed [ 548272 ] Default argument code missing braces.
Reported by Brett Williams.
05/25/2002: beazley
Fixed [ 547730 ] SwigValueWrapper needed for constructors.
Reported by William Fulton.
05/25/2002: beazley
Undefined identifiers now evaluate to 0 when evaluating
preprocessor expressions. For example:
#if !FOO
...
#endif
where FOO is undefined or set to some non-numeric value.
Fixes [ 540868 ] #if defined whatever - not parsed.
Reported by Adam Hupp.
05/24/2002: beazley
SWIG now ignores the C++ 'export' keyword.
05/23/2002: beazley
Some refinement of type-name mangling to account for pointers, arrays,
references, and other embedded type constructs.
05/23/2002: beazley
Initial attempt at supporting template partial specialization. At
the very least, it is parsed and the classes are stored. Matching
of instantiations to specialized version is more limited and based on
the SWIG default typemap rules:
SWIGTYPE *
SWIGTYPE []
SWIGTYPE &
Now, why in the world would you want to use this feature? Other
than allowing for slightly modified class APIs, this capability is
primarily used to provide advanced wrapping support for STL-like
objects. It can also be mixed with typemaps. Here is an example:
/* Generic version */
template<class T> class vector {
%typemap(in) vector<T> * {
// A container of objects
}
};
/* Partial specialization (pointers) */
template<class T> class vector<T *> {
%typemap(in) vector<T> * {
// A container of pointers to objects.
}
};
/* Specialization (integers). */
template<> class vector<int> {
%typemap(in) vector<int> * {
// A container of integers.
}
};
*** EXPERIMENTAL FEATURE ***
05/23/2002: beazley
Enhancement to typemaps. Normally, typemap variables are
renamed to avoid conflicts. For example:
%typemap(in) int * (int temp) {
$1 = &temp;
}
This results in code that creates and uses variables "temp1","temp2",
"temp3" and so forth depending on how many times the typemap is used.
Sometimes you want a single variable instead. To do that, using
the following naming scheme:
%typemap(in) int *(int _global_temp) {
}
Is this case, a single variable _global_temp is emitted in the
wrapper functions. It is shared across all typemaps. Repeated
typemaps do not replicate the variable---they use the first one
emitted.
*** NEW FEATURE ***
05/23/2002: beazley
Minor enhancement to typemaps. If you have this code,
%typemap(in) Foo (int somevar = 3) {
...
}
the default value for somevar is now emitted into the wrapper code.
05/22/2002: beazley
Fixed %extend to be better behaved in namespaces. If you have code
like this:
namespace foo {
struct bar {
%extend {
void blah();
};
};
}
SWIG matches the blah() method to a C function named
void foo_bar_blah(foo::bar *self).
This is consistent with the non-namespace version.
Bug reported by Marcelo Matus.
05/22/2002: beazley
New library files: cpointer.i, carrays.i, cmalloc.i. These
provide access to C pointers and memory allocation functions.
See Doc/Manual/Library.html for details.
05/22/2002: cheetah (William Fulton)
[Java] C type char no longer maps to Java type byte, but to Java type char.
It is now treated as a character rather than a signed number. This fits in
with the other language modules and is a more natural mapping as char* is
mapped as a string of characters. Note that the C signed char type is still
mapped to a Java byte.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
05/22/2002: cheetah (William Fulton)
[Java] Improved constants wrapping. Constants (#define and %constant) values
are now obtained through a JNI call. Previously the value was compiled as
Java code, but this didn't work for all cases, eg #define 123ULL.
05/22/2002: beazley
Fixed bogus error message with %extend directive and C++
access specifiers. Reported by Marcelo Matus.
05/22/2002: beazley
Namespaces and enums now work correctly. For example:
namespace Foo {
enum Bar { A, B };
}
Bug reported by Marcelo Matus.
05/21/2002: beazley
The %types directive can now be used to specify inheritance relationships
in the runtime type system. For example,
%types(Foo = Bar);
specifies that Foo isa Bar. Using this is potentially quite dangerous.
However, this is useful in certain cases (and in the SWIG library).
05/20/2002: beazley
%nodefault and %makedefault directives now require a trailing semicolon.
For example:
%nodefault;
...
%makedefault;
In addition both directives can take a class name. For example:
%nodefault Foo;
class Foo { /* No default constructor/destructor */
};
class Bar { /* Default constructor/destructor generated */
};
*** POTENTIAL INCOMPATIBILITY ***
If you don't use the trailing semicolon, things will mysteriously break.
05/20/2002: beazley
More improvements to type system handling. SWIG now correctly handles
template names and parameters in a namespace. For example:
namespace foo {
template<class T> class bar { };
typedef int Integer;
void blah(bar<Integer> *x);
};
In the generated code, all of the typenames are properly qualified.
05/17/2002: cheetah (William Fulton)
[Java] deprecated broken -jnic and -jnicpp commandline options. The C or C++
JNI calling convention is now determined from the -c++ commandline option.
05/16/2002: cheetah (William Fulton)
[Java] The JCALL macros which exist so that the same typemaps can be used
for generating both the C and C++ JNI calling conventions no longer appear
in the generated code. This is because the output is now passed through the
SWIG preprocessor which does the macro expansion for either C or C++ (depending
on whether -c++ is passed on the SWIG commandline).
The generation of the functions used in the array typemaps have been adjusted
to take account of this. The side effect is that any typemaps which contained
JCALL macros within %{ %} brackets will have to be moved within {} brackets
so that the SWIG preprocessor can expand the macros.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
05/13/2002: beazley
Class templates may now be used as template parameters. For example:
template<class T, template<class> class C> class Foo {
...
};
template<class T> class Bar {
...
};
%template(Fooi) Foo<int, Bar>;
SWIG doesn't really do anything special with this---it's just
another way of specifying a template parameter.
05/13/2002: beazley
Minor refinement of template support. Template parameter names are no longer
required for types. For example:
template<bool> class Foo {
};
Obviously, names are required for template<class T>;
05/12/2002: beazley
New macro expansion in typemaps. The sequence:
$descriptor(type)
Will expand into the SWIG type descriptor structor for
the given type. Type may be any abstract datatype.
For example:
$descriptor(int *)
$descriptor(int (*)(int,double))
$descriptor(vector<int> *)
Caveat: It is *NOT* currently legal to use other typemap
substitution variables in the macro. For example
$descriptor($1_type).
The primary purpose of this modification is to better
support typemaps for container objects or to allow typemaps
that might be performing type conversions.
*** NEW FEATURE ***
05/11/2002: beazley
The wrapping of references to primitive types has been
changed as follows:
Arguments of type 'const primitive &' are now passed
by value as opposed to pointers. Return values of
type 'const primitive &' are returned as values instead of
pointers.
'primitive' is any one of int, short, long, long long,
char, float, double, bool (as well as unsigned variants).
This change is being made to better support C++ wrapping--especially
code that makes use of templates and the STL.
05/11/2002: beazley
The %template directive can now be used to access templates
in a namespace. For example:
namespace std {
template<class T> class complex {
T re, im;
public:
complex(T _r = T(), T _i = T()) : re(_r), im(_i) { }
T real() { return re; }
T imag() { return im; }
};
}
%template(complex) std::complex<double>;
Note: There are some very subtle namespace/symbol table
management issues involved in the implementation of this.
It may not work in certain cases.
05/10/2002: beazley
Member template constructor support added. For example:
template<typename _T1, typename _T2>
struct pair {
_T1 first;
_T2 second;
pair() : first(_T1()), second(_T2()) { }
template<class _U1, class _U2> pair(const pair<_U1,_U2> &x);
};
To instantiate the template, use %template and %extend.
For example, this expands the constructor into a default
copy constructor:
%extend pair {
%template(pair) pair<_T1,_T2>;
}
Highly experimental. Other uses may be broken.
05/10/2002: beazley
The %extend (%addmethods) directive no longer works unless
it appears in the public section of a class. An error
message is now generated (as opposed to a segmentation fault).
05/09/2002: beazley
New %warnfilter() directive. This directive attaches a warning
filter to specific declarations and has the same semantics as
%rename, %ignore, %feature, and so forth. For example:
%warnfilter(501) foo; // Suppress overloaded warning
int foo(int);
int foo(double);
or
%warnfilter(501) Object::foo(double);
class Object {
public:
int foo(int);
int foo(double);
};
This feature only suppresses warnings in later stages of code
generation. It does not suppress warnings related to preprocessing
or parsing.
*** NEW FEATURE ***
05/09/2002: beazley
SWIG now supports C99 variadic preprocessor macros. For example:
#define debugf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
The argument "..." is used to indicate variable arguments which
are all placed into the special argument name __VA_ARGS__ in
the macro expansion.
SWIG also implements the GNU (##) extension for swallowing the
preceding comma when __VA_ARGS__ is empty. For example:
#define debugf(fmt,...) fprintf(stderr,fmt, ##__VA_ARGS__)
Here is how this is expanded:
debugf("%d", 3) --> fprintf(stderr,"%d",3)
debugf("Hello") --> fprintf(stderr,"Hello" )
(notice the deleted comma).
*** NEW FEATURE ***
05/08/2002: samjam (Sam Liddicott)
Many changes to php module. Shadow classes are now implemented
entirely in native C and no need for php-code shadow wrappers
Populated template config.m4 and Makefile.in as needed by
phpize are generated.
05/08/2002: ljohnson (Lyle Johnson)
[Ruby] A copy constructor is now turned into a "clone"
instance method (see Dave's change for copy constructors
dated 4/7/2002). This seems like the appropriate thing
to do for Ruby code.
05/08/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed [ 553864 ] Inline destructor code not written.
05/08/2002: beazley
%ignore behaves better with constructors, destructors, and the
type system in general. For constructors and destructors,
%ignore now suppresses the creation of a default constructor
or destructor. For example:
%ignore ~Foo;
class Foo {
public:
Foo();
~Foo();
...
};
In SWIG-1.3.11, ~Foo() simply "disappeared" and the code generator
created a wrapper for a default destructor (as if it was never
declared in the interface). In SWIG-1.3.12, %ignore suppresses
the creation of a destructor if one is actually defined.
Similarly, even though a declaration is ignored, information
may still be needed to properly handle types. For example, here
is a very subtle error that is fixed by this change:
%ignore std::string; // Prevent class wrapping
namespace std {
class string {
...
};
%typemap(in) string * {
...
}
}
void foo(std::string *s); // Broken.
Before this fix, %ignore would cause the class definition to disappear.
This, in turn, would cause the typemap to be misapplied.
05/08/2002: beazley
Minor changes to %rename, %ignore, %feature, and related directives
for better support of destructors. Destructors can now be precisely
tagged. For example:
%ignore Foo::~Foo;
%feature("action") ~Bar {
...
}
*Developer warning*
Operations such as renaming and feature attachment for classes used to
be applied to destructors as well. For instance, if you did this:
%rename(Bar) Foo;
The operation applied to the class itself, the constructor, and
the destructor. This is no longer the case. Now such operations
will only apply to the class and the constructor. Note: if you
were relying on this for class renaming, be aware that renamed
classes should really only be handled at the level of the class itself
and not the level of individual declarations in the class (although
they can be renamed individually if needed). As far as I know,
the Language class is already taking care of this case correctly.
05/07/2002: beazley
New set of tests. The Examples/test-suite/errors directory contains
tests that try to exercise all of SWIG's error and warning messages.
05/07/2002: beazley
Start of a warning framework. Warning messages are now assigned numeric values
that are shown in warning messages. These can be suppressed using the
-w option. For example:
swig -w302 example.i
swig -w302,305 example.i
Alternatively, the #pragma preprocessor directive can be used to disable this:
#pragma SWIG nowarn=302
#pragma SWIG nowarn=302,305
Note: Since SWIG is a multi-pass compiler, this pragma should
only be used to change global settings of the warning filter. It should
not be used to selectively enable/disable warnings in an interface file.
The handling of #pragma occurs in the C++ preprocoessor and affects all
subsequent stages of compilation.
The -Wall option turns on all warnings and overrides any filters that
might have been set.
Warnings can be issued from an interface using %warn. For example:
%warn "110:%section is deprecated"
The first part of a warning message is an optional warning number.
A complete set of warning numbers is found in Source/Include/swigwarn.h.
*** NEW FEATURE ***
05/07/2002: beazley
Internal parsing change. Directives to include files now use brackets [ ... ]
instead of { ... }.
%includefile "foo.i" [
...
]
The use of { ... } was a bad choice because they were included implicitly by
the preprocessor and made it impossible to properly detect legitimate missing '}'
errors.
04/16/2002-
05/02/2002: beazley
SWIG European Tour: Paris-Amsterdam-Bath.
04/23/2002: beazley
The %addmethods directive has been renamed to %extend.
For example:
class Foo {
...
};
%extend Foo {
int blah() { ... };
int bar() { ... };
...
};
Motivation: the %addmethods directive can be used for many
other tasks including adding synthesized attributes, constructors,
and typemaps. Because of this, "addmethods" is somewhat misleading.
%extend more precisely describes this operation---extension of a
class or structure.
*** POTENTIAL INCOMPATIBILITY ***
%addmethods still works via a macro definition. However,
a warning message may be generated. Errors involving %addmethods
will actually refer to the %extend directive.
04/23/2002: beazley
Further refinement of the type system. Typedef now
propagates through functions, pointers to functions,
and pointers to member functions.
For example:
typedef int Integer;
void foo(int (*x)(int), Integer (*y)(Integer));
In this case, arguments 'x' and 'y' have exactly
the same type (and would obviously accept objects
of either type).
Similarly, consider this:
class Foo {
};
typedef Foo Bar;
void bar(int (Foo::*x)(int), int (Bar::*y)(int));
In this case, arguments x and y are the same
type (via typedef).
04/22/2002: beazley
SWIG now generates a warning message if any part of
an expression involves values from a private part of a class.
For example:
class Foo {
private:
static int X;
public:
void blah(int a, int b = X); // Warning
};
In this case, the default argument is ignored. There
are workarounds, but they are rather clumsy. For instance,
you might do this:
%feature("action") blah(int,int) {
if ($nargs == 1) {
result = blah(arg1);
} else {
result = blah(arg1,arg2);
}
}
void blah(int a, int b = 0);
04/21/2002: beazley
Use of the %inline directive inside a namespace is
forbidden and now generates an error message. This is
not allowed since the inlined code that is emitted is
not placed inside a namespace. This confuses other
stages of parsing.
04/21/2002: beazley
Some bug fixes to casting operations and expression
parsing. Due to some parsing issues, it is not
currently possible to use casts for all possible
datatypes. However, the common cases work.
04/20/2002: beazley (Amsterdam)
Member templates now work. Simply use the %template
directive inside a class or %addmethods to create
instantiations (see Doc/Manual/SWIGPlus.html). Supporting
this was easy---earlier changes to templates made it
possible using only a two-line modification to the parser
and a few minor modifications elsewhere. Hmmm, come to
think of it, the smoke was rather thick in that Internet "cafe".
*** NEW FEATURE ***
04/19/2002: beazley (TGV)
Improved handling of non-type template parameters. For example:
vector<int,100>;
Simple numbers and strings can be used with the %template
directive as well. For example:
%template(vecint100) vector<int,100>;
Note: Arithmetic expressions are not currently allowed.
Default template arguments now work and do not have to
be given to %template.
04/18/2002: beazley (Paris)
Change in internal template handling. Template
parameters are now fully integrated into the type
system and are aware of typedefs, etc. This builds
upon the change below.
*** DEVELOPER WARNING ***
Word of caution to language module writers. The "name"
parameter of certain parse tree nodes (classes, functions, etc.)
may be parameterized with types. This parameterization is
done using SWIG type-strings and not the underlying C version.
For example,
int max<int *>(int *,int *)
has a name of "max<(p.int)>". If you use the name directly,
you may get syntax errors in the generated code. To fix this,
use SwigType_namestr(name) to convert a parameterized name
to a C name with valid syntax. The internal version is
used to reduce template types to a common representation
and to handle issues of typedef.
04/16/2002: beazley (somewhere over the Atlantic)
Enhancement of typedef resolution. The type system is now
aware of template arguments and typedef. For example:
typedef int Integer;
foo(vector<int> *x, vector<Integer> *y);
In this case, vector<int> and vector<Integer> are
the same type. There is some interaction between this
mechanism and the implementation of typemaps. For example,
a typemap defined for vector<int> * would apply to either type.
However, a typemap for vector<Integer> * would only apply to
that type.
Typedefs and typemaps and matched by left-most expansion.
For example:
vector<Integer,Integer> -->
vector<int, Integer> -->
vector<int, int>
04/24/2002: cheetah (William Fulton)
[Java] Changes to Java shadow classes.
Overcomes a bug where the module assumed that a pointer to a derived
class could be used in place of a pointer to a base class. Thanks
to Stephen McCaul for analysing the bug and submitting patches.
A consequence is that the getCPtr() method in each shadow class has
disappeared and has been replaced with a getCPtrXXX(), where XXX is the
shadow class name. If you have code that previously used getCPtr(),
and the associated class is wrapping a C struct or a C++ class that
is not involved in an inheritance chain, just use the new method. If
however, the class is involved in an inheritance chain, you'll have
to choose which pointer you really want. Backwards compatibility
has been broken as not using the correct pointer can lead to weird bugs
through ill-defined behaviour. If you are sure you want the old methods,
you could add them back into all shadow classes by adding this at the
beginning of your interface file:
%pragma(java) allshadowcode=%{
public long getCPtr(){
return swigCPtr;
}
%}
Please see entry dated 07/23/2002 to see how to do this after the deprecation
of the allshadowcode pragma.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
04/13/2002: beazley
Fixed problem with default arguments and references. Declarations such
as this should now work:
void foo(const string &x = "Hello");
04/12/2002: beazley
Added typemap $* substitutions for typemaps involving arrays.
Requested by William Fulton.
04/11/2002: beazley
Template specialization is now supported. For example:
template<> class vector<int> {
...
};
When the %template directive is used, it will use a specialization
if one is defined. There are still some limitations. Partial
specialization is not supported. A template of type <void *> does
not match all pointers.
*** NEW FEATURE ***
04/11/2002: beazley
Major change to template wrapping internals. Template declarations are
no longer processed as macros but now result in real parse-tree
nodes. The %template directive expands these nodes into a
specific instantiation. This change enables a number of
new and interesting capabilities:
Directives such as %rename, %feature, and %addmethods can
now be applied to uninstantiated templates. For example:
%rename(barsize) vector::bar(char *buf, int len);
...
template<typename T> class vector {
public:
...
void bar(char *buf);
void bar(char *buf, int len); // Renamed
...
};
%template(intvector) vector<int>; // Renaming carries through
By parsing templates into an internal data structure, it will
be possible to support specialization (and maybe partial
specialization).
This is highly experimental and a work in progress.
*** POTENTIAL INCOMPATIBILITY ***
In SWIG-1.3.11, template declarations were simply processed
as weird macros. No other information was retained. This
made it impossible to support more advanced features and
complicated many other parts of the implementation.
04/09/2002: beazley
Change to template class wrapping. There were a variety of
"issues" with the old approach related to parsing, the type
system, and namespaces. These changes are meant to rectify
some of these problems:
A specific instantiation of a template can now be specified
by including the class inline like this:
class vector<int> {
public:
vector();
~vector();
... whatever ...
};
This is template specialization, but partial specialization is
not yet implemented.
The %template directive has been modified to expand roughly as
follows:
%template(vecint) vector<int>;
becomes
%rename(vecint> vector<int>;
class vector<int> {
public:
vector();
...
};
Note that this simply builds upon the code above (templates
included inline).
This modified approach to wrapping fixes some subtle type
issues. For instance, you can now define typemaps and typedefs
like this:
%typemap(in) vector<int> * {
...
}
typedef vector<int> intvector;
...
void blah(intvector *v); // Gets the above typemap
This did not work in SWIG-1.3.11 due to a peculiarity of
the template implementation.
%template(name) no longer installs the template as a class
with name "name". This might break %addmethods as described
in the manual. For example:
%template(vecint) vector<int>;
%addmethods vecint { // Fails. vecint not a class
...
};
To fix this, just use the template name instead:
%addmethods vector<int> {
...
}
Note: This technique might be a way to implement some bizarre
template specialization techniques. For example:
%addmethods vector<int> {
// Only applied if vector<int> instantiated later
%typemap(in) vector<int> * {
...
}
...
};
*** POTENTIAL INCOMPATIBILITY ***
04/08/2002: beazley
Fixed [ 540868 ] #if defined whatever - not parsed. SWIG should
now correctly handle preprocessor directives like this:
#if defined __cplusplus
...
#endif
Note: was implemented previously, but there was a minor bug.
Reported by Adam Hupp.
04/07/2002: beazley
%readonly and %readwrite are deprecated due to a change in the
implementation. Instead of being pragmas, mutability is now
controlled as a "feature" using the following two directives:
%immutable;
int x; // read-only variable
int y; // read-only variable
%mutable;
int z; // Modifiable
%immutable and %mutable are much more powerful than their older
counterparts. They can now pinpoint a specific declaration like
this:
%immutable x; /* Any x */
%immutable Foo::x; /* x in class Foo */
In fact, the matching algorithm is the same as for %rename,
%ignore, and other directives. This means that the declaration
%immutable Foo::x;
would not only apply to class Foo but to all derived classes
as well.
*** POTENTIAL INCOMPATIBILITY ***
%immutable and %mutable must be terminated by a semi-colon. This
differs slightly from the older %readonly and %readwrite directives.
Since %immutable and %mutable can be applied to declarations the
semicolon is needed to distinguish between a global feature and
one targeted to a single declaration. Note: this incompatibility is the
primary reason for changing the name of the directive.
04/07/2002: beazley
New handling of copy constructors. If a class defines
constructors like this:
class Foo {
public:
Foo();
Foo(const Foo &); // Copy constructor
...
};
SWIG now generates a function copy_Foo() for the copy
constructor.
In previous verions, this generated a name-clash and an
error message. To preserve backwards compatibility, SWIG
does not change the behavior if %rename is used to resolve
the name conflict. However, if no name resolution is made,
this new approach is used.
Copy constructors may be handled as a special case in the
target language. However, this is up to the language module
itself.
04/07/2002: beazley
The %template directive is now namespace aware. This allows
code like this:
namespace foo {
template<typename T> max(T a, T b) { return a > b ? a : b; }
}
using namespace foo;
%template(maxint) max<int>; // Ok
namespace bar {
using foo::max;
%template(maxdouble) max<double>; // Ok
}
Caveat: the template name supplied to %template must be defined in the
same scope in which the %template directive appears. This code is
illegal:
%template(maxint) foo::max<int>;
04/07/2002: beazley
Minor enhancement to preprocessor. The preprocessor can now perform
string comparison. For example:
#define A "hello"
...
#if A == "hello"
...
#endif
The primary use of this is in SWIG macros. For example:
%define FOO(x)
#if #x == "int"
/* Special handling for int */
...
#endif
%enddef
Normal users can probably safely ignore this feature. However, it may
be used in parts of the SWIG library.
04/07/2002: beazley
Further refinement of default constructor/destructor wrapper generation.
SWIG is now much more aware of pure virtual methods. For instance:
class A { /* Abstract */
public:
virtual void method1() = 0;
virtual void method2() = 0;
};
class B : public A { /* Abstract */
public:
virtual void method1() { };
};
class C : public B { /* Ok */
public:
virtual void method2() { };
};
In this case, SWIG will only generate default constructors for C.
Even though B looks fine, it's missing a required method and is abstract.
04/04/2002: beazley
Subtle change to structure data member access. If you
have a structure like this:
struct Foo {
Bar b;
};
The accessor functions for b are generated as follows:
(1) If b is *not* defined as a structure or class:
Bar Foo_b_get(Foo *self) {
return self->b;
}
void Foo_b_set(Foo *self, Bar value) {
self->b = value;
}
(2) If b *is* defined as a structure or class:
Bar *Foo_b_get(Foo *self) {
return &self->b;
}
void Foo_b_set(Foo *self, Bar *value) {
self->b = *value;
}
See the "Structure data members" section of Doc/Manual/SWIG.html
for further details.
*** POTENTIAL INCOMPATIBILITY ***
This may break interfaces that relied on a lot of a undeclared
structure and class names. To get the old behavior, simply
use a forward declaration such as "struct Bar;"
04/04/2002: beazley
C++ namespace support added. SWIG supports all aspects of
namespaces including namespace, using, and namespace alias
declarations. The default behavior of SWIG is to flatten
namespaces in the target language. However, namespaces are
fully supported at the C++ level and in the type system.
See Doc/Manual/SWIGPlus.html for details on the implementation.
04/02/2002: cheetah (William Fulton)
[Java] Sun has modified javac in jdk1.4 to no longer compile
an import of an unnamed namespace. To fix this SWIG no longer
generates the import for packageless classes.
http://developer.java.sun.com/developer/bugParade/bugs/4361575.html
As reported SF #538415.
03/27/2002: ljohnson (Lyle Johnson)
[Ruby] Added support for pointer-to-member, similar to that
for the Python module. Remarkably similar. Also added a new
example for this (Examples/ruby/mpointer), which is remarkably
similar to the Python example of the same name.
03/26/2002: ljohnson (Lyle Johnson)
[Ruby] Made a few minor edits to the "Advanced Topics"
chapter of the SWIG manual and added a new major section
about how to create multi-module Ruby packages with SWIG.
03/26/2002: ljohnson (Lyle Johnson)
[Ruby] Removed all of the old Ruby pragmas. If any of this
functionality is truly missed we can resurrect it, preferably
with some kind of feature-based directive.
03/25/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed SWIG exception library support for Ruby, which
has apparently been broken for some time. Luckily, no one seems
to have noticed.
03/23/2002: beazley
C++-namespace support in SWIG directives.
%addmethods:
The %addmethods directive now accepts a fully qualified classname
and can be used inside C++ namespace declarations. For example:
// Attaches to the class Foo::Bar below
%addmethods Foo::Bar {
int somemethod() { ... }
};
namespace Foo {
class Bar {
public:
...
};
// Attaches to the class Bar above
%addmethods Bar {
int othermethod() { ... };
}
}
%feature, %rename, %ignore, %exception, and related directives:
Namespaces are fully integrated into the the renaming and declaration
matcher. For example:
%rename(display) Foo::print; // Rename in namespace Foo
%ignore Foo::Bar::blah; // Ignore a declaration
%rename directives can be placed inside namespace blocks as well. For
example:
namespace Foo {
%rename(display) print; // Applies to print below
void print();
};
Most other SWIG directives should work properly inside namespaces.
No other changes are needed.
03/22/2002: beazley
Some changes to internal symbol table handling. SWIG no longer
manages structures and unions in a separate namespace than normal
declarations like ANSI C. This means you can't have a structure
with the same name as a function. For example:
struct Foo {
...
}
int Foo() { ... }
This approach is more like C++. It's not clear that SWIG ever
really supported the ANSI C anyways---using the same name would
almost certainly generate a name-clash in the target language.
03/22/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed [ 517302 ] for handling of renamed overloaded
constructors. Now, renamed overloaded constructors are converted
into class singleton methods (basically acting as "factory"
methods).
03/21/2002: beazley
Fixed [ 532957 ] %ignore parse error and casting operator.
Reported by William Fulton.
03/18/2002: beazley (** ADVANCED USERS ONLY **)
Added support for dynamic casting in return values. A somewhat
common problem in certain C++ programs is functions that hide
the identity of underlying objects when they are returned
from methods and functions. For example, a program might include
some generic method like this:
Node *getNode();
However, Node * may just be base class to a whole hierarchy
of different objects. Instead of returning this generic Node *,
it might be nice to automatically downcast the object into the
appropriate type using some kind dynamic cast.
Assuming you understand the peril involved, a downcast can now
be performed using the following function in the run-time type
checker:
swig_type_info *SWIG_TypeDynamicCast(swig_type_info *, void **ptr);
This function checks to see if the type can be converted to another
type. If so, a different type descriptor (for the converted type)
is returned. This type descriptor would then be used to create
a pointer in the target language.
To use this, you would write a typemap similar to this:
%typemap(out) Node * {
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
$result = SWIG_NewPointerObj($1, ty);
}
Alternatively,
%typemap(out) Node * = SWIGTYPE *DYNAMIC;
To make the typemap have any effect, you have to write a supporting
function that knows how to perform downcasting. For example:
%{
static swig_type_info *
Node_dynamic_cast(void **ptr) {
Node **nptr = (Node **) ptr;
Element *e = dynamic_cast<Element *>(*nptr);
if (e) {
*ptr = (void *) e;
return SWIGTYPE_p_Element;
}
Data *d = dynamic_cast<Data *>(*nptr);
if (d) {
*ptr = (void *) d;
return SWIGTYPE_p_Data;
}
return 0;
}
%}
There is no restriction on how types are determined. dynamic_cast<>
uses C++ RTTI. However, if you had some other mechanism for determining
the type, you could use that here. Note: it is important to save
the new pointer value back into the argument as shown. When downcasting,
the value of the pointer could change.
Finally, to make the casting function available, you have to register
it with the run-time type checker. Put this macro in your interface file.
DYNAMIC_CAST(SWIGTYPE_p_Node, Node_dynamic_cast);
Note: this feature does not introduce a performance penalty on
normal SWIG operation. The feature is only enabled by writing
a new typemap that explicitly calls SWIG_TypeDynamicCast() to
make a conversion.
Examples/test-suite/dynamic_cast.i contains a simple example.
This feature is not supported in the Java module due to differences
in the type-checking implementation.
*** EXPERIMENTAL FEATURE ***
03/17/2002: beazley
Small change to type-name handling of unnamed structures and
typedef. If a structure of this form appears:
typedef struct {
...
} Foo;
Then 'Foo' is used as the proper typename for the structure.
Furthermore, Foo can now be used as a name in C++ inheritance.
SWIG was already kind of doing this, but this modification refines
the implementation to more closely follow the C++ ARM, section
7.1.3, p. 106. This fixes a couple of obscure corner cases.
03/16/2002: beazley
Modified C++ inheritance with a few enhancements. First, type information
needed for casting and type-equivalence is generated even when base-classes
aren't defined in the interface. For example:
class Foo : public Bar { /* Bar unspecified */
public:
...
};
void blah(Bar *b);
In this case, the blah() function still accepts Foo * even though nothing
is really known about Bar. Previous SWIG versions would just generate
a type error.
Inheritance has also been modified to work through typedef. For example:
class Bar {
};
typedef Bar OtherBar;
class Foo: public OtherBar {
}
In this case, the base class of OtherBar is correctly resolved back to
Bar. The use of the name OtherBar is lost in this resolution (the wrappers
will simply use Bar instead of the typedef name OtherBar).
03/13/2002: beazley
%typemap, %apply, and related directives can now appear inside
class definitions.
03/13/2002: beazley
Fixed a variety of problems related to compiling SWIG on 64-bit
platforms.
03/12/2002: beazley
Fixed problem with "ignore" and "in" typemaps. Local variables
associated with "in" were being added to the wrapper function even
though they were never used. Mostly harmless, but it would lead
to a variety of compilation warnings.
03/12/2002: beazley
Some changes to the internal type system and handling of nested C++
types. In previous versions of SWIG, if you had the following:
class Foo {
public:
typedef int Blah;
};
class Bar : public Foo {
public:
void somemethod(Blah x);
};
The argument type in somemethod() would implicitly be set to Bar::Blah.
Although this is technically allowed, it breaks typemaps. For example:
%typemap(in) Foo::Blah { ... }
doesn't match like you expect. This has been changed in SWIG-1.3.12.
Now, types are expanded using the class in which they were defined.
So, the argument type in somemethod() will be Foo::Blah---since the
type Blah was defined in Foo.
03/10/2002: beazley
Fixed some subtle type scoping problems with typedef and C++ classes.
For example:
typedef int Blah;
class Bar {
public:
typedef double Blah;
void foo(Blah x, ::Blah y);
...
}
03/10/2002: beazley
Highly experimental change to handle variable length arguments.
First, there is no portable or reliable way to wrap
a varargs function in full generality. However, you *can* change
the function signature using %varargs.
%varargs(char *) fprintf;
...
void fprintf(FILE *f, char *fmt, ...);
In this case, the variable length parameter "..." is
simply replaced by the parameters given in %varargs. This
results in a function like this:
void fprintf(FILE *f, char *fmt, char *s);
More than one argument can be used and default values
can be defined. For example, this code specifies a
maximum of four arguments.
%varargs(char *x1 = 0, char *x2 = 0, char *x3 = 0, char *x4 = 0) fprintf;
*** EXPERIMENTAL NEW FEATURE ***
03/10/2002: beazley
Change to handling of variable length arguments. varargs
is now handled as a proper parameter and is passed to the
code generator. However, it still can't be handled correctly
(and will generate a typemap warning). This change has been
made to better incorporate variable length arguments with other
directives such as %ignore, %rename, %feature, and so forth.
03/10/2002: beazley
Fixed [ 522555 ] Syntax error parsing "define" construct. SWIG
is a little more restrictive in determining #define statements
that will be wrapped as constants. Also added a better parser
error rule for handling bad constants.
03/08/2002: cheetah (William Fulton)
[Java] Bug fix: Classes renamed with %rename that are derived from
another class generate more appropriate shadow class code.
03/08/2002: cheetah (William Fulton)
[Java] Fixed SF [ #523632 ] and [ #513335 ] both reported by Israel
Tanner. Support for types that are used which are in a typedef. The
appropriate shadow class name is generated. Also generated correct
shadow classname when a templated class is used within another
templated class. See the cpp_typedef.i testcase.
03/08/2002: cheetah (William Fulton)
[Java] Bug fix: No type was generated in shadow classes for types
that weren't wrapped by SWIG. The type is treated as a raw
pointer, ie no shadow class.
02/22/2002: beazley
Refined the matching algorithm used by %rename, %ignore, and
%feature. If a type signature is supplied, it must exactly
match that used in the declaration---including any use of
const. For example:
%rename(foo1) foo(int);
%rename(bar1) bar(int) const;
class Blah {
public:
void foo(int); // Matched --> foo1
void foo(int) const; // Not matched
void bar(int); // Not matched
void bar(int) const; // Matched --> bar1
}
In previous versions, a non-const specification would match
both the non-const and const declarations. However, the whole
point of %rename and related directives is that they be able
to precisely pinpoint exact declarations in an interface. This
fixes the problem.
02/21/2002: beazley
Reworked the handling of default constructor and destructors.
SWIG now makes a preliminary pass over the parse tree to discover
which classes support default allocation. This fixes a number
of very subtle issues in code generation and call/return by value.
02/18/2002: cheetah (William Fulton)
Improved support on Cygwin: Perl, Python, Tcl, Ruby and Java should
work out of the box, barring the runtime library. Removed dllwrap
and replaced with newly working gcc -shared instead for Cygwin.
All this will require the new improved binutils 20010802 and later,
but the latest Cygwin is usually the best recommendation.
02/15/2002: beazley
Fixed some problems related to wrapping of global variables
and Perl shadow classes. Reported by Chia-liang Kao.
02/15/2002: ljohnson (Lyle Johnson)
[Ruby] Made a fix to the code generation for C++ class
constructors so that we get both a "new" singleton method
and an "initialize" instance method for each class. This
change enables developers to derive new Ruby classes from
SWIG-wrapped C++ classes and then override their initialize
methods to provide subclass-specific instance initialization.
02/15/2002: ljohnson (Lyle Johnson)
[Ruby] Massive documentation update for the Ruby module,
contributed by Craig Files.
02/14/2002: ljohnson (Lyle Johnson)
[Ruby] Bug fix: An error in the SWIG runtime support for Ruby
was causing several of the examples to fail. Reported by
William Fulton.
02/14/2002: ljohnson (Lyle Johnson)
[Ruby] Bug fix: Enumerations defined within a class (such
as those seen in the Examples/ruby/enum example) were not
being exported with the correct names. Reported by William
Fulton.
02/13/2002: ljohnson (Lyle Johnson)
[Ruby] Added a warning message when we run across overloaded
class constructors for C++ code, that this is currently not
supported (even if the overloads have been %renamed). For an
example of where this doesn't work, see Examples/ruby/operator.
02/13/2002: ljohnson (Lyle Johnson)
[Ruby] Added an "ignored" warning message when the parser runs
across an operator!=() declaration for C++ code.
02/11/2002: ljohnson (Lyle Johnson)
[Ruby] Added the "import", "import_template", "operator" and
"template" examples.
02/11/2002: ljohnson (Lyle Johnson)
[Ruby] Added multi-module support.
02/09/2002: ljohnson (Lyle Johnson)
[Ruby] Added the missing "#define SWIG_NOINCLUDE" at the top of
the wrapper code when the '-c' option is used.
02/09/2002: ljohnson (Lyle Johnson)
Corrected a minor off-by-one error for the size of the
swig_types[] array that's generated in the wrapper code.
02/08/2002: beazley
Fixed SF [ #515058 ] Wrong code for C++ templates.
Reported by Israel Taller.
Version 1.3.11 (January 31, 2002)
=================================
01/30/2002: beazley
Fix to pass/return by value for C++ objects that define
no default constructor. Changes to the typemap system
made it impossible to wrap C++ objects with no default
constructor. This has been fixed, but the solution
involves some clever template magic contributed by
William Fulton. Please see the comments in the file
Lib/swig.swg for further details. This solution is
experimental and may be refined in a future release.
01/30/2002: beazley
Global variables and member data of type "const char *"
can be set, but the old value is silently discarded without
any garbage collection. This may generate a memory leak.
This change is needed to more safely handle variables
like this:
const char *foo = "Hello World\n";
In this case, it's not safe to free the old value. However,
SWIG can dynamically allocate a new value and make foo point
to it. To fix this memory leak, you can probably do this:
%clear const char *foo;
%apply char * {const char *foo};
*** POTENTIAL INCOMPATIBILITY ***
01/30/2002: beazley
Two minor typemap enhancements have been added. First,
typemaps can issue a warning message by including a special
warning attribute. For example:
%typemap(in,warning="I'm going to do something dangerous") ...
The warning message will show up whenever the typemap is
applied.
Second, a typemap can force a no-match by defining
%typemap(in) sometype "pass";
If this is used, the typemap system will *not* record a
typemap match for "sometype". This can be used to block
selected typemaps. For example, if you wanted to disable
a typemap feature for some type, you could do this.
// Do not allow global variables of type 'const char *' to be set.
%typemap(varin) const char * "pass";
It might also be possible to use this to do subtle and
strange things with typemaps. For example, if you wanted to
make 'blah *' an output value and 'const blah *' an input
parameter, you might do this:
%typemap(ignore) blah *(blah temp) {
$1 = &temp;
}
%typemap(argout) blah * {
... return a value ...
}
/* Block unqualified typemaps defined above */
%typemap(ignore) const blah * "pass";
%typemap(argout) const blah * "pass";
%typemap(in) const blah * {
... get input value ...
}
(This potential applications of typemaps suggested by Greg Stein).
*** NEW FEATURE ***
01/29/2002: cheetah (william fulton)
[Java] Bug fix: No enumerations were wrapped when the -shadow
commandline option was not specified. Reported by Israel Taller.
01/28/2002: cheetah (william fulton)
[Java] Global arrays are successfully wrapped. In fact they started
mostly working in SWIG-1.3.10.
01/28/2002:richardp
Added first attempt at C++ and -shadow support for PHP4 module,
please test and mail me if any problems/ideas on improving it.
There is a known problem with uninitialized member variables,
please see Examples/php4/sync/README for details.
Also more PHP documentation added to Doc/Manual/Php.html
01/27/2002:beazley
The ANSI C size_t type is now recognized as an integer by default.
01/26/2002:beazley
long long and unsigned long long support added to many language modules.
This is not a portable feature and will require compiler support
for the long long type. In target languages that do not support
long long (e.g., Tcl and Perl), numbers are converted to a string
of digits. This prevents their use in arithmetic calculations, but
still allows values to be set from a string.
long long support requires the use of the strtoll() and strtoull()
functions as well as the 'lld' and 'llu' format specifiers
of sprintf().
01/26/2002:beazley
Fixed [ #501827 ] Delete method is not called. The Tcl
module wasn't correctly calling destructors when they
were defined using %addmethods. This has been fixed.
Reported by Reinhard Fobbe.
01/26/2002: beazley
Better support for long long and unsigned long long. Typemaps
have been included in a number of modules for handling these types.
In addition, the parser has been modified to accept long long
literals such as 1234LL and 1234ULL.
01/27/2002: cheetah (william fulton)
[Java] A C char[] is mapped to a Java String which is the default
SWIG handling of char[] and char*. It used to be mapped to byte[].
Note that a C signed char[] array is mapped to byte[].
*** POTENTIAL INCOMPATIBILITY ***
01/25/2002: beazley
Fixed a problem with return-by-value, C++, and
objects that define no default constructor.
Reported by Joel Reed.
01/25/2002: cheetah (william fulton)
[Java] Overhaul of the Java module. The C code generation is now
done from typemaps.
01/24/2002: cheetah (william fulton)
[Java] Support for arrays of enum pointers
01/20/2002: cheetah (william fulton)
[Java] Error checking for null Java objects being passed to native
functions. Exception thrown now whereas before the JVM crashed.
01/18/2002: cheetah (william fulton)
[Java] Corrected behaviour for functions that take arrays. For
example, when this c function:
void arrayfn(int array[]);
is wrapped the corresponding native function
public final static native void arrayfn(int[] array);
is produced. Previously if the C function made any changes to the
array elements, these were not reflected back into the Java array.
This has now been corrected so that the changes are propogated back
to Java and the calling function will see these changes. This is
how pure Java functions work, ie arrays are passed by reference.
01/15/2002:mkoeppe
[Guile] New file cplusplus.i with C++ typemaps contributed
by Marcio Luis Teixeira <marciot@holly.colostate.edu>.
01/11/2002: cheetah (william fulton)
[Java] Changed mapping of C long to Java type. Was mapped to Java
long, now mapped to Java int. If you want the previous mapping to
Java long use this approach in your interface file:
%clear long;
%typemap(jni) long "jlong"
%typemap(jtype) long "long"
%typemap(jstype) long "long"
%clear long[ANY];
%typemap(jni) long[ANY] "jlongArray"
%typemap(jtype) long[ANY] "long[]"
%typemap(jstype) long[ANY] "long[]"
%typemap(in) long[ANY] {write me for array support}
%typemap(out) long[ANY] {write me for array support}
%typemap(argout) long[ANY] {write me for array support}
%typemap(freearg) long[ANY] {write me for array support}
*** POTENTIAL INCOMPATIBILITY ***
This new mapping is more appropriate when interfacing to 32 bit
applications which are used in the current 32-bit JVMs. For future
64-bit JVMs you may have to change these mappings - eg on Unix LP64
systems, but not on Microsoft 64bit Windows which will be using a
P64 IL32 model. This may be automated in a future version of SWIG.
01/10/2002:beazley
Fixed [ 501677 ] %init block in wrong place. Reported
by Luigi Ballabio.
01/09/2002: cheetah (william fulton)
[Java] Default support for the long long type. signed long long is
mapped to a Java long. unsigned long long is mapped to BigInteger.
01/09/2002:beazley
Experimental change to parser to better support mixing of
int, long, short, unsigned, float, and double. The parser
should now support types like this:
short unsigned int
int unsigned short
unsigned short int
unsigned int short
This change also enables a type of 'long double' (previously
unsupported) to be used.
*** NEW FEATURE ***
01/05/2002: cheetah (william fulton)
[Java] Casting fix for when function return type is a pointer as
reported by Gary Pennington 2002-01-05. The upper 32bits of the
64 bit jlong will have contained junk for 32bit pointers.
01/05/2002: cheetah (william fulton)
[Java] Better pointer handling in Java is possible as the
INPUT, OUTPUT and INOUT typemaps have been added into typemaps.i.
01/05/2002: cheetah (william fulton)
[Java] $null can be used in input typemaps to return early from JNI
functions that have either void or a non-void return type. Example:
%typemap(check) int * %{
if (error) {
SWIG_exception(SWIG_IndexError, "Array element error");
return $null;
}
%}
If the typemap gets put into a function with void as return, $null
will expand to nothing:
void jni_fn(...) {
if (error) {
SWIG_exception(SWIG_IndexError, "Array element error");
return ;
}
...
}
otherwise $null expands to zero, where javareturntype is either a
pointer or a primitive type:
javareturntype jni_fn(...) {
if (error) {
SWIG_exception(SWIG_IndexError, "Array element error");
return 0;
}
...
}
01/02/2002: cheetah (william fulton)
[Java] The Java module incorrectly used argout typemaps for
strings. This is now corrected and the code now resides
in the freearg typemap. The argout array typemaps have been split into
argout and freearg typemaps. This correction may require some user
written typemaps to be modified.
*** POTENTIAL INCOMPATIBILITY ***
12/28/2001: cheetah (william fulton)
[Java] Multi typemaps now working for Java see multimap example.
[Java] Fix for recently introduced bug - freearg typemap code was appearing
before the function call.
12/28/2001: cheetah (william fulton)
[Java] JCALL macro for JNI calls that work in both C and C++ typemaps
have been replaced with JCALL0, JCALL1, JCALL2, JCALL3 and JCALL4
macros.
*** POTENTIAL INCOMPATIBILITY ***
12/22/2001:beazley
Resolved some inconsistent behavior with %rename and class renaming.
If you specify the following:
%rename(Foo) Bar;
class Bar {
public:
Bar();
~Bar();
}
Then the %rename directive applies to the class itself, the constructor,
and the destructor (all will be renamed to Foo).
If a class defines more than one constructor, the overloaded variants
can still be renamed by specifying parameters to %rename. For example:
%rename(Bar_copy) Bar(Bar &);
class Bar {
public:
Bar();
Bar(Bar &);
~Bar();
};
There are still some odd corner cases. If you specify
%rename(Foo) ::Bar;
then only the name of the class is changed and the constructor/destructor
names are left unmodified. If you specify
%rename(Foo) *::Bar;
then the names of the constructor/destructor functions are modified but
the name of the class is not.
12/21/2001: cheetah (william fulton)
[Java] jni, jtype and jstype typemaps no longer hardcoded but real
typemaps. New variable substitution, $javaclassname, can be used in
the jstype typemaps. It is replaced with the Java shadow class name
where applicable.
[Java] Fix for recently introduced bug to do with inheritance when
using %import.
[Java] A few more bug fixes, todo with %rename and using the kind
with the type, eg
void fn(union uni myuni, struct str mystr, class cl mycl);
12/20/2001:beazley
Fixed [ #494524 ] Preprocessor bug - apostrophe and #subst.
12/20/2001:beazley
Added SWIG_VERSION preprocessor symbol. This is a hexadecimal
integer such as 0x010311 (corresponding to SWIG-1.3.11). This can
be used in the interface as follows:
#if SWIG_VERSION >= 0x010311
/* Use some fancy new feature */
#endif
Note: The version symbol is not defined in the generated SWIG
wrapper file.
*** NEW FEATURE ***
12/20/2001:mkoeppe
[MzScheme]: Renamed mzswig_make_boolean to
swig_make_boolean, as the latter is used in the typemaps.
Reported by Luigi Ballabio.
12/17/2001:mkoeppe
[Guile]: Rewrote list-vector.i using multi-dispatch
typemaps. Updated pointer-in-out.i. Make the
deprecated typemap-substitution of "$source" in "argout"
work as before.
12/16/2001:mkoeppe
[Guile]: Fixed macros %values_as_list, %values_as_vector,
%multiple_values to use the proper %pragma syntax. New
Guile example/test "multivalue"; new Guile run-test for
test-suite item "list-vector" (currently broken).
12/14/2001:mkoeppe
[Guile]: Fixed typemap-substition bug for "varin". Relaxed
valid-identifier check to allow all R5RS identifiers.
Version 1.3.10 (December 10, 2001)
==================================
12/08/2001:beazley
Modified %typemap so that %{ ... %} can also be used as a
code block (mostly for completeness). For example:
%typemap(in) blah %{
...
%}
This form does not introduce a new block scope. Also, the
code enclosed in %{ ... %} is not processed by the preprocessor.
12/08/2001:beazley
Fixed [ #459614 ] SWIG with multiple TCL interpreters.
12/08/2001:beazley
Fixed [ #417141 ] rubydec.swg is wrong
Reported by Paul Brannan.
12/08/2001:beazley
Fixed [ #410557 ] Problem with %addmethods on NT.
Reported by Magnus Ljung.
12/08/2001:beazley
Fixed [ #445233 ] Enhancement: handle access change.
SWIG now parses (but ignores) C++ access changes for the
the following:
class A {
protected:
void something() { }
public:
A() {}
};
class B : private A {
public:
B() : A() { }
protected:
A::something; <---- Parsed, but ignored
};
Suggested by Krzysztof Kozminski.
12/08/2001: cheetah (william fulton)
Fix for Ruby to work using Visual C++.
12/06/2001:beazley
Fixed [ #465687 ] unsigned short parameters fail.
Reported by Gerald Williams.
12/06/2001:beazley
Fixed SF [ #489594 ] PyString_FromString can't take NULL arg.
Reported by John Merritt. SWIG now converts string values
to Python using code like this:
resultobj = result ? PyString_FromString(result) : Py_BuildValue("");
12/06/2001:beazley
Fixed SF [ #463561 ] Type conversions not generated.
Reported by Gerald Williams.
12/04/2001:beazley
Fixed SF [ #470217 ] Tcl default argument handling.
Reported by Shaun Lowry.
12/04/2001:beazley
Fixed SF [ #472088 ] defined(MACRO) expanded everywhere.
Embedded preprocessor directives such as
%#if defined(FOO)
are not expanded by the SWIG preprocessor.
Reported by Gerald Williams.
12/04/2001:beazley
Fixed SF [ #476467 ] Problems with #define & commas.
12/04/2001:beazley
Fixed SF [ #477547 ] wrong declaration of pointer functions.
Bad prototypes in Lib/tcl/ptrlang.i.
12/04/2001:beazley
Fixed SF [ #483182 ] Constants can take args by mistake.
When swig -perl5 -const is used, constants are declared
with a void prototype. For example:
sub ICONST () { $examplec::ICONST }
Patch submitted by Rich Wales.
12/03/2001:beazley
New %exception directive. This is intended to replace %except.
It works in exactly the same manner except it does not accept a
language specifier. For example:
%exception {
try {
$action
}
catch(SomeError) {
error
}
}
%exception is also name aware---allowing it to be applied to
specific declarations in an interface. For example:
%exception foo {
...
exception for any function/method foo
...
}
%exception Foo::bar {
...
exception for method bar in class Foo
...
}
%exception Foo::bar(double) {
...
exception for method bar(double) in class Foo
...
}
The semantics of this name matching is exactly the same as for %rename.
*** NEW FEATURE ***
12/03/2001:beazley
Substantial cleanup of the Python shadow class code. Shadow classes
used to be created in this rather complicated manner involving about
a half-dozen strings created in bits and pieces. Shadow classes
are now generated in a more straightforward manner--in the same
order that appears in the interface file.
*** POTENTIAL INCOMPATIBILITY ***
The order in which declarations appear in the shadow file may differ.
12/03/2001:beazley
The %insert directive (%{ ... %}, %runtime, %header, %wrapper, etc.)
can now be used inside of a class definition. This has potential
uses when generating shadow class code. For example:
class Foo {
...
%insert("shadow") %{
# Some python code
def blah(self):
print "I'm blah!"
%}
...
};
The support for class code insertion depends on the language module.
However, the intent of this feature is to simplify the task of extending
shadow class code. In the Python module, this inserts code with the
proper level of indendation (regardless of what was used in the SWIG
interface).
*** NEW FEATURE ***
11/29/2001: cheetah (william fulton)
Modifications for Java and Python modules to work on cygwin.
Unfortunately a lot of the python module has started to produces code
which cannot be auto-imported using cygwin libtools so most of it is
still broken.
11/28/2001:beazley
The %rename and %feature directive can now be used inside
of a class definition. For example:
class Foo {
%rename(foo_i) foo(int);
%rename(foo_d) foo(double);
public:
...
void foo(int);
void foo(double);
...
};
When used in this manner, the %rename directive only applies
to members of the class in which it appears as well as all
derived classes. In fact, this is really just the same
as saying:
%rename(foo_i) Foo::foo(int);
%rename(foo_d) Foo::foo(double);
class Foo {
...
};
*** NEW FEATURE ***
11/26/2001:beazley
Added the experimental %feature directive. %feature can be
used to attach arbitrary string attributes to parse tree nodes.
For example:
%feature("except") blah {
try {
$function
} catch (Error) {
whatever;
}
}
or
%feature("set") *::x_set "x";
or
%feature("blah") Foo::bar(int,double) const "spam";
The syntax is borrowed from the %rename directive. In fact, the
exact same semantics apply (inheritance, matching, etc.).
%feature is a very powerful low-level primitive that can be used to
customize individual language modules and to provide hints to
any stage of code generation. Features are attached to
parse tree nodes as attributes with names like "feature:*" where *
is replaced by the feature name (e.g., "feature:except", "feature:set",
etc.). Language modules can then look for the features using
a simple attribute lookup.
%feature is intended to be a replacement for a number of
older SWIG directives including %except and specialized
pragmas. It is more powerful (due to its parameterized
name matching) and it provides very precise control over
how customization features are attached to individual
declarations. There are future expansion plans that will
build upon this capability as well.
It's not certain that %feature will ever be used directly
by SWIG users. Instead, it may be a low-level primitive
that is used in high-level macro definitions. For instance,
to support properties, you might define a macro like this:
%define %property(name, setf, getf)
%feature("set") setf #name;
%feature("get") getf #name;
%enddef
Which allows a user to specify things like this:
%property(p, get_p, set_p);
class Blah {
public:
int get_p();
void set_p(int);
};
*** EXPERIMENTAL NEW FEATURE ***
11/24/2001:beazley
The Tcl module has been expanded with some new features for
managing object ownership. For example:
set c [Circle -args 20]
$c area # Invoke a method
$c -disown # Releases ownership of the object
$c -acquire # Acquires ownership of the object
If Tcl owns the object, its destructor is invoked when the
corresponding object command is deleted in Tcl.
To simplify the destruction of objects, the following syntax
can be used:
$c -delete # Delete an object
This is an alternative for the more obscure variant of
rename $c {}
These features also add functionality at the C API level.
The following functions manage ownership from C and
can be used in typemaps.
SWIG_Acquire(void *ptr);
SWIG_Disown(void *ptr);
A new function for constructing instances is also available:
Tcl_Obj *
SWIG_NewInstanceObj(Tcl_Interp *interp, void *ptr,
swig_type_info *type, int own);
When used in a typemap, this creates a pointer object and
an interpreter command that can be used to issue methods and
access attributes as shown above.
*** NEW FEATURE ***
11/23/2001:beazley
All Python-related %pragma operations have been eliminated.
Most of these were written for older SWIG versions in order to
compensate for limitations in earlier releases. In an effort
to reduce the amount of code-clutter and potential for errors,
it is easier to simply eliminate the pragmas and to start over
(if needed). To be honest, I'm not even sure the pragmas
worked in 1.3.9 and recent releases.
Note: If you need to insert code into the shadow class file
created by SWIG, simply use the %shadow directive like this:
%shadow %{
def some_python_code():
print "blah!"
%}
*** POTENTIAL INCOMPATIBILITY ***
11/22/2001:beazley
Sweeping changes to the way in which the Python module handles
shadow classes. In early implementations, shadow classes were
merely Python wrappers around typed pointer objects. However,
some users actually wanted to receive the shadow class object in C.
To accomodate this, the dereferencing of the "this" pointer in
a shadow class was moved to C as described in CHANGES [8/8/99].
However, the process of returning pointers to Python was still
somewhat problematic. Specifically, shadow classes never worked
in situations such as these:
- Use of any kind of output typemap ('out' or 'argout')
- Global variables (broken as far as I can tell).
In the past, some users have dealt with this by manually trying
to create shadow class objects themselves from C/C++. However,
this was difficult because the C wrappers don't really know how
to get access to the corresponding Python class.
The Python module has now been modified to automatically attach
shadow class objects to pointers when they are returned to
Python. This process occurs in the function SWIG_NewPointerObj()
so the process is completely transparent to users. As a result,
shadow classes are now more seamlessly integrated with typemaps
and other features of SWIG.
This change may introduce a number of incompatibilities. The
SWIG_NewPointerObj() now takes an extra parameter "own" to
indicate object ownership. This can be used to return a pointer
to Python that Python should destroy. In addition, older code
that tries to manually construct shadow class objects or which
expects bare pointers may break---such pointers may already be
encapsulated by a shadow class.
*** POTENTIAL INCOMPATIBILITY ***
11/20/2001:beazley
Modified the %insert directive to accept single braces { ... }.
For example:
%insert("header") {
... some code ...
}
This works exactly like %{ ... %} except that the code in the
braces is processed using the preprocessor. This can be useful
in certain contexts such as low-level code generation in
language modules.
*** NEW FEATURE ***
11/20/2001:beazley
Command line options are now translated into preprocessor
symbols. For example:
./swig -python -shadow -module blah interface.i
Creates the symbols:
SWIGOPT_PYTHON 1
SWIGOPT_SHADOW 1
SWIGOPT_MODULE blah
Modules can look for these symbols to alter their code generation
if needed.
*** NEW FEATURE ***
11/20/2001:beazley
Massive overhaul of the Perl5 module. A lot of code generation is
now driven by tables and typemaps. The generated wrapper code
also makes use of tables to install constants, variables, and
functions instead of inlining a bunch of procedure calls. The
separate variable initialization function is gone. Most
code generation is controlled via the perl5.swg file in the
library.
*** POTENTIAL INCOMPATIBILITY ***
11/13/2001:beazley
Added parsing support for the C++ typename keyword. Primarily this
is added to better support templates. For example:
template<typename T> void blah(C& v) {
typename C::iterator i = v.begin();
}
Note: typename is supported in the parser in the same way as 'struct'
or 'class'. You probably shouldn't use it anywhere except in templates.
*** NEW FEATURE ***
11/11/2001:beazley
Massive overhaul of the language module API. Most functions now
use a common, very simple, API. There are also a number of
interesting semantic side-effects of how code is actually generated.
Details will be forthcoming in Doc/Manual/Extending.html.
*** POTENTIAL INCOMPATIBILITY *** Language modules written for
previous versions of SWIG will no longer work,
11/10/2001:beazley
Fixed a very subtle bug due to unnamed class wrapping. For example, if
you did this
typedef struct {
int x,y;
} gdPoint, *gdPointPtr;
void foo(gdPointPtr x);
Then the foo function would get a type-error. The problem has
to do with internal typedef handling and the fact that the typedef
declarations after the struct appear later in the parse tree.
It should work now. Problem reported by Vin Jovanovic.
11/09/2001:beazley
Subtle change to "out" typemaps (and related variations). The name
that is attached to the typemap is now the raw C identifier that
appears on a declaration. This changes the behavior of
member functions. For example:
%typemap(out) int foo {
...
}
class Blah {
public:
int foo(); // typemap gets applied
}
Previous versions never really specified how this was supposed to
work. In SWIG1.1, you could probably write a typemap for the
wrapper name like this:
%typemap(out) int Blah_foo { ... }
However, this old behavior is now withdrawn and not supported.
Just use the member name without any sort of special prefix.
*** POTENTIAL INCOMPATIBILITY ***
11/06/2001:beazley
Changes to Tcl module initialization:
(1) SWIG now automatically includes the code needed to work with
Tcl stubs. Simply compile with -DUSE_TCL_STUBS.
(2) SWIG now automatically calls Tcl_PkgProvide to register
a package name. The package name is the same as the name
specified with the %module directive. The version number is
set to "0.0" by default. To change the version number, use
swig -pkgversion 1.2 interface.i.
*** POTENTIAL INCOMPATIBILITY ***
Modules that provided stubs and Tcl_PkgProvide on their own might
break. Simply remove that code.
11/05/2001:beazley
Changed code generation of constants in the Tcl module. Constants
are now stored in a large table that get installed at module startup.
There are also no longer any static variables so it should generate
somewhat less code.
11/04/2001:beazley
The "const" typemap has been renamed to "constant" in many language
modules. "const" is a C keyword which made the handling of the typemap
directive somewhat awkward in the parser.
*** POTENTIAL INCOMPATIBILITY ***
11/04/2001:beazley
%typemap directive can now accept nearly arbitrary keyword parameters.
For example:
%typemap(in,parse="i",doc="integer") int "...";
The purpose of the keyword parameters is to supply code generation
hints to the target language module. The intepretation of the
parameters is language specific.
*** NEW FEATURE ***
11/04/2001:beazley
Slight semantic change to internal call/return by value handling.
In previous versions of SWIG, call-by-value was translated
into pointers. For example:
double dot_product(Vector a, Vector b);
turned into this:
double wrap_dot_product(Vector *a, Vector *b) {
return dot_product(*a,*b);
}
This translation was normally performed by the SWIG core, outside
of the control of language modules. However, a side effect
of this was a lot of bizarre typemap behavior. For example,
if you did something like this:
%typemap(in) int32 {
...
}
You would find that int32 was transformed into a pointer everywhere!
(needless to say, such behavior is unexpected and quite awkward to
deal with). To make matters worse, if a typedef was also used,
the pointer behavior suddenly disappeared.
To fix this, the pointer transformation is now pushed to the
language modules. This produces wrappers that look roughly
like this:
double wrap_dot_product(Vector *a, Vector *b) {
Vector arg1 = *a;
Vector arg2 = *b;
return dot_product(arg1,arg2);
}
This change also makes it easy to define typemaps for
arbitrary undefined types. For example, you can do this (and it
will work regardless what int32 is):
%typemap(in) int32 {
$1 = (int32) PyInt_AsLong($input);
}
*** POTENTIAL IMCOMPATIBILITY ***
This change may break call/return by value code generation in
some language modules.
11/03/2001:beazley
Changed the name of the default typemaps to the following:
%typemap() SWIGTYPE {
... an object ...
}
%typemap() SWIGTYPE * {
... a pointer ...
}
%typemap() SWIGTYPE & {
... a reference ...
}
%typemap() SWIGTYPE [] {
... an array ...
}
%typemap() enum SWIGTYPE {
... an enum value ...
}
%typemap() SWIGTYPE (CLASS::*) {
... pointer to member ...
}
These types are used as the default for all types that don't match
anything else. See CHANGES log entry for 8/27/2000 for the
old behavior. The role of these types is also described in
Doc/Manual/Typemaps.html
*** POTENTIAL INCOMPATIBILITY ***
10/25/2001:beazley
Modified Guile and Mzscheme modules to support
multi-argument typemaps.
10/25/2001: cheetah (william fulton)
[Java] Fix to handle pointers to arrays.
10/24/2001:beazley
Defining a typemap rule for enum SWIGENUM can now be used
to define default behavior for enum variables.
10/22/2001:beazley
Ruby module modified to support multi-argument typemaps.
10/22/2001:beazley
The Ruby module can now handle functions with an arbitrary
number of arguments. Previous versions were limited to
to functions with only 9 or 16 arguments depending on
the use of default arguments. Note: from some inspection
of the Ruby interpreter source, the new approach might be
a little faster as well.
10/18/2001:beazley
Fixed a bug with forward class declarations and
templates.
class Foo <S,T>;
Bug reported by Irina Kotlova.
10/16/2001:beazley
Support for multivalued typemaps added. The typemaps
are specified using the syntax below. Within each
typemap, variable substitution is handled as follows:
%typemap(in) (int argc, char *argv[]) {
$arg; // The input object in the target language
$1; // C local variable for first argument
$2; // C local variable for second argument
// These variables refer to either argument
$1_type, $1_ltype, $1_basetype, etc... (argc)
$2_type, $2_ltype, $2_basetype, etc... (argv[])
// Array dimension of argv
$2_dim0
}
Basically any variable that was available in normal typemaps
is available for either argument by prefacing the variable
name by '$n_' where n is the argument position.
Notes:
(1) Multi-valued typemaps can only be applied to a single
object in the target scripting language. For example,
you can split a string into a (char *, int) pair or
split a list into a (int, char []) pair. It is not
possible to map multiple objects to multiple arguments.
(2) To maintain compatibility with older SWIG versions, the
variables such as $target and $type are preserved and
are mapped onto the first argument only.
(3) This should not affect compatibility with older code.
Multi-valued typemaps are an extension to typemap handling.
Single valued typemaps can be specified in the usual
way.
The old $source and $target variables are officially
deprecated. Input variables are referenced through
$arg$ and output values are reference through $result$.
*** NEW FEATURE ***
10/16/2001:beazley
Added parsing support for multivalued typemaps. The syntax
is a little funky, but here goes:
// Define a multivalued typemap
%typemap(in) (int argc, char *argv[]) {
... typemap code ...
}
// Multivalued typemap with locals
%typemap(in) (int argc, char *argv[])(int temp) {
... typemap code ...
}
// Copy a multivalued typemap
%typemap(in) (int argcount, char **argv) = (int argc, char *argv[]);
// Apply a multivalued typemap
%apply (int argc, char *argv[]) { (int argcount, char **argv) };
Note: this extra parsing support is added for future extension.
No language modules currently support multi-valued typemaps.
10/11/2001:beazley
Modified the typemap matching code to discard qualifiers when
checking for a match. For example, if you have a declaration
like this:
void blah(const char *x);
The typemap checker checks for a match in the following order:
const char *x
const char *
char *x
char *
If typedef's are involved, qualifier stripping occurs before
typedef resolution. So if you had this,
typedef char *string;
void blah(const string x);
typemap checking would be as follows:
const string x
const string
string x
string
const char *x
const char *
char *x
char *
The primary reason for this change is to simplify the implementation
of language modules. Without qualifier stripping, one has to write
seperate typemaps for all variations of const and volatile (which
is a pain).
*** POTENTIAL INCOMPATIBILITY *** Typemaps might be applied in
places where they weren't before.
10/9/2001: beazley
SWIG now generates wrappers that properly disambiguate
overloaded methods that only vary in constness. For
example:
class Foo {
...
void blah();
void blah() const;
...
};
To handle this, the %rename directive can be used normally.
%rename(blah_const) blah() const;
In the resulting wrapper code, method calls like this
are now generated:
(obj)->blah() // Non-const version
((Foo const *)obj)->blah() // const version
This should force the right method to be invoked.
Admittedly, this is probably obscure, but we might
as well get it right.
10/8/2001: beazley
The preprocessor now ignores '\r' in the input.
This should fix the following bug:
[ #468416 ] SWIG thinks macro defs are declarations?
10/8/2001: beazley
Added support for ||, &&, and ! in constants. This
fixes SF [ #468988 ] Logical ops break preprocessor.
However, at this time, constants using these operators
are not supported (the parser will issue a warning).
10/4/2001: beazley
Added -show_templates command line option. This makes
SWIG display the code it actually parses to generate
template wrappers. Mostly useful for debugging.
*** NEW FEATURE ***
10/4/2001: beazley
Change to semantics of %template directive. When
using %template, the template arguments are handled
as types by default. For example:
%template(vecint) vector<int>;
%template(vecdouble) vector<double>;
To specify a template argument that is *not* a type, you
need to use default-value syntax. For example:
%template(vecint) vector<int,int=50>;
%template(vecdouble) vector<int,size=100>;
In this case, the type name doesn't really matter--only
the default value (e.g., 50, 100) is used during
expansion. This differs from normal C++, but I couldn't
figure out a better way to do it in the parser. Might
implement an alternative later.
*** POTENTIAL INCOMPATIBILITY ***
10/4/2001: beazley
Major changes to template handling in order to provide
better integration with the C++ type-system. The main
problem is as follows:
Suppose you have a template like this:
template<class T> void blah(const T x) { stuff };
Now suppose, that you instantiate the template on a
type like this in SWIG:
%template(blahint) blah<int *>;
In C++, this is *supposed* to generate code like this:
void blah(int *const x) { stuff };
However, in SWIG-1.3.9, the template substitution gets it wrong
and produces
void blah(const int *x) { stuff };
(notice the bad placement of the 'const' qualifier).
To fix this, the SWIG parser now generates implicit typedefs
for template type arguments that produces code roughly
equivalent to doing this:
typedef int *__swigtmpl1;
%template(blahint) blah<__swigtmpl1>;
which generates code like this:
void blah(const __swigtmpl1 x) { stuff };
Since this is correct in both C++ and SWIG, it provides the right
semantics and allows everything to compile properly. However,
to clean up the generated code a little bit, the parser keeps
track of the template types and performs back-substitution to
the original type when building the parse tree. Thus, even
though the implicit typedef is used in the input and may appear
in the generated wrapper file (for proper compilation), the parse
tree will hide a lot of these details. For example:
void blah(const __swigtmpl1 x) { stuff };
will look like it was declared as follows (which is what
you want):
void blah(int *const x) { stuff }
The only place you are likely to notice the typedef hack
is in bodies of template functions. For example, if you
did this,
template<class T> class blah {
...
%addmethods {
void spam() {
T tempvalue;
...
}
}
}
you will find that 'T tempvalue' got expanded into some
strange typedef type. This *still* compiles correctly
so it's not a big deal (other than looking kind of ugly
in the wrapper file).
10/4/2001: beazley
Fixed some inheritance problems in Tcl Object interface.
10/1/2001: beazley
Tcl module has changed to use byte-backed pointer strings. This
implementation should be safe on 64-bit platforms. However,
the order in which digits appear in pointer values no longer
directly corresponds to the actual numerical value of a
pointer (on little-endian machines, pairs of digits appear
in reverse order).
10/1/2001: beazley
Perl5 module is now driven by a configuration file 'perl5.swg'
in the SWIG library.
10/1/2001: beazley
The perl5 module no longer tries to apply the "out" typemap
in code generated for magic variables. I'm surprised that
this ever worked at all (since all of the code that was there
was wrong anyways). Use the "varout" typemap to handle
global variables.
10/1/2001: beazley
Fixed a bug related to character array members of structures.
For example:
struct Foo {
char name[32];
};
SWIG is normally supposed to return a string, but this was
broken in 1.3.9. The reason it was broken was actually
due to a subtle new feature of typemaps. When a data member
is set to an array like this, the return type of the related
accessor function is actually set to an array. This means
that you can now write typemaps like this:
%typemap(python,out) char [ANY] {
$target = PyString_FromStringAndSize($source,$dim0);
}
This functionality can be used to replace the defunct
memberout typemap in a more elegant manner.
9/29/2001: beazley
Some further refinement of qualified C++ member functions.
For example:
class Foo {
...
void foo() const;
...
};
(i) The SWIG parser was extended slightly to allow 'volatile'
and combinations of 'const' and 'volatile' to be used. This
is probably rare, but technically legal. Only added for
completeness.
(ii) For the purposes of overloading, qualified and non-qualified
functions are different. Thus, when a class has methods like this:
void foo();
void foo() const;
Two distinct methods are declared. To deal with this, %rename
and similar directives have been extended to recognize const.
Thus, one can disambiguate the two functions like this:
%rename(fooconst) Foo::foo() const;
or simply ignore the const variant like this:
%ignore Foo::foo() const;
Note: SWIG currently has no way to actually invoke the const
member since the 'const' is discarded when generating wrappers
for objects.
9/27/2001: beazley
New directive. %namewarn can be used to issue warning
messages for certain declaration names. The name
matching is the same as for the %rename directive.
The intent of this directive is to issue warnings for
possible namespace conflicts. For example:
%namewarn("print is a python keyword") print;
The name matching algorithm is performed after a name
has been resolved using %rename. Therefore, a
declaration like this will not generate a warning:
%rename("Print") print;
...
void print(); /* No warning generated */
Since the warning mechanism follows %rename semantics, it is
also to issue warnings for specific classes or just for
certain member function names.
(Dave - I've been thinking about adding something like this
for quite some time. Just never got around to it)
*** NEW FEATURE ***
9/27/2001: beazley
Enhanced the %ignore directive so that warning messages
can be issued to users. This is done using %ignorewarn
like this:
%ignorewarn("operator new ignored") operator new;
The names and semantics of %ignorewarn is exactly the
same as %ignore. The primary purpose of this directive
is for module writers who want to ignore certain types
of declarations, but who also want to alert users about it.
A user might also use this for debugging (since messages
will appear whenever an ignored declaration appears).
*** NEW FEATURE ***
9/26/2001: beazley
Super-experimental support for overloaded operators.
This implementation consists of a few different parts.
(i) Operator names such as 'operator+' are now allowed
as valid declarator names. Thus the 'operator' syntax
can appear *anyplace* a normal declarator name was used
before. On the surface, this means that operators can
be parsed just like normal functions and methods.
However, it also means that operator names can be used
in many other SWIG directives like %rename. For example:
%rename(__add__) Complex::operator+(const Complex &);
(ii) Operators are wrapped *exactly* like normal functions
and methods. Internally, the operator name is used
directly meaning that the wrapper code might contain
statements like this:
arg0->operator*((Complex const &)*arg1);
This all seems to parse and compile correctly (at least
on my machine).
(iii) SWIG will no longer wrap a declaration if its symbol
table name contains illegal identifier characters. If
illegal characters are detected, you will see an error
like this:
Warning. Can't wrap operator* unless renamed to a valid identifier.
The only way to fix this is to use %rename or %name to bind
the operator to a nice name like "add" or something. Note:
the legal identifier characters are determined by the target
language.
There are certain issues with friend functions and operators.
Sometimes, friends are used to define mixed operators such
as adding a Complex and a double together. Currently, SWIG
ignores all friend declarations in a class. A global operator
declaration can probably be made to work, but you'll have to
rename it and it probably won't work very cleanly in the
target language since it's not a class member.
SWIG doesn't know how to handle operator specifications
sometimes used for automatic type conversion. For example:
class String {
...
operator const char*();
...
};
(this doesn't parse correctly and generates a syntax error).
Also: operators no longer show up as separate parse-tree
nodes (instead they are normal 'cdecl' nodes). I may
separate them as a special case later.
See Examples/python/operator for an example.
*** SUPER-EXPERIMENTAL NEW FEATURE ***
Version 1.3.9 (September 25, 2001)
==================================
9/25/2001: beazley
Fixed parsing problem with type declarations like
'char ** const'. SWIG parsed this correctly, but the
internal type was represented incorrectly (the pointers
and qualifiers were in the wrong order).
9/25/2001: beazley
Withdrew experimental feature (noted below) that was
causing serious parsing problems.
Version 1.3.8 (September 23, 2001)
==================================
9/23/2001: beazley
Included improved distutils setup.py file in the Tools
directory (look for the setup.py.tmpl file). Contributed by
Tony Seward.
9/23/2001: beazley
Included two new RPM spec files in the Tools directory. Contributed
by Tony Seward and Uwe Steinmann.
9/21/2001: beazley
Fixed SF Bug [ #463635 ] Perl5.swg does not compile in Visual C++
9/21/2001: beazley
Two new directives control the creation of default
constructors and destructors:
%nodefault
%makedefault
These replace %pragma nodefault and %pragma makedefault.
(old code will still work, but documentation will only
describe the new directives).
9/21/2001: beazley
Fixed SF Bug [ #462354 ] %import broken in 1.3.7.
9/20/2001: beazley
Parser modified to ignore out-of-class constructor
and destructor declarations. For example:
inline Foo::Foo() :
Bar("foo")
{
}
inline Foo::~Foo() {
}
Suggested by Jason Stewart.
*** EXPERIMENTAL FEATURE ***
9/20/2001: beazley
Modified the parser to ignore forward template class
declarations. For example:
template <class V, long S> class MapIter;
Suggested by an email example from Irina Kotlova.
9/20/2001: beazley
Fixed problem with undeclared tcl_result variable in
the "out" typemap for Tcl. Reported by Shaun Lowry.
9/20/2001: beazley
Incorporated changes to make SWIG work with ActivePerl.
Contributed by Joel Reed.
9/20/2001: beazley
Slight change to the parsing of C++ constructor initializers.
For example:
class Foo : public Bar {
public:
Foo() : Bar(...) {...}
};
SWIG now discards the contents of the (...) regardless of
what might enclosed (even if syntactically wrong). SWIG
doesn't need this information and there is no reason to
needless add syntax rules to handle all of the possibilities
here.
9/20/2001: beazley
Change to typemaps for structure members. If you have a
structure like this:
struct Vector {
int *bar;
};
The member name 'bar' is now used in any accessor functions.
This allows the "in" typemap to be used when setting the value.
For example, this typemap
%typemap(python,in) int *bar {
...
}
now matches Vector::bar. It should be noted that this will also
match any function with an argument of "int *bar" (so you should
be careful).
*** NEW FEATURE. POTENTIAL INCOMPATIBILITY ***
9/20/2001: beazley
Fixed SF bug #462642 setting string values in structures
9/20/2001: beazley
Fixed SF bug #462398 problem with nested templates.
9/20/2001: beazley
Fixed SF bug #461626 problem with formatting and C++ comments.
9/20/2001: beazley
Fixed SF bug #462845 Wrong ownership of returned objects.
9/19/2001: beazley
Fixed SF bug #459367. Default constructors for classes
with pure virtual methods.
9/19/2001: beazley
Fixed problem with default arguments and class scope. For
example:
class Foo {
public:
enum bar { FOO, BAR };
void blah(bar b = FOO);
...
}
SWIG now correctly generates a default value of "Foo::FOO" for
the blah() method above. This used to work in 1.1, but was
broken in 1.3.7. Bug reported by Mike Romberg.
Version 1.3.7 (September 3, 2001)
==================================
9/02/2001: beazley
Added special %ignore directive to ignore declarations. This
feature works exactly like %rename. For example:
%ignore foo; // Ignore all declarations foo
%ignore ::foo; // Only ignore foo in global scope
%ignore Spam::foo; // Only ignore in class Spam
%ignore *::foo; // Ignore in all classes
%ignore can also be parameterized. For example:
%ignore foo(int);
%ignore ::foo(int);
%ignore Spam::foo(int);
%ignore *::foo(int);
*** NEW FEATURE ***
9/02/2001: cheetah (william fulton)
[Java] shadowcode pragma modified so that the code that is output
in the shadow file is placed relative to where it is placed in the
c/c++ code. This allows support for JavaDoc function comments.
9/01/2001: beazley
Fixed SF Patch [ #447791 ] Fix for python -interface option.
Submitted by Tarn Weisner Burton.
9/01/2001: beazley
SWIG no longer generates default constructors/destructors
for a class if it only defines a private/protected constructor
or destructor or if any one of its base classes only has
private constructors/destructors. This was reported in
SF Patch [ #444281 ] nonpublic/default/inhereted ctor/dtor
by Marcelo Matus.
9/01/2001: beazley
Added patch to Perl5 module that allows constants to be
wrapped as constants that don't require the leading $.
This feature is enabled using the -const option.
Patch contributed by Rich Wales.
*** NEW FEATURE ***
8/31/2001: beazley
Added parsing support for the 'volatile' type qualifier.
volatile doesn't mean anything to SWIG, but it is
needed to properly generate prototypes for declarations
that use it. It's also been added to make the SWIG type
system more complete.
*** NEW FEATURE ***
8/30/2001: beazley
Added support for parameterized %rename directive. *** This
new feature can be used to greatly simplify the task of
resolving overloaded methods and functions. ***
In prior versions of SWIG, the %rename directive was
used to consistently apply an identifier renaming. For
example, if you said this:
%rename foo bar;
Every occurrence of 'foo' would be renamed to 'bar'.
Although this works fine for resolving a conflict with a
target language reserved word, it is useless for
for dealing with overloaded methods. This is because
all methods are simply renamed to the same thing
(generating the same conflict as before).
Therefore, the only way to deal with overloaded methods
was to go through and individually rename them all using
%name. For example:
class Foo {
public:
virtual void bar(void);
%name(bar_i) virtual void bar(int);
...
};
To make matters worse, you had to do this for all
derived classes too.
class Spam : public Foo {
public:
virtual void bar(void);
%name(bar_i) virtual void bar(int);
...
};
Needless to say, this makes it extremely hard to resolve
overloading without a lot of work and makes it almost
impossible to use SWIG on raw C++ .h files.
To fix this, %rename now accepts parameter declarators.
The syntax has also been changed slightly. For example,
the following declaration renames all occurrences of 'bar(int)'
to 'bar_i', leaving any other occurrence of 'bar' alone.
%rename(bar_i) bar(int);
Using this feature, you can now selectively rename
certain declarations in advance. For example:
%rename(bar_i) bar(int);
%rename(bar_d) bar(double);
// Include raw C++ header
%include "header.h"
When %rename is used in this manner, all occurrence of bar(int)
are renamed wherever they might occur. More control is obtained
through explicit qualification. For example,
%rename(bar_i) ::bar(int);
only applies the renaming if bar(int) is defined in the global scope.
The declaration,
%rename(bar_i) Foo::bar(int);
applies the renaming if bar(int) is defined in a class Foo.
This latter form also supports inheritance. Therefore, if you
had a class like this:
class Spam : public Foo {
public:
void bar(int);
}
The Spam::bar(int) method would also be renamed (since Spam
is a subclass of Foo). This latter feature makes it easy
for SWIG to apply a consistent renaming across an entire
class hierarchy simply by specifying renaming rules for
the base class.
A class wildcard of * can be used if you want to renaming
all matching members of all classes. For example:
%rename(bar_i) *::bar(int);
will rename all members bar(int) that are defined in classes.
It will not renamed definitions of bar(int) in the global
scope.
The old use of %rename is still supported, but is somewhat
enhanced.
%rename(foo) bar; // Renames all occurrences of 'bar'.
%rename(foo) ::bar; // Rename all 'bar' in global scope only.
%rename(foo) *::bar; // Rename all 'bar' in classes only.
%rename(foo) Foo::bar; // Rename all 'bar' defined in class Foo.
*** NEW FEATURE ***
8/30/2001: beazley
Added support for data-member to member-function
transformation. For example, suppose you had a
structure like this:
struct Vector {
double x,y;
};
Now suppose that you wanted to access x and y
through a member function interface instead
of the usual SWIG behavior. For example:
f.set_x(3.4) # instead of f.x = 3.4
x = f.get_x() # instead of x = f.x
To do this, simply use the new %attributefunc
directive. For example:
%attributefunc(get_%s,set_%s)
struct Vector {
double x,y;
};
%noattributefunc
The arguments to %attributefunc are C-style printf
format strings that determine the naming convention
to use. %s is replaced with the actual name of the
data member. SWIG provides a number of printf
extensions that might help. For example, if you
wanted to title case all of the attributes, you
could do this:
%attributefunc(get%(title)s,set%(title)s);
This will turn an attribute 'bar' to 'getBar()' and 'setBar()'.
(someone requested this long ago, but I finally figured
how to implement it in a straightforward manner).
*** EXPERIMENTAL NEW FEATURE ***
8/30/2001: beazley
SWIG now automatically generates default constructors
and destructors if none are defined. This used to be
enabled with a command line switch -make_default, but
most people want these functions anyways. To turn
off this behavior use the -no_default option or include
the following pragma in the interface file:
%pragma no_default;
This may break certain interfaces that defined their
own constructors/destructors using the same naming
convention as SWIG. If so, you will get duplicate
symbols when compiling the SWIG wrapper file.
*** POTENTIAL INCOMPATIBILITY ***
8/29/2001: beazley
Changes to Perl5 shadow class code generation. Iterators
are no longer supported (FIRSTKEY, NEXTKEY). Also, attribute
access has been changed to rely on inheritance in order
to provide better behavior across modules.
8/28/2001: beazley
Various obscure improvements to the type system and classes.
Strange declarations like this are now wrapped correctly
(i.e., the generated wrapper code doesn't cause the C++
compiler to die with a type error).
class Foo {
public:
typedef double Real;
Real foo(Real (*op)(Real,Real), Real x, Real y);
};
Inheritance of types is also handled correctly.
8/28/2001: beazley
Changes to class wrappers. When SWIG sees two classes like this,
class X {
public:
void foo();
...
}
class Y : public X {
public:
void bar();
...
}
it now only generates two wrapper functions:
X_foo(X *x) { x->foo(); }
Y_bar(Y *y) { y->bar(); }
Unlike SWIG1.15, the foo() method does *not* propagate to a wrapper
function Y_foo(). Instead, the base class method X_foo() must be
used.
This change should not affect modules that use shadow classes, but
it might break modules that directly use the low-level C wrappers.
This change is being made for a number of reasons:
- It greatly simplifies the implementation of SWIG--especially
with anticipated future changes such as overloaded methods.
- It results in substantially less wrapper code--especially
for big C++ class hierarchies (inherited declarations
are no longer copied into every single derived class).
- It allows for better code generation across multiple
SWIG generated modules (code isn't replicated in
every single module).
*** POTENTIAL INCOMPATIBILITY ***
8/22/2001: cheetah (william fulton)
Provided some Windows documentation in the Win directory and some
Visual C++ project files for running examples on Windows.
8/28/2001: mkoeppe
[Guile] Handle renamed overloaded functions properly;
thanks to Marc Zonzon <Marc.Zonzon@univ-rennes1.fr> for the
patch. See the new test case name_cxx.
8/27/2001: mkoeppe
[Tcl] Removed lots of warnings issued by the Sun Forte
compilers, which were caused by mixing function pointers
of different linkages (C++/C).
8/23/2001: mkoeppe
Improved the MzScheme module by porting Guile's pointer
type checking system and making type dispatch
typemap-driven.
8/22/2001: beazley
Entirely new symbol table processing. SWIG should be able to
report much better error messages for multiple declarations.
Also, the new symbol table allows for overloaded functions
(although overloading isn't quite supported in the language
modules yet).
8/22/2001: cheetah (william fulton)
* [Java] %new support added.
* [Java] Package JNI name refixed!
8/19/2001: beazley
Python module modified to support pointers to C++ members. This
is an experimental feature.
*** NEW FEATURE ***
8/19/2001: beazley
Added limited parsing and full type-system support for pointers to
members. None of SWIG's language modules really know how to deal with
this so this is really only provided for completeness and future
expansion. Note: SWIG does not support pointers to members which
are themselves pointers to members, references to pointers to members,
or other complicated declarations like this.
*** NEW FEATURE ***
8/19/2001: beazley
SWIG is much better at parsing certain C++ declarations. Operators and
friends generally don't cause anymore syntax errors. However, neither
are really supported.
8/18/2001: beazley
Added *highly* experimental support for wrapping of C++
template declarations. Since C++ templates are essentially
glorified macros and SWIG has a fully operational C
preprocessor with macro support, the parser now converts
template declarations to macros. For example, a function
template like this
template<class T> T max(T a, T b);
is internally converted into a macro like this:
%define %_template_max(__name,T)
%name(__name) T max(T a, T b);
%enddef
To instantiate a version of the template, a special %template declaration
is used like this:
%template(maxint) max<int>;
%template(maxdouble) max<double>;
The parameter to the %template directive must be proper C identifier that's
used to uniquely name the resulting instantiation. When used, the
the expanded macro looks like this:
%name(maxint) int max(int a, int b);
%name(maxdouble) double max(double a, double b);
A similar technique is used for template classes. For instance:
template<class T> class vector {
T *data;
int sz;
public:
vector(int nitems);
T *get(int n);
...
};
Gets converted into a macro like this:
%define %_template_vector(__name, T)
%{
typedef vector<T> __name;
%}
class __name {
T *data;
int sz;
public:
__name(int nitems);
T *get(int n);
...
};
typedef __name vector<T>;
%enddef
An a specific instantiation is created in exactly the same way:
%template(intvec) vector<int>;
The resulting code parsed by SWIG is then:
%{
typedef vector<int> intvec;
%}
class intvec {
int *data;
int sz;
public:
intvec(int nitems);
int *get(int n);
...
};
typedef intvec vector<int>;
Note: the last typedef is non-standard C and is used by SWIG to provide
an association between the name "intvec" and the template type
"vector<int>".
CAUTION: This is an experimental feature and the first time SWIG has
supported C++ templates. Error reporting is essential non-existent.
It will probably break in certain cases.
*** EXPERIMENTAL NEW FEATURE ****
8/15/2001: beazley
Change to wrapping of multi-dimensional arrays. Arrays
are now properly mapped to a pointer to an array of
one less dimension. For example:
int [10]; --> int *
int [10][20]; --> int (*)[20];
int [10][20][30]; --> int (*)[20][30];
This change may break certain SWIG extensions because
older versions simply mapped all arrays into a single
pointer such as "int *". Although possibly unusual,
the new version is correct in terms of the C type system.
*** POTENTIAL INCOMPATIBILITY ***
8/06/2001: cheetah (william fulton)
* [Java] Array setters generated for struct/class array members.
8/13/2001: beazley
Many improvements to Tcl/Perl/Python modules to better
work with multiple interface files and the %import directive.
8/13/2001: beazley
Fixed up the behavior of %import in the Python module.
SWIG no longer pollutes the module namespace by using
'from module import *' to refer to the other module.
Instead, it does a proper 'import module'. Also, SWIG
may work a lot better when importing modules that include
references to other imported modules.
8/13/2001: mkoeppe
Added new typemap substitutions, generalizing those of the
Guile-specific 5/27/2001 changes:
* $descriptor is the same as SWIGTYPE$mangle, but also
ensures that the type descriptor of this name gets
defined.
* $*type, $*ltype, $*mangle, $*descriptor are the same as
the variants without star, but they REMOVE one level of
pointers from the type. (This is only valid for pointer
types.)
* $&type, $<ype, $&mangle, $&descriptor are the same as
the variants without ampersand, but they ADD one level of
pointers to the type.
The Guile-specific substitution $basedescriptor was removed
because it was useless.
8/12/2001: beazley
The %extern directive is now deprecated and withdrawn. The
purpose of this directive was to import selected definitions
from other interface files and headers. However, the same
functionality is better handled through %import. This
leaves SWIG with two file inclusion directives:
%include filename - Inserts into current interface
%import filename - Import types and classes from
another module
*** POTENTIAL INCOMPATIBILITY ***
8/09/2001: beazley
Added new support for wrapping C/C++ callback functions.
A common problem with some C libraries is that many
functions take a function pointer as an argument. For example:
int do_op(..., int (*op)(int,int), ...);
Unfortunately, the only way to call such a function is to
pass it a function pointer of some compatible type. In
previous versions of SWIG, you had to solve this problem
with some really gross hacks. For example, if you wanted to
use the following function as a callback,
int foo(int, int);
you had to install a pointer to it as a constant. For example:
%constant int (*FOO)(int,int) = foo;
or
const int (*FOO)(int,int) = foo;
or if you had a really old SWIG version:
typedef int (*OP_FUNC)(int,int);
int do_op(..., OP_FUNC, ...);
const OP_FUNC FOO = foo;
Now, you can do one of two things:
%constant int foo(int,int);
This creates a constant 'foo' of type int (*)(int,int).
Alternatively, you can do this:
%callback("%s")
int foo(int,int);
int bar(int,int);
%nocallback
In this case, the functions are installed as constants where
the name is defined by the format string given to %callback().
If the names generated by the format string differ from the
actual function name, both a function wrapper and a callback
constant are created. For example:
%callback("%(upper)s")
int foo(int,int);
int bar(int,int);
%nocallback
Creates two wrapper functions 'foo', 'bar' and additionally
creates two callback constants 'FOO', 'BAR'.
Note: SWIG still does not provide automatic support for
writing callback functions in the target language.
*** NEW FEATURE ***
8/06/2001: cheetah (william fulton)
* struct nesting fixes as per SF bug #447488.
8/03/2001: beazley
The %name directive now applies to constants created with
#define and %constant. However, most language modules
were never written to support this and will have to be
modified to make it work. Tcl, Python, and Perl modules
are working now.
*** NEW FEATURE ***
8/03/2001: beazley
Massive changes and simplification of C declaration parsing.
Although SWIG is still not a full C parser, its ability
to handle complex datatypes including pointers to functions
and pointers to arrays has been vastly improved.
8/03/2001: cheetah (william fulton)
* Distribution fixes: autoconf no longer needed to install SWIG.
8/02/2001: beazley
Removed two undocumented parsing features. SWIG no longer
supports out-of-class static function or variable
declarations. For example:
static int Foo::bar;
This feature may return if there is sufficient demand.
However, since SWIG is most often used with header files,
it is more likely for these definitions to be included
in the class definition.
*** POTENTIAL INCOMPATIBILITY ***
8/02/2001: cheetah (william fulton)
* Cleanup of the GIFPlot examples. Upgraded Java GIFPlot example.
8/01/2001: cheetah (william fulton)
* [Java] Efficiency changes: _cPtr used where possible rather than
getCPtr(). Bug fixes for inheritance - derived class sometimes
didn't delete the c memory when _delete() was called.
* [Java] Abstract c++ classes are wrapped with a java abstract shadow
class. Also a pure virtual function is mapped with an abstract method.
* The default output file has always been <module>_wrap.c. It is now
<module>_wrap.cxx if the -c++ commandline option is passed to swig.
This has been done as otherwise c++ code would appear in a c file.
*** POTENTIAL INCOMPATIBILITY ***
7/31/2001: beazley
Modified the %constant directive to be more C-like in syntax.
The syntax is now:
%constant NAME = VALUE;
%constant TYPE NAME = VALUE;
For example:
%constant Foo *Bar = &Spam;
A more subtle case is as follows:
%constant int (*FOO)(int,int) = blah;
*** POTENTIAL INCOMPATIBILITY *** Modules that were using
the %constant directive directly will need to be modified.
7/30/2001: beazley
Removed obscure and undocumented form of the %inline directive:
%inline int blah(int a, int b) {
...
}
*** POTENTIAL INCOMPATIBILITY ***
(note: this feature was never documented and is withdrawn)
7/30/2001: beazley
Removed support for functions with no explicitly declared
return type. For example:
foo(int);
In C, such functions were implicitly assumed to return an 'int'.
In C++, this is illegal. Either way, it's considered bad
style. Removing support for this in SWIG will simplify
certain issues in parsing.
*** POTENTIAL INCOMPATIBILITY ***
7/30/2001: mkoeppe
* Partial merge from the CVS trunk. The Source/DOH directory
and most of the Source/Swig directory is up-to-date now.
* [Guile] %scheme is now a macro for %insert("scheme").
New syntax: %scheme "FILENAME";
New syntax: %scheme %{ SCHEME-CODE %}
New macros %multiple_values, %values_as_list,
%values_as_vector.
7/29/2001: beazley
%readonly and %readwrite have been turned into SWIG pragmas.
%pragma(swig) readonly and %pragma(swig) readwrite. Macros
are used to provide backwards compatibility.
7/29/2001: beazley
Minor changes to %pragma directive. %pragma must always
be directed to a specific language. For example:
%pragma(swig) make_default;
%pragma(perl5) include = "blah.i";
Also extended the pragma directive to allow code blocks
%pragma(foo) code = %{
... some code ...
%}
*** POTENTIAL INCOMPATIBILITY ***
7/29/2001: beazley
Change to the way 'const' variables are wrapped. In
previous versions of SWIG, a 'const' variable was
wrapped as a constant. Now, 'const' variables are
wrapped as read-only variables. There are several
reasons for making this change, mostly pertaining to
subtle details of how 'const' actually works.
This will probably break old interfaces that used 'const'
to create constants. As a replacement, consider using this:
const int a = 4; ===> %constant int a = 4;
*** POTENTIAL INCOMPATIBILITY ***
7/29/2001: beazley
Reorganization and simplification of type parsing.
Types with 'const' should work correctly now.
7/29/2001: beazley
Most swig directives related to the documentation system
are now deprecated.
7/29/2001: beazley
Removed support for Objective-C in order to simplify
parser reconstruction. Will return if there is sufficient
demand.
*** POTENTIAL INCOMPATIBILITY ***
7/29/2001: beazley
Code inclusion has been modified in the parser. A common
directive %insert is now used for everything. This
inserts a file into the output:
%insert(header) "foo.swg"
This inserts some inline code into the output
%insert(header) %{
... some code ...
%}
There are five predefined targets for the insert directive:
"header" - Header section of wrapper file
"runtime" - Runtime section of wrapper file
"wrapper" - Wrapper section
"init" - Initialization function
"null" - Nothing. Discard.
The following directives are still supported, but are
now defined in terms of macros:
%{ ... %} -> %insert(header) %{ ... %}
%init %{ ... %} -> %insert(init) %{ ... %}
%wrapper %{ ... %} -> %insert(wrapper) %{ ... %}
%runtime %{ ... %} -> %insert(runtime) %{ ... %}
Language modules can define new named targets by using the
C API function Swig_register_filebyname() (see main.cxx).
For example, if you wanted to expose a shadow class file,
you could do this:
Swig_register_filebyname("shadow", f_shadow);
Then in the interface file:
%insert(shadow) %{ ... %}
Note: this change should not affect any old interfaces, but
does open up new possibilities for enhancements.
7/29/2001: beazley
SWIG now always includes a standard library file 'swig.swg'.
This file defines a large number of macro definitions
that define the behavior of various SWIG directives.
Previously, all SWIG directives were handled as special
cases in the parser. This made the parser a large
bloated mess. Now, the parser is stripped down to a few
simple directives and macros are used to handle everything else.
7/26/2001: cheetah (william fulton)
* Fixes for Sourceforge bug #444748 - new testcase cpp_static:
[TCL] Class with just static member variable/function fix
[Java] Fixed static variables support
[Ruby] Static variables workaround removed
7/27/2001: mkoeppe
* stype.c (SwigType_default): Strip qualifiers first. The
default type of "int * const" is now "SWIGPOINTER *".
* main.cxx: Define "__cplusplus" in SWIG's preprocessor if
in C++ mode.
* [Guile]: Added some support for arrays and C++
references, fixing the "constant_pointers" test case.
* Moved most tests from the old Guile-specific test-suite
to the new test-suite. Also moved perl5/pointer-cxx
example there.
7/26/2001: cheetah (william fulton)
* Test-suite added.
* Initial testcases: constant_pointers cpp_enum defines
sizeof_pointers unions virtual_destructor
* Make clean improvements.
7/24/2001: cheetah (william fulton)
* [Java] Underscores in the package name and/or module name
no longer give linking problems.
7/17/2001: cheetah (william fulton)
* More parser bug fixes for constant pointers
7/19/2001: mkoeppe
* [Guile] Aesthetic improvement in variable wrappers.
7/18/2001: beazley
* Fixed core-dump problem in pointer library when
freeing character arrays.
SF Bug [ #415837 ] pointer lib core dump
7/18/2001: beazley
* Fixed problem with default destructors and shadow
classes. SF bug #221128.
7/18/2001: beazley
* To provide better line-number tracking in interfaces
with lots of macros, special locator comments are
now generated by the SWIG preprocessor. For example:
/*@foo.i,42,BLAH@*/expanded macro/*@@*/
The first /*@...@*/ sequence sets the context
to point to the macro code. The /*@@*/ comment
terminates the context. The SWIG parser should
ignore all of the locator comments as should
the C compiler (should such comments end up
in generated wrapper code).
7/18/2001: mkoeppe
* The parser now handles severely constified types in
typemaps. This introduced a new shift/reduce conflict, but
only with a heuristic function-pointer catch-all rule.
* [Guile]: Added typemaps for severely constified types.
* Fixed the "template-whitespace" problem by canonicalizing
whitespace, especially around angle brackets and commas.
7/17/2001: mkoeppe
* [Guile]: A Scheme file is emitted if the -scmstub FILE.SCM
command-line option is used. The %scheme directive
(implemented as a macro for a pragma) allows to insert
arbitrary code here. In "simple" and "passive" linkage,
the file gets filled with define-module and export
declarations.
7/17/2001: cheetah (william fulton)
* Parser bug fix to support constant pointers, eg int* const ptr.
Fixed everywhere - variables, parameters, return types etc. Note that
when wrapping a constant pointer variable only the getter is generated.
7/17/2001: mkoeppe
* Fixed SF bug #441470 (#define X "//" would not be parsed,
see test-suite entry "preproc-1"), reported by T. W. Burton
<twburton@users.sf.net>.
* Changed the type of character constants to "char", rather
than "char *". Changed the individual language modules
to keep the old behaviour, except for the Guile module,
where it is desired to make them Scheme characters. This
fixes SF bug #231409, test-suite entry "char-constant".
* Applied patch for DOH/Doh/memory.c by Les Schaffer
<schaffer@optonline.net> (avoid required side effects in
assert).
7/17/2001: cheetah (william fulton)
* Bug fix in parser for virtual destructor with void as parameter
* Bug fix in parser #defines embedded within classes/structs/unions
Consequently %constant can now also be placed within a struct/class/union.
* Bug fix in parser to allow sizeof(*I_am_a_pointer) within a #define
7/16/2001: mkoeppe
* Added changes for the Macintosh contributed by Luigi
Ballabio <ballabio@mac.com>.
* Some "const" fixes in the code.
* [Guile]: Made the constant-wrapper functions much shorter.
7/13/2001: mkoeppe
* [Guile]: Some "const" fixes for Guile version 1.3.4.
* Handle anonymous arguments with default values and static
array members of classes. Both bugs reported by Annalisa Terracina
<annalisa.terracina@datamat.it>; see the files
Examples/guile/test-suite/static-array-member.i and
anonymous-arg.i.
Version 1.3.6 (July 9, 2001)
=============================
7/09/2001: cheetah (william fulton)
* GIFPlot examples: FOREGROUND and BACKGROUND definition missing
after TRANSPARENT #define fix in GIFPlot
7/03/2001: beazley
Fixed up the version numbers so that the release is known
as 1.3.6. All future releases should have a similar
version format.
7/02/2001: mkoeppe
* [Python]: Prevent the problem of self.thisown not being
defined if the C++ class constructor raised an exception.
Thanks to Luigi Ballabio <ballabio@mac.com>.
6/29/2001: mkoeppe
* More portability fixes; fixed "gcc -Wall" warnings.
6/29/2001: cheetah (william fulton)
* GIFPlot examples: TRANSPARENT #define multiple times on Solaris
(clashes with stream.h).
* Multiple definition bug fix for shadow classes. The perl and python
modules had workarounds which have been replaced with fixes in
the core. Many of the Language::cpp_xxxx functions now set a
flag which the derived classes can access through
is_multiple_definition() to see whether or not code should be
generated. The code below would have produced varying degrees
of incorrect shadow class code for the various modules:
class TestClass
{
public:
TestClass() {};
TestClass(int a) {};
~TestClass() {};
unsigned long xyz(short k) {};
unsigned long xyz(int n) {};
static void static_func() {};
static void static_func(int a) {};
};
void delete_TestClass(int a);
6/27/2001: mkoeppe
* [Perl] Another const-related portability fix.
6/26/2001: cheetah (william fulton)
* [Java] Added in cpp_pragma() support with a host of new pragmas - see
jswig.html. These are designed for better mixing of Java and c++. It
enables the user to specify pure Java classes as bases and/or interfaces
for the wrapped c/c++.
* [Java] Old pragmas renamed. Warning given for the moment if used.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
6/25/2001: mkoeppe
* Incorporated more build changes contributed by Wyss Clemens
<WYS@helbling.ch> for swig/ruby on cygwin.
6/20/2001: cheetah (william fulton)
* Makefile mods so that 'make check' uses the swig options in the makefiles
* [Java] Removed Generating wrappers message
* [Java] NULL pointer bug fix
* [Java] Bug fix for Kaffe JVM
6/20/2001: mkoeppe
* SWIG_TypeQuery from common.swg now returns a
swig_type_info* rather than a void*. This fixes a problem
when using pointer.i and C++, as illustrated by the new
test-suite example perl5/pointer-cxx.
* Portability fixes (const char *).
* Incorporated build changes contributed by Wyss Clemens
<WYS@helbling.ch>, which make swig runnable on cygwin.
6/19/2001: cheetah (william fulton)
* [Java] Bug fix for SF bug #211144. This fix is a workaround
until fixed in the core.
6/19/2001: mkoeppe
* [Guile]: Portability fixes for use with the Sun Forte
compilers.
* [Tcl]: Portability fix (const char *).
* [Tcl]: Configure now first tries to find a tclConfig.sh
file in order to find the Tcl include directory, library
location and library name.
* [Python]: Added a few possible library locations.
6/18/2001: mkoeppe
* [Guile]: Don't call scm_c_export if nothing is to be
exported. Don't warn on %module if module has been set
already (this frequently occurs when %import is used).
6/16/2001: mkoeppe
* [Guile]: New "passive" linkage, which is appropriate for
multi-module extensions without Guile module magic.
6/15/2001: mkoeppe
* [Guile]: Fixed printing of smobs (space and angle were
missing).
* Properly generate type information for base classes
imported with the %import directive. Thanks to Marcelo
Matus <mmatus@acms.arizona.edu> for the report and the
patch; this closes SF bug #231619; see also
Examples/guile/test-suite/import*.
* [Guile]: Fix casting between class and base class; the
runtime type system had it the wrong way around; see
Examples/guile/test-suite/casts.i
* Make typemaps for SWIGPOINTER * with arg name take
precedence over those without arg name, to match normal
typemap precedence rules.
* Fixed the random-line-numbers problem reported as SF bug
#217310; thanks to Michael Scharf <scharf@users.sf.net>.
* [Guile]: Handle the %name and %rename directives.
* New syntax: %name and %rename now optionally take double
quotes around the scripting name. This is to allow scripting
names that aren't valid C identifiers.
6/14/2001: beazley
Made a minor change to the way files are loaded in
order to get file/line number reporting correct in
the preprocessor.
6/14/2001: mkoeppe
* The parser now understands the (non-standard) "long long"
types. It is up to the individual language modules to
provide typemaps if needed. Reported by Sam Steingold, SF
bug #429176.
* The parser now understands arguments like "const int *
const i". This fixes SF bug #215649.
* Fixed the Guile test-suite.
6/13/2001: mkoeppe
Partial merge from the CVS trunk at tag
"mkoeppe-merge-1". This covers the following changes:
| 01/16/01: ttn
| Wrote table of contents for Doc/engineering.html. Added section
| on CVS tagging conventions. Added copyright to other docs.
| 9/25/00 : beazley
| Modified the preprocessor so that macro names can start with a '%'.
| This may allow new SWIG "directives" to be defined as macros instead
| of having to be hard-coded into the parser.
|
| *** Also a yet-to-be-documented quoting mechanism with backquotes
| *** has been implemented?
6/13/2001: mkoeppe
* When configure does not find a language, don't use default
paths like /usr/local/include; this only causes build
problems.
* New directory: Examples/Guile/test-suite, where a few
bugs in 1.3a5 are demonstrated.
* Handle C++ methods that have both a "const" and a "throw"
directive (see Examples/Guile/test-suite/cplusplus-throw.i);
thanks to Scott B. Drummonds for the report and the fix.
* Handle C++ pointer-reference arguments (like "int *& arg")
(see Examples/Guile/test-suite/pointer-reference.i,
reported as SF bug #432224).
* [Ruby] Fixed typo in rubydec.swg; thanks to Lyle Johnson!
* Don't stop testing when one test fails.
* [Guile, MzScheme] Don't print "Generating wrappers...".
6/12/2001: mkoeppe
[Guile] VECTORLENINPUT and LISTLENINPUT now have separate
list length variables. TYPEMAP_POINTER_INPUT_OUTPUT
attaches argument documentation involving SCM_TYPE to the
standard pointer typemaps. INOUT is now an alias for BOTH.
6/12/2001: cheetah (william fulton)
Some Java documentation added.
[Java] Fixed bugs in import pragma and shadow pragma.
6/12/2001: mkoeppe
Fix declarations of SWIG_define_class
(Lib/ruby/rubydec.swg) and SWIG_TypeQuery
(Lib/common.swg). Thanks to Lyle Johnson
<ljohnson@resgen.com> for the patches.
6/11/2001: mkoeppe
[Guile] Use long instead of scm_bits_t; this makes the
generated wrapper code compatible with Guile 1.3.4
again. Thanks to Masaki Fukushima for pointing this out.
6/11/2001: cheetah (william fulton)
The generic INSTALL file from autoconf added. Few changes to README file.
6/11/2001: mkoeppe
Fixed typo in Makefile.in; thanks to Greg Troxel
<gdt@ir.bbn.com>.
6/08/2001: cheetah (william fulton)
make check works again. Examples/GIFPlot configure generated by
top level autoconf now.
6/08/2001: mkoeppe
Another build change: The new script autogen.sh runs
autoconf in the appropriate directories. The top-level
configure also configures in Examples/GIFPlot.
6/07/2001: mkoeppe
Made the Makefile work with non-GNU make again.
6/07/2001: cheetah (william fulton)
[Java] Class/struct members that are arrays of pointers to classes/structs -
Shadow class's get/set accessors now use Java classes instead of longs (pointers).
[Java] Shadow classes will now clean up memory if function return type
is a class/struct.
[Java] New example called reference based on the same example from other modules.
6/06/2001: mkoeppe
New configure option --with-release-suffix allows for
attaching a suffix to the swig binary and the swig runtime
libraries. Minor changes to the build system. "swig
-swiglib" works again. If invoked with the new option
"-ldflags", SWIG prints a line of linker flags needed to
link with the runtime library of the selected language
module.
6/06/2001: mkoeppe
[Guile] gswig_list_p is an int, not a SCM. This typo
caused warnings when compiling with a Guile configured with
strict C type checking. In INPUT and BOTH typemaps
generated by the SIMPLE_MAP macro, use the SCM_TO_C
function to convert from Guile to C (rather than C_TO_SCM).
Use scm_intprint to print pointers (rather than
sprintf). Allow using "-linkage" instead of "-Linkage".
6/05/2001: cheetah (william fulton)
[Java] Mods for using inherited c++ classes from Java
[Java] New example called class based on the same example from other modules
6/05/2001: cheetah (william fulton)
[Java] destructor (_delete()) was not aware of %name renaming
[Java] extends baseclass did not know about %name renaming
[Java] extends baseclass did extend even when the baseclass was not known to swig
[Java] sometimes enum-declarations occured before the Java class declaration
[Java] unrelated enum initialisations no longer appear in Java class
[Java] if module ends in '_' correct JNI names are now produced
6/04/2001: cheetah (william fulton)
[Java] Shadow class mods - Modified constructor replaces
newInstance(). _delete() now thread safe. getCPtr() replaces
_self. _selfClass() removed as now redundant.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
[Java] Not all output java files had SWIG banner. New banner.
[Java] Shadow class finalizers are output by default: Command
line option -finalize deprecated and replaced with -nofinalize.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
6/ 1/2001: mkoeppe
[Guile] Cast SCM_CAR() to scm_bits_t before shifting it.
This is required for compiling with a Guile configured with
strict C type checking.
6/ 1/2001: mkoeppe
Added configure option "--with-swiglibdir".
5/31/2001: mkoeppe
[Guile] Support multiple parallel lists or vectors in
the typemaps provided by list-vector.i. New typemaps file,
pointer-in-out.i.
5/25/2001: cheetah (william fulton)
[Java] HTML update for examples.
5/28/2001: mkoeppe
Minor changes to the build system. Added subdirectory for
Debian package control files.
5/28/2001: mkoeppe
[Guile] Build a runtime library, libswigguile.
5/28/2001: mkoeppe
[Guile] New typemap substitution $*descriptor. Use the {}
syntax, rather than the "" syntax for the standard
typemaps, in order to work around strange macro-expansion
behavior of the SWIG preprocessor. This introduces some
extra braces.
5/27/2001: mkoeppe
[Guile] Handle pointer types with typemaps, rather than
hard-coded. New typemap substitutions $descriptor,
$basedescriptor; see documentation. Some clean-up in the
variable/constants wrapper generator code. New convenience
macro SWIG_Guile_MustGetPtr, which allows getting pointers
from smobs in a functional style. New typemap file
"list-vector.i", providing macros that define typemaps for
converting between C arrays and Scheme lists and vectors.
5/25/2001: cheetah (william fulton)
[Java] STL string moved into its own typemap as it is c++ code and
it break any c code using the typemaps.i file.
- Fixes for wrappers around global variables - applies to primitive
types and user types (class/struct) and pointers to these.
- Structure member variables and class public member variables getters
and setters pass a pointer to the member as was in 1.3a3 and 1.1
(1.3a5 was passing by value)
- Parameters that were arrays and return types were incorrectly
being passed to create_function() as pointers.
- Fix for arrays of enums.
[Java] Updated java examples and added two more.
[Java] Java module updated from SWIG1.3a3 including code cleanup etc.
[Java] enum support added.
[Java] Array support implemented
[Java] Shadow classes improved - Java objects used rather than
longs holding the c pointer to the wrapped structure/c++class
5/22/2001: mkoeppe
[Guile] Fixed extern "C" declarations in C++ mode. Thanks
to Greg Troxel <gdt@ir.bbn.com>.
5/21/2001: mkoeppe
[Guile] New linkage "module" for creating Guile modules for
Guile versions >= 1.5.0.
4/18/2001: mkoeppe
[MzScheme] Added typemaps for passing through Scheme_Object
pointers.
4/9/2001 : mkoeppe
[MzScheme] Added typemaps for `bool'. Inclusion of headers
and support routines is now data-driven via mzscheme.i.
Headers come from the new file mzschemdec.swg. Don't abort
immediately when a type-handling error is reported. When
searching for typemaps for enums, fall back to using int,
like the Guile backend does. Support char constants. Emit
correct wrapper code for variables.
3/12/2001: mkoeppe
[Guile] Fixed typemaps for char **OUTPUT, char **BOTH.
3/2/2001 : mkoeppe
[Guile] Every wrapper function now gets a boolean variable
gswig_list_p which indicates whether multiple values are
present. The macros GUILE_APPEND_RESULT, GUILE_MAYBE_VALUES
and GUILE_MAYBE_VECTOR use this variable, rather than
checking whether the current return value is a list. This
allows for typemaps returning a list as a single value (a
list was erroneously converted into a vector or a
multiple-value object in this case).
3/1/2001 : mkoeppe
[Guile] Added support for returning multiple values as
vectors, or passing them to a muliple-value
continuation. By default, multiple values still get
returned as a list.
3/1/2001 : mkoeppe
[Guile] Added a "beforereturn" pragma. The value of this
pragma is inserted just before every return statement.
3/1/2001 : mkoeppe
[Guile] Added support for Guile 1.4.1 procedure
documentation formats, see internals.html.
2/26/2001: mkoeppe
[Guile] Made the wrapper code compile with C++ if the
"-c++" command-line switch is given. Thanks to
<monkeyiq@dingoblue.net.au>.
2/26/2001: mkoeppe
[Guile] Now two type tables, swig_types and
swig_types_initial, are used, as all other SWIG language
modules do. This removes the need for the tricky
construction used before that the broken Redhat 7.0 gcc
doesn't parse. Reported by <monkeyiq@dingoblue.net.au>.
2/26/2001: mkoeppe
[Guile] Fixed typemaps for char *OUTPUT, char *BOTH; a bad
free() would be emitted. Added typemap for SCM.
Version 1.3 Alpha 5
===================
9/19/00 : beazley
[Python] Python module generates more efficient code for
creating the return value of a wrapper function. Modification
suggested by Jon Travis.
9/19/00 : beazley
Library files specified with the -l option are now included at the
end of the interface file (reverting to the old behavior).
9/19/00 : beazley
Fixed some problems with enum handling. enums are now manipulated as
'int', but cast into the enum type when values are passed to the
corresponding C function.
9/19/00 : mkoeppe
[Guile] Removed "-with-smobs" command-line option, as this is the
default now. Added "-emit-setters" command-line option,
which turns on generating procedures-with-setters; see
internals.html.
9/18/00 : mkoeppe
Incorporated patch #101430, fixing bugs in the Guile module:
1. Some arguments were erroneously taken as *optional* arguments when
ignored arguments were present.
2. Guile 1.3.4 was not supported since functions introduced in Guile
1.4 were used.
3. Added handling of `const char *'.
9/17/00 : beazley
Fixed problem with failed assertion and large files.
9/17/00 : beazley
Fixed problem with the '%' character appearing in added methods
and function bodies. Preprocessor bug.
Version 1.3 Alpha 4 (September 4, 2000)
======================================
9/3/00 : ttn
Added instructions for maintainers in Examples/README on how
to make examples also be useful in the testing framework.
Also, "make check" now uses ./Lib by via env var `SWIG_LIB'.
This is overridable like so:
make chk-swiglib=/my/experimental/swig/Lib check
9/3/00 : beazley
Added $typemap variable to typemaps. This gets replaced with
a string indicating the typemap that is applied. Feature
request from rsalz.
9/3/00 : beazley
Experimental optimization to code generation for virtual
member functions. If you have two classes like this:
class A() {
virtual void foo();
}
class B() : public A {
virtual void foo();
}
Swig now will generate a single wrapper function for this
A_foo(A *a) {
a->foo();
}
and use it as the implementation of both A_foo() and B_foo().
This optimization only takes place if both methods are declared
as virtual and both take identical parameters.
*** EXPERIMENTAL FEATURE ***
9/3/00 : beazley
Restored the "memberin" typemap for setting structure members.
Unlike the old version, the new version is expanded inline in the
wrapper function allowing access to scripting language
internals (a sometimes requested feature). The "memberout" typemap
is gone. Use the "out" typemaps instead.
*** POTENTIAL INCOMPATIBILITY ***
9/3/00 : beazley
Attribute set methods no longer return the value of a member.
For example:
struct Foo {
int x;
...
}
now gets set as follows:
void Foo_x_set(Foo *f, int x) {
f->x = x;
}
In SWIG1.1 it used to be this:
int Foo_x_set(Foo *f, int x) {
return (f->x = x);
}
This has been changed due to the complexity created by trying
to do this with more exotic datatypes such as arrays. It also
complicates inlining and handling of the "memberin" typemap.
*** POTENTIAL INCOMPATIBILITY ***
9/2/00 : beazley
Removed the ptrcast() and ptrmap() functions from the
pointer.i library file. Old implementation is incompatible
with new type system.
*** POTENTIAL INCOMPATIBILITY ***
9/2/00 : beazley
New runtime function SWIG_TypeQuery(const char *name) added.
This function can be used to extract the type info structure
that is used for type-checking. It works with either the
nice C name or mangled version of a datatype. For example:
swig_type_info *ty = Swig_TypeQuery("int *");
swig_type_info *ty = Swig_TypeQuery("_p_int");
This is an advanced feature that has been added to support some
exotic extension modules that need to directly manipulate
scripting language objects.
*** NEW FEATURE ***
9/2/00 : beazley
New directive %types() added. This is used to
explicitly list datatypes that should be included in
the runtime type-checking code. Normally it is never
necessary to use this but sometimes advanced extensions
(such as the pointer.i library) may need to manually
add types to the type-checker.
*** NEW FEATURE ***
8/31/00 : beazley
Improved handling of string array variables. For example,
a global variable of the form "char name[64]" is automatically
managed as a 64 character string. Previously this didn't
work at all or required the use of a special typemap.
*** NEW FEATURE (Tcl, Perl, Python) ***
8/31/00 : ttn
Added Makefile target `check-c++-examples', which uses new
files under Examples/C++ contributed by Tal Shalif. Now "make
check" also does "make check-c++-examples". Also, expanded
actions in `check-gifplot-example' and `check-aliveness'.
8/30/00 : mkoeppe
Major clean-up in the Guile module. Added typemap-driven
documentation system. Changed to handle more than 10
args. Updated and extended examples.
*** NEW FEATURE ***
8/29/00 : beazley
Added new %insert directive that inserts the contents of a file
into a portion of the output wrapper file. This is only intended
for use by writers of language modules. Works as follows:
%insert(headers) "file.swg";
%insert(runtime) "file.swg";
%insert(wrappers) "file.swg";
%insert(init) "file.swg";
*** NEW FEATURE ***
8/29/00 : beazley
Added new %runtime directive which includes code into the runtime
portion of the wrapper code. For example:
%runtime %{
... some internal runtime code ...
%}
There is no practical reason for ordinary users to use this
feature (almost everything can be done using %{ ... %}
instead). However, writers of language modules may want to
use this in language configuration files.
*** NEW FEATURE ***
8/28/00 : beazley
Typemaps can now be specified using string literals like
this:
%typemap(in) int "$target = SvIV($source);";
When code is specified like this, it is *NOT* enclosed
inside a local scope (as with older typemap declarations).
Note: character escape sequences are interpreted in the
code string so if you want to include a quote or some
other special character, make sure you use a (\).
*** NEW FEATURE ***
8/27/00 : beazley
Typemaps have been modified to follow typedef declarations.
For example, if you have this:
typedef int Number;
%typemap(in) int {
... get an integer ...
}
void foo(Number a);
The typemap for 'int' will be applied to the argument 'Number a'.
Of course, if you specify a typemap for 'Number' it will take
precedence (nor will it ever be applied to an 'int').
*** POTENTIAL INCOMPATIBILITY ***
8/27/00 : beazley
Default typemap specification has changed. In older
versions of swig, you could do this:
%typemap(in) int SWIG_DEFAULT_TYPE {
...
}
To specify the default handling of a datatype. Now that
SWIG follows typedef declarations, this is unnecessary.
Simply specifying a typemap for 'int' will work for all
variations of integers that are typedef'd to 'int'.
Caveat, specifying the default behavior for pointers,
references, arrays, and user defined types is a little
different. This must be done as follows:
%typemap() SWIGPOINTER * {
... a pointer ...
}
%typemap() SWIGREFERENCE & {
... a reference ...
}
%typemap() SWIGARRAY [] {
... an array ...
}
%typemap() SWIGTYPE {
... a user-defined type (by value) ...
}
*** POTENTIAL INCOMPATIBILITY ***
8/15/00 : dustin
The file swig-1.3a1-1.spec has been added to the Tools directory.
It can be used to build a redhat package for SWIG, although it
will need to be updated for the next public release.
8/15/00 : beazley
Typemaps have been completely rewritten. Eventually they may be
replaced with something better, but for now they stay. However,
there are a number of a significant changes that may trip some
people up:
1. Typemap scoping is currently broken. Because of this, the
following code won't work.
%typemap(in) blah * {
...
}
class Foo {
...
int bar(blah *x);
}
%typemap(in) blah *; /* Clear typemap */
(this breaks because the code for the class Foo is actually
generated after the entire interface file has been processed).
This is only a temporary bug.
2. In SWIG1.1, the %apply directive worked by performing a
very complex type-aliasing procedure. From this point on,
%apply is simply a generalized typemap copy operation.
For example,
%apply double *OUTPUT { double *x, double *y };
Copies *ALL* currently defined typemaps for 'double *OUTPUT' and
copies them to 'double *x' and 'double *y'.
Most people probably won't even notice this change in
%apply. However, where it will break things is in code like
this:
%apply double *OUTPUT { double *x };
%typemap(in) double *OUTPUT {
... whatever ...
}
void foo(double *x);
In SWIG1.1, you will find that 'foo' uses the 'double *OUTPUT' rule
even though it was defined after the %apply directive (this is
the weird aliasing scheme at work). In SWIG1.3 and later,
the 'double *OUTPUT' rule is ignored because it is defined
after the %apply directive.
3. The %clear directive has been modified to erase all currently
defined typemaps for a particular type. This differs from
SWIG1.1 where %clear only removed rules that were added using
the %apply directive.
4. Typemap matching is now performed using *exact* types.
This means that things like this
%typemap(in) char * { }
%typemap(in) const char * { }
are different typemaps. A similar rule applies for pointers,
arrays, and references. For example:
%typemap(in) double * { }
used to apply to 'double &', 'double []', Now, it only applies
to 'double *'. If you want a 'double &', you'll need to handle
that separately.
5. Array matching has been simplfied. In SWIG1.1, array matching
was performed by trying various combinations of dimensions.
For example, 'double a[10][20]' was matched as follows:
double [10][20]
double [ANY][20]
double [10][ANY]
double [ANY][ANY]
In SWIG1.3, only the following matches are attempted:
double [10][20]
double [ANY][ANY]
On the positive side, typemap matching is now *significantly* faster
than before.
*** POTENTIAL INCOMPATIBILITY ***
8/15/00 : beazley
Secret developer feature. Since datatypes are now represented as
strings internally, you can bypass limitations of the parser and
create a wild datatype by simply enclosing the raw string encoding
in backticks (``) and sticking it in the interface file anywhere a
type is expected. For example, `a(20).a(10).p.f(int,int)`. This
feature is only intended for testing (i.e., you want to see what
happens to your language module if it gets a reference to a pointer
to an array of pointers to functions or something).
*** SICK HACK ***
8/14/00 : beazley
Completely new type-system added to the implementation.
More details later.
8/11/00 : beazley
Cleaned up some of the I/O handling. SWIG no longer generates
any temporary files such as _wrap.wrap, _wrap.ii, _wrap.init.
Instead, these "files" are kept around in memory as strings
(although this is transparent to language modules).
8/4/00 : ttn
Added Makefile target "check" and variants.
This can be used like "make check" or, to explicitly skip a
language LANG: "make skip-LANG=true check". LANG is skipped
automatically if ./configure determines that LANG support is
insufficient.
Currently, the check is limited to doing the equivalent of
"make all" in some of the Examples directories. This should
be expanded both horizontally (different types of tests) and
vertically (after "make all" in an Examples subdir succeeds,
do some additional tests with the resulting interpreter, etc).
8/4/00 : ttn
Added Makefile target "distclean", which deletes all the
files ./configure creates, including config.status and friends.
8/3/00 : harcoh
java changes??? [todo: document changes]
7/23/00 : beazley
Typemaps have been modified to key off of the real datatypes
used in the interface file. This means that typemaps for
"const char *" and "char *" will be difference as will typemaps
for "Vector" and "Vector *."
*** POTENTIAL INCOMPATIBILITY ***
This is likely to break interfaces that rely on the odd type
handling behavior of typemaps in SWIG1.1--especially with
respect to interfaces involving pass-by-value.
7/23/00 : beazley
New %constant directive. This directive can be used to
create true constants in the target scripting language.
It's most simple form is something like this:
%constant FOO 42;
In this case, the type is inferred from the syntax of the
value (in reality, all #define macros are translated into
directives of this form).
An expanded version is as follows:
%constant(Foo *) FOO = &FooObj;
In this case, an explicit type can be specified. This
latter form may be useful for creating constants that
used to be specified as
const Foo *FOO = &FooObj;
(which are now treated as variables).
*** EXPERIMENTAL FEATURE *** The syntax may change in
the final release.
7/23/00 : beazley
Modified the parser so that variable declarations of the form
"const type *a" are handled as variables, not constants.
Note: SWIG1.1 handled this case erroneously because
const char *a is a pointer variable that can be reassigned.
*** POTENTIAL INCOMPATIBILITY ***
Note: just because this is the "right" way to do things,
doesn't mean it's the most appropriate interpretation.
I suspect that many C programmers might use 'const char *'
with the intent of creating a constant, without realizing
that they've created a reassignable global variable.
7/23/00 : beazley
The C/C++ wrapping layer has been completely redesigned and
reimplemented. This change should iron out a few rough
spots with the handling of datatypes. In addition, the
wrapper code is somewhat cleaner.
*** POTENTIAL INCOMPATIBILITY ***
This change may break interfaces that involve
subtle corner-cases with typemaps and the %addmethods
directive since some of these features had somewhat
type handling behavior in SWIG1.1.
7/23/00 : beazley
The "memberin" and "memberout" typemaps are gone for the
moment, but they might return as soon as I figure out
how to integrate them with some of the streamlined C wrapper
functions.
*** POTENTIAL INCOMPATIBILITY ***
7/22/00 : beazley
A variety of old type handling functions such as print_type(),
print_full(), print_mangle(), etc... are gone and have been
replaced with a smaller set of functions. See the file
Doc/internals.html for details. This will break all third
party language modules.
*** POTENTIAL INCOMPATIBILITY ***
7/20/00 : beazley
Deprecated the %val and %out directives. These directives
shouldn't really be necessary since typemaps can be used
to achieve similar results. This also cleans up the
handling of types and parameters quite a bit.
*** POTENTIAL INCOMPATIBILITY ***
7/20/00 : ttn
Fixed unspecified-module bug in Guile support and removed
more non-"with-smobs" functionality using patches submitted
by Matthias Koeppe.
Re-enable recognition of "-with-smobs" (with no effect since
we use smobs by default now) for the time being. After the
1.3a4 release, this option will signal an error.
7/17/00 : ttn
Fixed NULL-input bug in parameter list handling.
Reported by Matthias Koeppe.
7/12/00 : beazley
Fixed memory leak in Python type-checking code. Reported by
Keith Davidson. Bug #109379.
7/10/00 : beazley
Changed internal data structures related to function parameters.
7/10/00 : beazley
Fixed some bugs related to the handling of the %name() directive
and classes in the Tcl module. Problem reported by James Bailey.
7/10/00 : beazley
Fixed parsing and enum handling problems with character constants.
Reported by Greg Kochanski.
7/10/00 : beazley
Removed WrapperFunction class from the core and updated the language
module. This will break third party modules.
*** POTENTIAL INCOMPATIBILITY ***
7/9/00 : beazley
Implementation of SWIG no longer makes use of C++ operator overloading.
This will almost certainly break *all* third party language modules
that are not part of the main SWIG CVS tree. Sorry.
*** POTENTIAL INCOMPATIBILITY ***
7/8/00 : beazley
Removed the experimental and undocumented "build" typemap that
was intended to work with multiple arguments. Simply too weird
to keep around. Besides, a better replacement is in the works.
7/6/00 : ttn
Removed non-"with-smobs" functionality (Guile support), i.e.,
"-with-smobs" is now the default and no longer needs to be
specified on the command-line.
7/5/00 : ttn
Incorporated Ruby support contributed by Masaki Fukushima.
6/28/00 : ttn
Applied more-than-10-args bugfix patch contributed
by Matthias Koeppe.
6/27/00 : beazley
Rewrote some of the string handling and eliminated the C++
implementation (which is now just a wrapper).
6/27/00 : ttn
Added Doc/index.html and Doc/internals.html. The target
audience for the latter is new SWIG developers.
Version 1.3 Alpha 3 (June 18, 2000)
===================================
6/18/00 : beazley
Removed the naming.cxx, hash.cxx, and symbol.cxx files from
the SWIG1.1 directory. Continued to migrate things away
from the C++ base (although there's still a lot of work to do).
6/17/00 : beazley
Added a few more examples to the Examples directory. Still
need to do a lot of work on this.
6/16/00 : beazley
Added -includeall to follow all #include statements in the
preprocessor.
6/15/00 : beazley
Tried to fix as many C++ warnings as possible when compiling
with the Sun Workshop C++ compiler. Unfortunately, this means
that there are a lot of statements that contain string literals
of the form (char*)"Blah".
6/15/00: beazley
A variety of cleanup and performance optimization in the
low-level DOH library. This seems to result in a speedup
of 50-100% for preprocessing and other related tasks.
5/10/00 : ttn
Applied variable-wrapping bugfix patch contributed
by Matthias Koeppe.
4/17/00 : ttn
Updated MzScheme support contributed by Oleg Tolmatcev.
We now use a `Scheme_Type'-based structure to wrap pointers.
4/11/00 : ttn
Incorporated further Guile-support patch by Matthias Koeppe.
Typemaps previously deleted have been re-added. There is now
exception handling (see Doc/engineering.html). `SWIG_init' is now
declared extern only for simple linkage. Some bugs were fixed.
4/06/00 : ttn
Incorporated MzScheme support contributed by Oleg Tolmatcev.
This includes new directories Lib/mzscheme and Examples/mzscheme.
4/03/00 : ttn
Added Examples/guile and children. This is an adaptation of
the same-named directory from the SWIG-1.1p5 distribution.
Added Guile-specific section to Doc/engineering.html.
4/02/00 : ttn
Incorporated new guilemain.i by Martin Froehlich.
Incorporated Guile-support rewrite patch by Matthias Koeppe.
The command line option "-with-smobs" enables implementation of
pointer type handling using smobs, the canonical mechanism for
defining new types in Guile. Previous implementation (using
strings) is at the moment still supported but deprecated. At
some point, "-with-smobs" will be the default and no longer
required.
3/13/00 : beazley
Added purify patches submitted by Ram Bhamidipaty.
3/02/00 : ttn
Added support for different Guile "linkage" schemes.
Currently, "-Linkage hobbit" works.
Version 1.3 Alpha 2 (March 1, 2000)
===================================
2/29/00 : beazley
Made SWIG ignore the 'mutable' keyword.
2/29/00 : beazley
Incorporated some patches to the Perl5 module related to
the -hide option and the destruction of objects.
Patch submitted by Karl Forner.
2/27/00 : ttn
Incorporated Guile support contributed by Matthias Koeppe.
This includes a cpp macro in Lib/guile/guile.swg and the
entire file Lib/guile/typemaps.i.
2/25/00 : ttn
Modified configure.in and Makefile.in files to support
non-local build (useful in multi-arch environments).
2/24/00 : ttn
Incorporated Guile support contributed by Clark McGrew.
This works with Guile 1.3, but since it depends heavily
on the gh_ interface, it should work for all later versions.
It has not been tested with versions before 1.3.
WARNING: Code is unstable due to experimentation by ttn.
2/16/00 : beazley
A variety of performance improvements to the Python shadow
class code generation. Many of these result in substantial
runtime performance gains. However, these have come at
a cost of requiring the use of Python 1.5.2. For older
versions, use 'swig -noopt -python' to turn off these
optimization features.
Version 1.3 Alpha 1 (February 11, 2000)
=======================================
2/11/00 : Added 'void' to prototype of Python module initializer.
Reported by Mark Howson (1/20/00).
2/11/00 : beazley
Modified the Python shadow class code to discard ownership of an
object whenever it is assigned to a member of another object.
This problem has been around for awhile, but was most recently
reported by Burkhard Kloss (12/30/99).
2/11/00 : beazley
Added braces around macros in the exception.i library. Reported
by Buck Hodges (12/19/99)
2/11/00 : beazley
Fixed bug in the constraints.i library. Reported by Buck
Hodges (12/14/99)
2/11/00 : beazley
The %native directive now generates Tcl8 object-style command calls.
A full solution for Tcl7 and Tcl8 is still needed. Patch suggested
by Mike Weiblen (11/29/99)
2/11/00 : beazley
Modified the typemap code to include the $ndim variable for arrays.
Patch provided by Michel Sanner (11/12/99).
2/11/00 : beazley
Modified the Python module to raise a Runtime error if an attempt
is made to set a read-only member of a shadow class. Reported by
Michel Sanner (11/5/99).
2/10/00 : The documentation system has been removed. However, it is likely
to return at some point in the future.
2/1/00 : Added a number of performance enhancements to the Python shadow
classing and type-checking code. Contributed by Vadim Chugunov.
1. Remove _kwargs argument from the shadow wrappers when -keyword
option is not specified. This saves us a construction of keyword
dictionary on each method call.
def method1(self, *_args, **_kwargs):
val = apply(test2c.PyClass1_method1, (self,) + _args, _kwargs)
return val
becomes
def method1(self, *_args):
val = apply(test2c.PyClass1_method1, (self,) + _args)
return val
2. Incorporate self into the _args tuple. This saves at least one tuple
allocation per method call.
def method1(self, *_args):
val = apply(test2c.PyClass1_method1, (self,) + _args)
return val
becomes
def method1(*_args):
val = apply(test2c.PyClass1_method1, _args)
return val
3. Remove *Ptr classes.
Assume that we are SWIGging a c++ class CppClass.
Currently SWIG will generate both CppClassPtr class
that hosts all methods and also CppClass that is derived
from the former and contains just the constructor.
When CppClass method is called, the interpreter will try
to find it in the CppClass's dictionary first, and only then
check the base class.
CppClassPtr functionality may be emulated with:
import new
_new_instance = new.instance
def CppClassPtr(this):
return _new_instance(CppClass, {"this":this,"thisown":0})
This saves us one dictionary lookup per call.
<DB>The new module was first added in Python-1.5.2 so it
won't work with older versions. I've implemented an
alternative that achieves the same thing</DB>
4. Use CObjects instead of strings for pointers.
Dave: This enhancements result in speedups of up to 50% in some
of the preliminary tests I ran.
2/1/00 : Upgraded the Python module to use a new type-checking scheme that
is more memory efficient, provides better performance, and
is less error prone. Unfortunately, it will break all code that
depends on the SWIG_GetPtr() function call in typemaps.
These functions should be changed as follows:
if (SWIG_GetPtr(string,&ptr,"_Foo_p")) {
return NULL;
}
becomes
if (SWIG_ConvertPtr(pyobj, &ptr, SWIG_TYPE_Foo_p) == -1) {
return NULL;
}
Note: In the new implementation SWIG_TYPE_Foo_p is no longer
a type-signature string, but rather an index into a type
encoding table that contains type information.
*** POTENTIAL INCOMPATIBILITY ***
1/30/00 : loic
Conditionaly compile experimental code with --enable-experiment
configure flag.
Fix .cvsignore to ignore configrue & yacc generated files
1/28/00 : loic
Apply automake everywhere
Keep configure scripts so that people are not *forced* to autoconf
Keep sources generated by yacc so that compilation without yacc
is possible.
Source/LParse/cscanner.c: change lyacc.h into parser.h to please
default yacc generation rules.
Use AC_CONFIG_SUBDIRS in configure.in instead of hand made script.
Update all relevant .cvsignore to include .deps
Fixed missing ; line 136 Source/Swig/swig.h
1/13/00 : beazley
Fixed a number of minor end-of-file parsing problems in the
preprocessor.
1/13/00 : beazley
Added -freeze option that forces SWIG to freeze upon exit.
This is only used as a debugging tool so that I can more
easily examine SWIG's memory footprint.
1/13/00 : beazley
Added patch to guile module for supporting optional arguments
Patch contributed by Dieter Baron.
1/13/00 : loic
Added .cvsignore, Examples/.cvsignore, Source/DOH/Doh/.cvsignore
Source/SWIG1.1/main.cxx: Fixed -I handling bug
Source/Modules1.1/java.cxx: fixed char* -> const char* warnings that are
errors when compiling with gcc-2.95.2
Source/SWIG1.1/main.cxx: cast const char* to char* for String_replace
token and rep should really be const.
1/12/00 : beazley
Added Harco's Java modules.
1/12/00 : beazley
Revoked the %ifdef, %ifndef, %endif, %if, %elif, and %else
directives. These are no longer needed as SWIG now has a real
preprocessor.
*** POTENTIAL INCOMPATIBILITY ***
1/12/00 : beazley
Moved the documentation modules from the SWIG directory
to the Modules directory (where they really should have been
to begin with).
1/12/00 : beazley
Removed the -stat option for printing statistics. The
statistics reporting was inadequate and mostly broken
anyway.
*** POTENTIAL INCOMPATIBILITY ***
1/12/00 : beazley
Removed the -t option for reading a typemap file. More
trouble than it's worth. Just include typemaps at the top
of the interface file.
*** POTENTIAL INCOMPATIBILITY ***
1/12/00 : beazley
Removed the %checkout directive.
*** POTENTIAL INCOMPATIBILITY ***
1/12/00 : beazley
Removed the -ci option for file checkin. Too problematic
to implement. Probably better to just put your SWIG library
under CVS instead.
*** POTENTIAL INCOMPATIBILITY ***.
1/11/00 : beazley
Deleted the LATEX module. Sorry... Didn't know anyone
who was using it. Besides, I'm looking to simplify
the documentation system.
*** POTENTIAL INCOMPATIBILITY ***
1/11/00 : beazley
Modified the ASCII documentation module to use a .txt
suffix for its output file instead of .doc.
1/11/00 : beazley
Added the long-lost SWIG preprocessor back to the system.
It should be enabled by default. Raw preprocessed output
can be viewed using swig -E file.i.
*** NEW FEATURE ***
1/11/00 : beazley and djmitche
Completely reorganized the SWIG directory structure. The
basic organization is now:
Source/ SWIG source code
Lib/ SWIG library files (swig_lib)
Doc/ Documentation
Examples/ Examples
More directories will be added as needed.
12/08/99: Loic Dachary (loic@senga.org)
Enhanced package handling for perl5 and c++.
With new option -hide Foo::Bar, every perl5 object (Frob) is
qualified by Foo::Bar::Frob. The package name is solely used
to encapsulate C/C++ wrappers output in <module>_wrap.c and the
corresponding perl package in <module>.pm. Note that a package
name may contain :: (Frob::Nitz) and will be relative to the
package name provided by -hide (Foo::Bar::Frob::Nitz).
In *_wrap.c, SWIG_init macro is used. Was previously defined
but not used and simplifies code.
Added typemap(perl5,perl5in) and typemap(perl5,perl5out) that
do the equivalent of typemap(perl5,in) and typemap(perl5,out)
but contain perl code and applies to wrappers generated by
-shadow.
Lacking proper regression tests I used
Examples/perl5/{c++,constraint,defarg,except,
graph/graph[1234],multinherit,nested,shadow,simple,tree,
typemaps/{argv,argv2,arraymember,database,file,ignore,integer,
output,passref,reference,return}}/. I ran swig with and without
the patches, diff the generatedsources, run the .pl files
and checked that the results are identical. In all those examples
I had no error.
11/21/99: Modified the Tcl module to provide full variable linking capabilities
to all datatypes. In previous versions, a pair of accessor functions
were created for datatypes incompatible with the Tcl_LinkVar() function.
Now, we simply use variable traces to support everything. This may
break scripts that rely upon the older behavior.
*** POTENTIAL INCOMPATIBILITY ***
11/21/99: Added slight tweak to wrapper generator to collect local variables
of similar type. Produces somewhat more compact wrapper code.
11/20/99: Modified the Tcl module to use SWIG_GetArgs() to parse
arguments. This is a technique borrowed from Python in which
arguments are converted using a format string convention similiar
to fprintf(). This results in a *substantial* reduction in the
size of the resulting wrapper code with only a modest runtime overhead
in going through the extra conversion function.
11/13/99: Completely rewrote the class/structure generation code for the
Tcl module. Now, a small set of runtime functions are used
to implement the functionality for all classes (instead of a
massive amount of runtime code being generated for each class).
Class specific information is simply encoded in a series of
static tables. This results in a *HUGE* reduction in wrapper
code size--especially for C++.
11/13/99: Removed the -tcl (Tcl 7.x) module. Tcl 8.0 is now several
years old and the defacto standard--no real reason to keep
supporting the old version at this point.
11/13/99: Cleaned up -c option for Python module. The pyexp.swg file
is now gone.
11/13/99: Fixed external declarations to work better with static linking
on Windows. Static linking should now be possible by defining
the -DSTATIC_LINK option on the command line. Patch contributed
by Alberto Fonseca.
11/5/99 : Fixed an obscure code generation bug related to the generation
of default constructors. Bug reported by Brad Clements.
11/5/99 : Fixed a few memory problems found by purify.
11/5/99 : Officially deprecated the -htcl, -htk, and -plugin options
from the Tcl and Tcl8 modules.
10/26/99: Removed unused variable from python/typemaps.i. Patch
contributed by Keith Davidson.
8/16/99 : Added _WIN32 symbol to libraries to better support Windows.
8/16/99 : Deprecated the Perl4 module. It is no longer included in the
distribution and no longer supported. In the entire 3 years SWIG
has been around I never received a single comment about it so I'm
assuming no one will miss it...
8/16/99 : Modified the type-checking code to register type mappings using a
table instead of repeated calls to SWIG_RegisterMapping(). This
reduces the size of the module initialization function somewhat.
8/15/99 : Cleaned up the pointer type-checking code in the Tcl module.
8/15/99 : Many changes to the libraries to support runtime libraries.
8/13/99 : Eliminated C++ compiler warning messages about extern "C" linkage.
8/13/99 : Some cleanup of Python .swg files to better support runtime libraries
on Windows.
8/13/99 : Modified the %pragma directive to attach pragmas declared inside
a class definition to the class itself. For example:
class foo {
...
%pragma(python) addtomethod = "insert:print `hello world'"
...
}
Most people don't need to worry about how this works. For people
writing backend modules, class-based pragmas work like this:
lang->cpp_open_class() // Open a class
lang->cpp_pragma() // Supply pragmas
... // Emit members
lang->cpp_close_class() // Close the class
All of the pragmas are passed first since they might be used to
affect the code generation of other members. Please see
the Python module for an example. Patches contributed
by Robin Dunn.
8/13/99 : Patch to Python shadow classes to eliminate ignored
exception errors in destructors. Patch contributed
by Robin Dunn.
8/11/99 : Minor patch to swig_lib/python/swigptr.swg (added SWIGSTATIC
declaration). Patch contributed by Lyle Johnson.
8/11/99 : Added FIRSTKEY/NEXTKEY methods to Perl5 shadow classes
Patch contributed by Dennis Marsa.
8/11/99 : Modified Python module so that NULL pointers are returned
and passed as 'None.' Patch contributed by Tal Shalif.
8/10/99 : Fixed missing 'int' specifiers in various places.
8/10/99 : Added Windows makefile for Runtime libraries. Contributed
by Bob Techentin.
8/10/99 : Fixed minor problem in Python runtime makefile introduced
by keyword arguments.
8/8/99 : Changed $target of perl5(out) typemap from ST(0) to
ST(argvi). Patch contributed by Geoffrey Hort.
8/8/99 : Fixed bug in typemap checking related to the ANY keyword
in arrays and ignored arguments. Error reported by
Geoffrey Hort.
8/8/99 : %enabledoc and %disabledoc directives can now be used
inside class/structure definitions. However, no check
is made to see if they are balanced (i.e., a %disabledoc
directive inside a class does not have to have a matching
%enabledoc in the same class).
8/8/99 : Keyword argument handling is now supported in the Python
module. For example:
int foo(char *bar, int spam, double x);
Can be called from Python as
foo(x = 3.4, bar="hello", spam=42)
To enable this feature, run SWIG with the '-keyword' command
line option. Mixing keyword and default arguments
should work as well. Unnamed arguments are assigned names
such as "arg1", "arg2", etc...
*** POTENTIAL INCOMPATIBILITY ***
Functions with duplicate argument names such as
bar(int *OUTPUT, int *OUTPUT) will likely cause problematic
wrapper code to be generated. To fix this, use different
names or use %apply to map typemaps to alternate names.
8/8/99 : Handling of the 'this' pointer has been changed in Python shadow
classes. Previously, dereferencing of '.this' occured in the
Python shadow class itself. Now, this step occurs in the C
wrappers using the following function:
SWIG_GetPtrObj(PyObject *, void **ptr, char *type)
This function can accept either a string containing a pointer
or a shadow class instance with a '.this' attribute of
appropriate type. This change allows the following:
1. The real shadow class instance for an object is
passed to the C wrappers where it can be examined/modified
by typemaps.
2. Handling of default/keyword arguments is now greatly
simplified.
3. The Python wrapper code is much more simple.
Plus, it eliminated more than 300 lines of C++ code in the
Python module.
*** CAVEAT : This requires the abstract object interface.
It should work with Python 1.4, but probably nothing older
than that.
8/8/99 : Fixed handling of "const" and pointers in classes. In particular,
declarations such as
class foo {
...
const char *msg;
const int *iptr;
}
are handled as assignable variables as opposed to constant
values (this is the correct behavior in C/C++). Note:
declarations such as "char *const msg" are still unsupported.
Constants declared at the global level using const are also
broken (because I have a number of interfaces that rely upon
this behavior).
*** POTENTIAL INCOMPATIBILITY *** This may break interfaces that
mistakenly treat 'const char *' types as constant values.
8/8/99 : Modified the parser to support bit-fields. For example:
typedef struct {
unsigned int is_keyword : 1;
unsigned int is_extern : 1;
unsigned int is_static : 1;
} flags;
Bit-fields can only be applied to integer types and their
are other restrictions. SWIG performs no such type-checking
(although the C compiler will catch problems when it tries to
compile the wrapper code).
8/8/99 : Removed trailing space of $basetype substitution in typemaps.
This is to allow things like this:
%typemap(python, argout) spam** OUTPUT{
...
char* a = "$basetype_p";
...
}
(Patch suggested by Nathan Dunfield).
6/22/99 : Made a very slight tweak to the Perl5 shadow class
code that allows typemaps to alter the return type
of objects (to support polymorphic types). Patch
contributed by Drake Diedrich.
4/8/99 : Fixed null pointer handling bug in Perl module.
Patch contributed by Junio Hamano.
3/17/99 : Fixed bug in perl5ptr.swg for ActiveState Perl.
Patch contributed by Greg Anderson.
2/27/99 : Eliminated segmentation fault when Swig runs on
empty files.
2/27/99 : Added patch to Guile module to eliminate unused
variables. Contributed by Mike Simons.
2/27/99 : Fixed problem with %addmethods returning references.
2/27/99 : Fixed Runtime/Makefile. Patch contributed by
Mike Romberg.
2/27/99 : Incorporated patches to the type-checker.
2/27/99 : Fixed problem with -exportall switch and shadow classes
in Perl5 module. Patch contributed by Dennis Marsa.
2/27/99 : Modified Perl5 module to recognize 'undef' as a NULL char *.
Patch contributed by Junio Hamano.
2/27/99 : Fixed the Perl5 module to support the newer versions of
ActiveState Perl for Win32.
2/27/99 : Fixed the include order of files specified with the
-I option.
2/5/98- : Dave finishes his dissertation, goes job hunting, moves to
2/5/99 Chicago and generally thrashes about.
Version 1.1 Patch 5 (February 5, 1998)
======================================
2/4/98 : Fixed a bug in the configure script when different package
locations are specified (--with-tclincl, etc...).
2/2/98 : Fixed name-clash bug related to the switch to C macros for accessor
functions. The new scheme did not work correctly for objects
with members such as 'obj', 'val', etc... Fixed the bug by
appending the word 'swig' to macro argument names. Patch
contributed by Rudy Albachten.
2/2/98 : Slight fix to the Perl5 module to eliminate warning messages
about 'varname used only once : possible typo'. Fix
contributed by Rudy Albachten.
1/9/98 : Fixed a bug in the Perl 5 module related to the creation of
constants and shadow classes.
1/9/98 : Fixed linking bug with Python 1.5 embed.i library file.
Version 1.1 Patch 4 (January 4, 1998)
=====================================
1/4/98 : Changed structured of the Examples directory to be more friendly
to Borland C++.
1/4/98 : Added the function Makefile.win.bc for compiling the examples
under Borland 5.2.
1/4/98 : Slight change to the perl5 module and C++ compilation. The
<math.h> library is now included before any Perl headers
because Perl the extern "C" linkage of math.h screws alot
of things up (especially on Windows).
1/2/98 : Change to the Python module that reduces the number of constants
created by C++ classes, inheritance, and shadow classes. This
modification may introduce a few slight incompatibilities if
you attempt to use the non-shadow class interface with shadow
classes enabled. Patch contributed by Mike Romberg.
1/2/98 : Support for Tcl 8.0 namespaces has been added. This *replaces*
the original SWIG mechanism that assumed [incr Tcl] namespaces.
To use namespaces, simply run SWIG with the following options
swig -tcl -namespace foo.i
This places everything in a namespace that matches
the module name
swig -tcl -namespace -prefix bar foo.i
This places everything in the namespace 'bar'
The use of namespaces is new in Tcl 8.0. However, the wrapper code
generated by SWIG will still work with all versions of Tcl newer
than and including Tcl 7.3/Tk3.6 even if the -namespace option is
used.
*** POTENTIAL INCOMPATIBILITY ***
This change may break existing applications that relied on the
-prefix and -namespace options.
1/2/98 : Added the following constants to the Tcl wrapper code
SWIG_name - Name of the SWIG module
SWIG_prefix - Prefix/namespace appended to command names
SWIG_namespace - Name of the namespace
SWIG library writers can use these to their advantages.
1/2/98 : Fixed a bug in the Tcl8 module related to the creation of
pointer constants (the function SWIG_MakePtr was missing from
the wrapper code).
1/2/98 : Added the consthash.i library file to the Tcl and Tcl8 modules.
1/1/98 : Changed and cleaned up the Python typemaps.i file. The following
significant changes were made :
1. The OUTPUT typemap now returns Python tuples instead of
lists. Lists can be returned as before by using the
L_OUTPUT type. If compatibility with older versions
is needed, run SWIG with the -DOUTPUT_LIST option.
2. The BOTH typemap has been renamed to INOUT. For backwards
compatibility, the "BOTH" method still exists however.
3. Output typemaps now generate less code than before.
Changes to typemaps.i may break existing Python scripts that assume
output in the form of a list.
*** POTENTIAL INCOMPATIBILITY ***
12/31/97: Fixed long overdue problems with the testing scripts and certain
makefiles that required the use of the bash shell. Everything should
work properly with the standard Bourne shell (sh) now.
12/31/97: Modified typemaps to allow $basetype as a valid local variable.
This allows for all sorts of bizarre hackish typemaps that
do cool things. Patch contributed by Dominique Dumont.
12/31/97: Switched accessor functions generated for member data to
C preprocessor macros (except in cases involving typemaps
or char *).
12/31/97: Fixed a bug related to C++ member data involving references.
12/31/97: Changed accessor functions for C++ member functions to
preprocessor macros. This cleans up the wrapper code
and results in fewer function definitions.
12/31/97: Changed the default C constructor to use calloc() instead
of malloc()
12/30/97: Changed the creation of constants in the Perl5 module.
For all practical purposes, they should work in exactly the
same way as before except that they now require much less
wrapper code. Modules containing large numbers of
constants may see greater than a 50% reduction in wrapper
code size.
12/30/97: Modified the Python module to be more intelligent about the
creation of constants. SWIG no longer generates redundant
global variables and the size of the module initialization
function should be reduced. (Many thanks to Jim Fulton).
12/29/97: Fixed a bug in C++ code generation related to member functions,
default arguments, and references.
12/29/97: Fixed configure script and a few makefiles to support Python 1.5
12/29/97: Added 'embed15.i' library file. This file should be used to
staticly link versions of Python 1.5. To make it the default,
simply copy 'swig_lib/python/embed15.i' to 'swig_lib/python/embed.i'
Version 1.1 Patch 3 (November 24, 1997)
========================================
11/23/97: Fixed a bug in the Perl5 module with shadow classes and
static class functions that return class instances.
Note : The fix for this bug requires a slight restructuring of
of the .pm files created by SWIG.
11/23/97: Fixed a bug in the Tcl/Tcl8 modules related to variable linking
of character arrays. If you declared a global variable 'char foo[10]',
the generated wrapper code would either cause a segmentation fault
immediately upon loading or weird memory corruption elsewhere.
This should now be fixed although character arrays can only be
read-only.
11/23/97: Fixed a bug with the %import directive that caused it to
fail if files were imported from directories other than
the current working directory.
11/23/97: Fixed incorrect diagnostic message in the ASCII documentation
module.
11/23/97: Changed the behavior of the -o option when used with shadow
classes. If -o was used to specify both the pathname and filename
of SWIG's output such as
swig -o /home/swig/wrapper.c -shadow -perl5 foo.i
The wrapper code would be placed the file specified with -o,
but the .pm file and documentation would be placed in the
directory where SWIG was run. Now, these files are placed
in the same directory as the file specified with the -o option.
This change is also needed for proper operation on the
Macintosh.
11/23/97: Added a 'this()' method to Perl5 shadow classes. This can
be used to return the normal pointer value from a shadow
class that is represented as a tied hash. To use just
invoke as a method like this :
$l = new List; # Create an object
$ptr = $l->this(); # Get the normal pointer value
*** NEW FEATURE ***
11/23/97: Fixed the Tcl 8 pointer.i library file (which was completely
broken in 1.1p2).
11/23/97: Modified the Perl5 type-checker to fix a few problems
with global variables of pointer types and to allow
tied hashes to be used interchangably with normal
pointer values.
11/23/97: Modified the typemap mechanism to allow output
typemaps of type 'void'. These were ignored previously,
but now if you specify,
%typemap(lang,out) void {
... return a void ...
}
You can change or assign a return value to the function.
11/23/97: Fixed processing of 'bool' datatypes in the Python module.
11/23/97: Fixed minor parsing error with C++ initializers. For example,
class B : public A {
public:
B() : A() { ... };
...
}
11/23/97: Fixed the Tcl8 module so that C functions that call back into
Tcl don't corrupt the return result object (SWIG was gathering
the result object too early which leads to problems if subsequent
Tcl calls are made).
11/23/97: Fixed a code generation bug in the Python module when two or
more output parameters were used as the first arguments of a
function. For example :
%include typemaps.i
void foo(double *OUTPUT, double *OUTPUT, double a);
Previously, doing this resulted in the creation of an
extraneous comma in the output, resulting in a C syntax error.
11/22/97: Fixed a bug when template handling that was stripping whitespace
around nested templates. For example :
Foo<Bar<double> >
was getting munged into Foo<Bar>> which is a syntax error in
in the C++ compiler.
11/22/97: Fixed bugs in the Borland C++ makefiles.
11/22/97: Fixed memory corruption bug when processing integer
arguments in Tcl8 module.
11/21/97: Fixed a bug in the Runtime/Makefile related to Tcl 8.
11/21/97: Fixed a bug with the %new directive and Perl5 shadow classes.
No longer generates a perl syntax error.
11/9/97 : Changed a strncpy() to strcpy() in the pointer type-checker.
This results in a substantial performance improvement in
type-checking.
10/29/97: Fixed a bug in the code generation of default arguments and
user-defined types. For example :
void foo(Vector a, Vector b = d);
should now work properly.
Version 1.1 Patch 2 (September 4, 1997)
=======================================
9/4/97 : Fixed problem with handling of virtual functions that
was introduced by some changes in the C++ module.
Version 1.1 Patch 1 (August 27, 1997)
=====================================
8/26/97 : Fixed compilation and run-time bugs with Tcl 8.0 final.
8/21/97 : Fixed code generation bug with arrays appearing as arguments
to C++ member functions. For example :
class Foo {
public:
void Bar(int a[20][20]);
};
There is still a bug using arrays with added methods
however.
8/20/97 : Fixed a bug with generating the code for added methods
involving pass-by-value.
8/19/97 : Modified the typemapper to substitute the '$arg' value
when declaring local variables. For example :
%typemap(in) double * (double temp_$arg) {
... do something ...
}
When applied to a real function such as the following :
void foo(double *a, double *b, double *result);
three local variables will be created as follows :
double temp_a;
double temp_b;
double temp_result;
This can be used when writing multiple typemaps that need
to access the same local variables.
7/27/97 : Fixed a variety of problems with the %apply directive and arrays.
The following types of declarations should now work :
%apply double [ANY] { Real [ANY] };
%apply double [4] { double [10] };
A generic version of apply like this :
%apply double { Real };
should now work--even if arrays involving doubles and Reals are
used later.
7/27/97 : Changed warning message about "Array X has been converted to Y" to
only appear if running SWIG in verbose mode.
7/27/97 : Added the variables $parmname and $basemangle to the typemap
generator. $parmname is the name of the parameter used
when the typemap was matched. It may be "" if no parameter
was used. $basemangle is a mangled version of the base
datatype. Sometimes used for array handling.
7/27/97 : Changed the behavior of output arguments with Python shadow classes.
Originally, if a function returned an object 'Foo', the shadow class
mechanism would create code like this :
def return_foo():
val = FooPtr(shadowc.return_foo())
val.this = 1
return val
The problem with this is that typemaps allow a user to redefine
the output behavior of a function--as a result, we can no longer
make any assumptions about the return type being a pointer or
even being a single value for that matter (it could be a list,
tuple, etc...). If SWIG detects the use of output typemaps
(either "out" or "argout") it returns the result unmodified like
this :
def return_foo():
val = shadowc.return_foo()
return val
In this case, it is up to the user to figure out what to do
with the return value (including the possibility of converting it
into a Python class).
7/26/97 : Fixed a parsing problem with types like 'unsigned long int',
'unsigned short int', etc...
7/24/97 : Minor bug fix to Tcl 8 module to parse enums properly. Also
fixed a memory corruption problem in the type-checker.
(patch contributed by Henry Rowley.
7/24/97 : Added Python-tuple typemaps contributed by Robin Dunn.
7/24/97 : Incorporated some changes to the Python module in support of
Mark Hammond's COM support. I'm not entirely sure they
work yet however. Needs documentation and testing.
7/24/97 : Fixed code generation bugs when structures had array members
and typemaps were used. For example :
%typemap(memberin) double [20][20] {
... get a double [20][20] ...
}
struct Foo {
double a[20][20];
}
Originally, this would generate a compiler-type error when
the wrapper code was compiled. Now, a helper function like
this is generated :
double *Foo_a_set(Foo *a, double val[20][20]) {
... memberin typemap here ...
return (double *) val;
}
When writing typemaps, one can assume that the source variable
is an array of the *same* type as the structure member. This
may break some codes that managed to work around the array bug.
*** POTENTIAL INCOMPATIBILITY ***
7/13/97 : Fixed bug in Perl5 module when using C global variables that
are pointers. When used in function calls and other operations,
the value of the pointer would be invalid---causing core
dumps and other problems. SWIG implements global variables
using Perl magic variables. As it turns out, the error
was caused by the fact that the pointer-extraction code
was somehow bypassing the procedure used to resolve magical
variables (hence, leaving the value undefined). To fix
the problem, SWIG now explicitly resolves magic before
extracting pointer values.
7/12/97 : Eliminated the last remnants of free() and malloc() from
the SWIG compiler.
7/12/97 : Fixed parsing problems with typemaps involving arrays and
temporary variables of arrays. Also made it possible for
SWIG to handle typemaps like this :
%typemap(in) double [ANY] (double temp[$dim0]) {
... store data in temp[$dim0] ...
}
Not only does this typemap match any double [] array, it
creates a local variable with precisely the right dimensions.
(ie. $dim0 gets filled in with the real number of dimensions).
Of course, off the record, this will be a way to add more
functionality to the typemaps.i libraries.
7/9/97 : Fixed some problems with Perl5, static linking, and shadow
classes. When statically linking multiple modules together, write
a top-level interface file like this when shadow classes are not
used :
%module swig, foo, bar, glob;
%include perlmain.i
When shadow classes are used, the module names have an extra 'c'
appended so it should read as :
%module swig, fooc, barc, globc;
%include perlmain.i
When linking multiple modules, consider using the SWIG runtime
library.
7/8/97 : Incorporated fixed versions of the Borland C++ Makefiles.
7/8/97 : First cut at trying to eliminate excessive compiler warnings.
As it turns out, alot of warnings go away if you just make
declarations like this
clientData = clientData;
in the resulting wrapper code. Most compilers should just
ignore this code (at least would can hope).
7/8/97 : Fixed bizarre code generation bug with typemaps and C++ classes.
In some cases, typemaps containing printf formatting strings such as
%typemap(memberout) int * {
printf("%d",42);
}
Would generate completely bogus code with garbage replacing
the '%d'. Caused by one faulty use of printf (wasn't able to find
any other occurences).
7/7/97 : Fixed bug in Python shadow class generation with non-member
functions that are returning more than one value.
7/7/97 : Incorporated modifications to make SWIG work with Guile 1.2.
Still need to test it out, but it is rumored to work.
7/2/97 : Fixed some bugs related to output arguments and Python shadow
classes. If an output argument is detected, SWIG assumes
that the result is a list and handles it appropriately.
If the normal return type of an function is an object,
it will be converted into a shadow class as before, but
with the assumption that it is the first element of a
list. *** NOTE : This behavior has been subsequently changed ***
6/29/97 : Changed EXPORT to SWIGEXPORT in all of the language modules.
Should provide better compatibility with Windows.
6/29/97 : Modified Python shadow classes so that output arguments
work correctly (when typemaps are used).
Version 1.1 (June 24, 1997)
===========================
6/24/97 : Fixed Objective-C constructor bug when working with Perl5
shadow classes.
6/23/97 : Fixed some parsing problems with Objective-C. Declarations
such as the following should work now :
- foo : (int) a with: (int) b;
6/22/97 : Added SWIG Runtime library. This library contains
the SWIG pointer type-checker and support functions
that are normally included in every module. By using
the library, it is easier to work with multiple SWIG
generated modules.
6/22/97 : Fixed minor bug in Perl5 module related to static linking
of multiple modules.
6/22/97 : Fixed some bugs with the %import directive. When used with
Perl5 shadow classes, this generates a 'require' statement
to load in external modules.
6/22/97 : Added -swiglib option. This prints out the location of the
SWIG library and exits. This option is only really useful to
configuration tools that are looking for SWIG and its library
location (e.g. autoconf, configure, etc...).
6/21/97 : Fixed export bug with Perl5.004 on Windows-NT.
6/20/97 : Minor change to code generation of class/structure members in
order to work better with typemaps. Should have no noticable
impact on existing SWIG modules.
6/19/97 : Added -t option. This allows SWIG to load a typemap file before
processing any declarations. For example :
swig -t typemaps.i -python example.i
At most, only one typemap file can be specified in this manner.
*** NEW FEATURE ***
6/18/97 : Need a Makefile fast? Type
swig [-tcl, -perl5, -python] -co Makefile
and you will get a Makefile specific to that target language.
You just need to modify it for your application and you're
ready to run.
6/18/97 : Completed the -ci option. This option checks a file into the
SWIG library. It should be used in conjunction with a
language option. For example :
swig -tcl -ci foobar.i
Checks the file foobar.i into the Tcl part of the library.
In order to check a file into the general library (accessible
to all languages modules), do the following
swig -ci -o ../foobar.i foobar.i
(Admittedly this looks a little strange but is unavoidable).
The check-in option is primarily designed for SWIG maintenance
and library development. The command will fail if the user does
not have write permission to the SWIG library. Third party library
extensions can easily install themselves by simply providing
a shell script that uses 'swig -ci' to install the appropriate
library files. It is not necessary to know where the SWIG library
is located if you use this mechanism.
*** NEW FEATURE ***
6/16/97 : Fixed a bug in shadow class generation when %name() was applied
to a class definition. Unfortunately, fixing the bug required
a change in the Language C API by adding an extra argument to
the Language::cpp_class_decl() function. This may break
SWIG C++ extensions.
*** POTENTIAL INCOMPATIBILITY ***
6/15/97 : Added a warning message if no module name is specified with the
%module directive or -module option.
6/15/97 : Fixed line number bug when reporting errors for undefined
base classes.
6/15/97 : Added new %rename directive. This allows the forward declaration
of a renaming. For example :
%rename OldName NewName;
.... later ...
int OldName(int);
Unlike %name, %rename will rename any occurence of the old name.
This applies to functions, variables, class members and so forth.
There is no way to disable %rename once set, but you can change the
name by redeclaring it to something else.
*** NEW FEATURE ***
6/15/97 : Improved the implementation of the %name directive so that it
could be used with conditional compilation :
#ifdef SWIG
%name(NewName)
#endif
int OldName(int);
6/15/97 : Added support for functions with no return datatype. In this case,
SWIG assumes a return type of 'int'.
6/11/97 : Improved error reporting in the parser. It should be a little
less sensitive to errors that occur inside class definitions
now. Also reports errors for function pointers.
6/11/97 : Made '$' a legal symbol in identifiers. This is to support
some Objective-C libraries. Some compilers (such as gcc) may also
allow identifiers to contain a $ in C/C++ code as well (this is
an obscure feature of C). When '$' appears in identifier, SWIG
remaps it to the string '_S_' when creating the scripting language
function. Thus a function 'foo$bar' would be called 'foo_S_bar'.
6/11/97 : Fixed bug in Python shadow classes with __repr__ method. If
supplied by the user, it was ignored, but now it should work.
6/9/97 : Fixed the Tcl 8.0 module to work with Tcl 8.0b1. SWIG is no
longer compatible with *any* alpha release of Tcl 8.0.
*** POTENTIAL INCOMPATIBILITY ***
6/7/97 : Put a maximal error count in (currently set to 20). SWIG will bail out
if it generates more errors than this (useful for preventing SWIG
from printing 4000 syntax errors when it gets confused).
6/7/97 : Fixed segmentation fault when parsing variable length arguments.
6/7/97 : Minor change to Perl5 module. C++ static functions are now
put in the same package as their class when using shadow classes.
6/7/97 : Centralized the naming of functions, members, wrappers etc... By
centralizing the naming scheme, it should be possible to make
some multi-file optimizations. Also, it should be possible to
change SWIG's naming scheme (perhaps a new feature to be added
later).
6/2/97 : Added 'arginit' typemap. This can be used to assign initial values
to function arguments. Doing so makes it somewhat easier to detect
improper argument passing when working with other typemaps.
6/2/97 : Fixed code generation bug when read-only variables were inherited
into other classes. Under inheritance, the variables would
become writable, but this has now been corrected.
5/30/97 : An empty %name() directive is no longer allowed or supported.
This directive was originally used to strip the prefix
off of a class or structure. Unfortunately, this never really
seemed to work right and it complicated the C++ code generator
significantly. As far as I can tell no one uses it, so it
is now history. *** POTENTIAL INCOMPATIBILITY ***
5/28/97 : Fixed a parsing bug with #define and C++ comments. Declarations
such as the following now work properly :
#define CONST 4 // A Comment
5/28/97 : Made some performance improvements to the SWIG String class.
(only affects the SWIG compiler itself).
5/28/97 : Modified the parser to skip template definitions and issue a
warning message.
5/28/97 : Preliminary support for parameterized types added (ie. templates).
Types such as the following should pass through the SWIG compiler
void foo(vector<complex> *a, vector<double> *b);
When used, the entire name 'vector<complex>' becomes the name
of the datatype. Due to space limitations in datatype
representations, the name should not exceed 96 characters.
Note : This is only part of what is needed for template support.
Template class definitions are not yet supported by SWIG.
The template notation above may also be used when specifying
Objective-C protocol lists.
*** NEW FEATURE ***
5/24/97 : First cut at Objective-C support added. As it turns out, almost
everything can be handled with only a few minor modifications to
the C++ module.
*** NEW FEATURE ***
5/23/97 : Fixed repeated definition bug in multiple inheritance handling
when multiple base classes share a common base class (ie.
the evil diamond).
5/21/97 : Fixed rather embarrassing typo that worked its way into the
Tests/Build directory.
5/19/97 : Fixed code generation bug when using native methods and
shadow classes with Python and Perl5 modules.
5/19/97 : Modified the %apply directive slightly so that it would work
with pointers a little better. For example :
%apply unsigned long { DWORD };
Applies *all* typemaps associated with "unsigned long" to
"DWORD". This now includes pointers to the two datatypes.
For example, a typemap applied to "unsigned long **" would
also be applied to any occurrence of "DWORD **" as well.
5/19/97 : Fixed an ownership assignment bug in the Perl5 module when
class members were returning new objects belonging to
different classes.
5/17/97 : Added a few more typemap variables.
$name - Name of function/variable/member
$basetype - Base datatype (type without pointers)
$argnum - Argument number
5/16/97 : Fixed embarrassing underscore error in local variable
allocator.
5/16/97 : Fixed namespace clash bug in parameterized typemaps
when creating arrays as new local variables.
5/15/97 : Fixed some bugs with inheritance of added methods across
multiple files. SWIG now uses names of base classes
when generating such functions.
5/14/97 : Finished support for default typemaps. Primarily used
internally, they can be used to match the basic
built-in datatypes used inside of SWIG. You can
specify them in interface files as well like this :
%typemap(tcl,in) int SWIG_DEFAULT_TYPE {
$target = atoi($target);
}
Unlike normal typemaps, this default map will get applied
to *all* integer datatypes encountered, including those
renamed with typedef, etc...
5/13/97 : Fixed substring bug in type checker.
5/12/97 : Fixed bug in parameterized typemaps when declaring local
variables of structures.
Version 1.1 Beta6 (May 9, 1997)
===============================
5/9/97 : Fixed bizarre NULL pointer handling bug in Perl5 module.
5/8/97 : Fixed mysterious segmentation fault when running SWIG on an
empty file.
5/7/97 : The code generator will now replace the special symbol "$cleanup"
with the cleanup code specified with the "freearg" typemap.
This change needed to properly manage memory and exceptions.
5/5/97 : Added the 'typemaps.i' library file. This contains a
variety of common typemaps for input values, pointers,
and so on.
5/5/97 : Changed behavior of "argout" typemap in Python module.
Old versions automatically turned the result into a
Python list. The new version does nothing, leaving the
implementation up to the user. This provides more flexibility
but may break older codes that rely on typemaps.
*** POTENTIAL INCOMPATIBILITY ***
5/5/97 : Fixed bug in Python module related to the interaction of
"argout" and "ignore" typemaps.
5/5/97 : Fixed bug in Python module that would generate incorrect code
if all function arguments are "ignored".
5/4/97 : Added %apply and %clear directives. These form a higher level
interface to the typemap mechanism. In a nutshell, they
can be used to change the processing of various datatypes without
ever having to write a typemap. See the SWIG documentation
for more details. ** NEW FEATURE **
5/4/97 : Added a local variable extension to the typemap handler.
For example :
%typemap(tcl,in) double *(double temp) {
temp = atof($source);
$target = &temp;
}
In this case, 'temp' is a local variable that exists
in the entire wrapper function (not just the typemap
code). This mechanism provides better support for
certain types of argument handling and also makes it
possible to write thread-safe typemaps. Any number
local variables can be declared by supplying a comma
separated list. Local variables are guaranteed to be
unique, even if the same typemap is applied many times
in a given function.
** Not currently supported in Perl4 or Guile modules.
5/2/97 : Fixed processing of %ifdef, %endif, %if, etc... (These are
SWIG equivalents of the C preprocessor directives that
can pass through the C preprocessor without modification).
5/2/97 : Fixed major (but subtle) bug in the run-time type checker
related to searching and type-checking for C++ inheritance.
To make a long story short, if you had two classes named
"Foo" and "FooObject" the type checker would sometimes
get confused and be unable to locate "Foo" in an internal
table.
5/2/97 : Fixed some bugs in the -co option.
4/24/97 : Pointer library added to the SWIG library.
4/19/97 : Added the %new directive. This is a "hint" that can be used
to tell SWIG that a function is returning a new object. For
example :
%new Foo *create_foo();
This tells SWIG that create_foo() is creating a new object
and returning a pointer to it. Many language modules may
choose to ignore the hint, but when working with shadow classes,
the %new is used to handle proper ownership of objects.
%new can also be used with dynamically allocated strings.
For example :
%new char *create_string();
When used, all of the language modules will automatically cleanup
the returned string--eliminating memory leaks.
** NEW FEATURE **
4/19/97 : Added a new typemap "newfree". This is used in conjunction with
the %new directive and can be used to change the method by which
a new object returned by a function is deleted.
4/19/97 : The symbol "__cplusplus" is now defined in the SWIG interpreter
when running with the -c++ option.
4/17/97 : Added support for static member functions when used inside the
%addmethods directive.
4/15/97 : Added a special typemap symbol PREVIOUS that can be used to
restore a previous typemap. For example :
%typemap(tcl,in) int * = PREVIOUS;
This is primarily used in library files.
4/13/97 : Added %pragma directive for Perl5 module. Two new pragmas are
available :
%pragma(perl5) code = "string"
%pragma(perl5) include = "file.pl"
Both insert code into the .pm file created by SWIG. This can
be used to automatically customize the .pm file created by SWIG.
4/13/97 : Scanner modified to only recognize C++ keywords when the -c++
option has been specified. This provides support for C programs
that make use of these keywords for identifiers.
SWIG may need to be explicitly run with the -c++ option when
compiling C++ code (this was allowed, but not recommended in
previous versions). **POTENTIAL INCOMPATIBILITY**
4/11/97 : Fixed a rather nasty bug in the Perl5 module related to using
variable linking with complex datatypes and pointers. On Unix,
code would work (somehow), but would cause an access violation
under Windows-NT. The fix should correct the problem,
but there may still be a problem using global variables of
complex datatypes in conjunction with shadow classes. Fortunately,
this sort of thing seems to be relatively rare (considering
that the bug has been around for more than a year - yikes!).
4/11/97 : Fixed bizarre constant evaluation bug in Perl5 code generation
when running under Windows-NT.
4/8/97 : Bug when using default arguments and C++ references fixed.
4/8/97 : Fixed code generation bugs in Python and Perl5 modules related to
using class renaming (applying the %name directive to a class
definition) and shadow classes.
4/7/97 : Fixed minor bugs in swigptr.swg, tcl8ptr.swg, and perl5ptr.swg to
prevent infinite loops when weird datatypes are passed.
3/29/97 : 'Makefile.win' added. This is used to build most of the examples
in the Examples directory under Windows NT/95.
3/27/97 : Fixes to SWIG's error return codes. SWIG now returns non-zero
exit codes for certain kinds of errors (which makes it more
friendly to makefiles). An overhaul of the error handling
is on the to-do list and will probably show up in a later release.
3/25/97 : Bug fix. "freearg" and "argout" typemaps have been fixed in
the Perl5 module. In previous versions, function input parameters
and function output parameters shared the same memory space--causing
all sorts of nasty problems when trying to pass perl values by
reference. SWIG now internally makes a "copy" (which is really
just a pointer) of affected parameters and uses that. This
is done transparently so there is no noticable impact on any
SWIG generated modules. This change is probably only noticable
to expert users.
3/25/97 : Added type-check to verbose and stat mode. SWIG will now generate a list
of all datatypes that were used but undefined (useful for tracking
down weird bugs). This is enabled with the -v option (which
is now officially known as "overly verbose" mode) or the -stat option.
3/25/97 : Slight change to the parser to make include guards work correctly.
For example :
#ifndef INTERFACE_I
#define INTERFACE_I
%module foobar.i
... declarations ...
#endif
3/24/97 : %checkout directive added. This allows an interface file to
extract files from the SWIG library and place them in the
current directory. This can be used to extract scripts and
other helper code that might be associated with library files.
For example :
%checkout array.tcl
Will look for a file "array.tcl" in the library and copy it
to the current directory. If the file already exists in the
directory, this directive does nothing (it will not overwrite an
existing file). This only an experimental feature for now.
3/24/97 : SWIG will now look in the SWIG Library for a file if it can't
find it in the current directory. As a result, it is easy to
make modules from SWIG library files. For example, if you
want to make a Python module from the SWIG timers library, just
type this in any directory :
swig -python timers.i
You will get the files timers_wrap.c and timers_wrap.doc in
the current directory that you can now compile. The file
remains in the SWIG library (although you can check it out
using the -co option). *** New Feature ***
3/24/97 : -co option added to SWIG to allow easy access to the SWIG library.
When used, this instructs SWIG to check out a library file and
place it in the current directory. For example :
unix > swig -co array.i
array.i checked out from the SWIG library
unix >
Once in your directory you can customize the file to suit your
particular purposes. The checkout option makes it easy to
grab library files without knowing anything about the SWIG
installation, but it also makes it possible to start
including scripts, C code, and other miscellaneous files
in the library. For example, you could put a cool script
in the library and check it out whenever you wanted to use it.
*** New Feature ***
3/24/97 : #pragma export directives added to Tcl output for compiling
shared libraries on the Mac.
3/24/97 : Minor changes to wish.i and tclsh.i library files to provide
support for the Macintosh.
3/19/97 : SWIG's policy towards NULL pointers has been relaxed. The
policy of requiring a special compiler directive -DALLOW_NULL
to use NULL pointers is no longer supported. While this may
seem "unsafe", it turns out that you can use a "check"
typemap to achieve some safety. For example :
%typemap(perl5,check) Node * {
if (!$target)
croak("NULL Pointers not allowed.");
}
This prevents any NULL value of a "Node *" pointer to be
passed to a function. (I think this is much cleaner
than the old -DALLOW_NULL hack anyways).
3/19/97 : Fixed pointer handling errors in Perl5 module. Modules no
longer core dump when a Perl reference is inadvertently
passed in as a C pointer.
3/18/97 : Added a "check" typemap. This can be used to check the
validity of function input values. For example :
%typemap(perl5,check) int posint {
if ($target < 0)
croak("Argument is not a positive integer");
}
3/18/97 : Added an $arg variable to Tcl typemaps. This makes it easier
to return argument values by "reference".
3/18/97 : Fixed a code generation bug when using C++ references and
the %addmethods directive.
3/18/97 : Fixed a few glitches in the typemap module with respect to
chaining. For example :
%typemap(tcl,in) int {
$in // Inserts prexisting typemap
printf("Received a %d\n", $target);
}
This has been allowed for quite some time, but didn't work
if no existing typemap was defined. Now, it still doesn't
work if no existing typemap is defined, but it issues a
warning message. There is some support using default typemaps,
but none of the language modules take advantage of it. This
should be considered experimental at this time.
Version 1.1b5 Patch 1 (March 16, 1997)
======================================
3/16/97 : Fixed references bug with C++ code generation.
3/16/97 : Fixed initialization bug in the documentation system that
was causing weird problems.
3/16/97 : Fixed fatal bug with -c option in the Python module.
3/13/97 : Fixed bug in the documentation system involving the %text directive
and sorting. In the old system, %text entries would float to the
top of a section because they were "nameless". Now they are
attached to the previous declaration and will stay in the proper
location relative to the previous entry.
Version 1.1b5 (March 12, 1997)
==============================
3/11/97 : Fixed compilation problems introduced by Tcl/Tk 8.0a2.
*** INCOMPATIBILITY *** SWIG no longer works with Tcl/Tk 8.0a1.
3/10/97 : Fixed bug with ignored arguments and C++ member functions in
the Python module.
3/9/97 : Parsing bugs with nested class definitions and privately
declared nested class definitions fixed.
3/9/97 : Fixed a few minor code generation bugs with C++ classes and
constructors. In some cases, the resulting wrapper code
would not compile properly. SWIG now attempts to use
the default copy constructor instead.
3/8/97 : Added a -l option to SWIG that allows additional SWIG library files
to be grabbed without having them specified in the interface file.
This makes it easier to keep the interface file clean and move certain
options into a Makefile. For example :
swig -tcl example.i # Build a normal Tcl extension
swig -tcl -lwish.i example.i # Build it as a wish extension
# by including the 'wish.i' file.
swig -python example.i # Build a dynamically loaded extension
swig -python -lembed.i example.i # Build a static extension
These kinds of options could previously be accomplished with
conditional compilation such as :
%module example
...
#ifdef STATIC
%include embed.i
#endif
3/8/97 : Incorporated changes to Guile module to use the new gh interface
in FSF Guile 1.0. The older gscm interface used in Cygnus
Guile releases is no longer supported by SWIG.
3/8/97 : Cleaned up the Tcl Netscape plugin example. It should work with
version 1.1 of the plugin now.
3/8/97 : Added better array support to the typemap module. The keyword
ANY can now be used to match any array dimension. For example :
%typemap(tcl,in) double [ANY] {
... get an array ...
}
This will match any single-dimensional double array. The array
dimension is passed in the variables $dim0, $dim1, ... $dim9. For
example :
%typemap(tcl,in) double [ANY][ANY][ANY] {
printf("Received a double[%d][%d][%d]\n",$dim0,$dim1,$dim2);
}
Any typemap involving a specific array dimension will override any
specified with the ANY tag. Thus, a %typemap(tcl,in) double [5][4][ANY] {}
would override a double [ANY][ANY][ANY]. However, overuse of the ANY
tag in arrays of high-dimensions may not work as you expect due to
the pattern matching rule used. For example, which of the following
typemaps has precedence?
%typemap(in) double [ANY][5] {} // Avoid this!
%typemap(in) double [5][ANY] {}
3/7/97 : Fixed a number of bugs related to multi-dimensional array handling.
Typedefs involving multi-dimensional arrays now works correctly.
For example :
typedef double MATRIX[4][4];
...
extern double foo(MATRIX a);
Typecasting of pointers into multi-dimensional arrays is now
implemented properly when making C/C++ function calls.
3/6/97 : Fixed potentially dangerous bug in the Tcl Object-oriented
interface. Well, actually, didn't fix it but issued a
Tcl error instead. The bug would manifest itself as follows:
% set l [List] # Create an object
...
% set m [List -this $l] # Make $m into an object assuming $l
# contains a pointer.
# Since $m == $l, $l gets destroyed
# (since its the same command name)
% $m insert Foo
Segmentation fault # Note : the list no longer exists!
Now, an error will be generated instead of redefining the command.
As in :
% set l [List]
...
% set m [List -this $l]
Object name already exists!
Use catch{} to ignore the error.
3/3/97 : Better support for enums added. Datatypes of 'enum MyEnum'
and typedefs such as 'typedef enum MyEnum Foo;' now work.
3/3/97 : Parser modified to ignore constructor initializers such as :
class Foo : public Bar {
int a,b;
public:
Foo(int i) : a(0), b(i), Bar(i,0) { };
};
3/3/97 : Modified parser to ignore C++ exception specifications such as :
int foo(double) throw(X,Y);
3/3/97 : Added %import directive. This works exactly like %extern
except it tells the language module that the declarations are
coming from a separate module. This is usually only
needed when working with shadow classes.
3/2/97 : Changed pointer type-checker to be significantly more
efficient when working with derived datatypes. This
has been accomplished by storing type-mappings in sorted
order, using binary search schemes, and caching recently
used datatypes. For SWIG generated C++ modules that
make a large number of C function calls with derived types,
this could result in speedups of between 100 and 50000 percent.
However, due to the required sorting operation, module
loading time may increased slightly when there are lots of
datatypes.
3/2/97 : Fixed some C++ compilation problems with Python
embed.i library files.
2/27/97 : Slight change to C++ code generation to use copy constructors
when returning complex data type by value.
2/26/97 : Fixed bug in Python module with -c option.
2/26/97 : Slight tweak of parser to allow trailing comma in enumerations
such as
enum Value (ALE, STOUT, LAGER, };
2/25/97 : Fixed code generation bug in Tcl module when using the
%name() directive on a classname.
2/25/97 : Finished code-size optimization of C++ code generation with
inheritance of attributes. Inherited attributes now
only generate one set of wrapper functions that are re-used
in any derived classes. This could provide big code
size improvements in some scripting language interfaces.
2/25/97 : Perl5 module modified to support both the Unix and Windows
versions. The windows version has been tested with the
Activeware port of Perl 5.003 running under Windows 95.
The C source generated by SWIG should compile without
modification under both versions of Perl, but is now
even more hideous than before.
2/25/97 : Modified parser to allow scope resolution operation to
appear in expressions and default arguments as in :
void foo(int a = Bar::defvalue);
2/25/97 : Fixed bug when resolving symbols inside C++ classes.
For example :
class Foo {
public:
enum Value {ALE, STOUT, LAGER};
...
void defarg(Value v = STOUT);
};
2/24/97 : Fixed bug with member functions returning void *.
2/23/97 : Modified Python module to be better behaved under Windows
- Module initialization function is now properly exported.
It should not be neccessary to explicitly export this function
yourself.
- Bizarre compilation problems when compiling the SWIG wrapper
code as ANSI C under Visual C++ 4.x fixed.
- Tested with both the stock Python-1.4 distribution and Pythonwin
running under Win95.
2/19/97 : Fixed typedef handling bug in Perl5 shadow classes.
2/19/97 : Added exception support. To use it, do the following :
%except(lang) {
... try part of the exception ...
$function
... catch part of exception ...
}
$function is a SWIG variable that will be replaced by the
actual C/C++ function call in a wrapper function. Thus,
a real exception specification might look like this :
%except(perl5) {
try {
$function
} catch (char *& sz) {
... process an exception ...
} catch(...) {
croak("Unknown exception. Bailing out...");
}
}
2/19/97 : Added support for managing generic code fragments (needed
for exceptions).
2/19/97 : Fixed some really obscure typemap scoping bugs in the C++
handler.
2/18/97 : Cleaned up perlmain.i file by removing some problematic,
but seemingly unnecessary declarations.
2/18/97 : Optimized handling of member functions under inheritance.
SWIG can now use wrapper functions generated for a
base class instead of regenerating wrappers for
the same functions in a derived class. This could
make a drastic reduction in wrapper code size for C++
applications with deep inheritance hierarchies and
lots of functions.
2/18/97 : Additional methods specified with %addmethods can now
be inherited along with normal C++ member functions.
2/18/97 : Minor internal fixes to make SWIG's string handling a little
safer.
2/16/97 : Moved some code generation of Tcl shadow classes to
library files.
2/16/97 : Fixed documentation error of '-configure' method in
Tcl modules.
2/16/97 : Modified Perl5 module slightly to allow typemaps
to use Perl references.
2/12/97 : Fixed argument checking bug that was introduced by
default arguments (function calls with too many
arguments would still be executed). Functions now
must have the same number of arguments as C version
(with possibility of default/optional arguments
still supported).
2/12/97 : Fixed default argument bug in Perl5 module when
generating wrapper functions involving default
arguments of complex datatypes.
2/12/97 : Fixed typemap scoping problems. For example :
%typemap(tcl,in) double {
.. get a double ..
}
class Foo {
public:
double bar(double);
}
%typemap(tcl,in) double {
.. new get double ..
}
Would apply the second typemap to all functions in Foo
due to delayed generation of C++ wrapper code (clearly this
is not the desired effect). Problem has been fixed by
assigning unique numerical identifiers to every datatype in
an interface file and recording the "range of effect" of each
typemap.
2/11/97 : Added support for "ignore" and "default" typemaps. Only use
if you absolutely know what you're doing.
2/9/97 : Added automatic creation of constructors and destructors for
C structs and C++ classes that do not specify any sort of
constructor or destructor. This feature can be enabled by
running SWIG with the '-make_default' option or by inserting
the following pragma into an interface file :
%pragma make_default
The following pragma disables automatic constructor generation
%pragma no_default
2/9/97 : Added -make_default option for producing default constructors
and destructors for classes without them.
2/9/97 : Changed the syntax of the SWIG %pragma directive to
%pragma option=value or %pragma(lang) option=value.
This change makes the syntax a little more consistent
between general pragmas and language-specific pragmas.
The old syntax still works, but will probably be phased
out (a warning message is currently printed).
2/9/97 : Improved Tcl support of global variables that are of
structures, classes, and unions.
2/9/97 : Fixed C++ compilation problem in Python 'embed.i' library file.
2/9/97 : Fixed missing return value in perlmain.i library file.
2/9/97 : Fixed Python shadow classes to return an AttributeError when
undefined attributes are accessed (older versions returned
a NameError).
2/9/97 : Fixed bug when %addmethods is used after a class definition whose
last section is protected or private.
2/8/97 : Made slight changes in include file processing to support
the Macintosh.
2/8/97 : Extended swigmain.cxx to provide a rudimentary Macintosh interface.
It's a really bad interface, but works until something better
is written.
1/29/97 : Fixed type-casting bug introduced by 1.1b4 when setting/getting the
value of global variables involving complex data types.
1/29/97 : Removed erroneous white space before an #endif in the code generated
by the Python module (was causing errors on DEC Alpha compilers).
1/26/97 : Fixed errors when using default/optional arguments in Python shadow
shadow classes.
1/23/97 : Fixed bug with nested %extern declarations.
1/21/97 : Fixed problem with typedef involving const datatypes.
1/21/97 : Somewhat obscure, but serious bug with having multiple levels
of typedefs fixed. For example :
typedef char *String;
typedef String Name;
Version 1.1 Beta4 (January 16, 1997)
====================================
Note : SWIG 1.1b3 crashed and burned shortly after take off due
to a few major run-time problems that surfaced after release.
This release should fix most, if not all, of those problems.
1/16/97 : Fixed major memory management bug on Linux
1/14/97 : Fixed bug in functions returning constant C++ references.
1/14/97 : Modified C++ module to handle datatypes better.
1/14/97 : Modified parser to allow a *single* scope resolution
operator in datatypes. Ie : Foo::bar. SWIG doesn't
yet handle nested classes, so this should be
sufficient for now.
1/14/97 : Modified parser to allow typedef inside a C++ class.
1/14/97 : Fixed some problems related to datatypes defined inside
a C++ class. SWIG was not generating correct code,
but a new scoping mechanism and method for handling
datatypes inside a C++ class have been added.
1/14/97 : Changed enumerations to use the value name instead
of any values that might have appeared in the interface
file. This makes the code a little more friendly to
C++ compilers.
1/14/97 : Removed typedef bug that made all enumerations
equivalent to each other in the type checker (since
it generated alot of unnecessary code).
Version 1.1 Beta3 (January 9, 1997)
====================================
Note : A *huge* number of changes related to ongoing modifications.
1. Support for C++ multiple inheritance added.
2. Typemaps added.
3. Some support for nested structure definitions added.
4. Default argument handling added.
5. -c option added for building bare wrapper code modules.
6. Rewrote Pointer type-checking to support multiple inheritance
correctly.
7. Tcl 8.0 module added.
8. Perl4 and Guile modules resurrected from the dead (well, they
at least work again).
9. New Object Oriented Tcl interface added.
10. Bug fixes to Perl5 shadow classes.
11. Cleaned up many of the internal modules of the parser.
12. Tons of examples and testing modules added.
13. Fixed bugs related to use of "const" return values.
14. Fixed bug with C++ member functions returning void *.
15. Changed SWIG configuration script.
Version 1.1 Beta2 (December 3, 1996)
====================================
1. Completely rewrote the SWIG documentation system. The changes
involved are too numerous to mention. Basically, take everything
you knew about the old system, throw them out, and read the
file Doc/doc.ps.
2. Limited support for #if defined() added.
3. Type casts are now allowed in constant expressions. ie
#define A (int) 3
4. Added support for typedef lists. For example :
typedef struct {
double x,y,z;
} Vector, *VectorPtr;
5. New SWIG directives (related to documentation system)
%style
%localstyle
%subsection
%subsubsection
6. Reorganized the C++ handling and made it a little easier to
work with internally.
7. Fixed problem with inheriting data members in Python
shadow classes.
8. Fixed symbol table problems with shadow classes in both
Python and Perl.
9. Fixed annoying segmentation fault bug in wrapper code
generated for Perl5.
10. Fixed bug with %addmethods directive. Now it can be placed
anywhere in a class.
11. More test cases added to the SWIG self-test. Documentation
tests are now performed along with other things.
12. Reorganized the SWIG library a little bit and set it up to
self-document itself using SWIG.
13. Lots and lots of minor bug fixes (mostly obscure, but bugs
nonetheless).
Version 1.1 Beta1 (October 30, 1996)
====================================
1. Added new %extern directive for handling multiple files
2. Perl5 shadow classes added
3. Rewrote conditional compilation to work better
4. Added 'bool' datatype
5. %{,%} block is now optional.
6. Fixed some bugs in the Python shadow class module
7. Rewrote all of the SWIG tests to be more informative
(and less scary).
8. Rewrote parameter list handling to be more memory
efficient and flexible.
9. Changed parser to ignore 'static' declarations.
10. Initializers are now ignored. For example :
struct FooBar a = {3,4,5};
11. Somewhat better parsing of arrays (although it's
usually just a better error message now).
12. Lot's of minor bug fixes.
Version 1.0 Final (August 31, 1996)
===================================
1. Fixed minor bug in C++ module
2. Fixed minor bug in pointer type-checker when using
-DALLOW_NULL.
3. Fixed configure script to work with Python 1.4beta3
4. Changed configure script to allow compilation without
yacc or bison.
Version 1.0 Final (August 28, 1996)
===================================
1. Changed parser to support more C/C++ datatypes (well,
more variants). Types like "unsigned", "short int",
"long int", etc... now work.
2. "unions" added to parser.
3. Use of "typedef" as in :
typedef struct {
double x,y,z;
} Vector;
Now works correctly. The name of the typedef is used as
the structure name.
4. Conditional compilation with #ifdef, #else, #endif, etc...
added.
5. New %disabledoc, %enabledoc directives allow documentation
to selectively be disabled for certain parts of a wrapper
file.
6. New Python module supports better variable linking, constants,
and shadow classes.
7. Perl5 module improved with better compatibility with XS
and xsubpp. SWIG pointers and now created so that they
are compatible with xsubpp pointers.
8. Support for [incr Tcl] namespaces added to Tcl module.
9. %pragma directive added.
10. %addmethods directive added.
11. %native directive added to allow pre-existing wrapper functions
to be used.
12. Wrote configure script for SWIG installation.
13. Function pointers now allowed with typedef statements.
14. %typedef modified to insert a corresponding C typedef into
the output file.
15. Fixed some problems related to C++ references.
16. New String and WrapperFunction classes add to make generating
wrapper code easier.
17. Fixed command line option processing to eliminate core dumps
and to allow help messages.
18. Lot's of minor bug fixes to almost all code modules
Version 1.0 Beta 3 (Patch 1) July 17, 1996
==========================================
1.0 Final is not quite ready yet, but this release fixes a
number of immediate problems :
1. Compiler errors when using -strict 1 type checking have been fixed.
2. Pointer type checker now recognizes pointers of the form
_0_Type correctly.
3. A few minor fixes were made in the Makefile
Version 1.0 Beta 3 (June 14, 1996)
===================================
There are lots of changes in this release :
1. SWIG is now invoked using the "swig" command instead of "wrap".
Hey, swig sounds cooler.
2. The SWIG_LIB environment variable can be set to change the
location where SWIG looks for library files.
3. C++ support has been added. You should use the -c++ option
to enable it.
4. The %init directive has been replaced by the %module directive.
%module constructs a valid name for the initialization function
for whatever target language you're using (actually this makes
SWIG files a little cleaner). The old %init directive still works.
5. The syntax of the %name directive has been changed. Use of the
old one should generate a warning message, but may still work.
6. To support Tcl/Tk on non-unix platforms, SWIG imports a file called
swigtcl.cfg from the $(SWIG_LIB)/tcl directory. I don't have access
to an NT machine, but this file is supposedly allows SWIG to
produce wrapper code that compiles on both UNIX and non UNIX machines.
If this doesn't work, you'll have to edit the file swigtcl.cfg. Please
let me know if this doesn't work so I can update the file as
necessary.
7. The SWIG run-time typechecker has been improved. You can also
now redefine how it works by supplying a file called "swigptr.cfg"
in the same directory as your SWIG interface files. By default,
SWIG reads this file from $(SWIG_LIB)/config.
8. The documentation system has been changed to support the following :
- Documentation order is printed in interface file order by
default. This can be overridden by putting an %alpha
directive in the beginning of the interface file.
- You can supply additional documentation text using
%text %{ put your text here %}
- A few minor bugs were fixed.
9. A few improvements have been made to the handling of command line
options (but it's still not finished).
10. Lots of minor bug fixes in most of the language modules have been
made.
11. Filenames have been changed to 8.3 for compatibility with a SWIG
port to non-unix platforms (work in progress).
12. C++ file suffix is now .cxx (for same reason).
13. The documentation has been upgraded significantly and is now
around 100 pages. I added new examples and a section on
C++. The documentation now includes a Table of Contents.
14. The SWIG Examples directory is still woefully sparse, but is
getting better.
Special notice about C++
------------------------
This is the first version of SWIG to support C++ parsing. Currently
the C++ is far from complete, but seems to work for simple cases.
No work has been done to add special C++ processing to any of
the target languages. See the user manual for details about how
C++ is handled. If you find problems with the C++ implementation,
please let me know. Expect major improvements in this area.
Note : I have only successfully used SWIG and C++ with Tcl and
Python.
Notice about Version 1.0Final
-----------------------------
Version 1.0B3 is the last Beta release before version 1.0 Final is
released. I have frozen the list of features supported in version 1.0
and will only fix bugs as they show up. Work on SWIG version 2.0 is
already in progress, but is going to result in rather significant
changes to SWIG's internal structure (hopefully for the better). No
anticipated date for version 2.0 is set, but if you've got an idea,
let me know.
Version 1.0 Beta 2 (April 26, 1996)
===================================
This release is identical to Beta1 except a few minor bugs are
fixed and the SWIG library has been updated to work with Tcl 7.5/Tk 4.1.
A tcl7.5 examples directory is now included.
- Fixed a bug in the Makefile that didn't install the libraries
correctly.
- SWIG Library files are now updated to work with Tcl 7.5 and Tk 4.1.
- Minor bug fixes in other modules.
Version 1.0 Beta 1 (April 10, 1996).
=====================================
This is the first "semi-official" release of SWIG. It has a
number of substantial improvements over the Alpha release. These
notes are in no particular order--hope I remembered everything....
1. Tcl/Tk
SWIG is known to work with Tcl7.3, Tk3.6 and later versions.
I've also tested SWIG with expect-5.19.
Normally SWIG expects to use the header files "tcl.h" and "tk.h".
Newer versions of Tcl/Tk use version numbers. You can specify these
in SWIG as follows :
% wrap -htcl tcl7.4.h -htk tk4.0.h example.i
Of course, I prefer to simply set up symbolic links between "tcl.h" and
the most recent stable version on the machine.
2. Perl4
This implementation has been based on Perl-4.035. SWIG's interface to
Perl4 is based on the documentation provided in the "Programming Perl"
book by Larry Wall, and files located in the "usub" directory of the
Perl4 distribution.
In order to compile with Perl4, you'll need to link with the uperl.o
file found in the Perl4 source directory. You may want to move this
file to a more convenient location.
3. Perl5
This is a somewhat experimental implementation, but is alot less
buggy than the alpha release. SWIG operates independently of
the XS language and xsubpp supplied with Perl5. Currently SWIG
produces the necessary C code and .pm file needed to dynamically
load a module into Perl5.
To support Perl5's notion of modules and packages (as with xsubpp),
you can use the following command line options :
% wrap -perl5 -module MyModule -package MyPackage example.i
Note : In order for dynamic loading to be effective, you need to be
careful about naming. For a module named "MyModule", you'll need to
create a shared object file called "MyModule.so" using something like
% ld -shared my_obj.o -o MyModule.so
The use of the %init directive must match the module name since Perl5
calls a function "boot_ModuleName" in order to initialize things.
See the Examples directory for some examples of how to get things
to work.
4. Python1.3
This is the first release supporting Python. The Python port is
experimental and may be rewritten. Variable linkage is done through
functions which is sort of a kludge. I also think it would be nice
to import SWIG pointers into Python as a new object (instead of strings).
Of course, this needs a little more work.
5. Guile3
If you really want to live on the edge, pick up a copy of Guile-iii and
play around with this. This is highly experimental---especially since
I'm not sure what the official state of Guile is these days. This
implementation may change at any time should I suddenly figure out better
ways to do things.
6. Extending SWIG
SWIG is written in C++ although I tend to think of the code as mostly
being ANSI C with a little inheritance thrown in. Each target language
is implemented as a C++ class that can be plugged into the system.
If you want to add your own modifications, see Appendix C of the user
manual. Then take a look at the "user" directory which contains some
code for building your own extenions.
7. The SWIG library
The SWIG library is still incomplete. Some of the files mentioned in
the user manual are unavailable. These files will be made available
when they are ready. Subscribe to the SWIG mailing list for announcements
and updates.
8. SWIG Documentation
I have sometimes experienced problems viewing the SWIG documentation in
some postscript viewers. However, the documentation seems to print
normally. I'm working on making much of the documentation online,
but this takes time.
Version 0.1 Alpha (February 9, 1996)
====================================
1. Run-time type-checking of SWIG pointers. Pointers are now represented
as strings with both numeric and encoded type information. This makes
it a little harder to shoot yourself in the foot (and it eliminates
some segmentation faults and other oddities).
2. Python 1.3 now supported.
3. #define and enum can be used to install constants.
4. Completely rewrote the %include directive and made it alot more powerful.
5. Restructured the SWIG library to make it work better.
6. Various bug fixes to Tcl, Perl4, Perl5, and Guile implementations.
7. Better implementation of %typedef directive.
8. Made some changes to SWIG's class structure to make it easier to expand.
SWIG is now built into a library file that you can use to make your
own extenions.
9. Made extensive changes to the documentation.
10. Minor changes to the SWIG parser to make it use less memory.
Also took out some extraneous rules that were undocumented and
didn't work in the first place.
11. The SWIG library files "tclsh", "wish", "expect", etc... in the first
release have been restructured and renamed to "tclsh.i", "wish.i",
and so on.
|