This file is indexed.

/usr/bin/idl2tcl is in tcl-combat 0.8.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

   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
#!/usr/bin/tclsh
# $Id: idl2tcl,v 1.2 2011-08-01 18:00:08 fp Exp $ \
#
# ----------------------------------------------------------------------
# Initialize.
# ----------------------------------------------------------------------
#

set myDir [file normalize [file dirname [info script]]]
set parentDir [file dirname $myDir]
set orbDir [file join $parentDir orb]
set killDir [file join $parentDir tclkill]

if {[file exists $orbDir] && [file isdirectory $orbDir]} {
    lappend auto_path $orbDir
}

if {[file exists $killDir] && [file isdirectory $killDir]} {
    lappend auto_path $killDir
}

if {[catch {package require combat} oops]} {
    puts stderr "Error: Failed to find the required \"combat\" package."
    exit 1
}

if {[catch {package require kill} oops]} {
    puts stderr "Error: Failed to find the required \"kill\" package."
    exit 1
}

if {[catch {set argv [eval corba::init $argv]} res]} {
    puts stderr "Error: corba::init failed: $res"
    exit 1
}

#
# ----------------------------------------------------------------------
# Command-line processing.
# ----------------------------------------------------------------------
#

proc usage {} {
    puts stderr "usage: $::argv0 \[options\] <idl-files>"
    puts stderr "  Options:"
    puts stderr "    -v           Verbose operation. Use more than once for more verbosity."
    puts stderr "    --name <n>   Name of the output file, else use the first IDL file's."
    puts stderr "    --impl       Generate an implementation skeleton file."
    puts stderr "    -I<path>     Passed to the IDL compiler."
    puts stderr "    -D<t\[=v\]>    Passed to the IDL compiler."
    puts stderr "    --ir <ior>   Process this Interface Repository rather than IDL files."
    puts stderr "    --ifr <cmd>  Command line to start the Interface Repository."
    puts stderr "    --idl <cmd>  Command line to feed IDL files to the Interface Repository."
    exit 1
}

set infiles ""
set outbase ""
set implflag "no"
set verbose 0
set irior ""
set ifr [list]
set idl [list]
set idlopts [list]

for {set i 0} {$i < [llength $argv]} {incr i} {
    switch -glob -- [lindex $argv $i] {
	--name {
	    set outbase [lindex $argv [incr i]]
	}
	--impl {
	    set implflag "yes"
	}
	-I -
	-D {
	    lappend idlopts [lindex $argv $i]
	    lappend idlopts [lindex $argv [incr i]]
	}
	-I* -
	-D* {
	    lappend idlopts [lindex $argv $i]
	}
	--ir {
	    set irior [lindex $argv [incr i]]
	}
	--ifr {
	    lappend ifr [lindex $argv [incr i]]
	}
	--idl {
	    lappend idl [lindex $argv [incr i]]
	}
	-v {
	    incr verbose
	}
	--* {
	    usage
	}
	default {
	    set file [lindex $argv $i]
	    if {![file readable $file]} {
		puts stderr "Error: input file $file does not exist or is not readable"
		exit 1
	    }
	    lappend infiles $file
	}
    }
}

if {[llength $infiles] == 0} {
    if {$irior == ""} {
	usage
    }

    if {$outbase == ""} {
	puts stderr "Error: must supply --name with --ir"
	exit 1
    }
} elseif {$outbase == ""} {
    set outbase [file rootname [file tail [lindex $infiles end]]]
}

#
# ----------------------------------------------------------------------
# Figure out which Interface Repository to use.
# ----------------------------------------------------------------------
#

#
# Look for the following in the $PATH:
#
# - The Interface Repository service:
#     - ird for MICO
#     - irserv for ORBacus
#     - tao_ifr_service for TAO
# - The program to feed IDL files to the Interface Repository:
#     - idl --feed-ir --no-codegen-c++ --feed-included-defs for MICO
#     - irfeed for ORBacus
#     - tao_ifr for TAO
#
# This can be overridden with the following command-line options:
#
# - Use --ifr <IOR>
#   If this command-line option is provided, we contact the Interface
#   Repository at the given IOR and dump all of its contents.
#
# - Use --ifrserver <ifrserver> AND --ifrfeed <ifrfeed>
#   - <ifrserver> must be the command line to start the Interface Repository
#     server.  The server must write the Interface Repository IOR to the file
#     "ir.ior" in the current directory (the command line should include
#     appropriate options).  <ifrserver> is spawned as a new process and
#     later killed.
#   - <irfeed> must be the command line to feed one or more IDL files
#     to the Interface Repository.  The "-ORBInitRef" option is added
#     to this command line to set the "InterfaceRepository" initial
#     reference.  It is expected that this command preprocesses the IDL
#     file, accepting the usual "-I" and "-D" command-line options, and
#     that the names of one or more IDL files are passed at the end of
#     the command line.
#

proc findFileInPath {name} {
    #
    # Look for a file in $PATH.
    #

    if {$::tcl_platform(platform) == "windows"} {
	#
	# On Windows, look for both $name and ${name}.exe.
	#

	foreach path [split $::env(PATH) ";"] {
	    if {[file exists [file join $path $name]]} {
		return [file join $path $name]
	    }
	    if {[file exists [file join $path ${name}.exe]]} {
		return [file join $path ${name}.exe]
	    }
	}

	set path [file dirname $::argv0]

	if {[file exists [file join $path $name]]} {
	    return [file join $path $name]
	}

	if {[file exists [file join $path ${name}.exe]]} {
	    return [file join $path ${name}.exe]
	}
    } else {
	foreach path [split $::env(PATH) ":"] {
	    if {[file exists [file join $path $name]]} {
		return [file join $path $name]
	    }
	}

	set path [file dirname $::argv0]

	if {[file exists [file join $path $name]]} {
	    return [file join $path $name]
	}
    }

    error "$name not found in PATH"
}

if {$irior == ""} {
    #
    # We know about MICO, TAO and ORBacus (though I haven't tried the latter
    # for a VERY long time).
    #

    if {![llength $ifr]} {
	if {$::tcl_platform(platform) == "windows"} {
	    append ::env(PATH) ";[pwd]"
	} else {
	    append ::env(PATH) ":[pwd]"
	    append ::env(LD_LIBRARY_PATH) ":[pwd]"
	}

	if {![catch {set ifr [list [findFileInPath "ird"]]}]} {
	    set ORB "MICO"
	    set idl [list [findFileInPath "idl"]]
	    lappend idl "--feed-ir" "--feed-included-defs" "--no-codegen-c++"
	    lappend ifr "-ORBNoResolve"
	} elseif {![catch {set ifr [findFileInPath "tao_ifr_service"]}]} {
	    set ORB "TAO"
	    set idl [list [findFileInPath "tao_ifr"]]
	    lappend ifr "-ORBDottedDecimalAddresses" "1"
	} elseif {![catch {set ifr [list [findFileInPath "irserv"]]}]} {
	    set ORB "ORBacus"
	    set idl [list [findFileInPath "irfeed"]]
	} else {
	    puts stderr "Error: Did not find Interface Repository executable.  Please make sure that"
	    puts stderr "       the following executables are in your \$PATH:"
	    puts stderr "       - When using Mico, \"ird\" and \"idl\""
	    puts stderr "       - When using TAO, \"tao_ifr_service\" and \"tao_ifr\""
	    puts stderr "       - When using ORBacus, \"irserv\" and \"irfeed\""
	    puts stderr "       Alternatively, use either --ir or --ifr and --idl."
	    exit 1
	}
    }
}

#
# ----------------------------------------------------------------------
# Traverse the Interface Repository.  Generate a list of dependencies,
# and then produce a post-order that ensures that definitions appear
# before they are referenced by a later definition.
# ----------------------------------------------------------------------
#

namespace eval Deps {
    #
    #  1: n1 contains n2
    # -1: n2 contains n1
    #  0: neither
    #
    
    proc Contains {n1 n2} {
	set l1 [string length $n1]
	set l2 [string length $n2]

	if {$l1 < $l2 && [string first $n1 $n2] == 0 && \
		[string index $n2 $l1] == ":"} {
	    return 1
	} elseif {$l1 > $l2 && [string first $n2 $n1] == 0 && \
		[string index $n1 $l2] == ":"} {
	    return -1
	}
	return 0
    }
    
    #
    #  1: n1 directly contains n2
    # -1: n2 directly contains n1
    #  0: neither
    #
    
    proc DirectlyContains {n1 n2} {
	set l1 [string length $n1]
	set l2 [string length $n2]

	if {$l1 < $l2 && [string first $n1 $n2] == 0 && \
		[string index $n2 $l1] == ":" && \
		[string first :: [string range $n2 [expr $l1+2] end]] == -1} {
	    return 1
	} elseif {$l1 > $l2 && [string first $n2 $n1] == 0 && \
		[string index $n1 $l2] == ":" && \
		[string first :: [string range $n1 [expr $l2+2] end]] == -1} {
	    return -1
	}
	return 0
    }

    proc MakeDep {dependee_name dependenton_name {forward 0}} {
	variable deps
	global verbose

	if {$forward} {
	    set dependenton_name "_fwd_$dependenton_name"
	}

	if {$verbose >= 4} {
	    if {$forward} {
		puts "Adding dependency from $dependee_name to $dependenton_name (forward)"
	    } else {
		puts "Adding dependency from $dependee_name to $dependenton_name"
	    }
	}
	
	if {![info exists deps($dependee_name)]} {
	    set deps($dependee_name) [list $dependenton_name]
	} elseif {[lsearch -exact $deps($dependee_name) $dependenton_name] == -1} {
	    lappend deps($dependee_name) $dependenton_name
	}
    }
    
    proc AddDep {dependee dependent_on} {
	variable deps

	if {![$dependee _is_a IDL:omg.org/CORBA/Contained:1.0]} {
	    return
	}

	if {![$dependent_on _is_a IDL:omg.org/CORBA/Contained:1.0]} {
	    #
	    # dereference template types
	    #
	    
	    switch [$dependent_on def_kind] {
		dk_Sequence -
		dk_Array {
		    AddDep $dependee [$dependent_on element_type_def]
		}
	    }
	
	    return
	}

	set n1 [$dependee absolute_name]
	set n2 [$dependent_on absolute_name]

	#
	# ignore if dependent_on is contained in dependee
	#

	if {[Contains $n1 $n2] == 1} {
	    return
	}

	#
	# If something within an interface (valuetype) depends on
	# something outside of that interface, make a dependency from
	# the interface (valuetype) instead.
	#

	set c $dependee
	while {[$c _is_a IDL:omg.org/CORBA/Contained:1.0] && \
		!([$c _is_a IDL:omg.org/CORBA/InterfaceDef:1.0] || \
		[$c _is_a IDL:omg.org/CORBA/ValueDef:1.0])} {
	    set c [$c defined_in]
	}

	if {[$c _is_a IDL:omg.org/CORBA/InterfaceDef:1.0] || \
		[$c _is_a IDL:omg.org/CORBA/ValueDef:1.0]} {
	    set if [$c absolute_name]
	    if {$if != $n2 && [Contains $if $n2] != 1} {
		set n1 $if
		set dependee $c
	    }
	}

	#
	# If dependent_on is an interface (or valuetype) and dependee
	# something outside that interface (or valuetype), mark
	# dependent_on as a candidate for a forward declaration
	#

	if {[$dependent_on _is_a IDL:omg.org/CORBA/InterfaceDef:1.0] || \
		[$dependent_on _is_a IDL:omg.org/CORBA/ValueDef:1.0]} {
	    if {[Contains $n2 $n1] != 1} {
		MakeDep $n1 $n2 1
		return
	    }
	}

	#
	# If dependent_on is a struct (or union), and dependee something
	# outside that struct (or union), we may have to forward-declare
	# the struct (or union). However, if the struct (or union) is
	# defined within an interface (or valuetype, struct or union),
	# and dependee is outside that type, then make dependee depend
	# on that outer type.
	#

	if {[$dependent_on _is_a IDL:omg.org/CORBA/StructDef:1.0] || \
		[$dependent_on _is_a IDL:omg.org/CORBA/UnionDef:1.0]} {
	    set c [$dependent_on defined_in]
	    if {[$c _is_a IDL:omg.org/CORBA/InterfaceDef:1.0] || \
		    [$c _is_a IDL:omg.org/CORBA/ValueDef:1.0] || \
		    [$c _is_a IDL:omg.org/CORBA/StructDef:1.0] || \
		    [$c _is_a IDL:omg.org/CORBA/UnionDef:1.0]} {
		set cn [$c absolute_name]
		if {![Contains $cn $n1]} {
		    AddDep $dependee $c
		    return
		}
	    }
	    if {[Contains $n2 $n1] != 1} {
		MakeDep $n1 $n2 1
		return
	    }
	}

	MakeDep $n1 $n2
    }
    
    proc ConstantDef {obj} {
	set type [$obj type_def]
	AddDep $obj $type
    }
    
    proc StructDef {obj} {
	set members [$obj members]
	foreach member $members {
	    array set elements $member
	    AddDep $obj $elements(type_def)
	}
	catch {array unset elements}
    }
    
    proc UnionDef {obj} {
	AddDep $obj [$obj discriminator_type_def]
	StructDef $obj
    }
    
    proc AliasDef {obj} {
	AddDep $obj [$obj original_type_def]
    }
    
    proc ExceptionDef {obj} {
	StructDef $obj
    }
    
    proc AttributeDef {obj} {
	AddDep $obj [$obj type_def]
    }

    proc OperationDef {obj} {
	set params [$obj params]
	foreach param $params {
	    array set pd $param
	    AddDep $obj $pd(type_def)
	}
	catch {array unset pd}
	set exceptions [$obj exceptions]
	foreach exception $exceptions {
	    AddDep $obj $exception
	}
	catch {array unset ex}
	AddDep $obj [$obj result_def]
    }

    proc InterfaceDef {obj} {
	set bases [$obj base_interfaces]
	foreach base $bases {
	    AddDep $obj $base
	}
    }

    proc ValueDef {obj} {
	set base [$obj base_value]
	if {$base != "0"} {
	    AddDep $obj $base
	}
	set absbases [$obj abstract_base_values]
	foreach absbase $absbases {
	    AddDep $obj $absbase
	}
	set supporteds [$obj supported_interfaces]
	foreach supported $supporteds {
	    AddDep $obj $supported
	}
    }
    
    proc ValueBoxDef {obj} {
	AddDep $obj [$obj original_type_def]
    }

    proc ValueMemberDef {obj} {
	AddDep $obj [$obj type_def]
    }
    
    proc Traverse {container} {
	variable elements
	global verbose

	set contents [$container contents dk_all true]
	
	foreach contained $contents {
	    if {$verbose >= 4} {
		$contained _is_a IDL:omg.org/CORBA/Contained:1.0
		puts "Visiting [$contained absolute_name]"
	    }

	    if {[$container def_kind] != "dk_Module"} {
		AddDep $contained $container
	    }

	    set kind [$contained def_kind]
	    switch $kind {
		dk_Constant          { ConstantDef $contained }
		dk_Struct            { StructDef $contained }
		dk_Union             { UnionDef $contained }
		dk_Alias             { AliasDef $contained }
		dk_Exception         { ExceptionDef $contained }
		dk_Attribute         { AttributeDef $contained }
		dk_Operation         { OperationDef $contained }
		dk_Interface -
		dk_LocalInterface -
		dk_AbstractInterface { InterfaceDef $contained }
		dk_Value             { ValueDef $contained }
		dk_ValueBox          { ValueBoxDef $contained }
		dk_ValueMember       { ValueMemberDef $contained }
		dk_Module            {}
		dk_Enum              {}
		dk_Native            {}
		dk_Typedef -
		dk_Primitive -
		dk_String -
		dk_Wstring -
		dk_Fixed -
		dk_Sequence -
		dk_Array -
		dk_Repository -
		default {
		    error "oops: illegal contained item: $kind"
		}
	    }
	    if {[$contained _is_a IDL:omg.org/CORBA/Container:1.0]} {
		Traverse $contained
	    }

	    if {$kind != "dk_Module"} {
		lappend elements [$contained absolute_name]
	    }
	}
    }

    proc DepthFirstTraversal {node} {
	variable deps
	variable visited
	variable postorder

	if {[info exists visited($node)]} {
	    return
	}

	set visited($node) 1

	if {[info exists deps($node)]} {
	    foreach child $deps($node) {
		DepthFirstTraversal $child
	    }
	}

	lappend postorder $node
    }

    #
    # "main" function
    #

    proc BuildDeps {container} {
	variable elements [list]
	variable postorder [list]
	variable visited
	global verbose

	if {![info exists verbose]} {
	    set verbose 0
	}

	#
	# Build dependencies
	#

	Traverse $container

	#
	# make depth-first traversal
	#

	catch {unset visited}

	foreach element $elements {
	    DepthFirstTraversal $element
	}

	return $postorder
    }
}

#
# ----------------------------------------------------------------------
# Produce an output string representing the Interface Repository's
# contents.
# ----------------------------------------------------------------------
#

namespace eval CodeGen {
    proc emitRepoId {obj} {
	return [list [$obj id] [$obj name] [$obj version]]
    }

    proc emitIDLTypeName {obj} {
	#
	# Emit type name for a primitive, named or anonymous type
	#
	if {[$obj _is_a IDL:omg.org/CORBA/PrimitiveDef:1.0]} {
	    switch [$obj kind] {
		pk_void     { set res void }
		pk_short    { set res short }
		pk_long     { set res long }
		pk_ushort   { set res "unsigned short" }
		pk_ulong    { set res "unsigned long" }
		pk_float    { set res float }
		pk_double   { set res double }
		pk_boolean  { set res boolean }
		pk_char     { set res char }
		pk_octet    { set res octet }
		pk_any      { set res any }
		pk_TypeCode { set res TypeCode }
		pk_string   { set res string }
		pk_objref   { set res Object }
		pk_longlong { set res "long long" }
		pk_ulonglong { set res "unsigned long long" }
		pk_longdouble { set res "long double" }
		pk_wchar    { set res wchar }
		pk_wstring  { set res wstring }
		pk_value_base { set res "value base" }
		default     {
		    error "oops: unknown primitive type [$obj kind]"
		}
	    }
	} elseif {[$obj _is_a IDL:omg.org/CORBA/TypedefDef:1.0]} {
	    set res [$obj id]
	} else {
	    switch [$obj def_kind] {
		dk_String   { set res [list string [$obj bound]] }
		dk_Wstring  { set res [list wstring [$obj bound]] }
		dk_Fixed    { set res [list fixed [$obj digits] [$obj scale]] }
		dk_Sequence {
		    set res [list sequence \
			    [emitIDLTypeName [$obj element_type_def]]]
		    if {[$obj bound] > 0} {
			lappend res [$obj bound]
		    }
		}
		dk_Array {
		    set res [list array \
			    [emitIDLTypeName [$obj element_type_def]] \
			    [$obj length]]
		}
		dk_Interface -
		dk_LocalInterface -
		dk_AbstractInterface -
		dk_Value {
		    set res [$obj id]
		}
	    }
	}
	return $res
    }

    proc emitConstant {obj} {
	return [list const \
		[emitRepoId $obj] \
		[emitIDLTypeName [$obj type_def]] \
		[lindex [$obj value] 1]]
    }

    proc emitStruct {obj} {
	set members [$obj members]
	set elements [list]
	foreach member $members {
	    array set md $member
	    lappend elements [list $md(name) \
		    [emitIDLTypeName $md(type_def)]]
	}
	catch {array unset md}
	return [list struct [emitRepoId $obj] $elements [emitContainer $obj]]
    }

    proc emitUnion {obj} {
	set members [$obj members]
	set elements [list]
	foreach member $members {
	    array set md $member
	    if {[lindex $md(label) 0] == "octet"} {
		binary scan [lindex $md(label) 1] c foo
		if {$foo == 0} {
		    set label "(default)"
		} else {
		    set label [lindex $md(label) 1]
		}
	    } else {
		set label [lindex $md(label) 1]
	    }
	    lappend elements [list $label $md(name) \
		    [emitIDLTypeName $md(type_def)]]
	}
	catch {array unset md}
	return [list union [emitRepoId $obj] \
		[emitIDLTypeName [$obj discriminator_type_def]] \
		$elements [emitContainer $obj]]
    }

    proc emitAlias {obj} {
	return [list typedef [emitRepoId $obj] \
		[emitIDLTypeName [$obj original_type_def]]]
    }

    proc emitException {obj} {
	set members [$obj members]
	set elements [list]
	foreach member $members {
	    array set md $member
	    lappend elements [list $md(name) \
		    [emitIDLTypeName $md(type_def)]]
	}
	catch {array unset md}
	return [list exception [emitRepoId $obj] \
		$elements [emitContainer $obj]]
    }

    proc emitEnum {obj} {
	return [list enum [emitRepoId $obj] [$obj members]]
    }

    proc emitAttribute {obj} {
	set res [list attribute \
		[emitRepoId $obj] \
		[emitIDLTypeName [$obj type_def]]]
	if {[$obj mode] == "ATTR_READONLY"} {
	    lappend res readonly
	}
	return $res
    }

    proc emitOperation {obj} {
	set params [$obj params]
	set pd [list]
	foreach param $params {
	    array set md $param
	    switch $md(mode) {
		PARAM_IN { set mode in }
		PARAM_OUT { set mode out }
		PARAM_INOUT { set mode inout }
	    }
	    lappend pd [list $mode $md(name) \
		    [emitIDLTypeName $md(type_def)]]
	}
	catch {array unset md}

	set exceptions [$obj exceptions]
	set ed [list]
	foreach exception $exceptions {
	    lappend ed [$exception id]
	}

	set res [list operation [emitRepoId $obj] \
		[emitIDLTypeName [$obj result_def]] \
		$pd $ed]
	if {[$obj mode] == "OP_ONEWAY"} {
	    lappend res oneway
	}

	return $res
    }

    proc emitInterface {obj} {
	set bases [$obj base_interfaces]
	set bd [list]
	foreach base $bases {
	    lappend bd [$base id]
	}
	
	switch [$obj def_kind] {
	    dk_Interface { set name "interface" }
	    dk_LocalInterface { set name "localinterface" }
	    dk_AbstractInterface { set name "abstractinterface" }
	    default { error "oops" }
	}

	return [list $name [emitRepoId $obj] $bd \
		[emitContainer $obj]]

    }

    proc emitValue {obj} {
	set base [$obj base_value]
	set bases [$obj abstract_base_values]
	set supps [$obj supported_interfaces]
	set inits [$obj initializers]

	if {$base != "0"} {
	    set base_id [$base id]
	} else {
	    set base_id "0"
	}

	set bases_id [list]
	foreach abase $bases {
	    lappend bases_id [$abase id]
	}

	set supp_id [list]
	foreach supp $supps {
	    lappend supp_id [$supp id]
	}

	set ninits [list]
	foreach init $inits {
	    array set ie $init
	    set nmembers [list]
	    foreach member $ie(members) {
		array set im $member
		lappend nmembers [list $im(name) \
			[emitIDLTypeName $im(type_def)]]
	    }
	    catch {array unset im}
	    lappend ninits [list $ie(name) $nmembers]
	}
	catch {array unset ie}

	set mods [list]
	if {[$obj is_abstract]} {
	    lappend mods "abstract"
	}

	if {[$obj is_custom]} {
	    lappend mods "custom"
	}

	if {[$obj is_truncatable]} {
	    lappend mods "truncatable"
	}

	return [list valuetype \
		[emitRepoId $obj] \
		$base_id \
		$bases_id \
		$supp_id \
		$ninits \
		$mods \
		[emitContainer $obj]]
    }

    proc emitValueBox {obj} {
	return [list valuebox [emitRepoId $obj] \
		[emitIDLTypeName [$obj original_type_def]]]
    }

    proc emitValueMember {obj} {
	if {[$obj access] == 0} {
	    set visi "private"
	} else {
	    set visi "public"
	}
	return [list valuemember \
		[emitRepoId $obj] \
		[emitIDLTypeName [$obj type_def]]\
		$visi]
    }

    proc emitNative {obj} {
	return [list native [emitRepoId $obj]]
    }

    proc emit {contained} {
	variable container
	variable visited

	set name [$contained absolute_name]
	set kind [$contained def_kind]

	# puts "emit $name"

	set visited($name) 1

	switch $kind {
	    dk_Constant          { set res [emitConstant $contained] }
	    dk_Struct            { set res [emitStruct $contained] }
	    dk_Union             { set res [emitUnion $contained] }
	    dk_Alias             { set res [emitAlias $contained] }
	    dk_Exception         { set res [emitException $contained] }
	    dk_Enum              { set res [emitEnum $contained] }
	    dk_Attribute         { set res [emitAttribute $contained] }
	    dk_Operation         { set res [emitOperation $contained] }
	    dk_Interface  -
	    dk_LocalInterface -
	    dk_AbstractInterface { set res [emitInterface $contained] }
	    dk_Value             { set res [emitValue $contained] }
	    dk_ValueBox          { set res [emitValueBox $contained] }
	    dk_ValueMember       { set res [emitValueMember $contained] }
	    dk_Module            { set res {} }
	    dk_Native            { set res [emitNative $contained] }
	    dk_Typedef -
	    dk_Primitive -
	    dk_String -
	    dk_Wstring -
	    dk_Fixed -
	    dk_Sequence -
	    dk_Array -
	    dk_Repository -
	    default {
		error "oops: illegal contained item: $kind"
	    }
	}
	return $res
    }

    proc emitForwardDecl {element} {
	variable container
	variable moduledata
	variable module
	variable data

	set if [$container lookup $element]
	ChangeModule [$if defined_in]

	switch [$if def_kind] {
	    dk_Struct { set type "struct" }
	    dk_Union { set type "union" }
	    dk_Interface { set type "interface" }
	    dk_LocalInterface { set type "localinterface" }
	    dk_AbstractInterface { set type "abstractinterface" }
	    dk_Value { set type "valuetype" }
	}

	return [list $type [emitRepoId $if]]
    }

    proc emitContainer {obj} {
	variable postorder
	variable visited
	variable container

	set container_name [$obj absolute_name]
	set to_visit [list]
	set new_po [list]
	set res [list]

	foreach element $postorder {
	    if {[string range $element 0 4] == "_fwd_"} {
		set elname [string range $element 5 end]
	    } else {
		set elname $element
	    }
	    if {[Deps::DirectlyContains $container_name $elname] == 1} {
		lappend to_visit $element
	    } else {
		lappend new_po $element
	    }
	}

	set postorder $new_po
	unset new_po

	foreach element $to_visit {
	    if {[string range $element 0 4] == "_fwd_"} {
		set realname [string range $element 5 end]
		if {![info exists visited($element)] && \
			![info exists visited($realname)]} {
		    lappend res [emitForwardDecl $realname]
		}
	    } elseif {![info exists visited($element)] && \
		    [Deps::DirectlyContains $container_name $element] == 1} {
		lappend res [emit [$container lookup $element]]
	    }
	}

	return $res
    }

    proc ChangeModule {c} {
	variable data
	variable moduledata
	variable module
	variable container

	while {![$c _is_a IDL:omg.org/CORBA/ModuleDef:1.0] && \
		[$c _is_a IDL:omg.org/CORBA/Contained:1.0]} {
	    set c [$c defined_in]
	}

	if {[$c _is_a IDL:omg.org/CORBA/ModuleDef:1.0]} {
	    set newmod [$c absolute_name]
	} elseif {[$c _is_a IDL:omg.org/CORBA/Repository:1.0]} {
	    set newmod ::
	} else {
	    return
	}

	if {$newmod != $module} {
	    if {$module != "::"} {
		set oldmod [$container lookup $module]
		while {[$oldmod _is_a IDL:omg.org/CORBA/ModuleDef:1.0]} {
		    set moduledata [list [list module \
			    [emitRepoId $oldmod] \
			    $moduledata]]
		    set oldmod [$oldmod defined_in]
		}
		lappend data [lindex $moduledata 0]
		unset moduledata
	    }
	    set module $newmod
	}
    }

    proc AddData {d} {
	variable moduledata
	variable module
	variable data

	if {$module == "::"} {
	    lappend data $d
	} else {
	    lappend moduledata $d
	}
    }

    proc CodeGen { _container _postorder } {
	variable container $_container
	variable postorder $_postorder
	variable visited

	catch {unset visited}

	variable data [list]
	variable module ::
	variable moduledata [list]

	foreach element $postorder {
	    if {[string range $element 0 4] == "_fwd_"} {
		set realname [string range $element 5 end]
		if {![info exists visited($element)] && \
			![info exists visited($realname)]} {
		    set contained [$container lookup $realname]
		    ChangeModule [$contained defined_in]
		    AddData [emitForwardDecl $realname]
		}
	    } else {
		if {![info exists visited($element)]} {
		    set contained [$container lookup $element]
		    ChangeModule [$contained defined_in]
		    AddData [emit $contained]
		}
	    }
	}

	ChangeModule $container
	return $data
    }
}

#
# ----------------------------------------------------------------------
# Produce (print) an implementation skeleton for interfaces.
# ----------------------------------------------------------------------
#

namespace eval ImplGen {
    proc emitLine {{data {}}} {
	variable indent
	variable out

	if {$data != {}} {
	    for {set i 0} {$i < $indent} {incr i} {
		puts -nonewline $out "    "
	    }
	}

	puts $out $data
    }

    proc Indent {{increment 1}} {
	variable indent
	incr indent $increment
    }

    proc TypeOf {idltype} {
	set kind [$idltype def_kind]

	switch $kind {
	    dk_Struct    { set res "struct [$idltype name]" }
	    dk_Union     { set res "union [$idltype name]" }
	    dk_Alias     { set res [TypeOf [$idltype original_type_def]] }
	    dk_Enum      { set res "enum [$idltype name]" }
	    dk_Primitive {
		set ptype [$idltype kind]
		set res [string range $ptype 3 end]
	    }
	    dk_String    { set res "string<[$idltype bound]>" }
	    dk_Wstring   { set res "wstring<[$idltype bound]>" }
	    dk_Sequence  {
		if {[$idltype bound] == 0} {
		    set res "sequence<[TypeOf [$idltype element_type_def]]>"
		} else {
		    set res "sequence<[TypeOf [$idltype element_type_def]], [$idltype bound]"
		}
	    }
	    dk_Array {
		set res "[TypeOf [$idltype element_type_def]]\[[$idltype length]\]"
	    }
	    dk_Interface { set res "[$idltype id] object reference" }
	    dk_Value     { set res "valuetype [$idltype name]" }
	    default {
		error "oops, unknown type"
	    }
	}
	return $res
    }

    proc emitAttributeDcl {attr} {
	emitLine "# type of [$attr name] is [TypeOf [$attr type_def]]"
	emitLine "public variable [$attr name]"
	emitLine
    }

    proc emitOperationDcl {op} {
	set params [$op params]
	set allpars [list]
	foreach param [$op params] {
	    array set pardata $param
	    lappend allpars $pardata(name)
	}
	emitLine "public method [$op name] \{[join $allpars]\}"
    }

    proc emitInterfaceDcl {iface} {
	emitLine "#"
	emitLine "# declaration for Interface [$iface absolute_name]"
	emitLine "#"
	emitLine

	emitLine "class [$iface absolute_name] \{"
	Indent

	#
	# class inheritance
	#

	set bases [$iface base_interfaces]

	if {[llength $bases] == 0} {
	    emitLine "inherit ::PortableServer::ServantBase"
	} elseif {[llength $bases] == 1} {
	    set base [lindex $bases 0]
	    emitLine "inherit [$base absolute_name]"
	} else {
	    puts stderr "warning: [$iface absolute_name] uses multiple inheritance"
	    emitLine "#"
	    emitLine "# This causes \"diamond inheritance\" and is not supported"
	    emitLine "# by \[incr Tcl\] yet. You'll have to use delegation here."
	    emitLine "#"

	    set inheritances [list]
	    foreach base $bases {
		lappend inheritances [$base absolute_name]
	    }
	    emitLine "inherit [join $inheritances]"
	}
	emitLine

	#
	# method _Interface
	#

	emitLine "public method _Interface \{\} \{"
	Indent
	emitLine "return \"[$iface id]\""
	Indent -1
	emitLine "\}"
	emitLine

	#
	# Handle Attributes
	#

	set attrs [$iface contents dk_Attribute true]
	foreach attr $attrs {
	    emitAttributeDcl $attr
	}

	#
	# Handle Operations
	#

	set ops [$iface contents dk_Operation true]
	foreach op $ops {
	    emitOperationDcl $op
	}

	#
	# done
	#

	Indent -1
	emitLine "\}"
	emitLine
    }

    proc emitOperationBody {op} {
	emitLine "#"
	emitLine "# operation [$op name]"
	emitLine "#"
	set params [$op params]
	set allpars [list]
	if {[llength $params] > 0} {
	    emitLine "#   parameters:"
	    foreach param [$op params] {
		array set pardata $param
		switch $pardata(mode) {
		    PARAM_IN    { set dir in }
		    PARAM_OUT   { set dir out }
		    PARAM_INOUT { set dir inout }
		}
		emitLine "#     $pardata(name): $dir [TypeOf $pardata(type_def)]"
		lappend allpars $pardata(name)
	    }
	    emitLine "#"
	}
	emitLine "#   returns:"
	emitLine "#     [TypeOf [$op result_def]]"
	emitLine "#"
	set exs [$op exceptions]
	if {[llength $exs] > 0} {
	    emitLine "#   raises:"
	    foreach ex $exs {
		emitLine "#     [$ex id]"
	    }
	    emitLine "#"
	}
	emitLine
	emitLine "body [$op absolute_name] \{[join $allpars]\} \{"
	Indent
	emitLine "#"
	emitLine "# Add implementation here"
	emitLine "#"
	emitLine
	emitLine "error \"Unimplemented method [$op absolute_name]\""
	Indent -1
	emitLine "\}"
	emitLine
    }

    proc emitInterfaceBody {iface} {
	emitLine "#"
	emitLine "# ----------------------------------------------------------------------"
	emitLine "#"
	emitLine "# code for Interface [$iface absolute_name]"
	emitLine "#"
	emitLine "# ----------------------------------------------------------------------"
	emitLine "#"
	emitLine

	#
	# Handle Operations
	#

	set ops [$iface contents dk_Operation true]
	foreach op $ops {
	    emitOperationBody $op
	}
    }

    proc ImplGen {_container postorder {_out stdout}} {
	variable container $_container
	variable out $_out
	variable module ::
	variable indent 0

	emitLine "#"
	emitLine "# ----------------------------------------------------------------------"
	emitLine "#"
	emitLine "# Declarations"
	emitLine "#"
	emitLine "# ----------------------------------------------------------------------"
	emitLine "#"
	emitLine

	#
	# First pass: emit declarations
	#

	foreach element $postorder {
	    set contained [$container lookup $element]
	    if {$contained != 0 && [$contained def_kind] == "dk_Interface"} {
		emitInterfaceDcl $contained
	    }
	}

	#
	# Second pass: emit empty method bodies
	#

	foreach element $postorder {
	    set contained [$container lookup $element]
	    if {$contained != 0 && [$contained def_kind] == "dk_Interface"} {
		emitInterfaceBody $contained
	    }
	}
    }
}

#
# ----------------------------------------------------------------------
# Type information for the Interface Repository, so that we can talk to
# it.
# ----------------------------------------------------------------------
#

#
# This file was automatically generated from ir.idl
# by idl2tcl. Do not edit.
#

set _ir_ir \
{{module {IDL:omg.org/CORBA:1.0 CORBA 1.0} {{typedef\
{IDL:omg.org/CORBA/Identifier:1.0 Identifier 1.0} string} {typedef\
{IDL:omg.org/CORBA/VersionSpec:1.0 VersionSpec 1.0} string} {typedef\
{IDL:omg.org/CORBA/RepositoryId:1.0 RepositoryId 1.0} string} {enum\
{IDL:omg.org/CORBA/DefinitionKind:1.0 DefinitionKind 1.0} {dk_none dk_all\
dk_Attribute dk_Constant dk_Exception dk_Interface dk_Module dk_Operation\
dk_Typedef dk_Alias dk_Struct dk_Union dk_Enum dk_Primitive dk_String\
dk_Sequence dk_Array dk_Repository dk_Wstring dk_Fixed dk_Value dk_ValueBox\
dk_ValueMember dk_Native dk_AbstractInterface dk_LocalInterface dk_Component\
dk_Home dk_Factory dk_Finder dk_PrimaryKey dk_Emits dk_Publishes dk_Consumes\
dk_Provides dk_Uses dk_Event}} {interface {IDL:omg.org/CORBA/IRObject:1.0\
IRObject 1.0} {} {{attribute {IDL:omg.org/CORBA/IRObject/def_kind:1.0\
def_kind 1.0} IDL:omg.org/CORBA/DefinitionKind:1.0 readonly} {operation\
{IDL:omg.org/CORBA/IRObject/destroy:1.0 destroy 1.0} void {} {}}}} {interface\
{IDL:omg.org/CORBA/IDLType:1.0 IDLType 1.0} IDL:omg.org/CORBA/IRObject:1.0\
{{attribute {IDL:omg.org/CORBA/IDLType/type:1.0 type 1.0} TypeCode\
readonly}}} {struct {IDL:omg.org/CORBA/StructMember:1.0 StructMember 1.0}\
{{name IDL:omg.org/CORBA/Identifier:1.0} {type TypeCode} {type_def\
IDL:omg.org/CORBA/IDLType:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/StructMemberSeq:1.0 StructMemberSeq 1.0} {sequence\
IDL:omg.org/CORBA/StructMember:1.0}} {struct\
{IDL:omg.org/CORBA/UnionMember:1.0 UnionMember 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {label any} {type TypeCode} {type_def\
IDL:omg.org/CORBA/IDLType:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/UnionMemberSeq:1.0 UnionMemberSeq 1.0} {sequence\
IDL:omg.org/CORBA/UnionMember:1.0}} {typedef\
{IDL:omg.org/CORBA/EnumMemberSeq:1.0 EnumMemberSeq 1.0} {sequence\
IDL:omg.org/CORBA/Identifier:1.0}} {typedef {IDL:omg.org/CORBA/Visibility:1.0\
Visibility 1.0} short} {const {IDL:omg.org/CORBA/PRIVATE_MEMBER:1.0\
PRIVATE_MEMBER 1.0} IDL:omg.org/CORBA/Visibility:1.0 0} {const\
{IDL:omg.org/CORBA/PUBLIC_MEMBER:1.0 PUBLIC_MEMBER 1.0}\
IDL:omg.org/CORBA/Visibility:1.0 1} {typedef\
{IDL:omg.org/CORBA/ValueModifier:1.0 ValueModifier 1.0} short} {const\
{IDL:omg.org/CORBA/VM_NONE:1.0 VM_NONE 1.0}\
IDL:omg.org/CORBA/ValueModifier:1.0 0} {const\
{IDL:omg.org/CORBA/VM_CUSTOM:1.0 VM_CUSTOM 1.0}\
IDL:omg.org/CORBA/ValueModifier:1.0 1} {const\
{IDL:omg.org/CORBA/VM_ABSTRACT:1.0 VM_ABSTRACT 1.0}\
IDL:omg.org/CORBA/ValueModifier:1.0 2} {const\
{IDL:omg.org/CORBA/VM_TRUNCATABLE:1.0 VM_TRUNCATABLE 1.0}\
IDL:omg.org/CORBA/ValueModifier:1.0 3} {struct\
{IDL:omg.org/CORBA/ValueMember:1.0 ValueMember 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {type TypeCode} {type_def\
IDL:omg.org/CORBA/IDLType:1.0} {access IDL:omg.org/CORBA/Visibility:1.0}} {}}\
{typedef {IDL:omg.org/CORBA/ValueMemberSeq:1.0 ValueMemberSeq 1.0} {sequence\
IDL:omg.org/CORBA/ValueMember:1.0}} {typedef\
{IDL:omg.org/CORBA/ScopedName:1.0 ScopedName 1.0} string} {interface\
{IDL:omg.org/CORBA/Container:1.0 Container 1.0}} {interface\
{IDL:omg.org/CORBA/Repository:1.0 Repository 1.0}} {interface\
{IDL:omg.org/CORBA/Contained:1.0 Contained 1.0}\
IDL:omg.org/CORBA/IRObject:1.0 {{attribute\
{IDL:omg.org/CORBA/Contained/id:1.0 id 1.0}\
IDL:omg.org/CORBA/RepositoryId:1.0} {attribute\
{IDL:omg.org/CORBA/Contained/name:1.0 name 1.0}\
IDL:omg.org/CORBA/Identifier:1.0} {attribute\
{IDL:omg.org/CORBA/Contained/version:1.0 version 1.0}\
IDL:omg.org/CORBA/VersionSpec:1.0} {attribute\
{IDL:omg.org/CORBA/Contained/defined_in:1.0 defined_in 1.0}\
IDL:omg.org/CORBA/Container:1.0 readonly} {attribute\
{IDL:omg.org/CORBA/Contained/absolute_name:1.0 absolute_name 1.0}\
IDL:omg.org/CORBA/ScopedName:1.0 readonly} {attribute\
{IDL:omg.org/CORBA/Contained/containing_repository:1.0 containing_repository\
1.0} IDL:omg.org/CORBA/Repository:1.0 readonly} {struct\
{IDL:omg.org/CORBA/Contained/Description:1.0 Description 1.0} {{kind\
IDL:omg.org/CORBA/DefinitionKind:1.0} {value any}} {}} {operation\
{IDL:omg.org/CORBA/Contained/describe:1.0 describe 1.0}\
IDL:omg.org/CORBA/Contained/Description:1.0 {} {}} {operation\
{IDL:omg.org/CORBA/Contained/move:1.0 move 1.0} void {{in new_container\
IDL:omg.org/CORBA/Container:1.0} {in new_name\
IDL:omg.org/CORBA/Identifier:1.0} {in new_version\
IDL:omg.org/CORBA/VersionSpec:1.0}} {}}}} {typedef\
{IDL:omg.org/CORBA/ContainedSeq:1.0 ContainedSeq 1.0} {sequence\
IDL:omg.org/CORBA/Contained:1.0}} {interface {IDL:omg.org/CORBA/ModuleDef:1.0\
ModuleDef 1.0}} {interface {IDL:omg.org/CORBA/ConstantDef:1.0 ConstantDef\
1.0}} {interface {IDL:omg.org/CORBA/StructDef:1.0 StructDef 1.0}} {interface\
{IDL:omg.org/CORBA/ExceptionDef:1.0 ExceptionDef 1.0}} {interface\
{IDL:omg.org/CORBA/UnionDef:1.0 UnionDef 1.0}} {interface\
{IDL:omg.org/CORBA/EnumDef:1.0 EnumDef 1.0}} {interface\
{IDL:omg.org/CORBA/AliasDef:1.0 AliasDef 1.0}} {interface\
{IDL:omg.org/CORBA/InterfaceDef:1.0 InterfaceDef 1.0}} {typedef\
{IDL:omg.org/CORBA/InterfaceDefSeq:1.0 InterfaceDefSeq 1.0} {sequence\
IDL:omg.org/CORBA/InterfaceDef:1.0}} {interface\
{IDL:omg.org/CORBA/AbstractInterfaceDef:1.0 AbstractInterfaceDef 1.0}}\
{typedef {IDL:omg.org/CORBA/AbstractInterfaceDefSeq:1.0\
AbstractInterfaceDefSeq 1.0} {sequence\
IDL:omg.org/CORBA/AbstractInterfaceDef:1.0}} {interface\
{IDL:omg.org/CORBA/LocalInterfaceDef:1.0 LocalInterfaceDef 1.0}} {interface\
{IDL:omg.org/CORBA/ValueDef:1.0 ValueDef 1.0}} {typedef\
{IDL:omg.org/CORBA/ValueDefSeq:1.0 ValueDefSeq 1.0} {sequence\
IDL:omg.org/CORBA/ValueDef:1.0}} {struct {IDL:omg.org/CORBA/Initializer:1.0\
Initializer 1.0} {{members IDL:omg.org/CORBA/StructMemberSeq:1.0} {name\
IDL:omg.org/CORBA/Identifier:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/InitializerSeq:1.0 InitializerSeq 1.0} {sequence\
IDL:omg.org/CORBA/Initializer:1.0}} {typedef\
{IDL:omg.org/CORBA/ExceptionDefSeq:1.0 ExceptionDefSeq 1.0} {sequence\
IDL:omg.org/CORBA/ExceptionDef:1.0}} {struct\
{IDL:omg.org/CORBA/ExceptionDescription:1.0 ExceptionDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {type TypeCode}} {}} {typedef\
{IDL:omg.org/CORBA/ExcDescriptionSeq:1.0 ExcDescriptionSeq 1.0} {sequence\
IDL:omg.org/CORBA/ExceptionDescription:1.0}} {struct\
{IDL:omg.org/CORBA/ExtInitializer:1.0 ExtInitializer 1.0} {{members\
IDL:omg.org/CORBA/StructMemberSeq:1.0} {exceptions_def\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {exceptions\
IDL:omg.org/CORBA/ExcDescriptionSeq:1.0} {name\
IDL:omg.org/CORBA/Identifier:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/ExtInitializerSeq:1.0 ExtInitializerSeq 1.0} {sequence\
IDL:omg.org/CORBA/ExtInitializer:1.0}} {interface\
{IDL:omg.org/CORBA/ExtValueDef:1.0 ExtValueDef 1.0}} {interface\
{IDL:omg.org/CORBA/ValueBoxDef:1.0 ValueBoxDef 1.0}} {interface\
{IDL:omg.org/CORBA/NativeDef:1.0 NativeDef 1.0}} {interface\
{IDL:omg.org/CORBA/Container:1.0 Container 1.0}\
IDL:omg.org/CORBA/IRObject:1.0 {{operation\
{IDL:omg.org/CORBA/Container/lookup:1.0 lookup 1.0}\
IDL:omg.org/CORBA/Contained:1.0 {{in search_name\
IDL:omg.org/CORBA/ScopedName:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/contents:1.0 contents 1.0}\
IDL:omg.org/CORBA/ContainedSeq:1.0 {{in limit_type\
IDL:omg.org/CORBA/DefinitionKind:1.0} {in exclude_inherited boolean}} {}}\
{operation {IDL:omg.org/CORBA/Container/lookup_name:1.0 lookup_name 1.0}\
IDL:omg.org/CORBA/ContainedSeq:1.0 {{in search_name\
IDL:omg.org/CORBA/Identifier:1.0} {in levels_to_search long} {in limit_type\
IDL:omg.org/CORBA/DefinitionKind:1.0} {in exclude_inherited boolean}} {}}\
{struct {IDL:omg.org/CORBA/Container/Description:1.0 Description 1.0}\
{{contained_object IDL:omg.org/CORBA/Contained:1.0} {kind\
IDL:omg.org/CORBA/DefinitionKind:1.0} {value any}} {}} {typedef\
{IDL:omg.org/CORBA/Container/DescriptionSeq:1.0 DescriptionSeq 1.0} {sequence\
IDL:omg.org/CORBA/Container/Description:1.0}} {operation\
{IDL:omg.org/CORBA/Container/describe_contents:1.0 describe_contents 1.0}\
IDL:omg.org/CORBA/Container/DescriptionSeq:1.0 {{in limit_type\
IDL:omg.org/CORBA/DefinitionKind:1.0} {in exclude_inherited boolean} {in\
max_returned_objs long}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_module:1.0 create_module 1.0}\
IDL:omg.org/CORBA/ModuleDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_constant:1.0 create_constant 1.0}\
IDL:omg.org/CORBA/ConstantDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in type IDL:omg.org/CORBA/IDLType:1.0}\
{in value any}} {}} {operation {IDL:omg.org/CORBA/Container/create_struct:1.0\
create_struct 1.0} IDL:omg.org/CORBA/StructDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in members\
IDL:omg.org/CORBA/StructMemberSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_exception:1.0 create_exception 1.0}\
IDL:omg.org/CORBA/ExceptionDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in members\
IDL:omg.org/CORBA/StructMemberSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_union:1.0 create_union 1.0}\
IDL:omg.org/CORBA/UnionDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in discriminator_type\
IDL:omg.org/CORBA/IDLType:1.0} {in members\
IDL:omg.org/CORBA/UnionMemberSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_enum:1.0 create_enum 1.0}\
IDL:omg.org/CORBA/EnumDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0} {in\
name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in members\
IDL:omg.org/CORBA/EnumMemberSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_alias:1.0 create_alias 1.0}\
IDL:omg.org/CORBA/AliasDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in original_type\
IDL:omg.org/CORBA/IDLType:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_interface:1.0 create_interface 1.0}\
IDL:omg.org/CORBA/InterfaceDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in base_interfaces\
IDL:omg.org/CORBA/InterfaceDefSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_abstract_interface:1.0\
create_abstract_interface 1.0} IDL:omg.org/CORBA/AbstractInterfaceDef:1.0\
{{in id IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in base_interfaces\
IDL:omg.org/CORBA/AbstractInterfaceDefSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_local_interface:1.0\
create_local_interface 1.0} IDL:omg.org/CORBA/LocalInterfaceDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in base_interfaces\
IDL:omg.org/CORBA/InterfaceDefSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_value:1.0 create_value 1.0}\
IDL:omg.org/CORBA/ValueDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in is_custom boolean} {in is_abstract\
boolean} {in base_value IDL:omg.org/CORBA/ValueDef:1.0} {in is_truncatable\
boolean} {in abstract_base_values IDL:omg.org/CORBA/ValueDefSeq:1.0} {in\
supported_interfaces IDL:omg.org/CORBA/InterfaceDefSeq:1.0} {in initializers\
IDL:omg.org/CORBA/InitializerSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_ext_value:1.0 create_ext_value 1.0}\
IDL:omg.org/CORBA/ExtValueDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in is_custom boolean} {in is_abstract\
boolean} {in base_value IDL:omg.org/CORBA/ValueDef:1.0} {in is_truncatable\
boolean} {in abstract_base_values IDL:omg.org/CORBA/ValueDefSeq:1.0} {in\
supported_interfaces IDL:omg.org/CORBA/InterfaceDefSeq:1.0} {in initializers\
IDL:omg.org/CORBA/ExtInitializerSeq:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_value_box:1.0 create_value_box 1.0}\
IDL:omg.org/CORBA/ValueBoxDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in original_type_def\
IDL:omg.org/CORBA/IDLType:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Container/create_native:1.0 create_native 1.0}\
IDL:omg.org/CORBA/NativeDef:1.0 {{in id IDL:omg.org/CORBA/RepositoryId:1.0}\
{in name IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0}} {}}}} {enum\
{IDL:omg.org/CORBA/PrimitiveKind:1.0 PrimitiveKind 1.0} {pk_null pk_void\
pk_short pk_long pk_ushort pk_ulong pk_float pk_double pk_boolean pk_char\
pk_octet pk_any pk_TypeCode pk_Principal pk_string pk_objref pk_longlong\
pk_ulonglong pk_longdouble pk_wchar pk_wstring pk_value_base}} {interface\
{IDL:omg.org/CORBA/PrimitiveDef:1.0 PrimitiveDef 1.0}} {interface\
{IDL:omg.org/CORBA/StringDef:1.0 StringDef 1.0}} {interface\
{IDL:omg.org/CORBA/WstringDef:1.0 WstringDef 1.0}} {interface\
{IDL:omg.org/CORBA/SequenceDef:1.0 SequenceDef 1.0}} {interface\
{IDL:omg.org/CORBA/ArrayDef:1.0 ArrayDef 1.0}} {interface\
{IDL:omg.org/CORBA/FixedDef:1.0 FixedDef 1.0}} {interface\
{IDL:omg.org/CORBA/Repository:1.0 Repository 1.0}\
IDL:omg.org/CORBA/Container:1.0 {{operation\
{IDL:omg.org/CORBA/Repository/lookup_id:1.0 lookup_id 1.0}\
IDL:omg.org/CORBA/Contained:1.0 {{in search_id\
IDL:omg.org/CORBA/RepositoryId:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Repository/get_primitive:1.0 get_primitive 1.0}\
IDL:omg.org/CORBA/PrimitiveDef:1.0 {{in kind\
IDL:omg.org/CORBA/PrimitiveKind:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Repository/create_string:1.0 create_string 1.0}\
IDL:omg.org/CORBA/StringDef:1.0 {{in bound {unsigned long}}} {}} {operation\
{IDL:omg.org/CORBA/Repository/create_wstring:1.0 create_wstring 1.0}\
IDL:omg.org/CORBA/WstringDef:1.0 {{in bound {unsigned long}}} {}} {operation\
{IDL:omg.org/CORBA/Repository/create_sequence:1.0 create_sequence 1.0}\
IDL:omg.org/CORBA/SequenceDef:1.0 {{in bound {unsigned long}} {in\
element_type IDL:omg.org/CORBA/IDLType:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Repository/create_array:1.0 create_array 1.0}\
IDL:omg.org/CORBA/ArrayDef:1.0 {{in length {unsigned long}} {in element_type\
IDL:omg.org/CORBA/IDLType:1.0}} {}} {operation\
{IDL:omg.org/CORBA/Repository/create_fixed:1.0 create_fixed 1.0}\
IDL:omg.org/CORBA/FixedDef:1.0 {{in digits {unsigned short}} {in scale\
short}} {}}}} {interface {IDL:omg.org/CORBA/PrimitiveDef:1.0 PrimitiveDef\
1.0} IDL:omg.org/CORBA/IDLType:1.0 {{attribute\
{IDL:omg.org/CORBA/PrimitiveDef/kind:1.0 kind 1.0}\
IDL:omg.org/CORBA/PrimitiveKind:1.0 readonly}}} {interface\
{IDL:omg.org/CORBA/StringDef:1.0 StringDef 1.0} IDL:omg.org/CORBA/IDLType:1.0\
{{attribute {IDL:omg.org/CORBA/StringDef/bound:1.0 bound 1.0} {unsigned\
long}}}} {interface {IDL:omg.org/CORBA/WstringDef:1.0 WstringDef 1.0}\
IDL:omg.org/CORBA/IDLType:1.0 {{attribute\
{IDL:omg.org/CORBA/WstringDef/bound:1.0 bound 1.0} {unsigned long}}}}\
{interface {IDL:omg.org/CORBA/SequenceDef:1.0 SequenceDef 1.0}\
IDL:omg.org/CORBA/IDLType:1.0 {{attribute\
{IDL:omg.org/CORBA/SequenceDef/bound:1.0 bound 1.0} {unsigned long}}\
{attribute {IDL:omg.org/CORBA/SequenceDef/element_type:1.0 element_type 1.0}\
TypeCode readonly} {attribute\
{IDL:omg.org/CORBA/SequenceDef/element_type_def:1.0 element_type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0}}} {interface {IDL:omg.org/CORBA/ArrayDef:1.0\
ArrayDef 1.0} IDL:omg.org/CORBA/IDLType:1.0 {{attribute\
{IDL:omg.org/CORBA/ArrayDef/length:1.0 length 1.0} {unsigned long}}\
{attribute {IDL:omg.org/CORBA/ArrayDef/element_type:1.0 element_type 1.0}\
TypeCode readonly} {attribute\
{IDL:omg.org/CORBA/ArrayDef/element_type_def:1.0 element_type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0}}} {interface {IDL:omg.org/CORBA/FixedDef:1.0\
FixedDef 1.0} IDL:omg.org/CORBA/IDLType:1.0 {{attribute\
{IDL:omg.org/CORBA/FixedDef/digits:1.0 digits 1.0} {unsigned short}}\
{attribute {IDL:omg.org/CORBA/FixedDef/scale:1.0 scale 1.0} short}}}\
{interface {IDL:omg.org/CORBA/ModuleDef:1.0 ModuleDef 1.0}\
{IDL:omg.org/CORBA/Container:1.0 IDL:omg.org/CORBA/Contained:1.0} {}}\
{interface {IDL:omg.org/CORBA/ConstantDef:1.0 ConstantDef 1.0}\
IDL:omg.org/CORBA/Contained:1.0 {{attribute\
{IDL:omg.org/CORBA/ConstantDef/type:1.0 type 1.0} TypeCode readonly}\
{attribute {IDL:omg.org/CORBA/ConstantDef/type_def:1.0 type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0} {attribute\
{IDL:omg.org/CORBA/ConstantDef/value:1.0 value 1.0} any}}} {interface\
{IDL:omg.org/CORBA/TypedefDef:1.0 TypedefDef 1.0}\
{IDL:omg.org/CORBA/Contained:1.0 IDL:omg.org/CORBA/IDLType:1.0} {}}\
{interface {IDL:omg.org/CORBA/StructDef:1.0 StructDef 1.0}\
{IDL:omg.org/CORBA/TypedefDef:1.0 IDL:omg.org/CORBA/Container:1.0}\
{{attribute {IDL:omg.org/CORBA/StructDef/members:1.0 members 1.0}\
IDL:omg.org/CORBA/StructMemberSeq:1.0}}} {interface\
{IDL:omg.org/CORBA/ExceptionDef:1.0 ExceptionDef 1.0}\
{IDL:omg.org/CORBA/Contained:1.0 IDL:omg.org/CORBA/Container:1.0} {{attribute\
{IDL:omg.org/CORBA/ExceptionDef/type:1.0 type 1.0} TypeCode readonly}\
{attribute {IDL:omg.org/CORBA/ExceptionDef/members:1.0 members 1.0}\
IDL:omg.org/CORBA/StructMemberSeq:1.0}}} {interface\
{IDL:omg.org/CORBA/UnionDef:1.0 UnionDef 1.0}\
{IDL:omg.org/CORBA/TypedefDef:1.0 IDL:omg.org/CORBA/Container:1.0}\
{{attribute {IDL:omg.org/CORBA/UnionDef/discriminator_type:1.0\
discriminator_type 1.0} TypeCode readonly} {attribute\
{IDL:omg.org/CORBA/UnionDef/discriminator_type_def:1.0 discriminator_type_def\
1.0} IDL:omg.org/CORBA/IDLType:1.0} {attribute\
{IDL:omg.org/CORBA/UnionDef/members:1.0 members 1.0}\
IDL:omg.org/CORBA/UnionMemberSeq:1.0}}} {interface\
{IDL:omg.org/CORBA/EnumDef:1.0 EnumDef 1.0} IDL:omg.org/CORBA/TypedefDef:1.0\
{{attribute {IDL:omg.org/CORBA/EnumDef/members:1.0 members 1.0}\
IDL:omg.org/CORBA/EnumMemberSeq:1.0}}} {interface\
{IDL:omg.org/CORBA/AliasDef:1.0 AliasDef 1.0}\
IDL:omg.org/CORBA/TypedefDef:1.0 {{attribute\
{IDL:omg.org/CORBA/AliasDef/original_type_def:1.0 original_type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0}}} {enum {IDL:omg.org/CORBA/OperationMode:1.0\
OperationMode 1.0} {OP_NORMAL OP_ONEWAY}} {typedef\
{IDL:omg.org/CORBA/ContextIdentifier:1.0 ContextIdentifier 1.0}\
IDL:omg.org/CORBA/Identifier:1.0} {typedef\
{IDL:omg.org/CORBA/ContextIdSeq:1.0 ContextIdSeq 1.0} {sequence\
IDL:omg.org/CORBA/ContextIdentifier:1.0}} {enum\
{IDL:omg.org/CORBA/ParameterMode:1.0 ParameterMode 1.0} {PARAM_IN PARAM_OUT\
PARAM_INOUT}} {struct {IDL:omg.org/CORBA/ParameterDescription:1.0\
ParameterDescription 1.0} {{name IDL:omg.org/CORBA/Identifier:1.0} {type\
TypeCode} {type_def IDL:omg.org/CORBA/IDLType:1.0} {mode\
IDL:omg.org/CORBA/ParameterMode:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/ParDescriptionSeq:1.0 ParDescriptionSeq 1.0} {sequence\
IDL:omg.org/CORBA/ParameterDescription:1.0}} {struct\
{IDL:omg.org/CORBA/OperationDescription:1.0 OperationDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {result TypeCode} {mode\
IDL:omg.org/CORBA/OperationMode:1.0} {contexts\
IDL:omg.org/CORBA/ContextIdSeq:1.0} {parameters\
IDL:omg.org/CORBA/ParDescriptionSeq:1.0} {exceptions\
IDL:omg.org/CORBA/ExcDescriptionSeq:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/OpDescriptionSeq:1.0 OpDescriptionSeq 1.0} {sequence\
IDL:omg.org/CORBA/OperationDescription:1.0}} {enum\
{IDL:omg.org/CORBA/AttributeMode:1.0 AttributeMode 1.0} {ATTR_NORMAL\
ATTR_READONLY}} {struct {IDL:omg.org/CORBA/AttributeDescription:1.0\
AttributeDescription 1.0} {{name IDL:omg.org/CORBA/Identifier:1.0} {id\
IDL:omg.org/CORBA/RepositoryId:1.0} {defined_in\
IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {type TypeCode} {mode\
IDL:omg.org/CORBA/AttributeMode:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/AttrDescriptionSeq:1.0 AttrDescriptionSeq 1.0} {sequence\
IDL:omg.org/CORBA/AttributeDescription:1.0}} {typedef\
{IDL:omg.org/CORBA/RepositoryIdSeq:1.0 RepositoryIdSeq 1.0} {sequence\
IDL:omg.org/CORBA/RepositoryId:1.0}} {interface\
{IDL:omg.org/CORBA/AttributeDef:1.0 AttributeDef 1.0}} {interface\
{IDL:omg.org/CORBA/OperationDef:1.0 OperationDef 1.0}} {interface\
{IDL:omg.org/CORBA/InterfaceDef:1.0 InterfaceDef 1.0}\
{IDL:omg.org/CORBA/Container:1.0 IDL:omg.org/CORBA/Contained:1.0\
IDL:omg.org/CORBA/IDLType:1.0} {{attribute\
{IDL:omg.org/CORBA/InterfaceDef/base_interfaces:1.0 base_interfaces 1.0}\
IDL:omg.org/CORBA/InterfaceDefSeq:1.0} {operation\
{IDL:omg.org/CORBA/InterfaceDef/is_a:1.0 is_a 1.0} boolean {{in interface_id\
IDL:omg.org/CORBA/RepositoryId:1.0}} {}} {struct\
{IDL:omg.org/CORBA/InterfaceDef/FullInterfaceDescription:1.0\
FullInterfaceDescription 1.0} {{name IDL:omg.org/CORBA/Identifier:1.0} {id\
IDL:omg.org/CORBA/RepositoryId:1.0} {defined_in\
IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {operations\
IDL:omg.org/CORBA/OpDescriptionSeq:1.0} {attributes\
IDL:omg.org/CORBA/AttrDescriptionSeq:1.0} {base_interfaces\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {type TypeCode}} {}} {operation\
{IDL:omg.org/CORBA/InterfaceDef/describe_interface:1.0 describe_interface\
1.0} IDL:omg.org/CORBA/InterfaceDef/FullInterfaceDescription:1.0 {} {}}\
{operation {IDL:omg.org/CORBA/InterfaceDef/create_attribute:1.0\
create_attribute 1.0} IDL:omg.org/CORBA/AttributeDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in type IDL:omg.org/CORBA/IDLType:1.0}\
{in mode IDL:omg.org/CORBA/AttributeMode:1.0}} {}} {operation\
{IDL:omg.org/CORBA/InterfaceDef/create_operation:1.0 create_operation 1.0}\
IDL:omg.org/CORBA/OperationDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in result IDL:omg.org/CORBA/IDLType:1.0}\
{in mode IDL:omg.org/CORBA/OperationMode:1.0} {in params\
IDL:omg.org/CORBA/ParDescriptionSeq:1.0} {in exceptions\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {in contexts\
IDL:omg.org/CORBA/ContextIdSeq:1.0}} {}}}} {interface\
{IDL:omg.org/CORBA/AbstractInterfaceDef:1.0 AbstractInterfaceDef 1.0}\
IDL:omg.org/CORBA/InterfaceDef:1.0 {}} {interface\
{IDL:omg.org/CORBA/LocalInterfaceDef:1.0 LocalInterfaceDef 1.0}\
IDL:omg.org/CORBA/InterfaceDef:1.0 {}} {interface\
{IDL:omg.org/CORBA/ValueMemberDef:1.0 ValueMemberDef 1.0}} {interface\
{IDL:omg.org/CORBA/ValueDef:1.0 ValueDef 1.0}\
{IDL:omg.org/CORBA/Container:1.0 IDL:omg.org/CORBA/Contained:1.0\
IDL:omg.org/CORBA/IDLType:1.0} {{attribute\
{IDL:omg.org/CORBA/ValueDef/supported_interfaces:1.0 supported_interfaces\
1.0} IDL:omg.org/CORBA/InterfaceDefSeq:1.0} {attribute\
{IDL:omg.org/CORBA/ValueDef/initializers:1.0 initializers 1.0}\
IDL:omg.org/CORBA/InitializerSeq:1.0} {attribute\
{IDL:omg.org/CORBA/ValueDef/base_value:1.0 base_value 1.0}\
IDL:omg.org/CORBA/ValueDef:1.0} {attribute\
{IDL:omg.org/CORBA/ValueDef/abstract_base_values:1.0 abstract_base_values\
1.0} IDL:omg.org/CORBA/ValueDefSeq:1.0} {attribute\
{IDL:omg.org/CORBA/ValueDef/is_abstract:1.0 is_abstract 1.0} boolean}\
{attribute {IDL:omg.org/CORBA/ValueDef/is_custom:1.0 is_custom 1.0} boolean}\
{attribute {IDL:omg.org/CORBA/ValueDef/is_truncatable:1.0 is_truncatable 1.0}\
boolean} {operation {IDL:omg.org/CORBA/ValueDef/is_a:1.0 is_a 1.0} boolean\
{{in value_id IDL:omg.org/CORBA/RepositoryId:1.0}} {}} {struct\
{IDL:omg.org/CORBA/ValueDef/FullValueDescription:1.0 FullValueDescription\
1.0} {{name IDL:omg.org/CORBA/Identifier:1.0} {id\
IDL:omg.org/CORBA/RepositoryId:1.0} {is_abstract boolean} {is_custom boolean}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {operations\
IDL:omg.org/CORBA/OpDescriptionSeq:1.0} {attributes\
IDL:omg.org/CORBA/AttrDescriptionSeq:1.0} {members\
IDL:omg.org/CORBA/ValueMemberSeq:1.0} {initializers\
IDL:omg.org/CORBA/InitializerSeq:1.0} {supported_interfaces\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {abstract_base_values\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {is_truncatable boolean} {base_value\
IDL:omg.org/CORBA/RepositoryId:1.0} {type TypeCode}} {}} {operation\
{IDL:omg.org/CORBA/ValueDef/describe_value:1.0 describe_value 1.0}\
IDL:omg.org/CORBA/ValueDef/FullValueDescription:1.0 {} {}} {operation\
{IDL:omg.org/CORBA/ValueDef/create_value_member:1.0 create_value_member 1.0}\
IDL:omg.org/CORBA/ValueMemberDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in type IDL:omg.org/CORBA/IDLType:1.0}\
{in access IDL:omg.org/CORBA/Visibility:1.0}} {}} {operation\
{IDL:omg.org/CORBA/ValueDef/create_attribute:1.0 create_attribute 1.0}\
IDL:omg.org/CORBA/AttributeDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in type IDL:omg.org/CORBA/IDLType:1.0}\
{in mode IDL:omg.org/CORBA/AttributeMode:1.0}} {}} {operation\
{IDL:omg.org/CORBA/ValueDef/create_operation:1.0 create_operation 1.0}\
IDL:omg.org/CORBA/OperationDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in result IDL:omg.org/CORBA/IDLType:1.0}\
{in mode IDL:omg.org/CORBA/OperationMode:1.0} {in params\
IDL:omg.org/CORBA/ParDescriptionSeq:1.0} {in exceptions\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {in contexts\
IDL:omg.org/CORBA/ContextIdSeq:1.0}} {}}}} {struct\
{IDL:omg.org/CORBA/ExtAttributeDescription:1.0 ExtAttributeDescription 1.0}\
{{name IDL:omg.org/CORBA/Identifier:1.0} {id\
IDL:omg.org/CORBA/RepositoryId:1.0} {defined_in\
IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {type TypeCode} {mode\
IDL:omg.org/CORBA/AttributeMode:1.0} {get_exceptions\
IDL:omg.org/CORBA/ExcDescriptionSeq:1.0} {set_exceptions\
IDL:omg.org/CORBA/ExcDescriptionSeq:1.0}} {}} {typedef\
{IDL:omg.org/CORBA/ExtAttrDescriptionSeq:1.0 ExtAttrDescriptionSeq 1.0}\
{sequence IDL:omg.org/CORBA/ExtAttributeDescription:1.0}} {interface\
{IDL:omg.org/CORBA/ExtAttributeDef:1.0 ExtAttributeDef 1.0}} {interface\
{IDL:omg.org/CORBA/ExtValueDef:1.0 ExtValueDef 1.0}\
IDL:omg.org/CORBA/ValueDef:1.0 {{attribute\
{IDL:omg.org/CORBA/ExtValueDef/ext_initializers:1.0 ext_initializers 1.0}\
IDL:omg.org/CORBA/ExtInitializerSeq:1.0} {struct\
{IDL:omg.org/CORBA/ExtValueDef/ExtFullValueDescription:1.0\
ExtFullValueDescription 1.0} {{name IDL:omg.org/CORBA/Identifier:1.0} {id\
IDL:omg.org/CORBA/RepositoryId:1.0} {is_abstract boolean} {is_custom boolean}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {operations\
IDL:omg.org/CORBA/OpDescriptionSeq:1.0} {attributes\
IDL:omg.org/CORBA/ExtAttrDescriptionSeq:1.0} {members\
IDL:omg.org/CORBA/ValueMemberSeq:1.0} {initializers\
IDL:omg.org/CORBA/ExtInitializerSeq:1.0} {supported_interfaces\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {abstract_base_values\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {is_truncatable boolean} {base_value\
IDL:omg.org/CORBA/RepositoryId:1.0} {type TypeCode}} {}} {operation\
{IDL:omg.org/CORBA/ExtValueDef/describe_ext_value:1.0 describe_ext_value 1.0}\
IDL:omg.org/CORBA/ExtValueDef/ExtFullValueDescription:1.0 {} {}} {operation\
{IDL:omg.org/CORBA/ExtValueDef/create_ext_attribute:1.0 create_ext_attribute\
1.0} IDL:omg.org/CORBA/ExtAttributeDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in type IDL:omg.org/CORBA/IDLType:1.0}\
{in mode IDL:omg.org/CORBA/AttributeMode:1.0} {in get_exceptions\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {in set_exceptions\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0}} {}}}} {interface\
{IDL:omg.org/CORBA/ValueBoxDef:1.0 ValueBoxDef 1.0}\
IDL:omg.org/CORBA/TypedefDef:1.0 {{attribute\
{IDL:omg.org/CORBA/ValueBoxDef/original_type_def:1.0 original_type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0}}} {interface {IDL:omg.org/CORBA/NativeDef:1.0\
NativeDef 1.0} IDL:omg.org/CORBA/TypedefDef:1.0 {}} {interface\
{IDL:omg.org/CORBA/AttributeDef:1.0 AttributeDef 1.0}\
IDL:omg.org/CORBA/Contained:1.0 {{attribute\
{IDL:omg.org/CORBA/AttributeDef/type:1.0 type 1.0} TypeCode readonly}\
{attribute {IDL:omg.org/CORBA/AttributeDef/type_def:1.0 type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0} {attribute\
{IDL:omg.org/CORBA/AttributeDef/mode:1.0 mode 1.0}\
IDL:omg.org/CORBA/AttributeMode:1.0}}} {interface\
{IDL:omg.org/CORBA/OperationDef:1.0 OperationDef 1.0}\
IDL:omg.org/CORBA/Contained:1.0 {{attribute\
{IDL:omg.org/CORBA/OperationDef/result:1.0 result 1.0} TypeCode readonly}\
{attribute {IDL:omg.org/CORBA/OperationDef/result_def:1.0 result_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0} {attribute\
{IDL:omg.org/CORBA/OperationDef/params:1.0 params 1.0}\
IDL:omg.org/CORBA/ParDescriptionSeq:1.0} {attribute\
{IDL:omg.org/CORBA/OperationDef/mode:1.0 mode 1.0}\
IDL:omg.org/CORBA/OperationMode:1.0} {attribute\
{IDL:omg.org/CORBA/OperationDef/contexts:1.0 contexts 1.0}\
IDL:omg.org/CORBA/ContextIdSeq:1.0} {attribute\
{IDL:omg.org/CORBA/OperationDef/exceptions:1.0 exceptions 1.0}\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0}}} {interface\
{IDL:omg.org/CORBA/ValueMemberDef:1.0 ValueMemberDef 1.0}\
IDL:omg.org/CORBA/Contained:1.0 {{attribute\
{IDL:omg.org/CORBA/ValueMemberDef/type:1.0 type 1.0} TypeCode readonly}\
{attribute {IDL:omg.org/CORBA/ValueMemberDef/type_def:1.0 type_def 1.0}\
IDL:omg.org/CORBA/IDLType:1.0} {attribute\
{IDL:omg.org/CORBA/ValueMemberDef/access:1.0 access 1.0}\
IDL:omg.org/CORBA/Visibility:1.0}}} {interface\
{IDL:omg.org/CORBA/ExtAttributeDef:1.0 ExtAttributeDef 1.0}\
IDL:omg.org/CORBA/AttributeDef:1.0 {{attribute\
{IDL:omg.org/CORBA/ExtAttributeDef/get_exceptions:1.0 get_exceptions 1.0}\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {attribute\
{IDL:omg.org/CORBA/ExtAttributeDef/set_exceptions:1.0 set_exceptions 1.0}\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {operation\
{IDL:omg.org/CORBA/ExtAttributeDef/describe_attribute:1.0 describe_attribute\
1.0} IDL:omg.org/CORBA/ExtAttributeDescription:1.0 {} {}}}} {typedef\
{IDL:omg.org/CORBA/LocalInterfaceDefSeq:1.0 LocalInterfaceDefSeq 1.0}\
{sequence IDL:omg.org/CORBA/LocalInterfaceDef:1.0}} {struct\
{IDL:omg.org/CORBA/ModuleDescription:1.0 ModuleDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0}} {}} {struct\
{IDL:omg.org/CORBA/ConstantDescription:1.0 ConstantDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {type TypeCode} {value any}} {}} {struct\
{IDL:omg.org/CORBA/TypeDescription:1.0 TypeDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {type TypeCode}} {}} {struct\
{IDL:omg.org/CORBA/InterfaceDescription:1.0 InterfaceDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{defined_in IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {base_interfaces\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0}} {}} {interface\
{IDL:omg.org/CORBA/InterfaceAttrExtension:1.0 InterfaceAttrExtension 1.0} {}\
{{struct\
{IDL:omg.org/CORBA/InterfaceAttrExtension/ExtFullInterfaceDescription:1.0\
ExtFullInterfaceDescription 1.0} {{name IDL:omg.org/CORBA/Identifier:1.0} {id\
IDL:omg.org/CORBA/RepositoryId:1.0} {defined_in\
IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {operations\
IDL:omg.org/CORBA/OpDescriptionSeq:1.0} {attributes\
IDL:omg.org/CORBA/ExtAttrDescriptionSeq:1.0} {base_interfaces\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {type TypeCode}} {}} {operation\
{IDL:omg.org/CORBA/InterfaceAttrExtension/describe_ext_interface:1.0\
describe_ext_interface 1.0}\
IDL:omg.org/CORBA/InterfaceAttrExtension/ExtFullInterfaceDescription:1.0 {}\
{}} {operation\
{IDL:omg.org/CORBA/InterfaceAttrExtension/create_ext_attribute:1.0\
create_ext_attribute 1.0} IDL:omg.org/CORBA/ExtAttributeDef:1.0 {{in id\
IDL:omg.org/CORBA/RepositoryId:1.0} {in name\
IDL:omg.org/CORBA/Identifier:1.0} {in version\
IDL:omg.org/CORBA/VersionSpec:1.0} {in type IDL:omg.org/CORBA/IDLType:1.0}\
{in mode IDL:omg.org/CORBA/AttributeMode:1.0} {in get_exceptions\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0} {in set_exceptions\
IDL:omg.org/CORBA/ExceptionDefSeq:1.0}} {}}}} {interface\
{IDL:omg.org/CORBA/ExtInterfaceDef:1.0 ExtInterfaceDef 1.0}\
{IDL:omg.org/CORBA/InterfaceDef:1.0\
IDL:omg.org/CORBA/InterfaceAttrExtension:1.0} {}} {interface\
{IDL:omg.org/CORBA/ExtAbstractInterfaceDef:1.0 ExtAbstractInterfaceDef 1.0}\
{IDL:omg.org/CORBA/ExtInterfaceDef:1.0\
IDL:omg.org/CORBA/AbstractInterfaceDef:1.0\
IDL:omg.org/CORBA/InterfaceAttrExtension:1.0} {}} {interface\
{IDL:omg.org/CORBA/ExtLocalInterfaceDef:1.0 ExtLocalInterfaceDef 1.0}\
{IDL:omg.org/CORBA/ExtInterfaceDef:1.0\
IDL:omg.org/CORBA/LocalInterfaceDef:1.0\
IDL:omg.org/CORBA/InterfaceAttrExtension:1.0} {}} {struct\
{IDL:omg.org/CORBA/ValueDescription:1.0 ValueDescription 1.0} {{name\
IDL:omg.org/CORBA/Identifier:1.0} {id IDL:omg.org/CORBA/RepositoryId:1.0}\
{is_abstract boolean} {is_custom boolean} {defined_in\
IDL:omg.org/CORBA/RepositoryId:1.0} {version\
IDL:omg.org/CORBA/VersionSpec:1.0} {supported_interfaces\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {abstract_base_values\
IDL:omg.org/CORBA/RepositoryIdSeq:1.0} {is_truncatable boolean} {base_value\
IDL:omg.org/CORBA/RepositoryId:1.0}} {}}}}}

#
# ----------------------------------------------------------------------
# Helper functions.
# ----------------------------------------------------------------------
#

#
# Print a huge (tcl-code) string, not more than 80 chars per line.
#

proc DumpIt {file data} {
    set where 0
    set data [string trimleft $data]
    while {$data != ""} {
	set idx [string first " " $data]
	if {$idx == -1} {
	    set idx [string length $data]
	}
	if {$idx + $where > 76 && $where != 0} {
	    puts -nonewline $file "\\\n"
	    set where 0
	} elseif {$where != 0} {
	    puts -nonewline $file " "
	    incr where
	}
	puts -nonewline $file [string range $data 0 [expr $idx - 1]]
	set data [string trimleft [string range $data [expr $idx + 1] end]]
	set where [expr $where + $idx]
    }
    if {$where != 0} {
	puts -nonewline $file "\n"
    }
}

#
# Wait for a file to appear.
#

proc WaitForFile { file } {
    global verbose

    if {$verbose} {
	puts -nonewline "Waiting for $file to appear "
	flush stdout
    }

    for {set i 0} {$i < 50} {incr i} {
	if {[file readable $file]} {
	    set f [open $file]
	    set d [gets $f]
	    close $f
	    if {$d != "" } {
		if {$verbose} {
		    puts " ok."
		}
		return 1
	    }
	}
	if {$verbose} {
	    puts -nonewline "."
	    flush stdout
	}
	after 500
    }

    if {$verbose} {
	puts " failed."
    }

    puts "pwd [pwd], could not read $file"
    return 0
}

#
# ----------------------------------------------------------------------
# "main"
# ----------------------------------------------------------------------
#

#
# Load Interface Repository type information.
#

if {$verbose} {
    puts -nonewline "Feeding local IFR with IFR info ... "
    flush stdout
}

if {[catch {
    combat::ir add $_ir_ir
} err]} {
    puts stderr "init error: $err"
    exit 1
}

if {$verbose} {
    puts " done."
}

#
# If the --ifr command-line option was not used, start the interface
# repository and feed it the IDL files.
#

if {$irior == ""} {
    #
    # Start Interface Repository.
    #

    catch {file delete ir.ior}

    if {[catch {
	if {$verbose} {
	    puts -nonewline "Starting up IFR ... "
	    flush stdout
	}

	set cmd $ifr

	switch $ORB {
	    MICO {
		lappend cmd "--ior" "ir.ior"
	    }
	    ORBacus {
		lappend cmd "--ior" ">" "ir.ior"
	    }
	    TAO {
		lappend cmd "-o" "ir.ior"
	    }
	    default {
		#
		# Assume that the user has provided the correct options.
		#
	    }
	}

	lappend cmd "&"

	if {$verbose >= 2} {
	    puts "$cmd"
	}

	set pid [eval exec $cmd]

	if {$verbose} {
	    puts " running, pid $pid."
	}

	if {![WaitForFile ir.ior]} {
	    error "oops, IFR did not start up."
	}

	#
	# We could pass a file:// IOR to $ifrfeed, but reading the file and
	# passing an IOR: string instead avoids any problems with (a) drive
	# names on Windows and (b) whitespace in the path name.
	#

	set file [open "ir.ior"]
	set irior [string trim [read $file]]
	close $file

	#
	# Feed IDL files to Interface Repository.
	#

	foreach file $infiles {
	    if {$verbose} {
		puts -nonewline "Feeding $file to IFR ... "
		flush stdout
	    }

	    set cmd $idl

	    lappend cmd "-ORBInitRef" "InterfaceRepository=$irior"

	    foreach opt $idlopts {
		lappend cmd $idlopts
	    }

	    lappend cmd $file

	    switch $ORB {
		TAO {
		    #
		    # tao_ifr prints "processing <file>" to standard error.  That
		    # makes "exec" think that the process has failed.  Redirect to
		    # standard out.
		    #

		    lappend cmd "2>@" "stdout"
		}
	    }

	    if {$verbose >= 2} {
		puts "$cmd"
	    }

	    eval exec $cmd

	    if {$verbose} {
		puts " done."
	    }
	}
    } err]} {
	puts stderr "$err"
	catch {kill $pid}
	exit 1
    }
} else {
    set pid 0
}

#
# Connect to the Interface Repsoitory and dump its contents.
#

if {[catch {
    if {$verbose} {
	puts -nonewline "Building dependency tree ... "
	flush stdout
    }

    set ir [corba::string_to_object $irior]

    if {![$ir _is_a IDL:omg.org/CORBA/Repository:1.0]} {
	error "oops, IOR does not smell like an Interface Repository"
    }

    set objs [Deps::BuildDeps $ir]

    if {$verbose} {
	puts " done."
    }

    if {$verbose >= 3} {
	puts "--- Postorder"
	puts "$objs"
	puts "---"
    }
    
    if {$verbose} {
	puts -nonewline "Generating Tcl code ... "
	flush stdout
    }

    set data [CodeGen::CodeGen $ir $objs]

    if {$verbose} {
	puts " done."
    }

    if {$verbose >= 3} {
	puts "--- Data"
	puts "$data"
	puts "---"
    }

    #
    # Generate Tcl file to feed local Interface Repository from
    #

    if {$verbose} {
	puts -nonewline "Writing output file \"${outbase}.tcl\" ... "
	flush stdout
    }

    set out [open "${outbase}.tcl" w]
    puts $out "#"
    puts $out "# This file was automatically generated from $infiles"
    puts $out "# by idl2tcl. Do not edit."
    puts $out "#"
    puts $out ""
    puts $out "package require combat"
    puts $out ""
    puts $out "combat::ir add \\"
    DumpIt $out [list $data]
    puts $out ""
    close $out

    if {$verbose} {
	puts " done."
    }

    #
    # Generate implementation template
    #

    if {$implflag == "yes"} {
	if {[file exists ${outbase}_impl.tcl]} {
	    puts stderr "warning: Output file ${outbase}_impl.tcl exists."
	} else {
	    if {$verbose} {
		puts -nonewline "Writing skeleton template file \"${outbase}_impl.tcl\" ... "
		flush stdout
	    }
	    set out [open "${outbase}_impl.tcl" w]
	    ImplGen::ImplGen $ir $objs $out
	    close $out
	    if {$verbose} {
		puts " done."
	    }
	}
    }
} res]} {
    puts ""
    puts stderr "Oops, Error:"
    puts stderr $errorInfo
    if {$pid} {
	if {$verbose} {
	    puts -nonewline "Killing IFR daemon ... "
	    flush stdout
	}

	catch {kill $pid}
	catch {file delete ir.ior}

	if {$verbose} {
	    puts " done."
	}
    }
    catch {file delete "${outbase}.tcl"}
    exit 1
}

if {$pid} {
    if {$verbose} {
	puts -nonewline "Killing IFR daemon ... "
	flush stdout
    }

    catch {kill $pid}
    catch {file delete ir.ior}

    if {$verbose} {
	puts " done."
    }
}