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
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
25761
25762
25763
25764
25765
25766
25767
25768
25769
25770
25771
25772
25773
25774
25775
25776
25777
25778
25779
25780
25781
25782
25783
25784
25785
25786
25787
25788
25789
25790
25791
25792
25793
25794
25795
25796
25797
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810
25811
25812
25813
25814
25815
25816
25817
25818
25819
25820
25821
25822
25823
25824
25825
25826
25827
25828
25829
25830
25831
25832
25833
25834
25835
25836
25837
25838
25839
25840
25841
25842
25843
25844
25845
25846
25847
25848
25849
25850
25851
25852
25853
25854
25855
25856
25857
25858
25859
25860
25861
25862
25863
25864
25865
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883
25884
25885
25886
25887
25888
25889
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
25908
25909
25910
25911
25912
25913
25914
25915
25916
25917
25918
25919
25920
25921
25922
25923
25924
25925
25926
25927
25928
25929
25930
25931
25932
25933
25934
25935
25936
25937
25938
25939
25940
25941
25942
25943
25944
25945
25946
25947
25948
25949
25950
25951
25952
25953
25954
25955
25956
25957
25958
25959
25960
25961
25962
25963
25964
25965
25966
25967
25968
25969
25970
25971
25972
25973
25974
25975
25976
25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
26011
26012
26013
26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
26040
26041
26042
26043
26044
26045
26046
26047
26048
26049
26050
26051
26052
26053
26054
26055
26056
26057
26058
26059
26060
26061
26062
26063
26064
26065
26066
26067
26068
26069
26070
26071
26072
26073
26074
26075
26076
26077
26078
26079
26080
26081
26082
26083
26084
26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
26104
26105
26106
26107
26108
26109
26110
26111
26112
26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
26131
26132
26133
26134
26135
26136
26137
26138
26139
26140
26141
26142
26143
26144
26145
26146
26147
26148
26149
26150
26151
26152
26153
26154
26155
26156
26157
26158
26159
26160
26161
26162
26163
26164
26165
26166
26167
26168
26169
26170
26171
26172
26173
26174
26175
26176
26177
26178
26179
26180
26181
26182
26183
26184
26185
26186
26187
26188
26189
26190
26191
26192
26193
26194
26195
26196
26197
26198
26199
26200
26201
26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
26223
26224
26225
26226
26227
26228
26229
26230
26231
26232
26233
26234
26235
26236
26237
26238
26239
26240
26241
26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
26252
26253
26254
26255
26256
26257
26258
26259
26260
26261
26262
26263
26264
26265
26266
26267
26268
26269
26270
26271
26272
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284
26285
26286
26287
26288
26289
26290
26291
26292
26293
26294
26295
26296
26297
26298
26299
26300
26301
26302
26303
26304
26305
26306
26307
26308
26309
26310
26311
26312
26313
26314
26315
26316
26317
26318
26319
26320
26321
26322
26323
26324
26325
26326
26327
26328
26329
26330
26331
26332
26333
26334
26335
26336
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346
26347
26348
26349
26350
26351
26352
26353
26354
26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
26367
26368
26369
26370
26371
26372
26373
26374
26375
26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
26387
26388
26389
26390
26391
26392
26393
26394
26395
26396
26397
26398
26399
26400
26401
26402
26403
26404
26405
26406
26407
26408
26409
26410
26411
26412
26413
26414
26415
26416
26417
26418
26419
26420
26421
26422
26423
26424
26425
26426
26427
26428
26429
26430
26431
26432
26433
26434
26435
26436
26437
26438
26439
26440
26441
26442
26443
26444
26445
26446
26447
26448
26449
26450
26451
26452
26453
26454
26455
26456
26457
26458
26459
26460
26461
26462
26463
26464
26465
26466
26467
26468
26469
26470
26471
26472
26473
26474
26475
26476
26477
26478
26479
26480
26481
26482
26483
26484
26485
26486
26487
26488
26489
26490
26491
26492
26493
26494
26495
26496
26497
26498
26499
26500
26501
26502
26503
26504
26505
26506
26507
26508
26509
26510
26511
26512
26513
26514
26515
26516
26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
26528
26529
26530
26531
26532
26533
26534
26535
26536
26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
26548
26549
26550
26551
26552
26553
26554
26555
26556
26557
26558
26559
26560
26561
26562
26563
26564
26565
26566
26567
26568
26569
26570
|
SWIG (Simplified Wrapper and Interface Generator)
See the CHANGES.current file for changes in the current version.
See the RELEASENOTES file for a summary of changes in each release.
Issue # numbers mentioned below can be found on Github. For more details, add
the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.1 (21 Aug 2019)
===========================
2019-08-20: TekuConcept
[Javascript] #1535 Add %native support to Javascript.
2019-08-20: bkotzz
[Java] #1616 Add SWIG_JavaIllegalStateException to support throwing
java.lang.IllegalStateException from JNI code.
2019-08-19: sjml
[Lua] #1596 tostring output changes to show the underlying C/C++ pointer.
2019-08-08: rokups
[C#, Java] #1601 Fix invalid code generated for "%constant enum EnumType.
2019-08-07: wsfulton
[Python] Fix method overloading of methods that take STL containers of different
types. The following usage (using std::vector) would fail when using -builtin:
%include <std_string.i>
%include <std_vector.i>
%inline %{
struct X {};
%}
%template(VectorX) std::vector<X>;
%template(VectorInt) std::vector<int>;
%inline %{
using namespace std;
string VectorOverload(vector<X> v);
string VectorOverload(vector<int> v);
%}
The following would incorrectly fail:
s = VectorOverload([1, 2, 3])
With:
Traceback (most recent call last):
File "runme3.py", line 20, in <module>
ret = VectorOverload([1, 2, 3])
TypeError: Wrong number or type of arguments for overloaded function 'VectorOverload'.
Possible C/C++ prototypes are:
VectorOverload(std::vector< Number,std::allocator< Number > >)
VectorOverload(std::vector< int,std::allocator< int > >)
The problem was due to some error handling that was not cleared during typehecking.
In this case an error was not cleared when the elements in the list failed the
typecheck for converting to X. Only occurs in Python 3+.
In some combinations of overloaded methods, the following type of error message would
occur:
RuntimeError: in sequence element 0
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "runme3.py", line 23, in <module>
check(VectorOverload(v), "vector<X>")
SystemError: <built-in function VectorOverload> returned a result with an error set
2019-08-01: wsfulton
#1602 Fix regression in 4.0.0 where a template function containing a parameter
with the same name as the function name led to the parameter name used in the
target language being incorrectly modified.
2019-07-29: wsfulton
Remove all generated files on error. Previously generated files were not removed,
potentially breaking Makefiles using file dependencies, especially when -Werror
(warnings as errors) was used.
2019-07-23: smithx
[C#] #1530 #1532 Fix marshalling of std::wstring to C#.
2019-07-18: gicmo
[Python] #1587 Python 3.8 support - remove use of deprecated PyObject_GC_UnTrack.
2019-07-18: cher-nov
[Python] #1573 Generated Python code uses consistent string quoting style - double
quotes.
2019-07-16: geefr
[C#] #616 #1576 Fix C# bool INPUT[], bool OUTPUT[], bool INOUT[] typemaps to marshall
as 1-byte.
2019-07-12: vadz
[C#, Java] #1568 #1583 Fix std::set<> typemaps for primitive types.
2019-07-12: vadz
#1566 #1584 Regression in 4.0.0 - fix missing value for first item of enums with
trailing comma.
2019-07-11: mcfarljm
#1548 #1578 Fix segfault in Doxygen parser parsing empty lines in some commands like
\code.
2019-07-09: IsaacPascual
[C#, Java] #1570 Fix name of generated C#/Java classes for %interface macros
in swiginterface.i when wrapping nested C++ classes.
2019-07-05: wsfulton
[Python] #1547 Whitespace fixes in Doxygen translated comments into pydoc comments
for Sphinx compatibility.
2019-06-28: wsfulton
[MzScheme, OCaml] #1559 $arg and $input were incorrectly substituted in the
argout typemap when two or more arguments were present.
2019-06-24: wsfulton
[Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
This class was intended for director exception handling but was never used by
SWIG and was never documented.
*** POTENTIAL INCOMPATIBILITY ***
2019-06-06: bkotzz
[Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
a native Java array as input.
2019-06-03: olly
[Python] Fix regression in implicit_conv handling of tuples,
introduced in SWIG 4.0.0. Fixes #1553, reported by Alexandre
Duret-Lutz.
2019-05-24: wsfulton
[Octave] Fix detection of Octave on MacOS.
2019-05-24: opoplawski
[Octave] #1522 Adapt OCTAVE_LDFLAGS for Octave 5.1.
2019-05-22: ferdynator
[PHP] #1528 Don't add a closing '?>' PHP tag to generated files.
PSR-2 says it MUST be omitted for files containing only PHP.
Version 4.0.0 (27 Apr 2019)
===========================
2019-04-24: vadz
#1517 Fix crash if "@return" Doxygen tag was used on a node without any return type.
2019-04-24: vadz
#1515 Fix parsing of enums with trailing comma when using -doxygen.
2019-04-19: ianlancetaylor
[Go] #1055 When generating Go code, make -cgo the default. Add new -no-cgo option
to disable the default.
2019-04-19: pbecherer
[Tcl] #1508 Fix Visual Studio 2015 and later compilation errors due to snprintf macro
definition.
2019-04-09: wsfulton
[C#] Fix FxCop warning CA2002 in SWIGPendingException - a lock on a reference of
type 'Type'.
2019-03-30: wsfulton
[Java, D] Add the parameters typemap attribute to the javadestruct,
javadestruct_derived, ddispose, ddispose_derived typemaps to mirror enhanced
flexibility in the csdisposing and csdisposing_derived (C#) typemaps. If provided
the contents are generated as the delete/dispose method's parameters declaration.
2019-03-30: wsfulton
[C#] #421 Fix FxCop warning CA1063 by implementing the recommended Dispose methods for
the IDisposable interface. Previously just the Dispose() method was generated.
Now the Dispose() and Dispose(bool disposing) methods are generated.
Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived"
typemaps are being used. Details in #421 on Github. SWIG will error out if one of
the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example
error message:
foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove
it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the
csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.
*** POTENTIAL INCOMPATIBILITY ***
2019-03-25: Liryna
[C#] #1143 Add std_list.i for std::list support.
The C# std::list<T> wrappers are made to look and feel like a C#
System.Collections.Generic.LinkedList<> collection.
The IEnumerable<> interface is implemented in the proxy class.
The ICollection<> interface can also be implemented to provide enhanced functionality
whenever a C++ operator== is available. This is the case for when T is a
primitive type or a pointer. If T does define an operator==, then use the
SWIG_STD_LIST_ENHANCED macro to obtain this enhanced functionality, for example:
SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
%template(ListKlass) std::list<SomeNamespace::Klass>;
2019-03-18: richardbeare
[R] #1328 Non-trivial enums are working now. The enum values are now obtained from
the C/C++ layer. const reference enums and C++11 enum classes are also now working.
2019-03-14: mochizk
[Javascript] #1500 Fix compilation errors due to deprecating V8 API in Node.js.
New V8 API is used if node.js >= v10.12, or if V8 >= v7.0.
2019-03-12: vadz
[C#] #1495 Add std_set.i for std::set support.
2019-03-11: dirteat,opoplawski
[Octave] Fix compilation errors in Octave 5.1.
error: format not a string literal and no format arguments [-Werror=format-security]
2019-02-28: wsfulton
[Java] std::vector improvements for types that do not have a default constructor.
The std::vector wrappers have been changed to work by default for elements that are
not default insertable, i.e. have no default constructor. This has been achieved by
not wrapping:
vector(size_type n);
Previously the above had to be ignored via %ignore.
If the above constructor is still required it can be added back in again via %extend:
%extend std::vector {
vector(size_type count) { return new std::vector< T >(count); }
}
Alternatively, the following wrapped constructor could be used as it provides near-enough
equivalent functionality:
vector(jint count, const value_type& value);
*** POTENTIAL INCOMPATIBILITY ***
2019-02-25: wsfulton
[Python] Fix compile errors wrapping overloaded functions/constructors where a vararg
function is declared after a non-vararg function.
2019-02-23: zphensley42
Use fully qualified name 'java.lang.Object' instead of 'Object' in generated code to
avoid clashes with wrapped C++ classes called 'Object'.
2019-02-23: gtbX
[Java] #1035 Add (const char *STRING, size_t LENGTH) typemaps in addition to the non-const
typemaps (char *STRING, size_t LENGTH) which does not attempt to write back to the const
string.
2019-02-22: tamuratak
[Ruby] #984 Add support for RTypedData introduced in Ruby 1.9.3.
2019-02-22: ZackerySpytz
#1483 Fix compilation failures when a director class has final methods.
2019-02-21: wsfulton
[Java] #1240 Suppress Java 9 deprecation warnings on finalize method.
2019-02-21: ZackerySpytz
#1480 Fix some rejections of valid floating-point literals.
2019-02-19: wsfulton
#1475 Fix regression parsing gcc preprocessor linemarkers in the form:
# linenum filename flags
2019-02-18: jakecobb
[Python] #945 #1234 Elements in std::vector memory access fix.
Accessing an element in a std::vector obtains a reference to the element via an
iterator pointing to the element in the container. If the vector is garbage collected,
the SWIG wrapper containing the pointer to the element becomes invalid. The fix is
to obtain a back-reference to the container by the wrapper to the element in the Python
layer to prevent the garbage collector from destroying the underlying container.
2019-02-17: wsfulton
Fix typemap matching to expand template parameters when the name contains
template parameters. In the %typemap below the type is T and the name is X<T>::make
and the name now expands correctly to X< int >::make
template<typename T> struct X {
%typemap(out) T X<T>::make "..."
T make();
};
%template(Xint) X<int>;
2019-02-16: wsfulton
Fix parser error containing multiple #define statements inside an enum.
The second #define fails to parse:
enum FooEnum {
ENUM1 = 0,
ENUM2 = 1,
#define MACRO_DEF1 "Hello"
#define MACRO_DEF2 "World!"
ENUM3 = 2,
ENUM4 = 3,
};
Bug mentioned at https://sourceforge.net/p/swig/patches/333/
2019-02-14: wsfulton
Add some missing copy constructors into STL containers.
2019-02-14: bkotzz
[Java] #1356 Add STL containers:
std::unordered_map
std::unordered_set
std::set
2019-02-14: bkotzz
[Java] #1356 std::map wrappers have been modified. Now the Java proxy class
extends java.util.AbstractMap. The std::map container looks and feels much like
a java.util.HashMap from Java.
A few members have changed their names. If the old method signatures are needed,
then copy std_map.i from swig-3.0.12 and use that instead. Alternatively,
add the old missing methods to the new methods by using the following %proxycode:
%extend std::map {
%proxycode %{
// Old API
public boolean empty() {
return isEmpty();
}
public void set($typemap(jboxtype, K) key, $typemap(jboxtype, T) x) {
put(key, x);
}
public void del($typemap(jboxtype, K) key) {
remove(key);
}
public boolean has_key($typemap(jboxtype, K) key) {
return containsKey(key);
}
%}
}
*** POTENTIAL INCOMPATIBILITY ***
2019-02-13: ZackerySpytz
#1469 Add support for C++17 hexadecimal floating literals.
2019-02-11: wsfulton
[OCaml] #1437 OCaml has been give the 'Experimental' language status. The examples work
and most of the test-suite is also working, so it is quite close to being a 'Supported' language.
2019-02-10: ZackerySpytz
#1464 Add support for C++14 binary integer literals.
2019-02-10: ZackerySpytz
#1450 Add support for C++11 UCS-2 and UCS-4 character literals. Also, add support for
C++17 UTF-8 character literals.
2019-02-10: wsfulton
[MzScheme] #1437 MzScheme/Racket is now an 'Experimental' language. The examples work
and a large portion of the test-suite is also working.
2019-02-10: wsfulton
[MzScheme] Destructor wrappers were not being generated.
2019-02-10: wsfulton
[MzScheme] Static variable wrappers fixed - $argnum was not expanded.
2019-02-10: sethrj
#1452 Fix %apply for anonymous template instantiations
2019-02-09: olly
[PHP] Fix access to already released memory during PHP module
shutdown, which often didn't cause visible problems, but could
result in segmentation faults, bus errors, etc. Fixes #1170,
reported by Jitka Plesn�kov�.
2019-02-09: olly
[PHP] A renamed constructor is now wrapped as a static method in
PHP.
2019-02-08: olly
[PHP] Don't generate code which references $r when $r hasn't been
defined. This could happen in overloaded methods which returned
void and took at least one const std::string& parameter.
2019-02-08: olly
[PHP] The generated code is now compatible with PHP 7.3, and the
testsuite now runs cleanly with this version too.
2019-02-05: wsfulton
#1437 SWIG now classifies the status of target languages into either 'Experimental' or
'Supported'. This status is provided to indicate the level of maturity to expect when using
a particular target language as not all target languages are fully developed. Details are
in the Introduction.html chapter of the documentation.
2019-02-04: wsfulton
[CFFI] #1447 Common Lisp CFFI has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Allegrocl] #1447 Allegro Common Lisp has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Chicken] #1447 CHICKEN has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[CLISP] #1447 GNU Common Lisp has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[S-EXP] #1447 Common Lisp S-Exp has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[UFFI] #1447 Common Lisp UFFI has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Pike] #1447 Pike has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Modula3] #1447 Modula3 has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-02: ahnolds
[Python] Documentation enhancements for Python:
#728 Fixed the handling of autodoc when using -fastproxy.
#1367 Added documentation to wrapped member variables using the
property(... doc="...") construct.
Only show a single documentation entry for functions with default arguments when
using autodoc.
Fixed a bug where a cached doxygen docstring could be deleted while still in use,
causing swig to segfault.
2019-01-31: olly
SWIG now requires a target language to be specified instead of
defaulting to wrapping for Tcl. Specifying swig --help without
a target language now just shows the generic help. The -nolang
option has been removed.
2019-01-28: ZackerySpytz
[OCaml] #1429 Remove support for OCaml versions < 3.12.0.
*** POTENTIAL INCOMPATIBILITY ***
2019-01-22: vadz
[Ruby, Octave] #1424 Improve autodoc parameter naming.
2019-01-22: vadz
[Python] #1271 #1423 Always include default parameter values in autodoc strings.
2019-01-19: vadz
#1272, #1421 When a function's parameter is a keyword, the name of the paramater is
no longer simply changed to argN, where N is the argument number. Instead the
parameter name is changed to the renaming rules for keywords that normally apply to
symbols such as classes/functions etc. Note that unlike other symbol renaming,
parameter renaming does not issue a warning when the parameter is renamed. This
change only affects languages where the parameter names are actually used, for example,
Java function parameter lists in the proxy class or Python documentation comments.
2019-01-18: wsfulton
#1420 Fix gdb debugger functions 'swigprint' and 'locswigprint' from swig.gdb to
work with newer versions of gdb-8. Fixes errors when debugging SWIG source with gdb:
(gdb) swigprint n
Undefined command: "Printf". Try "help".
2019-01-16: wsfulton
Python static method wrapper changes
- Static method wrappers were using the 'fastproxy' approach by default.
This is inconsistent with instance method wrappers. The fastproxy approach
is now turned off by default to be consistent with instance methods.
Static method wrappers can now also be controlled using the -fastproxy and
-olddefs options.
Example:
struct Klass {
static int statmethod(int a = 2);
};
generates by default:
class Klass(object):
...
@staticmethod
def statmethod(a=2):
return _example.Klass_statmethod(a)
instead of the following (which can be restored by using -fastproxy):
class Klass(object):
...
statmethod = staticmethod(_example.Klass_statmethod)
- Modernise wrappers for static methods to use decorator syntax - @staticmethod.
- Add missing runtime test for static class methods and using the actual class method.
2019-01-12: ZackerySpytz
[OCaml] #1403 #1194 Fix compilation problems for OCaml >= 4.03.0 due to OCaml using
int64_t instead of int64.
2019-01-11: ZackerySpytz
[OCaml] #1400 Fix the getters and setters of non-static member variables.
2019-01-07: wsfulton
#358 Add VOID to windows.i
2019-01-05: wsfulton
#948 #1019 #1273 Fix for C++11 raw strings where the delimiters were mistakenly left
in the string contents in situations where the string was copied into generated code.
For example, %constant, the "docstring" feature and for C#/Java/D constants turned on
with %javaconst/%csconst/%dmanifestconst.
2019-01-05: wsfulton
[Ruby] #538. Fix Ruby support for %feature("docstring").
2019-01-03: wsfulton
#1202 Fix overloading of non-pointer class types in scripting languages when overloaded
with a pointer and a NULL scripting language equivalent is used, eg None in Python.
The implementation changes the SWIGTYPE, SWIGTYPE& and SWIGTYPE&& typecheck typemaps to
prevent accepting a conversion to a NULL pointer.
2019-01-03: ZackerySpytz
[OCaml] #1386 Fix the OCaml examples and test suite for out-of-source builds.
2019-01-01: wsfulton
[Python] #639 remove duplicate proxy method definitions for global function wrappers.
Global functions previously generated two definitions, eg:
def foo():
return _example.foo()
foo = _example.foo
The first definition is replaced by the second definition and so the second definition
is the one used when the method is actually called. Now just the first definition is
generated by default and if the -fastproxy command line option is used, just the second
definition is generated. The second definition is faster as it avoids the proxy Python
method as it calls the low-level C wrapper directly. Using both -fastproxy and -olddefs
command line options will restore the previously generated code as it will generate both
method definitions.
With this change, the wrappers for global C/C++ functions and C++ class methods now work
in the same way wrt to generating just a proxy method by default and control via
-fastproxy/-olddefs options.
2018-12-20: hasinoff,wsfulton
[Java] #1334 Set Java thread name to native thread name when using directors.
Default is to use name "Thread-XXX" and is still works like this by default. However,
adding the following will turn on the thread name setting (works for more recent
versions of Linux and MacOS):
%begin %{
#define SWIG_JAVA_USE_THREAD_NAME
%}
2018-12-20: chlandsi
[Python] #1357. Fix overriding __new__ in Python 3.6.
Fixes SystemError: Objects/tupleobject.c:81: bad argument to internal function"
2018-12-16: wsfulton
[Python] #848 #1343 The module import logic has changed to stop obfuscating real ImportError
problems. Only one import of the low-level C/C++ module from the pure Python module is
attempted now. Previously a second import of the low-level C/C++ module was attempted
after an ImportError occurred and was done to support 'split modules'. A 'split module' is
a configuration where the pure Python module is a module within a Python package and the
low-level C/C++ module is a global Python module. Now a 'split module' configuration is
no longer supported by default. This configuration can be supported with a simple
customization, such as:
%module(package="mypackage", moduleimport="import $module") foo
or if using -builtin:
%module(package="mypackage", moduleimport="from $module import *") foo
instead of
%module(package="mypackage") foo
See the updated Python chapter titled "Location of modules" in the documentation.
2018-12-11: tlby
[Perl] #1374 repair EXTEND() handling in typemaps
2018-12-06: vadz
#1359 #1364 Add missing nested class destructor wrapper when the nested class is
inside a template. Removes associated bogus 'Illegal destructor name' warning. Only
occurred when the nested class' destructor is explicitly specified.
2018-12-04: adr26
[Python] #1368 #1369 Access Violation in tp_print caused by mismatched Python/extension
CRT usage
Remove all use of tp_print, as this API uses a FILE*, which can be
mismatched when modules are built with different C libraries from
the main python executable.
This change also brings consistent output between Python 2 and 3 for the 'cvar' SWIG
object (that contains the global variables) and SWIG packed objects (such as callback
constants).
2018-12-04: wsfulton
[Python] #1282 Fix running 'python -m' when using 'swig -builtin'
Similar to the earlier PEP 366 conforming fix for non-builtin.
2018-11-29: adr26
[Python] #1360 Leak of SWIG var link object
Fix reference counting on _SWIG_globals to allow var link to be freed on module unload.
2018-11-28: wsfulton
[Python] When using -builtin, the two step C-extension module import is now
one step and the wrapped API is only available once and not in an underlying
module attribute like it is without -builtin. To understand this, consider a
module named 'example' (using: %module example). The C-extension is compiled into
a Python module called '_example' and a pure Python module provides the actual
API from the module called 'example'. It was previously possible to additionally
access the API from the module attribute 'example._example'. The latter was an
implementation detail and is no longer available. It shouldn't have been used, but
if necessary it can be resurrected using the moduleimport attribute described in the
Python chapter of the documentation. If both modules are provided in a Python
package, try:
%module(moduleimport="from . import _example\nfrom ._example import *") example
or more generically:
%module(moduleimport="from . import $module\nfrom .$module import *") example
and if both are provided as global modules, try:
%module(moduleimport="import _example\nfrom _example import *") example
or more generically:
%module(moduleimport="import $module\nfrom $module import *") example
The module import code shown will appear in the example.py file.
2018-11-24: vadz
#1358 Fix handling of abstract base classes nested inside templates
Correct detecting of whether a derived class method overrides a pure virtual
base class method when both classes are nested inside a template class: this
notably didn't work correctly for methods taking parameters of the base class
type.
2018-11-22: rupertnash
[Python] #1282 Make generated module runnable via python -m (PEP 366 conforming)
Previously any SWIG generated modules in a package would fail with an ImportError
when using 'python -m' for example 'python -m mypkg.mymodule'.
This fix also allows the SWIG generated module to be placed into a directory and
then renamed __init__.py to convert the module into a package again. This ability
stopped working in swig-3.0.9. However, only Python 2.7 or 3.3 and later work. If
Python 3.2 support is needed, use moduleimport in %module to customise the import
code.
2018-11-13: wsfulton
#1340 Remove -cppcast and -nocppcast command line options (this was an option
available to the scripting language targets).
The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.
*** POTENTIAL INCOMPATIBILITY ***
2018-11-13: wsfulton
[Python] #1340 Remove -outputtuple and -nooutputtuple command line options.
Both the command line and %module options of the same name have been
removed. These were undocumented. The -outputtuple option returned a
Python tuple instead of a list, mostly typically in the OUTPUT
typemap implementations.
It unclear why a tuple instead of a list return type is needed and
hence this option has been removed as part of the simplification of
the SWIG Python command line options for SWIG 4.
2018-11-13: wsfulton
[Python] #1340 Remove -noproxyimport command line option.
This option turned off the insertion of Python import statements
derived from a %import directive. For example given:
%module module_b
%import "module_a.i"
then module_b.py will contain:
import module_a
*** POTENTIAL INCOMPATIBILITY ***
2018-10-29: AlexanderGabriel
[PHP] The following PHP7 reserved keywords are now only renamed by
SWIG when used as function names in the API being wrapper:
__halt_compiler array die echo empty eval exit include include_once
isset list print require require_once return unset
2018-10-22: olly,wsfulton
[Python] #1261 #1340 Turn on many optimisation options by default and rationalise the
number of command line options.
There were an unnecessary number of command line options and many of these have now
been removed in a drive for simplification. Some were needed to support older versions
of Python (2.6 and earlier).
Many of the options could be turned on individually and when using -O. Previously -O
resulted in turning on a set of options:
-modern -fastdispatch -nosafecstrings -fvirtual -noproxydel
-fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone
Now -O results in turning on this reduced set:
-fastdispatch -fastproxy -fvirtual
The following options are now on by default, a deprecated warning is displayed if they
are used:
-fastinit Class initialisation code done in C/C++ rather than in Python code.
-fastquery Python dictionary used for lookup of types.
-fastunpack Faster unpacking of function arguments in C/C++ wrappers.
-modern Use Python 2.3 features such as object and property.
-modernargs Use Python 2.3 C APIs for unpacking arguments in tuples.
-noproxydel Stop generating a proxy __del__ method for backwards compatiblity.
-safecstrings No discernable difference
The following options have been removed altogether:
-aliasobj0
-buildnone
-classptr
-new_repr
-newrepr
-noaliasobj0
-nobuildnone
-nocastmode
-nodirvtable
-noextranative
-nofastinit
-nofastproxy
-nofastquery
-nomodern
-nomodernargs
-nooutputtuple
-nosafecstrings
-old_repr
-oldrepr
-proxydel
-new_vwm is no longer supported. Use the -newvwm alias instead.
*** POTENTIAL INCOMPATIBILITY ***
2018-10-22: olly
[Python] #1261 Remove command line option no longer needed as Python 2.3 and earlier
are no longer supported:
-classic
2018-10-09: wsfulton
[D, Go, Guile, Lua, Mzscheme, Ocaml, Perl5, Php, Scilab, Tcl]
Allow wrapping of std::map using non-default comparison function.
2018-10-09: vadz
[Java] #1274 Allow wrapping of std::map using non-default comparison function.
2018-10-04: wsfulton
[Python] #1126 Fix C default arguments with -builtin and -fastunpack and -modernargs.
Problem occurred when there is just one (defaulted) parameter in the parameter list.
2018-09-24: wsfulton
[Python] #1319 C++11 hash tables implementation is finished now (including for -builtin):
std::unordered_map
std::unordered_set
std::unordered_multimap
std::unordered_multiset
2018-09-21: wsfulton
[Python] Fix when using -builtin and wrapping std::map, std::set, std::unordered_map or
std::unordered_set to ensure __contains__ is called. This is a wrapper for the STL
container's find method. Without it, Python will do its own slower sequence search.
2018-09-19: wsfulton
[Python] Fix functors (wrapped as __call__) when using -builtin -modern -fastunpack.
2018-09-02: andreas.gaeer,tkrasnukha
[Python] #1321 Fix assert in PyTuple_GET_SIZE in debug interpreter builds of python-3.7
when calling tp_new.
2018-09-01: ChristopherHogan
[Guile] #1288 Fix garbage collection for guile >= 2.0.12.
2018-08-31: wsfulton
[Python] #1319 C++11 hash tables support:
std::unordered_map
std::unordered_set
std::unordered_multimap
std::unordered_multiset
is now compiling and working (sorting using -builtin not fully functional yet though).
2018-08-20: wkalinin
#1305 Fix nested structure symbol tables in C mode to fix member name conflicts
in different structs with the same nested struct member name.
2018-08-18: wsfulton
[Python] #688 Fix makefile recursion when running python test-suite.
2018-08-18: wsfulton
[Python] #1310 Re-implement Python -fastproxy option.
The previous implementation failed with Python 3 and abstract base clases.
The new implementation replaces the Python 2 implementation using
new.instancemethod with the C API PyMethod_New to match the equivalent Python 3
implementation which uses PyInstanceMethod_New.
The new approach runs slightly faster. See #1310.
2018-08-12: gmazzamuto
[Python] #1283 Update pybuffer.i library to use new-style Python buffer C API.
2018-08-12: brianhatwood,wsfulton
[Java] #1303 #1304 Fix crash in directors when using OUTPUT and INOUT typemaps in typemaps.i and
passing NULL pointers in C++ to director method overloaded and implemented in Java.
2018-08-10: wsfulton
[Python] #1293 Improve TypeError message inconsistencies between default and fastdispatch
mode when handling overloaded C++ functions. Previously the error message did not always
display the possible C/C++ prototypes in fastdispatch mode.
2018-08-02: furylynx,jacobwgillespie,p2k
[Javascript] #1290, #968. Add support for NodeJS versions 2-10.
2018-07-31: wsfulton
[Python] #1293 Overloaded C++ function wrappers now raise a TypeError instead
of NotImplementedError when the types passed are incorrect. This change means
there is now consistency with non-overloaded function wrappers which have always
raised TypeError when the incorrect types are passed. The error message remains
the same and is for example now:
TypeError: Wrong number or type of arguments for overloaded function 'f'.
Possible C/C++ prototypes are:
f(int)
f(char const *)
instead of:
NotImplementedError: Wrong number or type of arguments for overloaded function 'f'.
Possible C/C++ prototypes are:
f(int)
f(char const *)
*** POTENTIAL INCOMPATIBILITY ***
2018-06-23: wsfulton
[Python] #718 Fix pythonnondynamic feature for modern classes
Fixes nondynamic mode when an instance variable is set with the same
name as a class variable in a class derived from a SWIG proxy class.
This corner case set an instance variable instead of raising an AttributeError.
Also fix %pythonnondynamic in Python 3 with -modern. The metaclass
containing the implementation was previously not being applied in Python 3.
2018-07-17: petrmitrichev,wsfulton
[Python] #1275 #1279 Initialize function-local statics (singletons) that call Python
code during Python module initialization in order to avoid deadlocks with subsequent
multi-threaded usage.
2018-06-15: wsfulton
[Python] Fix seg fault using Python 2 when passing a Python string, containing
invalid utf-8 content, to a wstring or wchar * parameter. A TypeError is thrown instead, eg:
%include <std_wstring.i>
void instring(const std::wstring& s);
instring(b"h\xe9llooo") # Python
2018-06-15: wsfulton
[Python] Python 3.7 support: Replace use of deprecated PyUnicode_GetSize with
PyUnicode_GetLength to remove deprecated warnings compiling the C/C++ wrappers.
2018-06-12: wsfulton
[Python] Python 3.7 support: The %pythonabc feature in pyabc.i now uses base classes
collections.abc.MutableSequence
collections.abc.MutableMapping
collections.abc.MutableSet
instead of
collections.MutableSequence
collections.MutableMapping
collections.MutableSet
as the latter are deprecated in Python 3.7 and are due to be removed in Python 3.8.
The classes in collections.abc.* are available from Python 3.3 onwards. If you
require support for Python 3.2, then copy the pyabc.i file and modify by removing
the few instances of the .abc sub-module.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-12: olly,wsfulton
[Python] #701 Remove support for Python versions < 2.7 and 3.0 and 3.1.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-11: olly
[Python] Fix new GCC8 warnings in generated code by avoiding casts
between incompatible function types where possible, and by
suppressing the warning when it's due to the design of Python's C
API. Fixes #1259.
2018-06-08: philippkraft
[Python] Stop exposing <CLASS>_swigregister to Python. It's not
useful for user Python code to call this, and it just clutters the
API unnecessarily. Fixes #1225.
2018-06-07: cmfoil, kabbi, Jamie Kirkpatrick, markok314, vadz, wsfulton, Yann Diorcet
#170 Doxygen documentation support added. This allows translation of Doxygen comments
into JavaDoc and PyDoc documentation. It is enabled via the -doxygen command line
option. See the Doxygen.html chapter in the documentation for further information.
2018-06-07: olly
[PHP] We've finally removed support for %pragma(php4) which was
deprecated back in 2008. Use %pragma(php) instead, which has been
supported since at least 2005.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-07: olly
[PHP5] Support for PHP5 has been removed. PHP5 is no longer
actively supported by the PHP developers and security support for
it ends completely at the end of 2018, so it doesn't make sense
to include support for it in the upcoming SWIG 4.0.0 release.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-06: olly
[Lua] Improve configure probes for Lua headers and libs used in testsuite.
2018-05-15: kwwette
[Octave] add support for version 4.4
- Should not introduce any user-visible incompatibilities
2018-05-15: wsfulton
[C#, D, Java] Fix lookup of csconstruct, dconstruct and javaconstruct typemaps.
The C++ namespace was previously ignored when looking up the typemap.
2018-05-15: wsfulton
[Javascript] Fix generated C++ code when using %nspace on namespaces that are more
than two levels deep.
2018-05-14: wsfulton
Issue #1251 Add support for C++17 nested namespace definitions,
for example:
namespace A::B { ... }
2018-05-11: wsfulton
[C#, D, Java] Add support so that the %csmethodmodifiers, %dmethodmodifiers,
%javamethodmodifiers can modify the method modifiers for the destructor wrappers
in the proxy class: dispose, Dispose, delete. With this feature, it is now possible
to make a C# proxy class sealed, eg when wrapping a class X, the virtual method modifiers
can be removed using:
%typemap(csclassmodifiers) X "public sealed class"
%csmethodmodifiers X::~X "public /*virtual*/";
2018-04-18: olly
[Python] Suppress new pycodestyle warning:
E252 missing whitespace around parameter equals
2018-04-07: goatshriek
[Ruby] #1213 Fix ruby %alias directive for global C/C++ functions.
2018-04-03: olly
[Ruby] Fix to pass Qnil instead of NULL to rb_funcall(), which silences GCC
-Wconversion-null warning (on by default with recent GCC).
2018-03-09: wsfulton
[Java] #1184 Fix swigReleaseOwnership() and swigTakeOwnership() regression
for non-director classes. Restores a dynamic_cast which was previously removed.
2018-03-07: llongi
Github PR #1166 - Fix preprocessor handling of macros with commas
in a // comment.
2018-02-18: JPEWdev
Patch #1164 - Add support for a command-line options file, also sometimes
called a response file. This is useful if the command-line options exceed
the system command-line length limit. To use, put the command-line options
into a file, then provide the file name prefixed with @, for example using
a file called args.txt:
swig @args.txt
2018-02-11: wsfulton
[Javascript] #1187 Fix compilation error wrapping std::complex via
std_complex.i.
2018-01-30: smarchetto
[Scilab] add type name argument in SWIG_ptr() function to cast from pointer address to typed pointers
2018-01-16: wsfulton
Expressions following a preprocessor directive must now be separated by whitespace
or non-numeric characters. This syntax change makes the SWIG preprocessor work like
the C preprocessor in this area.
For example, the following code used be accepted as valid syntax:
#if1
#define ABC 123
#endif
Now you get an error:
example.h:1: Error: Unknown SWIG preprocessor directive: if1 (if this is a block of
target language code, delimit it with %{ and %})
example.h:3: Error: Extraneous #endif.
The following is the correct syntax:
#if 1
#define ABC 123
#endif
The following of course also works:
#if(1)
#define ABC 123
#endif
*** POTENTIAL INCOMPATIBILITY ***
2018-01-15: wsfulton
Fix issue #1183. Floating point exception evaluating preprocessor expressions
resulting in division by zero.
2018-01-14: wsfulton
Fix issue #1172. Seg fault parsing invalid exponents in the preprocessor.
2018-01-12: Liryna
[C#] Patch #1128. Add ToArray function to std::vector wrappers.
2018-01-12: wsfulton
[Java] Fix issue #1156. Add missing throws clause for interfaces when using the
%interface family of macros.
2018-01-05: wsfulton
Fix default arguments using expressions containing -> syntax error. Problem reported on
swig-user mailing list.
2017-12-30: wsfulton
[Python] Replace pep8 with pycodestyle for checking the Python code style when
running Python tests.
2017-12-30: davedissian
Fixed a symbol lookup issue when encountering a typedef of a symbol from the tag
namespace to the global namespace when the names are identical, such as 'typedef
struct Foo Foo;'.
2017-12-13: wsfulton
[Perl] add missing support for directorfree typemaps.
2017-12-13: wsfulton
Issue #1167 Fix directorout typemaps which were causing undefined behaviour when
returning pointers by reference.
2017-12-08: olly
[PHP] Use ZEND_MODULE_GLOBALS_ACCESSOR to access globals so the
generated code builds when PHP was built with ZTS enabled.
2017-12-04: wsfulton
[Python] Add missing checks for failures in calls to PyUnicode_AsUTF8String. Previously a
seg fault could occur when passing invalid UTF8 strings (low surrogates), eg passing
u"\udcff" to the C layer (Python 3).
2017-11-24: joequant
[R] Fix #1124 and return R_NilValue for null pointers
2017-11-29: wsfulton
[Java] director exception handling improvements.
When a director method throws an exception and it is caught by DirectorException
and passed back to Java using Swig::DirectorException::throwException, the Java
stack trace now contains the original source line that threw the exception.
Deprecate Swig::DirectorException::raiseJavaException, please replace usage with
Swig::DirectorException::throwException.
*** POTENTIAL INCOMPATIBILITY ***
2017-10-26: wsfulton
Add support for C++11 ref-qualifiers when using directors.
2017-10-26: wsfulton
Fix generated code when using directors and methods returning const ref pointers.
2017-10-26: wsfulton
[C#, D, Java, Octave, R, Scilab] Port director typemaps to these additional languages.
Issue #700.
2017-10-26: radarsat1
[Ruby Python] Patch #1029 - Correct handling of null using directors and shared_ptr.
2017-10-10: joequant
[R] pass enum expressions to R. This will generate
incorrect files when there is an arithmetic expression
in the enum, but this is better than silently generating
incorrect code
2017-10-09: olly
[PHP] Fix incorrect wrapper code generated when there's a
combination of overloading, parameters with a default value
and %newobject. Fixes https://sourceforge.net/p/swig/bugs/1350/
2017-10-09: olly
Remove GCJ support. It isn't in a good state and doesn't seem to
be used, and GCC7 dropped GCJ. Closes
https://sourceforge.net/p/swig/bugs/823/
2017-10-07: olly
Fix preprocessor handling of empty macro arguments to match that of
C/C++ compilers. Fixes issue #1111 and
https://sourceforge.net/p/swig/bugs/826/
2017-10-06: wsfulton
[Python] Issue #1108. Fix platform inconsistency in Python default argument handling.
32 bit and 64 bit compiled versions of SWIG generated different Python files
when default arguments were outside the range of 32 bit signed integers.
The default arguments specified in Python are now only those that are in the
range of a 32 bit signed integer, otherwise the default is obtained from C/C++ code.
2017-10-02: wsfulton
[C#] Fix std::complex types passed by value.
2017-10-02: wsfulton
[Javascript, Python, Ruby] Issue #732 - Missing type information for std::complex
in std_complex.i meant that previously std::complex always had to be fully qualified
in order to be wrapped with the appropriate typemaps.
2017-10-01: joequant
allow R package names with docs
allowing multiple get accessors in R
fix smart-pointer and NAMESPACE support
constructors now returning smart pointers (if class
declared as such)
smart-pointer classes deriving from parent smart-pointers
2017-09-29: wsfulton
Issue #1100 - Allow an instantiated template to have the same name in the target
language as the C++ template name, for example, this is now possible:
template<typename T> struct X { ... };
%template(X) X<int>;
2017-09-23: wsfulton
Issue #1098. Fix overloading of shared_ptr with underlying pointer types, eg:
void m(std::shared_ptr<T> p);
void m(T &p);
void m(T *p);
Only the first method is wrapped and the others are ignored/shadowed.
The implementation is done via a new attribute in the 'typecheck' typemap called
'equivalent'. If specified, it must contain the equivalent pointer type for overloading
and can only be used for the special SWIG_TYPECHECK_POINTER precedence level.
The shared_ptr 'typecheck' typemaps have been modified accordingly.
Here is a simplified version:
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="T *")
T,
T CONST &,
T CONST *,
T *CONST&,
std::shared_ptr< T >,
std::shared_ptr< T > &,
std::shared_ptr< T > *,
std::shared_ptr< T > *&
{ ... }
Overloading with any of these types will result in SWIG ignoring all but the first
overloaded method by default. Without the 'equivalent' attribute, wrapping the overloaded
methods resulted in types being shadowed (scripting languages) or code that did not
compile (statically typed languages).
2017-09-19: futatuki
[Python] #1003 Add --with-2to3=/path/to/2to3 option to configure.
2017-09-18: wsfulton
Fix type promotion wrapping constant expressions of the form:
# define EXPR_MIXED1 (0x80 + 11.1) - 1
This was previously an integral type instead of a floating point type.
2017-09-17: wsfulton
Fix generated code for constant expressions containing wchar_t L literals such as:
# define __WCHAR_MAX (0x7fffffff + L'\0')
# define __WCHAR_MIN (-__WCHAR_MAX - 1)
2017-09-10: mlamarre
[Python] Patch #1083. Define_DEBUG to 1 to do exactly like Visual Studio
/LDd, /MDd or /MTd compiler options.
2017-08-25: wsfulton
Issue #1059. Add support for C++11 ref-qualifiers on non-static member functions.
Members with lvalue ref-qualifiers such as:
struct RQ {
void m1(int x) &;
void m2(int x) const &;
};
are wrapped like any other member function. Member functions with rvalue ref-qualifiers
are ignored by default, such as:
struct RQ {
void m3(int x) &&;
void m4(int x) const &&;
};
example.i:7: Warning 405: Method with rvalue ref-qualifier m3(int) && ignored.
example.i:8: Warning 405: Method with rvalue ref-qualifier m4(int) const && ignored.
These can be unignored and exposed to the target language, see further documentation in
CPlusPlus11.html.
2017-08-16: wsfulton
Fix #1063. Add using declarations to templates into typedef table.
Using declarations to templates were missing in SWIG's internal typedef tables.
This led to a few problems, such as, templates that did not instantiate and generated
C++ code that did not compile as SWIG did not know what scope the template was
in. This happened mostly when a using declaration was used on a template type in a
completely unrelated namespace.
2017-08-16: wsfulton
Fix type lookup in the presence of using directives and using declarations.
Fix some cases of type lookup failure via a combination of both using directives and
using declarations resulting in C++ code that did not compile as the generated type was
not fully qualified for use in the global namespace. Example below:
namespace Space5 {
namespace SubSpace5 {
namespace SubSubSpace5 {
struct F {};
}
}
using namespace SubSpace5;
using SubSubSpace5::F;
void func(SubSubSpace5::F f);
}
2017-08-16: wsfulton
Issue #1051. %template scope enforcement and class definition fixes.
The scoping rules around %template have been specified and enforced.
The %template directive for a class template is the equivalent to an
explicit instantiation of a C++ class template. The scope for a valid
%template instantiation is now the same as the scope required for a
valid explicit instantiation of a C++ template. A definition of the
template for the explicit instantiation must be in scope where the
instantiation is declared and must not be enclosed within a different
namespace.
For example, a few %template and C++ explicit instantiations of std::vector
are shown below:
// valid
namespace std {
%template(vin) vector<int>;
template class vector<int>;
}
// valid
using namespace std;
%template(vin) vector<int>;
template class vector<int>;
// valid
using std::vector;
%template(vin) vector<int>;
template class vector<int>;
// ill-formed
namespace unrelated {
using std::vector;
%template(vin) vector<int>;
template class vector<int>;
}
// ill-formed
namespace unrelated {
using namespace std;
%template(vin) vector<int>;
template class vector<int>;
}
// ill-formed
namespace unrelated {
namespace std {
%template(vin) vector<int>;
template class vector<int>;
}
}
// ill-formed
namespace unrelated {
%template(vin) std::vector<int>;
template class std::vector<int>;
}
When the scope is incorrect, an error now occurs such as:
cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and
was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
Previously SWIG accepted the ill-formed examples above but this led to
numerous subtle template scope problems especially in the presence of
using declarations and using directives as well as with %feature and %typemap.
Actually, a valid instantiation is one which conforms to the C++03
standard as C++11 made a change to disallow using declarations and
using directives to find a template.
// valid C++03, ill-formed C++11
using std::vector;
template class vector<int>;
Similar fixes for defining classes using forward class references have
also been put in place. For example:
namespace Space1 {
struct A;
}
namespace Space2 {
struct Space1::A {
void x();
}
}
will now error out with:
cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and
was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
Previously some symbols would have been instantiated in the wrong scope and led
to lots of scope problems involving SWIG typemaps, features, renames etc.
You will need to correct the scope used in other SWIG directives which do not
support 'using declarations' and 'using directives'. For example, if you previously had:
%rename(Zap) vector<int>::clear;
using namespace std;
%template(VectorInt) vector<int>;
Prior versions of SWIG incorrectly instantiated vector<int> in the global namespace
and so the %rename matched. Now the template is instantiated in the correct namespace,
so is fully qualified as std::vector<int>. The other SWIG directives need correcting as
they do not follow 'using declarations' and 'using directives'. Change it to:
%rename(Zap) std::vector<int>::clear;
using namespace std;
%template(vin) vector<int>;
*** POTENTIAL INCOMPATIBILITY ***
2017-08-16: wsfulton
Fix scope lookup for template parameters containing unary scope operators.
Fixes cases like:
namespace Alloc {
template<typename T> struct Rebind {
typedef int Integer;
};
}
%template(RebindBucket) Alloc::Rebind< Bucket >;
OR
%template(RebindBucket) Alloc::Rebind< ::Bucket >;
Alloc::Rebind< Bucket >::Integer Bucket1();
Alloc::Rebind< ::Bucket >::Integer Bucket2();
Alloc::Rebind<::template TemplateBucket<double>>::Integer Bucket3();
2017-08-16: wsfulton
For templates only, the template parameters are fully resolved when
handling typemaps. Without this, it is too hard to have decent rules
to apply typemaps when parameter types are typedef'd and template
parameters have default values.
Fixes %clear for typedefs in templates, eg:
%typemap("in") XXX<int>::Long "..."
template typename<T> struct XXX {
typedef long Long;
};
%clear XXX<int>::Long;
as the typemap was previously incorrectly stored as a typemap for long
instead of XXX<int>::Long.
2017-08-05: olly
[C++11] Allow static_assert at the top level (and disallow it right
after template<T>). Fixes issue 1031 reported by Artem V L.
2017-08-02: wsfulton
Fix incorrectly shown warning when an empty template instantiation was used on a
class used as a base class and that base class was explicitly ignored with %ignore.
Example of the warning which will no longer appear:
Warning 401: Base class 'Functor< int,int >' has no name as it is an empty
template instantiated with '%template()'. Ignored.
2017-07-17: fflexo
[Java] #674 Add std_list.i to add support for std::list containers. The Java proxy
extends java.util.AbstractSequentialList and makes the C++ std::list container look
and feel much like a java.util.LinkedList from Java.
2017-07-07: wsfulton
[Python] Fix display of documented template types when using the autodoc
feature. For example when wrapping:
%feature("autodoc");
template<typename X> struct T {};
%template(TInteger) T<int>;
the generated documentation contains:
"""Proxy of C++ T< int > class."""
instead of:
"""Proxy of C++ T<(int)> class."""
and
"""__init__(TInteger self) -> TInteger"""
instead of
"""__init__(T<(int)> self) -> TInteger"""
2017-06-27: nihaln
[PHP] Update the OUTPUT Typemap to add return statement to the
PHP Wrapper.
2017-06-27: nihaln
[PHP] Update the enum and value examples to use the OO wrappers
rather than the flat functions produced with -noproxy. There's
not been a good reason to use -noproxy for since PHP5 OO wrapping
was fixed back in 2005.
2017-06-23: m7thon
[Python] fix and improve default argument handling:
1. Fix negative octals. Currently not handled correctly by `-py3`
(unusual case, but incorrect).
2. Fix arguments of type "octal + something" (e.g. `0640 | 04`).
Currently drops everything after the first octal. Nasty!
3. Fix bool arguments "0 + something" (e.g. `0 | 1`) are always
"False" (unusual case, but incorrect).
4. Remove special handling of "TRUE" and "FALSE" from
`convertValue` since there's no reason these have to match
"true" and "false".
5. Remove the Python 2 vs. Python 3 distinction based on the
`-py3` flag. Now the same python code is produced for default
arguments for Python 2 and Python 3. For this, octal default
arguments, e.g. 0644, are now wrapped as `int('644', 8)`. This
is required, as Python 2 and Python 3 have incompatible syntax
for octal literals.
Fixes #707
2017-06-21: futatuki
#1004 - Fix ccache-swig executable name to respect configure's --program-prefix and
--program-suffix values if used.
2017-06-21: tamuratak
[Ruby] #911 - Add std::wstring support.
2017-06-19: wsfulton
[Python] Fix handling of rich comparisons when wrapping overloaded operators:
operator< operator<= operator> operator>= operator== operator!=
Previously a TypeError was always thrown if the type was not correct. NotImplemented
is now returned from these wrapped functions if the type being compared with is
not correct. The subsequent behaviour varies between different versions of Python
and the comparison function being used, but is now consistent with normal Python
behaviour. For example, for the first 4 operator overloads above, a TypeError
'unorderable types' is thrown in Python 3, but Python 2 will return True or False.
NotImplemented should be returned when the comparison cannot be done, see PEP 207 and
https://docs.python.org/3/library/constants.html#NotImplemented
Note that the bug was only present when overloaded operators did not also have a
function overload.
Fixes SF bug #1208 (3441262) and SF patch #303.
*** POTENTIAL INCOMPATIBILITY ***
2017-06-17: fabrice102
[Go] Fix Go callback example. Fixes github #600, #955, #1000.
2017-06-16: wsfulton
Make sure warning and error messages are not split up by other processes writing to
stdout at the same time.
2017-06-16: wsfulton
[R] Fix wrapping function pointers containing rvalue and lvalue reference parameters.
2017-06-13: olly
[Perl] Fix testsuite to work without . in @INC - it was removed in
Perl 5.26 for security reasons, and has also been removed from
older versions in some distros. Fixes #997 reported by lfam.
2017-06-03: wsfulton
Fix %import on a file containing a file scope %fragment forced inclusion to not
generate the fragment contents as %import should not result in code being generated.
The behaviour is now the same as importing code insertion blocks.
Wrapping FileC.i in the following example will result in no generated code, whereas
previously "#include <limits.h>" was generated:
// FileA.i
%fragment("<limits.h>", "header") %{
#include <limits.h>
%}
%{
#include <stdio.h>
%}
%fragment("<limits.h>");
// FileC.i
%import "FileA.i"
*** POTENTIAL INCOMPATIBILITY ***
2017-05-26: Volker Diels-Grabsch, vadz
[Java] #842 Extend from java.util.AbstractList<> and implement java.util.RandomAccess for
std::vector wrappers. This notably allows to iterate over wrapped vectors in a natural way.
Note that boxed types are now used in the Java layer when wrapping vector of C primitive
types, for example. This may introduce some subtle incompatibilities due to some
differences in how Java converts boxed types and unboxed types. For example,
int i=0;
double d1 = i; // ok
Double d2 = i; // error: incompatible types: int cannot be converted to Double
This can be a problem when calling the add and set functions. A suggested backwards
compatible workaround is to use something like (shown for std::vector<double>:
#if defined(SWIGJAVA)
// Add in old api that uses non-boxed types
%extend std::vector<double> {
%proxycode %{
public void add(double x) {
add(Double.valueOf(x));
}
public void set(int i, double val) {
set(i, Double.valueOf(val));
}
%}
}
#endif
%include "std_vector.i"
%template(VectorDouble) std::vector<double>;
*** POTENTIAL INCOMPATIBILITY ***
2017-05-30: davidcl
[Scilab] #994 Undefined symbol error when loading in Scilab 6
2017-05-25: asibross
[Java] #370 #417 Missing smart pointer handling in Java director extra methods
swigReleaseOwnership() and swigTakeOwnership().
2017-05-23: wsfulton
[Java] #230 #759 Fix Java shared_ptr and directors for derived classes java compilation
error.
For shared_ptr proxy proxy classes, add a protected method swigSetCMemOwn for modifying
the swigCMemOwn and swigCMemOwnDerived member variables which are used by various other
methods for controlling memory ownership.
2017-05-21: Sghirate
[Java, C#, D] #449 Remove unnecessary use of dynamic_cast in directors to enable
non-RTTI compilation.
2017-05-21: wsfulton
[Python] #993 Fix handling of default -ve unsigned values, such as:
void f(unsigned = -1U);
2017-05-20: jschueller
[Python] #991 Fix E731 PEP8 warning: do not assign a lambda expression
2017-05-16: nihal95
[PHP] Add %pragma version directive to allow the version of the
extension to be set. Patch #970, fixes #360.
2017-05-13: yag00
Patch #975 - Add support for noexcept on director methods.
2017-04-27: redbrain
Issue #974, Patch #976 - Fix preprocessor handling of macros with commas in a comment.
2017-04-25: jleveque
[Lua] #959 - Fix Visual Studio C4244 conversion warnings in Lua wrappers.
2017-04-21: tamuratak
[Ruby] #964 - Add shared_ptr director typemaps.
2017-04-20: wsfulton
[Ruby] #586, #935 Add assert for invalid NULL type parameter when calling SWIG_Ruby_NewPointerObj.
2017-04-20: tamuratak
[Ruby] #930, #937 - Fix containers of std::shared_ptr.
Upcasting, const types (eg vector<shared_ptr<const T>>) and NULL/nullptr support added.
2017-04-12: smarchetto
[Scilab] New parameter targetversion to specify the Scilab target version (5, 6, ..) for code generation
With Scilab 6 target specified, identifier names truncation is disabled (no longer necessary)
2017-03-24: tamuratak
[Ruby] Fix #939 - Wrapping std::vector<bool> fix due to incorrect null checks
on VALUE obj.
2017-03-17: vadz
[C#] #947 Add support for std::complex<T>
2017-03-17: wsfulton
[Go] Fix handling of typedef'd function pointers and typedef'd member function pointers
such as:
typedef int (*FnPtr_td)(int, int);
int do_op(int x, int y, FnPtr_td op);
2017-03-16: wsfulton
Add support for member const function pointers such as:
int fn(short (Funcs::* parm)(bool)) const;
Also fix parsing of references/pointers and qualifiers to member
pointers such as:
int fn(short (Funcs::* const parm)(bool));
int fn(short (Funcs::* & parm)(bool));
2017-03-10: wsfulton
Extend C++11 alternate function syntax parsing to support const and noexcept, such as:
auto sum1(int x, int y) const -> int { return x + y; }
auto sum2(int x, int y) noexcept -> int { return x + y; }
2017-02-29: tamuratak
[Ruby] #917 - Add Enumerable module to all container class wrappers. It was missing
for std::list, std::multiset, std::unordered_multiset and std::unordered_map.
2017-02-27: assambar
[C++11] Extend parser to support throw specifier in combination
with override and/or final.
2017-02-10: tamuratak
[Ruby] #883 - Add support for C++11 hash tables:
std::unordered_map
std::unordered_set
std::unordered_multimap
std::unordered_multiset
2017-02-08: jcsharp
[C#] #887 Improve std::vector<T> wrapper constructors -
Replace constructor taking ICollection with IEnumerable and also add IEnumerable<T>
constructor to avoid the boxing and unboxing overhead of the original constructor,
when the type parameter is a value type.
Version 3.0.12 (27 Jan 2017)
============================
2017-01-27: wsfulton
[C#] #882 Fix missing filename in error messages when there is a problem
writing out C# files.
2017-01-27: briancaine
[Guile] #744 Fix compilation errors in Guile wrappers - regression
introduced in swig-3.0.11.
2017-01-24: andrey-starodubtsev
[Java] Apply #704 - director typemap improvements.
Memory leak fixes, add support for "directorargout" typemap and
add director support to typemaps.i.
2017-01-24: wsfulton
Enhance %extend to extend a class with template constructors, eg:
struct Foo {
%extend {
template<typename T>
Foo(int a, T b) {
...
}
}
};
%template(Foo) Foo::Foo<double>;
2017-01-22: wsfulton
Issue #876 Enhance %extend to extend a class with template methods, eg:
struct Foo {
%extend {
template<typename T>
void do_stuff(int a, T b) {
...
}
}
};
%template(do_stuff_inst) Foo::do_stuff<double>;
Similarly for static template methods.
2017-01-22: kwwette
[Octave] add support for version 4.2
- The Octave API now uses some C++11 features. It is recommended to use
the mkoctfile program supplied by Octave to compile the SWIG-generated
wrapper code, as mkoctfile will ensure the correct C++ compiler/options
are used. Otherwise, the value of `mkoctfile -p CXX` should be parsed
for any -std=* flags which might be present.
- Octave has dropped support for << and >> operators, so SWIG now
ignores them.
- The Octave error() function now raises C++ exceptions to propagate
Octave errors, so %exception directives may need to be modified.
For convenience the SWIG_RETHROW_OCTAVE_EXCEPTIONS macro can be used
to rethrow any Octave exceptions for Octave itself to handle, e.g.:
try {
$action // may call error()
}
SWIG_RETHROW_OCTAVE_EXCEPTIONS // error() exceptions are rethrown
catch(...) {
... // all other exceptions
}
*** POTENTIAL INCOMPATIBILITY ***
2017-01-16: wkalinin
[C#] Fix #733 regression introduced in swig-3.0.9.
Missing virtual function override in C# layer when using %import.
2017-01-16: fschlimb
Fix #813 template symbol name lookup bug when typedef names are the same but in different
namespaces.
2017-01-15: wsfulton
[C# D Java]
The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
completely freeing them up for users to use without having to replicate the library
code that they previously added. The code previously generated by these typemaps
has been replaced by the new %proxycode directive. Their use in the library code
was fairly minimal:
C# cstype: std_array.i std_map.i std_vector.i
D dtype: std_vector.i
Java javatype: arrays_java.i
2017-01-14: wsfulton
The %extend directive can now optionally support one of the 'class', 'struct' or 'union'
keywords before the identifier name, for example:
struct X { ... };
%extend struct X { ... }
Previously this had to specified as:
struct X { ... };
%extend X { ... }
2017-01-13: wsfulton
[C# D Java] Add new %proxycode directive which is a macro for %insert("proxycode").
This is a way of adding pure C#/D/Java code into the appropriate proxy class, eg:
%extend Proxy2 {
%proxycode %{
public int proxycode2(int i) {
return i+2;
}
%}
}
%inline %{
struct Proxy2 {};
%}
There will then be a pure Java/C#/D method called proxycode2 in the Proxy2 class.
2016-12-31: ajrheading1
Issue #860 - Remove use of std::unary_function and std::binary_function
which is deprecated in C++11.
2016-12-30: olly
[PHP7] Register internal 'swig_runtime_data_type_pointer' constant
as "CONST_PERSISTENT" to avoid segmentation fault on module unload.
Fixes #859 reported by Timotheus Pokorra. Thanks also to Javier Torres
for a minimal reproducer.
Version 3.0.11 (29 Dec 2016)
============================
2016-12-24: wsfulton
[C#] Add %feature("csdirectordelegatemodifiers") to enable customization
of the delegate access modifiers generated in director classes.
Fixes issue #748.
2016-12-23: wsfulton
[Python] Fix builtin "python:slot" feature failing for tp_hash when using
hashfunc closure with a "Wrong type for hash function" for Python 2.
Issue #843.
2016-12-21: joequamt
Changed generation of functions so that only functions
that end in _set generate accessor functions rather than
looking for "set".
Change generation of operators to not have underscores
to start in R. Users need to provide custom names for these operator overloads.
2016-12-21: olly
Fix isfinite() checks to work with all C++11 compilers.
Fixes issues #615, #788 and #849.
2016-12-20: wsfulton
%namewarn unnecessarily caused keyword warnings for non-instantiated template classes
and duplicate warnings for instantiated template classes when keywords were used.
Issue #845.
2016-12-18: ezralanglois
[Python, Ruby, Octave] Memory leak fix on error in std::pair wrappers.
Issue #851.
2016-12-18: wsfulton
Zero initialize arrays when using %array_class and %array_functions.
2016-12-18: t-ikegami
[Python] Fix #446
Python %array_class of carrays.i failed with -builtin option.
2016-12-16: briancaine
[Guile] Patch #744 Added support for Guile's native pointer functionality
2016-12-01: wsfulton
[Python] Issue #769.
Add optional moduleimport attribute to %module so that the
default module import code can be overridden. See the "Searching for the wrapper module"
documentation in Python.html. Example:
%module(moduleimport="import _foo") foo
$module also expands to the low-level C/C++ module name, so the following is the
same as above
%module(moduleimport="import $module") foo
2016-11-30: olly
[PHP] Add support for PHP7. PHP5's C extension API has changed
substantially so you need to use -php7 to specify you want PHP7
compatible wrappers. The default extension for generated wrappers
is now .cxx (to match SWIG's default for every other language - to
generate foo_wrap.cpp you can run SWIG with -cppext cpp). Fixes
issue #571.
As part of this change, the language subdirectory for PHP5 has
changed from "php" to "php5" - if you are making use of the search
path feature where the language subdirectory of each directory
is also searched, you'll need to update your bindings. A simple
fix which works for older and newer SWIG is to add a symlink:
ln -s php php5
*** POTENTIAL INCOMPATIBILITY ***
2016-11-30: olly
[PHP] Only emit one copy of each distinct arginfo. Previously we
emitted a separate one for every wrapped function, but typically
many functions have the same number of parameters and combinations
of parameters passed by reference or not.
This change significantly reduces both the size of the generated
wrapper, and of the compiled PHP extension module (e.g. by ~6% for
the stripped extension module for Xapian's PHP7 bindings).
2016-11-28: wsfulton
Fix %rename override of wildcard %rename for templates. For example:
%rename(GlobalIntOperator) *::operator bool; // wildcard %rename
%rename(XIntOperator) X::operator bool; // fix now overrides first %rename above
OR
%rename(XIntOperator) X<int>::operator bool; // fix now overrides first %rename above
template<typename T> struct X {
operator bool();
...
};
%template(Xint) X<int>;
This also fixes %rename override of global %rename for templates. For example:
// Global rename to make all functions start with a lower case letter
%rename("%(firstlowercase)s", %$isfunction ) "";
%rename(woohoo) W::Woo; // fix now overrides above %rename
template<typename T> struct W {
W Woo();
...
};
%template(Wint) W<int>;
The above also introduces a possibly unexpected change. Many of the STL containers
provided by SWIG use %rename to rename some methods, eg in std::vector, push_back
is renamed to add in Java. Previously this intended rename did not happen when using
using global %rename rules and the method would remain as push_back, but is now
renamed to add. Some more info in issue #856.
*** POTENTIAL INCOMPATIBILITY ***
2016-11-26: m7thon
[Python] Issue #709 - improved wrapping of division operators
'from __future__ import division' now works in Python 2 whether or not the
-py3 flag is used.
2016-11-12: joequant
[R] Issue #697 - fix comma issue with overload methods
2016-11-12: joequant
[R] Issue #555 - R runtime needs stdio.h
2016-11-02: wsfulton
[Python] Issue #816 - fix compilation error when using -extranative and -builtin.
2016-11-02: liorgold
Patch #741 - Add support for C++11 alias templates, see updated CPlusPlus11.html
documentation.
2016-10-30: myd7349
[C#] Patch #740 Add std_array.i for C# for wrapping std::array.
Patch also enhances std::vector<std::wstring> C# wrappers with additional functions
(Contains, IndexOf, LastIndexOf and Remove).
2016-10-30: tobilau
[Java] Fix wrappers for wstring parameters in director methods to cleanup local
ref after director callback has finished.
2016-10-23: wsfulton
[C#] Add missing csdirectorin VOID_INT_PTR and csdirectorout VOID_INT_PTR typemaps.
2016-10-23: jiulongw
Patch #781 - Fix wrapping of C compound expressions containing char constants
in quotes such as:
#define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
enum DifferentTypes {
typecharcompound='A'+1,
typecharcompound2='B' << 2
};
2016-10-13: wsfulton
[Python] Issue #808 - fix Python pickling and metaclass for builtin wrappers.
The metaclass (SwigPyObjectType) for SWIG objects was not defined in
a way that let importlib successfully import the Python wrappers.
The pickle module previously failed to pickle objects because it couldn't
determine what module the SWIG wrapped objects were in.
2016-09-29: wsfulton
[Allegrocl, CFFI, GO, Javascript, Ocaml, R, Scilab]
Add missing support for the "ret" typemap in a few target languages.
The documentation also now has info on the "ret" typemap.
2016-09-27: ahmed-usman
[xml] Handle template parameters correctly.
2016-09-27: dontpanic92
[Go] Fix argument names in inherited functions taking more than 8
parameters. Fixes #795.
2016-09-26: smarchetto
[Scilab] mlists that map pointers can be given a custom type name.
2016-09-25: wsfulton
Patch #793 from q-p to expand exception handling to include std::bad_cast
in std_except.i.
2016-09-24: olly
[PHP] Fix code generated for feature("director:except") -
previously the return value of call_user_function() was ignored and
we checked an uninitialised value instead. Fixes #627. Based on
patch from Sergey Seroshtan.
2016-09-22: wsfulton
[Python] More flexible python builtin slots for overloaded C++ function.
The closure names used for builtin slots are mangled with their functype so
that overloaded C++ method names can be used for multiple slots.
For example:
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__;
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
will generate closures:
SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___ssizeargfunc_closure */
SWIGPY_BINARYFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___binaryfunc_closure */
Previously only one name was defined: _wrap_SimpleArray___getitem___closure.
Hence the overloaded __getitem__ method can be used to support both mp_subscript and sq_item slots.
2016-09-17: wsfulton
[Python] Fix iterators for containers of NULL pointers (or Python None) when using
-builtin. Previously iteration would stop at the first element that was NULL.
2016-09-16: olly
[Javascript] Fix SWIG_exception() macro to return from the current
function. Fixes #789, reported by Julien Dutriaux.
2016-09-16: olly
[PHP] Fix SWIG_exception() macro to return from the current function.
Fixes #240, reported by Sergey Seroshtan.
2016-09-12: xypron
[C#] Patch #786 Keyword rename to be CLS compliant by adding an underscore
suffix instead of an underscore prefix to the C symbol name. Please use an explicit
%rename to rename the symbol with a _ prefix if you want the old symbol name.
*** POTENTIAL INCOMPATIBILITY ***
2016-09-09: olly
[Python] Fix import handling for Python 2.6 to work in a frozen
application. Fixes #145, reported by Thomas Kluyver.
2016-09-02: smarchetto
[Scilab] Pointers are mapped to mlist instead of tlist
(mlist better for scilab overloading)
2016-09-02: olly
[PHP] Fix "out" typemap for member function pointers and "in"
typemap for char INPUT[ANY].
2016-09-01: wsfulton
[Python] More efficient Python slicing.
Call reserve for container types that support it to avoid repeated
memory reallocations for new slices or slices that grow in size.
2016-09-01: wsfulton
[Python] #771 - Make builtin types hashable by default.
Default hash is the underlying C/C++ pointer. This matches up with testing for
equivalence (Py_EQ in SwigPyObject_richcompare) which compares the pointers.
2016-08-22: wsfulton
[Python] The following builtin slots can be customized like other slots via the
"python:<x>" and "python:slot" features where <x> is the appropriate slot name:
tp_allocs
tp_bases
tp_basicsize
tp_cache
tp_del
tp_dealloc
tp_flags
tp_frees
tp_getset
tp_is_gc
tp_maxalloc
tp_methods
tp_mro
tp_new
tp_next
tp_prev
tp_richcompare
tp_subclasses
tp_weaklist
was_sq_ass_slice
was_sq_slice
A few documentation improvements for slot customization.
2016-08-09: joequant
[R] Patch #765 Fix extern "C" header includes for C++ code.
2016-08-05: olly
[xml] Fix how the output filename is built to avoid problems when
it contains the embedded strings ".c", ".cpp" or ".cxx".
Fixes #540 reported by djack42.
2016-07-01: wsfulton
Fix corner case of wrapping std::vector of T pointers where a pointer to a pointer of T
also exists in the wrapped code. SF Bug 2359417 (967).
2016-06-26: wkalinin
[Java, C#] Patch #681 Fix seg fault when ignoring nested classes.
2016-06-25: mromberg
[Python] #711 Fix -castmode and conversion of signed and unsigned integer types.
See 2015-12-23 CHANGES entry for details of these improvements when they were
implemented for the default options (ie not using -castmode).
2016-06-25: ahnolds
Patch #730 - Fix %implicitconv for overloaded functions when using
-castmode or -fastdispatch options.
The result is that in all overload cases where there are multiple possibilities
with the same number of arguments, the dispatch function will first check for
exact (aka non implicit) matches, and then subsequently check for implicit
casting matches. This was already happening in the normal dispatch situation,
and in the -fastdispatch case two passes through the candidates were happening,
just with SWIG_POINTER_IMPLICIT_CONV always set. After this patch, it is not set
on the first pass, and then set on the second pass.
2016-06-25: liorgold
Patch #727 - Add support for C++11 type aliasing.
Version 3.0.10 (12 Jun 2016)
============================
2016-06-06: mromberg
[Python] Patch #698. Add support for -relativeimport for python 2.7, so -py3 is no
longer also required for relative import support.
2016-06-05: mromberg
[Python] Patch #694 - Fix package import regressions introduced in swig-3.0.9.
1) The code in 3.0.9 did not fall back to 'import _foo' if 'import bar._foo' failed
(assuming bar.foo was the main module). Every place _foo is imported now first tries
it from the package where foo was found and if that fails tries _foo as a global module.
2) The separate block of Python code that injected code to pull in the attributes
from _foo when -builtin is used made use of the -py3 switch to either do
'from ._foo import *' or "from _foo import *". This block of code no longer does this
and instead checks the Python version at runtime to switch between the two syntaxes.
In summary, swig-3.0.10 has been modified to ease the creation of wrapper modules
that can be fully made part of a Python package. SWIG no longer
assumes the dynamically linked C module is a global module.
The dynamic module can now be placed into either the same package as the pure Python
module or as a global module. Both locations are used by the Python wrapper to
locate the C module.
However, this could cause a backwards incompatibility with some code
that was relying on the ability of "from package import _module" to
pull attributes out of the package directly. If your code populates a
module (which is also a package) with attributes that are SWIG
generated modules which were not loaded in a conventional way,
swig-3.0.8 and earlier may have worked due to 'from package import
_module' bypassing a real import and pulling your module in as an
attribute. This will no longer work. Since this is not a common (or
even recommended) practice, most folk should not be affected.
*** POTENTIAL INCOMPATIBILITY ***
2016-05-31: wsfulton
Fix #690 - Smart pointer to %ignored class doesn't expose inherited methods.
Regression introduced in swig-3.0.9.
Version 3.0.9 (29 May 2016)
===========================
2016-05-24: mromberg
[Python] Patch #612 - Add support for Python's implicit namespace packages.
2016-05-23: wsfulton
[Ruby] Fix #602 - Error handling regression of opaque pointers introduced
in swig-3.0.8 when C functions explicitly reset a pointer using 'DATA_PTR(self) = 0'.
An ObjectPreviouslyDeleted error was incorrectly thrown when the pointer was used
as a parameter.
2016-05-17: tamuratak
[Ruby] Patch #651 - Correct overloaded function error message when function is
using %newobject.
2016-05-17: aurelj
[Ruby] Patch #582 - add support for docstring option in %module()
2016-05-14: wsfulton
Fix #434 - Passing classes by value as parameters in director methods did not create
a copy of the argument leading to invalid memory accesses if the object was used
after the upcall into the target language. Passing arguments by value shouldn't give
rise to these sorts of memory problems and so the objects are now copied and ownership
of their lifetime is controlled by the target language.
2016-05-07: wsfulton
Fix #611. Fix assertion handling defaultargs when using %extend for a template
class and the extended methods contain default arguments.
2016-05-05: ejulian
[Python] Patch #617. Fix operator/ wrappers.
2016-05-02: wsfulton
Fix #669. Don't issue warning about ignoring base classes when the derived class is
itself ignored.
2016-04-18: ianlancetaylor
[Go] Fix use of goout typemap when calling base method by
forcing the "type" attribute to the value we need.
2016-04-17: ianlancetaylor
[Go] Fixes for Go 1.6: avoid returning Go pointers from
directors that return string values; add a trailing 0 byte
when treating Go string as C char*.
2016-04-06: smarchetto
[Scilab] #552 Make Scilab runtime keep track of pointer types
Instead of a Scilab pointer which has no type, SWIG Scilab maps a
pointer to a structure tlist containing the pointer adress and its type.
2016-04-02: ahnolds
[Python] Apply #598. Fix misleading error message when attempting to read a non-existent
attribute. The previous cryptic error message:
AttributeError: type object 'object' has no attribute '__getattr__'
is now replaced with one mentioning the attribute name, eg:
AttributeError: 'Foo' object has no attribute 'bar'
2016-04-02: derkuci
[Python] Patch #610 to fix #607.
Fix single arguments when using python -builtin -O with %feature("compactdefaultargs")
2016-03-31: wsfulton
Fixes #594. Fix assertion for some languages when wrapping a C++11 enum class that
is private in a class.
Also don't wrap private enums for a few languages that attempted to do so.
2016-03-31: wsfulton
[Java] unsigned long long marshalling improvements when a negative number
is passed from Java to C. A cast to signed long long in the C layer will now
result in the expected value. No change for positive numbers passed to C.
Fixes #623.
2016-03-22: alexwarg
[Lua] #398 Fix lua __getitem + inheritance
The new handling of classes in Lua (not merging methods into the derived classes)
breaks for classes that provide a __getitem function. The __getitem function
prevents method calls to any method defined in a base class. This fix calls
__getitem only if the member is not found using recursive lookup.
2016-03-18: ptomulik
[Python] #563 Stop generating unnecessary _swigconstant helpers.
2016-03-16: richardbeare
[R] #636 Add extra std::vector numeric types
2016-03-14: wsfulton
[Java] Add std_array.i for C++11 std::array support.
2016-03-12: wsfulton
[Java, C#, D] Fix static const char member variables wrappers with %javaconst(1)
%csconst(1) or %dmanifestconst.
This fixes the case when an integer is used as the initializer, such as:
struct W { static const char w = 100; };
Fix generated code parsing enum values using char escape sequences
when these values appear in the Java code (usually when using %javaconst(1))
such as:
enum X { x1 = '\n', x2 = '\1' };
Similarly for static const member char variables such as:
struct Y { static const char y = '\n'; }
Likewise for D and %dmanifestconstant. For C# and %csconst(1), char
values in C# are now hex escaped as C# doesn't support C octal escaping.
2016-03-11: wsfulton
[Java C#] Add support for treating C++ base classes as Java interfaces
instead of Java proxy classes. This enable some sort of support for
multiple inheritance. The implementation is in swiginterface.i and
provides additional macros (see Java.html for full documentation):
%interface(CTYPE)
%interface_impl(CTYPE)
%interface_custom("PROXY", "INTERFACE", CTYPE)
2016-03-01: wsfulton
Add rstrip encoder for use in %rename. This is like the strip encoder but
strips the symbol's suffix instead of the prefix. The example below
will rename SomeThingCls to SomeThing and AnotherThingCls to AnotherThing:
%rename("%(rstrip:[Cls])s") "";
class SomeThingCls {};
struct AnotherThingCls {};
2016-03-01: olly
Fix isfinite() check to work with GCC6. Fixes
issue #615 reported by jplesnik.
2016-02-17: olly
[Python] Add missing keywords 'as' and 'with' to pythonkw.swg.
2016-02-07: kwwette
[Octave] recognise various unary functions
* Use __float__() for numeric conversions, e.g. when calling double()
* Map various unary functions, e.g. abs() to __abs__(), see full list
in section 32.3.10 of manual; only available in Octave 3.8.0 or later
2016-02-07: kwwette
[Octave] export function swig_octave_prereq() for testing Octave version
2016-02-06: pjohangustavsson
[C#] Fix duplicate symbol problems when linking the source generated
from multiple SWIG modules into one shared library for the -namespace
option. The namespace is now mangled into the global PInvoke function
names.
*** POTENTIAL INCOMPATIBILITY ***
2016-01-27: ahnolds
[Python] Added support for differentiating between Python Bytes
and Unicode objects using by defining SWIG_PYTHON_STRICT_BYTE_CHAR
and SWIG_PYTHON_STRICT_UNICODE_WCHAR.
2016-01-27: steeve
[Go] Ensure structs are properly packed between gc and GCC/clang.
2016-01-25: ahnolds
[Python] Support the full Python test suite in -classic mode
* Convert long/unsigned long/long long/unsigned long long to PyInt
rather than PyLong when possible. Certain python functions like
len() require a PyInt when operating on old-style classes.
* Add support for static methods in classic mode, including support
for pythonappend, pythonprepend, and docstrings.
* Removing the use of __swig_getmethods__ for static member methods
since they will always be found by the standard argument lookup
* Fix a bug where the wrong type of exception was caught when
checking for new-style class support
2016-01-23: ahnolds
[Go] Enable support for the Go test-suite on OSX:
* The linker on OSX requires that all symbols (even weak symbols)
are defined at link time. Because the function _cgo_topofstack is
only defined starting in Go version 1.4, we explicitly mark it as
undefined for older versions of Go on OSX.
* Avoid writing empty swigargs structs, since empty structs are not
allowed in extern "C" blocks.
2016-01-12: olly
[Javascript] Look for "nodejs" as well as "node", as it's packaged
as the former on Debian.
2016-01-12: olly
[Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION.
Fixes issue 561.
2016-01-10: ahnolds
Improved size_t and ptrdiff_t typemaps to support large values
on platforms where sizeof(size_t) > sizeof(unsigned long) and
sizeof(ptrdiff_t) > sizeof(long).
Version 3.0.8 (31 Dec 2015)
===========================
2015-12-30: wsfulton
The pdf documentation is now generated by wkhtmltopdf and has colour
for the code snippets just like the html documentation!
2015-12-23: ahnolds
[Python] Fixes for conversion of signed and unsigned integer types:
No longer check for PyInt objects in Python3. Because PyInt_Check
and friends are #defined to the corresponding PyLong methods, this
had caused errors in Python3 where values greater than what could be
stored in a long were incorrectly interpreted as the value -1 with
the Python error indicator set to OverflowError. This applies to
both the conversions PyLong->long and PyLong->double.
Conversion from PyLong to long, unsigned long, long long, and
unsigned long long now raise OverflowError instead of TypeError in
both Python2 and Python3 for PyLong values outside the range
expressible by the corresponding C type. This matches the existing
behavior for other integral types (signed and unsigned ints, shorts,
and chars), as well as the conversion for PyInt to all numeric
types. This also indirectly applies to the size_t and ptrdiff_t
types, which depend on the conversions for unsigned long and long.
2015-12-19: wsfulton
[Python] Python 2 Unicode UTF-8 strings can be used as inputs to char * or
std::string types if the generated C/C++ code has SWIG_PYTHON_2_UNICODE defined.
2015-12-17: wsfulton
Issues #286, #128
Remove ccache-swig.1 man page - please use the CCache.html docs instead.
The yodl2man and yodl2html tools are no longer used and so SWIG no
longer has a dependency on these packages which were required when
building from git.
2015-12-16: zturner/coleb
[Python] Fix Python3.5 interpreter assertions when objects are being
deleted due to an existing exception. Most notably in generators
which terminate using a StopIteration exception. Fixes #559 #560 #573.
If a further exception is raised during an object destruction,
PyErr_WriteUnraisable is used on this second exception and the
original exception bubbles through.
2015-12-14: ahnolds/wsfulton
[Python] Add in missing initializers for tp_finalize,
nb_matrix_multiply, nb_inplace_matrix_multiply, ht_qualname
ht_cached_keys and tp_prev.
2015-12-12: wsfulton
Fix STL wrappers to not generate <: digraphs.
For example std::vector<::X::Y> was sometimes generated, now
corrected to std::vector< ::X::Y >.
2015-11-25: wsfulton
[Ruby] STL ranges and slices fixes.
Ruby STL container setting slices fixes:
Setting an STL container wrapper slice better matches the way Ruby
arrays work. The behaviour is now the same as Ruby arrays. The only
exception is the default value used when expanding a container
cannot be nil as this is not a valid type/value for C++ container
elements.
Obtaining a Ruby STL container ranges and slices fixes:
Access via ranges and slices now behave identically to Ruby arrays.
The fixes are mostly for out of range indices and lengths.
- Zero length slice requests return an empty container instead of nil.
- Slices which request a length greater than the size of the container
no longer chop off the last element.
- Ranges which used to return nil now return an empty array when the
the start element is a valid index.
Ruby STL container negative indexing support improved.
Using negative indexes to set values works the same as Ruby arrays, eg
%template(IntVector) std::vector<int>;
iv = IntVector.new([1,2,3,4])
iv[-4] = 9 # => [1,2,3,9]
iv[-5] = 9 # => IndexError
2015-11-21: wsfulton
[Ruby, Python] Add std::array container wrappers.
These work much like any of the other STL containers except Python/Ruby slicing
is somewhat limited because the array is a fixed size. Only slices of
the full size are supported.
2015-10-10: wsfulton
[Python] #539 - Support Python 3.5 and -builtin. PyAsyncMethods is a new
member in PyHeapTypeObject.
2015-10-06: ianlancetaylor
[Go] Don't emit a constructor function for a director
class with an abstract method, since the function will
always panic.
2015-10-01: wsfulton
Fix %shared_ptr support for private and protected inheritance.
- Remove unnecessary Warning 520: Derived class 'Derived' of 'Base'
is not similarly marked as a smart pointer
- Do not generate code that attempts to cast up the inheritance chain in the
type system runtime in such cases as it doesn't compile and can't be used.
Remove unnecessary warning 520 for %shared_ptr when the base class is ignored.
2015-10-01: vkalinin
Fix #508: Fix segfault parsing anonymous typedef nested classes.
2015-09-26: wsfulton
[Ruby] Add shared_ptr support
2015-09-13: kkaempf
[Ruby] Resolve tracking bug - issue #225.
The bug is that the tracking code uses a ruby hash and thus may
allocate objects (Bignum) while running the GC. This was tolerated in
1.8 but is invalid (raises an exception) in 1.9.
The patch uses a C hash (also used by ruby) instead.
2015-09-09: lyze
[CFFI] Extend the "export" feature in the CFFI module to support
exporting to a specified package.
2015-09-04: olly
[Python] Fix docstrings for %callback functions.
2015-09-03: demi-rluddy
[Go] Removed golang stringing for signed/unsigned char
Changed default handling of signed char* and unsigned char* to be
opaque pointers rather than strings, similarly to how other
languages work.
Any existing code relying on treating signed char* or unsigned
char* as a string can restore the old behavior with typemaps.i by
using %apply to copy the [unchanged] char* behavior.
*** POTENTIAL INCOMPATIBILITY ***
2015-08-07: talby
[Perl] tidy -Wtautological-constant-out-of-range-compare warnings when building generated code under clang
2015-08-07: xantares
[Python] pep257 & numpydoc conforming docstrings:
- Mono-line module docsstring
- Rewrite autodoc parameters section in numpydoc style:
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
- One line summary should end with "."
- Adds a blank line after class docstring
2015-08-05: vadz
[Java] Make (char* STRING, size_t LENGTH) typemaps usable for
strings of other types, e.g. "unsigned char*".
Version 3.0.7 (3 Aug 2015)
==========================
2015-08-02: wsfulton
[Java] Fix potential security exploit in generated Java classes.
The swigCPtr and swigCMemOwn member variables in the generated Java
classes are now declared 'transient' by default. Further details of the exploit
in Android is being published in an academic paper as part of USENIX WOOT '15:
https://www.usenix.org/conference/woot15/workshop-program/presentation/peles.
In the unlikely event that you are relying on these members being serializable,
then you will need to override the default javabody and javabody_derived typemaps
to generate the old generated code. The relevant typemaps are in the Lib directory
in the java.swg, boost_shared_ptr.i and boost_intrusive_ptr.i files. Copy the
relevant default typemaps into your interface file and remove the 'transient' keyword.
*** POTENTIAL INCOMPATIBILITY ***
2015-08-01: vadz
Make configure --without-alllang option more useful: it can now be overridden by the following
--with-xxx options, allowing to easily enable just one or two languages.
2015-07-30: wsfulton
Fix #440 - Initialise all newly created arrays when using %array_functions and %array_class
in the carrays.i library - bug is only relevant when using C++.
2015-07-29: wsfulton
[Python] Improve indentation warning and error messages for code in the following directives:
%pythonprepend
%pythonappend
%pythoncode
%pythonbegin
%feature("shadow")
Old error example:
Error: Line indented less than expected (line 3 of pythoncode)
New error example:
Error: Line indented less than expected (line 3 of %pythoncode or %insert("python") block)
as no line should be indented less than the indentation in line 1
Old warning example:
Warning 740: Whitespace prefix doesn't match (line 2 of %pythoncode or %insert("python") block)
New warning example:
Warning 740: Whitespace indentation is inconsistent compared to earlier lines (line 3 of
%pythoncode or %insert("python") block)
2015-07-28: wsfulton
[Python] Fix #475. Improve docstring indentation handling.
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring feature.
This occurred when the indentation (whitespace) in the docstring was less in the
second or later lines when compared to the first line.
SWIG-3.0.6 gave a 'Line indented less than expected' error instead of truncating
the docstring text.
Now the indentation for the 'docstring' feature is smarter and is appropriately
adjusted so that no truncation occurs.
2015-07-22: wsfulton
Support for special variable expansion in typemap attributes. Example usage expansion
in the 'out' attribute (C# specific):
%typemap(ctype, out="$*1_ltype") unsigned int& "$*1_ltype"
is equivalent to the following as $*1_ltype expands to 'unsigned int':
%typemap(ctype, out="unsigned int") unsigned int& "unsigned int"
Special variables can be used within special variable macros too. Example usage expansion:
%typemap(cstype) unsigned int "uint"
%typemap(cstype, out="$typemap(cstype, $*1_ltype)") unsigned int& "$typemap(cstype, $*1_ltype)"
Special variables are expanded first and hence the above is equivalent to:
%typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
which then expands to:
%typemap(cstype, out="uint") unsigned int& "uint"
2015-07-22: lindleyf
Apply patch #439 - support for $typemap() (aka embedded typemaps or special variable
macros) in typemap attributes. A simple example where $typemap() is expanded in the
'out' attribute (C# specific):
%typemap(cstype) unsigned int "uint"
%typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
is equivalent to:
%typemap(cstype, out="uint") unsigned int& "uint"
2015-07-18: m7thon
[Python] Docstrings provided via %feature("docstring") are now quoted and added to
the tp_doc slot when using python builtin classes (-builtin). When no docstring is
provided, the tp_doc slot is set to the fully qualified C/C++ class name.
Github issues #445 and #461.
2015-07-17: kwwette
[octave] Support Octave version 4.0.0 (thanks to patches from Orion Poplawski).
2015-07-07: wsfulton
SWIG no longer generates a wrapper for a class' constructor if that class has
any base class with a private destructor. This is because your compiler should
not allow a class to be instantiated if a base has a private destructor. Some
compilers do, so if you need the old behaviour, use the "notabstract" feature, eg:
%feature("notabstract") Derived;
class Base {
~Base() {}
};
struct Derived : Base {};
Version 3.0.6 (5 Jul 2015)
==========================
2015-07-02: wsfulton
Fix syntax error when the template keyword is used in types, eg:
std::template vector<int> v;
2015-07-02: ngladitz
[Lua] Push characters as unformatted 1-character strings to avoid
unprintable characters such as (char)127 being converted to
"<\127>" with Lua 5.3 and later. (github PR #452)
2015-06-29: olly
[Python] Improve handling of whitespace in %pythoncode.
Previously SWIG looked at the indentation of the first line and
removed that many characters from each subsequent line, regardless
of what those characters were. This was made worse because SWIG's
preprocessor removes any whitespace before a '#'. Fixes github
issue #379, reported by Joe Orton.
2015-06-12: wsfulton
[R] Fix #430 - call to SWIG_createNewRef in copyToC was incorrectly named.
2015-06-11: sghirate
[C#] Patch #427 adds in new command line option -outfile to combine all the
generated C# code into a single file.
2015-06-09: wsfulton
Fix seg fault processing C++11 type aliasing. Issue #424.
2015-05-28: wsfulton
[Python] Add new feature "python:cdefaultargs" to control default argument
code generation. By default, SWIG attempts to convert C/C++ default argument values
into Python values and generates code into the Python layer with these values.
Recent versions of SWIG are able to convert more of these values, however, the
new behaviour can be circumvented if desired via this new feature, such that
the default argument values are obtained from the C layer and not the Python layer.
For example:
struct CDA {
int fff(int a = 1, bool b = false);
};
The default code generation in the Python layer is:
class CDA(_object):
...
def fff(self, a=1, b=False):
return _default_args.CDA_fff(self, a, b)
Adding the feature:
%feature("python:cdefaultargs") CDA::fff;
Results in:
class CDA(_object):
...
def fff(self, *args):
return _default_args.CDA_fff(self, *args)
Some code generation modes, eg -builtin and -fastproxy, are unaffected by this as
the default values are always obtained from the C layer.
2015-05-27: wsfulton
[Python] Deal with an integer as the default value of a typedef to bool
parameter in the C++ prototype. See #327. Regression from 3.0.0 onwards.
2015-05-19: olly
[Python] Fix warning when compiling generated code with MSVC.
(Fixes https://sourceforge.net/p/swig/patches/351/ reported by
Mateusz Szyma�ski).
2015-05-14: wsfulton
Fix seg fault wrapping shared_ptr of classes with private constructors and destructors.
This also fixes the "unref" feature when used on classes with private destructors.
2015-05-10: wsfulton
[Java] Fix multi-argument typemaps (char *STRING, size_t LENGTH)
so that they can be applied to a wider range of types. Fixes #385.
2015-05-07: olly
[Python] Deal with an integer as the default value of a bool
parameter in the C++ prototype. Fixes github #327, reported by
Greg Allen.
2015-05-07: LindleyF
[Java] Allow feature("director") and feature("ref") to be used
together. Github PR#403.
2015-05-05: olly
Suppress warning 325 "Nested class not currently supported (Foo
ignored)" when Foo has already been explicitly ignored with "%ignore".
2015-05-04: wsfulton
Add support for friend templates, including operator overloading - fixes #196. Considering
the example below, previously the operator gave a syntax error and friendfunc incorrectly
warned with:
"Warning 503: Can't wrap 'friendfunc<(Type)>' unless renamed to a valid identifier."
template <class Type> class MyClass {
friend int friendfunc <Type>(double is, MyClass <Type> & x);
friend int operator<< <Type>(double un, const MyClass <Type> &x);
};
The following also previously incorrectly warned with:
"Warning 302: Identifier 'template_friend' redefined (ignored),"
template<typename T> T template_friend(T);
struct MyTemplate {
template<typename T> friend T template_friend(T);
};
2015-05-01: wsfulton
Fix handling of conversion operators where the operator is split over multiple
lines or has comments within the operator type. Fixes #401.
Also fix similar problem with normal operators which gave a syntax error if split over
multiple lines or had a comment within the operator declaration.
2015-04-30: olly
Ignore unknown preprocessor directives which are inside an inactive
conditional (github issue #394, reported by Dan Wilcox).
Regression introduced in 3.0.3.
2015-04-27: vadz
[Python] Fix "default" typemap used after an argument with "numinputs=0" (#377).
2015-04-24: wsfulton
[Python] Fix #256. Code generated with '-builtin -modernargs' segfaults for any
method taking zero arguments.
Also fixes: "SystemError: error return without exception set" during error checking
when using just -builtin and the incorrect number of arguments is passed to a class
method expecting zero arguments.
2015-04-23: wsfulton
[Java] Bug #386 - Memory leak fix in (char *STRING, size_t LENGTH) typemaps.
2015-04-23: vadz
[Python] Make "default" typemap work again (#330, #377).
2015-04-23: vadz
[Python] Fix the use of default values for the pointer types (#365, #376).
2015-04-23: wsfulton
Fix 'make check-ccache' which is part of 'make check' when one of the CCACHE_
environment variables, for example CCACHE_DISABLE, is set.
2015-04-14: wsfulton
Clearer warning message for badly constructed typecheck typemaps. For example, was:
example.i:3: Warning 467: Overloaded foo(int) not supported (no type checking
rule for 'int').
Now:
example.i:3: Warning 467: Overloaded foo(int) not supported (incomplete type checking
rule - no precedence level in typecheck typemap for 'int').
2015-04-11: wsfulton
[Java] Fix #353 - Linker multiple definition of 'ExceptionMatches' when
using directors and multiple modules.
2015-04-11: wsfulton
Merge #320 - Make __dict__ accessible for Python builtin classes.
2015-04-07: wsfulton
Fix #375 - parsing of extern "C" and typedef for example:
extern "C" typedef void (*Hook2_t)(int, const char *);
extern "C" typedef int Integer;
2015-03-12: olly
-DSWIG_DIRECTOR_STATIC is now supported for all languages with
director support, not only Python and PHP.
2015-03-02: ianlancetaylor
[Go] Add -cgo option, required for Go versions 1.5 and
later.
2015-02-26: olly
Fix segmentation fault when top==NULL, introduced by nested class
handling (reported in issue#346 by Pawe� Tomulik).
2015-02-09: wsfulton
[Guile] Fix generated code for static const char member variables when
defined and declared inline.
2015-02-09: mishas
[Go] Fix %import of files in sub directories.
2015-02-05: ianlancetaylor
[Go] Ignore Go specific type maps (goin, goout, etc.) if they are empty.
2015-02-05: ianlancetaylor
[Go] Generated Go code no longer calls _swig_goallocate or
_swig_makegostring, as they will no longer work as of Go 1.5.
Version 3.0.5 (31 Jan 2015)
===========================
2015-01-30: wsfulton
[Python] Fix Python -classic and property setting. Setting properties on classic classes
was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now
by using __dict__ again when using -classic.
Fixes patch #232.
2015-01-27: smarchetto
[Scilab] Support for the Scilab language has been added
2015-01-23: olly
[PHP] When wrapping a returned resource as an object, check if all
cases wrap it in the same class, and if so eliminate the pointless
switch statement wrapper we previously generated.
2015-01-22: wsfulton
[Octave] Merge patch #297 for SF bug #1277 - Octave shared_ptr support
2015-01-15: wsfulton
[Python] Merge patch #250 - Fixes for using %constant and objects (non-primitive types)
2015-01-15: wsfulton
[C# Go] Merge patch #308 and fix #307 - C++11 strongly typed enum support
in directors
2015-01-15: wsfulton
[Python] Second fix for #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments, this time when using kwargs.
Version 3.0.4 (14 Jan 2015)
===========================
2015-01-12: olly
[PHP] Fix segfault in director upcall check when using PHP built with
ZTS enabled. Fixes #155, reported by Pierre Labastie.
2015-01-12: vadz
[Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments. Invalid or missing default
arguments were sometimes being generated into the python layer.
2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue #284 reported
by Pawel Tomulik. Also handle "constexpr explicit" and "constexpr
static".
2015-01-08: olly
When reporting an error for a construct which hasn't been
terminated when the end of the file is reached, report it at the
start line rather than "EOF" as then tools like editors and IDEs
will take you to a generally more useful place for fixing the
problem.
2015-01-08: olly
Improve error messages for a few cases which previously gave the
one of the cryptic catch-all errors "Syntax error in input".
2015-01-08: olly
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend). Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
Version 3.0.3 (30 Dec 2014)
===========================
2014-12-27: wsfulton
Fix #280 - abort using all default template parameters within other template
parameters.
2014-12-27: talby
[Perl] Issue #282 perl5 archlib vs archlibexp
[Perl] tidy "warning: duplicate 'extern' declaration specifier" when building generated code
under clang
2014-12-18: wsfulton
Add support for %constant and structs/classes - issue #272
2014-12-09: wsfulton
Fix #245 - regression (since swig-3.0.0) in templated constructors.
Templated constructors could not be instantiated - they were incorrectly ignored with a warning 504:
"Function: xyz must have a return type. Ignored."
2014-12-07: wsfulton
Add support for C++11 strongly typed enumerations.
2014-11-21: wsfulton
[Java C#] Fix multiply defined error when using %rename of enum items when using the "simple enum"
wrappers.
2014-10-28: vadz
[Python] Patch #201 The generated .py file no longer uses *args for all Python parameters.
Instead, the parameters are named using the C++ parameter names.
"compactdefaultargs" feature can be enabled to restore the old behaviour.
*** POTENTIAL INCOMPATIBILITY ***
2014-10-24: timotheecour
[D] Patch #204 Use core.atomic.atomicOp to mutate shared variables
2014-10-21: wsfulton
Fix issue #242 - Use of the "kwargs" feature no longer automatically turns on the
"compactdefaultargs" feature if the target language does not support kwargs.
This change affects all languages except Python and Ruby.
*** POTENTIAL INCOMPATIBILITY ***
2014-10-10: diorcety
[Python] Patch #232 Fix property access using directors
2014-10-06: wsfulton
[Python] Fixes when using -builtin and std::vector/std::list wrappers to allow deletion
of single elements, such as 'del vec[0]'.
2014-09-30: oliverb
[Javascript] Merge patch #216 by Richie765 - Added support for many versions of v8 javascript.
2014-09-30: oliverb
[Javascript] Merge patch #195 by zittix - Fixed JSClassRef declaration not using the static one.
2014-09-30: ianlancetaylor
[Go] In configure script, require Go 1.1 or later.
2014-09-30: wsfulton
[Python] Patch #207 - Fix No module error with -relativeimport when using single
header file import.
2014-09-27: wsfulton
Patch #208 - Initialise newly created array when using array_functions in the
carrays.i library (C++ usage).
2014-09-27: wsfulton
[Ruby] Patch #187 - Fix crash on shutdown of the Ruby interpreter if more than one
module was loaded at a time when data is being shared between modules.
2014-09-27: wsfulton
[Java] Patch #168 - Fix leak in Java director string handling after the Java
upcall when called from a native thread.
2014-09-25: ianlancetaylor
[Go] Adjust generated code to work with upcoming Go 1.4
release.
2014-09-23: wsfulton
[Python] Add patch from Thomas Maslach to fix crash in wrappers when using -threads in
the STL iterators (SwigPyIterator destructor).
2014-09-17: wsfulton
[C#] Merge patch #229 from contre - Add bool array types to arrays_csharp.i
2014-09-12: olly
[PHP] Add support for specifying any PHP interfaces a wrapped class
implements, e.g.: %typemap("phpinterfaces") MyIterator "Iterator";
2014-09-11: olly
[PHP] Fix throwing a PHP exception through C++ from a subclassed
director method - PHP NULL gets returned by the subclassed method
in this case, so the directorout typemap needs to allow that (at
least if an exception is active).
2014-09-09: ianlancetaylor
[Go] Add goargout typemap.
2014-09-09: olly
[PHP] Fix segmentation faults with directors in PHP >= 5.4, and
reenable runme tests for director_basic testcase. Fix from
pavel-charvat in issue#164.
2014-09-05: ianlancetaylor
[Go] Add imtype, goin, goout, godirectorin, and
godirectorout typemaps, to support writing Go code to
convert between types.
2014-09-02: olly
[Python] Fix regression in indentation of python code produced with
-modern, introduced by changes in #188. Reported by fabiencastan
in #218.
2014-09-01: olly
Issue an error for unknown SWIG preprocessor directives, rather
than quietly ignoring them. Reported by jrhelsey in issue#217.
*** POTENTIAL INCOMPATIBILITY ***
2014-08-15: talby
[Perl] Include guard fix for nested modules from Anthony Heading (SF Patch #350).
2014-08-04: wsfulton
[C#] Merge patch #200 from gpetrou - Changed CSharp license header to include auto-generated
tag so that StyleCop ignores the files.
2014-08-04: wsfulton
[Java] Merge patch #198 from Yuval Kashtan - Support for java.nio.ByteBuffer mapping to
unsigned char * in various.i in NIOBUFFER typemaps.
2014-07-14: ianlancetaylor
[Go] Change struct definition to use void *, not uint8, so
that the type is recorded as possibly containing
pointers. This ensures that the 1.3 garbage collector
does not collect pointers passed to C++ code.
2014-07-01: wsfulton
Fix SF Bug #1375 - Expansion of the $parentclassname special variable incorrectly contains
brackets in the expanded name.
Version 3.0.2 (4 Jun 2014)
==========================
2014-06-02: v-for-vandal
[Lua] Pull request #176:
If class has no __eq implemented, then default __eq is generated.
Default __eq compares actual pointers stored inside Lua userdata.
2014-06-02: vkalinin
Fix #183 - %extend and unnamed nested structs
2014-05-28: kwwette
Fix install failure when using an 'out of source' build using the shipped
tarball - regression introduced in swig-3.0.1.
2014-05-24: kwwette
[Octave] Remove deprecated -global/-noglobal command-line arguments
*** POTENTIAL INCOMPATIBILITY ***
Version 3.0.1 (27 May 2014)
===========================
2014-05-25: hfalcic
[Python] Python 3 byte string output: use errors="surrogateescape"
if available on the version of Python that's in use. This allows
obtaining the original byte string (and potentially trying a fallback
encoding) if the bytes can't be decoded as UTF-8.
Previously, a UnicodeDecodeError would be raised with no way to treat
the data as bytes or try another codec.
2014-05-18: vkalinin
Bug #175 - Restore %extend to work for unnamed nested structures by using a C
symbol comprising the outer structure name and unnamed variable instance name.
2014-05-15: kwwette
Add #166 - 'make check' now works out of source. This required the examples to build
out of source. The main languages have been tested - C#, Go, Guile, Java, Javascript,
Lua, Octave, Perl, PHP, Python, Ruby and Tcl.
2014-05-01: Oliver Buchtala
Javascript support added, see Javascript chapter in the documentation.
2014-05-01: olly
[PHP] The generated __isset() method now returns true for read-only properties.
2014-04-24: kwwette
[Go] Fix go ./configure parsing of gccgo --version, and
goruntime.swg typo in __GNUC_PATCHLEVEL__ (SF Bug #1298)
2014-04-24: kwwette
Fix {python|perl5|ruby|tcl}/java examples
In Lib/gcj/cni.i, for compatibility with newer gcj versions:
- remove JvAllocObject() which gcj no longer defines, from gcj Changelog:
2004-04-16 Bryce McKinlay <mckinlay@redhat.com>
* gcj/cni.h (JvAllocObject): Remove these obsolete,
undocumented CNI calls.
- change JvCreateJavaVM() argument from void* to JvVMInitArgs*, from gcj Changelog:
2005-02-23 Thomas Fitzsimmons <fitzsim@redhat.com>
PR libgcj/16923
...
(JvCreateJavaVM): Declare vm_args as JvVMInitArgs* rather than void*.
*** POTENTIAL INCOMPATIBILITY ***
2014-04-08: wsfulton
SF Bug #1366 - Remove duplicate declarations of strtoimax and strtoumax in inttypes.i
2014-04-08: wsfulton
[Java C#] Enums which have been ignored via %ignore and are subsequently
used are handled slightly differently. Type wrapper classes are now generated
which are effectively a wrapper of an empty enum. Previously in Java uncompilable
code was generated and in C# an int was used.
2014-04-04: wsfulton
Fix regression in 3.0.0 where legal code following an operator<< definition might
give a syntax error. SF Bug #1365.
2014-04-03: olly
[PHP] Fix wrapping director constructors with default parameters
with a ZTS-enabled build of PHP.
2014-04-02: olly
[PHP] Pass the ZTS context we already have to avoid needing to
call TSRMLS_FETCH, which is relatively expensive.
2014-04-02: olly
[PHP] Pass ZTS context through to t_output_helper() so it works
with a ZTS-enabled build of PHP. Reported by Pierre Labastie in
github PR#155.
2014-03-28: wsfulton
[Java C# D Go] Fixes for C enums used in an API and the definition of the enum
has not been parsed. For D, this fixes a segfault in SWIG. The other languages
now produce code that compiles, although the definition of the enum is needed
in order to use the enum properly from the target language.
2014-03-23: v-for-vandal
[Lua] Fix for usage of snprintf in Lua runtime which Visual Studio does not have.
Version 3.0.0 (16 Mar 2014)
===========================
2014-03-16: wsfulton
C++11 support initially developed as C++0x support by Matevz Jekovec as a Google Summer of Code
project has been further extended. The C++11 support is comprehensive, but by no means complete
or without limitations. Full details for each new feature in C++11 is covered in the
CPlusPlus11.html chapter in the documentation which is included in SWIG and also available
online at http://www.swig.org/Doc3.0/CPlusPlus11.html.
2014-03-14: v-for-vandal
[Lua] Numerous Lua improvements:
1. %nspace support has been added. Namespaces are mapped to tables in the module, with the same
name as the C++ namespace.
2. Inheritance is now handled differently. Each class metatable keeps a list of class bases instead
of merging all members of all bases into the derived class.
3. The new metatables result in differences in accessing class members. For example:
%module example
struct Test {
enum { TEST1 = 10, TEST2 = 20 };
static const int ICONST = 12;
};
Now this can be used as follows:
print(example.Test.TEST1)
print(example.Test.ICONST)
The old way was:
print(example.Test_TEST1)
print(example.Test_ICONST)
4. The special class metatable member ".constructor" was removed. Now SWIG generates the proxy
function by itself and assigns it directly to the class table "__call" method.
5. eLua should also now support inheritance.
6. 'const' subtable in eLua is considered deprecated.
Changes in behaviour:
a. You can no longer assign to non-existing class members in classes without a __setitem__ method.
It will cause a Lua error.
b. You can no longer iterate over a module table and copy everything into the global namespace.
Actually, this was never the case, but it is now explicitly prohibited.
c. Now changing a base class will immediately affect all derived classes.
d. There might be some issues with inheritance. Although the bases iteration scheme is the same
as was used for merging base classes into derived one, some unknown issues may arise.
The old metatable behaviour can be restored by using the -no-old-metatable-bindings option.
*** POTENTIAL INCOMPATIBILITY ***
2014-03-06: wsfulton
[Python] Change in default behaviour wrapping C++ bool. Only a Python True or False
will now work for C++ bool parameters. This fixes overloading bool with other types.
Python 2.3 minimum is now required for wrapping bool.
When wrapping:
const char* overloaded(bool value) { return "bool"; }
const char* overloaded(int value) { return "int"; }
Previous behaviour:
>>> overloaded(False)
'int'
>>> overloaded(True)
'int'
>>> overloaded(0)
'int'
Now we get the expected behaviour:
>>> overloaded(False)
'bool'
>>> overloaded(0)
'int'
The consequence is when wrapping bool in non-overloaded functions:
const char* boolfunction(bool value) { return value ? "true" : "false"; }
The previous behaviour was very Pythonic:
>>> boolfunction("")
'false'
>>> boolfunction("hi")
'true'
>>> boolfunction(12.34)
'true'
>>> boolfunction(0)
'false'
>>> boolfunction(1)
'true'
Now the new behaviour more along the lines of C++ due to stricter type checking. The
above calls result in an exception and need to be explicitly converted into a bool as
follows:
>>> boolfunction(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: in method 'boolfunction', argument 1 of type 'bool'
>>> boolfunction(bool(0))
'false'
The old behaviour can be resurrected by passing the -DSWIG_PYTHON_LEGACY_BOOL command line
parameter when executing SWIG. Typemaps can of course be written to customise the behaviour
for specific parameters.
*** POTENTIAL INCOMPATIBILITY ***
2014-03-06: wsfulton
Fix SF Bug #1363 - Problem with method overloading when some methods are added by %extend
and others are real methods and using template default parameters with smart pointers.
This is noticeable as a regression since 2.0.12 when using the default smart pointer
handling for some languages when the smart pointer wraps std::map and other STL containers.
2014-03-02: wsfulton
[Python] SF Patch #346 from Jens Krueger. Correct exception thrown attempting to
access a non-existent C/C++ global variable on the 'cvar' object. The exception thrown
used to be a NameError. However, as this access is via a primary, an AttributeError
is more correct and so the exception thrown now is an AttributeError. Reference:
http://docs.python.org/2/reference/expressions.html#attribute-references
*** POTENTIAL INCOMPATIBILITY ***
2014-03-01: wsfulton
[Python] Patch #143 Fix type shown when using type() to include the module and package
name when using -builtin.
2014-03-01: wsfulton
[Python] SF patch #347 Fix missing argument count checking with -modern.
Fixes regression introduced when builtin changes were introduced in SWIG-2.0.3.
2014-02-21: wsfulton
[PHP] Fix warning suppression using %warnfilter for PHP reserved class names.
2014-02-19: olly
[Lua] Add keyword warnings for Lua keywords and Basic Functions.
2014-02-19: olly
-Wallkw now includes keywords for all languages with keyword
warnings (previously Go and R were missing).
2014-02-19: olly
[PHP] Update the lists of PHP keywords with new ones from PHP 5.4
and newer (and some missing ones from 5.3). Reserved PHP constants
names are now checked against enum values and constants, instead
of against function and method names. Built-in PHP function names
no longer match methods added by %extend. Functions and methods
named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no
longer needlessly renamed.
2014-02-15: wsfulton
Fix the %$ismember %rename predicates to also apply to members added via %extend.
Add %$isextendmember for %rename of members added via %extend. This can be used to
distinguish between normal class/struct members and %extend members. For example
'%$ismember, %$not %$isextendmember' will now identify just class/struct members.
*** POTENTIAL INCOMPATIBILITY ***
2014-02-16: hfalcic
[Python] Patch #137 - fix crashes/exceptions in exception handling in Python 3.3
2014-02-15: wsfulton
[Java] Add support for the cdata library.
2014-02-08: vkalinin
Nested class support added. This primarily allows SWIG to properly parse nested
classes and keep the nested class information in the parse tree. Java and C#
have utilised this information wrapping the C++ nested classes as Java/C#
nested classes. The remaining target languages ignore nested classes as in
previous versions. Help is needed by users of these remaining languages to
design how C++ nested classes can be best wrapped. Please talk to us on the
swig-devel mailing list if you think you can help.
Previously, there was limited nested class support. Nested classes were treated
as opaque pointers. However, the "nestedworkaround" feature provided a way to
wrap a nested class as if it was a global class. This feature no longer exists
and is replaced by the new "flatnested" feature. This effectively does the same
thing with less manual code to be written. Please see the 'Nested classes'
section in the documentation in SWIGPlus.html if you were previously using this
feature.
SWIG now parses the contents of nested classes where previously it did not. You
may find that you will need to make adjustments to your interface file as
effectively extra code is being wrapped.
*** POTENTIAL INCOMPATIBILITY ***
2014-02-06: gjanssens
[Guile] Patch #133. Make scm to string conversion work with non-ascii strings.
Guile 2 has a completely rewritten string implementation. SWIG made some assumptions
that are no longer valid as to the internals of guile's string representation.
2014-01-30: wsfulton
[C#] Add new swigtype_inout.i library containing SWIGTYPE *& OUTPUT typemaps.
Example usage wrapping:
void f(XXX *& x) { x = new XXX(111); }
would be:
XXX x = null;
f(out x);
// use x
x.Dispose(); // manually clear memory or otherwise leave out and leave it to the garbage collector
2014-01-21: ianlancetaylor
[Go] Add %go_import directive.
2014-01-21: ianlancetaylor
[Go] Add support for Go 1.3, not yet released.
2014-01-20: wsfulton
Director exceptions (Swig::DirectorException) now derive from std::exception
and hence provide the what() method. In Python and Ruby, this replaces the now
deprecated DirectorException::getMessage() method.
2014-01-14: diorcety
Patch #112 - Fix symbol resolution involving scopes that have multiple levels
of typedefs - fixes some template resolutions as well as some typemap searches.
2014-01-11: wsfulton
Fix and document the naturalvar feature override behaviour - the naturalvar
feature attached to a variable name has precedence over the naturalvar
feature attached to the variable's type. The overriding was not working
when turning the feature off on the variable's name.
Fix so that any use of the naturalvar feature will override the global
setting. Previously when set globally by -naturalvar or %module(naturalvar=1),
use of the naturalvar feature was not always honoured.
2014-01-06: ianlancetaylor
[Go] Fix bug that broke using directors from a thread not
created by Go.
2013-12-24: ptomulik
[Python] SF Bug #1297
Resolve several issues related to python imports.
For example, it's now possible to import modules having the same module
names, but belonging in different packages.
From the user's viewpoint, this patch gives a little bit more control on
import statements generated by SWIG. The user may choose to use relative
or absolute imports.
Some details:
- we (still) generate import statements in the form 'import a.b.c' which
corresponds to absolute imports in python3 and (the only available)
ambiguous one in python2.
- added -relativeimport option to use explicit relative import syntax
(python3),
The "Python Packages" section in the documentation discusses how to work
with importing packages including the new -relativeimport command line option.
2013-12-23: vadz
[Octave, Perl, Python, R, Ruby, Tcl] Change the length of strings created from fixed-size char
buffers in C code.
This is a potential backwards compatibility break: a "char buf[5]" containing "ho\0la" was
returned as a string of length 5 before, but is returned as a string of length 2 now. Also,
it was possible to assign a (non-NUL-terminated) string "hello" to such a buffer before but
now this fails and only "helo" can fit.
Apply "char FIXSIZE[ANY]" typemaps to explicitly choose the old behaviour.
*** POTENTIAL INCOMPATIBILITY ***
2013-12-23: talby
[Perl] Add support for directors.
2013-12-18: ianlancetaylor
[Go] Don't require that Go environment variables be set
when running examples or testsuite when using Go 1 or
later.
2013-12-17: ianlancetaylor
[Go] Remove -longsize option (for backward compatibility,
ignore it if seen).
2013-12-17: ianlancetaylor
[Go] Add -go-pkgpath option.
2013-12-16: ianlancetaylor
[Go] Update for Go 1.2 release. Add support for linking
SWIG code directly into executable, rather than using a
shared library.
2013-12-13: ianlancetaylor
[Go] Add SWIG source file name as comments in generated
files. This can be used by Go documentation tools.
2013-12-12: jleveque
[Lua] Fix typo (wchar instead of wchar_t) which made wchar.i
for Lua useless.
2013-12-12: vmiklos
[PHP] PHP's peculiar call-time pass-by-reference feature was
deprecated in PHP 5.3 and removed in PHP 5.4, so update the REF
typemaps in phppointers.i to specify pass-by-reference in the
function definition. Examples/php/pointer has been updated
accordingly.
2013-12-12: olly
[PHP] The usage of $input in PHP directorout typemaps has been
changed to be consistent with other languages. The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).
*** POTENTIAL INCOMPATIBILITY ***
2013-11-27: vadz
[C#, Java, Python] Add std_auto_ptr.i defining typemaps for returning std::auto_ptr<>.
2013-11-09: wsfulton
[C#] Apply patch #79 from Brant Kyser
- Remove using directives from the generated C# code and fully qualify the use of all .NET
framework types in order to minimize potential name collisions from input files defining
types, namespace, etc with the same name as .NET framework members.
- Globally qualify the use of .NET framework types in the System namespace
- Remove .NET 1.1 support, .NET 2 is the minimum for the C# module
This is a potential backwards compatibility break if code has been added relying on these using
statements that used to be generated:
using System;
using System.Runtime.InteropServices;
The quick fix to add these back in is to add the -DSWIG2_CSHARP command line option when
executing SWIG. See CSharp.html documentation for more info.
*** POTENTIAL INCOMPATIBILITY ***
2013-11-05: wsfulton
[Java] Fix some corner cases for the $packagepath/$javaclassname special variable substitution.
2013-11-05: wsfulton
[Java] Apply patch #91 from Marvin Greenberg - Add director:except feature for improved
exception handling in director methods for Java.
2013-10-15: vadz
Allow using \l, \L, \u, \U and \E in the substitution part of %(regex:/pattern/subst/)
inside %rename to change the case of the text being replaced.
2013-10-12: wsfulton
[CFFI] Apply #96 - superclass not lispify
2013-10-12: wsfulton
Merge in C++11 support from the gsoc2009-matevz branch where Matevz Jekovec first
started the C++0x additions. Documentation of the C++11 features supported is in a
new Chapter of the documentation, "SWIG and C++11" in Doc/Manual/CPlusPlus11.html.
2013-10-04: wsfulton
Fix %naturalvar not having any affect on templated classes instantiated with an
enum as the template parameter type. Problem reported by Vadim Zeitlin.
2013-09-20: wsfulton
[Java] Fix a memory leak for the java char **STRING_ARRAY typemaps.
Version 2.0.12 (9 Feb 2014)
===========================
2014-01-16: wsfulton
[PHP] Fix compilation error in ZTS mode (64 bit windows) due to incorrect placement
of TSRMLS_FETCH() in SWIG_Php_GetModule() as reported by Mark Dawson-Butterworth.
2014-01-13: kwwette
[Octave] update support to Octave version 3.8.0
- Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1
will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see
http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e
So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to
enable features requiring Octave version major.minor.patch or later.
For Octave versions prior to 3.8.1, we reconstruct values for
OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER,
extracted from Octave's ChangeLogs. An additional hack is needed to
distinguish between Octave <= 3.2.x and 3.8.0, neither of which define
OCTAVE_API_VERSION_NUMBER.
- Octave 3.8.0 deprecates symbol_table::varref(), so remove its use
for this and future versions of Octave.
- Octave 3.8.0 removes octave_value::is_real_nd_array(), used in
octave_swig_type::dims(). Its use is not required here, so remove it.
- Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0.
- Updated Octave documentation with tested Octave versions, and added a
warning against using versions <= 3.x.x, which are no longer tested.
2013-12-22: wsfulton
C++11 support for new versions of erase and insert in the STL containers.
The erase and insert methods in the containers use const_iterator instead
of iterator in C++11. There are times when the methods wrapped must match
the parameters exactly. Specifically when full type information for
template types is missing or SWIG fails to look up the type correctly,
for example:
%include <std_vector.i>
typedef float Real;
%template(RealVector) std::vector<Real>;
SWIG does not find std::vector<Real>::iterator because %template using
typedefs does not always work and so SWIG doesn't know if the type is
copyable and so uses SwigValueWrapper<iterator> which does
not support conversion to another type (const_iterator). This resulted
in compilation errors when using the C++11 version of the containers.
Closes #73
2013-10-17: wsfulton
[R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include <exception>
within extern "C" block.
2013-10-17: wsfulton
[Python] Fix SF #1345 - Missing #include <stddef.h> for offsetof when using -builtin.
2013-10-12: wsfulton
[Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details()
and SWIG_Lua_namespace_register().
Version 2.0.11 (15 Sep 2013)
============================
2013-09-15: wsfulton
[R] Fix attempt to free a non-heap object in OUTPUT typemaps for:
unsigned short *OUTPUT
unsigned long *OUTPUT
signed long long *OUTPUT
char *OUTPUT
signed char*OUTPUT
unsigned char*OUTPUT
2013-09-12: wsfulton
[Lua] Pull Git patch #62.
1) Static members and static functions inside class can be accessed as
ModuleName.ClassName.FunctionName (MemberName respectively). Old way such as
ModuleName.ClassName_FunctionName still works.
2) Same goes for enums inside classes: ModuleName.ClassName.EnumValue1 etc.
2013-09-12: wsfulton
[UTL] Infinity is now by default an acceptable value for type 'float'. This fix makes
the handling of type 'float' and 'double' the same. The implementation requires the
C99 isfinite() macro, or otherwise some platform dependent equivalents, to be available.
Users requiring the old behaviour of not accepting infinity, can define a 'check' typemap
wherever a float is used, such as:
%typemap(check,fragment="<float.h>") float, const float & %{
if ($1 < -FLT_MAX || $1 > FLT_MAX) {
SWIG_exception_fail(SWIG_TypeError, "Overflow in type float");
}
%}
*** POTENTIAL INCOMPATIBILITY ***
2013-08-30: wsfulton
[Lua] Pull Git patch #81: Include Lua error locus in SWIG error messages.
This is standard information in Lua error messages, and makes it much
easier to find bugs.
2013-08-29: wsfulton
Pull Git patch #75: Handle UTF-8 files with BOM at beginning of file. Was giving an
'Illegal token' syntax error.
2013-08-29: wsfulton
[C#] Pull Git patch #77: Allow exporting std::map using non-default comparison function.
2013-08-28: wsfulton
[Python] %implicitconv is improved for overloaded functions. Like in C++, the methods
with the actual types are considered before trying implicit conversions. Example:
%implicitconv A;
struct A {
A(int i);
};
class CCC {
public:
int xx(int i) { return 11; }
int xx(const A& i) { return 22; }
};
The following python code:
CCC().xx(-1)
will now return 11 instead of 22 - the implicit conversion is not done.
2013-08-23: olly
[Python] Fix clang++ warning in generated wrapper code.
2013-08-16: wsfulton
[Python] %implicitconv will now accept None where the implicit conversion takes a C/C++ pointer.
Problem highlighted by Bo Peng. Closes SF patch #230.
2013-08-07: wsfulton
[Python] SF Patch #326 from Kris Thielemans - Remove SwigPyObject_print and SwigPyObject_str and
make the generated wrapper use the default python implementations, which will fall back to repr
(for -builtin option).
Advantages:
- it avoids the swig user having to jump through hoops to get print to work as expected when
redefining repr/str slots.
- typing the name of a variable on the python prompt now prints the result of a (possibly redefined)
repr, without the swig user having to do any extra work.
- when redefining repr, the swig user doesn't necessarily have to redefine str as it will call the
redefined repr
- the behaviour is exactly the same as without the -builtin option while requiring no extra work
by the user (aside from adding the %feature("python:slot...) statements of course)
Disadvantage:
- default str() will give different (but clearer?) output on swigged classes
2013-07-30: wsfulton
[Python, Ruby] Fix #64 #65: Missing code in std::multimap wrappers. Previously an instantiation
of a std::map was erroneously required in addition to an instantiation of std::multimap with the
same template parameters to prevent compilation errors for the wrappers of a std::multimap.
2013-07-14: joequant
[R] Change types file to allow for SEXP return values
2013-07-05: wsfulton
[Python] Add %pythonbegin directive which works like %pythoncode, except the specified code is
added at the beginning of the generated .py file. This is primarily needed for importing from
__future__ statements required to be at the very beginning of the file. Example:
%pythonbegin %{
from __future__ import print_function
print("Loading", "Whizz", "Bang", sep=' ... ')
%}
2013-07-01: wsfulton
[Python] Apply SF patch #340 - Uninitialized variable fix in SWIG_Python_NonDynamicSetAttr
when using -builtin.
2013-07-01: wsfulton
[Python, Ruby, Ocaml] Apply SF patch #341 - fix a const_cast in generated code that was generating
a <:: digraph when using the unary scope operator (::) (global scope) in a template type.
2013-07-01: wsfulton
[Python] Add SF patch #342 from Christian Delbaere to fix some director classes crashing on
object deletion when using -builtin. Fixes SF bug #1301.
2013-06-11: wsfulton
[Python] Add SWIG_PYTHON_INTERPRETER_NO_DEBUG macro which can be defined to use the Release version
of the Python interpreter in Debug builds of the wrappers. The Visual Studio .dsp example
files have been modified to use this so that Debug builds will now work without having
to install or build a Debug build of the interpreter.
2013-06-07: wsfulton
[Ruby] Git issue #52. Fix regression with missing rb_complex_new function for Ruby
versions prior to 1.9 using std::complex wrappers if just using std::complex as an output type.
Also fix the Complex helper functions external visibility (to static by default).
2013-06-04: olly
[PHP] Fix SWIG_ZTS_ConvertResourcePtr() not to dereference NULL
if the type lookup fails.
Version 2.0.10 (27 May 2013)
============================
2013-05-25: wsfulton
[Python] Fix Python 3 inconsistency when negative numbers are passed
where a parameter expects an unsigned C type. An OverFlow error is
now consistently thrown instead of a TypeError.
2013-05-25: Artem Serebriyskiy
SVN Patch ticket #338 - fixes to %attribute macros for template usage
with %arg.
2013-05-19: wsfulton
Fix ccache-swig internal error bug due to premature file cleanup.
Fixes SF bug 1319 which shows up as a failure in the ccache tests on
Debian 64 bit Wheezy, possibly because ENABLE_ZLIB is defined.
This is a corner case which will be hit when the maximum number of files
in the cache is set to be quite low (-F option), resulting in a cache miss.
2013-05-09: kwwette
[Octave] Fix bugs in Octave module loading:
- fix a memory leak in setting of global variables
- install functions only once, to speed up module loads
2013-04-28: gjanssens
[Guile] Updates in guile module:
- Add support for guile 2.0
- Drop support for guile 1.6
- Drop support for generating wrappers using guile's gh interface.
All generated wrappers will use the scm interface from now on.
- Deprecate -gh and -scm options. They are no longer needed.
A warning will be issued when these options are still used.
- Fix all tests and examples to have a successful travis test
2013-04-18: wsfulton
Apply Patch #36 from Jesus Lopez to add support for $descriptor() special variable macro expansion
in fragments. For example:
%fragment("nameDescriptor", "header")
%{
static const char *nameDescriptor = "$descriptor(Name)";
%}
which will generate into the wrapper if the fragment is used:
static const char *nameDescriptor = "SWIGTYPE_Name";
2013-04-18: wsfulton
Fix SF Bug #428 - Syntax error when preprocessor macros are defined inside of enum lists, such as:
typedef enum {
eZero = 0
#define ONE 1
} EFoo;
The macros are silently ignored.
2013-04-17: wsfulton
[C#] Pull patch #34 from BrantKyser to fix smart pointers in conjunction with directors.
2013-04-15: kwwette
[Octave] Fix bugs in output of cleanup code.
- Cleanup code is now written also after the "fail:" label, so it will be called if
a SWIG_exception is raised by the wrapping function, consistent with other modules.
- Octave module now also recognises the "$cleanup" special variable, if needed.
2013-04-08: kwwette
Add -MP option to SWIG for generating phony targets for all dependencies.
- Prevents make from complaining if header files have been deleted before
the dependency file has been updated.
- Modelled on similar option in GCC.
2013-04-09: olly
[PHP] Add missing directorin typemap for char* and char[] which
fixes director_string testcase failure.
2013-04-05: wsfulton
[Ruby] SF Bug #1292 - Runtime fixes for Proc changes in ruby-1.9 when using STL
wrappers that override the default predicate, such as:
%template(Map) std::map<swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ, swig::BinaryPredicate<> >;
2013-04-05: wsfulton
[Ruby] SF Bug #1159 - Correctly check rb_respond_to call return values to fix some
further 1.9 problems with functors and use of Complex wrappers.
2013-04-02: wsfulton
[Ruby] Runtime fixes for std::complex wrappers for ruby-1.9 - new native Ruby complex numbers are used.
2013-03-30: wsfulton
[Ruby] Fix seg fault when using STL containers of generic Ruby types, GC_VALUE or LANGUAGE_OBJECT,
on exit of the Ruby interpreter. More frequently observed in ruby-1.9.
2013-03-29: wsfulton
[Ruby] Fix delete_if (reject!) for the STL container wrappers which previously would
sometimes seg fault or not work.
2013-03-25: wsfulton
[Python] Fix some undefined behaviour deleting slices in the STL containers.
2013-03-19: wsfulton
[C#, Java, D] Fix seg fault in SWIG using directors when class and virtual method names are
the same except being in different namespaces when the %nspace feature is not being used.
2013-02-19: kwwette
Fix bug in SWIG's handling of qualified (e.g. const) variables of array type. Given the typedef
a(7).q(volatile).double myarray // typedef volatile double[7] myarray;
the type
q(const).myarray // const myarray
becomes
a(7).q(const volatile).double // const volatile double[7]
Previously, SwigType_typedef_resolve() produces the type
q(const).a(7).q(volatile).double // non-sensical type
which would never match %typemap declarations, whose types were parsed correctly.
Add typemap_array_qualifiers.i to the test suite which checks for the correct behaviour.
2013-02-18: wsfulton
Deprecate typedef names used as constructor and destructor names in %extend. The real
class/struct name should be used.
typedef struct tagEStruct {
int ivar;
} EStruct;
%extend tagEStruct {
EStruct() // illegal name, should be tagEStruct()
{
EStruct *s = new EStruct();
s->ivar = ivar0;
return s;
}
~EStruct() // illegal name, should be ~tagEStruct()
{
delete $self;
}
}
For now these trigger a warning:
extend_constructor_destructor.i:107: Warning 522: Use of an illegal constructor name 'EStruct' in
%extend is deprecated, the constructor name should be 'tagEStruct'.
extend_constructor_destructor.i:111: Warning 523: Use of an illegal destructor name 'EStruct' in
%extend is deprecated, the destructor name should be 'tagEStruct'.
These %extend destructor and constructor names were valid up to swig-2.0.4, however swig-2.0.5 ignored
them altogether for C code as reported in SF bug #1306. The old behaviour of using them has been
restored for now, but is officially deprecated. This does not apply to anonymously defined typedef
classes/structs such as:
typedef struct {...} X;
2013-02-17: kwwette
When generating functions provided by %extend, use "(void)" for no-argument functions
instead of "()". This prevents warnings when compiling with "gcc -Wstrict-prototypes".
2013-02-17: kwwette
[Octave] Minor fix to autodoc generation: get the right type for functions returning structs.
2013-02-15: wsfulton
Deprecate typedef names used in %extend that are not the real class/struct name. For example:
typedef struct StructBName {
int myint;
} StructB;
%extend StructB {
void method() {}
}
will now trigger a warning:
swig_extend.i:19: Warning 326: Deprecated %extend name used - the struct name StructBName
should be used instead of the typedef name StructB.
This is only partially working anyway (the %extend only worked if placed after the class
definition).
2013-02-09: wsfulton
[CFFI] Apply patch #22 - Fix missing package before &body
2013-01-29: wsfulton
[Java] Ensure 'javapackage' typemap is used as it stopped working from version 2.0.5.
2013-01-28: wsfulton
[Python] Apply patch SF #334 - Fix default value conversions "TRUE"->True, "FALSE"->False.
2013-01-28: wsfulton
[Java] Apply patch SF #335 - Truly ignore constructors in directors with %ignore.
2013-01-18: Brant Kyser
[Java] Patch #15 - Allow the use of the nspace feature without the -package commandline option.
This works as long and the new jniclasspackage pragma is used to place the JNI intermediate class
into a package and the nspace feature is used to place all exposed types into a package.
2013-01-15: wsfulton
Fix Visual Studio examples to work when SWIG is unzipped into a directory containing spaces.
2013-01-15: wsfulton
[C#] Fix cstype typemap lookup for member variables so that a fully qualified variable name
matches. For example:
%typemap(cstype) bool MVar::mvar "MyBool"
struct MVar {
bool mvar;
};
2013-01-11: Brant Kyser
[Java, C#, D] SF Bug #1299 - Fix generated names for when %nspace is used on
classes with the same name in two different namespaces.
2013-01-11: Vladimir Kalinin
[C#] Add support for csdirectorin 'pre', 'post' and 'terminator' attributes.
2013-01-08: olly
[PHP] Fix to work with a ZTS build of PHP (broken in 2.0.7).
2013-01-07: olly
Fix bashism in configure, introduced in 2.0.9.
2013-01-06: wsfulton
Pull patch #4 from ptomulik to fix SF Bug #1296 - Fix incorrect warning for virtual destructors
in templates, such as:
Warning 521: Illegal destructor name B< A >::~B(). Ignored.
2013-01-05: wsfulton
[Python] Pull patch #3 from ptomulik to fix SF Bug #1295 - standard exceptions as
classes using the SWIG_STD_EXCEPTIONS_AS_CLASSES macro.
2013-01-04: wsfulton
[Java] Pull patch #2 from BrantKyser to fix SF Bug #1283 - fix smart pointers in conjuction
with directors.
2013-01-03: wsfulton
[Java] Pull patch #1 from BrantKyser to fix SF Bug #1278 - fix directors and nspace feature when
multilevel namespaces are used.
Version 2.0.9 (16 December 2012)
================================
2012-12-16: wsfulton
Fix garbage line number / empty file name reporting for some missing
'}' or ')' error messages.
2012-12-15: kkaempf
[Ruby] Apply patch 3530444, Class#methods and Class#constants returns array of
symbols in Ruby 1.9+
2012-12-14: kkaempf
[Ruby] Apply patch 3530439 and finally replace all occurrences of the STR2CSTR() macro
with StringValuePtr(). STR2CSTR was deprecated since years and got removed in Ruby 1.9
2012-12-14: kkaempf
[Ruby] Applied patches #3530442 and 3530443 to adapt compile and runtime include
paths to match Ruby 1.9+
2012-12-14: wsfulton
[CFFI] Fix #3161614 - Some string constants are incorrect
2012-12-13: wsfulton
[CFFI] Fix #3529690 - Fix incorrect constant names.
2012-12-12: drjoe
[R] add fix to finalizer that was missed earlier
2012-12-11: wsfulton
[Python] Apply patch #3590522 - fully qualified package paths for Python 3 even if a module is in the
same package.
2012-12-08: wsfulton
[Python] Bug #3563647 - PyInt_FromSize_t unavailable prior to Python 2.5 for unsigned int types.
2012-12-08: wsfulton
[Perl] Fix bug #3571361 - C++ comment in C wrappers.
2012-12-07: wsfulton
[C#] Apply patch #3571029 which adds missing director support for const unsigned long long &.
2012-11-28: kwwette
[Octave] Simplified module loading: now just the syntax
$ example;
is accepted, which loads functions globally but constants and variables relative to the current scope.
This make module loading behaviour reliably consistent, and reduces problems when loading modules which
depend on other modules which may not have been previously loaded.
2012-11-27: wsfulton
[cffi] Fix junk output when wrapping single character literal constants.
2012-11-17: wsfulton
[Tcl, Modula3] Add missing support for -outdir.
2012-11-17: wsfulton
Fix segfaults when using filename paths greater than 1024 characters in length.
2012-11-14: wsfulton
[ccache-swig] Apply patch #3586392 from Frederik Deweerdt to fix some error cases - incorrectly using
memory after it has been deleted.
2012-11-09: vzeitlin
[Python] Fix overflow when passing values greater than LONG_MAX from Python 3 for parameters with unsigned long C type.
2012-11-09: wsfulton
Fix some feature matching issues for implicit destructors and implicit constructors and implicit
copy constructors added with %copyctor. Previously a feature for these had to be fully qualified
in order to match. Now the following will also match:
%feature("xyz") ~XXX();
struct XXX {};
2012-11-09: wsfulton
Further consistency in named output typemap lookups for implicit constructors and destructors and
implicit copy constructors added with %copyctor. Previously only the fully qualified name was being
used, now the unqualified name will also be used. For example, previously:
example.i:38: Searching for a suitable 'out' typemap for: void Space::More::~More
Looking for: void Space::More::~More
Looking for: void
Now the unqualified name is also used:
example.i:38: Searching for a suitable 'out' typemap for: void Space::More::~More
Looking for: void Space::More::~More
Looking for: void ~More
Looking for: void
2012-11-02: wsfulton
Fix some subtle named output typemap lookup misses, the fully qualified name was not always being
used for variables, for example:
struct Glob {
int MyVar;
};
Previously the search rules (as shown by -debug-tmsearch) for the getter wrapper were:
example.i:44: Searching for a suitable 'out' typemap for: int MyVar
Looking for: int MyVar
Looking for: int
Now the scope is named correctly:
example.i:44: Searching for a suitable 'out' typemap for: int Glob::MyVar
Looking for: int Glob::MyVar
Looking for: int MyVar
Looking for: int
2012-10-26: wsfulton
Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously
the name was ignored during the typemap search. Applies to the following list of typemaps:
directorout, csdirectorout, cstype, imtype, ctype, ddirectorout, dtype, gotype, jtype, jni, javadirectorout.
2012-10-11: wsfulton
Most of the special variables available for use in %exception are now also available for expansion in
%extend blocks. These are: $name $symname $overname $decl $fulldecl $parentclassname $parentclasssymname, see docs
on "Class extension" in SWIGPlus.html. Patch based on submission from Kris Thielemans.
2012-10-10: wsfulton
Additional new special variables in %exception are expanded as follows:
$parentclassname - The parent class name (if any) for a method.
$parentclasssymname - The target language parent class name (if any) for a method.
2012-10-08: iant
[Go] Generating Go code now requires using the -intgosize option to
indicate the size of the 'int' type in Go. This is because the
size of the type is changing from Go 1.0 to Go 1.1 for x86_64.
2012-09-14: wsfulton
Add new warning if the empty template instantiation is used as a base class, for example:
template <typename T> class Base {};
%template() Base<int>;
class Derived : public Base<int> {};
gives the following warning instead of silently ignoring the base:
cpp_inherit.i:52: Warning 401: Base class 'Base< int >' has no name as it is an empty template instantiated with '%template()'. Ignored.
cpp_inherit.i:51: Warning 401: The %template directive must be written before 'Base< int >' is used as a base class and be declared with a name.
2012-09-11: wsfulton
[Java] Fix #3535304 - Direct use of a weak global reference in directors
sometimes causing seg faults especially on Android.
2012-09-06: wsfulton
[Java] Fix (char *STRING, size_t LENGTH) typemaps to accept NULL string.
2012-08-26: drjoe
[R] make ExternalReference slot ref to contain reference
2012-08-26: drjoe
[R] fix Examples/Makefile to use C in $(CC) rather than $(CXX)
Version 2.0.8 (20 August 2012)
==============================
2012-08-15: wsfulton
[Perl] Add size_type, value_type, const_reference to the STL containers.
2012-08-15: wsfulton
[Python] Add discard and add methods to std::set wrappers so that pyabc.i can be used ensuring
MutableSet is a valid abstract base class for std::set. As reported by Alexey Sokolov.
Similarly for std::multiset.
2012-08-15: wsfulton
[Python] Fix #3541744 - Missing PyInt_FromSize_t calls for Python 3.
2012-08-13: wsfulton
[Java] Patch from David Baum to add the assumeoverride feature for Java directors to
improve performance when all overridden methods can be assumed to be overridden.
2012-08-05: wsfulton
[Python] #3530021 Fix unused variable warning.
2012-08-05: wsfulton
[C#] Fix #3536360 - Invalid code sometimes being generated for director methods
with many arguments.
2012-08-05: wsfulton
[Perl] #3545877 - Don't undefine bool if defined by C99 stdbool.h - problem using
Perl 5.16 and later.
2012-08-04: wsfulton
Remove incorrect warning (314) about target language keywords which were triggered
by using declarations and using directives. For example 'string' is a keyword in C#:
namespace std { class string; }
using std::string;
2012-07-21: wsfulton
Fix display of pointers in various places on 64 bit systems - only 32 bits were being shown.
2012-07-21: wsfulton
Fix gdb debugger functions 'swigprint' and 'locswigprint' to display to the gdb output window
rather than stdout. This fixes display problems in gdbtui and the ensures the output
appears where expected in other gdb based debuggers such as Eclipse CDT.
2012-07-20: kwwette
[Octave] segfault-on-exit prevention hack now preserves exit status, and uses C99 _Exit().
2012-07-02: wsfulton
Fix Debian bug http://bugs.debian.org/672035, typemap copy failure - regression introduced
in swig-2.0.5:
%include<stl.i>
using std::pair;
%template(StrPair) pair<std::string, std::string>;
2012-07-02: wsfulton
Fix using declarations combined with using directives with forward class declarations so that
types are correctly found in scope for templates. Example:
namespace Outer2 {
namespace Space2 {
template<typename T> class Thing2;
}
}
using namespace Outer2;
using Space2::Thing2;
template<typename T> class Thing2 {};
// STILL BROKEN void useit2(Thing2<int> t) {}
void useit2a(Outer2::Space2::Thing2<int> t) {}
void useit2b(::Outer2::Space2::Thing2<int> t) {}
void useit2c(Space2::Thing2<int> t) {}
namespace Outer2 {
void useit2d(Space2::Thing2<int> t) {}
}
%template(Thing2Int) Thing2<int>;
2012-06-30: wsfulton
Fix template namespace problems for symbols declared with a forward class declarations, such as:
namespace Space1 {
namespace Space2 {
template<typename T> struct YYY;
}
template<typename T> struct Space2::YYY {
T yyy(T h) {
return h;
}
};
void testYYY1(Space1::Space2::YYY<int> yy) {}
void testYYY2(Space2::YYY<int> yy) {}
void testYYY3(::Space1::Space2::YYY<int> yy) {}
}
%template(YYYInt) Space1::Space2::YYY<int>;
2012-06-30: wsfulton
Fix namespace problems for symbols declared with a forward class declarations, such as:
namespace Space1 {
namespace Space2 {
struct XXX;
struct YYY;
}
struct Space2::YYY {};
struct Space1::Space2::XXX {};
void testXXX2(Space2::XXX xx) {}
void testYYY2(Space2::YYY yy) {}
}
where xx and yy were not recognised as the proxy classes XXX and YYY.
2012-06-30: wsfulton
Fix using declarations combined with using directives with forward class declarations so that
types are correctly found in scope.
namespace Outer2 {
namespace Space2 {
class Thing2;
}
}
using namespace Outer2;
using Space2::Thing2;
class Thing2 {};
// None of the methods below correctly used the Thing2 proxy class
void useit2(Thing2 t) {}
void useit2a(Outer2::Space2::Thing2 t) {}
void useit2b(::Outer2::Space2::Thing2 t) {}
void useit2c(Space2::Thing2 t) {}
namespace Outer2 {
void useit2d(Space2::Thing2 t) {}
}
2012-06-25: wsfulton
Fix using declarations combined with using directives so that types are correctly found in scope.
Example:
namespace Outer2 {
namespace Space2 {
class Thing2 {};
}
}
using namespace Outer2; // using directive
using Space2::Thing2; // using declaration
void useit2(Thing2 t) {}
Similarly for templated classes.
2012-05-29: wsfulton
Fix #3529601 - seg fault when a protected method has the "director"
feature but the parent class does not. Also fix similar problems with
the allprotected feature.
2012-05-28: wsfulton
Fix seg fault when attempting to warn about an illegal destructor - #3530055, 3530078 and #3530118.
Version 2.0.7 (26 May 2012)
===========================
2012-05-26: wsfulton
std::string typemap modifications so they can be used with %apply for other string
classes.
2012-05-25: wsfulton
[Lua] Fixes for -external-runtime to work again.
2012-05-22: szager
[python] Disambiguate SWIG_From_unsigned_SS_int and SWIG_From_unsigned_SS_long.
2012-05-18: olly
[PHP] Fix getters for template members. (SF#3428833, SF#3528035)
2012-05-14: wsfulton
Fix some language's std::map wrappers to recognise difference_type, size_type, key_type
and mapped_type.
2012-05-14: kwwette (signed off by xavier98)
[Octave] Prevent Octave from seg-faulting at exit when SWIG
modules are loaded, due to bugs in Octave's cleanup code:
* Wrapping functions now declared with Octave DEFUN_DLD macro,
and loaded through Octave's dynamic module loader
* Global variables of swigref type are now assigned a new()
copy of the swigref class, to prevent double-free errors
* SWIG module at-exit cleanup function now created in Octave
through eval(), so not dependent on loaded .oct library
* For Octave versions 3.1.* to 3.3.*, register C-level at-exit
function which terminates Octave immediately (with correct
status code) without performing memory cleanup. This function
can be controlled with macros in Lib/octave/octruntime.swg
[Octave] New syntax for determing whether SWIG module should be
loaded globally or non-globally. To load module "example" globally,
type the module name
$ example;
as before; to load module non-globally, assign it to a variable:
$ example = example;
or
$ ex = example;
for a shorter (local) module name. -global/-noglobal command-line
options and module command line are deprecated. Added usage info
to module, so typing
$ help example
or incorrect usage should display proper usage, with examples.
*** POTENTIAL INCOMPATIBILITY ***
2012-05-12: olly
[PHP] Fix memory leak in code generated for a callback. Patch from
SF bug #3510806.
2012-05-12: olly
[PHP] Avoid using zend_error_noreturn() as it doesn't work with all
builds of PHP (SF bug #3166423). Instead we now wrap it in a
SWIG_FAIL() function which we annotate as "noreturn" for GCC to
avoids warnings. This also reduces the size of the compiled
wrapper (e.g. the stripped size is reduced by 6% for Xapian's PHP
bindings).
2012-05-11: wsfulton
[Java] SF patch #3522855 Fix unintended uninitialised memory access in OUTPUT typemaps.
2012-05-11: wsfulton
[Java] SF patch #3522674 Fix possible uninitialised memory access in char **STRING_OUT
typemap.
2012-05-11: wsfulton
[Java] SF patch #3522611 Fix uninitialised size regression in char **STRING_ARRAY
introduced in swig-2.0.6.
2012-05-11: wsfulton
SF bug #3525050 - Fix regression introduced in swig-2.0.5 whereby defining one typemap
method such as an 'out' typemap may hide another typemap method such as an 'in' typemap -
only occurs when the type is a template type where the template parameters are the same
via a typedef.
2012-05-10: olly
[PHP] Fix the constant typemaps for SWIGTYPE, etc - previously
these used the wrong name for renamed constants. Add
autodoc_runme.php to the testsuite as a regression test for this.
2012-05-02: ianlancetaylor
[Go] Remove compatibility support for gccgo 4.6. Using
SWIG with gccgo will now require gccgo 4.7. Using SWIG
with the more commonly used gc compiler is unaffected.
2012-05-01: wsfulton
Fix generated code for C forward enum declarations in some languages.
Version 2.0.6 (30 April 2012)
=============================
2012-04-25: wsfulton
[Lua] Fix uninitialised variable in SWIGTYPE **OUTPUT typemaps as reported by Jim Anderson.
2012-04-28: wsfulton
[Python] Fix compilation errors when wrapping STL containers on Mac OS X and possibly other systems.
2012-04-28: wsfulton
[Java] Patch 3521811 from Leo Davis - char **STRING_ARRAY typemaps fixed to handle
null pointers.
Version 2.0.5 (19 April 2012)
=============================
2012-04-14: wsfulton
[Lua] Apply patch #3517435 from Miles Bader - prefer to use Lua_pushglobaltable
2012-04-14: wsfulton
[Ruby] Apply patch #3517769 from Robin Stocker to fix compile error on MacRuby using RSTRING_PTR.
2012-04-13: wsfulton
Apply patch #3511009 from Leif Middelschulte for slightly optimised char * variable wrappers.
2012-04-13: wsfulton
[Lua] Apply #3219676 from Shane Liesegang which adds:
- support for %factory
- a __tostring method
- a __disown method
2012-04-13: wsfulton
[Xml] Apply #3513569 which adds a catchlist to the xml output.
2012-04-05: olly
[Lua] Add support for Lua 5.2 (patch SF#3514593 from Miles Bader)
2012-03-26: xavier98
[octave] Apply patch #3425993 from jgillis: add extra logic to the octave_swig_type::dims(void) method: it checks if the user has defined a __dims__ method and uses this in stead of returning (1,1)
[octave] Apply patch #3424833 from jgillis: make is_object return true for swig types
2012-03-24: wsfulton
[D] Apply #3502431 to fix duplicate symbols in multiple modules.
2012-03-21: wsfulton
Fix #3494791 - %$isglobal for %rename matching.
2012-03-20: wsfulton
Fix #3487706 and #3391906 - missing stddef.h include for ptrdiff_t when using %import
for STL containers and compiling with g++-4.6. An include of stddef.h is now only
generated when SWIG generates STL helper templates which require ptrdiff_t. If you
were previously relying on "#include <stddef.h>" always being generated when using a
%include of an STL header, you may now need to add this in manually.
2012-03-16: wsfulton
Apply patch #3392264 from Sebastien Bine to parse (unsigned) long long types in enum value assignment.
2012-03-16: wsfulton
Apply patch #3505530 from Karl Wette to allow custom allocators in STL string classes for the UTL languages.
2012-03-13: wsfulton
Apply patch #3468362 from Karl Wette to fix %include inside %define.
2012-03-13: wsfulton
[Python, Ruby, Octave, R] Fix #3475492 - iterating through std::vector wrappers of enumerations.
2012-02-27: xavier98 (patches from Karl Wette)
[Octave] Use -globals . to load global variables in module namespace
[Octave] Comment declaration of unimplemented function swig_register_director
[Octave] Fix OCTAVE_PATH in octave Makefiles
[Octave] Add support for std::list - fix li_std_containers_int test
[Octave] Fix imports test
2012-02-16: wsfulton
[Java] Make generated support functions in arrays_java.i static so that generated code
from multiple instances of SWIG can be compiled and linked together - problem reported by
Evan Krause.
2012-01-24: wsfulton
Fix crash with bad regex - bug #3474250.
2012-01-24: wsfulton
[Python] Add Python stepped slicing support to the STL wrappers (std::vector, std::list).
Assigning to a slice, reading a slice and deleting a slice with steps now work.
For example:
%template(vector_i) std::vector<int>
vi = vector_i(range(10))
print list(vi)
vi[1:4:2] = [111, 333]
print list(vi)
del vi[3:10:3]
print list(vi)
print list(vi[::-1])
gives (same behaviour as native Python sequences such as list):
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 111, 2, 333, 4, 5, 6, 7, 8, 9]
[0, 111, 2, 4, 5, 7, 8]
[8, 7, 5, 4, 2, 111, 0]
2012-01-23: klickverbot
[D] Correctly annotate function pointers with C linkage.
[D] Exception and Error have become blessed names; removed d_exception_name test case.
2012-01-20: wsfulton
[Python] Fix some indexing bugs in Python STL wrappers when the index is negative, eg:
%template(vector_i) std::vector<int>
iv=vector_i([0,1,2,3,4,5])
iv[-7:]
now returns [0, 1, 2, 3, 4, 5] instead of [5].
vv[7:9] = [22,33]
now returns [0, 1, 2, 3, 4, 5, 22, 33] instead of "index out range" error.
Also fix some segfaults when replacing ranges, eg when il is a std::list wrapper:
il[0:2] = [11]
2012-01-17: wsfulton
[Go] Fix forward class declaration within a class when used as a base.
2012-01-07: wsfulton
[C#] Add support for %nspace when using directors.
2012-01-06: wsfulton
[Java] Patch #3452560 from Brant Kyser - add support for %nspace when using directors.
2011-12-21: wsfulton
The 'directorin' typemap now accepts $1, $2 etc expansions instead of having to use workarounds -
$1_name, $2_name etc.
2011-12-20: wsfulton
[Java] Add (char *STRING, size_t LENGTH) director typemaps.
2011-12-20: wsfulton
[C#, Go, Java, D] Add support for the 'directorargout' typemap.
2011-12-20: wsfulton
[Ocaml, Octave, PHP, Python, Ruby] Correct special variables in 'directorargout' typemap.
This change will break any 'directorargout' typemaps you may have written. Please change:
$result to $1
$input to $result
Also fix the named 'directorargout' DIRECTOROUT typemaps for these languages which didn't
previously compile and add in $1, $2 etc expansion.
*** POTENTIAL INCOMPATIBILITY ***
2011-12-10: talby
[perl5] SWIG_error() now gets decorated with perl source file/line number.
[perl5] error handling now conforms to public XS api (fixes perl v5.14 issue).
2011-12-10: wsfulton
[Android/Java] Fix directors to compile on Android.
Added documentation and examples for Android.
2011-12-08: vadz
Bug fix: Handle methods renamed or ignored in the base class correctly in the derived classes
(they could be sometimes mysteriously not renamed or ignored there before).
2011-12-03: klickverbot
[D] Fix exception glue code for newer DMD 2 versions.
[D] Do not default to 32 bit glue code for DMD anymore.
[D] Use stdc.config.c_long/c_ulong to represent C long types.
2011-12-01: szager
[python] Fixed bug 3447426: memory leak in vector.__getitem__.
2011-11-30: wsfulton
[R] Remove C++ comments from generated C code.
2011-11-27: olly
[Python] Fix some warnings when compiling generated wrappers with
certain GCC warning options (Debian bug #650246).
2011-11-28: wsfulton
Fix #3433541 %typemap(in, numinputs=0) with 10+ arguments.
2011-11-28: olly
[Perl] Fix warnings when compiling generated wrappers with certain
GCC warning options (Debian bug #436711).
2011-11-28: olly
[PHP] Update keyword list to include keywords added in PHP releases up to 5.3.
2011-11-25: wsfulton
[C#] Provide an easy way to override the default visibility for the proxy class pointer
constructors and getCPtr() method. The visibility is 'internal' by default and if multiple
SWIG modules are being used and compiled into different assemblies, then they need to be
'public' in order to use the constructor or getCPtr() method from a different assembly.
Use the following macros to change the visibilities in the proxy and type wrapper class:
SWIG_CSBODY_PROXY(public, public, SWIGTYPE)
SWIG_CSBODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
[Java] Provide an easy way to override the default visibility for the proxy class pointer
constructors and getCPtr() method. The visibility is 'protected' by default and if multiple
SWIG modules are being used and compiled into different packages, then they need to be
'public' in order to use the constructor or getCPtr() method from a different package.
Use the following macros to change the visibilities in the proxy and type wrapper class:
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
The default for Java has changed from public to protected for the proxy classes. Use the
SWIG_JAVABODY_PROXY macro above to restore to the previous visibilities.
*** POTENTIAL INCOMPATIBILITY ***
2011-11-22: szager
[python] Bug 3440044: #ifdef out SWIG_Python_NonDynamicSetAttr if -builtin
isn't being used, to avoid unnecessary binary incompatibilities between
python installations.
2011-11-17: wsfulton
Bug fix: Remove root directory from directory search list in Windows.
2011-11-13: wsfulton
[Ruby] Apply patch #3421876 from Robin Stocker to fix #3416818 - same class name in
different namespaces confusion when using multiple modules.
2011-11-11: wsfulton
Fix pcre-build.sh to work with non-compressed tarballs - problem reported by Adrian Blakely.
2011-11-03: wsfulton
Expand special variables in typemap warnings, eg:
%typemap(in, warning="1000:Test warning for 'in' typemap for $1_type $1_name") int "..."
2011-11-01: wsfulton
Fix named output typemaps not being used when the symbol uses a qualifier and contains
a number, eg:
%typemap(out) double ABC::m1 "..."
2011-10-24: talby
[perl5] SF bug #3423119 - overload dispatch stack corruption fix. Better, but more research
is needed on a stable path for tail calls in XS.
Also, fix for large long longs in 32 bit perl.
2011-10-13: xavier98
[octave] Allow Octave modules to be re-loaded after a "clear all".
2011-09-19: wsfulton
Fix regression introduced in swig-2.0.1 reported by Teemu Ikonone leading to uncompilable code
when using typedef and function pointer references, for example:
typedef int FN(const int &a, int b);
void *typedef_call1(FN *& precallback, FN * postcallback);
2011-09-14: wsfulton
[Lua] Patch #3408012 from Raman Gopalan - add support for embedded Lua (eLua)
including options for targeting Lua Tiny RAM (LTR).
2011-09-14: wsfulton
[C#] Add boost_intrusive_ptr.i library contribution from patch #3401571.
2011-09-13: wsfulton
Add warnings for badly named destructors, eg:
struct KStruct {
~NOT_KStruct() {}
};
cpp_extend_destructors.i:92: Warning 521: Illegal destructor name ~NOT_KStruct. Ignored.
2011-09-13: wsfulton
Fix %extend and destructors for templates. The destructor in %extend was not always wrapped,
for example:
%extend FooT {
~FooT() { delete $self; } // was not wrapped as expected
};
template<class T> class FooT {};
%template(FooTi) FooT<int>;
2011-09-13: wsfulton
Fix special variables such as "$decl" and "$fulldecl" in destructors to include the ~ character.
2011-09-10: talby
[perl5] SF bug #1481958 - Improve range checking for integer types.
Enhance li_typemaps_runme.pl
2011-09-08: wsfulton
Fix %extend on typedef classes in a namespace using the typedef name, for example:
namespace Space {
%extend CStruct {
...
}
typedef struct tagCStruct { ... } CStruct;
}
2011-08-31: xavier98
[octave] patches from Karl Wette: improvements to module loading behavior;
added example of friend operator to operator example; fixed octave panic/crash in 3.0.5;
documentation improvements
2011-08-30: szager
[python] Bug 3400486, fix error signalling for built-in constructors.
2011-08-26: wsfulton
[Go] Fix file/line number display for "gotype" when using typemap debugging options
-tmsearch and -tmused.
2011-08-26: wsfulton
[C#, D] Fix %callback which was generating uncompilable code.
2011-08-25: wsfulton
Fix constructors in named typedef class declarations as reported by Gregory Bronner:
typedef struct A {
A(){} // Constructor which was not accepted by SWIG
B(){} // NOT a constructor --illegal, but was accepted by SWIG
} B;
For C code, the fix now results in the use of 'struct A *' instead of just 'B *' in
the generated code when wrapping members in A, but ultimately this does not matter, as
they are the same thing.
2011-08-23: wsfulton
Fix %newobject when used in conjunction with %feature("ref") as reported by Jan Becker. The
code from the "ref" feature was not always being generated for the function specified by %newobject.
Documentation for "ref" and "unref" moved from Python to the C++ chapter.
2011-08-22: szager
[python] Fixed memory leak with --builtin option (bug 3385089).
2011-08-22: wsfulton
[Lua] SF patch #3394339 from Torsten Landschoff - new option -nomoduleglobal to disable installing
the module table into the global namespace. Require call also returns the module table instead
of a string.
2011-08-09: xavier98
Fix bug 3387394; Octave patches for 3.4.0 compatibility, etc. (from Karl Wette)
2011-08-04: wsfulton
Add in $symname expansion for director methods.
2011-07-29: olly
[PHP] Don't generate "return $r;" in cases where $r hasn't been set.
This was basically harmless, except it generated a PHP E_NOTICE if
the calling code had enabled them.
2011-07-26: wsfulton
Fix scoping of forward class declarations nested within a class (for C++). Previously the symbol
was incorrectly put into the outer namespace, eg
namespace std {
template<class Key, class T> struct map {
class iterator;
};
}
iterator was scoped as std::iterator, but now it is correctly std::map<Key, T>::iterator;
Also fixed is %template and template parameters that are a typedef when the template contains
default template parameters, eg:
namespace Std {
template<class Key, class T, class C = int> struct Map {
typedef Key key_type;
typedef T mapped_type;
};
}
typedef double DOUBLE;
%template(MM) Std::Map<int, DOUBLE>;
All symbols within Map will be resolved correctly, eg key_type and mapped_type no matter if the
wrapped code uses Std::Map<int, double> or std::Map<int, DOUBLE> or Std::Map<int, double, int>
Also fixes bug #3378145 - regression introduced in 2.0.4 - %template using traits.
2011-07-20 szager
[python] Fix closure for tp_call slot.
2011-07-16: wsfulton
[python] Fix director typemap using PyObject *.
2011-07-13: szager
[python] SF patch #3365908 - Add all template parameters to map support code in std_map.i
2011-07-13: szager
[python] Fix for bug 3324753: %rename member variables with -builtin.
2011-07-01: wsfulton
Fix some scope and symbol lookup problems when template default parameters are being
used with typedef. For example:
template<typename XX, typename TT = SomeType> struct Foo {
typedef XX X;
typedef TT T;
};
template<typename TT> struct UsesFoo {
void x(typename Foo<TT>::T, typename Foo<TT>::X);
};
Also fixes use of std::vector<int>::size_type for Python as reported by Aubrey Barnard.
2011-06-23: olly
[PHP] Fix director code to work when PHP is built with ZTS enabled,
which is the standard configuration on Microsoft Windows.
2011-06-21: mutandiz
[allegrocl]
- various small tweaks and bug fixes.
- Avoid name conflicts between smart pointer wrappers and the wrappers for
the actual class.
- Fix default typemaps for C bindings, which were incorrectly attempting to
call non-existent destructors on user-defined types.
- New feature, feature:aclmixins, for adding superclass to the foreign class
wrappers.
- Improve longlong typemaps.
2011-06-19: wsfulton
Fix incorrect typemaps being used for a symbol within a templated type, eg:
A<int>::value_type would incorrectly use a typemap for type A.
2011-06-18: olly
[Tcl] Fix variable declarations in middle of blocks which isn't
permitted in C90 (issue probably introduced in 2.0.3 by patch #3224663).
Reported by Paul Obermeier in SF#3288586.
2011-06-17: wsfulton
[Java] SF #3312505 - slightly easier to wrap char[] or char[ANY] with a Java byte[]
using arrays_java.i.
2011-06-13: wsfulton
[Ruby, Octave] SF #3310528 Autodoc fixes similar to those described below for Python.
2011-06-10: wsfulton
[Python] Few subtle bugfixes in autodoc documentation generation,
- Unnamed argument names fix for autodoc levels > 0.
- Display of template types fixed for autodoc levels > 1.
- Fix SF #3310528 - display of typedef structs for autodoc levels > 1.
- Add missing type for self for autodoc levels 1 and 3.
- autodoc levels 2 and 3 documented.
- Minor tweaks to autodoc style to conform with PEP8.
2011-05-30: olly
[PHP] Fix handling of directors when -prefix is used.
2011-05-24: olly
[PHP] Fix handling of methods of classes with a virtual base class (SF#3124665).
Version 2.0.4 (21 May 2011)
===========================
2011-05-19: wsfulton
[Guile] Patch #3191625 fixing overloading of integer types.
2011-05-19: wsfulton
[Perl] Patch #3260265 fixing overloading of non-primitive types and integers in
Perl 5.12 and later.
2011-05-19: wsfulton
[Ruby] Fix %import where one of the imported files %include one of the STL include
files such as std_vector.i.
2011-05-17: wsfulton
[Java] Apply #3289851 from Alan Harder to fix memory leak in directors when checking
for pending exceptions.
2011-05-17: wsfulton
[Tcl] Apply #3300072 from Christian Delbaere to fix multiple module loading not
always sharing variables across modules.
2011-05-16: xavier98
[octave] Fix an incompatibility with never versions of Octave. Case on Octave
API >= 40 to handle rename of Octave_map to octave_map.
[octave] Add support for y.__rop__(x) operators when x.__op__(y) doesn't exist.
[octave] Allow global operators to be defined by SWIG-wrapped functions.
[octave] Fix several bugs around module namespaces; add -global, -noglobal,
-globals <name> command line options to the module.
2011-05-14: wsfulton
%varargs when used with a numeric argument used to create an additional argument
which was intended to provide a guaranteed sentinel value. This never worked and now
the additional argument is not generated.
2011-05-13: wsfulton
[python] Additional fixes for python3.2 support.
2011-05-07: szager
[python] Fixed PyGetSetDescr for python3.2.
2011-05-05: wsfulton
[Lua, Python, Tcl] C/C++ prototypes shown in error message when calling an overloaded
method with incorrect arguments improved to show always show fully qualified name
and if a const method.
Also fixed other Lua error messages in generated code which weren't consistently
using the fully qualified C++ name - requested by Gedalia Pasternak.
2011-04-29: szager
Bug 2635919: Convenience method to convert std::map to a python dict.
2011-04-29: szager
[Python] Fixed bug 2811549: return non-const iterators from STL
methods begin(), end(), rbegin(), rend().
2011-04-25: szager
[Python] Fixed bug 1498929: Access to member fields in map elements
2011-04-23: klickverbot
[D] nspace: Correctly generate identifiers for base classes when
not in split proxy mode.
2011-04-13: szager
Fixed bug 3286333: infinite recursion with mutual 'using namespace' clauses.
2011-04-12: szager
Fixed bug 1163440: vararg typemaps.
2011-04-12: szager
Fixed bug #3285386: parse error from 'operator T*&()'. Added operator_pointer_ref
test case to demonstrate.
2011-04-11: szager
[Python] Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about
static initialization of struct members with pointers.
2011-04-11: wsfulton
[Tcl] Apply patch #3284326 from Colin McDonald to fix some compiler warnings.
2011-04-11: szager
[Python] Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about
static initialization of struct members with pointers.
2011-04-10: klickverbot
[D] Fixed wrapping of enums that are type char, for example:
enum { X = 'X'; } (this was already in 2.0.3 for C# and Java)
2011-04-10: klickverbot
[D] nspace: Fixed referencing types in the root namespace when
not in split proxy mode.
2011-04-09: szager
[Python] Applied patch #1932484: migrate PyCObject to PyCapsule.
2011-04-09: szager
[Python] Added preprocessor guards for python functions PyUnicode_AsWideChar and
PySlice_GetIndices, which changed signatures in python3.2.
2011-04-07: wsfulton
Fix wrapping of const array typedefs which were generating uncompilable code as
reported by Karl Wette.
2011-04-03: szager
[Python] Fixed the behavior of %pythonnondynamic to conform to the spec in Lib/pyuserdir.swg.
2011-04-03: szager
[Python] Merged in the szager-python-builtin branch, adding the -builtin feature
for python. The -builtin option may provide a significant performance gain
in python wrappers. For full details and limitations, refer to Doc/Manual/Python.html.
A small test suite designed to demonstrate the performance gain is in
Examples/python/performance.
2011-04-01: wsfulton
Add in missing wrappers for friend functions for some target languages, mostly
the non-scripting languages like Java and C#.
Version 2.0.3 (29 March 2011)
=============================
2011-03-29: wsfulton
[R] Apply patch #3239076 from Marie White fixing strings for R >= 2.7.0
2011-03-29: wsfulton
[Tcl] Apply patch #3248280 from Christian Delbaere which adds better error messages when
the incorrect number or type of arguments are passed to overloaded methods.
2011-03-29: wsfulton
[Tcl] Apply patch #3224663 from Christian Delbaere.
1. Fix when function returns a NULL value, a "NULL" command will be created in the Tcl interpreter
and calling this command will cause a segmentation fault.
2. Previous implementation searches for class methods using a linear search causing performance issues
in wrappers for classes with many member functions. The patch adds a method hash table to classes and
changes method name lookup to use the hash table instead of doing a linear search.
2011-03-26: wsfulton
[C#, Java] SF bug #3195112 - fix wrapping of enums that are type char, for example:
enum { X = 'X'; }
2011-03-21: vadz
Allow setting PCRE_CFLAGS and PCRE_LIBS during configuration to override the values returned by
pcre-config, e.g. to allow using a static version of PCRE library.
2011-03-17: wsfulton
[UTL] Add missing headers in generated STL wrappers to fix compilation with gcc-4.6.
2011-03-17: wsfulton
Fix regression introduced in swig-2.0.2 where filenames with spaces were not found
when used with %include and %import. Reported by Shane Liesegang.
2011-03-15: wsfulton
[UTL] Fix overloading when using const char[], problem reported by David Maxwell.
Similarly for char[ANY] and const char[ANY].
2011-03-15: wsfulton
[C#] Apply patch #3212624 fixing std::map Keys property.
2011-03-14: olly
[PHP] Fix handling of overloaded methods/functions where some
return void and others don't - whether this worked or not depended
on the order they were encountered in (SF#3208299).
2011-03-13: klickverbot
[D] Extended support for C++ namespaces (nspace feature).
2011-03-12: olly
[PHP] Fix sharing of type information between multiple SWIG-wrapped
modules (SF#3202463).
2011-03-09: wsfulton
[Python] Fix SF #3194294 - corner case bug when 'NULL' is used as the default value
for a primitive type parameter in a method declaration.
2011-03-07: olly
[PHP] Don't use zend_error_noreturn() for cases where the function
returns void - now this issue can only matter if you have a function
or method which is directed and returns non-void.
2011-03-06: olly
[PHP] Add casts to the typemaps for long long and unsigned long
long to avoid issues when they are used with shorter types via
%apply.
2011-03-02: wsfulton
Templated smart pointers overloaded with both const and non const operator-> generated uncompilable
code when the pointee was a class with either public member variables or static methods.
Regression in 2.0.x reported as working in 1.3.40 by xantares on swig-user mailing list.
Version 2.0.2 (20 February 2011)
================================
2011-02-19: wsfulton
[PHP] Add missing INPUT, OUTPUT and INOUT typemaps in the typemaps.i library
for primitive reference types as well as signed char * and bool *.
2011-02-19: olly
[PHP] Address bug in PHP on some platforms/architectures which
results in zend_error_noreturn() not being available using
SWIG_ZEND_ERROR_NORETURN which defaults to zend_error_noreturn but
can be overridden when building the module by passing
-DSWIG_ZEND_ERROR_NORETURN=zend_error to the compiler. This may
result in compiler warnings, but should at least allow a module
to be built on those platforms/architectures (SF#3166423).
2011-02-18: wsfulton
Fix #3184549 - vararg functions and function overloading when using the -fastdispatch option.
2011-02-18: olly
[PHP] An overloaded method which can return an object or a
primitive type no longer causes SWIG to segfault. Reported by Paul
Colby in SF#3168531.
2011-02-18: olly
[PHP] Fix invalid erase during iteration of std::map in generated
director code. Reported by Cory Bennett in SF#3175820.
2011-02-17: wsfulton
Preprocessing now warns if extra tokens appear after #else and #end.
2011-02-16: wsfulton
Fix #1653092 Preprocessor does not error out when #elif is missing an expression.
This and other cases of missing preprocessor expressions now result in an error.
2011-02-14: wsfulton
[Ocaml] Apply patch #3151788 from Joel Reymont. Brings Ocaml support up to date
(ver 3.11 and 3.12), including std::string.
2011-02-13: wsfulton
[Ruby] Apply patch #3176274 from James Masters - typecheck typemap for time_t.
2011-02-13: wsfulton
Apply patch #3171793 from szager - protected director methods failing when -fvirtual is used.
2011-02-13: wsfulton
Fix #1927852 - #include directives don't preprocess the file passed to it. The fix is for
#include with -importall or -includeall, %include and %import, for example:
#define FILENAME "abc.h"
%include FILENAME
2011-02-12: wsfulton
Fix #1940536, overactive preprocessor which was expanding defined(...) outside of #if and #elif
preprocessor directives.
2011-02-05: wsfulton
[MzScheme] SF #2942899 Add user supplied documentation to help getting started with MzScheme.
Update chapter name to MzScheme/Racket accounting for the rename of MzScheme to Racket.
2011-02-05: wsfulton
[C#] SF #3085906 - Possible fix running test-suite on Mac OS X.
2011-02-05: wsfulton
SF #3173367 Better information during configure about Boost prerequisite for running
the test-suite.
2011-02-05: wsfulton
SF #3127633 Fix infinite loop in recursive typedef resolution.
2011-02-04: wsfulton
[R] SF #3168676 Fix %rename not working for member variables and methods.
2011-02-04: wsfulton
[clisp] SF #3148200 Fix segfault parsing nested unions.
2011-02-01: wsfulton
[C#] Directors - a call to a method being defined in the base class, not
overridden in a subclass, but again overridden in a class derived from
the first subclass was not being dispatched correctly to the most derived class.
See director_alternating.i for an example.
2011-02-01: wsfulton
[C#, Java] Any 'using' statements in the protected section of a class were previously
ignored with director protected (dirprot) mode.
2011-01-30: wsfulton
Fix overloading with const pointer reference (SWIGTYPE *const&) parameters for a
number of scripting languages.
2011-01-17: wsfulton
New warning for smart pointers if only some of the classes in the inheritance
chain are marked as smart pointer, eg, %shared_ptr should be used for all classes
in an inheritance hierarchy, so this new warning highlights code where this is
not the case.
example.i:12: Warning 520: Base class 'A' of 'B' is not similarly marked as a smart pointer.
example.i:16: Warning 520: Derived class 'C' of 'B' is not similarly marked as a smart pointer.
2011-01-14: wsfulton
Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and
(char *STRING, int LENGTH). Documentation for this updated. Java patch from
Volker Grabsch.
2011-01-11: iant
Require Go version 7077 or later.
2010-12-30: klickverbot
[C#, D, Java] Check for collision of parameter names with target
language keywords when generating the director glue code.
The situation in which the generated could would previously be
invalid is illustrated in the new 'director_keywords' test case.
2010-12-23: wsfulton
[C#] Fix $csinput special variable not being expanded for csvarin typemaps
when used for global variables. Reported by Vadim Zeitlin.
2010-12-14: wsfulton
Fix $basemangle expansion in array typemaps. For example if type is int *[3],
$basemangle expands to _p_int.
2010-12-07: iant
Check that we are using a sufficiently new version of the
6g or 8g Go compiler during configure time. If not, disable Go.
Minimum version is now 6707.
*** POTENTIAL INCOMPATIBILITY ***
2010-12-06: wsfulton
Fix #3127394 - use of network paths on Windows/MSys.
2010-11-18: klickverbot
[D] Added the D language module.
2010-11-12: vadz
Fix handling of multiple regex-using %renames attached to the same
declaration. For example, now
%rename("%(regex:/^Set(.*)/put\\1/)s") "";
%rename("%(regex:/^Get(.*)/get\\1/)s") "";
works as expected whereas before only the last anonymous rename was
taken into account.
2010-10-17: drjoe
[R] Fix failure in overloaded functions which was breaking
QuantLib-SWIG
2010-10-14: olly
[PHP] Allow compilation on non-conforming Microsoft C++ compilers
which don't accept: return function_returning_void();
Reported by Frank Vanden Berghen on the SWIG mailing list.
2010-10-12: wsfulton
Fix unary scope operator (::) (global scope) regression introduced in 2.0.0, reported by
Ben Walker. The mangled symbol names were incorrect, sometimes resulting in types being
incorrectly treated as opaque types.
Also fixes #2958781 and some other type problems due to better typedef resolution, eg
std::vector<T *>::value_type didn't resolve to T * when it should have. The mangled type
was incorrectly SWIGTYPE_std__vectorT_Test_p_std__allocatorT_Test_p_t_t__value_type and now
it is correctly SWIGTYPE_p_Test.
Version 2.0.1 (4 October 2010)
==============================
2010-10-03: wsfulton
Apply patch #3066958 from Mikael Johansson to fix default smart pointer
handling when the smart pointer contains both a const and non-const operator->.
2010-10-01: wsfulton
Add -pcreversion option to display PCRE version information.
2010-10-01: olly
[Ruby] Avoid segfault when a method node has no parentNode
(SF#3034054).
2010-10-01: olly
[Python] Allow reinitialisation to work with an embedded Python
interpreter (patch from Jim Carroll in SF#3075178).
2010-09-28: wsfulton
[C#] Apply patch from Tomas Dirvanauskas for std::map wrappers to avoid
throwing exceptions with normal usage of iterators.
2010-09-27: olly
[Python] Improve error message given when a parameter of the wrong
type is passed to an overloaded method (SF#3027355).
2010-09-25: wsfulton
Apply SF patch #3075150 - Java directors using static variables in
named namespace.
2010-09-24: wsfulton
More file and line error/warning reporting fixes where SWIG macros
are used within {} braces (where the preprocessor expands macros),
for example macros within %inline {...} and %fragment(...) {...}
and nested structs.
2010-09-18: wsfulton
More file and line error/warning reporting fixes for various inherited
class problems.
2010-09-15: wsfulton
A much improved debugging of SWIG source experience is now available and
documented in the "Debugging SWIG" section in the Doc/Devel/internals.html
file, including a swig.dbg support file for the gdb debugger.
2010-09-11: wsfulton
Fix incorrect line number reporting in errors/warnings when a macro
definition ends with '/' and it is not the end of a C comment.
2010-09-11: wsfulton
Fix incorrect line number reporting in errors/warnings after parsing
macro invocations with parameters given over more than one line.
2010-09-10: wsfulton
Remove extraneous extra line in preprocessed output after including files
which would sometimes lead to error/warning messages two lines after the
end of the file.
2010-09-10: wsfulton
Fix #2149523 - Incorrect line number reporting in errors after parsing macros
containing C++ comments.
2010-09-08: olly
[PHP] Fix handling of OUTPUT typemaps (Patch from Ryan in SF#3058394).
2010-09-03: wsfulton
Fix erroneous line numbers in error messages for macro expansions, for example,
the error message now points to instantiation of the macro, ie the last line here:
#define MACRO2(a, b)
#define MACRO1(NAME) MACRO2(NAME,2,3)
MACRO1(abc)
2010-09-02: wsfulton
Fix line numbers in error and warning messages for preprocessor messages within
%inline, for example:
%inline %{
#define FOOBAR 1
#define FOOBAR "hi"
%}
2010-09-02: wsfulton
Fix line numbers in error and warning messages which were cumulatively one
less than they should have been after parsing each %include/%import - bug
introduced in swig-1.3.32. Also fix line numbers in error and warning messages
when new line characters appear between the %include / %import statement and
the filename.
2010-08-30: wsfulton
Fix line number and file name reporting for some macro preprocessor warnings.
The line number of the macro argument has been corrected and the line number
of the start of the macro instead of one past the end of the macro is used.
Some examples:
file.h:11: Error: Illegal macro argument name '..'
file.h:19: Error: Macro 'DUPLICATE' redefined,
file.h:15: Error: previous definition of 'DUPLICATE'.
file.h:25: Error: Variable-length macro argument must be last parameter
file.h:32: Error: Illegal character in macro argument name
file.i:37: Error: Macro 'SIT' expects 2 arguments
2010-08-26: wsfulton
Fix __LINE__ and __FILE__ expansion reported by Camille Gillot. Mostly this
did not work at all. Also fixes SF #2822822.
2010-08-17: wsfulton
[Perl] Fix corner case marshalling of doubles - errno was not being correctly
set before calling strtod - patch from Justin Vallon - SF Bug #3038936.
2010-08-17: wsfulton
Fix make distclean when some of the more obscure languages are detected by
configure - fixes from Torsten Landschoff.
2010-07-28: wsfulton
Restore configuring out of source for the test-suite since it broke in 1.3.37.
As previously, if running 'make check-test-suite' out of source, it needs to be
done by invoking configure with a relative path. Invoking configure with an
absolute path will not work. Running the full 'make check' still needs to be
done in the source tree.
2010-07-16: wsfulton
Fix wrapping of function pointers and member function pointers when the function
returns by reference.
2010-07-13: vadz
Removed support for the old experimental "rxspencer" encoder and
"[not]rxsmatch" in %rename (see the 01/16/2006 entry). The new and
officially supported "regex" encoder and "[not]regexmatch" checks
should be used instead (see the two previous entries). Please
replace "%(rxspencer:[pat][subst])s" with "%(regex:/pat/subst/)s"
when upgrading. Notice that you will also need to replace the back-
references of form "@1" with the more standard "\\1" and may need to
adjust your regular expressions syntax as the new regex encoder uses
Perl-compatible syntax and not (extended) POSIX syntax as the old one.
*** POTENTIAL INCOMPATIBILITY ***
2010-07-13: vadz
Add "regexmatch", "regextarget" and "notregexmatch" which can be
used to apply %rename directives to the declarations matching the
specified regular expression only. The first two can be used
interchangeably, both of the %renames below do the same thing:
%rename("$ignore", regexmatch$name="Old$") "";
%rename("$ignore", regextarget=1) "Old$";
(namely ignore the declarations having "Old" suffix).
"notregexmatch" restricts the match to only the declarations which
do not match the regular expression, e.g. here is how to rename to
lower case versions all declarations except those consisting from
capital letters only:
%rename("$(lowercase)s", notregexmatch$name="^[A-Z]+$") "";
2010-07-13: vadz
Add the new "regex" encoder that can be used in %rename, e.g.
%rename("regex:/(\\w+)_(.*)/\\2/") "";
to remove any alphabetical prefix from all identifiers. The syntax
of the regular expressions is Perl-like and PCRE library
(http://www.pcre.org/) is used to implement this feature but notice
that backslashes need to be escaped as usual inside C strings.
Original patch from Torsten Landschoff.
2010-07-08: wsfulton
Fix #3024875 - shared_ptr of classes with non-public destructors. This also fixes
the "unref" feature when used on classes with non-public destructors.
2010-06-17: ianlancetaylor
[Go] Add the Go language module.
2010-06-10: wsfulton
[Lua] Fix SWIG_lua_isnilstring multiply defined when using multiple
modules and wrapping strings. Patch from 'Number Cruncher'.
2010-06-10: olly
[PHP] Fix directors to correctly call a method with has a
different name in PHP to C++ (we were always using the C++ name
in this case).
2010-06-03: wsfulton
Fix uncompilable code when %rename results in two enum items
with the same name. Reported by Vadim Zeitlin.
Version 2.0.0 (2 June 2010)
===========================
2010-06-02: wsfulton
[C#] Fix SWIG_STD_VECTOR_ENHANCED macro used in std::vector to work with
types containing commas, for example:
SWIG_STD_VECTOR_ENHANCED(std::pair< double, std::string >)
2010-06-01: wsfulton
Add in std_shared_ptr.i for wrapping std::shared_ptr. Requires the %shared_ptr
macro like in the boost_shared_ptr.i library. std::tr1::shared_ptr can also be
wrapped if the following macro is defined:
#define SWIG_SHARED_PTR_SUBNAMESPACE tr1
%include <std_shared_ptr.i>
shared_ptr is also documented in Library.html now.
2010-05-27: wsfulton
Add the ability for $typemap special variable macros to call other $typemap
special variable macros, for example:
%typemap(cstype) CC "CC"
%typemap(cstype) BB "$typemap(cstype, CC)"
%typemap(cstype) AA "$typemap(cstype, BB)"
void hah(AA aa);
This also fixes C# std::vector containers of shared_ptr and %shared_ptr.
Also added diagnostics for $typemap with -debug-tmsearch, for example, the
above displays additional diagnostic lines starting "Containing: ":
example.i:34: Searching for a suitable 'cstype' typemap for: AA aa
Looking for: AA aa
Looking for: AA
Using: %typemap(cstype) AA
Containing: $typemap(cstype, BB)
example.i:31: Searching for a suitable 'cstype' typemap for: BB
Looking for: BB
Using: %typemap(cstype) BB
Containing: $typemap(cstype, CC)
example.i:29: Searching for a suitable 'cstype' typemap for: CC
Looking for: CC
Using: %typemap(cstype) CC
2010-05-26: olly
Fix %attribute2ref not to produce a syntax error if the last
argument (AccessorMethod) is omitted. Patch from David Piepgras
in SF#2235756.
2010-05-26: olly
[PHP] When using %throws or %catches, SWIG-generated PHP5 wrappers
now throw PHP Exception objects instead of giving a PHP error of
type E_ERROR.
This change shouldn't cause incompatibility issues, since you can't
set an error handler for E_ERROR, so previously PHP would just exit
which also happens for unhandled exceptions. The benefit is you can
now catch them if you want to.
Fixes SF#2545578 and SF#2955522.
2010-05-25: olly
[PHP] Add missing directorin typemap for const std::string &.
Fixes SF#3006404 reported by t-Legiaw.
2010-05-23: wsfulton
[C#] Fix #2957375 - SWIGStringHelper and SWIGExceptionHelper not always being
initialized before use in .NET 4 as the classes were not marked beforefieldinit.
A static constructor has been added to the intermediary class like this:
%pragma(csharp) imclasscode=%{
static $imclassname() {
}
%}
If you had added your own custom static constructor to the intermediary class in
the same way as above, you will have to modify your approach to use static variable
initialization or define SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR - See csharphead.swg.
*** POTENTIAL INCOMPATIBILITY ***
2010-05-23: wsfulton
Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an
inheritance hierarchy. No special treatment is needed for derived classes.
The proxy class also no longer needs to be specified, it is automatically
deduced. The following macros are deprecated:
SWIG_SHARED_PTR(PROXYCLASS, TYPE)
SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
and have been replaced by
%shared_ptr(TYPE)
Similarly for intrusive_ptr wrappers, the following macro is deprecated:
SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE)
SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
and have been replaced by
%intrusive_ptr(TYPE)
2010-05-21: olly
[PHP] Stop generating a bogus line of code in certain constructors.
This was mostly harmless, but caused a PHP notice to be issued, if
enabled (SF#2985684).
2010-05-18: wsfulton
[Java] Fix member pointers on 64 bit platforms.
2010-05-14: wsfulton
Fix wrapping of C++ enum boolean values reported by Torsten Landschoff:
typedef enum { PLAY = true, STOP = false } play_state;
2010-05-14: olly
[PHP] Fix wrapping of global variables which was producing
uncompilable code in some cases.
2010-05-12: drjoe
[R] Add two more changes from Wil Nolan. Get garbage
collection to work. Implement newfree
2010-05-09: drjoe
Fix bug reported by Wil Nolan change creation of string so
that R 2.7.0+ can use char hashes
2010-05-07: wsfulton
Apply patch #2955146 from Sergey Satskiy to fix expressions containing divide by
operator in constructor initialization lists.
2010-05-05: wsfulton
[R] Memory leak fix handling const std::string & inputs, reported by Will Nolan.
2010-05-01: wsfulton
Typemap matching enhancement for non-default typemaps. Previously all
qualifiers were stripped in one step, now they are stripped one at a time
starting with the left most qualifier. For example, int const*const
is first stripped to int *const then int *.
*** POTENTIAL INCOMPATIBILITY ***
2010-04-25: bhy
[Python] Fix #2985655 - broken constructor renaming.
2010-04-14: wsfulton
Typemap fragments are now official and documented in Typemaps.html.
2010-04-09: wsfulton
[Ruby] Fix #2048064 and #2408020.
Apply Ubuntu patch to fix Ruby and std::vector wrappers with -minherit.
https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/522874
2010-04-09: wsfulton
[Mzscheme] Apply Ubuntu patch to fix std::map wrappers:
https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/203876
2010-04-09: wsfulton
[Python] Apply patch #2952374 - fix directors and the -nortti option.
2010-04-09: wsfulton
[Lua] Fix #2887254 and #2946032 - SWIG_Lua_typename using wrong stack index.
2010-04-03: wsfulton
[Python] Fix exceptions being thrown with the -threads option based on patch from Arto Vuori.
Fixes bug #2818499.
2010-04-03: wsfulton
Fix Makefile targets: distclean and maintainer-clean
2010-04-02: wsfulton
[Lua] Fix char pointers, wchar_t pointers and char arrays so that nil can be passed as a
valid value. Bug reported by Gedalia Pasternak.
2010-04-01: wsfulton
Numerous subtle typemap matching rule fixes when using the default type. The typemap
matching rules are to take a type and find the best default typemap (SWIGTYPE, SWIGTYPE* etc),
then look for the next best match by reducing the chosen default type. The type deduction
now follows C++ class template partial specialization matching rules.
Below are the set of changes made showing the default type deduction
along with the old reduced type and the new version of the reduced type:
SWIGTYPE const &[ANY]
new: SWIGTYPE const &[]
old: SWIGTYPE (&)[ANY]
SWIGTYPE *const [ANY]
new: SWIGTYPE const [ANY]
old: SWIGTYPE *[ANY]
SWIGTYPE const *const [ANY]
new: SWIGTYPE *const [ANY]
old: SWIGTYPE const *[ANY]
SWIGTYPE const *const &
new: SWIGTYPE *const &
old: SWIGTYPE const *&
SWIGTYPE *const *
new: SWIGTYPE const *
old: SWIGTYPE **
SWIGTYPE *const &
new: SWIGTYPE const &
old: SWIGTYPE *&
Additionally, a const SWIGTYPE lookup is used now for any constant type. Some examples, where
T is some reduced type, eg int, struct Foo:
T const
new: SWIGTYPE const
old: SWIGTYPE
T *const
new: SWIGTYPE *const
old: SWIGTYPE *
T const[]
new: SWIGTYPE const[]
old: SWIGTYPE[]
enum T const
new: enum SWIGTYPE const
old: enum SWIGTYPE
T (*const )[]
new: SWIGTYPE (*const )[]
old: SWIGTYPE (*)[]
Reminder: the typemap matching rules can now be seen for any types being wrapped by using
either the -debug-tmsearch or -debug-tmused options.
In practice this leads to some subtle matching rule changes and the majority of users
won't notice any changes, except in the prime area of motivation for this change: Improve
STL containers of const pointers and passing const pointers by reference. This is fixed
because many of the STL containers use a type 'T const&' as parameters and when T is
a const pointer, for example, 'K const*', then the full type is 'K const*const&'. This
means that the 'SWIGTYPE *const&' typemaps now match when T is either a non-const or
const pointer. Furthermore, some target languages incorrectly had 'SWIGTYPE *&' typemaps
when these should have been 'SWIGTYPE *const&'. These have been corrected (Java, C#, Lua, PHP).
*** POTENTIAL INCOMPATIBILITY ***
2010-03-13: wsfulton
[Java] Some very old deprecated pragma warnings are now errors.
2010-03-13: wsfulton
Improve handling of file names and directories containing double/multiple path separators.
2010-03-10: mutandiz (Mikel Bancroft)
[allegrocl] Use fully qualified symbol name of cl::identity in emit_defun().
2010-03-06: wsfulton
[Java] The intermediary JNI class modifiers are now public by default meaning these
intermediary low level functions are now accessible by default from outside any package
used. The proxy class pointer constructor and getCPtr() methods are also now public.
These are needed in order for the nspace option to work without any other mods.
The previous default of protected access can be restored using:
SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
%pragma(java) jniclassclassmodifiers = "class"
2010-03-06: wsfulton
[C#] Added the nspace feature for C#. Documentation for the nspace feature is now available.
2010-03-04: wsfulton
Added the nspace feature. This adds some improved namespace support. Currently only Java
is supported for target languages, where C++ namespaces are automatically translated into
Java packages. The feature only applies to classes,struct,unions and enums declared within
a namespace. Methods and variables declared in namespaces still effectively have their
namespaces flattened. Example usage:
%feature(nspace) Outer::Inner1::Color;
%feature(nspace) Outer::Inner2::Color;
namespace Outer {
namespace Inner1 {
struct Color {
...
};
}
namespace Inner2 {
struct Color {
...
};
}
}
For Java, the -package option is also required when using the nspace feature. Say
we use -package com.myco, the two classes can then be accessed as follows from Java:
com.myco.Outer.Inner1.Color and com.myco.Outer.Inner2.Color.
2010-02-27: wsfulton
[Python] Remove -dirvtable from the optimizations included by -O as it this option
currently leads to memory leaks as reported by Johan Blake.
2010-02-27: wsfulton
License code changes: SWIG Source is GPL-v3 and library code license is now clearer
and is provided under a very permissive license. See http://www.swig.org/legal.html.
2010-02-13: wsfulton
[Ruby] A few fixes for compiling under ruby-1.9.x including patch from 'Nibble'.
2010-02-13: wsfulton
[Ruby] Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x
used in various STL wrappers.
2010-02-13: wsfulton
[C#, Java] Fix incorrect multiply defined symbol name error when an enum item
and class name have the same name, as reported by Nathan Krieger. Example:
class Vector {};
namespace Text {
enum Preference { Vector };
}
This also fixes other incorrect corner case target language symbol name clashes.
2010-02-11: wsfulton
Add the -debug-lsymbols option for displaying the target language layer symbols.
2010-02-09: wsfulton
Fix -MM and -MMD options on Windows. They were not omitting files in the SWIG library as
they should be.
2010-02-08: wsfulton
Fix #1807329 - When Makefile dependencies are being generated using the -M family of options
on Windows, the file paths have been corrected to use single backslashes rather than double
backslashes as path separators.
2010-02-06: wsfulton
Fix #2918902 - language specific files not being generated in correct directory on
Windows when using forward slashes for -o, for example:
swig -python -c++ -o subdirectory/theinterface_wrap.cpp subdirectory/theinterface.i
2010-02-05: wsfulton
Fix #2894405 - assertion when using -xmlout.
2010-01-28: wsfulton
Fix typemap matching bug when a templated type has a typemap both specialized and not
specialized. For example:
template<typename T> struct XX { ... };
%typemap(in) const XX & "..."
%typemap(in) const XX< int > & "..."
resulted in the 2nd typemap being applied for all T in XX< T >.
2010-01-22: wsfulton
Fix #2933129 - typemaps not being found when the unary scope operator (::) is used to denote
global scope, the typemap is now used in situations like this:
struct X {};
%typemap(in) const X & "..."
void m(const ::X &);
and this:
struct X {};
%typemap(in) const ::X & "..."
void m(const X &);
2010-01-20: wsfulton
Fix some unary scope operator (::) denoting global scope problems in the types generated
into the C++ layer. Previously the unary scope operator was dropped in the generated code
if the type had any sort of qualifier, for example when using pointers, references, like
::foo*, ::foo&, bar< ::foo* >.
2010-01-13: olly
[PHP] Add datetime to the list of PHP predefined classes (patch
from David Fletcher in SF#2931042).
2010-01-11: wsfulton
Slight change to warning, error and diagnostic reporting. The warning number is no
longer shown within brackets. This is to help default parsing of warning messages by
other tools, vim on Unix in particular.
Example original display using -Fstandard:
example.i:20: Warning(401): Nothing known about base class 'B'. Ignored.
New display:
example.i:20: Warning 401: Nothing known about base class 'B'. Ignored.
Also subtle fix to -Fmicrosoft format adding in missing space. Example original display:
example.i(20): Warning(401): Nothing known about base class 'Base'. Ignored.
New display:
example.i(20) : Warning 401: Nothing known about base class 'Base'. Ignored.
2010-01-10: wsfulton
Fix a few inconsistencies in reporting of file/line numberings including modifying
the overload warnings 509, 512, 516, 474, 475 to now be two line warnings.
2010-01-10: wsfulton
Modify -debug-tags output to use standard file name/line reporting so that editors
can easily navigate to the appropriate lines.
Was typically:
. top . include . include (/usr/share/swig/temp/trunk/Lib/swig.swg:312)
. top . include . include . include (/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39)
now:
/usr/share/swig/temp/trunk/Lib/swig.swg:312: . top . include . include
/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39: . top . include . include . include
2010-01-03: wsfulton
Fix missing file/line numbers for typemap warnings and in output from the
-debug-tmsearch/-debug-tmused options.
2010-01-03: wsfulton
Add typemaps used debugging option (-debug-tmused). When used each line displays
the typemap used for each type for which code is being generated including the file
and line number related to the type. This is effectively a condensed form of the
-debug-tmsearch option. Documented in Typemaps.html.
2009-12-23: wsfulton
Fix for %javaexception and directors so that all the appropriate throws clauses
are generated. Problem reported by Peter Greenwood.
2009-12-20: wsfulton
Add -debug-tmsearch option for debugging the typemap pattern matching rules.
Documented in Typemaps.html.
2009-12-12: wsfulton
[Octave] Remove the -api option and use the new OCTAVE_API_VERSION_NUMBER
macro provided in the octave headers for determining the api version instead.
2009-12-04: olly
[Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of
SF#2859614.
2009-12-04: olly
Fix handling of modulo operator (%) in constant expressions
(SF#2818562).
2009-12-04: olly
[PHP] "empty" is a reserved word in PHP, so rename empty() method
on STL classes to "is_empty()" (previously this was automatically
renamed to "c_empty()").
*** POTENTIAL INCOMPATIBILITY ***
2009-12-03: olly
[PHP] Add typemaps for long long and unsigned long long, and for
pointer to method.
2009-12-02: olly
[PHP] Fix warning and rename of reserved class name to be case
insensitive.
2009-12-01: wsfulton
Revert support for %extend and memberin typemaps added in swig-1.3.39. The
memberin typemaps are ignored again for member variables within a %extend block.
Documentation inconsistency reported by Torsten Landschoff.
2009-11-29: wsfulton
[Java, C#] Fix generated quoting when using %javaconst(1)/%csconst(1) for
static const char member variables.
%javaconst(1) A;
%csconst(1) A;
struct X {
static const char A = 'A';
};
2009-11-26: wsfulton
[Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to
use the actual constant value if it is specified, rather than the C++ code to
access the member.
%javaconst(1) EN;
%csconst(1) EN;
struct X {
static const int EN = 2;
};
2009-11-23: wsfulton
C++ nested typedef classes can now be handled too, for example:
struct Outer {
typedef Foo { } FooTypedef1, FooTypedef2;
};
2009-11-18: wsfulton
The wrappers for C nested structs are now generated in the same order as declared
in the parsed code.
2009-11-18: wsfulton
Fix #491476 - multiple declarations of nested structs, for example:
struct Outer {
struct {
int val;
} inner1, inner2, *inner3, inner4[1];
} outer;
2009-11-17: wsfulton
Fix parsing of enum declaration and initialization, for example:
enum ABC {
a,
b,
c
} A = a, *pC = &C, array[3] = {a, b, c};
2009-11-17: wsfulton
Fix parsing of struct declaration and initialization, for example:
struct S {
int x;
} instance = { 10 };
2009-11-15: wsfulton
Fix #1960977 - Syntax error parsing derived nested class declaration and member
variable instance.
2009-11-14: wsfulton
Fix #2310483 - function pointer typedef within extern "C" block.
2009-11-13: wsfulton
Fix usage of nested template classes within templated classes so that compilable code
is generated.
2009-11-13: olly
[php] Fix place where class prefix (as specified with -prefix)
wasn't being used. Patch from gverbruggen in SF#2892647.
2009-11-12: wsfulton
Fix usage of nested template classes so that compilable code is generated - the nested
template class is now treated like a normal nested classes, that is, as an opaque type
unless the nestedworkaround feature is used.
2009-11-12: wsfulton
Replace SWIGWARN_PARSE_NESTED_CLASS with SWIGWARN_PARSE_NAMED_NESTED_CLASS and
SWIGWARN_PARSE_UNNAMED_NESTED_CLASS for named and unnamed nested classes respectively.
Named nested class ignored warnings can now be suppressed by name using %warnfilter, eg:
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::Inner;
but clearly unnamed nested classes cannot and the global suppression is still required, eg:
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
2009-11-11: wsfulton
Added the nestedworkaround feature as a way to use the full functionality of a nested class
(C++ mode only). It removes the nested class from SWIG's type information so it is as if SWIG
had never parsed the nested class. The documented nested class workarounds using a global
fake class stopped working when SWIG treated the nested class as an opaque pointer, and
this feature reverts this behaviour. The documentation has been updated with details of how
to use and implement it, see the "Nested classes" section in SWIGPlus.html.
2009-11-11: wsfulton
There were a number of C++ cases where nested classes/structs/unions were being handled
as if C code was being parsed which would oftentimes lead to uncompilable code as an
attempt was made to wrap the nested structs like it is documented for C code. Now all
nested structs/classes/unions are ignored in C++ mode, as was always documented. However,
there is an improvement as usage of nested structs/classes/unions is now always treated
as an opaque type by default, resulting in generated code that should always compile.
*** POTENTIAL INCOMPATIBILITY ***
2009-11-09: drjoe
Fix R for -fcompact and add std_map.i
2009-11-08: wsfulton
Fix inconsistency for nested structs/unions/classes. Uncompilable code was being
generated when inner struct and union declarations were used as types within the
inner struct. The inner struct/union is now treated as a forward declaration making the
behaviour the same as an inner class. (C++ code), eg:
struct Outer {
struct InnerStruct { int x; };
InnerStruct* getInnerStruct();
};
2009-11-08: wsfulton
Ignored nested class/struct warnings now display the name of the ignored class/struct.
2009-11-07: wsfulton
Bug #1514681 - Fix nested template classes within a namespace generated uncompilable
code and introduced strange side effects to other wrapper code especially code
after the nested template class. Note that nested template classes are still ignored.
2009-11-07: wsfulton
Add new debug options:
-debug-symtabs - Display symbol tables information
-debug-symbols - Display target language symbols in the symbol tables
-debug-csymbols - Display C symbols in the symbol tables
2009-11-03: wsfulton
Fix some usage of unary scope operator (::) denoting global scope, for example:
namespace AA { /* ... */ }
using namespace ::AA;
and bug #1816802 - SwigValueWrapper should be used:
struct CC {
CC(int); // no default constructor
};
::CC x();
and in template parameter specializations:
struct S {};
template <typename T> struct X { void a() {} };
template <> struct X<S> { void b() {} };
%template(MyTConcrete) X< ::S >;
plus probably some other corner case usage of ::.
2009-11-02: olly
[Python] Fix potential memory leak in initialisation code for the
generated module.
2009-10-23: wsfulton
Fix seg fault when using a named nested template instantiation using %template(name)
within a class. A warning that these are not supported is now issued plus processing
continues as if no name was given.
2009-10-20: wsfulton
[Python] Fix std::vector<const T*>. This would previously compile, but not run correctly.
2009-10-20: wsfulton
Fixed previously fairly poor template partial specialization and explicit
specialization support. Numerous bugs in this area have been fixed including:
- Template argument deduction implemented for template type arguments, eg this now
works:
template<typename T> class X {};
template<typename T> class X<T *> {};
%template(X1) X<const int *>; // Chooses T * specialization
and more complex cases with multiple parameters and a mix of template argument
deduction and explicitly specialised parameters, eg:
template <typename T1, typename T2> struct TwoParm { void a() {} };
template <typename T1> struct TwoParm<T1 *, int *> { void e() {} };
%template(E) TwoParm<int **, int *>;
Note that the primary template must now be in scope, like in C++, when
an explicit or partial specialization is instantiated with %template.
*** POTENTIAL INCOMPATIBILITY ***
2009-09-14: wsfulton
[C#] Add %csattributes for adding C# attributes to enum values, see docs for example.
2009-09-11: wsfulton
Fix memmove regression in cdata.i as reported by Adriaan Renting.
2009-09-07: wsfulton
Fix constant expressions containing <= or >=.
2009-09-02: wsfulton
The following operators in constant expressions now result in type bool for C++
wrappers and remain as type int for C wrappers, as per each standard:
&& || == != < > <= >= (Actually the last 4 are still broken). For example:
#define A 10
#define B 10
#define A_EQ_B A == B // now wrapped as type bool for C++
#define A_AND_B A && B // now wrapped as type bool for C++
2009-09-02: wsfulton
Fix #2845746. true and false are now recognised keywords (only when wrapping C++).
Constants such as the following are now wrapped (as type bool):
#define FOO true
#define BAR FOO && false
Version 1.3.40 (18 August 2009)
===============================
2009-08-17: olly
[Perl] Add "#undef do_exec" to our clean up of Perl global
namespace pollution.
2009-08-17: olly
[PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217).
2009-08-17: wsfulton
Fix #2797485 After doing a 'make clean', install fails if yodl2man or yodl2html
is not available.
2009-08-16: wsfulton
[Octave] Caught exceptions display the type of the C++ exception instead of the
generic "c++-side threw an exception" message.
2009-08-16: wsfulton
[Java] When %catches is used, fix so that any classes specified in the "throws"
attribute of the "throws" typemap are generated into the Java method's throws clause.
2009-08-16: wsfulton
[C#] Fix exception handling when %catches is used, reported by Juan Manuel Alvarez.
2009-08-15: wsfulton
Fix %template seg fault on some cases of overloading the templated method.
Bug reported by Jan Kupec.
2009-08-15: wsfulton
[Ruby] Add numerous missing wrapped methods for std::vector<bool> specialization
as reported by Youssef Jones.
2009-08-14: wsfulton
[Perl] Add SWIG_ConvertPtrAndOwn() method into the runtime for smart pointer
memory ownership control. shared_ptr support still to be added. Patch from
David Fletcher.
2009-08-14: olly
[PHP] PHP5 now wraps static member variables as documented.
2009-08-14: olly
[PHP] Update the PHP "class" example to work with PHP5 and use
modern wrapping features.
2009-08-13: wsfulton
[PHP] std::vector wrappers overhaul. They no longer require the
specialize_std_vector() macro. Added wrappers for capacity() and reserve().
2009-08-13: wsfulton
[PHP] Add const reference typemaps. const reference primitive types are
now passed by value rather than pointer like the other target languages.
Fixes SF#2524029.
2009-08-08: wsfulton
[Python] More user friendly AttributeError is raised when there are
no constructors generated for the proxy class in the event that the
class is abstract - the error message is now
"No constructor defined - class is abstract" whereas if there are no
public constructors for any other reason and the class is not abstract,
the message remains
"No constructor defined".
[tcl] Similarly for tcl when using -itcl.
2009-08-04: olly
[PHP] Fix generated code to work with PHP 5.3.
2009-08-04: vmiklos
[PHP] Various mathematical functions (which would conflict
with the built-in PHP ones) are now automatically handled by
adding a 'c_' prefix.
2009-08-03: wsfulton
[C#] The std::vector<T> implementation is improved and now uses $typemap such
that the proxy class for T no longer has to be specified in some macros
for correct C# compilation; the following macros are deprecated, where
CSTYPE was the C# type for the C++ class CTYPE:
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE)
usage should be removed altogether
SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE)
should be replaced with:
SWIG_STD_VECTOR_ENHANCED(CTYPE)
Some more details in csharp/std_vector.i
*** POTENTIAL INCOMPATIBILITY ***
2009-07-31: olly
[Python] Fix indentation so that we give a useful error if the
module can't be loaded. Patch from Gaetan Lehmann in SF#2829853.
2009-07-29: wsfulton
Add $typemap(method, typelist) special variable macro. This allows
the contents of a typemap to be inserted within another typemap.
Fully documented in Typemaps.html.
2009-07-29: vmiklos
[PHP] Static member variables are now prefixed with the
class name. This allows static member variables with the
same name in different classes.
2009-07-29: olly
[Python] Add missing locks to std::map wrappers. Patch from
Paul Hampson in SF#2813836.
2009-07-29: olly
[PHP] Fix memory leak in PHP OUTPUT typemaps. Reported by Hitoshi
Amano in SF#2826322.
2009-07-29: olly
[PHP] Fix memory leak in PHP resource destructor for classes
without a destructor and non-class types. Patch from Hitoshi Amano
in SF#2825303.
2009-07-28: olly
[PHP] Update warnings about clashes between identifiers and PHP
keywords and automatic renaming to work with the PHP5 class
wrappers. Fixes SF#1613679.
2009-07-28: vmiklos
[PHP] If a member function is not public but it has a base
which is public, then now a warning is issued and the member
function will be public, as PHP requires this.
2009-07-21: vmiklos
[PHP] Director support added.
2009-07-15: olly
[Perl] Don't specify Perl prototype "()" for a constructor with a
different name to the class, as such constructors can still take
parameters.
2009-07-12: xavier98
[Octave] Add support for Octave 3.2 API
2009-07-05: olly
[PHP] Update the list of PHP keywords - "cfunction" is no longer a
keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__",
and "__NAMESPACE__".
2009-07-03: olly
[Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter
of the manual. Based on patch from SF#2810380 by Christian
Gollwitzer.
2009-07-02: vmiklos
[PHP] Added factory.i for PHP, see the li_factory testcase
for more info on how to use it.
2009-07-02: wsfulton
Fix -Wallkw option as reported by Solomon Gibbs.
2009-07-02: wsfulton
Fix syntax error when a nested struct contains a comment containing a * followed
eventually by a /. Regression from 1.3.37, reported by Solomon Gibbs.
2009-07-01: vmiklos
[PHP] Unknown properties are no longer ignored in proxy
classes.
2009-07-01: vmiklos
[PHP] Fixed %newobject behaviour, previously any method
marked with %newobject was handled as a constructor.
2009-06-30: olly
[Ruby] Undefine close and connect macros defined by Ruby API
headers as we don't need them and they can clash with C++ methods
being wrapped. Patch from Vit Ondruch in SF#2814430.
2009-06-26: olly
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
double parameter.
2009-06-24: wsfulton
Fix wrapping methods with default arguments and the compactdefaultargs feature
where a class is passed by value and is assigned a default value. The SwigValueWrapper
template workaround for a missing default constructor is no longer used as the code
generated does not call the default constructor.
2009-06-16: wsfulton
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
2009-06-02: talby
[Perl] Resolved reference.i overload support problem
identified by John Potowsky.
2009-05-26: wsfulton
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy
now implements System.Collections.Generic.IDictionary<>.
These std:map wrappers have a non-backwards compatible overhaul to make them
like a .NET IDictionary. Some method names have changed as following:
set -> setitem (use this[] property now)
get -> getitem (use this[] property now)
has_key -> ContainsKey
del -> Remove
clear -> Clear
The following macros used for std::map wrappers are deprecated and will no longer work:
specialize_std_map_on_key
specialize_std_map_on_value
specialize_std_map_on_both
*** POTENTIAL INCOMPATIBILITY ***
2009-05-20: vmiklos
[PHP] Add the 'thisown' member to classes. The usage of it
is the same as the Python thisown one: it's 1 by default and
you can set it to 0 if you want to prevent freeing it. (For
example to prevent a double free.)
2009-05-14: bhy
[Python] Fix the wrong pointer value returned by SwigPyObject_repr().
2009-05-13: mutandiz (Mikel Bancroft)
[allegrocl] Minor tweak when wrapping in -nocwrap mode.
2009-05-11: wsfulton
[C#] Improved std::vector wrappers on the C# proxy side from Yuval Baror. These
implement IList<> instead of IEnumerable<> where possible.
2009-04-29: wsfulton
[Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps.
When this attribute is set, the typemap will not apply to classes that are derived
from a C++ base class, eg
%typemap(csbase, notderived="1") SWIGTYPE "CommonBase"
2009-04-29: olly
[Python] Don't attempt to acquire the GIL in situations where we
know that it will already be locked. This avoids some dead-locks
with mod_python (due to mod_python bugs which are apparently
unlikely to ever be fixed), and results in smaller wrappers which
run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04,
the stripped wrapper library was 11% smaller and ran 2.7% faster).
2009-04-21: wsfulton
[C#] Fix #2753469 - bool &OUTPUT and bool *OUTPUT typemaps initialisation.
2009-04-09: wsfulton
Fix #2746858 - C macro expression using floating point numbers
2009-03-30: olly
[PHP] The default out typemap for char[ANY] now returns the string up to a
zero byte, or the end of the array if there is no zero byte. This
is the same as Python does, and seems more generally useful than
the previous behaviour of returning the whole contents of the array
including any zero bytes. If you want the old behaviour, you can provide
your own typemap to do this:
%typemap(out) char [ANY]
%{
RETVAL_STRINGL($1, $1_dim0, 1);
%}
Version 1.3.39 (21 March 2009)
==============================
2009-03-19: bhy
[Python] Fix the memory leak related to Python 3 unicode and C char* conversion,
which can be shown in the following example before this fix:
from li_cstring import *
i=0
while True:
i += 1
n = str(i)*10
test3(n)
This fix affected SWIG_AsCharPtrAndSize() so you cannot call this function with
a null alloc and non-null cptr argument in Python 3, otherwise a runtime error
will be raised.
2009-03-18: wsfulton
[C#] std::vector<T> wrapper improvements for .NET 2 and also providing the
necessary machinery to use the std::vector<T> wrappers with more advanced features such
as LINQ - the C# proxy class now derives from IEnumerable<>. The default is now to
generate code requiring .NET 2 as a minimum, although the C# code can be compiled
for .NET 1 by defining the SWIG_DOTNET_1 C# preprocessor constant. See the
std_vector.i file for more details.
*** POTENTIAL INCOMPATIBILITY ***
2009-03-12: wsfulton
[Ruby] Fix #2676738 SWIG generated symbol name clashes.
2009-03-01: bhy
[Python] Some fixes for Python 3.0.1 and higher support. In 3.0.1, the C API function
PyObject_Compare is removed, so PyObject_RichCompareBool is used for replacement.
Struct initilization of SwigPyObject and SwigPyObject_as_number changed to reflect
the drop of tp_compare and nb_long.
2009-03-01: bhy
[Python] Fix SF#2583160. Now the importer in Python shadow wrapper take care of the
case that module already imported at other place.
2009-02-28: bhy
[Python] Fix SF#2637352. Move struct declaration of SWIG_module in pyinit.swg before
the method calls, since some C compiler don't allow declaration in middle of function
body.
2009-02-21: wsfulton
[Allegrocl] Fix seg fault wrapping some constant variable (%constant) types.
2009-02-20: wsfulton
[CFFI] Fix seg faults when for %extend and using statements.
2009-02-20: wsfulton
Fix SF #2605955: -co option which broke in 1.3.37.
2009-02-20: wsfulton
New %insert("begin") section added. Also can be used as %begin. This is a new
code section reserved entirely for users and the code within the section is generated
at the top of the C/C++ wrapper file and so provides a means to put custom code
into the wrapper file before anything else that SWIG generates.
2009-02-17: wsfulton
'make clean-test-suite' will now run clean on ALL languages. Previously it only
ran the correctly configured languages. This way it is now possible to clean up
properly after running 'make partialcheck-test-suite'.
2009-02-14: wsfulton
Extend attribute library support for structs/classes and the accessor functions use
pass/return by value semantics. Two new macros are available and usage is identical
to %attribute. These are %attributeval for structs/classes and %attributestring for
string classes, like std::string. See attribute.swg for more details.
2009-02-13: wsfulton
Add support for %extend and memberin typemaps. Previously the memberin typemaps were
ignored for member variables within a %extend block.
2009-02-12: wsfulton
Remove unnecessary temporary variable when wrapping return values that are references.
Example of generated code for wrapping:
struct XYZ {
std::string& refReturn();
};
used to be:
std::string *result = 0 ;
...
{
std::string &_result_ref = (arg1)->refReturn();
result = (std::string *) &_result_ref;
}
Now it is:
std::string *result = 0 ;
...
result = (std::string *) &(arg1)->refReturn();
2009-02-08: bhy
Change the SIZE mapped by %pybuffer_mutable_binary and %pybuffer_binary in pybuffer.i from
the length of the buffer to the number of items in the buffer.
2009-02-08: wsfulton
Fix %feature not working for conversion operators, reported by Matt Sprague, for example:
%feature("cs:methodmodifiers") operator bool "protected";
2009-02-07: wsfulton
[MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions.
Also fixes Makefile errors building SWIG executable when mzscheme package is installed
(version 3.72 approx and later).
2009-02-04: talby
[Perl] Fix SF#2564192 reported by David Kolovratnk.
SWIG_AsCharPtrAndSize() now handles "get" magic.
Version 1.3.38 (31 January 2009)
================================
2009-01-31: bhy
[Python] Fix SF#2552488 reported by Gaetan Lehmann. Now %pythonprepend
and %pythonappend have correct indentation.
2009-01-31: bhy
[Python] Fix SF#2552048 reported by Gaetan Lehmann. The parameter list
of static member function in generated proxy code should not have the
'self' parameter.
2009-01-29: wsfulton
Fix regression introduced in 1.3.37 where the default output directory
for target language specific files (in the absence of -outdir) was no
longer the same directory as the generated c/c++ file.
2009-01-28: wsfulton
[Java, C#] Fix proxy class not being used when the global scope operator
was used for parameters passed by value. Reported by David Piepgrass.
2009-01-15: wsfulton
[Perl] Fix seg fault when running with -v option, reported by John Ky.
Version 1.3.37 (13 January 2009)
================================
2009-01-13: mgossage
[Lua] Added contract support for requiring that unsigned numbers are >=0
Rewrote much of Examples/Lua/embed3.
Added a lot to the Lua documentation.
2009-01-13: wsfulton
Fix compilation error when using directors on protected virtual overloaded
methods reported by Sam Hendley.
2009-01-12: drjoe
[R] Fixed handling of integer arrays
2009-01-10: drjoe
[R] Fix integer handling in r to deal correctly with signed
and unsigned issues
2009-01-10: wsfulton
Patch #1992756 from Colin McDonald - %contract not working for classes
in namespace
2009-01-05: olly
Mark SWIGPERL5, SWIGPHP5, and SWIGTCL8 as deprecated in the source
code and remove documentation of them.
2008-12-30: wsfulton
Bug #2430756. All the languages now define a macro in the generated C/C++
wrapper file indicating which language is being wrapped. The macro name is the
same as those defined when SWIG is run, eg SWIGJAVA, SWIGOCTAVE, SWIGCSHARP etc
and are listed in the "Conditional Compilation" section in the documentation.
2008-12-23: wsfulton
[Java] Fix #2153773 - %nojavaexception was clearing the exception feature
instead of disabling it. Clearing checked Java exceptions also didn't work.
The new %clearjavaexception can be used for clearing the exception feature.
2008-12-22: wsfulton
Fix #2432801 - Make SwigValueWrapper exception safe for when copy constructors
throw exceptions.
2008-12-21: wsfulton
Apply patch #2440046 which fixes possible seg faults for member and global
variable char arrays when the strings are larger than the string array size.
2008-12-20: wsfulton
The ccache compiler cache has been adapted to work with SWIG and
named ccache-swig. It now works with C/C++ compilers as well as SWIG
and can result in impressive speedups when used to recompile unchanged
code with either a C/C++ compiler or SWIG. Documentation is in CCache.html
or the installed ccache-swig man page.
2008-12-12: wsfulton
Apply patch from Kalyanov Dmitry which fixes parsing of nested structs
containing comments.
2008-12-12: wsfulton
Fix error message in some nested struct and %inline parsing error situations
such as unterminated strings and comments.
2008-12-07: olly
[PHP] Fix warnings when compiling generated wrapper with GCC 4.3.
2008-12-06: wsfulton
[PHP] Deprecate %pragma(php4). Please use %pragma(php) instead.
The following two warnings have been renamed:
WARN_PHP4_MULTIPLE_INHERITANCE -> WARN_PHP_MULTIPLE_INHERITANCE
WARN_PHP4_UNKNOWN_PRAGMA -> WARN_PHP_UNKNOWN_PRAGMA
*** POTENTIAL INCOMPATIBILITY ***
2008-12-04: bhy
[Python] Applied patch SF#2158938: all the SWIG symbol names started with Py
are changed, since they are inappropriate and discouraged in Python
documentation (from http://www.python.org/doc/2.5.2/api/includes.html):
"All user visible names defined by Python.h (except those defined by
the included standard headers) have one of the prefixes "Py" or "_Py".
Names beginning with "_Py" are for internal use by the Python implementation
and should not be used by extension writers. Structure member names do
not have a reserved prefix.
Important: user code should never define names that begin with "Py" or "_Py".
This confuses the reader, and jeopardizes the portability of the user
code to future Python versions, which may define additional names beginning
with one of these prefixes."
Here is a brief list of what changed:
PySwig* -> SwigPy*
PyObject_ptr -> SwigPtr_PyObject
PyObject_var -> SwigVar_PyObject
PySequence_Base, PySequence_Cont, PySequence_Ref ->
SwigPySequence_Base, SwigPySequence_Cont, SwigPySequence_Ref
PyMap* -> SwigPyMap*
We provided a pyname_compat.i for backward compatibility. Users whose code having
these symbols and do not want to change it could simply include this file
at front of your code. A better solution is to run the converting tool on
your code, which has been put in SWIG's SVN trunk (Tools/pyname_patch.py) and
you can download it here:
https://swig.svn.sourceforge.net/svnroot/swig/trunk/Tools/pyname_patch.py
*** POTENTIAL INCOMPATIBILITY ***
2008-12-02: wsfulton
[Python] Apply patch #2143727 from Serge Monkewitz to fix importing base classes
when the package option is specified in %module and that module is %import'ed.
2008-11-28: wsfulton
[UTL] Fix #2080497. Some incorrect acceptance of types in the STL, eg a double * element
passed into a vector<int *> constructor would be accepted, but the ensuing behaviour
was undefined. Now the type conversion correctly raises an exception.
2008-11-24: wsfulton
Add -outcurrentdir option. This sets the default output directory to the current
directory instead of the path specified by the input file. This option enables
behaviour similar to c/c++ compilers. Note that this controls the output directory,
but only in the absence of the -o and/or -outdir options.
2008-11-23: wsfulton
[ruby] Apply patch #2263850 to fix ruby/file.i ... rubyio.h filename change in
ruby 1.9.
2008-11-23: wsfulton
Apply patch #2319790 from Johan Hake to fix shared_ptr usage in std::tr1 namespace.
2008-11-21: wsfulton
The use of the include path to find the input file is now deprecated.
This makes the behaviour of SWIG the same as C/C++ compilers in preparation
for use with ccache.
2008-11-16: wsfulton
Fix -nopreprocess option to:
- correctly report file names in warning and error messages.
- use the original input filename that created the preprocessed output when
determining the C++ wrapper file name (in the absence of -o). Previously
the name of the input file containing the preprocessed output was used.
2008-11-11: wsfulton
[Java] Add patch #2152691 from MATSUURA Takanori which fixes compiles using the
Intel compiler
2008-11-01: wsfulton
Add patch #2128249 from Anatoly Techtonik which corrects the C/C++ proxy
class being reported for Python docstrings when %rename is used.
2008-11-01: wsfulton
Add the strip encoder patch from Anatoly Techtonik #2130016. This enables an
easy way to rename symbols by stripping a commonly used prefix in all the
function/struct names. It works in the same way as the other encoders, such as
title, lower, command etc outlined in CHANGES file dated 12/30/2005. Example
below will rename wxAnotherWidget to AnotherWidget and wxDoSomething to
DoSomething:
%rename("%(strip:[wx])s") "";
struct wxAnotherWidget {
void wxDoSomething();
};
2008-09-26: mutandiz
[allegrocl]
Lots of test-suite work.
- Fix ordering of wrapper output and %{ %} header output.
- Fix declarations of local vars in C wrappers.
- Fix declaration of defined constants in C wrappers.
- Fix declaration of EnumValues in C wrappers.
- add some const typemaps to allegrocl.swg
- add rename for operator bool() overloads.
2008-09-25: olly
[PHP5] Fill in typemaps for SWIGTYPE and void * (SF#2095186).
2008-09-22: mutandiz (Mikel Bancroft)
[allegrocl]
- Support wrapping of types whose definitions are not seen by
SWIG. They are treated as forward-referenced classes and if a
definition is not seen are treated as (* :void).
- Don't wrap the contents of unnamed namespaces.
- More code cleanup. Removed some extraneous warnings.
- start work on having the allegrocl mod pass the cpp test-suite.
2008-09-19: olly
[PHP5] Add typemaps for long long and unsigned long long.
2008-09-18: wsfulton
[C#] Added C# array typemaps provided by Antti Karanta.
The arrays provide a way to use MarshalAs(UnmanagedType.LPArray)
and pinning the array using 'fixed'. See arrays_csharp.i library file
for details.
2008-09-18: wsfulton
Document the optional module attribute in the %import directive,
see Modules.html. Add a warning for Python wrappers when the
module name for an imported base class is missing, requiring the
module attribute to be added to %import, eg
%import(module="FooModule") foo.h
2008-09-18: olly
[PHP5] Change the default input typemap for char * to turn PHP
Null into C NULL (previously it was converted to an empty string).
The new behaviour is consistent with how the corresponding output
typemap works (SF#2025719).
If you want to keep the old behaviour, add the following typemap
to your interface file (PHP's convert_to_string_ex() function does
the converting from PHP Null to an empty string):
%typemap(in) char * {
convert_to_string_ex($input);
$1 = Z_STRVAL_PP($input);
}
2008-09-18: olly
[PHP5] Fix extra code added to proxy class constructors in the case
where the only constructor takes no arguments.
2008-09-18: olly
[PHP5] Fix wrapping of a renamed enumerated value of an enum class
member (SF#2095273).
2008-09-17: mutandiz (Mikel Bancroft)
[allegrocl]
- Fix how forward reference typedefs are handled, so as not to conflict
with other legit typedefs.
- Don't (for now) perform an ffitype typemap lookup when trying to
when calling compose_foreign_type(). This is actually a useful thing
to do in certain cases, the test cases for which I can't currently
locate :/. It's breaking some wrapping behavior that is more commonly
seen, however. I'll readd in a more appropriate way when I can
recreate the needed test case, or a user complains (which means
they probably have a test case).
- document the -isolate command-line arg in the 'swig -help' output.
It was in the html docs, but not there.
- small amount of code cleanup, removed some unused code.
- some minor aesthetic changes.
2008-09-12: bhy
[Python] Python 3.0 support branch merged into SWIG trunk. Thanks to
Google Summer of Code 2008 for supporting this project! By default
SWIG will generate interface files compatible with both Python 2.x
and 3.0. And there's also some Python 3 new features that can be
enabled by passing a "-py3" command line option to SWIG. These
features are:
- Function annotation support
Also, the parameter list of proxy function will be generated,
even without the "-py3" option. However, the parameter list
will fallback to *args if the function (or method) is overloaded.
- Buffer interface support
- Abstract base class support
For details of Python 3 support and these features, please see the
"Python 3 Support" section in the "SWIG and Python" chapter of the SWIG
documentation.
The "-apply" command line option and support of generating codes
using apply() is removed. Since this is only required by very old
Python.
This merge also patched SWIG's parser to solve a bug. By this patch,
SWIG features able to be correctly applied on C++ conversion operator,
such like this:
%feature("shadow") *::operator bool %{ ... %}
2008-09-02: richardb
[Python] Commit patch #2089149: Director exception handling mangles
returned exception. Exceptions raised by Python code in directors
are now passed through to the caller without change. Also, remove
the ": " prefix which used to be added to other director exceptions
(eg, those due to incorrect return types).
2008-09-02: wsfulton
[Python] Commit patch #1988296 GCItem multiple module linking issue when using
directors.
2008-09-02: wsfulton
[C#] Support for 'using' and 'fixed' blocks in the 'csin' typemap is now
possible through the use of the pre attribute and the new terminator attribute, eg
%typemap(csin,
pre=" using (CDate temp$csinput = new CDate($csinput)) {",
terminator=" } // terminate temp$csinput using block",
) const CDate &
"$csclassname.getCPtr(temp$csinput)"
See CSharp.html for more info.
2008-09-01: wsfulton
[CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into
no-eval context in DEFCENUM
2008-08-02: wuzzeb
[Chicken,Allegro] Commit Patch 2019314
Fixes a build error in chicken, and several build errors and other errors
in Allegro CL
2008-07-19: wsfulton
Fix building of Tcl examples/test-suite on Mac OS X reported by Gideon Simpson.
2008-07-17: wsfulton
Fix SF #2019156 Configuring with --without-octave or --without-alllang
did not disable octave.
2008-07-14: wsfulton
[Java, C#] Fix director typemaps for pointers so that NULL pointers are correctly
marshalled to C#/Java null in director methods.
2008-07-04: olly
[PHP] For std_vector.i and std_map.i, rename empty() to is_empty()
since "empty" is a PHP reserved word. Based on patch from Mark Klein
in SF#1943417.
2008-07-04: olly
[PHP] The deprecated command line option "-make" has been removed.
Searches on Google codesearch suggest that nobody is using it now
anyway.
2008-07-04: olly
[PHP] The SWIG cdata.i library module is now supported.
2008-07-03: olly
[PHP] The deprecated command line option "-phpfull" has been
removed. We recommend building your extension as a dynamically
loadable module.
2008-07-02: olly
[PHP4] Support for PHP4 has been removed. The PHP developers are
no longer making new PHP4 releases, and won't even be providing
patches for critical security issues after 2008-08-08.
2008-07-02: olly
[Python] Import the C extension differently for Python 2.6 and
later so that an implicit relative import doesn't produce a
deprecation warning for 2.6 and a failure for 2.7 and later.
Patch from Richard Boulton in SF#2008229, plus follow-up patches
from Richard and Haoyu Bai.
Version 1.3.36 (24 June 2008)
=============================
06/24/2008: wsfulton
Remove deprecated -c commandline option (runtime library generation).
06/24/2008: olly
[PHP] Fix assertion failure when handling %typemap(in,numinputs=0)
(testcase ignore_parameter).
06/24/2008: olly
[PHP] Fix segfault when wrapping a non-class function marked with
%newobject (testcase char_strings).
06/22/2008: wsfulton
[Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread
in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see
Lib/java/director.swg.
06/21/2008: wsfulton
[Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods)
06/19/2008: wsfulton
[Java, C#] C# and Java keywords will be renamed instead of just issuing a warning
and then generating uncompilable code. Warning 314 gives the new name when a
keyword is found.
06/19/2008: wsfulton
[R] Keyword handling added. R Keywords will be renamed as necessary.
Warning 314 gives the new name when a keyword is found.
06/17/2008: mgossage
[Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase.
(Bug #1938142)
06/07/2008: bhy
Added test case keyword_rename, then made the keyword renaming works properly
by fixing Swig_name_make() for a incomplete condition checking.
06/02/2008: wsfulton
[Java, C#] Fix enum wrappers when using -noproxy.
05/30/2008: bhy
Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive
type in SWIG - fixed SF #1976978.
05/29/2008: wsfulton
[Java, C#] Fix variable wrappers when using -noproxy.
05/29/2008: bhy
[Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related
to -extranative SWIG option - SF #1971977.
05/20/2008: wsfulton
New partialcheck makefile targets for partial testing of the test-suite. These
just invoke SWIG, ie no compilation and no runtime testing. It can be faster
when developing by just doing a directory diff of the files SWIG generates
against those from a previous run. Example usage from the top level directory:
make partialcheck-test-suite
make partialcheck-java-test-suite
This change also encompasses more flexibility in running the test-suite, eg
it is possible to prefix the command line which runs any target language test
with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk
file and makefiles in the test-suite directory. For example it is possible to
run the runtime tests through valgrind using:
make check RUNTOOL="valgrind --leak-check=full"
or invoke SWIG under valgrind using:
make check SWIGTOOL="valgrind --tool=memcheck"
05/19/2008: drjoe
[R] Fixed define that was breaking pre-2.7. Checked in
patch from Soren Sonnenburg that creates strings in
version independent way
05/15/2008: wsfulton
[Java] Fix variable name clash in directors - SF #1963316 reported by Tristan.
05/14/2008: wsfulton
Add an optimisation for functions that return objects by value, reducing
the number of copies of the object that are made. Implemented using an
optional attribute in the "out" typemap called "optimal". Details in
Typemaps.html.
05/11/2008: olly
[PHP] Check for %feature("notabstract") when generating PHP5 class
wrapper.
05/11/2008: wsfulton
Fix SF #1943608 - $self substitution in %contract, patch submitted by
Toon Verstraelen.
05/09/2008: olly
[PHP] Fix char * typemaps to work when applied to signed char * and
unsigned char * (uncovered by testcase apply_strings).
05/09/2008: wsfulton
Fix wrapping of char * member variables when using allprotected mode.
Bug reported by Warren Wang.
05/09/2008: olly
[PHP] Fix bad PHP code generated when wrapping an enum in a
namespace (uncovered by testcase arrays_scope).
05/09/2008: olly
[PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4
is essentially obsolete now, so we care much more about solid PHP5
support.
05/07/2008: wsfulton
STL fixes when using %import rather than %include and the Solaris Workshop
compiler and the Roguewave STL.
05/07/2008: wsfulton
Fix wrapping of overloaded protected methods when using allprotected mode.
Bug reported by Warren Wang.
05/03/2008: wsfulton
Commit patch #1956607 to add -MT support from Richard Boulton.
This patch mirrors the gcc -MT option which allows one to change the default
Makefile target being generated when generating makefiles with the -M family
of options. For example:
$ swig -java -MM -MT overriddenname -c++ example.i
overriddenname: \
example.i \
example.h
04/30/2008: mgossage
[Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor)
which was unused and causing warning with g++ -Wall.
Removed other unused warning in typemaps.i and other places.
Added Examples/lua/embed3, and run tests a few test cases.
04/24/2008: olly
[Python] Fix generated code for IBM's C++ compiler on AIX (patch
from Goeran Uddeborg in SF#1928048).
04/24/2008: olly
Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to
avoid a clash with BSIZE defined by headers on AIX with Perl
(reported in SF#1928048).
04/20/2008: wsfulton
Add the ability to wrap all protected members when using directors.
Previously only the virtual methods were available to the target language.
Now all protected members, (static and non-static variables, non-virtual methods
and static methods) are wrapped when using the allprotected mode. The allprotected
mode is turned on in the module declaration:
%module(directors="1", allprotected="1") modulename
Version 1.3.35 (7 April 2008)
=============================
04/07/2008: wsfulton
[Lua] Add missing pointer reference typemaps
04/06/2008: wsfulton
Fix stack overflow when using typemap warning suppression, eg
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG)
04/05/2008: wsfulton
[Python] Fix shared_ptr typemaps so that %pythonnondynamic can be used. Also corrects
display of the proxy class type. Reported by Robert Lupton.
04/04/2008: olly
[Python] Add %newobject reference to python memory management subsection of manual
(patch from mdbeachy in SF#1894610).
03/27/2008: wsfulton
[Python] Fix shared_ptr typemaps where the pointer type is a templated type with
with more than one parameter. Reported by Robert Lupton.
03/27/2008: mgossage
[Lua] Added a typemap DISOWN for SWIGTYPE* and SWIGTYPE[], and support for %delobject feature.
Added Examples/lua/owner which demonstrates the use of the memory management.
03/26/2008: wsfulton
[Java] Apply patch #1844301 from Monty Taylor to suppress enum constructor
unused warnings.
03/26/2008: wsfulton
[Python] Apply patch #1924524 from Casey Raymondson which ensures the
"No constructor defined" message is displayed when attempting to call a
constructor on a class that doesn't have a constructor wrapper, eg if
the C++ class is abstract.
03/26/2008: wsfulton
[Python] Apply patch #1925702 from Casey Raymondson which removes warning 512
for std::vector wrappers.
03/26/2008: olly
[Python] Apply GCC 4.3 warnings patch from Philipp Thomas
(SF#1925122).
03/21/2008: wsfulton
[Python] Thread safety patch for STL iterators from Abhinandan Jain.
03/17/2008: mgossage
[Lua] Added %luacode feature to add source code into wrappers.
Updated documentation to document this.
Added Examples/lua/arrays to show its use (and typemaps)
03/17/2008: olly
Fix nonportable sed usage which failed on Mac OS X (and probably
other platforms). Fixes SF#1903612.
03/17/2008: olly
Fix memory leak in SWIG's parser (based on patch from Russell
Bryant in SF#1914023).
03/12/2008: wsfulton
Fix bug #1878285 - unnecessary cast for C struct creation wrappers.
03/12/2008: wsfulton
[Python] Remove debugging info when using shared_ptr support
03/06/2008: mgossage
[Lua] Updated documentation for Lua exceptions.
Added Examples/lua/exception and Examples/lua/embed2.
Small updates to the typemaps.
03/04/2008: wsfulton
[Java, C#] Add char *& typemaps.
03/04/2008: wsfulton
Fix occasional seg fault when attempting to report overloaded methods as being ignored.
02/29/2008: wsfulton
[Perl] Fix #1904537 Swig causes a Perl warning "x used only once" in Perl 5.10
reported by Ari Jolma
02/29/2008: wsfulton
[Python] Add shared_ptr varin/varout typemaps for wrapping global variables.
02/25/2008: wsfulton
Fix $wrapname to work in %exception (fixes some wrap:name assertions)
Version 1.3.34 (27 February 2008)
=================================
02/13/2008: wsfulton
[R] Fix wrapping of global function pointer variables.
02/13/2008: wsfulton
Add new special variables for use within %exception:
$wrapname - language specific wrapper name
$overname - if a method is overloaded this contains the extra mangling used on
the overloaded method
$decl - the fully qualified C/C++ declaration of the method being wrapped
without the return type
$fulldecl - the fully qualified C/C++ declaration of the method being wrapped
including the return type
02/12/2008: drjoe
[R] Now setting S4 flag in SWIG created objects. This
fixes R-SWIG for 2.6 and warning for 2.6 failure has been removed.
02/11/2008: mgossage
[Lua] Added a patch by Torsten Landschoff to fix the unary minus issue
Ran 'astyle --style=kr -2' across lua.cxx to neaten it up
02/10/2008: wsfulton
Bump SWIG_RUNTIME_VERSION to 4. This is because of the recently introduced API
change in the conversion functions, ie change in definition of swig_converter_func.
Anyone calling SWIG_TypeCast must pass in a valid value for the new additional
(third) parameter and then handle the newly created memory if the returned value
is set to SWIG_CAST_NEW_MEMORY else a memory leak will ensue.
02/09/2008: wsfulton
[Python] Experimental shared_ptr typemaps added. Usage is the same as the recently
added Java and C# shared_ptr typemaps. Two macros are available, although these
may well change in a future version:
For base classes or classes not in an inheritance chain:
SWIG_SHARED_PTR(PROXYCLASS, TYPE)
For derived classes:
SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
The PROXYCLASS is the name of the proxy class, but is only required for Java/C#.
Example usage:
%include "boost_shared_ptr.i"
SWIG_SHARED_PTR(Klass, Space::Klass)
SWIG_SHARED_PTR_DERIVED(KlassDerived, Space::Klass, Space::KlassDerived)
namespace Space {
struct Klass { ... };
struct KlassDerived : Klass { ... };
}
Further details to follow in future documentation, but the following features
should be noted:
- Not restricted to boost::shared_ptr, eg std::tr1::shared_ptr can also be used.
- Available typemap groups:
(a) Typemaps for shared_ptr passed by value, reference, pointer and pointer
reference.
- (b) Typemaps for passing by raw value, raw pointer, raw reference, raw pointer
reference.
- The code being wrapped does not even have to use shared_ptr, SWIG can use
shared_ptr as the underlying storage mechanism instead of a raw pointer due to
the typemaps in group (b) above.
- No array support as shared_ptr does not support arrays.
- This works quite differently to the usual SWIG smart pointer support when
operator-> is parsed by SWIG:
- An additional smart pointer class is not generated reducing code bloat in
the wrappers.
- Using smart pointers and raw pointers can be mixed seamlessly.
- Missing constructors for the smart pointers is no longer a problem and so
separate factory type functions do not have to be written and wrapped.
- The implicit C++ shared_ptr< derived class > to shared_ptr< base class >
cast also works in the target language. This negates the necessity to write
an explicit helper cast function providing the upcast which would need
calling prior to passing a derived class to a method taking a shared_ptr to
a base class.
02/09/2008: wsfulton
[Python] Add support for overriding the class registration function via a new
"smartptr" feature. This is a very low level of customisation most users
would never need to know. The feature will typically be used for intrusive
smart pointers along with additional typemaps. Example usage of the feature:
%feature("smartptr", noblock=1) Foo { boost::shared_ptr< Foo > }
class Foo {};
The generated Foo_swigregister function will then register boost::shared < Foo >
(SWIGTYPE_p_boost__shared_ptrTFoo_t instead of SWIGTYPE_p_Foo) as the underlying
type for instantiations of Foo.
02/09/2008: wsfulton
Features now supports the optional 'noblock' attribute for all usage of %feature.
When specified, the { } braces are removed from the feature code. This is identical
in behaviour to usage of 'noblock' in typemaps and is used when the preprocessor
is required to operate on the code in the feature and the enclosing { } braces
are not required. Example:
#define FOO foo
%feature("smartptr", noblock="1") { FOO::bar }
The preprocessor then reduces this as if this had been used instead:
%feature("smartptr") "foo::bar"
02/01/2008: olly
[Python] Fix format string bug (SF#1882220).
01/31/2008: wsfulton
Additions to the %types directive. Now the conversion / casting code can be
overridden to some custom code in the %types directive, like so:
%types(fromtype = totype) %{
... code to convert fromtype to totype and return ...
%}
The special variable $from will be replaced by the name of the parameter of the
type being converted from. The code must return the totype cast to void *. Example:
class Time;
class Date;
Date &Time::dateFromTime();
%types(Time = Date) %{
Time *t = (Time *)$from;
Date &d = t->dateFromTime();
return (void *) &d;
%}
resulting in the conversion / casting code looking something like:
static void *_p_TimeTo_p_Date(void *x) {
Time *t = (Time *)x;
Date &d = t->dateFromTime();
return (void *) &d;
}
This is advanced usage, please use only if you understand the runtime type system.
01/30/2008: mgossage
Small update to documentation in Typemaps.html, to warn about use of local
variables in typemaps for multiple types.
01/25/2008: wsfulton
[Java] Fix bug reported by Kevin Mills in ARRAYSOFCLASSES typemaps where any
changes made to an array element passed from Java to C are not reflected back
into Java.
01/24/2008: mgossage
More updates to the configure script for detecting lua.
Also looks in /usr/include/lua*
Also changed typemaps.i not to check for NULL before freeing a pointer
01/21/2008: wsfulton
[Python] For STL containers, SWIG no longer attempts to convert from one
STL container to another, eg from std::vector<int> to std::vector<double>
or std::list<int> to std::vector<int> or even std::vector<Foo> to
std::vector<Bar> as it previously did. In fact SWIG no longer attempts to
convert any SWIG wrapped C++ proxy class that is also a Python sequence,
whereas previously it would. Any non-SWIG Python sequence will still be
accepted wherever an STL container is accepted. Overloaded methods using
containers should be faster.
01/18/2008: wsfulton
[C#] Add 'directorinattributes' and 'directoroutattributes' typemap attributes
for the imtype typemap. These should contain C# attributes which will
be generated into the C# director delegate methods.
01/18/2008: olly
Fix handling of byte value 255 in input files on platforms where
char is signed (it was getting mapped to EOF). Fixes SF#1518219.
01/16/2008: wsfulton
Fix template member variables wrapped by a smart pointer. Bug reported
by Robert Lupton.
01/14/2008: mgossage
Substantial changes to configure script for detecting lua.
Code can now link to liblua.a, liblua50.a or liblua51.a
It's also a lot neater now.
12/16/2007: wsfulton
[Perl] Backed out #1798728 - numbers can be passed to functions taking char *
12/16/2007: wsfulton
Fix #1832613 - Templates and some typedefs involving pointers or function pointers
12/12/2007: wsfulton
[Java] Fix #1632625 - Compilation errors on Visual C++ 6 when using directors.
12/12/2007: wsfulton
[Perl] Fix #1798728 - numbers can be passed to functions taking char *.
12/12/2007: wsfulton
Fix #1819847 %template with just one default template parameter
template<typename T = int> class Foo {...};
%template(FooDefault) Foo<>;
12/12/2007: mgossage
[Lua] Small correction on Lua.html
12/09/2007: wsfulton
Apply patch #1838248 from Monty Taylor for vpath builds of SWIG.
12/08/2007: wsfulton
[Lua] Fixes to remove gcc-4.2 warnings
12/06/2007: wsfulton
Fix #1734415 - template template parameters with default arguments such as:
template<typename t_item, template<typename> class t_alloc = pfc::alloc_fast >
class list_t : public list_impl_t<t_item,pfc::array_t<t_item,t_alloc> > { ... };
12/04/2007: mgossage
[lua] Fix a bug in the class hierachy code, where the methods were not propagated,
if the name ordering was in a certain order.
Added new example programs (dual, embed) and runtime tests for test-suite.
11/30/2007: wsfulton
Fix using statements using a base class method where the methods were overloaded.
Depending on the order of the using statements and method declarations, these
were previously generating uncompilable wrappers, eg:
struct Derived : Base {
virtual void funk();
using Base::funk;
};
Version 1.3.33 (November 23, 2007)
==================================
11/21/2007: mikel
[allegrocl] omit private slot type info in the classes/types
defined on the lisp side. Fix bug in mapping of C/++ types
to lisp types. Fix typo in modules generated defpackage form.
Have std::string *'s automatically marshalled between foreign
and lisp strings.
11/20/2007: olly
[Python] Fill in Python Dictionary functions list (patch from
Jelmer Vernooij posted to swig-devel).
11/20/2007: beazley
Fixed a bug in the C scanner related to backslash characters.
11/19/2007: wsfulton
[Perl] Fix broken compilation of C++ wrappers on some compilers.
11/16/2007: olly
[Python] Don't pass Py_ssize_t for a %d printf-like format as
that's undefined behaviour when sizeof(Py_ssize_t) != sizeof(int).
Version 1.3.32 (November 15, 2007)
==================================
11/14/2007: wsfulton
[R] Package name and dll name is now the same as the SWIG module
name. It used to be the module name with _wrap as a suffix. The package
and dll names can be modified using the -package and -dll commandline
options.
*** POTENTIAL INCOMPATIBILITY ***
11/11/2007: wsfulton
[R] Add support for Windows (Visual C++ 8 tested)
11/10/2007: olly
[php] Fix makefile generated by -make (SF#1633679). Update
documentation to mark "-make" as deprecated (none of the other
SWIG backends seem to offer such a feature, it can't realistically
generate a fully portable makefile, and the commands to build an
extension are easy enough to write for the user's preferred build
tool). Also recommend against the use of "-phpfull" (it's only
really useful when static linking, and a dynamically loadable
module is virtually always the better approach).
11/09/2007: olly
Fix --help output to note that `export SWIG_FEATURES' is required.
10/29/2007: wsfulton
[R] Fix seg fault on Windows
[R] Examples R scripts are now platform independent
10/30/2007: mgossage
[lua] fixed bug in template classes which cases template_default2
and template_specialization_defarg to fail.
Added several warning filters into the overload's test cases.
Added runtime tests for several codes.
You can now make check-lua-test-suite with no errors and only a few warnings.
10/30/2007: olly
[guile] Fix the configure test to put GUILELINK in LIBS not LDFLAGS
(SF#1822430).
10/30/2007: olly
[guile] Fix the guile examples on 64-bit platforms.
10/29/2007: wsfulton
[C#] Fix member pointers on 64 bit platforms.
10/28/2007: olly
[lua] Fix swig_lua_class instances to be static to allow multiple
SWIG wrappers to be compiled into the same executable statically.
Patch from Andreas Fredriksson (posted to the swig mailing list).
10/28/2007: olly
[lua] Fix Examples/lua to pass SRCS for C tests rather than CXXSRCS.
The code as it was happened to work on x86, but broke on x86_64 (and
probably any other platforms which require -fPIC).
10/28/2007: wsfulton
[Java, C#] New approach for fixing uninitialised variable usage on error in director
methods using the new templated initialisation function SwigValueInit().
10/28/2007: wsfulton
[Perl] Use more efficient SvPV_nolen(x) instead of SvPV(x,PL_na) if SvPV_nolen is
supported.
10/26/2007: wuzzeb
[Chicken] Fix global variables of class member function pointers.
Other minor fixes, so all tests in the chicken test suite now pass
10/25/2007: olly
Fix UTL typecheck macro for a function taking char[] or const
char[] (SF#1820132).
10/22/2007: mkoeppe
[Guile] Filter out -ansi -pedantic from CFLAGS while compiling test programs for Guile
in configure. This enables running the test suite for Guile if it is installed and
usable.
10/22/2007: mkoeppe
[Guile -scm] Fix testcases apply_signed_char and apply_strings
by adding explicit casts to the appropriate $ltype.
10/22/2007: wsfulton
[Java, C#] Fix uninitialised variable usage on error in director methods.
10/19/2007: wsfulton
[Java, C#] Bug #1794247 - fix generated code for derived classes when csbase or javabase
typemaps are used with the replace="1" attribute.
10/19/2007: wsfulton
[Python] Docs updated to suggest using distutils. Patch #1796681 from Christopher Barker.
10/19/2007: olly
[perl5] Clear errno before calls to strtol(), strtoul(), strtoll()
and strtoull() which we check errno after to avoid seeing a junk
value of errno if there isn't an error in the call.
10/16/2007: wsfulton
Deprecate %attribute_ref and replace with %attributeref. There is just an argument
order change in order to maintain consistency with %attribute, from:
%attribute_ref(Class, AttributeType, AccessorMethod, AttributeName)
to
%attributeref(Class, AttributeType, AttributeName, AccessorMethod)
10/16/2007: olly
[Tcl] Fix several occurrences of "warning: deprecated conversion
from string constant to 'char*'" from GCC 4.2 in generated C/C++
code.
10/16/2007: olly
[PHP] Fix many occurrences of "warning: deprecated conversion from
string constant to 'char*'" from GCC 4.2 in generated C/C++ code
when compiling with a new enough version of PHP 5 (tested with
PHP 5.2.3, but PHP 5.2.1 is probably the minimum requirement).
10/15/2007: wsfulton
Patch #1797133 from David Piepgrass fixes %attribute when the getter has the same name
as the attribute name and no longer generate non-functional setter for read-only attributes.
10/15/2007: olly
[Tcl] Prevent SWIG_Tcl_ConvertPtr from calling the unknown proc.
Add Examples/tcl/std_vector/ which this change fixes. Patch
is from "Cliff C" in SF#1809819.
10/12/2007: wsfulton
[Java] Add DetachCurrentThread back in for directors. See entry dated 08/11/2006 and
search for DetachCurrentThread on the mailing lists for details. The crashes on Solaris
seem to be only present in jdk-1.4.2 and lower (jdk-1.5.0 and jdk-1.6.0 are okay), so
anyone using directors should use a recent jdk on Solaris, or define (see director.swg)
SWIG_JAVA_NO_DETACH_CURRENT_THREAD to the C++ compiler to get old behaviour.
10/12/2007: wsfulton
[Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated
when there are C comments in the jtype and jstype typemaps.
10/12/2007: wuzzeb
Added a testsuite entry for Bug #1735931
10/09/2007: olly
Automatically rerun autogen.sh if configure.in is modified.
10/09/2007: olly
Enhance check-%-test-suite rule and friends to give a more helpful
error message if you try them for a language which doesn't exist
(e.g. "make check-php-test-suite" rather than the correct
"make check-php4-test-suite").
10/09/2007: olly
Add make rule to regenerate Makefile from Makefile.in if it has
changed.
10/09/2007: olly
[php] Fix long-standing memory leak in wrapped constructors and
wrapped functions/methods which return an object.
10/08/2007: olly
Fix Makefile.in to read check.list files correctly in a VPATH
build.
10/07/2007: wsfulton
[C#, Java] Experimental shared_ptr typemaps added
09/27/2007: mgossage
[lua] added more verbose error messages for incorrect typechecks.
Added a routine which checks the exact number of parameters passed to a function
(breaks operator_overloading for unary minus operator, currently disabled).
Reorganised the luatypemaps.swg to tidy it up.
Added a lot of %ignores on the operators not supported by lua.
Added support for constant member function pointers & runtest for member_pointer.i
Added first version of wchar.i
09/25/2007: wsfulton
[C#, Java] throws typemaps for std::wstring using C# patch #1799064 from David Piepgrass
09/24/2007: wsfulton
[Tcl] Apply #1771313 to fix bug #1650229 - fixes long long and unsigned long long
handling.
09/20/2007: olly
[Java] Eliminate some unnecessary uses of a temporary buffer
allocated using new[]. SF#1796609.
09/19/2007: wsfulton
[C#] The $csinput special variable can be used in the csvarin typemap where it is always
expanded to 'value'.
09/19/2007: wsfulton
[C#] Fix bug reported by Glenn A Watson and #1795260 where the cstype typemap used the 'ref'
keyword in the typemap body, it produced uncompilable C# properties (variable wrappers).
The type for the property now correctly comes from the 'out' attribute in the cstype typemap.
09/19/2007: wsfulton
[Java] Fix const std::wstring& typemaps
09/19/2007: wsfulton
[Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated
where a parameter is passed by pointer reference, eg in the std::vector wrappers. The pgcpp
is also generated now when user's custom typemaps use a proxy class in the jstype typemap
and a 'long' in the jtype typemap.
09/18/2007: olly
[php] Add typemaps for handling parameters of type std::string &
which are modified by the wrapped function.
09/17/2007: olly
[python] Split potentially long string literals to avoid hitting
MSVC's low fixed limit on string literal length - patch from
SF#1723770, also reported as SF#1630855.
09/17/2007: olly
[ocaml] Fix renaming of overloaded methods in the method_table -
my patch from SF#940399.
09/17/2007: olly
[python] Simpler code for SWIG_AsVal_bool() which fixes a "strict
aliasing" warning from GCC - patch from SF#1724581 by Andrew
Baumann.
09/17/2007: olly
[perl5] Use sv_setpvn() to set a scalar from a pointer and length
- patch from SF#174460 by "matsubaray".
09/17/2007: olly
When wrapping C++ code, generate code which uses
std::string::assign(PTR, LEN) rather than assigning
std::string(PTR, LEN). Using assign generates more efficient code
(tested with GCC 4.1.2).
09/07/2007: wsfulton
Fix %ignore on constructors which are not explicitly declared [SF #1777712]
09/05/2007: wuzzeb (John Lenz)
- Change r_ltype in typesys.c to store a hashtable instead of a single value.
several very subtle bugs were being caused by multiple ltypes being mapped
to a single mangled type, mostly when using typedefed template parameters.
Now, r_ltype stores a hashtable of possible ltypes, and when generating the
type table, all the ltypes are added into the swig_type_info structure.
08/31/2007: wsfulton
SF #1754967 from James Bigler.
- Fix bug in turning on warnings that were turned off by default. Eg 'swig -w+309' will now
turn on the normally suppressed warning 309.
- New -Wextra commandline option which enables the extra warning numbers:
202,309,403,512,321,322 (this is the list of warnings that have always been suppressed by
default). By specifying -Wextra, all warnings will be turned on, but unlike -Wall,
warnings can still be selectively turned on/off using %warnfilter,
#pragma SWIG nowarn or further -w commandline options, eg:
swig -Wextra -w309
will turn on all warnings except 309.
08/28/2007: wsfulton
- New debugging options, -debug-module <n> and -debug-top <n> to display the parse tree at
various stages, where <n> is a comma separated list of stages 1-4.For example, to
display top of parse tree at stages 1 and 3:
swig -debug-top 1,3
- Deprecate the following options which have equivalents below:
-dump_parse_module => -debug-module 1
-dump_module => -debug-module 4
-dump_parse_top => -debug-top 1
-dump_top => -debug-top 4
- Renamed some commandline options for naming consistency across all options:
-debug_template => -debug-template
-debug_typemap => -debug-typemap
-dump_classes => -debug-classes
-dump_tags => -debug-tags
-dump_typedef => -debug-typedef
-dump_memory => -debug-memory
08/25/2007: olly
[PHP5] Fix handling of double or float parameters with an integer
default value.
08/25/2007: olly
[PHP5] Generate __isset() methods for setters for PHP 5.1 and later.
08/20/2007: wsfulton
[Java C#] Fix director bug #1776651 reported by Stephane Routelous which occurred when
the director class name is the same as the start of some other symbols used within
the director class.
08/17/2007: wsfulton
Correct behaviour for templated methods used with %rename or %ignore and the empty
template declaration - %template(). A warning is issued if the method has not been
renamed.
08/16/2007: mutandiz (Mikel Bancroft)
[allegrocl] Name generated cl file based on input file rather than by
module name. It was possible to end up with a mypackage.cl and a test_wrap.c
when parsing a test.i input file. Confusing. Also, include external-format
templates for :fat and :fat-le automatically to avoid these being compiled
at runtime.
08/15/2007: efuzzyone
[cffi] Apply patch #1766076 from Leigh Smith adding support for newly introduced
in cffi :long-long and :unsigned-long-long.
08/10/2007: wsfulton
[Java] Add documentation patch #1743573 from Jeffrey Sorensen. It contains a neat
idea with respect to better memory management by the JVM of C++ allocated memory.
08/10/2007: wsfulton
[Perl] Apply patch #1771410 from Wade Brainerd to fix typedef XS(SwigPerlWrapper) in
perlrun.swg for ActiveState Perl build 822 and Perl 5.8.9 and 5.10 branches.
08/10/2007: wsfulton
[Lua] const enum reference typemaps fixed.
08/09/2007: wsfulton
[C#] Added missing support for C++ class member pointers.
08/09/2007: wsfulton
[C#, Java] Add support for $owner in the "out" typemaps like in the scripting
language modules. Note that $owner has always been supported in the "javaout" / "csout"
typemaps.
08/01/2007: wsfulton
Fix smart pointer handling for classes that have templated methods within the smart
pointer type. Problem reported by craigdo at ee.washington.edu.
07/31/2007: efuzzyone
[cffi] fixed memory access after being freed bug. thanks to Martin Percossi.
package name clos changed to cl. thanks to Ralf Mattes
07/24/2007: wsfulton
Parallel make support added for the examples and test-suite for developers who have
more than one CPU. Now parallel make can be used for checking in addition to building
the SWIG executable. Some typical checking examples:
make -j8 -k check
make -j4 check-java-test-suite
make -j2 check-java-examples
07/19/2007: mgossage
Fixed bug that stopped configure working on mingw (applied dos2unix to configure.in)
07/10/2007: mgossage
[lua] Extra compatibility with Lua 5.1 (updated SWIG_init, docs, examples, test suite)
Removed name clash for static link of multiple modules
07/05/2007: mgossage
[lua] Fix a bug in SWIG_ALLOC_ARRAY()
improved the error messages for incorrect arguments.
Changed the output of swig_type() to use the human readable form of the type,
rather than the raw swig type.
07/03/2007: wsfulton
[C#] Fix directors for some overloaded methods where the imtype resulted in identical
methods being generated in the C# director class, eg void foo(int *) and void foo(double *)
used to generated two of these:
private void SwigDirectorfoo(IntPtr p) { ... }
06/25/2007: wsfulton
[Java, C#] Some parameter name changes in std_vector.i allowing better targeting
of typemaps for method parameters (for memory management of containers of pointers).
06/07/2007: mutandiz (Mikel Bancroft)
[allegrocl]
fix foreign-type constructor to properly look for ffitype typemap
bindings. fix inout_typemaps.i for strings.
06/06/2007: olly
[Ruby]
Use whichever of "long" or "long long" is the same size as "void*"
to hold pointers as integers, rather than whichever matches off_t.
Fixes compilation on OS X and GCC warnings on platforms where
sizeof(void*) < sizeof(off_t) (SF patch #1731979).
06/06/2007: olly
[PHP5]
Fix handling of a particular case involving overloaded functions
with default parameters.
06/05/2007: mutandiz (Mikel Bancroft)
[allegrocl]
Fix case where we'd pass fully qualified identifiers
(i.e. NS1::NS2::FOO) to swig-insert-id. All namespaces
should be stripped.
Fix bug in TypedefHandler introduced by last fix.
06/05/2007: olly
Fix reporting of filenames in errors after %include (patch from
Leigh Smith in #1731040; also reported as #1699940).
05/31/2007: olly
[Python]
Fix "missing initialiser" warning when compiling generated C/C++
wrapper code with Python 2.5 with warnings enabled (patch from
bug#1727668 from Luke Moore).
05/29/2007: olly
[Python]
Split docstrings into separate string literals at each newline when
generating C/C++ wrapper code (the C/C++ compiler will just combine
them back into a single string literal). This avoids MSVC
complaining that the strings are too long (problem reported by
Bo Peng on the mailing list).
05/28/2007: olly
[Python]
Escape backslashes in docstrings.
05/26/2007: olly
[Python]
Fix autodoc generation of enums to be more consistent with how the
enums are wrapped - patch #1697226 from Josh Cherry.
05/26/2007: olly
[PHP5]
Fix wrapping of methods and functions which return a pointer to a
class (bug#1700788) and those which have overloaded forms returning
both classes and non-classes (bug#1712717, thanks to Simon
Berthiaume for the patch).
05/25/2007: wsfulton
Fixed %rename inconsistency in conversion operators as reported by Zhong Ren. The matching
is now done on the operator name in the same way as it is done for parameters. For example:
%rename(opABC) Space::ABC::operator ABC() const;
%rename(methodABC) Space::ABC::method(ABC a) const;
namespace Space {
class ABC {
public:
void method(ABC a) const {}
operator ABC() const { ABC a; return a; }
};
}
Note that qualifying the conversion operator previously may or may not have matched.
Now it definitely won't, so this will not match:
%rename(opABC) Space::ABC::operator Space::ABC() const;
in the same way that this does not match:
%rename(methodABC) Space::ABC::method(Space::ABC a) const;
The documentation has been improved with respect to %rename, namespaces and templates.
Conversion operators documentation too.
*** POTENTIAL INCOMPATIBILITY ***
05/16/2007: mutandiz
[allegrocl]
Fix bad generation of local var ltype's in functionWrapper().
Try to work better with the backward order in which swig
unrolls nested class definitions.
cleaned up a little unnecessary code/debug printf's.
Remove warning when replacing $ldestructor for ff:foreign-pointer
05/12/2007: olly
[Python]
swig -python -threads now generates C/C++ code which uses Python's
own threading abstraction (from pythread.h) rather than OS specific
code. The old code failed to compile on MS Windows. (See SF patch
tracker #1710341).
05/04/2007: gga
[Ruby]
Changed STL renames to be global renames. This fixes
STL functions not being renamed when autorename is on.
This is a not a totally perfect work-around, but better.
Someone really needs to fix the template renaming code.
(See bug #1545634)
05/04/2007 gga
[All]
Changed %rename("%(undercase)s") a little so that single
numbers at the end of a function are not undercased. That is:
getSomething -> get_something
get2D -> get_2d
get234 -> get_234
BUT:
asFloat2 -> as_float2
(Bug #1699714)
05/03/2007: gga
[Ruby]
Made __swigtype__ => @__swigtype__ so it can be accessed
from the scripting language (and follows Ruby's official
documentation, just in case).
Made tracking => @__trackings__ for same reason.
Currently storing ivars without the @ seems valid, but
the PickAxe says this is not correct, so just in case...
05/03/2007: gga
[Ruby]
Applied patch for -minherit bug and exception classes.
This issue should be revisited more closely, as Multiple
Inheritance in Ruby is still problematic.
(patch/bug #1604878)
05/03/2007: gga
[Ruby]
Overloaded functions in ruby will now report to the user
the possible prototypes when the user mistypes the number or
type of a parameter.
05/03/2007: gga
[Ruby]
Forgot to document the bug fixing of an old bug regarding
exceptions.
(bug #1458247)
05/03/2007: gga
[Ruby]
Fixed Ruby documentation to use the proper css styles for
each section. Added autodoc section to Ruby's docs to
document the features supported by Ruby in documenting its modules.
Made rdoc documentation spit out the full name of the class +
method name. Albeit this will make the current rdoc not recognize
the method, this is still needed to disambiguate between different
classes with similar methods (rdoc was created to document the
ruby source which only contains one class per c file, unlike swig)
I have patched rdoc to make it more friendly to swig. This
patch needs to be merged in the ruby std library now.
05/03/2007: gga
[Ruby]
Changed flag -feature to be -init_name to better reflect its
purpose and avoid confusion with -features.
05/03/2007: gga
[Ruby]
Improved autodoc generation.
Added autodoc .swg files to Ruby library for easily adding
documentation to common Ruby methods and STL methods.
Fixed autodoc documenting of getters and setters and module.
Made test suite always generate autodocs.
05/03/2007: gga
[Ruby]
Removed some warnings from STL and test suite.
05/02/2007: mgossage
[Lua] Fixed issues with C++ classes and hierachies across multiple
source files. Fixed imports test case & added run test.
Added Examples/imports.
Added typename for raw lua_State*
Added documentation on native functions.
05/02/2007: gga
[Ruby]
Docstrings are now supported.
%feature("autodoc") and %feature("docstring") are now
properly supported in Ruby. These features will generate
a _wrap.cxx file with rdoc comments in them.
05/02/2007: gga
[Ruby]
STL files have been upgraded to follow the new swig/python
Lib/std conventions.
This means std::vector, std::set, std::map, set::multimap,
std::multiset, std::deque and std::string are now properly
supported, including their iterators, support for containing
ruby objects (swig::GC_VALUE) and several other ruby
enhancements.
std::complex, std::ios, std::iostream, std::iostreambuf and
std::sstream are now also supported.
std::wstring, std::wios, std::wiostream, std::wiostreambuf
and std::wsstream are supported verbatim with no unicode
conversion.
std_vector.i now mimics the behavior of Ruby Arrays much more
closely, supporting slicing, shifting, unshifting,
multiple indexing and proper return values on assignment.
COMPATABILITY NOTE: this changes the older api a little bit in
that improper indexing would previously (incorrectly) raise
exceptions. Now, nil is returned instead, following ruby's
standard Array behavior.
05/02/2007: gga
[Ruby]
Changed the value of SWIG_TYPECHECK_BOOL to be 10000 (ie. higher
than that of all integers).
This is because Ruby allows typecasting
integers down to booleans which can make overloaded functions on
bools and integers to fail.
(bug# 1488142)
05/02/2007: gga
[Ruby]
Fixed a subtle bug in multiple argouts that could get triggered if
the user returned two or more arguments and the first one was an
array.
05/01/2007: gga
[Ruby]
Improved the documentation to document the new features
added, add directorin/out/argout typemaps, etc.
05/01/2007: gga
[Ruby]
Added %initstack and %ignorestack directives for director
functions. These allow you to control whether a director
function should re-init the Ruby stack.
This is sometimes needed for an embedded Ruby where the
director method is used as a C++ callback and not called
by the user from ruby code.
Explanation:
Ruby's GC needs to be aware of the running OS stack in order to
mark any VALUE (Ruby objects) it finds there to avoid collection
of them. This allows the ruby API to be very simple and allows
you to write code like "VALUE a = sth" anywhere without needing
to do things like refcounting like python.
By default, the start of the stack is set when ruby_init() is
called. If ruby is inited within main(), as it usually is the
case with the main ruby executable, ruby will be able to calculate
its stack properly. However, when this is not possible, as when
ruby is embedded as a plugin to an application where main is not
available, ruby_init() will be called in the wrong place, and
ruby will be incorrectly tracking the stack from the function
that called ruby_init() forwards only, which can lead to
all sorts of weird crashes or to ruby thinking it has run out of
stack space incorrectly.
To avoid this, director (callback) functions can now be tagged
to try to reset the ruby stack, which will solve the issues.
NOTE: ruby1.8.6 still contains a bug in it in that its function
to reset the stack will not always do so. This bug is triggered
very rarely, when ruby is called from two very distinct places
in memory, like a branch of main() and another dso. This bug
has now been reported to ruby-core and is pending further
investigation.
(bug #1700535 and patch #1702907)
04/30/2007: wsfulton
Fix #1707582 - Restore building from read-only source directories.
04/30/2007: gga
[Ruby]
Ruby will now report the parameter index properly on type
errors as well as the class and value of the incorrect
argument passed.
(feature request #1699670)
04/30/2007: gga
[Ruby]
Ruby no longer creates the free_Class function if the class
contains its own user defined free function (%freefunc).
(bug #1702882)
04/30/2007: gga
[Ruby]
Made directors raise a ruby exception for incorrect argout
returned values if RUBY_EMBEDDED is set, instead of throwing
an actual SwigDirector exception.
This will prevent crashes when ruby is embedded and unaware
of the SwigDirector exception.
04/30/2007: gga
[Ruby]
Removed the need for -DSWIGEXTERN.
Changed swig_ruby_trackings to be a static variable, but also
be kept within a hidden instance variable in the SWIG module.
This allows properly dealing with trackings across multiple
DSOs, which was previously broken.
(bug #1700535 and improvement to patch #1702907)
04/29/2007: gga
[Ruby] Fixed GC memory issues with trackings that could lead
to segfaults when dealing, mainly, with static variables.
(bug #1700535 and patch #1702907)
04/29/2007: gga
[Ruby]
Fixed String conversion using old ruby1.6 macros. Now
StringValuePtr() is used if available. This removes warnings
when converting strings with \0 in them.
(bug #1700535 and patch #1702907)
04/29/2007: gga
[Ruby]
Fixed the argout count in directors for Ruby. Previously,
ignored or "numinputs=0" typemaps would incorrectly not get
counted towards the argout count.
(bug/patch #1545585)
04/29/2007: gga
[Ruby]
Upgraded Ruby converter to recognize "numinputs=0". Previously,
only the old "ignore" flag was checked (which would currently
still work properly, but is deprecated).
04/29/2007: gga
[Ruby - but should be made generic]
%feature("numoutputs","0") added.
This feature allows you to ignore the output of a function so
that it is not added to a list of output values
( ie. argouts ).
This should also become a feature of %typemap(directorout)
as "numoutputs"=0, just like "numinputs"=0 exists.
%feature("directors"=1)
%include <typemaps.i>
%feature("numoutputs","0") { Class::member_function1 };
%typemap(out) MStatus { // some code, like check mstatus
// and raise exception if wrong };
%inline %{
typedef int MStatus;
class Class {
// one argument returned, but director out code added
// MStatus is discarded as a return (out) parameter.
virtual MStatus member_function1( int& OUTPUT );
// two arguments returned, director out code added
// MStatus is not discarded
virtual MStatus member_function2( int& OUTPUT );
};
%}
04/21/2007: olly
Fix parsing of float constants with an exponent (e.g. 1e-02f)
(bug #1699646).
04/20/2007: olly
[Python] Fix lack of generation of docstrings when -O is used.
Also, fix generation of docstrings containing a double quote
character. Patch from Richard Boulton in bug#1700146.
04/17/2007: wsfulton
[Java, C#] Support for adding in Java/C# code before and after the intermediary call,
specifically related to the marshalling of the proxy type to the intermediary type.
The javain/csin typemap now supports the 'pre' and 'post' attributes to achieve this.
The javain typemap also supports an optional 'pgcppname' attribute for premature garbage
collection prevention parameter naming and the csin typemap supports an optional 'cshin'
attribute for the parameter type used in a constructor helper generated when the type is used
in a constructor. Details in the Java.html and CSharp.html documentation.
04/16/2007: olly
Don't treat `restrict' as a reserved identifier in C++ mode
(bug#1685534).
04/16/2007: olly
[PHP5] Fix how zend_throw_exception() is called (bug #1700785).
04/10/2007: olly
Define SWIGTEMPLATEDISAMBIGUATOR to template for aCC (reported on
swig-user that this is needed).
04/04/2007: olly
[PHP5] If ZTS is enabled, release <module>_globals_id in MSHUTDOWN
to avoid PHP interpreter crash on shutdown. This solution was
suggested here: http://bugs.php.net/bug.php?id=40985
04/03/2007: olly
[PHP4] Add missing ZTS annotations to generated C++ wrapper code
to fix compilation failures when using ZTS enabled SWIG (Linux
distributions tend to disable ZTS, but notably the Windows build
uses it by default).
04/01/2007: efuzzyone
[CFFI] Patch #1684261: fixes handling of unsigned int literals, thanks Leigh Smith.
Also, improved documentation.
03/30/2007: olly
Avoid generating '<:' token when using SwigValueWrapper<> on a type
which starts with '::' (patch #1690948).
03/25/2007: wuzzeb (John Lenz)
[perl5] Add SWIG_fail to the SWIG_exception macro. Fixes a few problems reported
on the mailing list.
03/23/2007: wsfulton
String copying patch from Josh Cherry reducing memory consumption by about 25%.
03/21/2007: wsfulton
[Java] Apply patch #1631987 from Ulrik Peterson - bool INOUT typemaps
fail on big endian machines.
03/16/2007: wsfulton
Fix seg fault given dodgy C++ code: namespace abc::def { }
03/16/2007: wsfulton
[Java] Fixes so that ARRAYSOFCLASSES and ARRAYSOFENUMS in arrays_java.i can be applied
to pointer types.
03/03/2007: olly
[PHP5] When we know the literal numeric value for a constant, use
that to initialise the const member in the PHP wrapper class.
03/02/2007: olly
[PHP5] Fix PHP wrapper code generated for certain cases of
overloaded forms with default arguments.
02/26/2007: efuzzyone
[CFFI] Patch #1656395: fixed hex and octal values bug, thanks to Arthur Smyles.
02/22/2007: mgossage
[Lua] Fixed bug in typemaps which caused derived_byvalue and rname test cases to fail.
Updated derived_byvalue.i to explain how to find and fix the problem
01/25/2007: wsfulton
Fix #1538522 and #1338527, forward templated class declarations without a
name for the templated class parameters, such as:
template <typename, class> class X;
01/23/2007: mgossage
[Lua] Patch #1640862: <malloc.h> replaced by <stdlib.h>
Patch #1598063 Typo in typemaps.i
01/22/2007: mgossage
[Lua] Added a lua specific carrays.i which adds the operator[] support.
modified the main code to make it not emit all the class member functions & accessors
Note: C structs are created using new_XXX() while C++ classes use XXX() (should be standardised)
Updated test case: li_carrays
Updated the documentation.
01/12/2007: wsfulton
[Php] Add support for newfree typemaps (sometimes used by %newobject)
01/12/2007: beazley
New command line option -macroerrors. When supplied, this will force
the C scanner/parser to report proper location information for code contained
inside SWIG macros (defined with %define). By default, SWIG merely reports
errors on the line at which a macro is used. With this option, you
can expand the error back to its source---something which may simplify
debugging.
01/12/2007: beazley
[Internals] Major overhaul of C/C++ scanning implementation. For quite
some time, SWIG contained two completely independent C/C++ tokenizers--
the legacy scanner in CParse/cscanner.c and a general purpose scanner
in Swig/scanner.c. SWIG still has two scanning modules, but the C parser
scanner (CParse/cscanner.c) now relies upon the general purpose
scanner found in Swig/scanner.c. As a result, it is much smaller and
less complicated. This change also makes it possible to maintain all
of the low-level C tokenizing in one central location instead of two
places as before.
***POTENTIAL FLAKINESS***
This change may cause problems with accurate line number reporting
as well as error reporting more generally. I have tried to resolve this
as much as possible, but there might be some corner cases.
01/12/2007: mgossage
[Lua] Added typemap throws for std::string*, typemap for SWIGTYPE DYNAMIC,
changed the existing throws typemap to throw a string instead of making a copy of
the object (updating a few test cases to deal with the change).
fixed test case: dynamic_casts, exception_partial_info, li_std_string, size_t
01/03/2007: beazley
[Internals]. Use of swigkeys.c/.h variables is revoked. Please use
simple strings for attribute names.
12/30/2006: beazley
Internal API functions HashGetAttr() and HashCheckAttr() have been revoked.
Please use Getattr() to retrieve attributes. The function Checkattr() can
be used to check attributes. Note: These functions have been revoked
because they only added a marginal performance improvement at the expense
code clarity.
12/26/2006: mgossage
[Lua] Added more STL (more exceptions, map, size_t),
fixed test case: conversion_ns_template.
12/21/2006: mgossage
[Lua] Update to throw errors when setting immutables,
and allowing user addition of module variables.
12/20/2006: wsfulton
Fix typedef'd variable wrappers that use %naturalvar, eg, std::string.
12/14/2006: wsfulton
[C#] Add std::wstring and wchar_t typemaps
12/14/2006: olly
[php] Fix bug #1613673 (bad PHP5 code generated for getters and
setters).
12/02/2006: wsfulton, John Lenz, Dave Beazley
Move from cvs to Subversion for source control
11/30/2006: beazley
Cleaned up swigwarnings.swg file not to use nested macro
definitions.
11/12/2006: wsfulton
[Java, C#] Fix for %extend to work for static member variables.
Version 1.3.31 (November 20, 2006)
==================================
11/12/2006: Luigi Ballabio
[Python] Alternate fix for Python exceptions bug #1578346 (the previous one broke Python
properties in modern classes)
11/12/2006: wsfulton
-fakeversion commandline option now generates the fake version into the generated wrappers
as well as displaying it when the -version commandline option is used.
14/11/2006: mgossage
[lua] update to typemap for object by value, to make it c89 compliant
Version 1.3.30 (November 13, 2006)
==================================
11/12/2006: wsfulton
[java] Remove DetachCurrentThread patch from 08/11/2006 - it causes segfaults
on some systems.
11/12/2006: wsfulton
[python] Fix #1578346 - Python exceptions with -modern
11/10/2006: wsfulton
Fix #1593291 - Smart pointers and inheriting from templates
11/09/2006: wsfulton
Fix director operator pointer/reference casts - #1592173.
11/07/2006: wsfulton
Add $self special variable for %extend methods. Please use this instead of just 'self'
as the C++ 'this' pointer.
11/07/2006: mutandiz
[allegrocl]
allegrocl.swg: swig-defvar updated to allow specifying of
non-default foreign type (via :ftype keyword arg).
allegrocl.cxx: Specify proper access type for enum values.
11/03/2006: wsfulton
[Java/C#] Fix const std::string& return types for directors as reported by
Mark Donselzmann
10/29/2006: wsfulton
[Java] Remove DeleteLocalRef from end of director methods for now as it is causing a
seg fault when run on Solaris 8.
10/29/2006: wuzzeb (John Lenz)
[Guile] Patch from Chris Shoemaker to clean up some warnings in the generated code.
10/29/2006: wsfulton
[Java] Important fix to prevent early garbage collection of the Java proxy class
while it is being used in a native method. The finalizer could destroy the underlying
C++ object while it was being used. The problem occurs when the proxy class is no
longer strongly reachable after a native call. The problem seems to occur in
memory stress situations on some JVMs. It does not seem to occur on the
Sun client JVM up to jdk 1.5. However the 1.6 client jdk has a more aggressive garbage
collector and so the problem does occur. It does occur on the Sun server
JVMs (certainly 1.4 onwards). The fix entails passing the proxy class into the native
method in addition to the C++ pointer in the long parameter, as Java classes are not
collected when they are passed into JNI methods. The extra parameter can be suppressed
by setting the nopgcpp attribute in the jtype typemap to "1" or using the new -nopgcpp
commandline option.
See Java.html#java_pgcpp for further details on this topic.
10/24/2006: wsfulton
[C#] Fix smart pointer wrappers. The virtual/override/new keyword is not generated
for each method as the smart pointer class does not mirror the underlying pointer
class inheritance hierarchy. SF #1496535
10/24/2006: mgossage
[lua] added support for native methods & member function pointers.
fixed test cases arrays_dimensionless & cpp_basic. Added new example (functor).
tidied up a little of the code (around classHandler).
10/17/2006: wsfulton
[C#, Java] directorout typemap changes to fall in line with the other director
languages. $result is now used where $1 used to be used. Please change your typemaps
if you have a custom directorout typemap.
10/18/2006: wsfulton
Some fixes for applying the char array typemaps to unsigned char arrays.
10/17/2006: wsfulton
[C#, Java] Add in const size_t& and const std::size_t& typemaps.
10/15/2006: efuzzyone
[CFFI] Suppress generating defctype for enums, thanks to Arthur Smyles. Patch 1560983.
10/14/2006: wuzzeb (John Lenz)
[Chicken] Minor fix to make SWIG work with the (as yet unreleased) chicken 2.5
[Guile,Chicken] Fix SF Bug 1573892. Added an ext_test to the test suite to test
this bug, but this test can not really be made generic because the external code must
plug into the target language interpreter directly.
See Examples/test-suite/chicken/ext_test.i and ext_test_external.cxx
Added a %.externaltest to common.mk, and any interested language modules can
copy and slightly modify either the chicken or the guile ext_test.i
10/14/2006: mgossage
[Lua] added OUTPUT& for all number types, added a long long type
fixed several test cases.
update: changed typemaps to use SWIG_ConvertPtr rather than SWIG_MustGetPointer
started spliting lua.swg into smaller parts to make it neater
10/13/2006: wsfulton
[C#, Java] Marginally better support for multiple inheritance only in that you can
control what the base class is. This is done using the new 'replace' attribute in the
javabase/csbase typemap, eg in the following, 'Me' will be the base class,
no matter what Foo is really derived from in the C++ layer.
%typemap(javabase, replace="1") Foo "Me";
%typemap(csbase, replace="1") Foo "Me";
Previously it was not possible for the javabase/csbase typemaps to override the C++ base.
10/12/2006: wsfulton
[Java] Remove potential race condition on the proxy class' delete() method
(it is now a synchronized method, but is now customisable by changing the
methodmodifiers attribute in the javadestruct or javadestruct_derived typemap)
[C#] Remove potential race condition on the proxy class' Dispose() method,
similar to Java's delete() above.
*** POTENTIAL INCOMPATIBILITY ***
10/12/2006: wsfulton
[Ruby, Python] Remove redundant director code in %extend methods (%extend
methods cannot be director methods)
10/12/2006: wsfulton
[Ruby, Python] Fix #1505594 - director objects not returned as director objects
in %extend methods.
10/11/2006: wsfulton
[Java] Fix #1238798 - Directors using unsigned long long or any other type
marshalled across the JNI boundary using a Java class (where the jni typemap
contains jobject).
10/06/2006: wsfulton
Fix #1162194 - #include/%include within a structure
10/06/2006: wsfulton
Fix #1450661, string truncation in String_seek truncating Java/C# enums.
10/06/2006: mgossage
[Lua] Fix #1569587. The name is now correct.
10/04/2006: wsfulton
Director fixes for virtual conversion operators
10/04/2006: olly
[php] Fix #1569587 for PHP. Don't use sizeof() except with string
literals. Change some "//" comments to "/* */" for portability.
10/04/2006: mgossage
[Lua] Partial Fix #1569587. The type is now correct, but the name is still not correct.
10/03/2006: wsfulton
[Ruby] Fix #1527885 - Overloaded director virtual methods sometimes produced
uncompilable code when used with the director:except feature.
10/03/2006: wsfulton
Directors: Directors are output in the order in which they are declared in
the C++ class rather than in some pseudo-random order.
10/03/2006: mmatus
Fix #1486281 and #1471039.
10/03/2006: olly
[Perl] Fix for handling strings with zero bytes from Stephen Hutsal.
09/30/2006: efuzzyone
[CFFI] Bitfield support and vararg support due to Arthur Smyles.
C expression to Lisp conversion, thanks to Arthur Smyles for the initial
idea, it now supports conversion for a whole range of C expressions.
09/28/2006: wsfulton
Fix #1508327 - Overloaded methods are hidden when using -fvirtual optimisation.
Overloaded methods are no longer candidates for elimination - this mimics
C++ behaviour where all overloaded methods must be defined and implemented
in a derived class in order for them to be available.
09/25/2006: wsfulton
[Ruby, Python, Ocaml] Fix #1505591 Throwing exceptions in extended directors
09/25/2006: wsfulton
Fix #1056100 - virtual operators.
09/24/2006: olly
Don't accidentally create a "<:" token (which is the same as "[" in C++).
Fixes bug # 1521788.
09/23/2006: olly
[Ruby] Support building with recent versions of the Ruby 1.9
development branch. Fixes bug #1560092.
09/23/2006: olly
Templates can now be instantiated using negative numbers and
constant expressions, e.g.:
template<int q> class x {};
%template(x_minus1) x<-1>;
%template(x_1plus2) x<1+2>;
Also, constant expressions can now include comparisons (>, <, >=,
<=, !=, ==), modulus (%), and ternary conditionals (a ? b : c).
Fixes bugs #646275, #925555, #956282, #994301.
09/22/2006: wsfulton
Fix %ignore on director methods - Bugs #1546254, #1543533
09/20/2006: wsfulton
Fix %ignore on director constructors
09/20/2006: wsfulton
Fix seg faults and asserts when director methods are ignored (#1543533)
09/20/2006: wsfulton
Fix out of source builds - bug #1544718
09/20/2006: olly
Treat a nested class definition as a forward declaration rather
than ignoring it completely, so that we generate correct code for
passing opaque pointers to the nested class (fixes SF bug #909387).
09/20/2006: olly
*** POTENTIAL INCOMPATIBILITY ***
[php] Overload resolution now works. However to allow this, SWIG
generated wrappers no longer coerce PHP types (which reverts a change
made in 1.3.26). So for example, if a method takes a string, you
can no longer pass a number without explicitly converting it to a
string in PHP using: (string)x
09/18/2006: mgossage
[ALL] fix on swiginit.swg, has been reported to crash on several test cases
found and fixed problem in imports under python (mingw)
09/16/2006: wsfulton
[Python] Patch from Michal Marek for Python 2.5 to fix 64 bit array indexes on
64 bit machines.
09/13/2006: wsfulton
The explicitcall feature has been scrapped. This feature was introduced primarily
to solve recursive director method calls. Director upcall improvements made instead:
[Python, Ruby, Ocaml] The swig_up flag is no longer used. The required mutexes
wrapping this flag are also no longer needed. The recursive calls going from C++
to the target language and back again etc are now avoided by a subtlely different
approach. Instead of using the swig_up flag in each director method to indicate
whether the explicit C++ call to the appropriate base class method or a normal
polymorphic C++ call should be made, the new approach makes one of these calls
directly from the wrapper method.
[Java, C#] The recursive call problem when calling a C++ base class method from
Java/C# is now fixed. The implementation is slightly different to the other languages
as the detection as to whether the explicit call or a normal polymorphic call is made
in the Java/C# layer rather than in the C++ layer.
09/11/2006: mgossage
[ALL] updated swiginit.swg to allow multiple interpreters to use multiple
swig modules at once. This has been tested in Lua (mingw & linux),
perl5 & python (linux) only.
09/11/2006: mgossage
[lua] added support for passing function pointers as well as native lua object
into wrappered function.
Added example funcptr3 to demonstrate this feature
09/05/2006: olly
[php] Rename ErrorCode and ErrorMsg #define-s to SWIG_ErrorCode
and SWIG_ErrorMsg to avoid clashes with code the user might be
wrapping (patch from Darren Warner in SF bug #1466086). Any
user typemaps which use ErrorCode and/or ErrorMsg directly will
need adjusting - you can easily fix them to work with both old
and new SWIG by changing to use SWIG_ErrorMsg and adding:
#ifndef SWIG_ErrorMsg
#define SWIG_ErrorMsg() ErrorMsg()
#endif
08/29/2006: olly
[php] Move constant initialisation from RINIT to MINIT to fix a
warning when using Apache and mod_php. We only need to create
PHP constants once when we're first initialised, not for every HTTP
request.
08/21/2006: mgossage
[Lua]
Bugfix #1542466 added code to allow mapping Lua nil's <-> C/C++ NULL's
updated various typemaps to work correctly with the changes
added voidtest_runme.lua to show the features working
08/19/2006: wuzzeb (John Lenz)
[Guile] Add feature:constasvar to export constants as variables instead of functions
that return the constant value.
08/11/2006: wsfulton
[Java] DetachCurrentThread calls have been added so that natively created threads
no longer prevent the JVM from exiting. Bug reported by Thomas Dudziak and
Paul Noll.
08/10/2006: wsfulton
[C#] Fix director protected methods so they work
07/25/2006: mutandiz
[allegrocl]
more additions to std::string, some tweaks and small bug fixes
-nocwrap mode.
07/21/2006: mgossage
[Lua]
Bugfix #1526022 pdated std::string to support strings with '\0' inside them
updated typemaps.i to add support for pointer to pointers
07/19/2006: mutandiz
[allegrocl]
- Add std_string.i support.
- Add newobject patch submitted by mkoeppe (thanks!)
- Fix type name mismatch issue for nested type definitions.
specifically typedefs in templated class defns.
07/18/2006: mgossage
Bugfix #1522858
updated lua.cxx to support -external-runtime command
07/14/2006: wuzzeb (John Lenz)
Increment the SWIG_RUNTIME_VERSION to 3, because of the
addition of the owndata member in swig_type_info.
Reported by: Prabhu Ramachandran
07/05/2006: wsfulton
Search path fixes:
- Fix search path for library files to behave as documented in Library.html.
- Fix mingw/msys builds which did not find the SWIG library when installed.
- Windows builds also output the mingw/msys install location when running
swig -swiglib.
- The non-existent and undocumented config directory in the search path has
been removed.
07/05/2006: wsfulton
Fix $symname special variable expansion.
07/04/2006: wuzzeb (John Lenz)
[Chicken]
Add %feature("constasvar"), which instead of exporting a constant as a
scheme function, exports the constant as a scheme variable. Update the
documentation as well.
07/04/2006: wsfulton
[See entry of 09/13/2006 - explicitcall feature and documentation to it removed]
New explicitcall feature which generates additional wrappers for virtual methods
that call the method explicitly, not relying on polymorphism to make the method
call. The feature is a feature flag and is enabled like any other feature flag.
It also recognises an attribute, "suffix" for mangling the feature name, see
SWIGPlus.html#SWIGPlus_explicitcall documentation for more details.
[Java, C#]
The explicitcall feature is also a workaround for solving the recursive calls
problem when a director method makes a call to a base class method. See
Java.html#java_directors_explicitcall for updated documentation.
06/28/2006: joe (Joseph Wang)
[r] Initial support for R
06/20/2006: wuzzeb (John Lenz)
[Chicken]
Minor fixes to get apply_strings.i testsuite to pass
Remove integers_runme.scm from the testsuite, because SWIG and Chicken does
handle overflows.
06/19/2005: olly
[php] Add support for generating PHP5 class wrappers for C++
classes (use "swig -php5").
06/17/2006: olly
[php] Added some missing keywords to the PHP4 keyword list, and
fixed __LINE__ and __FILE__ which were in the wrong category.
Also added all the keywords new in PHP5, and added comments
noting the PHP4 keywords which aren't keywords in PHP5.
06/17/2006: olly
[php] Don't segfault if PHP Null is passed as this pointer (e.g.
Class_method(Null)) - give a PHP Error instead.
06/15/2006: mutandiz
[allegrocl]
Add initial support for std::list container class.
Fix a few bugs in helper functions.
05/13/2006: wsfulton
[Java] Replace JNIEXPORT with SWIGEXPORT, thereby enabling the possibility
of using gcc -fvisibility=hidden for potentially smaller faster loading wrappers.
05/13/2006: wsfulton
Fix for Makefiles for autoconf-2.60 beta
05/13/2006: wsfulton
Vladimir Menshakov patch for compiling wrappers with python-2.5 alpha.
05/12/2006: wsfulton
Fix buffer overflow error when using large %feature(docstring) reported
by Joseph Winston.
05/12/2006: wsfulton
[Perl] Operator overload fix from Daniel Moore.
05/25/2006: mutandiz
[allegrocl]
Fix bug in generation of CLOS type declarations for unions
and equivalent types.
05/24/2006: mutandiz
[allegrocl]
Don't require a full class definition to generate a CLOS wrapper.
05/20/2006: olly
[php] GCC Visibility support now works with PHP.
05/19/2006: olly
[php] Removed support for -dlname (use -module instead). Fixed
naming of PHP extension module to be consistent with PHP
conventions (no "php_" prefix on Unix; on PHP >= 4.3.0, handle Unix
platforms which use something other than ".so" as the extension.)
05/13/2006: wsfulton
[C#] Director support added
05/07/2006: olly
[php] Don't segfault if PHP Null is passed where a C++ reference
is wanted.
05/05/2006: olly
[php] Fix wrappers generated for global 'char' variables to not
include a terminating zero byte in the PHP string.
05/03/2006: wsfulton
Modify typemaps so that char * can be applied to unsigned char * or signed char *
types and visa versa.
05/03/2006: efuzzyone
[cffi]Thanks to Luke J Crook for this idea.
- a struct/enum/union is replaced with :pointer only if
that slot is actually a pointer to that type. So,:
struct a_struct { int x; } and
struct b_struct { a_struct struct_1; };
will be converted as:
(cffi:defcstruct b_struct
(struct_1 a_struct))
- Other minor fixes in lispifying names.
05/02/2006: wsfulton
Fix possible redefinition of _CRT_SECURE_NO_DEPRECATE for VC++.
04/14/2006: efuzzyone
[cffi]
Thanks to Thomas Weidner for the patch.
- when feature export is set (export 'foo) is
generated for every symbol
- when feature inline is set (declaim (inline foo)) is
generated before every function definition
- when feature intern_function is set
#.(value-of-intern-function "name" "nodeType" package)
is emitted instead of the plain symbol. A sample swig-lispify
is provided.
- every symbol is prefixed by it's package.
04/13/2006: efuzzyone
[cffi]
Fixed the generation of wrappers for global variables.
Added the option [no]swig-lisp which turns on/off generation
of code for swig helper lisp macro, functions, etc.
Version 1.3.29 (March 21, 2006)
===============================
04/05/2006: mutandiz
[allegrocl]
Fix output typemap of char so it produces a character instead
of an integer. Also adds input/output typemaps for 'char *'.
add command-line argument -isolate to generate an interface
file that won't interfere with other SWIG generated files that
may be used in the same application.
03/20/2005: mutandiz
[allegrocl]
More tweaks to INPUT/OUTPUT typemaps for bool.
Fix constantWrapper for char and string literals.
find-definition keybindings should work in ELI/SLIME.
Output (in-package <module-name>) to lisp wrapper
instead of (in-package #.*swig-module-name*).
slight rework of multiple return values.
doc updates.
03/17/2005: mutandiz
[allegrocl]
mangle names of constants generated via constantWrapper.
When using OUTPUT typemaps and the function has a non-void
return value, it should be first in the values-list, followed
by the OUTPUT mapped values.
Fix bug with boolean parameters, which needed to be
passed in as int values, rather than T or NIL.
03/15/2006: mutandiz
[allegrocl]
Generate wrappers for constants when in C++ or -cwrap mode.
Make -cwrap the default, since it is most correct. Users
can use the -nocwrap option to avoid the creation of a .cxx
file when interfacing to C code.
When in -nocwrap mode, improve the handling of converting
infix literals to prefix notation for lisp. This is very
basic and not likely to be improved upon since this only
applies to the -nocwrap case. Literals we can't figure out
will result in a warning and be included in the generated
code.
validIdentifier now more closely approximates what may be
a legal common lisp symbol.
Fix typemap error in allegrocl.swg
03/12/2006: mutandiz
[allegrocl]
fix up INPUT/OUTPUT typemaps for bool.
Generate c++ style wrapper functions for struct/union members
when -cwrap option specified.
03/10/2006: mutandiz
[allegrocl]
Fix bug in C wrapper generation introduced by last allegrocl
commit.
03/10/2006: wsfulton
[Java]
Commit #1447337 - Delete LocalRefs at the end of director methods to fix potential leak
03/10/2006: wsfulton
Fix #1444949 - configure does not honor --program-prefix.
Removed non-standard configure option --with-release-suffix. Fix the autoconf standard
options --program-prefix and --program-suffix which were being shown in the help,
but were being ignored. Use --program-suffix instead of --with-release-suffix now.
03/10/2006: wsfulton
[Java]
Fix #1446319 with patch from andreasth - more than one wstring parameter in director methods
03/07/2006: mkoeppe
[Guile]
Fix for module names containing a "-" in non-"shadow" mode.
Patch from Aaron VanDevender (#1441474).
03/04/2006: mmatus
- Add -O to the main program, which now enables -fastdispatch
[Python]
- Add the -fastinit option to enable faster __init__
methods. Setting 'this' as 'self.this.append(this)' in the python
code confuses PyLucene. Now the initialization is done in the
the C++ side, as reported by Andi and Robin.
- Add the -fastquery option to enable faster SWIG_TypeQuery via a
python dict cache, as proposed by Andi Vajda
- Avoid to call PyObject_GetAttr inside SWIG_Python_GetSwigThis,
since this confuses PyLucene, as reported by Andi Vajda.
03/02/2006: wsfulton
[Java]
Removed extra (void *) cast when casting pointers to and from jlong as this
was suppressing gcc's "dereferencing type-punned pointer will break strict-aliasing rules"
warning. This warning could be ignored in versions of gcc prior to 4.0, but now the
warning is useful as gcc -O2 and higher optimisation levels includes -fstrict-aliasing which
generates code that doesn't work with these casts. The assignment is simply never made.
Please use -fno-strict-aliasing to both suppress the warning and fix the bad assembly
code generated. Note that the warning is only generated by the C compiler, but not
the C++ compiler, yet the C++ compiler will also generate broken code. Alternatively use
-Wno-strict-aliasing to suppress the warning for gcc-3.x. The typemaps affected
are the "in" and "out" typemaps in java.swg and arrays_java.swg. Users ought to fix
their own typemaps to do the same. Note that removal of the void * cast simply prevents
suppression of the warning for the C compiler and nothing else. Typical change:
From:
%typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)(void *)&$input; %}
To:
%typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)&$input; %}
From:
%typemap(out) SWIGTYPE * %{ *($&1_ltype)(void *)&$result = $1; %}
To:
%typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %}
03/02/2006: mkoeppe
[Guile -scm]
Add typemaps for "long long"; whether the generated code compiles, however, depends
on the version and configuration of Guile.
03/02/2006: wsfulton
[C#]
Add support for inner exceptions. If any of the delegates are called which construct
a pending exception and there is already a pending exception, it will create the new
exception with the pending exception as an inner exception.
03/02/2006: wsfulton
[Php]
Added support for Php5 exceptions if compiling against Php5 (patch from Olly Betts).
03/01/2006: mmatus
Use the GCC visibility attribute in SWIGEXPORT.
Now you can compile (with gcc 3.4 or later) using
CFLAGS="-fvisibility=hidden".
Check the difference for the 'std_containers.i' python
test case:
Sizes:
3305432 _std_containers.so
2383992 _std_containers.so.hidden
Exported symbols (nm -D <file>.so | wc -l):
6146 _std_containers.so
174 _std_containers.so.hidden
Execution times:
real 0m0.050s user 0m0.039s sys 0m0.005s _std_containers.so
real 0m0.039s user 0m0.026s sys 0m0.007s _std_containers.so.hidden
Read http://gcc.gnu.org/wiki/Visibility for more details.
02/27/2006: mutandiz
[allegrocl]
Add support for INPUT, OUTPUT, and INOUT typemaps.
For OUTPUT variables, the lisp wrapper returns multiple
values.
02/26/2006: mmatus
[Ruby] add argcargv.i library file.
Use it as follow:
%include argcargv.i
%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
%inline {
int mainApp(size_t argc, const char **argv)
{
return argc;
}
}
then in the ruby side:
args = ["asdf", "asdf2"]
n = mainApp(args);
This is the similar to the python version Lib/python/argcargv.i
02/24/2006: mgossage
Small update Lua documents on troubleshooting problems
02/22/2006: mmatus
Fix all the errors reported for 1.3.28.
- fix bug #1158178
- fix bug #1060789
- fix bug #1263457
- fix 'const char*&' typemap in the UTL, reported by Geoff Hutchison
- fixes for python 2.1 and the runtime library
- fix copyctor + template bug #1432125
- fix [ 1432152 ] %rename friend operators in namespace
- fix gcc warning reported by R. Bernstein
- avoid assert when finding a recursive scope inheritance,
emit a warning in the worst case, reported by Nitro
- fix premature object deletion reported by Paul in tcl3d
- fix warning reported by Nitro in VC7
- more fixes for old Solaris compiler
- fix for python 2.3 and gc_refs issue reported by Luigi
- fix fastproxy for methods using kwargs
- fix overload + protected member issue reported by Colin McDonald
- fix seterrormsg as reported by Colin McDonald
- fix directors, now the test-suite runs again using -directors
- fix for friend operator and Visual studio and bug 1432152
- fix bug #1435090
- fix using + %extend as reported by William
- fix bug #1094964
- fix for Py_NotImplemented as reported by Olly and Amaury
- fix nested namespace issue reported by Charlie
and also:
- allow director protected members by default
- delete extra new lines in swigmacros[UTL]
- cosmetic for generated python code
- add the factory.i library for UTL
- add swigregister proxy method and move __repr__ to a
single global module [python]
02/22/2006: mmatus
When using directors, now swig will emit all the virtual
protected methods by default.
In previous releases, you needed to use the 'dirprot'
option to achieve the same.
If you want, you can disable the new default behaviour,
use the 'nodirprot' option:
swig -nodirprot ...
and/or the %nodirector feature for specific methods, i.e.:
%nodirector Foo::bar;
struct Foo {
virtual ~Foo();
protected:
virtual void bar();
};
As before, pure abstract protected members are allways
emitted, independent of the 'dirprot/nodirprot' options.
02/22/2006: mmatus
Add the factory.i library for languages using the UTL (python,tcl,ruby,perl).
factory.i implements a more natural wrap for factory methods.
For example, if you have:
---- geometry.h --------
struct Geometry {
enum GeomType{
POINT,
CIRCLE
};
virtual ~Geometry() {}
virtual int draw() = 0;
//
// Factory method for all the Geometry objects
//
static Geometry *create(GeomType i);
};
struct Point : Geometry {
int draw() { return 1; }
double width() { return 1.0; }
};
struct Circle : Geometry {
int draw() { return 2; }
double radius() { return 1.5; }
};
//
// Factory method for all the Geometry objects
//
Geometry *Geometry::create(GeomType type) {
switch (type) {
case POINT: return new Point();
case CIRCLE: return new Circle();
default: return 0;
}
}
---- geometry.h --------
You can use the %factory with the Geometry::create method as follows:
%newobject Geometry::create;
%factory(Geometry *Geometry::create, Point, Circle);
%include "geometry.h"
and Geometry::create will return a 'Point' or 'Circle' instance
instead of the plain 'Geometry' type. For example, in python:
circle = Geometry.create(Geometry.CIRCLE)
r = circle.radius()
where 'circle' now is a Circle proxy instance.
02/17/2006: mkoeppe
[MzScheme] Typemaps for all integral types now accept the full range of integral
values, and they signal an error when a value outside the valid range is passed.
[Guile] Typemaps for all integral types now signal an error when a value outside
the valid range is passed.
02/13/2006: mgossage
[Documents] updated the extending documents to give a skeleton swigging code
with a few typemaps.
[Lua] added an extra typemap for void* [in], so a function which requires a void*
can take any kind of pointer
Version 1.3.28 (February 12, 2006)
==================================
02/11/2006: mmatus
Fix many issues with line counting and error reports.
02/11/2006: mmatus
[Python] Better static data member support, if you have
struct Foo {
static int bar;
};
then now is valid to access the static data member, ie:
f = Foo()
f.bar = 3
just as in C++.
02/11/2006: wsfulton
[Perl]
Fixed code generation to work again with old versions of Perl
(5.004 and later tested)
02/04/2006: mmatus
[Python] Add the %extend_smart_pointer() directive to extend
SWIG smart pointer support in python.
For example, if you have a smart pointer as:
template <class Type> class RCPtr {
public:
...
RCPtr(Type *p);
Type * operator->() const;
...
};
you use the %extend_smart_pointer directive as:
%extend_smart_pointer(RCPtr<A>);
%template(RCPtr_A) RCPtr<A>;
then, if you have something like:
RCPtr<A> make_ptr();
int foo(A *);
you can do the following:
a = make_ptr();
b = foo(a);
ie, swig will accept a RCPtr<A> object where a 'A *' is
expected.
Also, when using vectors
%extend_smart_pointer(RCPtr<A>);
%template(RCPtr_A) RCPtr<A>;
%template(vector_A) std::vector<RCPtr<A> >;
you can type
a = A();
v = vector_A(2)
v[0] = a
ie, an 'A *' object is accepted, via implicit conversion,
where a RCPtr<A> object is expected. Additionally
x = v[0]
returns (and sets 'x' as) a copy of v[0], making reference
counting possible and consistent.
%extend_smart_pointer is just a collections of new/old
tricks, including %typemaps and the new %implicitconv
directive.
02/02/2006: mgossage
bugfix #1356577, changed double=>lua_number in a few places.
added the std::pair wrapping
01/30/2006: wsfulton
std::string and std::wstring member variables and global variables now use
%naturalvar by default, meaning they will now be wrapped as expected in all languages.
Previously these were wrapped as a pointer rather than a target language string.
It is no longer necessary to add the following workaround to wrap these as strings:
%apply const std::string & { std::string *}
*** POTENTIAL INCOMPATIBILITY ***
01/28/2006: mkoeppe
[Guile -scm]
Add typemaps for handling of member function pointers.
01/24/2006: mmatus
- Better support for the %naturalvar directive, now it
works with the scripting languages as well as
Java/C#.
Now, it can also be applied to class types:
%naturalvar std::string;
%include <std_string.i>
that will tell swig to use the 'natural' wrapping
mechanism to all std::string global and member
variables.
- Add support for the %allowexcept feature along the
scripting languages, which allows the %exception feature
to be applied to the variable access methods. Also, add
the %exceptionvar directive to specify a distintic
exception mechanism only for variables.
- Add more docs for the %delobject directive to mark a method as a
destructor, 'disowning' the first argument. For example:
%newobject create_foo;
%delobject destroy_foo;
Foo *create_foo() { return new Foo(); }
void destroy_foo(Foo *foo) { delete foo; }
or in a member method as:
%delobject Foo::destroy;
class Foo {
public:
void destroy() { delete this;}
private:
~Foo();
};
01/24/2006: mgossage
[Lua]
- Removed the type swig_lua_command_info & replace with luaL_reg
(which then broke the code), fixed this
- added an additional cast in the typemaps for enum's
due to the issue that VC.Net will not allow casting of
a double to an enum directly. Therefore cast to int then to enum
(thanks to Jason Rego for this observation)
01/16/2006: mmatus (Change disabled... will be back in CVS soon)
Add initial support for regexp via the external library
RxSpencer. SWIG doesn't require this library to compile
and/or run. But if you specify --with-rxspencer, and the
library is found during installation, then swig will use
it in three places:
- In %renames rules, via the new rxsmatch rules, for example:
%rename("%(lowercase)",rxsmatch$name="GSL_.*") "";
%rename("%(lowercase)",rxsmatch$nodeType="enum GSL_.*") "";
rxsmatch is similar to the match rule, it just uses
the RxSpencer regexp library to decide if there is a
match with the provided regexp. As with the match
rule, you can also use the negate rule notrxsmatch.
- In the %rename target name via the rxstarget option, for example:
%rename("%(lowercase)",rxstarget=1) "GSL_.*";
where the target name "GSL.*" is now understood as a
regexp to be matched.
- In the new encoder "rxspencer", which looks like:
%(rxspencer:[regexp][replace])s
where "regexp" is the regular expression and "replace"
is a string used as a replacement, where the @0,@1,...,@9
pseudo arguments are used to represent the
corresponding matching items in the reg expression.
For example:
%(rxspencer:[GSL.*][@0])s <- Hello ->
%(rxspencer:[GSL.*][@0])s <- GSLHello -> GSLHello
%(rxspencer:[GSL(.*)][@1])s <- GSLHello -> Hello
%(rxspencer:[GSL(.*)][gsl@1])s <- GSLHello -> gslHello
Another example could be:
%rename("%(lowercase)s",sourcefmt="%(rxspencer:[GSL_(.*)][@1])s",%$isfunction) "";
which take out the prefix "GSL_" and returns all the
function names in lower cases, as following:
void GSL_Hello(); -> hello();
void GSL_Hi(); -> hi();
const int GSL_MAX; -> GSL_MAX; // no change, is not a function
We use the RxSpencer as an initial test bed to
implemention while we decide which library will be
finally added to swig.
You can obtain the RxSpencer library from
http://arglist.com/regex (Unix)
or
http://gnuwin32.sourceforge.net/packages.html (Windows)
Once installed, use "man rxspencer" to get more info
about the regexp format, or just google rxspencer.
Since now you can enable the rxsmatch rules (see above),
the simple or '|' support for the match rules
(01/12/2006: mmatus) is disabled. Still, if you have
problems with the rxspencer library, you can re-enable
the simple 'match or' support using
-DSWIG_USE_SIMPLE_MATCHOR.
01/16/2006: mmatus
Change the %rename predicates to use the prefix '%$', as in:
%rename("%(utitle)s",%$isfunction,%$ismember) "";
to avoid clashes with other swig macros/directives.
01/14/2006: cfisavage
[Ruby]
Added support for Ruby bang! methods via a new %bang feature.
Bang methods end in exclamation points and indicate that the
object being processed will be modified in-place as
opposed to being copied.
01/12/2006: cfisavage
[Ruby]
Updated the Ruby module to automatically convert
method names to lower_case_with_underscores using the
new %rename functionality.
01/12/2006: mmatus
- Add aliases for 'case' encoders used with %rename/%namewarn
%(uppercase)s hello_world -> HELLO_WORLD
%(lowercase)s HelloWorld -> helloworld
%(camelcase)s hello_world -> HelloWorld
%(undercase)s HelloWorld -> hello_world
01/12/2006: mmatus
- Add the -dump_parse_module and -dump_parse_top options,
which are similar to -dump_module and -dump_top, but they
dump the node trees just after parsing, showing only the
attributes visible at the parsing stage, and not the added
later in typemap.cxx, allocate.cxx, lang.cxx or elsewhere.
Besides debugging porpuses, these options are very useful
if you plan to use %rename in an "advance way", since it
shows only and all the node's attributes you can use
inside the match rules.
01/12/2006: mmatus
- Add predicates to %rename, so, you don't need to
remember, for example, how to match a member function.
Now it is easy, for example to use the 'utitle' encoder
in all the member methods, you type:
%rename("%(utitle)s",%isfunction,%ismember) "";
or to ignore all the enumitems in a given class:
%rename("$ignore", %isenumitem, %classname="MyClass") "";
Available predicates are (see swig.swg):
%isenum
%isenumitem
%isaccess
%isclass
%isextend
%isextend
%isconstructor
%isdestructor
%isnamespace
%istemplate
%isconstant
%isunion
%isfunction
%isvariable
%isimmutable
%isstatic
%isfriend
%istypedef
%isvirtual
%isexplicit
%isextern
%ismember
%isglobal
%innamespace
%ispublic
%isprotected
%isprivate
%classname
These predicates correspond to specific 'match'
declarations, which sometimes are not as evident as the
predicates names.
- Add the or '|' operation in %rename match, for
example to capitalize all the constants (%constant or
const cdecl):
%rename("%(upper)s",match="cdecl|constant",%isimmutable) "";
01/12/2006: mgossage
- Partial fixed of errors under C89, bug #1356574
(converted C++ style comments to C style)
- Added patches from neomantra@users.sf.net #1379988 and #1388343
missing a 'return' statement for error conditions
also updated the %init block bug #1356586
01/10/2006: mmatus
- Add the 'utitle' encoder, as an example of how to add
your own encoder. I added the encoder method in misc.c
but developers can add others, the same way, inside any
target language.
Well, 'utitle' is the reverse of 'ctitle', ie:
%rename("%(ctitle)s") camel_case; -> CamelCase;
%rename("%(utitle)s") CamelCase; -> camel_case;
01/10/2006: cfisavage
[Ruby]
Updated Ruby Exception handling. Classes that are specified in throws clauses,
or are marked as %exceptionclass, are now inherited from rb_eRuntimeError.
This allows instances of these classes to be returned to Ruby as exceptions.
Thus if a C++ method throws an instance of MyException, the calling Ruby
method will get back a MyException object. To see an example,
look at ruby/examples/exception_class.
01/10/2006: mmatus
- Add the %catches directive, which complements the %exception
directive in a more automatic way. For example, if you have
int foo() throw(E1);
swig generates the proper try/catch code to dispatch E1.
But if you have:
int barfoo(int i) {
if (i == 1) {
throw E1();
} else {
throw E2();
}
return 0;
}
ie, where there is no explicit exception specification in the decl, you
end up doing:
%exception barfoo {
try {
$action
} catch(E1) { ... }
} catch(E2) { ... }
}
which is very tedious. Well, the %catches directive defines
the list of exceptions to catch, and from swig:
%catches(E1,E2) barfoo(int i);
int barfoo(int i);
is equivalent to
int barfoo(int i) throw(E1,E2);
Note, however, that the %catches list doesn't have to
correspond to the C++ exception specification. For example, if you
have:
struct E {};
struct E1 : E {};
struct E2 : E {};
int barfoo(int i) throw(E1,E2);
you can define
%catches(E) barfoo(int i);
and swig will generate an action code equivalent to
try {
$action
} catch(E &_e) {
<raise _e>;
}
Of course, you still have to satisfy the C++ restrictions,
and the catches list must be compatible (not the same)
as the original list of types in the exception specification.
Also, you can now specify that you want to catch the
unknown exception '...', for example:
%catches(E1,E2,...) barfoo(int);
In any case, the %catches directive will emit the
code to convert into the target language error/exception
using the 'throws' typemap.
For the '...' case to work, you need to
write the proper typemap in your target language. In the
UTL, this looks like:
%typemap(throws) (...) {
SWIG_exception(SWIG_RuntimeError,"unknown exception");
}
01/09/2006: mutandiz
[Allegrocl]
Fixes a number of SEGVs primarily in the handling of
various anonymous types. Found in a pass through the
swig test-suite. Still more to do here, but this is a
good checkpoint.
Adds -cwrap and -nocwrap as an allegrocl specific
command-line argument. Controls generating of a C
wrapper file when wrapping C code. By default only a
lisp file is created for C code wrapping.
Doc updates for the command-line arguments and fixes as
pointed out on swig-devel
01/05/2006: wsfulton
[Java] Fix unsigned long long and const unsigned long long & typemaps
- Bug #1398394 with patch from Dries Decock
01/06/2006: mmatus
Add 'named' warning codes, now in addition to:
%warnfilter(813);
you can use
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE);
just use the same code name found in Source/Include/swigwarn.h
plus the 'SWIG' prefix.
If a developer adds a new warning code, the Lib/swigwarn.swg file
will be generated when running the top level make.
01/05/2006: cfisavage
[Ruby]
Reimplemented object tracking for Ruby. The new implementation works
by expanding the swig_class structure for Ruby by adding a trackObjects
field. This field can be set/unset via %trackobjects as explained
in the Ruby documentation. The new implementation is more robust
and takes less code to implement.
01/05/2006: wsfulton
Fix for %extend and static const integral types, eg:
class Foo {
public:
%extend {
static const int bar = 42;
}
};
12/30/2005: mmatus
- Add info for old and new debug options:
-dump_top - Print information of the entire node tree, including system nodes
-dump_module - Print information of the module node tree, avoiding system nodes
-dump_classes - Print information about the classes found in the interface
-dump_typedef - Print information about the types and typedefs found in the interface
-dump_tags - Print information about the tags found in the interface
-debug_typemap - Print information for debugging typemaps
-debug_template - Print information for debugging templates
- Add the fakeversion. If you have a project that uses
configure/setup.py, or another automatic building system
and requires a specific swig version, let say 1.3.22
you can use:
SWIG_FEATURES="-fakeversion 1.3.22"
or
swig -fakeversion 1.3.22
and then swig -version will report 1.3.22 instead of the
current version.
Typical use would be
SWIG_FEATURES="-fakeversion 1.3.22" ./configure
12/30/2005: mmatus
- Add option/format support to %rename and %namewarn.
Now %namewarn can force renaming, for example:
%namewarn("314: import is a keyword",rename="_%s") "import";
and rename can also support format forms:
%rename("swig_%s") import;
Now, since the format is processed via swig Printf, you
can use encoders as follows:
%rename("%(title)s") import; -> Import
%rename("%(upper)s") import; -> IMPORT
%rename("%(lower)s") Import; -> import
%rename("%(ctitle)s") camel_case; -> CamelCase
This will allow us to add more encoders, as the
expected one for regular expressions.
- Add the above 'ctitle' encoder, which does the camel case:
camel_case -> CamelCase
- Also, while we get the regexp support, add the 'command' encoder,
you can use it as follows
%rename("%(command:sed -e 's/\([a-z]\)/\U\\1/' <<< )s") import;
then swig will popen the command
"sed -e 's/\([a-z]\)/\U\\1/' <<< import"
see below for anonymous renames for better examples.
- The rename directive now also allows:
- simple match: only apply the rename if a type match
happen, for example
%rename(%(title)s,match="enumitem") hello;
enum Hello {
hi, hello -> hi, Hello
};
int hello() -> hello;
- extended match: only apply the rename if the 'extended attribute' match
occurred, for example:
// same as simple match
%rename(%(title)s,match$nodeType="enumitem") hello;
enum Hello {
hi, hello -> hi, Hello
};
Note that the symbol '$' is used to define the attribute name in
a 'recursive' way, for example:
// match only hello in 'enum Hello'
%rename(%(title)s,match$parentNode$type="enum Hello") hello;
enum Hello {
hi, hello -> hi, Hello // match
};
enum Hi {
hi, hello -> hi, hello // no match
};
here, for Hello::hi, the "parentNode" is "Hello", and its "type"
is "enum Hello".
- Anonymous renames: you can use 'anonymous' rename directives, for example:
// rename all the enum items in Hello
%rename(%(title)s,match$parentNode$type="enum Hello") "";
enum Hello {
hi, hello -> Hi, Hello // match both
};
enum Hi {
hi, hello -> hi, hello // no match
};
// rename all the enum items
%rename(%(title)s,match$nodeType="enumitem") "";
// rename all the items in given command (sloooow, but...)
%rename(%(command:<my external cmd>)s) "";
Anonymous renames with commands can be very powerful, since you
can 'outsource' all the renaming mechanism (or part of it) to an
external program:
// Uppercase all (and only) the names that start with 'i'
%rename("%(command:awk '/^i/{print toupper($1)}' <<<)s") "";
int imported() -> IMPORTED;
int hello() -> hello
Note that if the 'command' encoder returns an empty string, swig
understands that no rename is necessary.
Also note that %rename 'passes' the matched name. For example, in
this case
namespace ns1 {
int foo();
}
namespace ns2 {
int bar();
}
the external program only receives "foo" and "bar". If needed,
however, you can request the 'fullname'
%rename("%(command:awk 'awk '/ns1::/{l=split($1,a,"::"); print toupper(a[l])}'' <<<)s",fullname=1) "";
ns1::foo -> FOO
ns2::bar -> bar
- Mixing encoders and matching: of course, you can do mix commands
and match fields, for example:
%rename("%(<my encoder for fncs>)",match="cdecl") "";
%rename("%(<my encoder for enums>)",match="enumitem") "";
%rename("%(<my encoder for enums inside a class>)",match="enumitem",
match$parentNode$parentNode$nodeType="class") "";
Use "swig -dump_parse_module" to see the attribute names you can use to
match a specific case.
- 'sourcefmt' and 'targetfmt': sometimes you need to
process the 'source' name before comparing, for example
%namewarn("314: empty is a keyword",sourcefmt="%(lower)s") "empty";
then if you have
int Empty(); // "Empty" is the source
you will get the keyword warning since 'Empty' will be
lower cased, via the sourcefmt="%(lower)s" option,
before been compared to the 'target' "empty".
There is an additional 'targetfmt' option to process the
'target' before comparing.
- complementing 'match': you can use 'notmatch', for example
%namewarn("314: empty is a keyword",sourcefmt="%(lower)s",notmatch="namespace") "empty";
here, the name warning will be applied to all the symbols except namespaces.
12/30/2005: mmatus
- Add initial support for gcj and Java -> <target language> mechanism.
See examples in:
Examples/python/java
Examples/ruby/java
Examples/tcl/java
to see how to use gcj+swig to export java classes into
python/ruby/tcl.
The idea is to put all the common code for gcj inside
Lib/gcj
and localize specific types such as jstring, as can be found
in
Lib/python/jstring.i
Lib/ruby/jstring.i
Lib/tcl/jstring.i
Using the UTL, this is very easy, and the perl version for
jstring.i will be next.
12/29/2005: mmatus
- Add the copyctor feature/directive/option to enable the automatic
generation of copy constructors. Use as in:
%copyctor A;
struct A {
};
then this will work
a1 = A();
a2 = A(a1);
Also, since it is a feature, if you just type
%copyctor;
that will enable the automatic generation for all the
classes. It is also equivalent to
swig -copyctor -c++ ...
Notes:
1.- The feature only works in C++ mode.
2.- The automatic creation of the copy constructor will
usually produce overloading. Hence, if the target
language doesn't support overloading, a special name
will be used (A_copy).
3.- For the overloading reasons above, it is probably not
a good idea to use the flag when, for example, you are
using keywords in Python.
4.- The copyctor automatic mechanism follows more or less
the same rules as the default constructor mechanism,
i.e., a copy constructor will not be added if the
class is abstract or if there is a pertinent non-public
copy ctor in the class or its hierarchy.
Hence, it might be necessary for you to complete the
class declaration with the proper non-public copy ctor
to avoid a wrong constructor addition.
- Fix features/rename for templates ctor/dtor and other
things around while adding the copyctor mechanism.
12/27/2005: mmatus
- Add the 'match' option to typemaps. Assume you have:
%typemap(in) SWIGTYPE * (int res) {..}
%typemap(freearg) SWIGTYPE * { if (res$argnum) ...}
then if you do
%typemap(in) A * {...}
swig will 'overload the 'in' typemap, but the 'freearg'
typemap will be also applied, even when this is wrong. The old
solutions is to write:
%typemap(in) A * {...}
%typemap(freeag) A * "";
overload 'freearg' with an empty definition.
The problem is, however, there is no way to know you need
to do that until you start getting broken C++ code, or
worse, broken runtime code.
The same applies to the infamous 'typecheck' typemap,
which always confuses people, since the first thing you do
is to just write the 'in' typemap.
The 'match' option solves the problem, and if instead you write:
%typemap(in) SWIGTYPE * (int res) {..}
%typemap(freearg,match="in") SWIGTYPE * { if (res$argnum) ...}
%typemap(typecheck,match="in",precedence...) SWIGTYPE * {...}
it will tell swig to apply the 'freearg/typecheck'
typemaps only if they 'match' the type of the 'in'
typemap. The same can be done with other typemaps as:
%typemap(directorout) SWIGTYPE * {...}
%typemap(directorfree,match="directorout") SWIGTYPE * {...}
12/27/2005: mmatus
- Add the 'naturalvar' option/mode/feature to treat member
variables in a more natural way, ie, similar to the global
variable behavior.
You can use it in a global way via the command line
swig -naturalvar ...
or the module mode option
%module(naturalvar=1)
both forms make swig treat all the member variables in the
same way it treats global variables.
Also, you can use it in a case by case approach for
specific member variables using the directive form:
%naturalvar Bar::s;
Then, in the following case for example:
std::string s;
struct Bar {
std::string s;
};
you can do:
b = Bar()
b.s ="hello"
cvar.s = "hello"
if (b.s != cvar.s):
raise RuntimeError
This is valid for all the languages, and the
implementation is based on forcing the use of the
const SWIGTYPE& (C++)/SWIGTYPE (C) typemaps for the
get/set methods instead of the SWIGTYPE * typemaps.
Hence, for 'naturalvar' to work, each target language
must implement 'typemap(in/out) const Type&' properly.
The 'naturalvar' option replaces or makes workarounds such as:
%apply const std::string & { std::string *}
unnecessary.
Note1: If your interface has other kinds of workarounds to
deal with the old 'unnatural' way to deal with member
variables (returning/expecting pointers), the
'naturalvar' option could break them.
Note2: the option has no effect on unnamed types, such
as unnamed nested unions.
12/27/2005: mmatus
- Add more 'expressive' result states for the typemap
libraries.
In the past, for scripting languages, you would do checking something like:
if (ConvertPtr(obj,&vptr,ty,flags) != -1) {
// success
} else {
// error
}
Now the result state can carry more information,
including:
- Error state: like the old -1/0, but with error codes from swigerrors.swg.
int res = ConvertPtr(obj,&vptr,ty,flags);
if (SWIG_IsOK(res)) {
// success code
} else {
SWIG_Error(res); // res carries the error code
}
- Cast rank: when returning a simple successful
conversion, you just return SWIG_OK, but if you need
to do a 'cast', you can add the casting rank, ie:
if (PyFloat_Check(obj)) {
value = PyFloat_AsDouble(obj);
return SWIG_OK;
} else if (PyInt_Check(obj)) {
value = (double) PyInt_AsLong(obj);
return SWIG_AddCast(SWIG_OK);
}
later, the casting rank is used to properly dispatch
the overloaded function, for example. This of course
requires your language to support and use the new
dispatch cast/rank mechanism (Now mainly supported in
perl and python, and easily expandable to ruby and tcl).
- [UTL] Add support for the new 'expressive' result states.
12/27/2005: mmatus
- Add support for the C++ implicit conversion mechanism, which
required some modifications in parser.y (to recognize
'explicit') and overload.cxx (to replace $implicitconv as
needed).
Still, real support in each target language requires each
target language to be modified. Python provides an example,
see below.
- Add support for native C++ implicit conversions, ie, if you
have
%implicitconv A;
struct A {
int ii;
A() {ii = 1;}
A(int) {ii = 2;}
A(double) {ii = 3;}
explicit A(char *s) {ii = 4;}
};
int get(const A& a) {return a.ii;}
you can call:
a = A()
ai = A(1)
ad = A(1.0)
as = A("hello")
# old forms
get(a) -> 1
get(ai) -> 2
get(ad) -> 3
get(as) -> 4
#implicit conversions
get(1) -> 2
get(1.0) -> 3
get("hello") -> Error, explicit constructor
Also, as in C++, now implicit conversions are supported in
variable assigments, and if you have:
A ga;
struct Bar {
A a;
};
you can do:
cvar.ga = A(1)
cvar.ga = 1
cvar.ga = 1.0
cvar.ga = A("hello")
cvar.ga = "hello" -> error, explicit constructor
b = Bar()
b.a = A("hello")
b.a = 1
b.a = 1.0
b.a = "hello" -> error, explicit constructor
Note that the last case, assigning a member var directly,
also requires the 'naturalvar' option.
This support now makes the old '%implicit' macro, which
was found in 'implicit.i' and it was fragile in many ways,
obsolete, and you should use the new '%implicitconv'
directive instead.
Note that we follow the C++ conventions, ie, in the
following the implicit conversion is allowed:
int get(A a) {return a.ii;}
int get(const A& a) {return a.ii;}
but not in these cases:
int get(A *a) {return a->ii;}
int get(A& a) {return a.ii;}
Also, it works for director methods that return a by value
result, ie, the following will work:
virtual A get_a() = 0;
def get_a(self):
return 1
but not in this case:
virtual const A& get_a() = 0;
virtual A& get_a() = 0;
virtual A* get_a() = 0;
Notes:
- the implicitconv mechanism is implemented by directly
calling/dispatching the python constructor, triggering a
call to the __init__method. Hence, if you expanded the
__init__ method, like in:
class A:
def __init__(self,args):
<swig code>
<my code here>
then 'my code' will also be executed.
- Since the %implicitconv directive is a SWIG feature, if you type:
%implicitconv;
that will enable implicit conversion for all the classes in
your module.
But if you are worried about performance, maybe that will be
too much, especially if you have overloaded methods, since
to resolve the dispatching problem, python will efectively
try to call all the implicit constructors as needed.
- For the same reason, it is highly recommended that you use
the new 'castmode' when mixing implicit conversion and
overloading.
- [python] The %implicit directive is declared obsolete, and
you should use %implicitconv instead. If you include
the implicit.i file, a warning will remind you of this.
Note: Since %implicit is fragile, just replacing it by
%implicitconv could lead to different behavior. Hence, we
don't automatically switch from to the other, and the user
must migrate to the new %implicitconv directive manually.
12/26/2005: wsfulton
[C#]
Modify std::vector wrappers to use std::vector::value_type as this is
closer to the real STL declarations for some methods, eg for push_back().
Fixes some compilation errors for some compilers eg when the templated
type is a pointer.
[Java]
std::vector improvements - a few more methods are wrapped and specializations are
no longer required. The specialize_std_vector macro is no longer needed (a
warning is issued if an attempt is made to use it).
12/26/2005: wsfulton
[Java, C#]
Add in pointer reference typemaps. This also enables one to easily wrap
std::vector<T> where T is a pointer.
12/24/2005: efuzzyone
[CFFI] The cffi module for SWIG:
- Fully supports C, but provides limited supports for C++, in
particular C++ support for templates and overloading needs to
be worked upon.
12/23/2005: mmatus
[python] Add the castmode that allows the python
type casting to occur.
For example, if you have 'int foo(int)', now
class Ai():
def __init__(self,x):
self.x = x
def __int__(self):
return self.x
foo(1) // Ok
foo(1.0) // Ok
foo(1.3) // Error
a = Ai(4)
foo(ai) // Ok
The castmode, which can be enabled either with the
'-castmode' option or the %module("castmode") option, uses
the new cast/rank dispatch mechanism. Hence, now if you
have 'int foo(int); int foo(double);', the following works
as expected:
foo(1) -> foo(int)
foo(1.0) -> foo(double)
ai = Ai(4)
foo(ai) -> foo(int)
Note1: the 'castmode' could disrupt some specialized
typemaps. In particular, the "implicit.i" library seems to
have problem with the castmode. But besides that one, the
entire test-suite compiles fine with and without the
castmode.
Note2: the cast mode can't be combined with the fast
dispatch mode, ie, the -fastdispatch option has no effect
when the cast mode is selected. The penalties, however,
are minimum since the cast dispatch code is already based
on the same fast dispatch mechanism.
See the file overload_dispatch_cast_runme.py file for
new cases and examples.
12/22/2005: mmatus
Add the cast and rank mechanism to dispatch overloading
functions. The UTF supports it now, but for each language
it must be decided how to implement and/or when to use it.
[perl] Now perl uses the new cast and rank dispatch
mechanism, which solves all the past problems known
in perl, such as the old '+ 1' problem:
int foo(int);
$n = 1
$n = $n + 1
$r = foo(n)
also works:
foo(1);
foo("1");
foo(1.0);
foo("1.0");
but fails
foo("l");
and when overloading foo(int) and foo(double);
foo(1) -> foo(int)
foo(1.0) -> foo(double)
foo("1") -> foo(int)
foo("1.0") -> foo(double)
foo("l") -> error
foo($n) -> foo(int) for good perl versions
foo($n) -> foo(double) for old bad perl versions
when overloading foo(int), foo(char*) and foo(double):
foo(1) -> foo(int)
foo(1.0) -> foo(double)
foo("1") -> foo(char*)
foo("1.0") -> foo(char*)
foo("l") -> foo(char*)
Note: In perl the old dispatch mechanism was broken,
so, we don't provide an option to enable the old one
since, again, it was really really broken.
See 'overload_simple_runme.pl' for more cases and tests.
PS: all the old known issues are declared resolved, any
new "problem" that could be discovered is declared,
a priori, as "features" of the new dispatch mechanism
(until we find another solution at least).
*** POTENTIAL INCOMPATIBILITY ***
As with the introduction of the UTF, some things could
now start to work as expected, and people used to deal or
workaround previous bugs related to the dispatch
mechanism, could see now a difference in perl behavior.
12/21/2005: mmatus
- The '-nodefault' flag (pragma and feature) now generates
a warning, and recommends to use the explicit
-nodefaultctor and -nodefaultdtor options.
The reason to split the 'nodefault' behavior is that, in
general, ignoring the default destructor generates memory
leaks in the target language. Hence, is too risky just to
disable both the default constructor and destructor
at the same time.
If you need to disable the default destructor, it is
also recommended you use the directive form:
%nodefaultdtor MyVerySpecialClass;
for specific classes, and always avoid using the global
-nodefault and -nodefaultdtor options.
12/21/2005: wsfulton
[Java, C#]
Fix incorrect code generation when the intermediary classname is changed
in the module directive from its default. For example:
%module(jniclassname="myimclassnewname") "mymodule" // Java
%module(imclassname="myimclassnewname") "mymodule" // C#
Add in new special variable $imclassname. See docs.
12/17/2005: mmatus
[Python]
- Add the -aliasobj0/-noaliasobj0 options to use with
-fastunpack and/or -O and old typemaps that use 'obj0'
directly.
So, if you compile your code using -O and get errors about
the undeclared 'obj0' variable, run again using
swig -O -aliasobj0 -python ....
For new typemaps, never use 'obj0' directly, if needed,
use the '$self' name that will be properly expanded to
'obj0' (nofastunpack) or 'swig_obj[0]' (fastunpack).
If you have no idea what I am talking about, better, that
means you have no typemap with this problem.
12/14/2005: mmatus
[Python]
- Add the -fastunpack/-nofastunpack options to enable/disable
the use of the internal UnpackTuple method, instead of
calling the one from the python C API.
The option -O now also implies -fastunpack.
12/11/2005: mmatus
[Python]
- Add the -proxydel/-noproxydel options to enable/disable
the generation of proxy/shadow __del__ methods, even
when now they are redundant, since they are empty.
However, old interfaces could rely on calling them.
The default behavior is to generate the __del__ methods
as in 1.3.27 or older swig versions.
The option -O now also implies -noproxydel.
12/10/2005: mmatus
[UTF]
- Fix unnecessary calls to SWIG_TypeQuery for 'char *'
and 'wchar_t *', problem found by Clay Culver while
profiling the PyOgre project.
[Python]
- Add the -dirvtable/-nodirvtable to enable/disable
a pseudo virtual table used for directors, avoiding
the need to resolve the python method at each call.
- Add the -safecstrings/-nosafecstrings options to
enable/disable the use of safe conversions from PyString
to char *. Python requires you to never change the internal
buffer directly, and hence 'safectrings' warranties that
but returning a copy of the internal python string buffer.
The default, as in previous releases, is to return a
pointer to the buffer (nosafecstrings), so, it is the user's
responsibility to avoid its modification.
- Add the -O option to enable all the optimization options
at once, initially equivalent to
-modern -fastdispatch -dirvtable -nosafecstrings -fvirtual
12/08/2005: mmatus
- Add the -fastdispatch option (fastdispatch feature). This
enables the "fast dispatch" mechanism for overloaded
methods provided by Salvador Fandi~no Garc'ia (#930586).
The resulting code is smaller and faster since less type
checking is performed. However, the error messages you
get when the overloading is not resolved could be
different from what the traditional method returns.
With the old method you always get an error such as
"No matching function for overloaded ..."
with the new method you can also get errors such as
"Type error in argument 1 of type ..."
See bug report #930586 for more details.
So, this optimization must be explicitly enabled by users.
The new mechanism can be used as:
swig -fastdispatch
or using the feature form
%feature("fastdispatch") method;
or
%fastdispatch method;
12/06/2005: mmatus
- Several memory and speed improvements, specially for
templates. Now swig is up to 20 faster than before for
large template interfaces, such as the std_containers.i
and template_matrix.i files in the python test-suite.
Memory footprint is also reduced in consideration of small
pcs/architectures.
- add commandline options -cpperraswarn and -nocpperraswarn" to force
the swig preprocessor to treat the #error directive as a #warning.
the pragmas
#pragma SWIG cpperraswarn=1
#pragma SWIG cpperraswarn=0
are equivalent to the command line options, respectively.
12/06/2005: mmatus
[Python] The generated code is now more portable, especially
for Windows. Following
http://www.python.org/doc/faq/windows.html
Py_None is never accessed as a structure, plus other
tricks mentioned there.
12/06/2005: mmatus
[Python] Added initial support for threads based in the
proposal by Joseph Winston.
The user interface is as follows:
1.- the module thread support is enable via the "threads" module
option, i.e.
%module("threads"=1)
2.- Equivalent to that, is the new '-threads' swig option
swig -threads -python ...
3.- You can partially disable thread support for a given
method using:
%feature("nothread") method;
or
%nothread method;
also, you can disable sections of the thread support,
for example
%feature("nothreadblock") method;
or
%nothreadblock method;
%feature("nothreadallow") method;
or
%nothreadallow method;
the first disables the C++/python thread protection, and the
second disables the python/C++ thread protection.
4.- The current thread support is based in the PyGIL
extension present in python version 2.3 or later, but
you can provide the thread code for older versions by
defining the macros in pythreads.swg.
If you get a working implementation for older versions,
please send us a patch.
For the curious about performance, here are some numbers
for the profiletest.i test, which is used to check the speed
of the wrapped code:
nothread 9.6s (no thread code)
nothreadblock 12.2s (only 'allow' code)
nothreadallow 13.6s (only 'block' code)
full thread 15.5s ('allow' + 'block' code)
i.e., full thread code decreases the wrapping performance by
around 60%. If that is important to your application, you
can tune each method using the different 'nothread',
'nothreadblock' or 'nothreadallow' features as
needed. Note that for some methods deactivating the
'thread block' or 'thread allow' code is not an option,
so, be careful.
11/26/2005: wsfulton
SWIG library files use system angle brackets everywhere for %include, eg
%include "std_common.i"
becomes
%include <std_common.i>
11/26/2005: wsfulton
[Java, C#]
Typesafe enums and proper enums have an extra constructor so that enum item values that
are initialised by another enum item value can be wrapped without having to use %javaconstvalue/
%csconstvalue for when using %javaconst(1)/%csconst(1). Suggestion by
Bob Marinier/Douglas Pearson.
For example:
typedef enum
{
xyz,
last = xyz
} repeat;
11/21/2005: mmatus
[ruby + python]
Fixes for directors + pointers. This is an ugly problem without an easy
solution. Before we identified this case as problematic:
virtual const MyClass& my_method();
but it turns out that all the cases where a pointer, array or
reference is returned, are problematic, even for
primitive types (as int, double, char*, etc).
To try to fix the issue, a new typemap was added,
'directorfree', which is used to 'free' the resources
allocated during the 'directorout' phase. At the same
time, a primitive garbage collector engine was added to
deal with orphaned addresses, when needed.
The situation is much better now, but still it is possible to have
memory exhaustation if recursion is used.
So, still you need to avoid returning pointers, arrays or
references when using director methods.
- Added stdint.i - typemaps for latest C99 integral types found in stdint.h.
11/14/2005: wsfulton
More types added to windows.i, eg UINT8, WORD, BYTE etc.
Including windows.i will also enable SWIG to parse the __declspec Microsoft
extension, eg __declspec(dllimport). Also other Windows calling conventions
such as __stdcall.
11/10/2005: wsfulton
New library file for Windows - windows.i. This file will contain useful type
information for users who include windows.h. Initial support is for the
non ISO integral types: __int8, __int16, __int32, __int64 and unsigned versions.
The unsigned versions previously could not be parsed by SWIG. SF #872013.
11/09/2005: wsfulton
[Java, C#] Portability warning for files which will overwrite each other on case
insensitive file systems such as FAT32/NTFS. This will occur, for example, when two
class names are the same barring case. The warning is issued on all platforms and
can be suppressed with the usual warning suppression techniques. SF bug #1084507.
11/09/2005: wsfulton
./configure --with-python --with-ruby --with-perl5 etc enable these languages,
ie the --with-xxxx options, where no path is specified, work the same as if
the option was not specified at all. Based on patches #1335042 #1329048 #1329047.
11/09/2005: dancy
[Allegrocl]
Add C++ support to the Allegrocl module. Further
enhances the C support as well. Some of the
features:
- MUCH better generation of foreign types based on
the C/C++ types for use in defining the FFI on
the lisp side. We don't pass everything as a (* :void)
any longer.
- Uses typemaps for better control of type conversions
and code generation in the generated lisp and c++ wrapper
code.
- CLOS wrapping of pointers returned from foreign space
makes it easier to differentiate pointers in user code.
The wrapping objects can be passed directly to FF calls.
- Defun wrapping of FF calls, allowing for more lispy
interface. Conversion, GCing, of lisp objects to
foreign objects can be done in the wrapping defun via
the use of typemaps.
- overload dispatching implemented on the lisp side
using generic functions.
- Templates and synonymous types supported.
11/07/2005: mmatus
[Python] Adding proper support for multi-inheritance in
the python side, ie, if you have two C++ wrapped class, Foo
and Bar, now:
class MyPythonClass(Foo,Bar):
....
will properly work, even with directors, and the
deallocation of Foo.this and Bar.this will follow
correctly. Before, a class could only have one 'this'
instance (unlike C++), only the last base class was
properly deleted, or detected with directors.
Now 'self.this' can be a list, which will contain the C++
instance pointers for all the base classes.
Also, swig.this is responsible for deallocating the C++
instance(s), and the __del__ method is not emitted unless
the user preppend/append some code to it.
- Swig can now detect memory leaks, ie, if you still
don't use proxy/shadow classes, and type something like
import _example
f = _example.new_Foo()
and forget to call _example.delete_Foo(f), then swig will
tell you that there is a memory leak.
Otherwise, if you always use the proxy classes, you probably
you will never ever see this warning unless there is
something wrong inside the swig wrapping code.
*** POTENTIAL INCOMPATIBILITY ***
If you overloaded the __del__ method, and call the base
one without a try block, as in
class MyClass(SwigClass):
def __del__(self):
<your code here>
SwigClass.__del__(self)
python could complain that the method SwigClass.__del__ is
undefined. Try to use instead:
def __del__(self):
<your code here>
try: SwigClass.__del__(self)
except: pass
or simply
def __del__(self):
<your code here>
11/02/2005: mmatus
[Python] Adding more fun to STL/STD containers, now you
can do
%template(pyset) std::set<PyObject *>;
%template(pyvector) std::vector<PyObject *>;
%template() std::pair<PyObject *,PyObject *>;
%template(pyvector) std::map<PyObject *,PyObject *>;
....
The same applies to std::list, std::deque, std::multiset, etc.
Then, at the python side you can do now:
# C++ std::vector as native python sequence
v = pyvector([1,"hello",(1,2)])
print v[1]
>> 'hello'
print v[2]
>> (1,2)
# C++ std::set as native python sequence
s = pyset()
s.insert((1,2))
s.insert(1)
s.insert("hello")
sum=()
for i in s:
sum +=(i,)
print sum
>>> (1, 'hello', (1, 2))
# C++ std::map as native python sequence
m = pymap()
m["foo"] = "hello"
m[1] = (1,2)
pm = {}
for k in m:
pm[k] = m[k]
print pm
>>> {1: (1, 2), 'foo': 'hello'}
ie, the STD/STL containers work as real native python
container, with arbitrary item types and so.
But since normal C++ containers do not properly ref/unref
their items, you should use the safer versions:
%template(pyset) std::set<swig::PyObject_ptr>;
%template(pyvector) std::vector<swig::PyObject_ptr>;
%template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
%template(pyvector) std::map<swig::PyObject_ptr,swig::PyObject_ptr>;
....
where swig::PyObject_ptr is a PyObject * envelope class provided
to safely incref/decref the python object.
So, now you can use all the STL/STD containers as native
Python containers.
Note 1: std::map, std::set and the other 'ordered'
containers will properly use PyObject_Compare for sorting,
when needed.
Note 2: all the STL/STD containers have a limit size of
SIZE_MAX, ie, you can have manage containers larger than
INT_MAX, the python limit.
11/02/2005: mmatus
[Python]
- add 'iterator()' method for all sequences and additionally
'key_iterator()' for maps.
'iterator()' will always return the native C++ iterator.
Additionally, in maps, 'key_iterator()' will return a python
iterator using only the map keys.
In general the sequence method __iter__ will call
'iterator()', returning the native C++ iterator, but in
maps it will call 'key_iterator()', maintaining
backward compatibility.
Hence, for std::maps, you can play then with the native
C++ iterator, which value is a (key, value) pair, by
calling map.iterator(), as with map.begin(), map.end(), etc.
The difference is that map.iterator() returns a safe
'closed' iterator, while map.begin() and map.end() are
'open' iterators.
A 'closed' iterator knows the begin and the end of the
sequence, and it never can seg. fault. An 'open'
iterator, as in C++, can seg. fault at the C++ side.
# a closed iterator is safe in the following example.
# the next() method will throw a StopIteration
# exception as needed
i = seq.iterator()
try:
while True:
sum += i.next()
except: pass
# an open iterator always need to be checked,
# or it will crash at the C++ side
current = seq.begin()
end = seq.end()
while (current != end):
sum += current.next()
[Python]
- Finally, when we call
f = Foo()
the construction is 'one-way'. Before construction was done
something like
Foo() (python) -> _new_Foo() (C++)
new_Foo() (C++) -> FooPtr() (python)
FooPtr() (python) -> Foo() (python)
and returning a pointer was done like
NewPointerObj() (C++) -> FooPtr() (python)
FooPtr(python) -> Foo() (python)
ie, we when going back and forward between the C++ and
python side.
Now since there is no FooPtr the construction process is
Foo() (python) -> _new_Foo() (C++)
_new_Foo() (C++) -> NewPointerObj() (C++) (no shadow class)
and returning a pointer is done
NewPointerObj() (C++) (with shadow class) -> NewInstaceObj() (C++)
where NewInstanceObj creates a new instance without
calling __init__ and it doesn't go 'back' to python, is
'pure' C API.
- With this change, and the other ones in the
PySwigObject type, which now carries the thisown and
swig_type_info pointer, the generated code should be as
fast as boost::Python and/or the other python wrappers
based in pure Python/C API calls.
As a reference, the profiletest_runme.py example, which
does a simple call function many times, such as this code:
import profiletest
a = profiletest.A()
b = profiletest.B()
for i in range(0,1000000)
a = b.fn(a)
where fn is defined as 'A* B::fn(A *a) {return a;}',
produces the following times
nomodern modern
swig-1.3.26 19.70s 5.98s
swig-CVS 0.99s 0.98s
Clearly, there is a large improvement for the python
'nomodern' mode. Still, the 'modern' mode is around
6 times faster than before. For the same test, but
using the non-shadow version of the module, we get
_profiletest (non-shadow)
swig-1.3.26 0.80s
swig-CVS 0.60s
Hence, now for practical purposes, the proxy overhead
is insignificant.
Note that the performance numbers we are showing is for
a simple module (two types) and a simple function (one
argument). For real situations, for modules with many
more types and/or functions with many more parameters,
you will see even better results.
10/31/2005: mmatus
[Python]
- Finally, no more ClassPtr proxy classes. You will see
only a clean Class proxy class in the .py file.
- No more 'real' thisown attribute either, the PySwigObject now
carries the ownership info.
You can also do something like
print self.this.own()
>>> True
self.this.disown()
self.this.own(0)
print self.this.own()
>>> False
self.this.acquire()
self.this.own(1)
print self.this.own()
>>> True
Still the old way,
print self.thisown
>>> True
self.thisown = 0
print self.thisown
>>> False
self.thisown = 1
print self.thisown
>>> True
is supported, and python dispatches the proper method
calls as needed.
- Support for iterators in STL/STD containers, for example, if you have
%template<set_string> std::set<std::string>;
you can use the C++ iterators as:
s = set_string()
s.append("c")
s.append("a")
s.append("b")
b = s.begin()
e = s.end()
sum = ""
while (b != e):
sum += b.next()
print sum
>>> "abc"
advance the iterator as in C++
current = s.begin()
current += 1
print current.value()
>>> "b"
now using the reverse operators
b = s.rbegin()
e = s.rend()
sum = ""
while (b != e):
sum += b.next()
print sum
>>> "cba"
or the 'previous' method
b = s.begin()
e = s.end()
sum = ""
while (b != e):
sum += e.previous()
print sum
>>> "cba"
or just as in a python fashion
for i in s:
sum += i
Note 1: Iterators in C++ are very powerful, but
dangerous too. And in python you can shoot yourself in the foot
just like in C++, so, be careful.
Note 2: the iterators are 'light', ie, they do not
convert sequence elements until you request to do so, via
next(), value() or previous(). If you just increment/decrement one
no conversion is performed, for example:
b = s.begin()
b += 1
b.incr()
b.incr(2)
b.decr(2)
b.decr()
b -= 1
only the iterator is modified, and not value wrapper
is generated. Other typical C++ operations are also
available, such as:
print s.end() - s.begin()
>>> 3
f = s.begin() + 1
print f.value()
>>> "b"
l = s.end() - 1
print l.value()
>>> "c"
etc. Of course, the 'find', 'insert', 'erase', and
so on methods also supports iterators now, ie:
i = s.begin()
i += 1
s.erase(i)
for i in s:
sum += i
print sum
>>> "ac"
*** POTENTIAL INCOMPATIBILITY ***
There is no more 'thisown' attribute. If you use it, python
will translate the following code as follows:
if (self.thisown): ==> if (self.this.own()):
self.thisown = 1 ==> self.this.own(1)
self.thisown = 0 ==> self.this.own(0)
Still, maybe in some unusual cases the translation will not be
100% correct, so if you have a problem, please report it
and/or use the new 'self.this.own()' accessor.
*** POTENTIAL INCOMPATIBILITY ***
There is no more ClassPtr classes in the python code. Hence,
if in the past you needed to resort to some kind of trickery
with them, or overcome their presence, it is no longer
required, but the extra code you added could now break
things.
If needed, you can use the option -classptr, i.e.,
swig -classptr -python ...
to generate the old ClassPtr classes.
10/30/2005: mkoeppe
[Guile] Make declared and defined linkage of SWIG_init consistent.
Reported by Steven G. Johnson (SF patch 1315498).
10/26/2005: mmatus
- Added the attribute.i file to the global library director.
Now it can be used from other languages that do not use
the unified typemap library as well.
So, if you have something like:
%include attribute.i
%attribute(A, int, a, get_a, set_a);
struct A
{
int get_a() const;
void set_a(int aa);
};
%attribute_ref(B, int, c);
struct B
{
int& c();
};
then in the target language the 'A.a' and 'B.c' attributes will
be visible, ie, you can access them as plain variables:
f = A()
f.a = 3
g = B()
g.c = 3
h = f.a + g.c
and the proper get/set methods will be dispatched. See
attribute.i for more info.
- More cleanups around and adding more test-cases. The
DISOWN typemap now is tested and working in all the
languages that use the unified typemap library, ie, tcl,
ruby, perl and python.
10/25/2005: mmatus
- Perl, complete the DISOWN typemap.
- added the attribute.i file to the unified typemap
library (before was only usable from python).
- unify the names for the setter and getter methods in
perl,tcl,ruby and python, so, the attribute.i library
can work across them.
- see the li_attribute.i test-case or the library file
Lib/typemaps/attribute.swg
for more info about how to use it.
10/24/2005: mmatus
- Perl now uses the unified typemap library.
- Changes in ruby to use the $track option in typemaps.
- Changes in the unified typemap library to follow the
convention that all macros that are not used in the
C/C++ side starts with %, such as
%delete
%new_array
etc.
- Documenting fragments, see fragments.swg.
- Cleaner way to use the unified typemap library, include
just <typemaps/swigtypes.swg>.
Check some of the supported languages: perl, tcl, ruby,
python.
Always start with the head file, such as
python/python.swg
tcl/tcl8.swg
ruby/ruby.swg
perl5/perl5.swg
and the principal file that invokes the unified library, such as
python/pytypemaps.swg
tcl/tcltypemaps.swg
ruby/rubytypemaps.swg
perl/perltypemaps.swg
The file that provide the specialization for each
language are the one that provides the basic types:
python/pyprimtypes.swg
ruby/rubyprimtypes.swg
tcl/tclprimtypes.swg
perl5/perlprimtypes.swg
and the string manipulation:
python/pystrings.swg
ruby/rubystrings.swg
tcl/tclstrings.swg
perl5/perlstrings.swg
The rest of the files, such as carray.i, are mostly one
line files that include the proper typemap library
version.
*** POTENTIAL INCOMPATIBILITY in Perl ***
Some missing/wrong typemaps could start working properly,
and change the old expected behavior in Perl.
10/23/2005: wuzzeb
Chicken:
+ pointers to member functions finally work properly
+ add test of member function pointers to cpp_basic.i
10/20/2005: dancy
[allegrocl] Added C++ support. Large update, many changes. See
newly added Allegro Common Lisp section in lisp.html
10/20/2005: mmatus
Ruby, Tcl, Python:
- Uniform way to fail (label fail:), now finally
SWIG_exception works across the three languages and all
the typemaps.
- Add proper cleanup code to ruby
- More valgrind fixes
- Simplify the inline use, it seems a small interface of
20,000 lines (plus many many templates) can break
gcc -O3 easily.
- Finalize the typemaps library. All the old *.i files
(carray.i, cpointer.i, exception.i) had been implemented
in the new typemaps library.
10/19/2005: wuzzeb
Update the Runtime Typemap documentation in Typemaps.html
10/18/2005: wuzzeb
Chicken:
- Correctly handle %ignored classes
- Correctly convert long, long long, unsigned long, etc
to chicken primitives. (Thanks to Felix Winkelmann)
- Using argout parameters when the return value was a
wrapped pointer caused a memory corruption. The chicken
garbage collector moved a pointer out from under us.
This is now fixed by running all the proxy creation
functions as continuations after the wrapper function
returns. As part of this, we no longer need the
chickenfastproxy flag on output typemaps.
- using -proxy and -nocollection together works now
Before, it was not exporting the destructor in the proxy
wrapper.
10/18/2005: mmatus
Added the Unified Typemap Library (UTL). It unifies the typemaps for
python, ruby, tcl
and in the process, fixes several problems in each of the three
languages to work in a "canonical" way now established in
the typemap library
SWIG/Lib/typempas
The current status of the unification is that everything
compiles and runs inside the test-suite and examples
directories. And for the first time we have three
languages than pass the primitive_types.i case.
Also, we have a uniform way to treat the errors, for example
if you do something like
>>> from primitive_types import *
>>> print val_uchar(10)
10
>>> print val_uchar(1000)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: in argument 1 of type 'unsigned char'
you get the same exception in all the three languages.
And well, many more good things will come from this
unification, for example, proper support of the STL/STD classes
for all the languages, and hopefully, we can keep
adding other languages.
The hardest part, writing a common typemap library
that suites the three different languages, is done,
and adding another language should now be easy.
Still the global unification is not complete, the STL/STD
part is next, and probably as well as adding one or two more
languages.
If you are curious, look at the python, ruby and/or tcl
directories to see what is needed to support the new
common typemaps library. Still, the final way to
integrate a new language could change as we move to
integrate the STD/STL.
*** POTENTIAL INCOMPATIBILITY in Ruby/Tcl ***
Some missing/wrong typemaps could start working properly,
and change the old behavior, specially in ruby and tcl.
Version 1.3.27 (October 15, 2005)
=================================
10/15/2005: wsfulton
[Java] Fix for typesafe enum wrapping so that it is possible to
overload a method with 2 different enum types.
10/15/2005: wsfulton
Fix for %feature("immutable","0") attempting to generate setters
for constants.
Restored %immutable and %makedefault to clear the feature as it
behaved in SWIG-1.3.25 and earlier.
10/14/2005: mmatus
Fix bug in anonymous typedef structures which was leading to
strange behaviour.
10/13/2005: mmatus
Several minor changes:
- Improve the wchar_t type support
- Add a warning for when you define the 'in' typemap but
you don't define the 'typecheck' one. Very common mistake.
- Add proper default rule for function pointers, now you
can define a typemap such as:
%typemap(in) SWIGTYPE ((*)(ANY)) {...}
That will apply to all the pointer to functions. The
rule in C++ also apply to the function 'reference', ie,
in both cases
typedef int (*fptr)(int a);
typedef int (func)(int a);
This was needed since it seems to be 'illegal' in C++ to
do something like:
void *ptr = static_cast<void *>(fptr);
and probably, as for member functions, it is not
warrantied that the pointer sizes will match.
- Add the #error/#warning directives to swig's cpp.
- Add the noblock option for typemaps, which is used as
follows: supposed you a typemap, like this
%typemap(in,noblock=1) Hello {
....
}
then the typemap will be inserted without the block
imposed by the brackets, similar to
%typemap(in) Hello "...";
So, why you don't just use the quote style?, because:
1.- The quote style doesn't get preprocessed, for example
%typemap(in) Hello "$1= SWIG_macro($1);";
here, SWIG_macro doesn't get expanded
2.- Inside a quote typemap, you have to use
quotes carefully
%typemap(in) Hello "$1 = \"hello\" ";
3.- You can't make emacs and/or other editors
to indent inside a string!.
So, why do you want to remove the block?, because an extra
block when not needed (no local variables in it):
1.- makes the code harder to read
2.- makes the code larger
3.- or in short, for the same reason we have the quote style.
Version 1.3.26 (October 9, 2005)
================================
10/08/2005: wsfulton
[Php] Added 'throws' typemaps.
10/08/2005: wsfulton
Fixes for languages that don't support multiple inheritance. The
first non-ignored class in the public base class list is used for inheritance.
by the proxy class. Previously, if the first class in the list was ignored, then
the proxy class wouldn't have any base classes.
10/07/2005: mmatus
Update more features to follow new convention, including:
callback
ref/unref
except
All of them use not only the feature as a flag, but also
as code value. To deal with those features, we use now
GetFlagAttr, which is similar to GetFlag, but instead or
returning 1 or 0, it returns the attr value, if happens
to be different of "0" of course.
Now there are also more uniform directive names for the
ones based in features, for example, for the old
%newobject directive now we have tree directives defined:
#define %newobject %feature("new")
#define %nonewobject %feature("new","0")
#define %clearnewobject %feature("new","")
and so on for all the other feature directives.
*** POTENTIAL INCOMPATIBILITY ***
09/30/2005: wsfulton
Subtle change to some features. Previously it was not possible to disable many
features once they had been enabled. This was for most features that behave as
flags. These features now work as follows:
%feature("name") // enables the feature
%feature("name", "1") // enables the feature
%feature("name", "0") // disables the feature
%feature("name", "") // clears the feature
In fact any non-empty value other than "0" will enable the feature (like C boolean logic).
Previously "1", "0" or any other non-empty value would enable the feature and it would
only be possible to disable the feature by clearing it (assuming there was no global enable).
The following features are affected:
allowexcept
compactdefaultargs
classic (Python)
cs:const (C#)
director
exceptionclass (Python)
ignore
immutable
java:const (Java)
java:downcast (Java)
kwargs
modern (Python)
new
noautodoc (Python)
nodefault
nodirector
noref
notabstract
nounref
novaluewrapper
python:maybecall (Python)
python:nondynamic (Python)
modula3:multiretval (Modula3)
predicate (Ruby)
trackobjects (Ruby)
valuewrapper
It is now possible, for example to ignore all methods/classes in a header file, except for a
few targetted methods, for example:
%feature("ignore"); // ignore all methods/classes
%feature("ignore","0") some_function(int, double); // do not ignore this function
%feature("ignore","0") SomeClass; // do not ignore this Class
%feature("ignore","0") SomeClass::method; // do not ignore this method
%include "bigheader.h"
Removed %pythondynamic - it never worked properly. Use %pythonnondynamic instead.
Removed %feature("nokwargs") - it wasn't fully implemented - use %feature("kwargs","0") instead.
*** POTENTIAL INCOMPATIBILITY ***
09/25/2005: mkoeppe
[Guile] Add "throws" typemaps.
09/24/2005: cfisavage
[Ruby] Adds new %trackobjects functionality that maps C++ objects to
Ruby objects. This functionality makes it much easier to implement
mark functions for the garbage collector. For more information
refer to the update documentation and examples.
09/20/2005: wsfulton
[Perl] Patch 1116431 from Josh Cherry. Fixes non member functions inadvertently
being called instead of member functions.
09/20/2005: wsfulton
[Lua] Patch from Mark Gossage to add support for Lua-5.1, std::string,
std::vector, std::exception and documentation.
09/14/2005: mmatus
[Python] Add -nocppcast. Now the default behavior is to
always use the cppcast operators. Before that was the case
only when you used the -cppcast option.
If this seems to break your code... your welcome!, it
means it was broken before, and you never notice.
If you thing the error is due to one of the SWIG typemaps,
send us an example.
Use -nocppcast only with very old C++ compilers that
do not support the cppcast operations.
So, here applies:
This change doesn't break compatibility, it was broken before.
09/13/2005: wsfulton
[Java] Fix for director methods when a class is passed by value as a
parameter.
09/11/2005: mmatus
Adding the module option to the %import directive. Now you
can use it as
%import(module="BigModule") foo.i
where subfile could (or not) define the module name via
the %module directive. The module option take precedence
and it has the same effects than having the directive
%module BigModule
inside the imported file foo.i.
You can use the option in mainly two cases:
1.- You used the -module option when you generated the
module to be imported, and hence the module name in
the imported %module directive is not really useful.
2.- The module you want to import is very large, and it
has several .i/.h files. Then, if you just one to
import a class or so from the module, says 'foo', and
not the entire module via importing the main
BigModule.i file, then you just do:
%import(module="BigModule") foo.h
or
%import(module="BigModule") foo.i
where foo.i contains the 'foo' declaration and maybe a
couple of extra %include directives, as needed.
09/11/2005: mmatus
Fix bug #1282637, about the -module option not having effect
in places where it was needed.
09/11/2005: wsfulton
When wrapping variables, ensure that none of the typemaps used for the
set wrappers are used when generating the get wrappers. I doubt this was a
problem for any languages except for the recently introduced null attribute
in the out typemap (C# only).
09/08/2005: wsfulton
More descriptive error messages when files fail to open.
09/06/2005: mmatus
Allow a %define a macro inside another %define macro, for example
%define hello(name, Type)
%define name ## a(Type)
%typemap(in) Type "hello;";
%enddef
%enddef
To learn how to use this new features in your own typemaps library, see
python/cstring.i, python/cwstring.i and python/cwstrbase.i.
[Python] Normalize the cstring.i implementation to use fragments, and add
cwstring.i, which implements the same typemaps but for wchar_t strings.
[Python] Bug fixed: 1247477, 1245591, 1249878 and others.
08/18/2005: wsfulton
[Ruby] Implement support for SWIGTYPE* DISOWN typemap (like in Python) for
better control of memory management, eg when adding an object created in Ruby
to a C++ container. Patch #1261692 from Charlie Savage.
08/18/2005: wsfulton
[Tcl] 64 bit platform fixes for the varargs handling in SWIG_GetArgs. This is an
improved fix for bug #1011604 as suggested by Jeremy Lin.
08/18/2005: wsfulton
[Tcl] Bug #1240469 - %newobject support for Tcl. Patch from Bob Marinier.
08/16/2005: wsfulton
[Perl] Bug #1254494 - Fix for global namespace pollution by perl header files
(bool define) prevented STL headers from being used on some systems, eg
Windows with Visual Studio.
08/16/2005: wsfulton
[Java] Bug #1240937 - Redefinition of __int64 typedef for Intel compilers.
08/15/2005: wsfulton
[Xml] Bug #1251832 - C++ template may generate invalid XML file
08/15/2005: wsfulton
[Lua] Support added for Lua. Patch #1242772 from Mark Gossage.
It supports most C/C++ features (functions, struct, classes, arrays, pointers,
exceptions), as well as lots of documentation and a few test cases & examples.
08/14/2005: wsfulton
[Xml] Fix incorrect xml escaping in base class name when base class is a template.
08/13/2005: efuzzyone
[CLISP] Added support for handling enums. Does not adds the return type declaration
to the function definition, if a function returns void.
08/09/2005: mkoeppe
New language module, Common Lisp with UFFI, from Utz-Uwe Haus.
08/09/2005: mkoeppe
Fix the Lisp s-expression output module; it no longer complains about "unknown targets".
07/27/2005: wsfulton
Modifications to STL wrappers so that it is possible for a user's %exception directive
to be applied to the STL wrapper methods. Previously the following global %exception
directive would not be used on the wrapper methods:
%exception {
try {
$action
} catch (...) {
// handle uncaught exceptions
}
}
This has been implemented by replacing %exception directives for specific STL wrapper
methods with an exception specification declared on the wrapper methods. throws typemaps
are now supplied for handling the STL exception specification. These can also be easily
overridden, for example the std::out_of_range exception, which is used a lot in the STL
wrappers, can be customised easily:
%include "std_vector.i"
%typemap(throws) std::out_of_range {
// custom exception handler
}
%template(VectInt) std::vector<int>;
07/22/2005: efuzzyone
[CLISP] The clisp module for SWIG:
- It can only handle C, clisp currently does not supports ffi bindings to C++.
- It has two options, (a) -extern-all this will generate wrappers for all functions
and variablestions, (b) -generate-typedef this will generate wrappers "def-c-type"
wrappers for typedefs
- Can handle pointers to functions, complex types such as n-dimensional arrays of
pointers of depth d
- Generates wrappers for constants as well as variables
- Correctly distinguishes between the declaration of variables in structures and functions
- Creates a defpackage "declaration" with the module name as the package name, the created
package exports both functions and variables
- tries to guess when should a pointer variable be declared as c-ptr or c-pointer
07/22/2005: wsfulton
[C#] Changes to support C# structs returned by value. The changes required are:
- Using an optional 'null' attribute in the out typemap. If this attribute is specified,
then it is used for the $null special variable substitution.
- The ctype used in the C/C++ wrappers is no longer initialised to 0 on declaration.
Both of these changes fix the situations where an attempt was made to assign 0 to the
returned struct. Marshalling structs as value types still requires user defined typemaps.
See documentation for an example.
07/22/2005: wsfulton
[C#, Java] Fix SWIG_exception usage to work with compilers that don't support empty macro
arguments. Unfortunately this fix will stop usage of SWIG_exception being used within typemaps
that use "" or %{ %} delimiters, but continues to work with typemaps using {} delimiters.
Please use the SWIG_CSharpSetPendingExceptionArgument or SWIG_JavaThrowException methods instead
as SWIG_exception is really intended as a platform independent macro for the SWIG library writers.
07/16/2005: mkoeppe
[Allegro CL] Use specific foreign types rather than (* :void).
Use *swig-identifier-converter*.
06/27/2005: wsfulton
Functions declared as 'extern' no longer have an additional function declaration added to the
wrapper files. There are some cases where SWIG does not get this right, eg bug #1205859 (extern
functions with default arguments declared in a namespace). Also SWIG cannot get non-standard
calling conventions correct, eg Windows calling conventions are usually handled like this:
%{
#define DLLIMPORT __declspec(dllimport)
#define STDCALL __stdcall
%}
#define DLLIMPORT
#define STDCALL
%inline %{
DLLIMPORT extern STDCALL void function(int);
%}
SWIG incorrectly generates:
extern void function(int);
To which there is no solution as SWIG doesn't handle non-standard calling conventions. The extra
'extern' function that SWIG generates is superfluous unless a user has forgotten to add the function
declaration into the wrappers.
The -noextern commandline argument is now redundant and a new commandline argument -addextern can
be used to obtain the original behaviour. This shouldn't be necessary unless the header file
containing the function declaration was inadvertently not added to the wrappers. To fix this
add the function declaration into your wrappers, For example, replace:
extern void foo(int);
with:
%inline %{
extern void foo(int);
%}
*** POTENTIAL INCOMPATIBILITY ***
06/22/2005: wsfulton
[C#, Java, Modula3, Ocaml]
The intermediary function names have been changed when wrapping variables to
match the other language modules so that %extend for a member variable works
uniformly across all language modules, eg:
%extend ExtendMe {
Var;
};
%{
void ExtendMe_Var_set(ExtendMe *, double) {...}
double ExtendMe_Var_get(ExtendMe *) {...}
%}
The methods implementing the get/set used to be:
%{
void set_ExtendMe_Var(ExtendMe *, double) {...}
double get_ExtendMe_Var(ExtendMe *) {...}
%}
This also changes the name of variable wrapper functions when using -noproxy.
The original names can be generated with the -oldvarnames commandline option.
*** POTENTIAL INCOMPATIBILITY ***
Version 1.3.25 (June 11, 2005)
==============================
06/11/2006: mkoeppe
[Guile] Fix handling of anonymous-enum variables.
06/10/2005: mkoeppe
[Guile] Fix for function arguments that are passed by
copy-of-value. Fix for global "const char *" variables.
Fix testcases arrays_dimensionless, arrays_global.
06/08/2005: wsfulton
Fix for when a base class defines a symbol as a member variable and a derived class defines
the same symbol as a member method.
06/08/2005: wsfulton
[C#] More fixes for virtual/new/override modifiers - when a method has protected access
in base and public access in derived class.
06/02/2005: wsfulton
Fix #1066363 - Follow convention of release tarball name matching directory name.
06/02/2005: wsfulton
[C#, Java] Fix #1211353 - typesafe enums (and Java proper enums) wrappers when enum value
is negative.
05/27/2005: wsfulton
Modernised and tidied up Windows macros --> SWIGEXPORT, SWIGSTDCALL. They can be overridden
by users via -D compiler directives if need be.
05/26/2005: wsfulton
%csmethodmodifiers can be applied to variables as well as methods now.
In addition to the default 'public' modifier that SWIG generates, %csmethodmodifiers will also
replace the virtual/new/override modifiers that SWIG thinks is appropriate. This feature is
useful for some obscure cases where SWIG might get the modifiers incorrect, for example
with multiple inheritance and overriding a method in the base class.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
05/25/2005: wsfulton
Added missing constructors to std::pair wrappers (std_pair.i) for all languages.
05/25/2005: wsfulton
[C#] Added std::pair wrappers in std_pair.i
05/25/2005: wsfulton
[C#] The C# 'new' and 'override' modifiers will be generated when a C++ class inherits methods
via a C++ 'using' declaration.
05/25/2005: wsfulton
Fix for exception specifications previously being ignored in classes that inherited methods
from 'using' declarations, eg calls to Derived::bar below will convert C++ exceptions into
a target language exception/error, like it always has done for Base::Bar.
class Base {
virtual bar() throw (std::string);
};
class Derived : public Base {
using Base::bar;
};
05/23/2005: wsfulton
Fixes for detecting virtual methods in %extend for the -fvirtual option and C# override and new
method modifiers.
05/23/2005: wsfulton
[C#] The 'new' modifier is now generated on the proxy method when a method in a derived
class is not polymorphic and the same method exists in the derived class (ie it hides
the base class' non-virtual method).
05/23/2005: wsfulton
[Java, C#] Fixes to detection of covariant return types - when the class hierarchy is more
than 2 classes deep.
05/21/2005: wsfulton
[Java] std::wstring typemaps moved from std_string.i to std_wstring.i
05/21/2005: wsfulton
Fix for crash in DohStrstr, bug #1190921
05/21/2005: wsfulton
[TCL] Fix for methods with similar names when showing list of names on error - bug #1191828.
Patch from Jeroen Dobbelaere.
05/21/2005: wsfulton
[TCL] long long overloading fix - bug #1191835, patch from Jeroen Dobbelaere.
05/21/2005: wsfulton
Fix bug #1196755 to remove debug from swigtcl8.swg.
05/19/2005: wsfulton
[C# and -fvirtual option] Fix for the override key not being generated in the derived class when a
virtual method's return type was a typedef in either the base or derived class. Also ensures the
method is eliminated when using the -fvirtual option. For example, Derived.method now has the C#
override keyword generated:
typedef int* IntegerPtr;
struct Base {
virtual IntegerPtr method();
};
struct Derived : Base {
int * method() const;
};
[C#] Fix for the override key being incorrectly generated for virtual methods when a base class
is ignored with %ignore.
05/13/2005: wsfulton
[Java] Fixes to remove "dereferencing type-punned pointer will break strict-aliasing rules"
warnings in C wrappers when compiling C code with 'gcc -Wall -fstrict-aliasing'. Patch from
Michael Cahill. This modifies many of the casts slightly, for example
arg1 = *(DB_ENV **)&jarg1;
to
arg1 = *(DB_ENV **)(void *)&jarg1;
05/12/2005: wsfulton
[C#] Support for C# attributes. C# attributes can be generated:
1) On a C/C++ type basis by specifying an inattributes and/or outattributes typemap attribute
in the imtype or cstype typemaps (for C# return type or C# parameter type attributes).
2) On a wrapped method or variable by specifying a csattributes feature (%feature).
3) On a wrapped proxy class or enum by specifying a csattributes typemap.
Examples are in the C# documentation (CSharp.html).
04/29/2005: wsfulton
New configure option to turn off the default maximum compiler warning as
they couldn't be removed even when overriding CFLAGS and CXXFLAGS with configure
(./configure CFLAGS= CXXFLAGS=). To turn the maximum warnings off, run:
./configure --without-maximum-compile-warnings
04/28/2005: wsfulton
Patch from Scott Michel which reworks the Java constructor and finalize/destructor typemaps,
for directors to reduce the number of overall Java typemaps. Added the director_take and
director_release typemaps to emulate other modules' __disown__ functionality.
*** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS ***
04/28/2005: wsfulton
[C#] Fixed problems due to the over eager garbage collector. Occasionally the
garbage collector would collect a C# proxy class instance while it was being used
in unmanaged code if the object was passed as a parameter to a wrapped function.
Needless to say this caused havoc as the C# proxy class calls the C++ destructor
when it is collected. Proxy classes and type wrapper classes now use a HandleRef,
which holds an IntPtr, instead of a plain IntPtr to marshal the C++ pointer to unmanaged
code. There doesn't appear to be any performance degradation as a result of this
modification.
The changes are in the proxy and type wrapper classes. The swigCPtr is now of type HandleRef
instead of IntPtr and consequently the getCPtr method return type has also changed. The net
effect is that any custom written typemaps might have to be modified to suite. Affected users
should note that the implementation uses the new 'out' attribute in the imtype typemap as the
input type is now a HandleRef and the output type is still an IntPtr.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
04/28/2005: wsfulton
[C#] Support for asymmetric type marshalling added. Sometimes the output type needs to be
different to the input type. Support for this comes in the form of a new optional 'out'
attribute for the ctype, imtype and cstype typemaps. If this typemap attribute is not
specified, then the type used for both input and output is the type specified in the
typemap, as has always previously been the case. If this typemap attribute is specified,
then the type specified in the attribute is used for output types and the type specified
in the typemap itself is used for the input type. An output type is a return value from
a wrapped method or wrapped constant and an input type is a parameter in a wrapped method.
An example shows that char * could be marshalled in different ways,
%typemap(imtype, out="IntPtr") char * "string"
char * function(char *);
The output type is thus IntPtr and the input type is string. The resulting intermediary C# code is:
public static extern IntPtr function(string jarg1);
04/22/2005: mkoeppe (Matthias Koeppe)
[Guile] Fix generation of "define-method" for methods of
classes with a constructor. Reported by Luigi Ballabio.
04/15/2005: wuzzeb (John Lenz)
[Chicken]
For wrapped functions that return multiple values (using argout),
SWIG CHICKEN now returns them as multiple values instead of as
a list. They can then be accessed using (call-with-values).
04/14/2005: wuzzeb (John Lenz)
[Chicken]
+ Added a whole bunch of new _runme scripts into the chicken test
suite. Also fix some bugs these new scripts turned up.
+ Added optimization when returning a wrapped proxy class. Before,
a minor garbage collection was invoked every time a function returned.
+ All the chicken Examples should now run correctly
04/14/2005: wsfulton
[C#] More fixes for typemap matching when wrapping variables, in particular
std::string, so that std::string variables can be easily marshalled with
a C# string property using:
%include "std_string.i"
%apply const std::string & { std::string *variable_name };
std::string variable_name;
(Recall that all class variables are wrapped using pointers)
04/05/2005: wuzzeb (John Lenz)
[Chicken]
+ Added Examples/chicken/egg, an example on how to build a chicken
extension library in the form of an egg. Also updated the
documentation on the different linking options.
+ chicken test-suite now has support to check SWIG with the -proxy
argument if there exists a _proxy_runme.ss file.
+ More fixes for overloaded functions and -proxy
03/31/2005: wsfulton
Turned on extra template features for all languages which were
previously only available to Python.
This enables typemaps defined within a templated class to be used as
expected. Requires %template on the templated class, %template() will
also pick up the typemaps. Example:
template <typename T> struct Foo {
...
%typemap(in) Foo "in typemap for Foo<T> "
or
%typemap(in) Foo<T> "in typemap for Foo<T> "
};
%template(Foo_i) Foo<int>;
%template() Foo<double>;
will generate the proper 'in' typemaps wherever Foo<int> and Foo<double>
are used.
03/30/2005: mkoeppe (Matthias Koeppe)
[MzScheme] Patch from Hans Oesterholt for supporting MzScheme 30x.
03/29/2005: wuzzeb (John Lenz)
[Chicken]
+ Reallow older versions of chicken (1.40 to 1.89) by passing -nocollection
argument to SWIG
+ %import now works correctly with tinyclos. (declare (uses ...)) will be
exported correctly.
+ TinyCLOS proxy classes now work correctly with overloaded functions
and constructors.
03/29/2005: wsfulton
[Java] Patch from Scott Michel for directorout typemaps. Java directors
require the directorout typemaps like the other languages now. The new
typemaps provide fixes for methods where the return type is returned
by reference (this cannot automatically be made thread safe though).
03/22/2005: wsfulton
Enum casting fixes. Visual C++ didn't like the C type casting SWIG produced
when wrapping C++ enum references, as reported by Admire Kandawasvika.
03/21/2005: wsfulton
[Perl] SF #1124490. Fix Perl macro clashes when using Visual Studio's STL string,
so now projects can #include <string>.
03/21/2005: wsfulton
Fixed %varargs which got broken with the recent default argument changes.
Also works for Java and C# for the first time now.
03/17/2005: wuzzeb (John Lenz)
[Chicken]
+ Fix a whole bunch of bugs in the chicken module. The entire
test suite now compiles, with the exception of the tests that require
std_vector.i, std_deque.i, and so on, which chicken does not have yet.
+ Add support for %exception and %typemap(exceptions). Exceptions are
thrown with a call to (abort) and can be handled by (handle-exceptions)
03/15/2005: wsfulton
[Java] Patch from Scott Michel for directors. Modifications to the typemaps
giving users fine control over memory ownership and lifetime of director classes.
Director classes no longer live forever by default as they are now collectable
by the GC.
03/15/2005: wuzzeb (John Lenz)
[Chicken] Add support for adding finalizers garbage collected objects.
Functions that return new objects should be marked with %newobject and
input arguments which consume (or take ownership) of a pointer should
be marked with the DISOWN typemap.
Also add support for correctly checking the number of arguments passed
to a function, and raising an error if the wrong number are passed.
03/14/2005: wuzzeb (John Lenz)
Add --without-alllang option to configure.in, which is the same as
passing all the --without-python --without-perl5 etc... that Matthias added.
03/09/2005: wsfulton
[Php] Memory leak fix for functions returning classes/structs by value.
03/08/2005: wsfulton
[Perl] Fix for Perl incorrectly taking memory ownership for return types that
are typedefs to a struct/class pointer. Reported by Josh Cherry.
03/07/2005: wsfulton
[C#] Various exception changes for the std::vector wrappers. These now more
accurately mirror the same exceptions that System.Collections.ArrayList throw.
03/07/2005: wsfulton
[C#] Fix undefined behaviour after any of the std::vector methods
throw an exception.
03/07/2005: wsfulton
[C#] When null is passed for a C++ reference or value parameter, the
exception thrown has been corrected to an ArgumentNullException instead
of NullReferenceException as recommended in the .NET Framework documentation.
The default throws typemaps turn a C++ exception into an ApplicationException,
not a SystemException now.
03/07/2005: wsfulton
[C#] Numerous changes in C# exception handling have been made over the past
few weeks. A summary follows:
The way in which C++ exceptions are mapped to C# exceptions is quite different.
The change is to fix C# exceptions so that the C++ exception stack is correctly
unwound as previously C++ exceptions were being thrown across the C PInvoke layer
into the managed world.
New typemap attributes (canthrow and excode) have been introduced to control the
mapping of C++ to C# exceptions. Essentially a callback into the unmanaged world
is made to set a pending exception. The exception to throw is stored in thread local
storage (so the approach is thread-safe). The typemaps are expected to return
from unmanaged code as soon as the pending exception is set. Any pending exceptions
are checked for and thrown once managed code starts executing. There should
be minimal impact on execution speed during normal behaviour. Full details will be
documented in CSharp.html.
The SWIG_CSharpThrowException() function has been removed and replaced with the
SWIG_CSharpSetPendingExceptionArgument() and SWIG_CSharpSetPendingException()
functions. The original name has been deliberately changed to break old code as
the old approach was somewhat flawed. Any user defined exceptions that follow the
same pattern as the old approach should also be fixed.
Numerous new .NET framework exceptions are now available for easy throwing from
unmanaged code. The complete list is:
ApplicationException, ArithmeticException, DivideByZeroException,
IndexOutOfRangeException, InvalidOperationException, IOException,
NullReferenceException, OutOfMemoryException, OverflowException,
SystemException, ArgumentException, ArgumentNullException and
ArgumentOutOfRangeException.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
05/05/2005: mmatus
Fix several memory leaks around. Even when we survive knowning
swig is a memory leak factory, it was a little out of
control. To run std_containers.i in the python test-suite,
swig was using ~260MB, now it uses 'only' ~40MB, which is
the same ammount that g++ uses, so, is not that bad.
In the process, I found a couple of extra Deletes, which
in some cases could trigger seg. faults and/or
DOH/asserts.
[python] Better support for directors + exception. More
verbose errors and added an unexpected exception handler.
[python] Fix memory leak for the
std::vector<std::vector<int> >
case,reported by Bo Peng.
[python] Fix SwigPyObject compare problem reporte by
Cameron Patrick.
[python] Fix several warnings in the generated code
for gnu-gcc, Intel and VC7.1 compilers.
02/25/2005: wuzzeb (John Lenz)
Update documentation to use CSS and <div> instead of <blockquote>
I used a script to convert the docs, and it set all the box classes
to be "code". There are actually 4 different classes,
"shell", "code", "targetlang", and "diagram". We need to go through
and convert the divs depending on what they contain.
02/23/2005: mmatus
[Python] Added option -nortti to disable the use of native
C++ RTTI with directors (dynamic_cast<> is not used).
Add more code for directors to detect and report errors in
the python side.
Extend the use of SWIGINTERN whenever is possible.
Remove template warnings reported by VC7.1.
Remove warnings reported by gcc/g++. Finally you can
compile using
g++ -W -Wall -c mymodule_wrap.cxx
and no spurious errors will be generated in the wrapper
code.
02/23/2005: wuzzeb (John Lenz)
Added -external-runtime argument. This argument is used to dump
out all the code needed for external access to the runtime system,
and it replaces including the files directly. This change adds
two new virtual functions to the Language class, which are used
to find the language specific runtime code. I also updated
all languages that use the runtime to implement these two functions.
02/22/2005: mmatus
Fix %template + private error SF#1099976.
02/21/2005: mmatus
Fix swigrun.swg warnings reported when using "gcc -W -Wall"
(static/inline not used in front of a function
declaration), and add SWIGUNUSED attribute to avoid
unused warnings elsewhere.
Fix unused variable warnings.
[Python] Use new SWIGUNUSED attribute to avoid warnings in
SWIGINTERN methods.
[Python] Fix PyOS_snprintf for python versions < 2.2 (SF #1104919).
[Python] Fix map/multimap to allow empty maps (reported by
Philippe Hetroy).
[Docs] Add some documentation to Python.html and
SWIGPlus.html, including for example the fact that
'friends' are now supported.
02/21/2005: wsfulton
[PHP] Patch from Olly Betts, so that wrappers compile with Zend thread safety enabled.
02/17/2005: wsfulton
Memory leak fix in some of the scripting language modules when using default
arguments in constructors. The scripting language was not taking ownership of the
C++ object memory when any of the constructors that use default arguments was called.
02/16/2005: wsfulton
SF #1115055: Failed make install. Patch from Rob Stone.
02/16/2005: wsfulton
[Java] SF #1123416 from Paul Moore. Correct memory allocation for STRINGARRAY
typemaps in various.i.
02/15/2005: wsfulton
Disabled typemap search changes for now (see entry 19/12/2004). It breaks
old typemaps, lengthens the execution time by about 25% and introduces
inconsistencies.
02/15/2005: wsfulton
swig -help follows other software by printing to stdout instead of stderr now.
swig -version also displays to stdout instead of stderr now.
Behaviour reported by Torsten Landschoff.
02/15/2005: wsfulton
[Ruby] Fix for the less commonly used ordering of %include and #include, so
that the generated code compiles. Bug reported by reported by Max Bowsher.
%include foo.h
%{
#include foo.h
%}
02/15/2005: wsfulton
[C#, Java] SWIG_exception macro will now return from unmanaged code / native code
as soon as it is called. Fixes possible JVM crashes and other code unexpectedly
being executed. Note SWIG_exception is only occasionally used by SWIG library
writers, and is best avoided by SWIG users.
02/15/2005: wsfulton
[C#, Java] Typemaps can now be targeted at global variable names
and static member variable names. Previously the typemaps for
the setters were ignored, for example:
%typemap(in) int globalint "..."
int globalint;
02/13/2005: mkoeppe (Matthias Koeppe)
[Guile] Add %typecheck for SWIGTYPE, add %typecheck for ptrdiff_t, fix
typemaps for size_t.
[Pike] Merge patch from Torsten Landschoff for improved Pike configuration.
02/12/2005: mkoeppe (Matthias Koeppe)
New configure switches --without-tcl, --without-python etc. allow to
disable the search for installed languages.
01/31/2005: wuzzeb (John Lenz)
- Add DohSortList to DOH
- Improve the runtime type system:
+ Speed. Type loading is now O(n log n) instead of O(N^2), which
for large modules is a huge improvement.
+ A whole bunch of functions in swigrun.swg no longer need the
swig_type_list_handle passed to them. The only one left is
TypeQuery. This also makes runtime.swg a lot smaller.
+ Split up swig_type_info structure into two structures
(swig_type_info and swig_cast_info)
+ Store a pointer to a swig_type_info rather than just the type
name string in the linked list of casts. First off, this makes
the guile module a little faster, and second, the
SWIG_TypeClientData() function is faster too.
+ Add the idea of a module into the type system. Before, all the
types were stored in one huge linked list. Now, another level is
added, and the type system stores a linked list of modules, each
of which stores an array of types associated with it.
+ For more information of how the runtime type system now works,
please see Doc/Manual/typemaps.html and Doc/Devel/runtime.txt
- Update all language modules to use the new type system. The changes
to each language module are minor. All languages are now able to
use runtime.swg for external access to the type system. Before
only python and perl did.
- [guile, mzscheme, ocaml, and php4] These languages opened up the
init function inside the .cxx code, and any code in the .swg files
in the init section was inside this function. This was a problem
for swiginit.swg, which needs to be inserted before the SWIG_init
function is opened. Thus I changed these languages to be like
python or perl, where the init function is declared in the .swg
file.
- [Ruby] Instead of moving the init function to the .swg file, I
added a new section initbeforefunc, and then added
%insert(initbeforefunc) "swiginit.swg"
- [MzScheme] Fix enums and fix Examples/Makefile.in so that if
multiple -I arguments are specified in the INCLUDES variable, each
gets a ++ccf.
- [Guile GH] Update Guile GH to use the new type system. See
Doc/Manual/Guile.html for how smobs are now used.
01/11/2005: wsfulton
[C#] New typemap called 'csconstruct'. The code in this typemaps was previously hard
coded and could not be customised by a user. This typemap contains the code that is
generated into a proxy class's constructor.
[Java] New typemap called 'javaconstruct'. The code in this typemaps was previously hard
coded and could not be customised by a user. This typemap contains the code that is
generated into a proxy class's constructor. Another typemap named 'javaconstruct_director'
is used instead when the proxy class is a director class.
[C#, Java] If a C++ class did not have a default constructor, a protected default constructor
was automatically generated by SWIG. This seems is unnecessary and has been removed
and thereby giving the user almost complete control over the generated code along with the
new typemaps above.
19/12/2004: mmatus
[Disabled, see entry 02/15/2004]
- Fix typemap search, now the "out" typemap search is done as follows
int *Foo::foo(int bar) -> int *Foo::foo(int bar)
-> int *Foo::foo
-> int *foo(int bar)
-> int *foo
-> int *
then, now you can be more specific, and define
/* apply only for 'Foo::foo' method */
%typemap(out) int * Foo::foo(int *bar) ...;
/* apply for all 'foo' functions/methods */
%typemap(out) int * foo(int *bar) ...;
%inline {
struct Foo {
int *foo(int *bar);
};
}
15/12/2004: mmatus
- More fixes for templates and template default args.
See template_default.i for scary cases that now are
supported, besides the already ugly STL/std cases.
- Cosmetics and more use of 'const' where it was implicit.
- Other fixes for OSS, which is now working again with 1.3.25.
Version 1.3.24 (December 14, 2004)
==================================
12/12/2004: wuzzeb (John Lenz)
[Chicken] Fix a bunch of bugs relating to -proxy support
+ non-class variables now export properly using -proxy
+ static member functions now export properly using -proxy
+ member class variables now export properly using -proxy
+ added a -nounit argument, which does not export the (declare (unit ...))
+ correctly install swigclosprefix.scm
+ constants (enums, defines) now correcly export when using -proxy
12/11/2004: wsfulton
configure fix for when more than one version of jni_md.h is found
in the Java include directory (was generating lots of sed error
messages).
12/08/2004: wsfulton
[Java] Fixes to arrays_java.i so that one can apply the array
typemaps to functions taking pointers as input, eg
%include "arrays_java.i"
%apply int[] {int*};
void foo(int *a);
12/05/2004: wsfulton
[Java] Director mods contributed by Scott Michel. New typemaps
directordisconnect and directordisconnect_derived for the
swigDirectorDisconnect() method. Also fix to get the javapackage
typemap working again.
12/05/2004: mmatus
- Finishing the fixes for templates + default template
args + specializations.
- [Python] Now we use the new templates + default template
args in the std/STL library. That means the internal
swig files are getting uglier since we now support the
original declarations:
template<class _Tp, class _Alloc = std::allocator< _Tp > >
class vector {
....
};
template<class _Key, class _Tp, class _Compare = std::less<_Key >,
class _Alloc = std::allocator<std::pair<const _Key, _Tp > > >
class map {
....
};
and the user can use the %template directive as
%template() std::vector<int>;
%template() std::vector<int, std::allocator<int> >;
%template() std::vector<int, MyAllocator<int> >;
Now we are closer to the cleaning/rewriting of the
python std/STL support, such that we recover support for
MSVC++ 6.0, and we can add support for other languages
too.
12/02/2004: wsfulton
[Java] Fix for directors when wrapping methods using a member enum
and typesafe/proper enums enabled.
12/01/2004: mmatus
- Fix typemaps to work with templates and default template
args, ie
template <class A, class B = int>
struct Foo {
};
%typemap(in) Foo<int> *{...}
%typemap(out) Foo<int,int> *{...}
Foo<int> * foo( Foo<int> *f1, Foo<int,int> *f2);
now 'f1', 'f2' and the return value resolve the provided
typemaps properly.
This is highly needed for proper STL support, see new
std_basic_string.i, std_sstream.i, etc.
- Added std_sstream.i, and fix std_basic_string.i to use
the new typemaps + template def. arg mechanism. Also,
added the needed std_alloc.i. Now, all the containers
can be modified to support std::allocator, like in:
template<class T, class A = std::allocator<T > >
class vector {
public:
....
};
This change is only completed by now for basic_string.
- Fix for smart pointers + members + extensions:
%extend Foo {
int extension(int i, int j) { return i; }
int extension() { return 1; }
}
%inline %{
class Foo {
public:
int y;
static const int z;
};
class Bar {
Foo *f;
public:
Bar(Foo *f) : f(f) { }
Foo *operator->() {
return f;
}
};
now you can
f = Foo()
f.y = 3
a = f.z
f->extension()
b = Bar(f)
b.y = 3
a = b.z
b->extension()
- Other small errors fixes, mostly python.
11/25/2004: wsfulton
[Java] Numerous director bug fixes so that the correct java types
and canonicalized types in the JNI code are emitted. Use of the
$javaclassname special variables in the director typemaps now
consistent with the non-director typemaps. The types used for
typemap lookups are also corrected in a few places. If you
previously had your own director typemaps, ensure they are using the
correct C++ type.
*** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS ***
11/25/2004: wsfulton
const enum SWIGTYPE & typemaps added. These wrap const enum references
as if they were passed by value. Const enum references thus work the
same as const reference primitive types such as const double &,
const int & etc. Typemaps added for Java, C#, Ruby, Tcl, Perl and Pike.
11/25/2004: wsfulton
[Java, C#] New special variable: $*javaclassname, similar to $javaclassname
and $&javaclassname. The new one removes a pointer from the C type before
obtaining the Java class name. One or more of $javaclassname,
$&javaclassname or $*javaclassname may now appear in a typemap. Likewise for
C# using csclassname instead of javaclassname.
11/25/2004: wsfulton
The last vestiges of enums being handled as integers removed from the
internals. The wrapper methods use the enum type rather than an int
now. The net result is added type safety for enums when handled as
pointers, references etc. Previously in situations such as a method
taking a pointer to an enum, a pointer to an int or a pointer to an
enum of some other type could inadvertantly be passed to the method.
This is now fixed as the descriptor for an enum is no longer based on
an int, but the enum type instead. Anonymous enums are still handled
as integers.
The consequence for scripting language users in correct usage of enums
should not be noticeable. There is no change for any of the languages
where enums are passed by value - most of the scripting languages will
still accept an integer for an enum value and the strongly typed
languages still use either typesafe enums, integers or proper enums
depending on what the user configures. For Java and C# users a change
in the typewrapper class name has occurred (for enum pointers,
references etc). For example:
enum Numbers { one=1, two };
enum Numbers* number();
In Java and C# this must now be coded as
SWIGTYPE_p_Numbers n = modulename.number();
rather than
SWIGTYPE_p_int n = modulename.number();
*** POTENTIAL INCOMPATIBILITY ***
11/21/2004: wsfulton/mmatus
Added missing deprecated warning for %name and remove remaining %name
usage in the SWIG libraries.
11/21/04: mmatus
- [Python] Adding the PySwigObject to be used for carrying
the instance C/C++ pointers. This is used instead of
string and PyCObjects.
The new PySwigObject is even safer than PyCObject, and
more friendly than plain strings:
now you can do
print a.this
<Swig Object at _00691608_p_A>
print str(a.this)
_00691608_p_A
print long(a.this)
135686400
print "%s 0x%x" % (a.this, a.this)
_00691608_p_A 0x8166900
the last one is very useful when debugging the C/C++
side, since is the pointer value you will usually get
from the debugger.
Also, if you have some old code that uses the string
representation "_00691608_p_A", you can use it now again
using 'str(ptr)', or by calling 'str = PyObject_Str(obj)'
in the C/C++ side.
This change is mainly for nostalgic swig users that miss
the string representation, but also allows to say again
if a.this == b.this:
return "a is b"
and well, since the change were really simple, maybe in
the future we will be able to do
next = a.this + 1
or add native python iteration over native C/C++ arrays,
ie, no need to create/copy new tuples when returning and
array or vector.
Also, a PySwigPacked object was adding to carry a member
method pointer, but this is probably a temporal solution
until a more general object for methods is added.
Be aware that to simplify maintaining and compatibility
with other tools, the old string and PyCObjects
representation could disappear very soon, and the
SWIG_COBJECTS_TYPES or SWIG_NO_OBJECT_TYPES macros will
have no effect at compilation time. Still, the three
mechanisms are present in the code just for testing,
debugging and comparison purposes.
11/21/04: mmatus
- [Python] Adding back support for using the swig runtime code
inside the user code. We just allow the user to include
the minimal code needed to implement the runtime
mechanism statically, just as in done in the swig
modules.
To use the swig runtime code, for example with python,
the user needs include the following:
#include <Python.h> // or using your favorite language
#include <swigrun.swg>
#include <python/pyrun.swg> // or using your favorite language
#include <runtime.swg>
the files swigrun.swg, pyrun.swg and runtime.swg can
be checked out by using swig -co, or they can simply
be found by adding the swig lib directory to the
compiler include directory list, for example
SWIGLIB=`swig -swiglib`
c++ -I${SWIGLIB} ..
of better, using the CPPFLAGS, but that depends on your
environment.
This change can be ported to the other languages too,
you just need to isolate the needed runtime code in
a single file like 'pyrun.swg', and provide the
SWIG_Runtime_GetTypeList() method. Look at the
Lib/python/pyrun.swg file and the Examples/python/swigrun
example.
11/15/04: mmatus
- Fix mixed_types.i + gcc-3.4, ie, arrays + references +
typedefs
- Fix multidim arrays + typedefs,ie
typedef char character[1];
typedef character word[64];
- Process protected/private bases in the same way before
we process protected/private members, ie, we check
for constructors, operator new, virtual members, etc.
- Fix Ruby/Java to work (or ignore) multi-inheritance +
directors. Allow other languages to define if it is
supported or not.
- Now you can run
SWIG_FEATURES="-directors -dirprot"
make check-ruby-test-suite
make check-python-test-suite
make check-java-test-suite
make check-ocaml-test-suite
and you will get only 'real' errors. ruby and python
compile with no errors, java shows some problems.
Version 1.3.23 (November 11, 2004)
==================================
11/05/2004: wsfulton
Patch #982753 from Fabrice Salvaire: Adds dependencies generation for
constructing makefiles. New command line options -MF -MD -MMD to work
with the current options -M and -MM. These options are named the same
and work the same as in gcc.
11/05/2004: wsfulton
%ignore/%rename changes for methods with default arguments to mirror
%feature behaviour. See previous entry.
*** POTENTIAL INCOMPATIBILITY ***
11/04/2004: wsfulton
%feature improvements for fine tuning when wrapping methods with
default arguments. Any %feature targeting a method with default arguments
will apply to all the extra overloaded methods that SWIG generates if the
default arguments are specified in the feature. If the default arguments are
not specified in the feature, then the feature will match that exact
wrapper method only and not the extra overloaded methods that SWIG generates.
For example:
%feature("except") hello(int i=0, double d=0.0);
void hello(int i=0, double d=0.0);
will apply the feature to all three wrapper methods, that is:
void hello(int i, double d);
void hello(int i);
void hello();
If the default arguments are not specified in the feature:
%feature("except") hello(int i, double d);
void hello(int i=0, double d=0.0);
then the feature will only apply to this wrapper method:
void hello(int i, double d);
and not these wrapper methods:
void hello(int i);
void hello();
This has been introduced to make %feature more powerful to ease the migration
to new default arguments wrapping approach.
*** POTENTIAL INCOMPATIBILITY ***
If you previously had a %feature and didn't specify the default arguments,
you will have to add them in now or you can obtain the original behaviour
by using %feature("compactdefaultargs").
11/04/2004: wsfulton
[C#] Typemaps for std::vector added into std_vector.i. The proxy classes
generated are modelled on the .NET ArrayList class. This isn't quite
ready for general consumption yet, but will work with vectors of primitive
types and some classes.
10/3/2004: wuzzeb (John Lenz)
[GUILE] The -scm interface is now the default. The old GH interface can
still be enabled by passing -gh to SWIG.
10/2/2004: mmatus
- More fixes for namespace + class declarations.
As an extra bonus, we get %template support for static/members class
methods, ie, now you can say:
namespace space {
struct A
{
template <class Y>
static void fooT(Y y) { }
};
}
struct B
{
template <class Y>
void barT(Y y) {}
};
%template(foo) space::A::fooT<double>;
%template(foo) space::A::fooT<int>;
%template(foo) space::A::fooT<char>;
%template(bar) B::barT<double>;
%template(bar) B::barT<int>;
%template(bar) B::barT<char>;
and call
A.foo(1)
b = B()
b.bar(1)
note the methods are emitted inside the classes,
and hence, the %template name refers to the 'member'
method name, not a global namespace name.
10/31/2004: mmatus
- Solve namespace + class declarations, as in
namespace foo {
struct Bar;
struct Foo {
};
}
struct foo::Bar : Foo {
};
see namespace_class.i for more examples.
- Fix %template directive to properly use namespaces,
including the case:
namespace one
{
template <typename T>
struct Ptr {};
}
namespace one
{
struct Obj1 {};
typedef Ptr<Obj1> Obj1_ptr;
%template(Obj1_ptr) Ptr<Obj1>;
}
namespace two
{
struct Obj2 {};
typedef one::Ptr<Obj2> Obj2_ptr;
%template(Obj2_ptr) one::Ptr<Obj2>;
}
this is done by using the namespace name 'one' to create
a namespace node to emit the template instantiation,
just as before, but the template parameters are resolved
and qualified in the current namespace ('one' or 'two').
This is same way that typedef works.
This resolve the smart_pointer_namespace2.i case, and at
the same time, several other ones where before swig was
generating the
"Can't instantiate template 'xx' inside namespace 'yy'"
error message. In fact, that error doesn't exist
anymore. You can only get an error if you use a bad
namespace name or so.
10/30/2004: mmatus
- [ruby] Directors fixes:
- enums and std::strings are working now (several
reports in bug track system)
- added patch 1025861 for director + exceptions
*** Attention ***: ruby with directors + protected
members work with version 1.7+. Older versions seems to
have a broken signature for'rb_protect'.
If you need to use an old version, look at
http://excruby.sourceforge.net/docs/html/ruby__hacks_8hpp-source.html
for workarounds.
- [ruby] Fix memory allocation problem in typemap (bug 1037259)
- [tcl] Fix (enums|constants) + namespace option
(reported by jason.m.surprise@intel.com).
- [perl] Add patch 962168 for multiple inheretance
- Fix 'defined' as variable name.
10/29/2004: wsfulton
Seg fault fix for global scope operator used for friend methods:
class B {
friend void ::globalscope();
...
};
10/28/2004:mmatus
- Added module and swig option "templatereduce" to force swig
to reduce any type needed with templates, ie, in these cases
%module("templatereduce") test
template <class T> struct A { };
typedef int Int;
%template(A_Int) A<Int> ==> %template(A_Int) A<int>
typedef B* Bp;
%template(A_Bp) A<Bp> ==> %template(A_Bp) A<B*>
swig reduces the types Int and Bp to their primitives
int and B*. This is closer to the usual compiler
resolution mechanism, and it is really needed sometimes
when you mix templates + typedefs + specializations.
Don't use it if you don't have any problem already,
since the type reduction can interfere with some
user typemaps, specially if you defined something like
typedef int Int;
%typemap(in) Int ...;
in this case, when you use the "templatereduce" option,
swig will ignore the user typemap, since the "typedef int Int"
will take precedence, and the usual "int" typemap will be
applied.
Note that the previous case is not common, and should be
avoided, ie, is not recommended to use a typedef and a
typemap at the same time, specially if you are going to
use templates + specializations.
- Directors:
virtual destructor is always emitted now, this doesn't
cause any harm, and could solve some nasty and
mysterious errors, like the one mentioned by Scott.
also the destructor is not in-lined, so, that can solve
some other mysterious errors when mixing directors +
imports + embedded applications + some specific compilers.
10/27/2004: wsfulton
[C#] typemaps.i library file with INPUT, OUTPUT and INOUT typemaps added.
10/27/2004: wsfulton
[Java] std::wstring typemap fixes in std_string.i from Russell Keith-Magee.
10/25/2004: mmatus
- Using + namespace is working now (using_namespace.i).
- Derived + nested classes is working now
(deriver_nested.i), but of course, we are still waiting
for the nested class support.
- Directors:
- unnamed parameters support,
- protected constructor support (automatic and with
dirprot mode),
- detection of really needed protected declarations
(members and constructors) now is done automatically.
Even if you don't use the 'dirprot' mode, swig will
wrap what is minimally needed (and protected) for the
code to compile.
what is public, as usual, is always wrapped, and if
you use the 'dirport'
- Final fixes for the OSS to compile with SWIG 1.3.23 (my
very very ugly C++ + templates + everything mounters wrap).
10/25/2004: wsfulton
[C#] New commandline option -dllimport. This enables one to specify
the name of the DLL for the DllImport attribute. Normally this name
comes from the module name, so now it is possible to override this:
swig -csharp -dllimport xyz example.i
will generate for all the wrapped PInvoke methods:
[DllImport("xyz", EntryPoint="...")]
public static extern ...
The wrappers from many different SWIG invocations can thus be compiled
into one DLL.
A new special variable $dllimport can also be used in typemaps, pragmas,
features etc. This will get translated into the value specified by -dllimport
if specified, otherwise the module name.
10/22/2004: wsfulton
[Java] Patch #1049496 from Scott Michel fixes directors methods with
enums when wrapped with typesafe or proper Java enums.
10/21/2004: wsfulton
Fixes for default arguments in director constructors (Python, Ruby, Ocaml).
10/21/2004: mmatus
- [Python] Add the '-cpluscast' option to enable the 'new'
C++ casting operators, such as 'static_cast', inside the
typemaps. By default swig use the old C cast style, even
when parsing C++.
- [Python] Add the '-new_vwm' option to enable the new
SwigValueWrapper mode. Now this is mainly for testing
that the typemaps are really safe for any future
solution, but you can use it if you have a very strange
error with default cosntructors missing + %apply +
%typemap, and if everything else fails (see
valuwrapper_opaque.i for alternative and current
solutions). If you are a user that don't know what is
SwigValueWrapper, don't even try it.
- [Python] Add the '-noh' option to be used with directors
and when you prefer to disable the generation of the
director header file. If not used, swig will work as
usual generating both the wrap.cxx and wrap.h files. If
you use it, swig will only generate wrap.cxx.
10/21/2004: wuzzeb (John Lenz)
- If you define SWIG_TYPE_TABLE when compiling a wrapper file,
the runtime types will be stored in the given type table name.
Using this, you can seperate different modules to share their
own type systems. -DSWIG_TYPE_TABLE=Mytable
- [Python] If you define SWIG_STATIC_RUNTIME then the type information
will be static to this wrapper. Nothing will be shared with any
other modules
- [Python] If you define SWIG_LINK_RUNTIME, then instead of using
the new way of sharing type information, the wrapper will expect
to be linked against the Lib/linkruntime.c file. Any modules compiled
with SWIG_LINK_RUNTIME and linked against linkruntime.c will all
share type information.
10/20/2004: mmatus
- [Python] Initial fix for python/import example. Please
update the Makefile (autoconf, configure, etc, expert),
since now probably is only working with g++, icc and a
few other compilers that have the -shared option.
We need to create additional shared libraries for the
virtual destructors. Old and usually forgotten C++
requirement.
Same fix need to be used in perl, I think.
- [Python] Fix generation of header file for directors,
now directors.swg is also included, so, it can be really
used from C++, and it solves some problem with compiler
that require that, even with the simple swig inclusion.
- [Python] Reordering the methods and moving some bodies
outside the class declaration. This is needed due to
some gcc-2.96 internal compiler errors. It seems the
PYTHON class is getting too large to been declared and
defined at the same time.
- Add the -oh option to change the output header file name
if needed:
swig -c++ -python test.i -o test.CC -oh test.HH
this is mainly needed when using directors, and if the
current default header file name is not good for you,
which is generated as follow:
swig -c++ -python test.i => test_wrap.h
swig -c++ -python test.i -o test.CC => test.h
10/20/2004: wsfulton
1) Compact default arguments feature added. This feature allows one
to use the default argument code generation that was used in
SWIG-1.3.22 and earlier versions. It produces more compact wrappers
as only one wrapper method is generated for any method with default
arguments. So the advantage is it generates less code but has the
original limitations, like it it does not work with all default arguments
and default arguments cannot be taken advantage of in the strongly typed
languages (C# and Java). It is implemented via the usual %feature mechanism:
%feature("compactdefaultargs");
2) Keyword arguments (kwargs) are working again for default arguments
in the languages that support it, ie, Python and Ruby. The new default
argument wrapping approach using overloaded methods cannot support kwargs
so the compact default argument feature is automatically turned on when
kwargs are specified, by %feature("kwargs").
3) Compact default arguments are also automatically turned on when wrapping
C (not C++) code. This is to support the bizarre notion of default arguments
for C code.
10/20/2004: wsfulton
Overloaded templated functions in namespaces also working now.
Templated functions with default arguments in namespaces too.
10/19/2004: mmatus
- Allow to disable the new SwigValueWrapper mechanism,
if you add the following line in your language main.
/* Turn on safe value wrapper use mode */
Swig_value_wrapper_mode(1);
Now is only active in python. All the other languages
are using the old resolution, but they can also use the
"valuewrapper"/"novaluewrapper" features to fix some
of the old broken cases. Note, however, that not all
the broken cases can be solved in that way.
The new mechanism seems to be working fine in perl, ruby
and tcl, but failing in some typemaps in java.
Hence, is upto the language maintainer to test it, and
decide to enable it or not.
Look at the valuewrapper_opaque.i for examples.
- Fix more SwigValueWrapper cases when the new mechanism
is active. Now it also check for local typemap
variables, see valuewrapper_opaque.i for an example when
this is needed. But again, this extra checking will only
be activated when using the new value wrapper mode.
- [Python] Fix variable wrapping of classes with private
assign operators. It should be easy to fix in all the
other modules, instead of checking
if (!Getattr(n,"immutable")) ...
you need to verify
if (is_assignable(n)) ...
Look at the private_assign.i for an example.
10/18/2004: mmatus
- %features "director"/"nodirector" now work as expected.
- General fixes in %feature to resolve function decl
properly,
%feature("hello") foo();
char foo() -> f() // was working
char *foo() -> f().p // it wasn't
- Template + specialization + default template args now is
working, (don't confuse with template + default arg
values, that was solved before), now this ugly case is
working:
template <class T, class A = Alloc<T> >
struct Vector
{
Vector(T a){}
};
template <>
struct Vector<double>
{
Vector(){}
int foo() { return 0; }
};
%template(V_c) Vector<char, Alloc<char> >;
%template(V_i) Vector<int>; // picks Vector<int,Alloc<int> >
%template(V_d) Vector<double>; // picks the specialization
this is needed for automatic STL support (later will
be).
- Fix the template + typedef errors in test-suite, which
probably will fix another group of strange template +
namespaces + typedefs errors.
- %warnfilter is working better now, parser.y tries to use
them when needed.
- **** New default type resolution method (stype.c) *****
It preserves the original mixed types, then it goes
'backward' first deleting the qualifier, then the inner
types, for example:
typedef A *Aptr;
const Aptr&;
r.q(const).Aptr -> r.q(const).p.SWIGTYPE
r.q(const).p.SWIGTYPE -> r.p.SWIGTYPE
r.p.SWIGTYPE -> r.SWIGTYPE
r.SWIGTYPE -> SWIGTYPE
enum Hello {};
const Hello& hi;
r.q(const).Hello -> r.q(const).enum SWIGTYPE
r.q(const).enum SWIGTYPE -> r.enum SWIGTYPE
r.enum SWIGTYPE -> r.SWIGTYPE
r.SWIGTYPE -> SWIGTYPE
int a[2][4];
a(2).a(4).int -> a(ANY).a(ANY).SWIGTYPE
a(ANY).a(ANY).SWIGTYPE -> a(ANY).a().SWIGTYPE
a(ANY).a().SWIGTYPE -> a(ANY).p.SWIGTYPE
a(ANY).p.SWIGTYPE -> a(ANY).SWIGTYPE
a(ANY).SWIGTYPE -> a().SWIGTYPE
a().SWIGTYPE -> p.SWIGTYPE
p.SWIGTYPE -> SWIGTYPE
before it always stops after finding ref/pointer/enum/array/etc.
Now, then, you can define (use and apply) 'higher' typemaps such as:
%typemap(in) SWIGTYPE* const&
%typemap(out) char FIXSIZE[ANY]
%typemap(in) SWIGTYPE* const&
%typemap(in) const enum SWIGTYPE&
%typemap(in) SWIGTYPE[ANY][ANY]
%typemap(in) const char (&)[ANY]
It is possible with this change that previous typemaps
that were defined (but ignored), now will start to work.
Also, it is necessary check for the '%typemap(varin) SWIGTYPE[]',
before it was usually not defined (but char[] was),
and that can produce some inconsistencies.
*** POTENTIAL INCOMPATIBILITY ***
This change was needed for STL, since std::vector<enum Hello>
std::vector<A*>, etc, will always generate methods that
mix const references with the vector type.
Now that is working, all the std::container<T*>
specialization will not be needed anymore, well, in
theory.
In the practice, everythin is working as before until
the proper mixed types are defined and the libraries
simplified to use them.
- Change the behavior of extern "java"/"fortran"/"etc",
now swig produces a warning, and use extern "C" instead.
The warning can also be disable with the "-w 313" flag.
(WARN_PARSE_UNDEFINED_EXTERN).
- SwigValueWrapper is now more selective (lang.cxx).
[Perl/Tcl]
- Fix some typemaps (perl/tcl) to work properly with
SwigValueWrapper. This was not a problem with
SwigValueWrapper, but with the typemaps that now are
safe to use with %apply.
[Python]
- Fix %callback/%pythoncallback work now as before after
the def args changes. Also, %callback now is an alias
for %pythoncallback, so, they do the same.
[Python/Ruby]
- %callback is more usable and uniform:
%callback("%s_cb") foo(); // for both, python/ruby
%callback("%s_cb"); // for both, python/ruby
%callback(1) foo(); // only in python.
10/17/2004: arty
[OCAML]
- Tweak to enum typing for soundness in the presence of multiple
modules.
- global functions are now unambiguous in multiple loaded modules.
- Fixed test case code to build multimodule test cases correctly.
- There is no way to share overload resolution across modules
because of soundness issues. If the user wants to call some
function foo from an arbitrary module bar, they will have to
use Bar._foo to call it correctly. Later I will fix the
camlp4 module to do something clever in this case.
- Promided performance overhaul of class mechanism.
- Removed symbol hack for ocaml-3.07 and below which is not needed
for ocaml-3.08 and above.
10/16/2004: wuzzeb (John Lenz)
[CHICKEN]
- Completly change how chicken.cxx handles CLOS and generic code.
chicken no longer exports -clos.scm and -generic.scm. The clos
code is exported directly into the module.scm file if -proxy is passed.
- The code now always exports a unit. Running the test-suite is now
majorly broken, and needs to be fixed.
- CLOS now generates virtual slots for member variables similar to how
GOOPS support works in the guile module.
- chicken no longer prefixes symbols by the module name, and no longer
forces all names to lower case. It now has -useclassprefix and -closprefix
similar to how guile handles GOOPS names.
10/16/2004: wsfulton
Templated functions with default arguments working with new default argument
wrapping approach. The new approach no longer fails with the following default
argument pattern (previously failed with some primitive types, like
unsigned primitive types):
template<typename T> int foo(const T& u = T());
%template(foo) foo<unsigned int>;
This relies on the templated function overloading support just added, so all
the combinations of overloading by template parameters and normal parameters
as well as overloading with default parameters works.
10/16/2004: wsfulton
Added support for the large range of templated function overloading that C++
supports.
- Overloaded templated functions, eg
template<typename T> int overload(T t);
template<typename T> int overload(T t, const T &r);
- Fixes where the templated type is not used in the parameter list, eg
template<typename T> void xyz();
template<> void xyz<double>();
- Fixes for overloading of plain functions by a templated function:
void abc(double d);
template<typename T> void abc(T t);
- Overloading by templated parameters fixed:
template<typename T> void foo(T t) {}
template<typename T, typename U> void foo(T t, U u) {}
%template(foo) foo<double, double>;
- All combinations of the above also working including specializations, eg:
void abc(double d);
template<typename T> void abc(T t);
template<> void abc<double>(double t);
template<> void abc(int t);
10/16/2004: wuzzeb (John Lenz)
- Remove the ability to share type information by using c linking.
All type sharing happens through a global variable in the target language.
+ Remove SWIG_NOIMPORT, SWIG_RUNTIME, and related defines.
+ Deprecate -runtime, -noruntime command line options
+ Update test-suite common.mk to correctly build multicpptest
+ Remove reference to precommon.swg
+ Update the guile_gh interface to share data by a global var instead
of c linkage.
- Remove Advanced.html, since everything in it is now obsolete
10/09/2004: mmatus
- Split the python std/STL C++ library files, now
all the language independent definitions are under
the directory
Lib/std
and hence, can be used from other languages.
- Add more documentation to the Python STL, and
clean unnecessary code.
- Add initial C99 complex support, and some fixes
for long double.
10/08/2004: mmatus
- Fix the SwigValueWrapper for opaque types, now it is
applied for opaque templates and classes, for which we
don't know if there is or not a default constructor, ie
struct A {
A(int);
};
Still, if you know that you class has a default
constructor, and for some very very particular reason
you want to avoid the SwigValueWrapper, and you don't
want or can't expose the class to swig, now you can
say
%feature("novaluewrapper") A;
class A;
or the other way around, if the class has a default
constructor, but you want to use the value wrapper, you
can say
%feature("valuewrapper") A;
struct A {
A();
....
};
- Fix for char > 128, ie
const char tilde_a = '\341';
- Add patch 1041858 for $lextype, which carries the
literal type of a symbol. See lextype.i in the
test-suite for more details.
10/07/2004: wsfulton
{Ruby, Java] Fix director + 'empty' throws
struct A {
A() throw();
virtual ~A() throw();
int foo() throw();
};
10/06/2004: wuzzeb (John Lenz)
[TCL]
- Fix bug reported by William A. Hoffman propagating clientdata
between modules. Added clientdata_prop.multicpptest to check for
this bug. The fix involved the following changes:
+ SwigType_clientdata_collect does not need to check
types in r_resolved because we only want to propagate clientdata
to typedefed classes, and r_mangled already takes care of typedefs.
+ SWIG_TypeRegister now copies the clientdata field correctly
+ Move SWIG_Guile_PropagateClientData function from guile module
into common.swg, because we need to call it from both guile and tcl.
+ Add base_names to swig_class to delay the lookup of bases. SWIG
now exports the base names and only when the base swig_class is
needed is SWIG_TypeQuery(name)->clientdata looked up.
- conversion_ns_template testsuite test was failing because
the name of the wrapped constructor function was not calculated
correctly for structs. Fixed.
10/06/2004: wsfulton
Fixes for default arguments used in directors - in virtual
methods and director constructors.
10/06/2004: mmatus
Fix the __cplusplus macro, and bug 1041170.
Now it is working as supposed, ie, you can safely use
#ifdef __cplusplus
...
all over swig, including inside %defines and %{ %} bodies.
*** POTENTIAL INCOMPATIBILITY ***
The old trick of using
#if __cplusplus
doesn't work any more. So, if you have your own typemaps
using that syntax, you will need to migrate them to use
"#ifdef __cplusplus".
10/05/2004: wuzzeb (John Lenz)
- Reorganize how runtime type information is stored and shared
between modules. For chicken and mzscheme, I removed
the ability to use runtime libraries, while perl, tcl, python, and
ruby default to using the new method but can go back to the old
method by declaring SWIG_ALLOW_RUNTIME.
- line 582 in mzscheme.cxx was generating a segfault on
imports.multicpptest, so I fixed it.
10/05/2004: wsfulton
Fixes for %extend and overloaded static methods with default
arguments.
10/05/2004: mmatus
- [python] Fix director + method with 'empty' throw, ie
struct A {
virtual int foo() throw();
};
other languages should also easy to fix, look for
Getattr(n,"throw") in python.cxx.
- Fix director + destructor with 'empty' throw
struct A {
virtual ~A() throw();
};
- Now SWIG_FEATURES parse all and the same options you
can pass to swig in the command line.
- New command line flag: -features <list>, as in
swig -features autodoc=3,director
ie, any global feature can be initialized from the
command line. This is mainly for testing, but users
can also take advantage of it.
10/04/2004: mmatus
- Properly qualify type in syntax as 'long(2)' or 'Foo()',
this solve old problem with default args, and probably
other problems around. However, the default arg problem
was also already solved by William (see below).
- Fix feature_set and feature_get methods. Before
they look from particular to general and keep the first
feature found. This didn't work well with templates.
Now the methods look from general to particular, and
override any found feature.
- Previously a feature could not be applied to constructors
or destructors that weren't explicitly declared in the class.
This is now fixed, for example:
%feature("featurename") Foo() "..."
%feature("featurename") ~Foo() "..."
class Foo {
// implicit Foo() and ~Foo()
};
- Fix missing features for default const/dest, by really
'creating' the methods and applying the features.
- Fix return_const_value.i case by adding SwigValueWrapper<const T>
specialization.
- Fix %extend + overload, including overloading actual
class methods.
- Adding more cases in related files in the test-suite.
10/04/2004: wsfulton
Changes to the way default arguments are wrapped. Previously a single
method was generated for each method that had default arguments. If
a method had 5 arguments, say, of which 1 had a default argument
then the call to the wrapped method would pass 5 arguments. The default
value was copied into the wrapper method and used if the scripting
language passed just 4 arguments. However, this was flawed as the
default argument sometimes does not have global access, for example
SWIG would generate code that couldn't compile when wrapping:
class Tricky {
public:
void foo(int val = privatevalue);
void bar(int val = Tricky::getDefault());
private:
static int getDefault();
enum { privatevalue = 200 };
};
Also bugs in resolving symbols generated code that wouldn't compile, for example
(probably fixable though):
namespace Space {
class Klass {
};
Klass constructorcall(const Klass& k = Klass());
}
The approach also does not work for statically typed languages (C# and Java)
as these languages do not allow methods to have variable number of arguments.
Although C# has a mechanism to pass a variable number of arguments they
must be of the same type and are more like varargs.
The new approach solves the above problems and wraps methods with default
arguments as if the method was overloaded. So SWIG will now treat
void foo(int val=0);
as if it had parsed:
void foo(int);
void foo();
The code generated is then exactly the same as if SWIG had parsed the two
overloaded methods. The scripting languages count the arguments passed and call
the appropriate method, just like overloaded methods. C# and Java are now able
to properly wrap methods with default arguments by generating extra methods,
again as if the method was overloaded, so for:
void bar(string s="hello", double d=10.0, int i=0);
the following proxy methods are generated:
void bar(string s, double d, int i);
void bar(string s, double d);
void bar(string s);
void bar();
The new approach comes with a couple of minor knock on effects.
1) SWIG support for default arguments for C (not C++) code no longer works.
Previously you could have this interface:
%{
void foo(int val);
%}
void foo(int val=0);
and call the wrapped method from a scripting language and pass no arguments
whereupon the default of 0 was used. You can get the same behaviour for C
code by using the "default" typemap:
%typemap(default) int val "$1 = 0;";
%{
void foo(int val);
%}
void foo(int val);
or you could of course compile your code as C++ if you want C++ features :) :
%{
void foo(int val=0);
%}
void foo(int val=0);
A couple of SWIG's libraries used this C extension and these have been modified
to use the "default" typemap. The "default" typemap is thus unchanged (and still
is not and is not fully supported by C# and Java, and is likely to remain so).
2) All features (%feature, %rename, %ignore etc) no longer work as if the method
with default arguments is just one method. For example, previously
%ignore foo(int);
would have ignored the method completely. Now it will only ignore foo(int) but
not the extra foo() method. Instead use:
%ignore foo;
to ignore them all. or
%ignore foo(int);
%ignore foo();
This of course allows one to fine tune the wrapping, for example one could use:
%rename(fooint) foo(int);
%rename(foodefaults) foo();
void foo(int val=0);
and call them from any language like so:
fooint(200)
foodefaults()
or for example ignore the extra overloaded method, so the defaults cannot be used:
%ignore foo();
void foo(int val=0);
*** POTENTIAL INCOMPATIBILITY ***
10/2/2004: mmatus
[Python]
- More cleaning up and uniformation on the Python Lib
- Added Robin's docstring patch, plus some fixes, plus
some extensions, see autodoc.i example in the test-suite,
and try using %feature("autodoc","extended").
This patch is not a complete solution for the
documentation problem, just enough to inform python about
the parameter list.
The expected swig documentation support is far far away yet.
10/1/2004: mmatus
- Fix the %callback feature (only used in ruby and python examples,
by now, but it should be generic), now member callbacks
are working again
- Fix wrapping of functions pointers like
std::ostream& std::endl(std::ostream&);
ie, the ones that return references or enums.
[Python] Add the %pythoncallback directive, which is
an improved version of %callback, ie,
%pythoncallback(1) foo;
%pythoncallback(1) A::bar;
%pythoncallback(1) A::barm;
int foo(int a) {
return a;
}
struct A
{
static int bar(int a);
int barm(int a);
};
int foobar(int a, int (*pf)(int a));
in python you can use
foo(2)
foobar(2,foo)
A.bar(2)
foobar(2,A.bar)
ie, no additional pointer elements are created, and
the original 'foo' and 'A.bar' can be used as parameters.
In the case of member function however, still you need
to use the special variable Class::<fnc_name>_cb_ptr, ie:
foobarm(3, a, A.barm_cb_ptr)
we will try to fix this situation also, but later.
[Python] Add more elements from the STL library, now
you can use
import std
std.cout << "hello " << 123 << std.endl
[Python] Fix in/out return mechanism, now swig will behave
as 1.3.21 but using a python list when needed. The problem
is that the types std::pair,std::vector,etc, use tuples,
and they interfer with the previous inout tuple type.
By using lists we solve the conflicts, swig acts as before,
but returns a list when more than one parameter are using
the OUT typemap. See the new inout.i example in the
test-suite.
*** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
[Python] Much better error messages for bad arguments, now
you always get the argument number where the error occurred.
09/27/2004: wsfulton
Patch from Bill Clarke -
1) Warning emitted when -importall and -includeall is used together,
with -includeall taking precedence.
2) Ensure SWIGIMPORTED is always defined when a file is being
imported with %import. Note that this is not the same as SWIGIMPORT,
which gets defined in all generated wrapper files.
09/26/2004: mmatus
- add %feature("exceptionclass") to identify a class used
as exception. Before swig identified and marked a class
using the "cplus:exceptionclass" attribute. However, the
class needed to appear on an throw() statement. Now
swig keeps trying to identify the exception classes, as
before, but it also allows the user to mark a class by
using the %feature explicitly. (mostly relevant for
python and chicken)
[Python]
- fix -modern option + exceptions, which mix old class
style with the new one. So, we always need to emit
the "nonmodern" python code.
- add the "python:nondynamic" feature and its handler
now if you have
%pythonnondynamic A;
struct A {
int a;
int b;
};
then, in the python side
aa = A()
aa.a = 1 # ok
aa.b = 2 # ok
aa.c = 3 # error, the class can not be extended dynamically.
Since this is a feature, you can use
%pythonnondynamic;
or
%pythondynamic; [ Note: %pythondynamic since deprecated ]
to force all the wrapped classes to be "nondynamic" ones.
The default, as in regular python, is that all the wrapped
classes are dynamics. So, careful with your spelling.
09/14/2004: mmatus
- Support the -I- option.
- Differentiate between %include <file> and %include "file".
This fix several corner cases.
[Python] Several patches:
- Normalize the Lib file names:
*.swg internal files,
*.i user files.
- Fix Char[ANY] typemaps, so they also delete any extra '\0' chars,
now they behave as before (1.3.21). Still, you can use
the SWIG_PRESERVE_CARRAY_SIZE macro if you need to
preserve the original size (see pystrbase.swg).
- Add the Char FIXSIZE[ANY] typemaps, to preserve the
original C array sizes (see above). Though, you can't
use them yet since %apply and arrays are not working
together.
- Add pyfragments.swg, now the user can add fragments
to override the default ones.
09/10/2004: wsfulton
Patch from Bill Clarke which fixes spurious preprocessor bug which
shows on Solaris and gcc, eg:
Warning(202): Could not evaluate '!defined(SWIGJAVA) &&
!(defined(SWIGCSHARP)'
Also fixes a bug where '#if "a" == "b" == 1' wouldn't have worked
09/10/2004: wsfulton
Restored multiple build directories for the test-suite. Patch from
Bill Clarke.
09/06/2004: wsfulton
Added the missing runtime.dsp Visual Studio project files for the
import examples to work.
Version 1.3.22 (September 4, 2004)
==================================
09/03/2004: wsfulton
The swig.m4 macro for use with the Autoconf/Automake/Libtool has
been removed and is no longer installed. Please use the new and better
maintained version derived from swig.m4 in the Autoconf macro archive.
See http://www.gnu.org/software/ac-archive/htmldoc/ac_pkg_swig.html and
http://www.gnu.org/software/ac-archive/htmldoc/ac_python_devel.html.
09/01/2004: wsfulton
[Perl] Applied patch #1019669 from Christoph Flamm. Adds support
for %feature("shadow") in the same way as it works in Python. This
enables one to override the generated shadow/proxy methods, including
constructors and destructors. For example:
/* Let's make the constructor of the class Square more verbose */
%feature("shadow") Square(double w)
%{
sub new {
my $pkg = shift;
my $self = examplec::new_Square(@_);
print STDERR "Constructed an @{[ref($self)]}\n";
bless $self, $pkg if defined($self);
}
%}
class Square {
public:
Square(double w);
...
};
08/31/2004: mmatus
[Python] Incompatibility reported by Bill Clarke (llib@computer.org):
If you are using Sun Studio 8 (and possibly earlier
versions) to compile the output produced by swig
1.3.22rc1, and you are using C++ and STL templates then
you need to use either "-runtime" or "-noruntime". If you
use neither of these options then you will probably get
compiler errors when trying to compile the wrapper file;
the error message will be like this: The name
SWIG_Python_ConvertPtr[...] is unusable in static
swigpy::traits_asptr[...] If you get this error message,
you need to regenerate your wrapper file using 'swig
-runtime' or 'swig -noruntime'.
You shouldn't get this problem with Sun Studio 9.
*** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
08/26/2004: wsfulton
[Perl] Applied #932333 from Ikegami Tsutomu. Fixes long long *OUTPUT
and unsigned long long *OUTPUT typemaps in typemaps.i.
08/26/2004: wsfulton
Applied patch #857344 from Art Yerkes. Workaround for autoconf bug when
running 'make install'.
08/26/2004: wsfulton
[Perl] Part of patch #982753 applied. This implements a %perlcode directive.
It allows one to add Perl code to the generated .pm file. Works the same
as %pythoncode.
08/26/2004: wsfulton
[Java] Fix for directors when wrapping virtual methods with exception
specifications that were not simple types. Previously code was generated that
didn't compile, for example when the exception specification was a pointer.
08/25/2004: wsfulton
[C#] Typemap fix for methods that return char *. The CLR would incorrectly
delete the memory pointed to by char *. Also applied the same correction to
the char array typemaps.
08/24/2004: wsfulton
Fixes for -fmicrosoft error/warning message display:
- End of file (EOF) warning messages not displaying in correct format
- Some messages containing a file path were displaying a double backslash
instead of a single backslash
08/23/2004: wsfulton
Applied patch #1011604 submitted by Charles Schwieters. Fix for 64 bit tcl
interpreters.
08/23/2004: wsfulton
Fix for bug #875583 - enum forward declarations previously gave a syntax error.
08/23/2004: mkoeppe
[Allegro CL] Use typemaps "ffitype" and "lisptype" to determine the FFI type
specifiers from the C type. This makes it possible, for instance, to control
whether a C "char" argument takes a Lisp character or a Lisp integer value.
The default (taking Lisp characters) is done by these built-in typemaps:
%typemap(ffitype) char ":char"; %typemap(lisptype) char "character";
If char means an integer instead, use these typemaps:
%typemap(ffitype) char ":char"; %typemap(lisptype) char "integer";
08/22/2004: wsfulton
As discussed in bug #772453, the SWIG library directory is now installed
into a different default directory. The library used to be installed to
/usr/local/lib/swig1.3. It is now in the more usual architecture independent
directory and I have additionally used a version specific subdirectory as
the library will rarely work with older versions of SWIG. This release
will thus use /usr/local/share/swig/1.3.22 by default, which can be
tailored as before using './configure --swiglibdir'.
08/17/2004: mkoeppe
[MzScheme] Add support to create native MzScheme structures from C structures.
To convert a C structure to an MzScheme structure, use the new runtime macro
SWIG_NewStructFromPtr in a typemap. Patch from Dmitriy Zavin.
08/12/2004: wsfulton
Patch #837715 from Ben Reser to correctly detect Python lib directory
on 64 bit systems.
08/12/2004: wsfulton
[C# and Java] Prevent memory leaks in the case of early return
from wrapper methods using const std::string & parameters. Modified
Mark Traudt patch #951565.
08/12/2004: wsfulton
Bug #943783 with patch fixes php char * out typemap NULL values.
08/03/2004: Ahmon Dancy <dancy@dancy>
[allegrocl] Additional case mode fixes. Also, make sure
foreign types are exported.
07/24/2004: mkoeppe
[Guile] In -scm mode, SWIG modules now exchange their pointer type
information via the Guile interpreter. It is no longer necessary to build a
runtime library or to use -noruntime and -runtime etc.
The module (Swig swigrun) which was introduced in the change of 05/17/2004 is
no longer automatically built. If you need it, run SWIG on the interface file
swigrun.i.
07/23/2004: wsfulton
[C#] Bug #917601 Mapping C++ bool fix from Mark Traudt
07/23/2004: wsfulton
RPM fixes for latest CVS version including removal of runtime
library.
07/23/2004: wsfulton
Patch #908955 from Robert H De Vries.
RPM file generation fix for Fedore Core 1 and Redhat AS2.1.
07/12/2004: wsfulton
Patch #864689 from Robin Dunn:
This patch corrects two problems in the XML output of SWIG:
1. There were often extra '/>\n' in the output.
2. value attributes were output with '\n' in them but
since that is not technically legal most (all?) XML
parsers will strip them out. Replacing the '\n' with
the ' ' entity reference solves this as that is
legal and XML parsers will convert it to a '\n' when
reading the values back in.
This patch also adds a new global command line option
that will allow the parse tree to be written out in XML
*after* some other language module has been run, in
order to be able to get extra info that the language
module puts in the tree. In this way the XML is a
post-processed version of the tree rather than a
pre-processed version.
Command line option is -dump_xml or -xmlout <file>
07/12/2004: wsfulton
[Java] Patch from Scott Michel to fix typesafe enums and proper enums
with directors.
07/12/2004: wsfulton
HTML documentation (makechap.py) file generator missing end of line
patch #908951 from Robert de Vries.
07/08/2004: wsfulton
The deprecated runtime library build has been removed. This also removes
the dependency on Libtool. Libtool is no longer required to build SWIG.
The associated -ldflags SWIG commandline option has also been removed.
The examples and test-suite testcases that used the runtime library have
been updated to use the replacement approach to using SWIG across
multiple modules, that is they use the -noruntime and -runtime commandline
options, see Modules.html. Effectively they build their own runtime
libraries using -runtime. The examples are import and import_template.
The test cases are in the imports and template_typedef_import directories.
Anyone who wants the original runtime libraries can either run the test-suite
or build the examples and use the appropriate shared object/DLL that is
generated with the -runtime commandline option. For example libimports_runtime.so
(Python calls it lib_imports_runtime.so) is generated after running the
'make imports.multicpptest' testcase in the Examples/test-suite/<lang>
directory. Or use libruntime.so / runtime.dll after building the import
examples in Examples/<lang>/import.
07/07/2004: mkoeppe
[Allegro CL] Convert character and string literals in constants to
CL syntax. Fix FF:DEF-FOREIGN-CALL for mixed-case C functions.
06/27/2004: wsfulton
[Java] New feature for Java exceptions with format %javaexception(exceptionclasses).
This feature is a slight enhancement to %exception and the only difference is the
addition of the exception classes which are generated into a throws clause.
The 'exceptionclasses' is a comma separated list of classes which will be
added to the associated proxy method's throws clause. The 'exceptionclasses'
are specified like the exception classes in the 'throws' attribute in the
typemaps. This feature should be used for correctly handling checked exceptions
thrown from JNI code. For example:
%javaexception("java.lang.Exception") throwException %{
... convert a std::logic_error into a java.lang.Exception using JNI code ...
%}
#include <stdexcept>
void throwException() {
throw std::logic_error("Logic error!");
}
will generate a method with a throws clause in the module class:
public static void throwException() throws java.lang.Exception { ... }
06/27/2004: wsfulton
[C#] New %csconstvalue(value) feature directive for use with constants and
enums. This works the same way as %javaconstvalue. For C#, this directive
is the only way that one can fix wrapping of C/C++ enums with proper C#
enums if the enum item's initialiser cannot compile as C# code. This is
because Java enums can use a call into C code to initialise the enum item,
whereas in C#, the enum value must be a compile time constant. That is,
using %csconst(0) cannot be used in C# to initialise the C# enum item via
a PINVOKE call.
06/27/2004: wsfulton
[Java] New %javaconstvalue(value) feature directive for use with constants and
enums. Sometimes the use of %javaconst(1) will produce code that won't compile
under Java. If a compile time constant is required, %javaconst(0) is not an
option. The %javaconstvalue directive achieves this goal and the value specified
is generated as Java code to initialise the constant. For example:
%javaconst(1);
%javaconstvalue(1000) BIG;
%javaconstvalue("new java.math.BigInteger(\"2000\")") LARGE;
%javaconstvalue(10) bar;
%{
const int bar = 10;
%}
%inline %{
#define BIG 1000LL
#define LARGE 2000ULL
enum Foo { BAR = ::bar };
%}
Generates:
public interface exampleConstants {
public final static long BIG = 1000;
public final static java.math.BigInteger LARGE = new java.math.BigInteger("2000");
}
public final class Foo {
public final static Foo BAR = new Foo("BAR", 10);
...
}
Previously, none of BIG, LARGE or BAR would have produced compilable code
when using %javaconst(1).
06/27/2004: wsfulton
%feature enhancements. Features can now take an unlimited number of attributes
in addition to the feature name and feature value. The attributes are optional
and are much the same as the typemap attributes. For example, the following
specifies two optional attributes, attrib1 and attrib2:
%feature(featurename, attrib1="attribval1", attrib2="attribval2") name "val";
%feature(featurename, val, attrib1="attribval1", attrib2="attribval2") name;
06/27/2004: wsfulton
%feature improvements for the syntax that takes the feature value within the
%feature() brackets. The value specified is no longer restricted to being just
a string. It can be a string or a number. For example, this is now acceptable
syntax:
%feature("featurename",20.0);
whereas previously it would have to have been:
%feature("featurename","20.0");
Useful for features that are implemented as a macro, for example:
#define %somefeature(value) %feature("somefeature",value)
These will now work accepting either a string or a number:
%somefeature("Fred");
%somefeature(4);
06/06/2004: wuzzeb (John Lenz)
[Chicken, Guile]
- Created the Examples/test-suite/schemerunme directory, which holds all the
runme scripts for guile and chicken (and possibly mzscheme...). The guile
and chicken _runme files then (load "../schemerunme/foo.scm").
- In chicken module, fix a few bugs invlolving dynamic casts.
06/03/2004: wsfulton
Patch to fix wrapping of templated methods. ISO compliant compilers, like
Comeau and GCC-3.4.0, don't like the template specifier that SWIG was generating
when calling the method. This fix may break some non standard compliant compilers,
for example, Sun workshop compilers prior to version 6.2.p2. Patch submitted
by Bill Clarke.
06/03/2004: wsfulton
[Java, C#] Undocumented special variable $imclassname removed.
New special variable $module is replaced by the module name, as specified
by %module or -module commandline option. $imclassname can be created from $module.
06/03/2004: wsfulton
[C#] Same as for Java below. The new typemaps are named differently, namely,
csbody and csbody_derived. The deprecated typemaps are csgetcptr and
csptrconstructormodifiers.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
06/03/2004: wsfulton
[Java] Typemap changes for the Java proxy / typewrapper and enum classes. A new
typemap called javabody contains the essential support code for generation into the body
of these classes. There is also a new javabody_derived typemap which is used instead for
wrapped classes that have a wrapped base class. The code is basically, the getCPtr()
method and swigCPtr and swigCMemOwn member variables. These used to be hard coded
with no way to modify the code. The introduction of this typemap makes it possible for
the user to tailor nearly every aspect of the code generation.
The exception now is the code for director classes.
The javagetcptr and javaptrconstructormodifiers typemaps are deprecated and are
no longer used as the code that these generated can be put in the more flexible
javabody and javabody_derived typemaps.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
The following macros contributed by Scott Michel may help you upgrade if you have used
the javagetcptr typemap:
/* Utility macro for manipulating the Java body code method attributes */
%define SWIGJAVA_ATTRIBS(TYPENAME, CTOR_ATTRIB, GETCPTR_ATTRIB)
%typemap(javabody) TYPENAME %{
private long swigCPtr;
protected boolean swigCMemOwn;
CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
GETCPTR_ATTRIB static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
%}
%typemap(javabody_derived) TYPENAME %{
private long swigCPtr;
CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) {
super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
GETCPTR_ATTRIB static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
%}
%enddef
/* The default is protected getCPtr, protected constructor */
SWIGJAVA_ATTRIBS(SWIGTYPE, protected, protected)
/* Public getCPtr method, protected constructor */
%define PUBLIC_GETCPTR(TYPENAME)
SWIGJAVA_ATTRIBS(TYPENAME, protected, public)
%enddef
/* Public getCPtr method, public constructor */
%define PUBLIC_BODYMETHODS(TYPENAME)
SWIGJAVA_ATTRIBS(TYPENAME, public, public)
%enddef
06/03/2004: wsfulton
[Java, C#] The contents of the class modifier typemaps and pragmas have changed.
They must now include the class type. Previously 'class' was hard coded.
This change enables flexibility into what type of class is generated,
for example the proxy class could be an interface instead of a class.
For Java this affects the javaclassmodifiers typemap and the jniclassclassmodifiers
and moduleclassmodifiers pragmas.
For C# this affects the csclassmodifiers typemap and the imclassclassmodifiers
and moduleclassmodifiers pragmas.
Unless you have overridden the default versions of these typemaps or pragmas, you
shouldn't be affected. However, if you have, upgrading is easy, for example
class Foo {};
%typemap(javaclassmodifiers) Foo "public final"
must now be:
class Foo {};
%typemap(javaclassmodifiers) Foo "public final class"
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
05/31/2004: wsfulton
Fix for C++ exception specifications that are references. Problem reported by
Oren Miller. Also improves the generated exception declarations in the
catch handler for pointers - a pointer is used instead of a reference to
a pointer. Added default throws typemaps for SWIGTYPE &, SWIGTYPE * and
SWIGTYPE[ANY] (Java and C#).
05/31/2004: wsfulton
[Java, C#] Some minor typesafe enum improvements, including storing the name of
the enum item. The toSring() / ToString() methods are overridden to return this name.
05/30/2004: wuzzeb (John Lenz)
[Chicken]
- Update how examples and the test suite are built.
- Symbol names are no longer converted to lower case
- Added union_runme.ss, which was copied and modified from the guile module
05/26/2004: lballabio (Luigi Ballabio)
Committed on behalf of Marcelo (who still has problems with
the SourceForge CVS.)
Added Python typemaps for FILE* with (Python-only) test.
5/24/2004: dancy
* Allegro CL module: Now using some macros (defined in
Lib/allegrocl/allegrocl.swg), swig-defconstant and swig-defun, for
defining constants and foreign functions. This makes the
generated file a bit neater.
Now strips a layer of parenthesis from constants.
Uses (* :void) instead of :foreign-address now.
05/20/2004: wsfulton
Unnamed enum global variables are now supported in addition
to the recently added support for unnamed enum member variables.
For example:
struct Foo {
enum { enum1, enum2 } MemberInstance;
};
enum { enum3, enum4 } GlobalInstance;
The int typemaps are used for wrapping the get/set accessor methods.
If the sizeof an enum is not the same size as an int then setting the
variable will silently do nothing as the casts cannot be easily and portably
generated. If you need to solve this highly obscure situation, write
the assignment using the %exception feature.
05/20/2004: wsfulton
[C#] C# enum wrapping mods. Similar to the Java module, enums can be wrapped using
one of 3 approaches:
1) Proper C# enums - use %include "enums.swg"
2) Typesafe enums - use %include "enumtypesafe.swg"
3) Simple constant integers (original approach) - use %include "enumsimple.swg"
See each of these files for further details. Each of these files use typemaps
and a new feature to control the generated code. The feature is:
%csenum(wrapapproach);
where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple".
[No implementation deemed necessary for type unsafe enums].
The default approach is proper C# enums. Anonymous enums are always wrapped by
constant integers.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
05/20/2004: wsfulton
[Java] Java enum support added. There are now 4 ways in which enums can be wrapped:
1) Proper Java enums - use %include "enums.swg"
2) Typesafe enums - use %include "enumtypesafe.swg"
3) Type unsafe enums (constant integers) - use %include "enumtypeunsafe.swg"
4) Simple constant integers (original approach) - use %include "enumsimple.swg"
See each of these files for further details. Each of these files use typemaps
and a new feature to control the generated code. The feature is:
%javaenum(wrapapproach);
where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple".
The default typemaps will handle enums that may or may not have specified initial
values, for example ten is specified:
enum Numbers { zero, ten(10) };
However, the amount of generated Java code can be cut down, by modifying these typemaps
if none of the enums have initial values (proper Java enums and typesafe enums approach).
The default approach is typesafe enums. Anonymous enums are always wrapped by
constant integers.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
05/11/2004: wsfulton
[Java, C#] Fix bug using %rename on enum items and when using
%javaconst(1) / %csconst(1)
For example, the following used to generate code that wouldn't compile:
%rename(Obj) Object;
enum Grammar { Subject, Object };
04/28/2004: wsfulton
[Java, C#] Minor fixes when using combinations of the
javainterfaces, javabase, csinterfaces and csbase typemaps.
05/18/2004: wsfulton
[Java] JVM link failure on some systems fixed when using std_vector.i.
Also adds default vector constructor for use from Java.
05/17/2004: mkoeppe (Matthias Koeppe)
[Guile] New runtime functions SWIG_PointerAddress,
SWIG_PointerType, SWIG_IsPointerOfType, SWIG_IsPointer.
[Guile] In -scm mode, wrap several SWIG runtime functions
and export them into the module (Swig swigrun). The
runtime module is now built with "module" linkage.
[Guile] GOOPS proxy objects now also print the pointer
address of the C object.
05/14/2004: lyle
Added Kou's patch for the Ruby %import directive so that modules
with "nested" names are handled properly. Consider an interface
file foo.i that has this %module declaration at its top:
%module "misc::text::foo"
Now consider another interface file spam.i that imports foo.i:
%import foo.i
Before this patch, this would result in the following code being
generated for spam_wrap.c:
rb_require("misc::text::foo");
With this patch, however, you'll get the correct path name
for the call to rb_require(), e.g.
rb_require("misc/text/foo");
See SourceForge Bug #928299.
05/12/2004: wsfulton
Patch for emitting directors when %feature("director") specified
for a class with no virtual methods, but does have a virtual destructor.
Submitted by Kevin Smith.
05/06/2004: mkoeppe (Matthias Koeppe)
New SWIG runtime function SWIG_TypePrettyName, which
returns an unmangled type name for a swig_type_info
object.
[Guile]: Use it for printing pointer objects.
05/03/2004: dancy (Ahmon Dancy)
* Lib/allegrocl/allegrocl.swg: Updated comments about identifer
conversion.
* Sources/Modules/allegrocl.cxx: Register /dev/null for "header"
target. Also, disregard "const" qualifiers during type
conversion.
05/02/2004: wuzzeb (John Lenz)
[Chicken] Fix bug 782468.
To fix this bug, the runtime code has been rewritten, and
pointers are now represented as a C_SWIG_POINTER_TYPE.
Chicken version > 1.40 is now required!
* Typemap incompatibility: typemaps no longer use chicken_words.
If a typemap needs some space, it should just call C_alloc
* argout typemaps no longer use the /* if ONE */ construct to
build an output list. A SWIG_APPEND_VALUE macro, exactly like
guile and mzscheme is now used.
04/25/2004: mkoeppe (Matthias Koeppe)
[Guile] In the generated GOOPS code, don't create methods
that would not specialize any arguments; simply re-export
the primitive functions. (This is a performance
optimization which reduces load time and execution time.)
[Guile] In -gh mode, fix the "too many initializers" error
which was caused by an incompatible swig_type_info layout.
[Guile] The typemap for FILE * in ports.i now also accepts
a regular FILE * pointer object. Also a bug with Scheme
file ports that are open for input and output has been
fixed.
04/25/2004: wsfulton
Change entry 03/21/2004 revoked. The change introduced another
inconsistency (reference typemaps beings used instead of
pointer typemaps for member variables as well as static
member variables and global variables for some languages,
but only for C++ and not C). This would break user's current
typemaps and introduce further inconsistencies. Alternative
solution required and being discussed.
04/10/2004: mmatus (Marcelo Matus)
Added the -directors flag. This enables the director
mode for the interface and all the classes that
don't set the "feature:nodirector" explicitly.
You can use this in your module if you want to use the
director feature in all your classes, but it is most
intended for testing purposes, like:
make check-python-test-suite SWIG="../../../swig -directors"
make check-ruby-test-suite SWIG="../../../swig -directors"
make check-java-test-suite SWIG="../../../../swig -directors"
These commands will run the entire test-suite using
directors, and not only the specific 'directors_*'
cases. This should be done from time to time.
04/10/2004: mmatus (Marcelo Matus)
[python] Added support for std::wstring and wchar_t,
for compiler and python versions that support them.
When needed, use
%inlcude std_string.i // 'char' strings
%inlcude std_wstring.i // 'wchar_t' strings
04/10/2004: mmatus (Marcelo Matus)
[python] Fix the default behaviour (seg. fault) when an
inplace operator (+=,-=,...) was wrapped, as reported by
Lucriz (lucriz@sitilandia.it), when the most common
form was used:
A& A::operator+=(int i) { ...; return *this; }
^^^^ ^^^^^^
ie, an object is returned and its contains the same 'this'
value than the input object, which is deleted after the
operation "a += b", leaving the result with no real
object, but a seg. fault.
To fix it, we needed to introduce a new feature and use an
old one:
%feature("self:disown") A::operator+=;
%feature("new") A::operator+=;
here, "self:disown" disable the ownership of the 'self'
or input object, and the "new" feature transfers the
ownership to the result object.
The feature/solution could also be used in other languages
that use gc and implement the inplace operators, or other
operators, in a similar way.
*** POTENTIAL INCOMPATIBILITY FOR Python MODULE ***
If you already are using the inplace operators in python,
and you implemented some kind of workaround to the problem
fixed here, it is possible you could end with 'free'
objects that never get deleted. If that is the case, and
you want to disable the current fix, use:
%feature("self:disown","") A::operator+=;
%feature("new","") A::operator+=;
04/07/2004: cheetah (William Fulton)
[C#] C++ enums are no longer wrapped by integers, they are now wrapped by
C# enums. For Example, given C++:
enum AnEnum { foo, bar };
typedef AnEnum AnEnumeration;
void something(AnEnum e, AnEnumeration f);
The following is generated:
public enum AnEnum {
foo,
bar
}
public static void something(AnEnum e, AnEnum f) {...}
Note that a global enum like AnEnum above is generated into its own
file called AnEnum.cs. Enums defined within a C++ class are defined
within the C# proxy class. Some of the typemaps for modifying C# proxy
classes also work for enums. For example global enums can use
%typemap(csimports) to add in extra using statements.
Global enums and class enums can use
%typemap(csclassmodifiers) to make the enum private, public etc.
%typemap(csbase) to change the underlying enum type (enum base)
If we add this for the above example:
%typemap(csclassmodifiers) AnEnum "protected"
%typemap(csbase) AnEnum "long"
the following is generated:
protected enum AnEnum : long {
foo,
bar
}
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
04/07/2004: cheetah (William Fulton)
Seg fault fix for empty enums, like
enum Foo {};
03/21/2004: mmatus
[Note: this change revoked on 04/25/2004]
[Python] Makes the following 'var' cases more uniform:
std::string ga;
struct A {
static std::string sa;
std::string ma;
};
now the three variables (ga, sa, ma) can be assigned as:
cvar.ga = "hello";
A.sa = "hello";
a.ma = "hello";
ie, now 'ma' will also use a std::string typemap 'in' if
defined, before it was only accepting a 'p_std_string'
pointer. Note, however, that 'ma' will not use the
'varin/varout' typemaps (that probably could be more
natural), but it will pick up the 'in' typemap for const
std::string& (which is easier).
The changes in cwrap.c and lang.cxx will probably fix the
behaviour in other languages that do not overload the
membervarHandler method "too much".
03/21/2004: mmatus
[Python] Disabling the default instantiations like:
%template() std::pair<int,int>;
for all the primitive types and STL containers/classes.
They are expensive, specially for pair and map, and the
previous behaviour also requires the user to perform
manual instantiations. Still, if the speed difference is
not important, it can be re-enabled by defining the macro
SWIG_STD_DEFAULT_INSTANTIATION (see std_common.i).
Also, normalizing the INPUT/OUTPUT/INOUT typemaps. Now
they use the same conversors than the rest of the
typemaps, and you can use them for std::pair, std::string
and all the other STL types, like in:
void p_inoutd(std::pair<double, double> *INOUT);
Added the attribute.i and implicit.i files with macros to
transform functions pairs like 'set_x'/'get_x'
(or 'T& x()'/'const T& x() const') into an attribute,
and allowing the use of implicit constructors in typemaps
(see the files for more details).
03/21/2004: mkoeppe
[Guile] Fix the documentation strings of functions with
anonymous arguments.
03/18/2004: mmatus
[Python] More general std_string.i interface.
Now you can wrap it using
%template(string) std::basic_string<char>;
and use the std::string as a base class:
struct A : std::string {
};
But more important, swig will recognize
both std::basic_string<char> and std::string as
the same type.
03/16/2004: mmatus
Previously added, but not mentioned before:
- friend declaration support, swig now emits a global
function in the same class scope.
- ref/unref features: to mix ref counting C++ classes
and native script ref counting mechanisms (like in python).
Use it like:
%feature("ref") RCObj "$this->ref();"
%feature("unref") RCObj "$this->unref();"
And the class RCObj, and all the derived ones, will
perform the right ref/unref calls when a new pointer
is returned to the target language, or when the target
language attempts to delete the object.
See the refcount.i file in the test-suite for more
details.
03/16/2004: mmatus
[Python] Using the new %fragment support, major rewrote
of the python swig library, including:
- Almost automatic template/typemap instantiation for
the STL components. For example, now you can write:
%template(vector_i) std::vector<int>;
and a specialized vector_i class is emitted with all
the needed typemaps. No need to use the old
'specialize_vector' macros.
Note you can also define
%template(matrix_i) std::vector<std::vector<int> >;
%template(vector_pii) std::vector<std::pair<int,int> >;
- The empty template instantiation
%template() std::vector<int>;
defines the vector typemaps, but no proxy class. For all the
fundamental types, the empty template instantiation are
defined, so, you can say
%include std_vector
int func(const std::vector<int>& a);
where the proper typemap is applied to 'a', but no
std::vector<int> proxy is generated.
- All the STL containers present a more uniform behavior and
more complete interface declaration. The following are
now supported:
std::vector<T>
std::list<T>
std::deque<T>
std::set<T>
std::multiset<T>
std::map<T>
std::multimap<T>
not a container, but also supported:
std::pair<T,U>
also, more typemaps are defined for all of them,
including varin, varout, typecheck, etc.
- Initial attempt to implement the STL containers
considering allocators, ie:
std::vector<T,A>
it is partially working, but it is just a workaround
while swig improves its template type support.
Please test with your particular setup. It seems to be
working with g++ 3.2.2, g++ 2.96, Intel icc and SGI CC
compilers, plus python 1.5.2, 2.0 and 2.3, but since
we are using templates, there is a chance you can find
some problems when using with an old C++ compiler.
03/16/2004: mmatus
- Allowing the empty %template directive, such as
%template() std::vector<int>;
to process the class "typedef"s and "typemap"s. Before
only the internal "typedef"s were processed.
This makes possible to emit the default in/out
typemaps without the need of wrapping an specialized
vector instance.
- Adding the preprocessor extension #@ which mangles the
following macro argument, like in:
#define macro(X) #@X
macro(int) -> int
macro(std::string) -> std_s_s_string
- Fragments can now be "type specialized", as the typemaps. The
syntax is as follows
%fragment("name","header")
{ /* a type independent fragment (old syntax) */ }
%fragment("name" {Type}, "header")
{ /* the fragment is type dependent */}
Now fragments can also be used inside templates:
template <class T>
struct A {
%fragment("incode"{A<T>},"header") {
/* 'incode' specialized fragment */
}
%typemap(in,fragment="incode"{A<T>}) {
/*
here we use the 'type specialized'
fragment "incode"{A<T>}
*/
}
};
03/11/2004: cheetah (William Fulton)
[Java] Director bug which meant that some virtual functions overridden in
Java were not being called on some operating systems. Bug reported and fixed
by Robert de Vries and Scott Michel.
03/02/2004: mkoeppe (Matthias Koeppe)
[Guile] In -scm mode, don't forget to check the type of string arguments.
02/24/2004: cheetah (William Fulton)
[C#] New commandline option -namespace <name>. This allows one to specify
a C# namespace into which all C# classes are generated.
02/23/2004: mkoeppe (Matthias Koeppe)
[MzScheme] Use FUNC_NAME rather than a bogus typemap variable for signalling
errors. Call scheme_wrong_type with a zero-based argument number.
Reported by Ondrej Pacovsky, SF #902621.
[Guile] Define FUNC_NAME also in the dispatch wrapper for overloaded
functions. Patch by John Lenz, SF #896255.
02/22/2004: mkoeppe (Matthias Koeppe)
[Guile] In -scm mode, don't try to invoke a null destructor function.
02/20/2004: cheetah (William Fulton)
Fixes so that the SWIG source will compile using the Digital Mars Compiler
(formerly Symantic compiler) on Windows. Submitted by Scott Michel.
02/13/2004: mkoeppe (Matthias Koeppe)
[MzScheme] New command-line argument -noinit. Use it for building
the runtime library, where we don't want to define the functions
scheme_initialize etc. Reported by Tim Brown, SF #891754.
[MzScheme] Don't produce invalid C code when invoked with the
-declaremodule option. Reported by Tim Brown, SF #891108.
[Guile] Build the runtime library with passive linkage, to rename
the SWIG_init function uniquely.
02/12/2004: cheetah (William Fulton)
[Java, C#] Patch submitted by Bill Hoffman which prevents SWIG from crashing
when a file for the typewrapper class cannot be opened.
02/11/2004: cheetah (William Fulton)
[Java, C#] Overloading changes:
- Methods which are overloaded in const only no longer generate Java
code that won't compile - the first method parsed is used and a
warning is displayed. Note that this behaviour is slightly different
to the scripting languages which always uses the non-const method.
- Warning messages 509 and 512 replaced by new warning number 516, which
is more relevant to these statically typed languages as the overloaded
methods aren't 'shadowed', they are ignored.
01/23/2004: mkoeppe (Matthias Koeppe)
[Guile] Replace the "known_classes" hash table by a node
attribute. Methods of classes in C++ namespaces now get
the proper specializer in the GOOPS declaration.
Reported by rm@mh-freiburg.de.
01/23/2004: mkoeppe (Matthias Koeppe)
[Guile] Uniquify the argument names in GOOPS shadow method
declarations. Reported by rm@mh-freiburg.de.
01/21/2004: sunshine (Eric Sunshine)
Revived the NextStep port of SWIG.
Fixed fatal problem in DohStrstr() caused by difference in strstr()
implementation which made %apply become entirely dysfunctional. On
NextStep, strstr("foo","") evaluates to NULL; whereas, on modern
platforms, it evaluates to "foo". %apply relies extensively upon
strstr("foo","") evaluating to non-NULL, therefore it failed
catastrophically when faced with NextStep's strstr().
Added `bool' check to configure.in since NextStep's C++ compiler
does not supply this type. swig.h now fakes up `bool' if needed.
Worked around NextStep C++ compiler bug in which C++ code is
disallowed inside extern "C" functions. This problem affected all
language modules, since they publish hook functions of the form:
extern "C" Language *swig_foo(void) { return new FOO(); }
Fixed by creating a C++ wrapper:
static Language *new_swig_foo() { return new FOO(); }
extern "C" Language *swig_foo(void) { return new_swig_foo(); }
Ensured that Swig_copy_string() is used in place of strdup() since
NextStep does not supply strdup().
Fixed detection of Ruby library name and location in configure.in.
Problem 1: Assumed that library always resided in Ruby's "archdir",
which was correct for Ruby 1.6.x, but which is incorrect for Ruby
1.8.x, in which case the library normally resides in Ruby's
"libdir". Problem 2: Assumed that the library could always be
linked via "-l"+RUBY_INSTALL_NAME (where RUBY_INSTALL_NAME
typically is "ruby"), however this failed for platforms, such as
NextStep, which do not support shared libraries. In this case, the
static library name in 1.8.x is libruby-static.a, thus
-lruby-static is required. The new logic works correctly for
static and shared libraries for 1.6.x and 1.8.x.
Fixed detection of Perl CFLAGS in configure.in for NextStep.
Detection code extracted CFLAGS from Perl's %Config hash but
neglected to add a newline to the value before passing it through
`sed'. NextStep's ancient `sed' discards input which is not
terminated with a newline, thus Perl CFLAGS always evaluated to the
empty string.
01/16/2004: cheetah (William Fulton)
Tidy up in the exception handling code that is generated when
C++ exception specifications are wrapped with the throws typemap.
This redundant code is no longer generated:
catch(...) {
throw;
}
01/12/2004: wsfulton on behalf of mmatus (marcelo matus)
if a method uses %exception and the method requires the use
of the throws typemap, the code in a throws typemap will be
generated inside the try body. For example:
%exception method {
try {
// method action
$action
} catch (int i) {
// method int catch handler
} catch (...) {
// method generic catch handler
}
}
%typemap(throws) Except %{
// throws typemap Except catch handler
%}
%inline %{
class Except {};
void method(int i) throw (Except);
Will generate:
{
try {
// method action
try {
method(arg1);
}
catch(Except &_e) {
// throws typemap Except catch handler
}
} catch (int i) {
// method int catch handler
} catch (...) {
// method generic catch handler
}
}
As can be seen, the inner try catch block is for the throws typemaps.
Previously, this was reversed so that the inner try catch block
was the %exception code. In the example above, it would have been
impossible to catch Except as the catch all (...) would catch the
exception instead.
Version 1.3.21 (January 11, 2004)
=================================
01/10/2004: cheetah (William Fulton)
The output format for both warnings and errors can be selected for
integration with your favourite IDE/editor. Editors and IDEs can usually
parse error messages and if in the appropriate format will easily take you
directly to the source of the error. The standard format is used by
default except on Windows where the Microsoft format is used by default.
These can be overridden using command line options, for example:
$ swig -python -Fstandard example.i
example.i:4: Syntax error in input.
$ swig -python -Fmicrosoft example.i
example.i(4): Syntax error in input.
01/09/2004: beazley
Fixed [ 871909 ] simple namespace problem.
This was a problem using anonymous structures in a namespace.
For example:
namespace ns {
typedef struct {
int n;
} S;
};
Reported by Josh Cherry.
01/09/2004: beazley
Fixed some broken Perl examples.
12/28/2003: cheetah (William Fulton)
[Java and C#] Fixes for wrapping covariant (polymorphic) return types.
For example:
struct Base {
virtual ~Base();
virtual Base* copy() const = 0;
};
struct Derived : Base {
virtual Derived* copy() const;
};
The Derived::copy proxy method returns Base not Derived. A warning is issued
about this. Previously the pointer used by the proxy class was incorrectly
treated as a Base* instead of a Derived*.
12/18/2003: cheetah (William Fulton)
Fix so that Windows paths are displayed correctly when reporting errors.
An error previously would have been shown something like:
.?xample.i:14: Syntax error in input.
instead of:
.\example.i:14: Syntax error in input.
Version 1.3.20 (December 17, 2003)
==================================
12/17/2003: beazley
Last minute modifications. Perl5 module now generates shadow classes
by default like all of the other modules. PHP4 wrappers no longer
include "config.h".
12/14/2003: beazley
Weakened warning message related to constructor names so that an
unusual nested-class wrapping technique would work again (apparently
it worked in some older SWIG releases). For example:
class Scope {
class ClassA;
class ClassB;
};
class Scope::ClassA {
...
};
class Scope::ClassB {
...
}
Note: There is still some odd interaction with the SWIG symbol
table/type system that will need to be looked at in a future release.
Reported by Gustavo Niemeyer.
12/11/2003: cheetah (William Fulton)
[Java] Protected class methods are wrapped as protected Java methods
when using the dirprot director feature. This can be changed using
%javamethodmodifiers to something else should the need arise, for
example, private or package access.
12/11/2003: cheetah (William Fulton)
[Java, C#]
%javamethodmodifiers (Java) and %csmethodmodifiers (C#) operate slightly
differently. Previously this feature had to be present to set the method
modifiers. Now it is only used if it exists for the method being wrapped.
The default is "public" as previous however, when wrapping protected
director methods it is "protected". This change will not affect existing
use of the %javamethodmodifiers or %csmethodmodifiers.
12/11/2003: mmatus (Marcelo Matus)
This fix some recurring reports about keywords not been
properly identified and warned, and it solves the problem
of how to add a test file to the test-suite such that it
doesn't use any keyword of all the supported languages
(and doing it without compiling the test for all the
supported languages, thing that is not always possible,
and without requiring you to know all the supported
language keywords, thing that is always impossible).
So these are the changes globally speaking:
- Uniform the definition of the keyword warnings through
the supported languages: all the languages has now a
separate file that defines the keywords or bad names:
python/pythonkw.swg
chicken/chickenkw.swg
....
- Added keyword list for most of the languages that didn't
have one (using the new separated file).
- Added the "All keywords" warning support: -Wallkw option.
This option allows you to include all the known keywords
for all the supported languages, and can be used as:
swig -Wallkw ....
This will help to the process of adding a test-suite
file that can be compiled in all the swig supported
languages, and it will be also helpful for users who
want to create multi-language libraries.
And these are the detailed changes (mostly file addition):
- For the languages that already have some sort of keyword
warning list, move it to an external languagekw.swg
file, ie:
move keywords from python.swg -> pythonkw.swg
move keywords from chicken.swg -> chickenkw.swg
move keywords from tcl8.swg -> tclkw.swg
and re-include languagekw.swg from language.swg.
- For the language that didn't have a keyword list, and
for the ones that I could find a list, add the
languagekw.swg file, ie:
csharp/csharpkw.swg
java/javakw.swg
php4/phpkw.swg
pike/pikekw.swg
ruby/rubykw.swg
also add a line in language.swg to include
languagekw.swg, but now it is commented!!!, like in
java.swg:
/* java keywords */
/* please test and activate */
//%include "javakw.swg"
ie, there will be no change in how swig runs normally
until the language maintainer test and uncomment that
line.
So, please check each languagekw.swg file (I left the
link to the keyword list source for checking), and after
testing, uncomment the %include line.
- Added the file allkw.swg, which includes all the
languagekw.swg files.
For the languages that has no languagekw.swg file right
now, and if they need one, add the file into the
language directory, and add the corresponding include
line into the allkw.swg file.
- Added the -Wallkw that includes the allkw.swg file.
Note that the old -lallkw.swg option couldn't be used
since it include the file after it would be needed.
Hopefully, the -Wallkw option will be added to the default
rules in the related test-suite Makefiles, so, when
creating a new test, or adding a new swig library file
(like _std_deque.i), swig will warn you if you are using a
bad name, considering all the language where it needs to
run.
Right now you can test it by using:
make check-python-test-suite SWIG="swig -Wallkw"
or using your favorite target language, it doesn't matter.
And yes, there are several examples that are using
reserved keywords, specially from csharp.
*** Remember ****: the new keyword warning lists are not
included by default in any of language that before didn't
have one. To enable the keyword warnings as the default
behavior, the inclusion of the languagekw.swg file has to
be uncommented at each language.swg file.
So, all the language maintainers, please check the
keywords list.
Also, you can add buit-in names, and not only keywords, like
'True/False' in python. Remember that you can be more
specific and refer only to member names, like *::configure
or *::cget (see an example in the tcl8/tcl8kw.swg file),
or only global names, like ::range (see an example in the
python/pythonkw.swg file.
Just to be consistent, use the following codes:
- Use code 314 for keyword and/or fatal bad names.
- Use code 321 for buit-in and/or not fatal bad names.
so, they can't be disabled/enabled independently (see
python/pyhtonkw.swg for examples).
**** And don't add any new test file without checking it
with the -Wallkw option!! (that includes me) *****.
12/11/2003: cheetah (William Fulton)
SF bug #854634
Added support for accepting the Unix directory separator '/' on
Windows and the Mac in addition to the native one ( '\' on
Windows). This can be used in %import, %include and commandline
options taking a path, for example -I. On Cygwin, both the Windows
and Unix directory separator can now be used (was '/' only).
12/10/2003: mmatus (Marcelo Matus)
[python] Implementing the runtime "reprotected" director
members, if you have:
%feature("director") B;
class Bar {
public:
virtual ~Bar();
virtual int hello() { return do_hello();)
protected:
virtual int do_hi() {return 0;}
virtual int do_hello() {return 0;}
};
then, at the python side
import my_module
class Foo(my_module.Bar):
def do_hello(self):
return 1
pass
b = Bar() # Pure C++ Director class
f = Foo() # C++ Director + python methods
b.hello() # Ok, and it calls C++ Bar::do_hello()
f.hello() # Ok, and it calls Python Foo::do_hello()
b.do_hi() # RuntimeError, do_hi() is protected!!
f.do_hi() # RuntimeError, do_hi() is protected!!
b.do_hello() # RuntimeError, do_hello() is protected!!
f.do_hello() # Ok, since it its redefined in python.
Here Bar.do_hello is always protected, but Foo.do_hello
is "public", because it is redefined in python. Before,
all the 'do_hello' methods were public.
This seems to be a good compromise between C++ and python
philosophies, ie, all the director protected methods keep
protected at the user side (C++ way) until they are
redefined (python way, were all defined methods are always
public). And this is not only a good compromise, it also
seems to be the only way to do it :).
Now ruby has native director protected members, and python
pure runtime support. I guess these are the two possible
extreme cases. And hopefully, they could be used as
templates to modify the other languages that support
directors, so they can "reprotect" the protected director
members at the target language side.
This finished the director protected support for the
python language. Ocalm will need to add the
"reprotection" later.
12/10/2003: mmatus (Marcelo Matus)
The following case (reported by Lyle Johnson) was fixed:
%rename(x) Foo::y();
class Foo {
public:
void y();
protected:
int x;
};
swig warned that the symbol 'x' was already defined, and
the renaming fails. 'x' was not emitted, since it is
protected, but it was kept in the symbol table with too
much information.
Now swig works for all the cases (plain, director and
dirprot) again. This was fixed by allowing the parser.y to
decide much closer what to do with 'x'. Before all the
discarding or generation was resolved at the lang.cxx
stage. Also the changes in parser.y to implement the
director protected mode are now much more encapsulated, and
they get disabled if the mode is not enabled. Before the
deactivation was done at the generation stage (lang.cxx).
By the other hand, if the director mode is enabled, and
%rename is done, reusing a protected member name, there is
a pathological case:
%rename(x) Foo::y();
class Foo : public A {
public:
void y();
protected:
int x; /* works */
static int x; /* works */
static void x(); /* works */
typedef void x(); /* works */
virtual void x(); /* always fails, as it should, since
Foo::x() will be emitted in the
director */
void x(); /* always fails, but sometimes it shouldn't,
since the Foo::x() will not be emitted if
it is not virtual */
};
The last case is not always right because at the parser.py
stage it is not possible to decide if the protected member
Foo::x() could or not conflict with the renamed Foo::y(),
since Foo::x() could be virtual by inheritance.
I guess this just an intrinsic limitation, and no much can
be done about it without resorting into larger changes to
postpone, under certain conditions, the multiply symbol
detection (lang.cxx stage).
So, by now, it is just considered a well known "feature" in
the director protected mode. The good news is that it seems
to be a rare case, and it can be avoided by the user by
hiding 'x' before renaming 'y':
%rename(_x) Foo::x();
%rename(x) Foo::y();
12/08/2003: mmatus (Marcelo Matus)
The virtual method detections now properly
treats the following cases:
namespace foo { typedef int Int; }
struct A {};
typedef A B;
struct Foo {
virtual ~Foo() {}
virtual Foo* cloner() = 0;
virtual int get_value() = 0;
virtual A* get_class() = 0;
virtual void just_do_it() = 0;
};
struct Bar : Foo
{
Bar* cloner();
foo::Int get_value();
B* get_class();
void just_do_it();
};
All the Foo and Bar methods are virtual. A new attribute
"virtual:type" record the base polymorphic type. In the
previous cases we have:
type : Bar virtual:type : Foo
type : foo::Int virtual:type : int
type : B virtual:type : A
type : void virtual:type : void
This attribute is useful in languages (java+directors)
that could have problems redefining Bar* Bar::cloner().
If you never had code like the above, you will see no
effects. But if you have some code like that, you
will see some effects since some methods that
before were not properly treated as virtual,
will start to act like that. This could enlarge
your director classes.
12/08/2003: mmatus (Marcelo Matus)
The director protected member support (dirprot)
is disabled by default.
It can be enable by using '-dirprot' or by adding
the option to the module declaration, like:
%module(directors="1",dirprot="1") my_module
This module option was added to properly compile the
director_protected.i and director_nested.i examples.
The feature has been tested with python[2.2,2.3]
and ruby[1.6.7], both at compilation and runtime, and
java[j2sdk1.4.1_01], but only at compilation (my java
installation doesn't run any of the director examples,
olds nor news).
Please test for ocaml and java.
The errors reported by William and Scott were fixed,
except for a warning about SWIG_JavaThrowExecption()
multiply defined. I can't reproduce this error with my
examples. We will wait for Scott to send us a minimal
case.
12/07/2003: mmatus (Marcelo Matus)
The director protected member support has been
completly moved out from python.cxx, and now
resides in the common lang.cxx, emit.cxx and
allocate.cxx files.
This means it should work for all the other languages
that currently support directors, ie, python, java, ocalm
and ruby.
The change has been tested with python (compilation+runtime)
and java (just compilation).
Please add runtime tests for the missing languages
and test it.
The '-nodirprot' option was moved to the principal main,
and can be used from all the languages.
12/07/2003: cheetah (William Fulton)
[Java] Fixed and improved error checking of STRING_OUT typemaps in
various.i.
12/04/2003: mmatus (Marcelo Matus)
- Now the virtual members with no explicit declarator
are properly identified:
struct A {
virtual int f() = 0;
};
struct B : A {
int f();
};
Here, B::f() is virtual, and the director and the
virtual elimination mechanism now recognize that.
- [C#] This fix also fixes the problem where 'override' was not being
used on any overridden virtual method, so for struct B above,
this C# code is generated:
public class B : A {
...
public override int f() {
...
}
...
}
- Initial support for protected virtual methods. They are now
properly emitted when using with director (python only by
now).
%feature("director") A;
struct A {
protected:
virtual int f1() = 0;
};
%feature("director") B;
struct B : A{
protected:
int f1();
virtual f2();
};
This can be dissabled by using the '-nodirprot' option.
- The feature 'nodirector' is working now at the top level,
so, it must work for all the languages:
%feature("director") A;
%feature("nodirector") A::f2;
struct A {
virtual int f1();
virtual int f2();
};
in this case, only 'f1' is exported to the director class.
- Added director support for const TYPE& arguments (python).
12/02/2003: cheetah (William Fulton)
[Java] Fix for INOUT and OUTPUT typemaps in typemaps.i for when the JNI type
is bigger than the C type. For example, unsigned long (32bits on most systems)
is mapped to jlong (64bits). Returned value was incorrect. Bug reported by
Brian Hawley.
12/02/2003: cheetah (William Fulton)
[C# and Java] Better fix for entry dated 05/11/2003. Fixes the following
typemaps:
Java: javabase, javainterfaces, javaimports, javaclassmodifiers,
javaptrconstructormodifiers, javafinalize, javagetcptr & javacode.
C#: csbase, csinterfaces, csimports, csclassmodifiers,
csptrconstructormodifiers, csfinalize, csgetcptr & cscode.
It also fixes bug in using arrays of C structs with arrays_java.i
as reported Scott Michel.
12/02/2003: beazley
[Perl] Fixed [ 852119 ] recursive inheritance in output .pm, perl5.
Reported by William Dowling.
12/02/2003: beazley
[Tcl] Fixed [ 755382 ] calling func(const vector<T>& p) evaluates p[0] in interp.
The Tcl type checker was improperly handling the interpreter result when
type violations were supposed to be ignored.
Reported by Flaviu Popp-Nowak.
11/30/2003: cheetah (William Fulton)
Fixed [ 545058 ] configure's --with-tclincl has no effect
11/30/2003: cheetah (William Fulton)
[Java] Fixed [ 766409 ] missing symbol SWIG_JavaThrowException during module load
SWIG's internal functions are all static as there is no need for different SWIG
generated modules to share any code at runtime.
11/30/2003: beazley
[Tcl] Added support for C++ pointers to members.
11/28/2003: cheetah (William Fulton)
Fixed [ 848335 ] Directors: #include wrapper .h file - was incorrectly
adding a directory to the generated #include "foo_wrap.h" statement
in some situations.
11/28/2003: cheetah (William Fulton)
[Java] Fixed [ 849064 ] JAVA : Access modifier for derived class wrong.
The delete() method is always public now. It used to be protected whenever a
destructor was non public. An UnsupportedOperationException runtime
exception is thrown instead of making delete() protected now.
11/28/2003: beazley
[Perl5] Added support for C++ pointers to members.
11/28/2003: beazley
Fixed [ 850151 ] PYVERSION with python2.3 in configure of SWIG 1.3.19 (Maybe).
11/28/2003: beazley
Fixed [ 850666 ] #include extra line added.
This should fix some problems with getting correct line numbers on
error messages.
11/26/2003: beazley
Fixed another one of Marcelo's evil template bugs (infinite
recursion). [ 849504 ] template and typedef -> inf. recursion.
11/26/2003: beazley
Fixed parsing problem with declarations like this:
int *x = &somearray[0];
11/25/2003: beazley
Fixed [ 756552 ] missing default argument class scope with "|".
This is really only a band-aid fix for use of class-enums in
expressions. For example:
class A {
public:
enum Flag { flag1 = 0x1, flag2 = 0x2 };
void foo(int x = flag1 | flag2);
};
Note: there are still some (more subtle) cases that are broken,
but hard to fix due to an issue with template expansion. Will
address later.
Reported by Dmitry Mironov.
11/25/2003: beazley
Incorporated [ 840878 ] support for %inline { ... } (PATCH).
This adds support for the following:
%inline {
... some code ...
}
The difference between this and %inline %{ ... %} is that the
enclosed text is processed by the SWIG preprocessor. This
allows special macros and other processing to be used in
conjunction with %inline.
Contributed by Salvador Fandino Garcia.
11/25/2003: beazley
Fixed [ 836903 ] C++ inconsistency (with void arguments).
SWIG was having difficulty with f() vs f(void) in C++ programs.
For instance:
class A {
public:
virtual void f(void) = 0;
};
class B {
public:
virtual void f(); // Not matched to f(void) correctly
};
The parser now normalizes all declarations of the form f(void)
in C++ classes to f(). This should fix a variety of subtle
problems with inheritance, optimizations, overloading, etc.
Problem reported by Partho Bhowmick.
11/25/2003: beazley
[Perl5] Incorporated [ 841074 ] better croaking (PATCH). This fixes some problems
with strings and provides some new error functions.
Contributed by Salvador Fandino Garcia.
11/25/2003: beazley
Fixed [ 791835 ] Default argument with cast: txt = (char *)"txt" syntax Error.
The parser should now accept things like this:
void foo(char *s = (char *) "Hello");
Problem reported by Claudius Schnorr.
11/24/2003: beazley
[Tcl] Fixed problem with cross module linking. Previously modules referred
to base classes through a global variable. Now, the module looks up base
classes through the type system itself---avoiding the need to link to a global
like before. Caveat: modules with base classes must be loaded before
modules with derived classes.
11/24/2003: mkoeppe (Matthias Koeppe)
[Guile] In -scm mode, use () to represent null pointers,
as it is done in -gh mode.
11/23/2003: mkoeppe (Matthias Koeppe)
Add a generated script "preinst-swig", which can be used
to invoke SWIG before it has been installed. It arranges
that the runtime libraries from the source directory are
used.
11/23/2003: mkoeppe (Matthias Koeppe)
[Guile] In -gh mode, don't forget to call SWIG_Guile_Init.
Add a SWIG_contract_assert macro.
11/23/2003: mkoeppe (Matthias Koeppe)
[MzScheme] Update the configure check for the dynext object to work
with MzScheme 205.
11/20/2003: mmatus
Fixed the include/import error reported by Kerim Borchaev,
where two files with names like
'dir1/hello.i'
'dir2/hello.i'
can not be include at the same time. Swig was including
just the first one, assuming the second one was not a
different one, since it was checking/keeping just the
basename 'hello.i'.
11/19/2003: beazley
Changes to the SWIG runtime library support.
- The -c command line option has been renamed to -noruntime
- New command line option: -runtime. When supplied, this
inserts the symbol SWIG_GLOBAL into the wrapper code. This,
in turn, makes all of the runtime support functions globally
visible.
- New library file: swigrun.i. Used to create modules
for runtime library (if needed).
11/18/2003: cheetah (William Fulton)
'make srcrpm' rpmbuild fix - patch from Joe Cooper
11/18/2003: mkoeppe (Matthias Koeppe)
[Guile] Change meaning of configure option --with-guile to
the name of the Guile executable. The new option --with-guile-prefix
can be used to specify the tree where Guile is
installed. (However, usually it suffices to use the
single option --with-guile-config.)
When running the run tests test-suite, make sure to use the
version of Guile that SWIG was configured for.
11/17/2003: mkoeppe (Matthias Koeppe)
[Guile] Improvements to object-ownership management in
"-scm" mode. (They do not apply to the default "-gh" mode.)
* Renamed the smob type that indicates that the object can
be garbage collected from "collected swig" to "collectable
swig", which is more precise.
* Export the destructor functions again. It is now
allowed to explicitly call destructors, even for
garbage-collected pointer objects. A pointer object
that has been passed to a destructor is marked in a
special way using a new smob type, "destroyed swig".
(This helps avoid nasty memory bugs, where references to
dead C objects are still held in Scheme. Moreover, the
garbage collector will not try to free a destroyed
object once more.)
* Destructor-like functions can also mark their arguments
as destroyed by applying the typemap SWIGTYPE *DESTROYED.
(It calls the function SWIG_Guile_MarkPointerDestroyed.)
* Functions that "consume" their objects (or that "own"
them after the call) can mark their arguments as
not garbage collectable. This can be done by applying
the typemap SWIGTYPE *CONSUMED. (It calls the function
SWIG_Guile_MarkPointerNoncollectable.)
* The macro TYPEMAP_POINTER_INPUT_OUTPUT from library
pointer-in-out.i creates additional typemaps
PTRTYPE *INPUT_CONSUMED, PTRTYPE *INPUT_DESTROYED.
They mark the passed pointer object likewise.
The typemap PTRTYPE *OUTPUT creates a garbage-collectable
pointer object, like %newobject does for a returned
pointer. Use the new typemap PTRTYPE *OUTPUT_NONCOLLECTABLE
to create a pointer object that will not be garbage collected.
11/17/2003: mkoeppe (Matthias Koeppe)
[Guile] Handle $input in "freearg" typemaps.
Never qualify GOOPS slot names with the class name.
Handle optional arguments properly in the GOOPS methods.
11/16/2003: cheetah (William Fulton)
Fixes for installation to work with the upcoming Automake-1.8.
mkinstalldirs was being used by a non-Automake makefile.
mkinstalldirs is being phased out and so was not being
created by Automake. install-sh used instead.
11/16/2003: cheetah (William Fulton)
[Java] Numerous director improvements, tweaks and bug fixes since
the initial implementation have been contributed by Scott Michel.
11/12/2003: beazley
[Python] When %feature("shadow") is used to add code to shadow
classes, the special variable $action expands to the name of the
underlying wrapper function that would have been called normally.
11/12/2003: beazley
[Python] When generating proxy class code, SWIG emits a few
default methods for __repr__() and other Python special
methods. Some of these methods are emitted after all of the
contents of a class. However, this makes it hard to override
the methods using %pythoncode and some other directives that
allow code to be inserted into a class. These special methods
are now emitted into the code *before* all of the other methods.
Suggested by Eric Jones.
11/11/2003: beazley
Preprocessor enhancement. For include statements like this:
%include "foo/bar.i"
the directory "foo" is now added to the search path while
processing the contents of bar.i. Thus, if bar.i includes other
files in the same directory, they will be found. Previously,
you would have to add additional directories using -I to make this
work correctly. Note: the C preprocessor seems to behave in
an identical manner on many (most? all?) systems.
Suggested by Kerim Borchaev.
11/11/2003: beazley
Configuration changes to make SWIG work on Mac OS X 10.3.x (Panther).
Tested with Python, Tcl, Perl, and Ruby---all of which seem to work.
11/08/2003: cheetah (William Fulton)
[Java] Fixed the typemaps in various.i which were mostly broken.
char **STRING_IN and char **STRING_RET typemaps replaced with
STRING_ARRAY. float *FLOAT_ARRAY_RETURN typemap removed.
11/08/2003: beazley
[Tcl] Tcl module now emits a safe module initialization function by
default. It can be removed by running 'swig -nosafe'.
11/04/2003: mkoeppe (Matthias Koeppe)
[Guile] Only use the SCM_ API when the function
`scm_slot_exists_p' exists (needed for GOOPS support).
This function was renamed during the Guile 1.5 series
from `scm_slots_exists_p'.
Report the right runtime library when invoked with
-scm -ldflags.
11/03/2003: mkoeppe (Matthias Koeppe)
[Chicken] Fix #782052. The --with-chickencfg configure
option (and others) were not accepted.
11/02/2003: mkoeppe (Matthias Koeppe)
[Guile] Merge new set of GOOPS changes by John Lenz.
GOOPS objects are now manipulated directly by the C code.
Some fixes to typemap-GOOPS interaction.
11/02/2003: mkoeppe (Matthias Koeppe)
[Guile] Remove the file argument to -scmstub and -goops.
The Scheme files are now always called MODULE.scm or
MODULE-primitive.scm, where MODULE is the module name and
"primitive" can be changed by the -primsuffix option.
The Scheme files are now placed in the directory given by
the -outdir option, or the current directory.
(Patch by John Lenz, slightly modified.)
*** INCOMPATIBILITY [Guile] ***
11/02/2003: mkoeppe (Matthias Koeppe)
Unify the pointer-conversion runtime API. The standard
functions are:
* SWIG_NewPointerObj (POINTER, TYPE, FLAGS)
-- Create an scripting object that represents a typed
pointer. FLAGS are language specific.
* SWIG_ConvertPtr (INPUT, RESULT, TYPE, FLAGS)
-- Get a pointer from the scripting object INPUT and
store it in the place RESULT. When a type mismatch
occurs, return nonzero.
* SWIG_MustGetPtr (INPUT, TYPE, ARGNUM, FLAGS)
-- Get a pointer from the scripting object INPUT and
return it. When a type mismatch occurs, throw an
exception. If ARGNUM > 0, report it as the
argument number that has the type mismatch.
[Guile]: No changes.
[MzScheme]: No changes.
[Perl]: Add the function SWIG_NewPointerObj.
The function SWIG_MakePtr is kept.
The function SWIG_MustGetPtr is currently not
supported.
[Python]: Add the function SWIG_MustGetPtr.
[Ruby]: Add the function SWIG_MustGetPtr.
[Tcl]: Remove the "interp" argument of
SWIG_NewInstanceObj, SWIG_ConvertPtr,
SWIG_ConvertPacked, and SWIG_ConvertPtrFromString.
The function SWIG_MustGetPtr is currently
not supported.
No changes to Pike because its pointer conversion code did
not look complete. No changes to PHP4, because I did not
understand its runtime code. No changes to Chicken
because major changes are expected soon anyway. No
changes to Java, OCaml, C# because they do not seem to
have a pointer-conversion runtime API.
*** INCOMPATIBILITY [Tcl] ***
11/02/2003: mkoeppe (Matthias Koeppe)
[Perl5, PHP4, Pike, Python, Ruby, Tcl]: Use the
preprocessor to rename external functions of the SWIG
runtime API to follow the naming convention
SWIG_<language>_<function>. This should allow linking
more than one interpreter into a program.
10/31/2003: cheetah (William Fulton)
[C#] Fix since introducing the exception and std::string delegates.
The fix overcomes linker errors when using more than one SWIG module.
Problem reported by Andreas Sch�rk.
10/31/2003: beazley
Incorporated patch: [ 823302 ] Incr Tcl support.
Contributed by Alexey Dyachenko.
Note: needs documentation.
10/31/2003: beazley
Incorporated patch: [ 829325 ] new Python Module options and features.
Robin Dunn writes:
This patch makes a number of changes to the SWIG python module.
1. Add -apply option, and change the default code
output to use the foo(*args, **kw) calling syntax
instead of using apply(). If the -apply option is
given then code is generated as before. This is very
similar to Patch #737281 but the new -modern option
makes the second half of that patch unnecessary so it
is not included here.
2. Add -new_repr option. This is the same as my Patch
#797002 which I will mark as closed since it is no
longer needed. When this new option is used then the
__repr__ methods that are generated for proxy classes
will be more informative and give details about the
python class and the C++ class.
3. Add %feature("addtofunc"). It allows you to insert
one or more lines of code inside the shadow method or
function that is already generated, instead of
replacing the whole thing like %feature("shadow") does.
For __init__ it goes at the end, for __del__ it goes
at the begining and for all others the code generated
is expanded out to be like
def Bar(*args, **kwargs):
val = _module.Foo_Bar(*args, **kwargs)
return val
and the "addtofunc" code is inserted just before the
return statement. If the feature is not used for a
particular method or function then the shorter code is
generated just like before.
4. A little bit of refactoring to make implementing
addtofunc a little easier.
5. Added a -modern command-line flag that will cause
SWIG to omit the cruft in the proxy modules that allows
it to work with versions of Python prior to 2.2. The
result is a simpler, cleaner and faster python proxy
module, but one that requires Python 2.2 or greater.
10/31/2003: beazley
Incorporated patch: [ 829319 ] XML module tweaks.
This adds a new command line option -xmllite that
greatly reduces the amount of emitted XML code by
eliminating some fields mostly used in SWIG's
internal processing. Contributed by Robin Dunn.
10/31/2003: beazley
Incorporated patch: [ 829317 ] Adds DohSplitLines function.
Contributed by Robin Dunn.
10/29/2003: beazley
Fixed [ 827907 ] argout objects not being wrapped properly (PATH).
Patch contributed by Salvador Fandi�o Garc�a.
10/29/2003: beazley
Fixed [ 826996 ] perl type checking ignores perl subclasses.
This enhancement makes it so wrapped classes and structs can
be subclassed in Perl and used normally.
Patch contributed by Salvador Fandi�o Garc�a.
10/16/2003: cheetah (William Fulton)
[C#] IntPtr marshalled with a void* instead of int in C function
declarations. The casts thus look more conventional, for example:
// old
DllExport double SWIGSTDCALL CSharp_get_Shape_x(int jarg1) {
...
Shape *arg1 = (Shape *) 0 ;
arg1 = *(Shape **)&jarg1;
...
}
// new
DllExport double SWIGSTDCALL CSharp_get_Shape_x(void * jarg1) {
...
Shape *arg1 = (Shape *) 0 ;
arg1 = (Shape *)jarg1;
...
}
10/14/2003: beazley
Fixed a subtle problem with overloaded methods and smart pointers.
If a class has overloaded methods like this:
class Foo {
public:
int bar(int x);
static int bar(int x, int y);
};
and the class is used as a smart pointer:
class FooPtr {
public:
Foo *operator->();
};
The SWIG would try to expose the static member Foo::bar
through FooPtr---resulting bogus wrapper code and a compiler
error.
Due to the way in which overloading is handled, it is
extremely difficult to eliminate the static method in
this case. Therefore, it is still exposed. However,
the generated code now compiles and works.
10/05/2003: mkoeppe (Matthias Koeppe)
[Guile, MzScheme, Chicken]: Remove symbol clashes between
the runtime libraries by renaming all extern common.swg
functions with the preprocessor.
10/05/2003: mkoeppe (Matthias Koeppe)
[Guile] Added basic GOOPS support, contributed by John Lenz.
See the documentation for details.
*** NEW FEATURE ***
10/04/2003: mkoeppe (Matthias Koeppe)
[Guile] New option, -only-setters, which disables
traditional getter and setter procedures for structure slots.
10/03/2003: mkoeppe (Matthias Koeppe)
[Guile] Added run test for reference_global_vars by John Lenz.
09/30/2003: beazley
Partial solution to [ 792180 ] C++ smart-pointer/namespace mixup revisited.
The problem is not easy to fix (at least it doesn't seem so), but is
related to the instantiation of qualified templates inside of other
namespaces. SWIG now generates an error message in this case rather
than generating broken wrappers.
09/30/2003: beazley
Fixed [ 800012 ] ENTER macro from CORE/scope.h clashes with libc search.h.
Reported by Britton Leo Kerin.
09/30/2003: beazley
Fixed [ 811518 ] Casting ints to doubles (w/ solution?)
Addresses a problem with overloading in the Perl module.
Reported by Gerald Dalley.
09/28/2003: mkoeppe
[Guile with -scm option] Fix typo in generated code for
procedures-with-setters. Reported by John Lenz.
09/26/2003: beazley
Fixed [ 812528 ] externs not correct when throw is in signature.
Reported by Joseph Winston.
09/23/2003: cheetah (William Fulton)
SWIG was generating a number of symbols that didn't comply with
the ISO C/C++ standard, in particular ISO/IEC 14882:1998(E) 17.4.3.1.2
where double underscores are forbidden as well as symbols starting with
an underscore followed by an upper case letter. Most of these have
been rooted out. See new section added to internals.html development
manual 'Symbol Naming Guidelines for Generated C/C++ Code'.
09/23/2003: cheetah (William Fulton)
Director typemap name changes:
inv => directorin
outv => directorout
argoutv => directorargout
*** POTENTIAL INCOMPATIBILITY ***
09/19/2003: mrose (Mark Rose)
[Python] Director constructors now default to __disown = 0,
which is the intended behavior and fixes the director_finalizer
test case under python.
09/12/2003: cheetah (William Fulton)
[C#] - Typemaps added for std::string and const std::string &.
- New delegate for creating a C# string given a char *. It
can be used by calling SWIG_csharp_string_callback as shown
in the std::string 'out' typemap. Useful if the return type is
mapped to a C# string and the calling function is responsible
for cleaning up memory as the C# garbage collector doesn't
free the memory created in C/C++ and then returned as a C# string.
- The exception delegates have moved into an inner class in the
intermediate class, thereby freeing up the static constructor.
09/11/2003: beazley
(Internals)
Major refactoring of iteration over lists and hashes. The
DOH library now uses iterators. They work like this:
List *l = (some list);
Iterator i;
for (i = First(l); i.item; i = Next(i)) {
// i.item contains the actual list item.
// i.item is NULL at end of list
...
}
Hash *h = (some hash);
Iterator j;
for (j = First(h); j.item; j = Next(j)) {
// j.item contains hash table item
// j.key contains hash table key
// Both j.item and j.key are NULL at end
...
}
The old iteration functions Firstitem(), Nextitem(), Firstkey(),
and Nextkey() are gone.
The new iterators are simpler, result in better memory use,
and may be faster. Also, there are no longer any problems
iterating over the same list/hash in multiple places at
the same time. For example, this is fine:
Iterator i,j;
for (i = First(l); i.item; i = Next(i)) {
for (j = First(l); j.item; j = Next(j)) {
...
}
}
(This never worked in previous versions).
*** POTENTIAL INCOMPATIBILITY ***. This will probably break
third party extensions to SWIG (or give them further encouragement
to join the SWIG CVS-tree :-).
09/10/2003: mkoeppe (Matthias Koeppe)
[Guile] Fix memory leaks in the "list-vector.i" typemaps.
09/09/2003: mkoeppe (Matthias Koeppe)
[Chicken] Use C_mk_bool rather than C_mkbool. This fixes
the wrapping of boolean values for Chicken 1.10 and newer.
Reported by Dave <hundo@yahoo.com> / Felix Winkelmann
<felix@proxima-mt.de>.
09/05/2003: cheetah (William Fulton)
[Java] Directors implemented for Java. In summary this is a big new feature
which supports upcalls from C++ to Java. Code is generated to support C++
callbacks to call into Java and true polymorphic behaviour for Java classes
derived from C++ classes. See java.html for details. Contributed by
Scott Michel.
09/05/2003: Tiger
Created contract example directory at /SWIG/Examples/contract
Added simple contract examples (simple_c & simple_cxx)
Modified contract module's output format
*** NEW FEATURE ***
09/01/2003: cheetah (William Fulton)
Test-suite build improvements:
- Multiple build directories working for the test suite, so it is now
possible to run configure in multiple subdirectories and run the test
suite in each of these sub directories.
- 'make distclean' fixed so it doesn't bomb out on the Examples directory
when using multiple subdiretory builds. Required the following directories
to be moved:
Examples/GIFPlot/Perl -> Examples/GIFPlot/Perl5
Examples/GIFPlot/Php -> Examples/GIFPlot/Php4
These new directories used to be symbolic links to the old directory.
Also the Examples/test-suite/Perl symbolic link has been removed.
- Running the test-suite, other than from the root directory, say
in Examples/test-suite/python will now display all the code being
executed.
- The following 3 C# compilers are detected during configure and work with
the test-suite: Mono, Portable.NET and Microsoft.
09/01/2003: Tiger
Added inheritance support for design by contract feature.
09/01/2003: beazley
Fixed [ 794914 ] Wrong types in template specialization.
SWIG was not handling arguments correctly in template
partial specialization. For example,
template<class T> class Foo<T *> {
public:
T *blah();
};
%template(FooInt) Foo<int *>;
in this class, the return type of blah was set to
'int **', but it should really be 'int *'. This has been
fixed, but it will affect all prior uses of partial
specialization.
09/01/2003: beazley
Fixed [ 786394 ] Patch for generated perl code does not compile under RedHat9.
Reported by Scott Finneran.
09/01/2003: beazley
Fixed [ 791579 ] (unsigned) long long handled incorrectly (Tcl).
This was an error in the Tcl typemaps.i file.
Reported by Kjell Wooding.
09/01/2003: beazley
Fixed [ 797573 ] no way to rename classes coming from C structures.
This problem relates to renaming of anonymous structures with a
typedef. For example:
%rename(Bar) Foo;
typedef struct {
...
} Foo;
Reported by Britton Leo Kerin.
09/01/2003: beazley
Fixed [ 797576 ] -help seems to imply that only tcl-specific options exist.
Added a comment to alert user to other options.
Reported by Britton Leo Kerin.
09/01/2003: beazley
Fixed [ 798205 ] Segfault in SWIG_ConvertPtr.
Reported by Prabhu Ramachandran.
08/30/2003: mrose (Mark Rose)
Modified the director typemaps in python/std_complex.i to use the
new-style macro and conversion functions, which eliminated some
redundant code. Fixed a few bugs in these typemaps as well, although
more testing is needed.
08/29/2003: mrose (Mark Rose)
Completed initial support for wrapping abstract classes with directors.
Constructor wrappers will be generated for abstract classes that have
directors, and instances of the director classes will be created regardless
of whether the proxy class has been subclassed in the target language.
No checks are made during construction to ensure that all pure virtual
methods are implemented in the target language. Instead, calls to
unimplemented methods will throw SWIG_DIRECTOR_PURE_VIRTUAL_EXCEPTION
exceptions in C++.
Integrated Prabhu Ramachandran's typemap patches, which provide director
typemap support for enums and std::size_t, and fix a couple bugs in the
director std::vector<> typemaps.
08/29/2003: cheetah (William Fulton)
[C#] Implemented exception handling for throwing C# exceptions from C/C++ code.
A few delegate functions are available for calling which then throw the C#
exception. Use the SWIG_CSharpThrowException function from C/C++ typemaps.
See the generated wrapper code or csharphead.swg for all available exceptions.
Example:
SWIG_CSharpThrowException(SWIG_CSharpException, "exception description");
The 'throws' typemaps are also now implemented, so code is automatically
generated to convert any C++ exception into a C# System.Exception when the C++
method declares an exception specification such as:
int foo() throw(Bar);
Also any parameters that are references to a C++ class or a class passed by value
and are passed as a C# null will now throw a C# NullReferenceException.
08/29/2003: cheetah (William Fulton)
[C#] Fix to match the calling convention of all pinvoke methods so that they
match the calling convention used by default in the C# 'static extern' declarations
(__stdcall is used on Windows).
08/19/2003: cheetah (William Fulton)
[Java] Reworked std::string typemaps. Fixes a number of string in std namespace
problems. For example %template vector<string>. The templated class' get method
wasn't returning a Java String, but a SWIGTYPE_p_string. Reported
by Zach Baum.
08/15/2003: beazley
Fixed [ 763522 ] 1.3.19 segfault in SwigType_add_pointer/DohInsertitem.
Related to problem with unnamed class handling in Perl module.
08/15/2003: beazley
Fixed [ 763563 ] Missing indication of optional arguments.
Tcl module. Reported by Krzysztof Kozminski.
08/15/2003: beazley
Fixed [ 787432 ] long param handled as int. Tcl module
now uses Tcl_GetLongFromObj to convert integer values.
08/11/2003: beazley
Fixed [ 775989 ] numeric template parameters. There were
some errors in template expansion related to the use of
arrays where the array dimension was a template parameter.
It should work now. Reported by Bryan Green.
08/10/2003: mrose (Mark Rose)
Added a director typemap (outv) for return by value and cleaned up up a few
of the commented director typemaps.
08/10/2003: mrose (Mark Rose)
Fixed constructor generation for director classes to ignore private
constructors. Protected constructors are also ignored for now, pending
a solution to the problem of wrapping classes that only define protected
constructors.
08/07/2003: cheetah (William Fulton)
New commandline option -outdir <dir> to specify where the language specific
files are to be generated. This is useful for target languages like Python,
Java etc which generate proxy files in the appropriate language.
This option does not apply to the C/C++ wrapper file.
08/07/2003: cheetah (William Fulton)
On Windows the generated files (other than the _wrap.c or _wrap.cxx files)
were sometimes incorrectly being generated into the current directory unless
the input file used the Unix path separator. The Windows path separator
should now be used. Bug reported by Robert Davies.
08/07/2003: beazley
Added array variable set typemap to Perl module.
08/07/2003: beazley
Fixed [ 775677 ] Array init causes codegen bug..
08/07/2003: beazley
Fixed [ 779062 ] Class"\n"::foo not supported. SWIG
should now correctly handle whitespace in between
namespace qualifiers. For example "A :: Foo :: Bar".
07/31/2003: cheetah (William Fulton)
Fixes for parameters which are classes that are passed by value and have
a default value. A copy constructor for SwigValueWrapper is required
(SF #780056). Also fixed memory leak in these circumstances. These mods
also fix SF #780054.
07/28/2003: beazley
Improved run-time error message for pointers in Python module.
Contributed by Zooko.
07/10/2003: ballabio (Luigi Ballabio)
[Almost all languages] Wrappers for std::pair added.
Typemaps for Python, Ruby, Guile and MzScheme.
07/01/2003: mkoeppe (Matthias Koeppe)
[Chicken] Handle the case of more than one argout typemap
per function.
06/29/2003: cheetah (William Fulton)
[Java, C#] SF #670949 request. The destructor wrapper function name is now
configurable. A new attribute called methodname in the
javadestruct/javadestruct_derived (Java) or csdestruct/csdestruct_derived (C#)
typemaps specifies the method name. For example in Java the destructor is
wrapped by default with the delete method:
%typemap(javadestruct, methodname="delete") SWIGTYPE {...}
06/27/2003: cheetah (William Fulton)
[Java, C#] The throws attribute for adding exception classes to the throws
clause also now works with the following typemaps:
newfree
javain, javaout (Java)
csin, csout (C#)
For example, the 'AnException' will be added to the throws clause in the
proxy function:
%typemap(javaout, throws="AnException") int {
int returnValue=$jnicall;
if (returnValue==0) throw new AnException("Value must not be zero");
return returnValue;
}
06/25/2003: mrose (Mark Rose)
[Python] Director typemap marshalling checks for null pointers when
walking the parameter list instead of relying soley on the parameter
count. Cures a segfault that occurred for multiple argument inv typemaps.
Someone with more Swig experience should probably review this code.
06/24/2003: mkoeppe (Matthias Koeppe)
[Chicken] Don't emit calls to "C_check_for_interrupt",
which may result in an endless loop. Patch by felix@proxima-mt.de.
06/20/2003: cheetah (William Fulton)
[C#] Finalizers now use destructor syntax as the override which was used in
the Finalize method is not in the ECMA standards, spotted by the MS compiler.
06/10/2003: cheetah (William Fulton)
[C#] A number of changes have been made to remove the Java naming
that was used in the C# module.
Typemap name changes:
jni -> ctype
jtype -> imtype
jstype -> cstype
javain -> csin
javaout -> csout
javainterfaces -> csinterfaces
javabase -> csbase
javaclassmodifiers -> csclassmodifiers
javacode -> cscode
javaimports -> csimports
javaptrconstructormodifiers -> csptrconstructormodifiers
javagetcptr -> csgetcptr
javafinalize -> csfinalize
Feature name changes:
javaconst -> csconst
javamethodmodifiers -> csmethodmodifiers
Pragma changes:
pragma(java) -> pragma(csharp)
jniclassbase -> imclassbase
jniclassclassmodifiers -> imclassclassmodifiers
jniclasscode -> imclasscode
jniclassimports -> imclassimports
jniclassinterfaces -> imclassinterfaces
Special variable name changes:
$javaclassname -> $csclassname
$javainput -> $csinput
$jnicall -> $imcall
This will break SWIG interface files that use these typemaps, features
and pragmas. Please update your code or use macros for backwards
compatibility.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
06/10/2003: mkoeppe (Matthias Koeppe)
[MzScheme] Applied MzScheme module updates contributed by
John Lenz <jelenz@students.wisc.edu>.
- Updated mzscheme to use SWIG's common runtime type
system from common.swg.
- The Lib/mzscheme directory has been reorganized to
standardize names across the language modules:
mzscheme.i was moved to mzscheme.swg, mzscheme.swg and
mzschemedec.swg have been removed, mzrun.swg (which
contains the runtime code) has been added.
- The swig_proxy structure was renamed to swig_mz_proxy.
swig_mz_proxy now contains a pointer to a swig_type_info
structure.
- Added varin and varout typemaps for SWIGTYPE [] and
SWIGTYPE &.
- Garbage collection by calling scheme_add_finalizer() has
been added.
*** NEW FEATURE [MzScheme] ***
06/10/2003: cheetah (William Fulton)
[Java] New typemaps: javadestruct and javadestruct_derived
for the C++ destructor wrapper. The javadestruct version gets used by
classes at the top of an inheritance chain and the javadestruct_derived
version gets used by other classes.
[C#] cildispose and cildisposeoverride typemaps replaced by
csdestruct and csdestruct_derived typemaps. The delete()
method has been removed and its functionality put into these
typemaps designed for the Dispose() method.
- New typemaps csinterfaces and csinterfaces_derived replace
the javainterfaces typemap. Also fixes the peculiarity of all classes
in an inheritance chain individually deriving from the IDisposable
interface.
- New typemap csfinalize for finalizers. C++ destructors are now called
by garbage collector during finalization. Problem reported by
Andreas Sch�rk.
06/10/2003: Tiger
Modified contract code for error message output.
Contract code can now print out simple error message.
Modified contract code to prepare for inheritance
06/03/2003: mkoeppe
[Guile] Applied Guile module updates contributed by
John Lenz <jelenz@students.wisc.edu>.
- SWIG currently uses Guile's gh_ API, which is marked as
deprecated in Guile 1.6 and will be removed in Guile
1.9. This change introduces a command-line flag "-scm"
which causes SWIG to generate wrappers that use Guile's
SCM API instead; this requires Guile >= 1.6.
- The Lib/guile directory has been reorganized to
standardize names across language modules: guiledec.swg
and guile.swg have been moved into guile_gh_run.swg,
guile.i has been moved to guile_gh.swg, guile_scm.swg
and guile_scm_run.swg which contain the SCM API stuff
have been added
- ghinterface.i, which contains the defines from the gh_
functions to the scm_functions has been added
- The API for dealing with pointer objects is now
SWIG_ConvertPtr, SWIG_MustGetPtr, SWIG_NewPointerObj.
- Added varin and varout typemaps for SWIGTYPE [] and SWIGTYPE &
- Garbage collection has been added.
*** NEW FEATURE [Guile] ***
06/01/2003: cheetah (William Fulton)
Dimensionless arrays such as
int foo[] = {1, 2};
extern int bar[];
produce a warning that the variable is read-only. Depending on the target
language, this used to cause compile errors or generate a setter that
generated a runtime error. A setter cannot be automatically generated
because the array size cannot be determined by SWIG. A varin, globalin
or memberin typemap (depending on the target language) must be written
by the user.
05/29/2003: beazley
Refinement to default typemap matching and arrays. When an
array is declared like this:
int foo[4];
The default typemap now resolves to
SWIGTYPE [ANY]
If no match is found for that, it then resolves to
SWIGTYPE []
If no array dimension is specified in the original declaration,
the SWIGTYPE [] is used right away.
Note: This change has been made to resolve problems related to
arrays with and without dimensions. For example, sometimes SWIG
was generating setter functions for array variables with no dimensions
(an error). Likewise, SWIG sometimes made arrays with dimensions
read-only (also an error). This fixes the arrays_global test
problem.
05/28/2003: beazley
Fixed subtle type handling bug with references and pointers.
If you had functions like this:
typedef Foo Bar;
Foo *func1();
void func2(Bar &x);
Then func2() wouldn't accept objects returned by func1()
because of a type error. It should work now.
Reported by Brian Yang.
05/21/2003: cheetah (William Fulton)
Fixes to some of the Visual C++ example project files which would not
work with spaces in the paths held in the environment variables used to
point to the target language's library / include directory.
SF bug #740769
05/21/2003: songyanf (Tiger)
Added -contracts option.
First try of the idea of "Wrap by Contract":
build up realiable cross-language module by wrapping with SWIG.
Implemented basic assertion
(preassertion & postassertion & invariant)
for simple C/C++ functions.
Current format of contracts are:
%contract class_name :: func_name (paras...) {
require:
boolean exprs;
exprs;
ensure:
boolean expr;
exprs;
invariant:
boolean expr;
exprs;
}
*** NEW FEATURE ***
05/19/2003: cheetah (William Fulton)
Build tweaks. There were a few preprocessor definitions which were
specified in the Makefile for passing on the commandline when compiling.
These are now all defined in swigconfig.h. Autoconf doesn't normally
allow installation directories to be defined in this config header file,
but an autoconf archive macro enables this. This macro along with future
autoconf macros are going to be put in the Tools/config directory.
'swig -version' now reports the target build platform.
05/11/2003: cheetah (William Fulton)
[C# and Java] Fix to the following typemaps:
javabase, javainterfaces, javaimports, javaclassmodifiers,
javaptrconstructormodifiers, javafinalize, javagetcptr & javacode.
These are the typemaps for modifying/generating proxy classes.
Previously the typemaps would use the proxy class name and not the
C++ type, which was inconsistent with all other typemaps.
In most circumstances the proxy class name and the C++ class name/type
is the same except for classes in namespace, templated classes etc. so
this shouldn't affect most cases.
*** POTENTIAL INCOMPATIBILITY FOR JAVA and C# MODULES ***
05/09/2003: cheetah (William Fulton)
Visual C++ Project files have been added so that the runtime libraries
can be built on Windows (for Tcl, Perl, Python and Ruby).
05/01/2003: beazley
Fixed problem with return by value, const, and private constructors.
For example:
class B {
private:
B();
public:
B(const B&);
};
class A {
...
const B returnB() const;
...
};
Problem and patch suggestion reported by Bill Hoffman.
04/29/2003: cheetah (William Fulton)
Build changes:
- Single autoconf invocation - autoconf in the Tools directory has gone.
- Libtool bootstrapped when running autogen.sh. This requires anyone
using the cvs version of SWIG to have libtool installed on their
machine. Suggest version 1.4.2 or higher, preferably the latest - 1.5.
- Automake is now used to build the runtime libraries in conjunction
with libtool.
- Runtime libraries are now successfully built as DLLs on Cygwin.
- Skipping languages is no longer just determined in the top level
makefile but in configure.in. This info is used for building
the runtime libraries and for running the examples and test-suite.
- These changes have fixed multiple build directory builds, that is
building from directories other than the top level directory.
Installation from multiple build directories also working. An initial
configure in the top level directory is no longer needed as described
in 04/02/2003 entry. A 'make distclean' will be needed before building
in a directory other than the top level directory if the autotools
have been run from this top level directory at some point, but
autoconf will tell you this. Note that 'make check' only works from
the top level directory at the moment.
04/28/2003: beazley
Fixed [ 723471 ] Wrapper_print() fails with preprocessor directives.
04/28/2003: beazley
Minor refinement of const static member variable handling
described in CHANGES 08/11/2002. Previously, SWIG merely
checked to see if there was an initializer in the declaration.
Now, SWIG additionally checks to make sure the static member
is const.
04/25/2003: ljohnson (Lyle Johnson)
[Ruby] Added a kind of limited support for multiple inheritance,
activated using the -minherit command-line option. I've also updated
the "C++ Inheritance" section of the Ruby documentation to discuss
how this works, and its limitations. Also also modified the minherit.i
test case to run against this.
04/25/2003: ljohnson (Lyle Johnson)
[Ruby] Added the -globalmodule command-line option for the Ruby
module, for wrapping stuff into the global module (Kernel) instead
of a nested module. Updated documentation accordingly.
04/23/2003: mrose (Mark Rose)
Fixed symname error in director calls to Python methods
that extend C++ operators.
Stopped director destructor wrappers from calling __set_up,
which was leaving the director flag in an inconsistent state.
04/23/2003: beazley
Fixed problem with namespace resolution and nested namespaces.
Reported by Alfred Lorber (and Marcelo Matus).
04/16/2003: cheetah (William Fulton)
Patch for Java examples and test-suite to run on Mac OS X.
04/15/2003: ljohnson (Lyle Johnson)
[Ruby] Incorporated Nobu Nakada's patches for supporting the Ruby
1.8 allocation framework.
04/15/2003: ljohnson (Lyle Johnson)
[Ruby] Replaced all uses of the deprecated STR2CSTR() macro with the
safer StringValuePtr() macro. For more information, see ruby-talk:67059
and follow-ups to that post.
04/11/2003: beazley
Fixed problem with preprocessor macro expansion. For example:
#define min(x,y) ((x) < (y)) ? (x) : (y)
int f(int min);
Reported by Sebastien Recio.
04/10/2003: cheetah (William Fulton)
[Java] Added a runtime check to typemaps in arrays_java.i library to check
that the Java array passed in is the same size as the C array and throw an
exception if not.
Also fix to use delete instead of free for arrays created using new.
04/07/2003: cheetah (William Fulton)
Remove GCC3 warning when compiling the examples and test-suite:
cc1plus: warning: changing search order for system directory "/usr/include"
cc1plus: warning: as it has already been specified as a non-system directory
See SF patch #715531 submitted by Gerald Williams
04/03/2003: cheetah (William Fulton)
[C#] Improved wrapping of enums and constants. These were previously
wrapped as C# variables rather than constants. Either these are wrapped
as readonly (runtime) constants or compile time constants, depending on
the %javaconst directive (The directive is likely to change name soon).
For example wrapping:
%javaconst(0);
#define ABC 22
%javaconst(1) XYZ;
#define XYZ 33
is now:
public static readonly int ABC = examplePINVOKE.get_ABC();
public const int XYZ = 33;
04/03/2003: cheetah (William Fulton)
[Java] Global constants and enums are put in their own interface called
xxxConstants, where xxx is the module name. This is an improvement as
it is possible to derive (implement) a Java class from the xxxConstants
interface to improve the syntax; namely when wrapping:
enum {ONE=1, TWO, THREE};
accessing these from a Java class implementing xxxConstants is neater:
int number = ONE;
than the previous:
int number = xxx.ONE;
Patch submitted by Dave Dribin.
04/02/2003: cheetah (William Fulton)
Build improvements for multiple builds. This allows one to build
the SWIG executable and runtime libraries for different platforms/compilers
etc by running configure in different directories. This isn't 100% just
yet and won't be until libtool is better configured... a 'configure' and
'make distclean' needs to be run in the root directory before it all works.
For example:
$ ./configure
$ make distclean
$ mkdir config1; cd config1; ../configure CC=gcc CXX=g++; make; cd ..
$ mkdir config2; cd config2; ../configure CC=cc CXX=c++; make; cd ..
To be improved. A 'make check' does not work yet either.
04/01/2003: beazley
Fixed template partial specialization argument expansion bug.
This showed up when trying to use std_vector.i with vectors
of pointers.
03/31/2003: cheetah (William Fulton)
Fix for parallel make builds of SWIG, for example
make -j 4
Build failure reported by Bill Clarke.
03/28/2003: beazley
Released 1.3.19.
Version 1.3.19 (March 28, 2003)
===============================
03/28/2003: beazley
Variety of minor bug fixes to the 1.3.18 release including:
- Segmentation fault with %extend directive.
- Typemap variable substitution bug.
- Expression evaluation bug.
- Large memory leak with template expansion.
Version 1.3.18 (March 23, 2003)
===============================
03/21/2003: beazley
Fixed two problems with the %extend directive, overloading, and
template expansion. See the 'template_extend_overload' and
'template_extend_overload_2' tests in Examples/test-suite for
details.
03/20/2003: cheetah (William Fulton)
[C#] Added some typemaps as suggested by Andreas Schoerk for handling
parameters that are passed as pointers or by reference. These have
been put in typemaps.i.
03/20/2003: beazley
Fixed a C++ scoping bug related to code like this:
class Foo {
public:
int Foo::bar();
};
Previously, SWIG just tossed out the Foo::bar() declaration. Now,
the declaration is wrapped provided that the prefix is exactly the
same as the current scope (including any enclosing namespaces).
Reported by Bruce Lowery.
03/20/2003: beazley
Incorporated [ 696516 ] Enabling exception processing for data member access.
In some compilers, attribute access can generate exceptions. However,
SWIG ordinarily assumes that no exceptions will be raised. To disable this,
use the %feature("allowexcept"). For example:
%feature("allowexcept") Foo::x;
...
class Foo {
public:
int x; /* Exception handling enabled */
...
};
Patch contributed by Yakov Markovitch.
03/20/2003: beazley
Incorporated Patch. [ 701860 ] Improve Performance (python proxies).
Gives a performance boost to proxy class code and the management of the
.this and .thisown attributes. Contributed by Mike Romberg.
03/19/2003: cheetah (William Fulton)
[C# and Java] Added missing vararg support.
03/18/2003: mrose (Mark Rose)
Removed code related to tagging individual methods for directors.
The concept of having directors for some but not all virtual methods
of a class is deeply flawed. The %feature("nodirector") tag is also
gone.
Directors are off by default. To enable them for a class, issue
%feature("director") classname; which will create director methods
for every virtual method in the hierarchy of the class.
03/17/2003: beazley
Fixed a subtle problem with passing arguments of type function. For
example:
int foo(int x(int, int));
or
typedef int binop_t(int, int);
int foo(binop_t x);
In old versions, this would produce code that wouldn't compile. Now,
SWIG merely adds an extra pointer, making these declarations the same
as:
int foo(int (*x)(int, int));
typedef int binop_t(int, int);
int foo(binop_t *x);
Reported by Garth Bushell.
03/17/2003: mrose (Mark Rose)
Fixed the return statement for director base class calls that have no
return value.
03/15/2003: beazley
Fixed a problem with const smart-pointer wrapping. For example:
class Foo {
public:
int x;
void bar() const;
void spam();
};
class Blah {
...
const Foo *operator->();
...
};
In this case, only "x" and "bar" are visible from Blah (since application
of spam violates constness). Moreover, access to "x" is read-only.
03/15/2003: mrose (Mark Rose)
Cleaned up two signed versus unsigned comparisons in python/std_vector.i.
03/15/2003: cheetah (William Fulton)
[C#] Global variables are wrapped using properties instead of get and set methods.
Member variable wrapping bug fixes, for example wrapping pointers work now.
Typemaps are used for all variable wrapping to generate the property code.
03/13/2003: mrose (Mark Rose)
Fixed a bug in the virtual method unrolling for directors.
The order of unrolling is now from base to derived, to ensure
that the most derived implementation of a director method is
found.
Director methods for pure virtual methods now throw
DIRECTOR_PURE_VIRTUAL_EXCEPTION if _up is set.
03/12/2003: cheetah (William Fulton)
[C#] Polymorphism fix: virtual functions now use the appropriate
keyword in the C# proxy class, virtual or override.
Some 'using System;' statement fixes needed by the Mono compiler.
03/11/2003: beazley
Fixed subtle bug in the application of SwigValueWrapper<> to
template classes with default constructors. Reported by
Bruce Lowery.
03/11/2003: beazley
The $descriptor(type) variable is now expanded in code supplied to
%extend. This is useful for certain kinds of advanced wrapping
(especially container classes).
03/11/2003: luigi
Support for std::map.
(a) Integration with scripting language (a la std::vector) for
Python, Ruby, MzScheme, and Guile;
(b) Simple wrapper for other languages
03/10/2003: beazley
Fixed problem with escape sequences in string and character constants. SWIG
wasn't parsing certain octal codes correctly.
03/07/2003: beazley
Fixed a variety of subtle preprocessor problems reported by
Sebastien Recio.
(a) Empty preprocessor values no longer generate "bad constant
value" errors. For example:
#define FOO
#define FOO BAR
(b) Macro names can now span multiple lines (technically valid,
although questionable practice). For example:
#define A_LONG_MACRO_\
NAME 42
(c) Whitespace is no longer required before certain macro values.
For example:
#define FOO"Hello"
#define BAR\
"Hello"
03/07/2003: ljohnson (Lyle Johnson)
[Ruby] Added missing long long and unsigned long long typemaps
in the Lib/ruby/typemaps.i library file.
03/07/2003: mrose (Mark Rose)
Added Examples/python/callback to demostrate how directors can
be used to implement callbacks in Python
Added Examples/python/extend to demonstrate virtual method
calls from C++ to Python (really the same as the callback
example, just a different context).
Added four tests for very basic director functionality. These
have runtime tests under python.
The Python module now emits #define SWIG_DIRECTORS near the
top of the output file if directors are enabled. This is useful
for disabling parts of tests in target languages that don't
support directors.
03/06/2003: mrose (Mark Rose)
Added a section to Doc/Manual/Python.html on cross language
polymorphism (directors).
03/06/2003: mrose (Mark Rose)
The short-lived "-fdirectors" command line option has been
removed. To enable directors, instead use the extended %module
directive as follows:
%module(directors="1") modulename
03/06/2003: cheetah (William Fulton)
The long long typemaps have been rewritten so that they can be more
easily used with non ISO compilers, like Visual C++. For example
if you are wrapping the Windows 64 bit type __int64 the long long
typemaps can be used with %apply:
%apply long long { __int64 };
__int64 value1(__int64 x);
__int64 will now appear in the generated code instead of long long.
03/06/2003: beazley
*** DEVELOPER CHANGE ***
Swig module mutation has been changed slightly. When a language
class method wants to save node attributes, it now uses one of the
following functions:
Swig_require()
Swig_save()
The first argument to these functions is a namespace in which
saved attributes are placed. For example,this code
Node *n;
Swig_save("cDeclaration",n,"type","parms","name",NIL);
saves the attributes as "cDeclaration:type", "cDeclaration:parms",
and so forth. If necessary, a language module can refer to
old values by using this special namespace qualifier.
In addition to this, a special attribute "view" contains the name
of the last namespace used to save attributes. In the above
example, "view" would have the value "cDeclaration". The value
of "cDeclaration:view" would have the previous view and so forth.
Swig_restore(n) restores a node to the state before the last
Swig_require() or Swig_save() call.
Note: This change makes it easier for language modules to refer
to old values of attributes.
03/06/2003: mrose (Mark Rose)
Merged the cross-language polymorphism patch. When enabled, C++
"proxy" classes (called directors) are generated for each specified
C++ class. Directors pass method calls from C++ to Python, similar
to the way the usual proxy (shadow) classes pass method calls from
Python to C++. Together, these two types of proxies allow C++
classes that are extended in Python to behave just like ordinary
C++ classes and be used in C++ like native objects.
This feature is still very experimental and is disabled by default.
To enable director support, specify '-fdirectors' on the SWIG command
line or in the SWIG_FEATURES environment variable. In the interface
file, add %feature("director") to generate directors for all classes
that have virtual methods.
See http://stm.lbl.gov/~tm2/swig/ProxyDoc.html for more details.
03/03/2003: beazley
Fixed a small glitch in typemap local variable replacement. If you had
a typemap like this:
%typemap(in) type ($1_type temp) {
...
temp = ...;
...
}
and no occurrence of "$1_type" appeared in the body, then the local
variable type wouldn't be substituted.
03/03/2003: cheetah (William Fulton)
[C#] New version of the CSharp module which is typemap based.
It also uses ECMA C# and no longer uses Microsoft Visual C++.NET
glue. This means that it will work on non-Windows platforms.
Contributed by Neil Cawse.
02/27/2003: beazley
Fixed [ 653548 ] error parsing casting operator definition.
SWIG now ignores casting operators declared outside of a class.
For example:
inline A::operator char *() { ... }
Bug reported by Martin Casado.
02/27/2003: beazley
Added support for anonymous bit-fields. For example:
struct Foo {
int x : 4;
int : 4;
int y : 8;
};
Anonymous bit-fields are ignored by SWIG. Problem
reported by Franz H�pfinger.
02/26/2003: cheetah (William Fulton)
[Java] Better typemaps in the Examples/java/typemap example and also
fixes subtle bug when using the StringBuffer typemaps more than once.
02/26/2003: beazley
Fixed [ 642112 ] Constants char bug.
02/26/2003: beazley
Fixed [ 675337 ] Partial template specialization not entirely working.
There was a subtle problem related to the naming and ordering of
template partial specialization arguments. Matching worked okay,
the resulting templates weren't expanded correctly.
02/25/2003: beazley
Fixed problem with parsing (and generating code) for
references to arrays. For example:
int foo(int (&x)[10]);
02/25/2003: beazley
Fixed [ 635347 ] Compilation warning from libpy.c.
Reported by Daniel L. Rall.
02/25/2003: beazley
Fixed a subtle problem with virtual method implementation
checking and typedef.
typedef int *intptr;
struct A {
virtual int *foo() = 0;
};
struct B : public A {
virtual intptr foo() { };
};
SWIG was treating these declarations as different even though
they are the same (via typedef).
02/25/2003: ljohnson (Lyle Johnson)
[Ruby] Added range checking for the NUM2USHRT macro, per [ 675353 ].
02/24/2003: beazley
Fixed a subtle problem with the code that determined if a class is abstract
and can be instantiated. If you had classes like this:
struct A {
virtual int foo(int) = 0;
};
struct B : virtual A {
virtual int foo(int);
};
struct C : virtual A {
};
/* Note order of base classes */
struct D : B, C { }; /* Ok */
struct E : C, B { }; /* Broken */
then SWIG determined that it could instantiate D(), but not E().
This inconsistency arose from the depth-first search of the
inheritance hierarchy to locate the implementations of virtual
methods. This problem should now be fixed---SWIG will attempt
to locate any valid implementation of a virtual method by
traversing over the entire hierarchy.
02/22/2003: cheetah (William Fulton)
[Java] Fix for using enum typemaps. The Java final static variable type
can be set using the jstype typemap, enabling enums to be mapped to
something other than int. Bug reported by Heiner Petith.
02/21/2003: songyanf (Tiger)
Added CSharp (C#) module prototype
i.e. csharp.cxx & csharp.h at Source/Modules/.
They are for test usage only now and need improvement.
The interface also need to be modified.
*** NEW FEATURE ***
02/20/2003: songyanf (Tiger)
Fixed problem with typedef with -fvirtual.
Similar as beazley's modification today.
02/20/2003: beazley
Added support for gcc-style variadic preprocessor macros.
Patch [ 623258 ] GCC-style vararg macro support.
Contributed by Joe Mason.
02/20/2003: beazley
Fixed [ 605162 ] Typemap local variables.
Reported by Lyle Johnson.
02/20/2003: beazley
Fixed problem with abstract classes and typedef. For example:
class Foo {
public:
virtual void foo(int x) = 0;
};
typedef int Integer;
class Bar : public Foo {
public:
virtual void foo(Integer x);
};
SWIG was getting confused about the latter method---making Bar
abstract. Reported by Marcelo Matus.
02/19/2003: cheetah (William Fulton)
[Java] %javaconst(flag) can also be used on enums as well as constants.
This feature enables true Java compiler constants so that they can be
used in Java switch statements. Thanks to Heiner Petith for patches.
02/19/2003: songyanf (Tiger)
Modified -fcompact feature to deal with PP lines
02/18/2003: beazley
Fixed [ 689040 ] Missing return value in std_vector.i.
Reported by Robert H. de Vries.
02/18/2003: beazley
Fixed a few evil scoping problems with templates, namespaces, and the
%extend directive. Problem reported by Luigi Ballabio.
02/18/2003: cheetah (William Fulton)
[Ruby] Improved support for Visual C++ and other native Windows compilers.
It is no longer necessary to specify "/EXPORT:Init_<module>", where <module> is the
swig module name when linking using these native Windows compilers.
02/15/2003: songyanf (Tiger)
Added -fvirtual option.
Reduce the lines and size of the wrapper file
by omitting redifined virtual function in children classes.
Modified -compact option to -fcompact option
Added -small option.
-small = -fvirtual -fcompact
And it can be extended by future feature options,
which are used to reduce wrapper file szie.
Added SWIG_FEATURES environment variable check.
To dynamically set the feature options such as -fcompact & -fvirtual
*** NEW FEATURE ***
02/13/2003: lenz
Updated Doc/Manual/Perl5.html to talk about C++ compile problems
configure.in now checks for PERL5_CCFLAGS
Runtime/Makefile.in and Example/Makefile.in now use PERL5_CCFLAGS
Added Lib/perl5/noembed.h which contains all the known macro conflicts
02/12/2003: beazley
Fixed [ 685410 ] C++ Explicit template instantiation causes SWIG to exit.
Fixes a syntax error with declarations similar to this:
template class std::vector<int>;
SWIG now ignores the instantiation and generates a warning message.
We might do more later. Reported by Thomas Williamson.
02/11/2003: cheetah (William Fulton)
Rewrote bool typemaps to remove performance warning for compiling generated code
under Visual C++.
02/11/2003: cheetah (William Fulton)
Fix for wrapping reference variables (const non-primitive and all non-const types)
for example:
int& i;
Class& c;
const Class& c;
02/11/2003: beazley
Fixed more very subtle preprocessor corner cases related to recursive
macro expansion. For example:
#define cat(x,y) x ## y
cat(cat(1,2),3) // Produces: cat(1,2)3
#define xcat(x,y) cat(x,y)
xcat(xcat(1,2),3) // Produces 123
See K&R, 2nd Ed. p. 231.
02/10/2003: cheetah (William Fulton)
Fixed [ 683882 ] - patch submitted by F. Postma for SWIG to compile on HP-UX.
02/10/2003: beazley
Fixed subtle preprocessor argument expansion bug. Reported by Marcelo Matus.
02/10/2003: songyanf
Added -compact option.
Reduce the lines and size of the wrapper file
by omitting comments and combining short lines.
*** NEW FEATURE ***
02/07/2003: beazley
Fixed [ 651355 ] Syntax error with cstring.i
Reported by Omri Barel.
02/07/2003: beazley
Fixed [ 663632 ] incompatibility with standard cpp.
This is a refinement that fixes this problem:
// Some macro with an argument
#define FOO(x) x
int FOO; /* Not a macro---no arguments */
02/05/2003: beazley
Fixed [ 675491 ] parse error with global namespace qualification.
Submitted by Jeremy Yallop.
02/04/2003: beazley
Fixed bug in varargs processing introduced by the numinputs typemap parameter.
01/08/2003: ttn
[xml] Fix string-replacement ordering buglet.
Thanks to Gary Herron.
12/23/2002: cheetah (William Fulton)
Further build changes:
- The SWIG executable is now built using a single Makefile.
- This makefile is generated by Automake (Source/Makefile.am).
- Dependency tracking and tags support are in this makefile.
- Automake 1.7.2 and Autoconf 2.54 minimum versions are needed to build SWIG from CVS.
- Running ./autogen.sh now installs Autoconf/Automake support files into
Tools/config and these files are no longer stored in CVS.
- Bug fixes in 'make install' for systems using .exe executable extension and
./configure --with-release-suffix=whatever
12/16/2002: cheetah (William Fulton)
More build changes:
- Autoconf's AC_CANONICAL_HOST replaces proprietary approach for detecting build host.
- Autoconf support files moved to Tools/config.
12/16/2002: cheetah (William Fulton)
Modifications to run on MacOS, submitted by Bernard Desgraupes.
Mainly ensuring generated files are output in the appropriate directory for
some modules.
12/11/2002: cheetah (William Fulton)
Various build modifications and bug fixes:
- Simplification of version string. Use autoconf's PACKAGE_VERSION instead.
- Build time removed from SWIG version.
- Using standard autoconf config header generation.
- Updated old autoconf macros as reported by autoupdate.
- Removed $prefix in autoconf from search paths as autoconf won't expand them.
- Subtle bug fix where 'make prefix=/somewhere; make clean; make prefix=/somwhere/else'
produced an executable using the incorrect library directories.
- Added -ldflags commandline option for MzScheme, Ocaml, Pike and PHP.
- Fixed reporting of compiler used when using -version commandline option.
- SWIG web address added to -version commandline option.
12/11/2002: beazley
Minor fix to Tcl dynamic cast typemaps. Reported by
Kristopher Blom.
12/10/2002: beazley
Fixed subtle template argument replace bug. Reported by
Chris Flatley.
12/10/2002: beazley
Reverted CHANGES 09/03/2002, preprocessor argument evaluation. Arguments
are not evaluated during collection, K&R, p. 230.
12/06/2002: beazley
Fixed [ 649022 ] Compilation problems with KAI/KCC
12/02/2002: beazley
SWIG 'rel-1-3' CVS branch merged back into the main branch.
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, $1.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:
(corrected typo in line below - 06/26/2008)
%fragment("type_header","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 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 accommodate 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
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 occurred 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
Conditionally compile experimental code with --enable-experiment
configure flag.
Fix .cvsignore to ignore configure & 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' occurred 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
statically 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 occurrences).
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 occurrence 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 necessary 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.
|