summaryrefslogtreecommitdiff
path: root/includes/mwcc_decomp.h
blob: 5efb2a1514b62fe86c1a3e78186842ef7194d271 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
#pragma once
#include "common.h"
#include "oslib.h"
#include "macemul.h"

#ifdef __cplusplus
extern "C" {
#endif

/********************************/
/* Option Fuckery */
#ifdef	__MWERKS__
#pragma options align=packed
#endif
typedef struct PARAM_T {
    char which;
    char flags;
    char *myname;
    struct PARAM_T *next;
} PARAM_T;
typedef struct MASK_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    char size;
    UInt32 ormask;
    UInt32 andmask;
    void *num;
} MASK_T;
typedef struct STRING_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    SInt16 maxlen;
    Boolean pstring;
    char *str;
} STRING_T;
typedef struct SET_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    char size;
    UInt32 value;
    char *num;
} SET_T;
typedef struct SETSTRING_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    char *value;
    char pstring;
    void *var;
} SETSTRING_T;
typedef struct GENERIC_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    int (*parse)(const char *opt, void *var, const char *pstr, int flags);
    void *var;
    char *help;
} GENERIC_T;
typedef struct SETTING_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    int (*parse)(const char *a, const char *b); // TODO name these args
    char *valuename;
} SETTING_T;
typedef struct TOGGLE_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    char size;
    UInt32 mask;
    void *num;
} TOGGLE_T;
typedef struct NUM_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    char size;
    char fit;
    UInt32 lo;
    UInt32 hi;
    void *num;
} NUM_T;
typedef struct FILEPATH_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    char fflags;
    char *defaultstr;
    void *filename;
    int maxlen;
} FILEPATH_T;
typedef struct IFARG_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    PARAM_T *parg;
    char *helpa;
    PARAM_T *pnone;
    char *helpn;
} IFARG_T;
typedef struct ONOFF_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    unsigned char *var;
} ONOFF_T;
typedef struct OFFON_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    unsigned char *var;
} OFFON_T;
typedef struct FTYPE_T {
    char which;
    char flags;
    char *myname;
    PARAM_T *next;
    OSType *fc;
    Boolean iscreator;
} FTYPE_T;
typedef struct OptionList {
    char *help;
    int flags;
    struct Option **list;
} OptionList;
typedef struct Option {
    char *names;
    int avail;
    PARAM_T *param;
    OptionList *sub;
    OptionList *conflicts;
    char *help;
} Option;
enum {
    HELPFLAGS_1 = 1,
    HELPFLAGS_IGNORED = 2,
    HELPFLAGS_OBSOLETE = 4,
    HELPFLAGS_DEPRECATED = 8,
    HELPFLAGS_SECRET = 0x10,
    HELPFLAGS_MEANINGLESS = 0x20,
    HELPFLAGS_COMPATIBLE = 0x40,
    HELPFLAGS_NORMAL = 0x80, // andmask = 0xE?
    HELPFLAGS_SPACES = 0x100,
    HELPFLAGS_TOOL = 0x200,
    HELPFLAGS_TOOL_THIS = 0x400,
    HELPFLAGS_TOOL_OTHER = 0x800,
    HELPFLAGS_TOOL_BOTH = 0xC00,
    HELPFLAGS_1000 = 0x1000,
    HELPFLAGS_2000 = 0x2000,
    HELPFLAGS_USAGE = 0x4000,
    HELPFLAGS_8000 = 0x8000
};
enum {
    OTF_GLOBAL = 1,
    OTF2 = 2,
    OTF_CASED = 4,
    OTF_OBSOLETE = 8,
    OTF_SUBSTITUTED = 0x10,
    OTF_DEPRECATED = 0x20,
    OTF_TOOL_LINKER = 0x40,
    OTF_TOOL_DISASSEMBLER = 0x80,
    OTF_TOOL_COMPILER = 0x100,
    OTF_TOOL_MASK = OTF_TOOL_LINKER | OTF_TOOL_DISASSEMBLER | OTF_TOOL_COMPILER,
    OTF200 = 0x200,
    OTF400 = 0x400,
    OTF700 = 0x700,
    OTF_IGNORED = 0x800,
    OTFC00 = 0xC00,
    OTF_SECRET = 0x1000,
    OTF2000 = 0x2000,
    OTF_COMPATIBILITY = 0x4000,
    OTF8000 = 0x8000,
    OTF10000 = 0x10000,
    OTF20000 = 0x20000,
    OTF40000 = 0x40000,
    OTF_WARNING = 0x80000,
    OTF_SLFLAGS_8 = 0x100000,
    OTF_SLFLAGS_10 = 0x200000,
    OTF_SLFLAGS_20 = 0x400000,
    OTF_SLFLAGS_MASK = OTF_SLFLAGS_8 | OTF_SLFLAGS_10 | OTF_SLFLAGS_20,
    OTF_MEANINGLESS = 0x800000,
    OTF_ALL_HIDDEN_BY_DEFAULT = OTF_OBSOLETE | OTF_DEPRECATED | OTF_IGNORED | OTF_SECRET | OTF_MEANINGLESS,
    OTF1000000 = 0x1000000,
    OTF2000000 = 0x2000000,
    OTF4000000 = 0x4000000,
    OTF8000000 = 0x8000000,
    OTF10000000 = 0x10000000,
    OTF20000000 = 0x20000000,
    OTF40000000 = 0x40000000,
    OTF80000000 = 0x80000000
};

enum {
    PARAMWHICH_None = 0,
    PARAMWHICH_FTypeCreator = 1,
    PARAMWHICH_FilePath = 2,
    PARAMWHICH_Number = 3,
    PARAMWHICH_String = 4,
    PARAMWHICH_Id = 5,
    PARAMWHICH_Sym = 6,
    PARAMWHICH_OnOff = 7,
    PARAMWHICH_OffOn = 8,
    PARAMWHICH_Mask = 9,
    PARAMWHICH_Toggle = 0xA,
    PARAMWHICH_Set = 0xB,
    PARAMWHICH_SetString = 0xC,
    PARAMWHICH_Generic = 0xD,
    PARAMWHICH_IfArg = 0xE,
    PARAMWHICH_Setting = 0xF,
    PARAMWHICH_MAX = 0x10
};
enum {
    PARAMFLAGS_1 = 1,
    PARAMFLAGS_2 = 2,
    PARAMFLAGS_3 = 3,
    PARAMFLAGS_4 = 4,
    PARAMFLAGS_8 = 8,
    PARAMFLAGS_10 = 0x10,
    PARAMFLAGS_12 = 0x12
};
enum {
    PARAMPARSEFLAGS_0 = 0,
    PARAMPARSEFLAGS_1 = 1,
    PARAMPARSEFLAGS_2 = 2,
    PARAMPARSEFLAGS_4 = 4,
    PARAMPARSEFLAGS_8 = 8,
    PARAMPARSEFLAGS_10 = 0x10,
    PARAMPARSEFLAGS_20 = 0x20,
    PARAMPARSEFLAGS_40 = 0x40,
    PARAMPARSEFLAGS_80 = 0x80,
    PARAMPARSEFLAGS_100 = 0x100
};
enum {
    SLFLAGS_1 = 1,
    SLFLAGS_2 = 2,
    SLFLAGS_4 = 4, // displays =...
    SLFLAGS_8 = 8, // displays [no] -- produces e.g. [no]err[or] | [no]iserr[or], [no]implicit[conv]
    SLFLAGS_10 = 0x10, // displays [-]
    SLFLAGS_20 = 0x20, // displays [no-]
    SLFLAGS_40 = 0x40
};
enum {
    LISTFLAGS_NONE = 0,
    LISTFLAGS_2 = 2,
    LISTFLAGS_4 = 4,
    LISTFLAGS_COMPILER = 0x100,
    LISTFLAGS_LINKER = 0x200,
    LISTFLAGS_DISASSEMBLER = 0x400,
    LISTFLAGS_TOOL_MASK = LISTFLAGS_COMPILER | LISTFLAGS_LINKER | LISTFLAGS_DISASSEMBLER
};
#ifdef	__MWERKS__
#pragma options align=reset
#endif


struct IDEAccessPath {
    FSSpec pathSpec;
    Boolean recursive;
    SInt32 subdirectoryCount;
    FSSpec *subdirectories;
};

struct IDEAccessPathList {
    SInt32 userPathCount;
    struct IDEAccessPath *userPaths;
    SInt32 systemPathCount;
    struct IDEAccessPath *systemPaths;
    unsigned char alwaysSearchUserPaths;
    unsigned char convertPaths;
};

#ifdef	__MWERKS__
#pragma options align=mac68k
#endif
typedef struct CWObjectFlags {
    SInt16 version;
    SInt32 flags;
    const char *objFileExt;
    const char *brsFileExt;
    const char *ppFileExt;
    const char *disFileExt;
    const char *depFileExt;
    const char *pchFileExt;
    OSType objFileCreator;
    OSType objFileType;
    OSType brsFileCreator;
    OSType brsFileType;
    OSType ppFileCreator;
    OSType ppFileType;
    OSType disFileCreator;
    OSType disFileType;
    OSType depFileCreator;
    OSType depFileType;
} CWObjectFlags;

typedef struct CWIDEInfo {
    UInt16 majorVersion;
    UInt16 minorVersion;
    UInt16 bugFixVersion;
    UInt16 buildVersion;
    UInt16 dropinAPIVersion;
} CWIDEInfo;

typedef struct DropInFlags {
    SInt16 rsrcversion;
    OSType dropintype;
    UInt16 earliestCompatibleAPIVersion;
    UInt32 dropinflags;
    OSType edit_language;
    UInt16 newestAPIVersion;
} DropInFlags;

typedef struct CWPanelList {
    SInt16 version;
    SInt16 count;
    const char **names;
} CWPanelList;

typedef struct CWFamily {
    OSType type;
    const char *name;
} CWFamily;

typedef struct CWFamilyList {
    SInt16 version;
    SInt16 count;
    CWFamily *families;
} CWFamilyList;

typedef struct CWTargetList {
    SInt16 version;
    SInt16 cpuCount;
    OSType *cpus;
    SInt16 osCount;
    OSType *oss;
} CWTargetList;

typedef struct CWExtensionMapping {
    OSType type;
    char extension[32];
    UInt32 flags;
} CWExtensionMapping;

typedef struct CWExtMapList {
    SInt16 version;
    SInt16 nMappings;
    CWExtensionMapping *mappings;
} CWExtMapList;

typedef struct CWHelpInfo {
    SInt16 version;
    const char *helpFileName;
} CWHelpInfo;
#ifdef	__MWERKS__
#pragma options align=reset
#endif

struct CW_BasePluginCallbacks {
    void (*cbGetFileInfo)();
    void (*cbFindAndLoadFile)();
    void (*cbGetFileText)();
    void (*cbReleaseFileText)();
    void (*cbGetSegmentInfo)();
    void (*cbGetOverlay1GroupInfo)();
    void (*cbGetOverlay1Info)();
    void (*cbGetOverlay1FileInfo)();
    void (*cbReportMessage)();
    void (*cbAlert)();
    void (*cbShowStatus)();
    void (*cbUserBreak)();
    void (*cbGetNamedPreferences)();
    void (*cbStorePluginData)();
    void (*cbGetPluginData)();
    void (*cbSetModDate)();
    void (*cbAddProjectEntry)();
    void (*cbCreateNewTextDocument)();
    void (*cbAllocateMemory)();
    void (*cbFreeMemory)();
    void (*cbAllocMemHandle)();
    void (*cbFreeMemHandle)();
    void (*cbGetMemHandleSize)();
    void (*cbResizeMemHandle)();
    void (*cbLockMemHandle)();
    void (*cbUnlockMemHandle)();
    void *cbInternal[8];
    void (*cbGetTargetName)();
    void (*cbCacheAccessPathList)();
    void (*cbPreDialog)();
    void (*cbPostDialog)();
    void (*cbPreFileAction)();
    void (*cbPostFileAction)();
    void (*cbCheckoutLicense)();
    void (*cbCheckinLicense)();
    void (*cbResolveRelativePath)();
};
struct CWCompilerLinkerCallbacks {
    void (*cbCachePrecompiledHeader)();
    void (*cbLoadObjectData)();
    void (*cbStoreObjectData)();
    void (*cbFreeObjectData)();
    void (*cbDisplayLines)();
    void (*cbBeginSubCompile)();
    void (*cbEndSubCompile)();
    void (*cbGetPrecompiledHeaderSpec)();
    void (*cbPutResourceFile)();
    void (*cbGetResourceFile)();
    void (*cbLookUpUnit)();
    void (*cbSBMfiles)();
    void (*cbStoreUnit)();
    void (*cbReleaseUnit)();
    void (*cbUnitNameToFileName)();
    void (*cbOSErrorMessage)();
    void (*cbOSAlert)();
    void (*cbGetModifiedFiles)();
    void (*cbGetSuggestedObjectFileSpec)();
    void (*cbGetStoredObjectFileSpec)();
    void (*cbGetRuntimeSettings)();
    void (*cbGetFrameworkCount)();
    void (*cbGetFrameworkInfo)();
    void (*cbGetFrameworkSharedLibrary)();
};
struct CWParserCallbacks {
    void (*cbParserAddAccessPath)();
    void (*cbParserSwapAccessPaths)();
    void (*cbParserSetNamedPreferences)();
    void (*cbParserSetFileOutputName)();
    void (*cbParserSetOutputFileDirectory)();
    void (*cbParserAddOverlay1Group)();
    void (*cbParserAddOverlay1)();
    void (*cbParserAddSegment)();
    void (*cbParserSetSegment)();
};

struct CWPluginPrivateContext {
    SInt32 request;
    SInt32 apiVersion;
    void *shellContext;
    void *pluginStorage;
    FSSpec projectFile;
    FSSpec outputFileDirectory;
    OSType shellSignature;
    OSType pluginType;
    SInt32 numFiles;
    SInt32 numOverlayGroups;
    OSErr callbackOSError;
    OSErr pluginOSError;
    CWIDEInfo *shellInfo;
    struct IDEAccessPathList *accessPathList;
    SInt32 dontEatEvents;
    FSSpec *targetDataDirectorySpec;
    SInt32 reserved[17];
    struct CW_BasePluginCallbacks *callbacks;
};

// Pref panels
#ifdef	__MWERKS__
#pragma options align=mac68k
#endif
typedef struct PCmdLine {
    SInt16 version;
    SInt16 state;
    SInt16 stages;
    SInt16 toDisk;
    SInt16 outNameOwner;
    Boolean dryRun;
    Boolean debugInfo;
    SInt16 verbose;
    Boolean showLines;
    Boolean timeWorking;
    Boolean noWarnings;
    Boolean warningsAreErrors;
    Boolean maxErrors;
    Boolean maxWarnings;
    SInt16 msgStyle;
    Boolean noWrapOutput;
    Boolean stderr2stdout;
    Boolean noCmdLineWarnings;
} PCmdLine;
typedef struct PCmdLineCompiler {
    SInt16 version;
    Boolean noSysPath;
    Boolean noFail;
    SInt16 includeSearch;
    char linkerName[64];
    char objFileExt[15];
    char brsFileExt[15];
    char ppFileExt[15];
    char disFileExt[15];
    char depFileExt[15];
    char pchFileExt[15];
    OSType objFileCreator;
    OSType objFileType;
    OSType brsFileCreator;
    OSType brsFileType;
    OSType ppFileCreator;
    OSType ppFileType;
    OSType disFileCreator;
    OSType disFileType;
    OSType depFileCreator;
    OSType depFileType;
    Boolean compileIgnored;
    Boolean relPathInOutputDir;
    Boolean browserEnabled;
    Boolean depsOnlyUserFiles;
    char outMakefile[256];
    SInt8 forcePrecompile;
    Boolean ignoreMissingFiles;
    Boolean printHeaderNames;
    SInt8 sbmState;
    char sbmPath[256];
    Boolean canonicalIncludes;
    Boolean keepObjects;
} PCmdLineCompiler;
typedef struct PCmdLineLinker {
    SInt16 version;
    Boolean callPreLinker;
    Boolean callPostLinker;
    Boolean keepLinkerOutput;
    Boolean callLinker;
} PCmdLineLinker;
typedef struct PCmdLineEnvir {
    SInt16 version;
    SInt16 cols;
    SInt16 rows;
    Boolean underIDE;
} PCmdLineEnvir;
typedef struct PBackEnd {
    SInt16 version;
    UInt8 structalignment;
    UInt8 tracebacktables;
    UInt8 processor;
    UInt8 readonlystrings;
    UInt8 profiler;
    UInt8 fpcontract;
    UInt8 schedule;
    UInt8 peephole;
    UInt8 processorspecific;
    UInt8 altivec;
    UInt8 vrsave;
    UInt8 autovectorize;
    UInt8 usebuiltins;
    UInt8 pic;
    UInt8 dynamic;
    UInt8 common;
    UInt8 implicit_templates;
    UInt8 reserved[3];
} PBackEnd;
typedef struct PDisassembler {
    SInt16 version;
    Boolean showcode;
    Boolean extended;
    Boolean mix;
    Boolean nohex;
    Boolean showdata;
    Boolean showexceptions;
    Boolean showsym;
    Boolean shownames;
} PDisassembler;
typedef struct PMachOLinker {
    SInt16 version;
    UInt8 linksym;
    UInt8 symfullpath;
    UInt8 suppresswarn;
    UInt8 linkmap;
    UInt8 multisymerror;
    UInt8 whatfileloaded;
    UInt8 whyfileloaded;
    UInt8 use_objectivec_semantics;
    SInt8 undefinedsymbols;
    SInt8 readonlyrelocs;
    SInt8 reserved_value1;
    SInt8 reserved_value2;
    SInt16 exports;
    SInt16 reserved_short1;
    UInt32 currentversion;
    UInt32 compatibleversion;
    SInt32 reserved_long1;
    char mainname[64];
    UInt8 prebind;
    UInt8 dead_strip;
    UInt8 twolevel_namespace;
    UInt8 strip_debug_symbols;
} PMachOLinker;
typedef struct PMachOProject {
    SInt16 version;
    SInt16 type;
    Str63 outfile;
    OSType filecreator;
    OSType filetype;
    SInt32 stacksize;
    SInt32 stackaddress;
    SInt32 reserved1;
    SInt32 reserved2;
    SInt32 reserved3;
    SInt32 reserved4;
    SInt32 reserved5;
    SInt32 reserved6;
    SInt32 reserved7;
    SInt32 reserved8;
    SInt32 reserved9;
    SInt32 reserved10;
    SInt32 reserved11;
    SInt32 reserved12;
    SInt32 reserved13;
    SInt32 reserved14;
    SInt32 reserved15;
    SInt32 reserved16;
    SInt32 reserved17;
    SInt32 reserved18;
    SInt32 reserved19;
    SInt32 reserved20;
    UInt8 flatrsrc;
    UInt8 filler1;
    UInt8 filler2;
    UInt8 filler3;
    Str63 separateflatfile;
    Str255 installpath;
} PMachOProject;
typedef struct {
    SInt16 version;
    Boolean userSetCreator;
    Boolean userSetType;
    Boolean gPrintMapToStdOutput;
    Str255 mapfilename;
    Str255 symfilename;
} PCLTExtras;
#ifdef	__MWERKS__
#pragma options align=reset
#endif

typedef struct CWCommandLineArgs {
    int argc;
    char **argv;
    char **envp;
} CWCommandLineArgs;

typedef struct VersionInfo {
    UInt16 major;
    UInt16 minor;
    UInt16 patch;
    UInt16 build;
} VersionInfo;

typedef struct CLPluginInfo {
    OSType plugintype;
    OSType language;
    SInt32 dropinflags;
    char *version;
    Boolean storeCommandLine;
} CLPluginInfo;

typedef struct ToolVersionInfo {
    char *company;
    char *product;
    char *tool;
    char *copyright;
    char *version;
} ToolVersionInfo;

// may not actually be named this
struct ParseOptsType {
    struct CWPluginPrivateContext *context;
    char helpKey[64];
    SInt32 helpFlags;
    UInt16 ioCols;
    UInt16 ioRows;
    CWCommandLineArgs *args;
    ToolVersionInfo *toolVersion;
    int numPlugins;
    CLPluginInfo *plugins;
    int numPanels;
    char **panelNames;
    OSType cpu;
    OSType os;
    char lastoutputname[256];
    SInt32 currentSegment;
    SInt32 currentOverlayGroup;
    SInt32 currentOverlay;
    int possibleFiles;
    int userSpecifiedFiles;
    int unusedFiles;
    Boolean hadAnyOutput;
    Boolean hadErrors;
    Boolean showHelp;
    Boolean underIDE;
    Boolean alwaysUsePaths;
    Boolean noOptions;
    Boolean printedVersion;
    Boolean passingArgs;
    Boolean disToFile;
    Boolean ppToFile;
    Boolean initBefore;
    Boolean weakImport;
    Boolean mergeIntoOutput;
    Boolean success;
    Boolean ignoreUnknown;
    UInt8 unused[2];
};

typedef struct {
    int argc;
    const char **argv;
    OSType cpu;
    OSType os;
    OSType plugintype;
    OSType language;
    OSType parserstyle;
    OSSpec programSpec;
    const char *programName;
    SInt16 countWarnings;
    SInt16 countErrors;
    Boolean pluginDebug;
    Boolean userBreak;
    Boolean withholdWarnings;
    Boolean withholdErrors;
    OSSpec makefileSpec;
    OSPathSpec sbmPathSpec;
    OSHandle browseTableHandle;
    const char *stdout_base;
    int stdout_written;
} CLState; // assumed name

typedef struct BasePluginCallbacks {
    SInt16 (*main)(void *context);
    SInt16 (*GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize);
    SInt16 (*GetDisplayName)(const char **displayName);
    SInt16 (*GetDropInName)(const char **dropInName);
    SInt16 (*GetPanelList)(const CWPanelList **panelList);
    SInt16 (*GetFamilyList)(const CWFamilyList **familyList);
    SInt16 (*GetHelpInfo)(const CWHelpInfo **helpInfo);
    SInt16 (*GetVersionInfo)(const VersionInfo **versionInfo);
    SInt16 (*GetFileTypeMappings)(const OSFileTypeMappingList **mappingList);
} BasePluginCallbacks;

typedef struct CompilerLinkerPluginCallbacks {
    SInt16 (*GetTargetList)(const struct CWTargetList **targetList);
    SInt16 (*GetDefaultMappingList)();
    SInt16 (*Unmangle)();
    SInt16 (*BrSymbolEntryPoint)();
    SInt16 (*GetObjectFlags)();
    SInt16 (*WriteObjectFile)();
} CompilerLinkerPluginCallbacks;

typedef struct ParserPluginCallbacks {
    SInt16 (*SupportsPlugin)();
    SInt16 (*SupportsPanels)();
} ParserPluginCallbacks;

typedef struct {
    char *name;
    void *ptr;
    SInt32 size;
} PrefDataPanel; // assumed name

typedef struct {
    OSType TYPE;
    OSType LANG;
    OSType CPU;
    OSType OS;
    int numPrefPanels;
    char **prefPanels;
    char *toolInfo;
    char *copyright;
    int numOptionLists;
    OptionList **optionLists;
    int numPrefDataPanels;
    PrefDataPanel *prefDataPanels;
    int (*PreParse)(); // sig?
    int (*MidParse)(); // sig?
    int (*PostParse)(); // sig?
} ParserTool; // assumed name

// I think this is internally defined in its .c file
// pro8 mwcc refers to it as =s0
typedef struct PrefPanel {
    char *name;
    Handle data;
    Handle workData;
    struct PrefPanel *next;
} PrefPanel;

// CLAccessPaths
typedef struct Paths {
    struct Path **pathsArray;
    UInt16 arraySize;
    UInt16 pathsCount;
} Paths;

typedef struct Frameworks {
    struct Paths_FWInfo **fwsArray;
    UInt16 arraySize;
    UInt16 fwsCount;
} Frameworks;

typedef struct Path {
    OSPathSpec *spec;
    Paths *recursive;
    char *dirlist;
    SInt16 flags;
} Path;

typedef struct Paths_FWInfo {
    OSSpec fileSpec;
    OSPathSpec version;
    OSPathSpec name;
    Path *path;
    Boolean hidden;
} Paths_FWInfo;

// CLDependencies
typedef struct InclFile {
    SInt32 filenameoffs;
    Path *accesspath;
    Path *globalpath;
    Path *specialpath;
    Boolean syspath;
} InclFile;

typedef struct Incls {
    struct Target *targ;
    SInt32 numincls;
    SInt32 maxincls;
    InclFile *files;
    SInt32 buflen;
    SInt32 bufpos;
    char *buffer;
    Paths *allPaths;
} Incls;

typedef struct Deps {
    int numDeps;
    int maxDeps;
    SInt32 *list;
    Incls *incls;
} Deps;

// CLFiles
typedef struct File {
    struct File *next;
    SInt32 filenum;
    UInt16 segnum;
    SInt32 srcmoddate;
    SInt32 outmoddate;
    char srcfilename[256];
    char outfilename[256];
    SInt16 outfileowner;
    OSSpec srcfss;
    OSSpec outfss;
    SInt16 writeToDisk;
    SInt16 wroteToDisk;
    SInt16 tempOnDisk;
    struct Plugin *compiler;
    SInt32 dropinflags;
    SInt32 objectflags;
    SInt32 mappingflags;
    SInt16 sourceUsage;
    SInt16 objectUsage;
    Handle textdata;
    Handle objectdata;
    Handle browsedata;
    SInt32 codesize;
    SInt32 udatasize;
    SInt32 idatasize;
    SInt32 compiledlines;
    Boolean recompileDependents;
    Boolean gendebug;
    Boolean hasobjectcode;
    Boolean hasresources;
    Boolean isresourcefile;
    Boolean weakimport;
    Boolean initbefore;
    Boolean mergeintooutput;
    Deps deps;
    Boolean recordbrowseinfo;
    SInt16 browseFileID;
    char browseoptions[32];
    OSType filetype;
    OSType filecreator;
} File;

typedef struct Files {
    File *fileList;
    SInt32 fileCount;
} Files;

typedef struct VFile {
    char displayName[32];
    Handle data;
    struct VFile *next;
} VFile;

// CLOverlays
typedef struct OvlAddr {
    UInt32 lo, hi;
} OvlAddr;

typedef struct Overlay {
    char name[256];
    SInt32 *list;
    SInt32 cnt;
    SInt32 max;
    struct Overlay *next;
} Overlay;

typedef struct OvlGroup {
    char name[256];
    OvlAddr addr;
    Overlay *olys;
    Overlay *lastoly;
    int olycnt;
    struct OvlGroup *next;
} OvlGroup;

typedef struct Overlays {
    OvlGroup *groups;
    OvlGroup *lastgrp;
    SInt32 grpcnt;
} Overlays;

// CLSegs
typedef struct Segment {
    char name[32];
    SInt16 attrs;
} Segment;

typedef struct Segments {
    Segment **segsArray;
    UInt16 arraySize;
    UInt16 segsCount;
} Segments;

// CLTarg
// Is this actually in Pro7? Not sure
typedef struct CLTargetInfo {
    OSType targetCPU;
    OSType targetOS;
    SInt16 outputType;
    SInt16 linkType;
    Boolean canRun;
    Boolean canDebug;
    OSSpec outfile;
    OSSpec symfile;
    OSSpec runfile;
    OSSpec linkAgainstFile;
} CLTargetInfo;
typedef struct CWTargetInfo {
    SInt16 outputType;
    FSSpec outfile;
    FSSpec symfile;
    FSSpec runfile;
    SInt16 linkType;
    Boolean canRun;
    Boolean canDebug;
    OSType targetCPU;
    OSType targetOS;
    OSType outfileCreator;
    OSType outfileType;
    OSType debuggerCreator;
    OSType runHelperCreator;
    FSSpec linkAgainstFile;
} CWTargetInfo;
typedef struct Target {
    struct BuildInfo {
        UInt32 linesCompiled;
        UInt32 codeSize;
        UInt32 iDataSize;
        UInt32 uDataSize;
    } info;
    CWTargetInfo *targetinfo;
    struct {
        Segments segs;
        Overlays overlays;
    } linkage;
    SInt32 linkmodel;
    Files files;
    Files pchs;
    Incls incls;
    Paths sysPaths;
    Paths userPaths;
    OSType lang;
    OSType cpu;
    OSType os;
    char targetName[64];
    struct Plugin *preLinker;
    struct Plugin *linker;
    struct Plugin *postLinker;
    UInt32 preLinkerDropinFlags;
    UInt32 linkerDropinFlags;
    UInt32 postLinkerDropinFlags;
    OSPathSpec outputDirectory;
    VFile *virtualFiles;
    struct Target *next;
} Target;

typedef struct Plugin {
    BasePluginCallbacks *cb;
    CompilerLinkerPluginCallbacks *cl_cb;
    ParserPluginCallbacks *pr_cb;
    void *context;
    char *cached_ascii_version;
    struct Plugin *next;
} Plugin;

typedef struct Token {
    int x0;
    void *x4;
} Token;

/********************************/
/* command_line/CmdLine/Src/Clients/CLStaticMain.c */
extern int main(int argc, const char **argv);

/********************************/
/* command_line/CmdLine/Src/Clients/ClientGlue.c */
extern int RegisterResource(const char *name, SInt16 rsrcid, Handle list);
extern int RegisterStaticPlugin(const BasePluginCallbacks *callbacks);
extern int RegisterStaticCompilerLinkerPlugin(const BasePluginCallbacks *callbacks, const CompilerLinkerPluginCallbacks *cl_callbacks);
extern int RegisterStaticParserPlugin(const BasePluginCallbacks *cb, const ParserPluginCallbacks *pr_callbacks);
extern void SetBuildTarget(OSType cpu, OSType os);
extern void SetParserType(OSType plang);
extern void SetPluginType(OSType lang, OSType type);
extern int CmdLine_Initialize(int argc, const char **argv, const char *builddate, const char *buildtime);
extern int CmdLine_Driver();
extern int CmdLine_Terminate(int exitcode);

/********************************/
/* command_line/CmdLine/Src/CLMain.c */
extern void Main_PreParse(int *pArgc, char ***pArgv);
extern void Main_PassSpecialArgs(void *unk1, void *unk2);
extern int Main_Initialize(int argc, const char **argv);
extern int Main_Terminate(int code);
extern int Main_Driver();

/********************************/
/* command_line/CmdLine/Src/Envir/CLErrors.c */
extern void CLReportError(SInt16 errid, ...);
extern void CLReportWarning(SInt16 errid, ...);
extern void CLReport(SInt16 errid, ...);
extern void CLReportOSError(SInt16 errid, int err, ...);
extern void CLReportCError(SInt16 errid, int err_no, ...);
extern void CLInternalError(const char *file, int line, const char *format, ...);
extern void CLFatalError(const char *format, ...);

/********************************/
/* command_line/CmdLine/Src/Plugins/CLPlugins.c */
//static void GetToolVersionInfo();
extern const ToolVersionInfo *Plugin_GetToolVersionInfo();
//static const char *Plugin_GetDisplayName(Plugin *pl);
extern const char *Plugin_GetDropInName(Plugin *pl);
extern VersionInfo *Plugin_GetVersionInfo(Plugin *pl);
extern const char *Plugin_GetVersionInfoASCII(Plugin *pl);
extern DropInFlags *Plugin_GetDropInFlags(Plugin *pl);
extern OSType Plugin_GetPluginType(Plugin *pl);
extern const CWTargetList *Plugin_CL_GetTargetList(Plugin *pl);
extern const CWPanelList *Plugin_GetPanelList(Plugin *pl);
extern const CWExtMapList *Plugin_CL_GetExtMapList(Plugin *pl);
extern const OSFileTypeMappingList *Plugin_GetFileTypeMappingList(Plugin *pl);
extern const CWObjectFlags *Plugin_CL_GetObjectFlags(Plugin *pl);
extern Boolean Plugin_MatchesName(Plugin *pl, const char *name);
extern Boolean Plugin_CL_MatchesTarget(Plugin *pl, OSType cpu, OSType os, Boolean exact);
extern Boolean Plugins_CL_HaveMatchingTargets(Plugin *p1, Plugin *p2, Boolean exact);
//static CL_MatchesExtMapping(CWExtensionMapping *map, OSType type, const char *ext, Boolean exact);
extern Boolean Plugin_CL_MatchesFileType(Plugin *pl, OSType type, const char *extension, Boolean exact);
extern Boolean Plugin_MatchesType(Plugin *pl, OSType type, OSType lang, Boolean exact);
extern Boolean Plugin_Pr_MatchesPlugin(Plugin *pl, CLPluginInfo *pluginfo, OSType cpu, OSType os);
extern Boolean Plugin_Pr_MatchesPanels(Plugin *pl, int numPanels, char **panelNames);
extern Boolean Plugin_CL_WriteObjectFile(Plugin *pl, FSSpec *src, FSSpec *out, OSType creator, OSType type, OSHandle *data);
extern Boolean Plugin_CL_GetCompilerMapping(Plugin *pl, OSType type, const char *ext, UInt32 *flags);
//static Boolean SupportedPlugin(Plugin *pl, const char **reason);
//static Boolean VerifyPanels(Plugin *pl);
extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *cl_cb, const ParserPluginCallbacks *pr_cb);
extern void Plugin_Free(Plugin *pl);
extern int Plugin_VerifyPanels(Plugin *pl);
extern void Plugins_Init();
extern void Plugins_Term();
extern int Plugins_Add(Plugin *pl);
extern Plugin *Plugins_MatchName(Plugin *list, const char *name);
extern Plugin *Plugins_CL_MatchTarget(Plugin *list, OSType cpu, OSType os, OSType type, OSType lang);
extern Plugin *Plugins_CL_MatchFileType(Plugin *list, OSType type, const char *ext, Boolean exact);
extern Plugin *Plugins_GetPluginForFile(Plugin *list, OSType plugintype, OSType cpu, OSType os, OSType type, const char *ext, OSType lang);
extern Plugin *Plugins_GetLinker(Plugin *list, OSType cpu, OSType os);
extern Plugin *Plugins_GetPreLinker(Plugin *list, OSType cpu, OSType os);
extern Plugin *Plugins_GetPostLinker(Plugin *list, OSType cpu, OSType os);
extern Plugin *Plugins_GetParserForPlugin(Plugin *list, OSType style, int numPlugins, CLPluginInfo *plugins, OSType cpu, OSType os, int numPanels, char **panelNames);
extern Plugin *Plugins_GetCompilerForLinker(Plugin *list, Plugin *linker, OSType type, const char *ext, OSType edit);
extern Boolean Plugins_GetPluginList(Plugin *list, int *numPlugins, CLPluginInfo **pluginInfo);
extern Boolean Plugins_GetPrefPanelUnion(Plugin *list, int *numPanels, const char ***panelNames);
extern Boolean Plugin_AddFileTypeMappings(Plugin *pl, OSFileTypeMappingList *ftml);
extern Boolean Plugins_AddFileTypeMappingsForTarget(Plugin *list, OSFileTypeMappings **mlist, OSType cpu, OSType os);
extern SInt16 Plugin_Call(Plugin *pl, void *context);

/********************************/
/* command_line/CmdLine/Src/Callbacks/CLParserCallbacks_v1.cpp */
// haha this is a C++ nightmare

/********************************/
/* command_line/CmdLine/Src/Envir/CLIO.c */
typedef struct MessageRef {
    OSSpec sourcefile;
    OSSpec errorfile;
    char *sourceline;
    SInt32 linenumber;
    SInt32 tokenoffset;
    SInt16 tokenlength;
    SInt32 selectionoffset;
    SInt16 selectionlength;
} MessageRef;

extern void SetupDebuggingTraps();
extern Boolean IO_Initialize();
extern Boolean IO_Terminate();
extern Boolean IO_HelpInitialize();
extern Boolean IO_HelpTerminate();
extern void FixHandleForIDE(OSHandle *text);
extern Boolean ShowHandle(OSHandle *text, Boolean decorate);
extern Boolean WriteHandleToFile(OSSpec *spec, OSHandle *text, OSType creator, OSType type);
extern Boolean WriteBinaryHandleToFile(OSSpec *spec, OSType maccreator, OSType mactype, OSHandle *text);
extern Boolean AppendHandleToFile(OSSpec *spec, OSHandle *text, OSType maccreator, OSType mactype);
extern void InitWorking();
extern void ShowWorking();
extern void TermWorking();
extern Boolean CheckForUserBreak();
extern char *IO_FormatText(char *buffer, SInt32 size, char *newline, const char *format, ...);
extern void CLPrintDispatch(SInt16 msgtype, const char *message, FILE *out, char *ptr, char *nptr);
extern void CLPrintType(SInt16 msgtype, ...);
extern void CLPrint(SInt16 msgtype, ...);
extern void CLPrintWarning(SInt16 msgtype, ...);
extern void CLPrintErr(SInt16 msgtype, ...);
extern SInt16 CLStyledMessageDispatch(Plugin *plugin, MessageRef *ref, SInt32 errorNumber, SInt16 msgType);

/********************************/
/* command_line/CmdLine/Src/CLToolExec.c */
extern void AppendArgumentList(int *argc, const char ***argv, const char *str);
// static int CopyArgumentList(int argc, const char **argv, int *Argc, const char ***Argv);
// static int FreeArgumentList(const char **argv);
// static int SetupLinkerCommandLine(SInt32 dropinflags, File *file, CWCommandLineArgs *args);
extern int SetupTemporaries(SInt32 idx, File *file);
extern int DeleteTemporaries(SInt32 idx, File *file);
extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile);

/********************************/
/* command_line/CmdLine/Src/Project/CLProj.c */
typedef struct Project {
    Target *targets;
    OSSpec projectDirectory;
} Project;
extern int Proj_Initialize(Project *this);
extern int Proj_Terminate(Project *this);

/********************************/
/* command_line/CmdLine/Src/CLLicenses.c */
extern void License_Initialize();
extern void License_Terminate();
extern SInt32 License_Checkout();
extern void License_Refresh();
extern void License_Checkin();
extern void License_AutoCheckin();

/********************************/
/* command_line/CmdLine/Src/CLPluginRequests.cpp */
extern Boolean SendParserRequest(
        Plugin *plugin,
        Target *target,
        CWCommandLineArgs *args,
        OSType cpu,
        OSType os,
        int numPlugins,
        CLPluginInfo *pluginInfo,
        int numPanels,
        const char **panelNames,
        CWCommandLineArgs *plugin_args,
        CWCommandLineArgs *panel_args,
        const char *build_date,
        const char *build_time,
        ToolVersionInfo *build_tool
        );
extern Boolean SendCompilerRequest(Plugin *plugin, File *file, SInt16 stage);
extern Boolean SendTargetInfoRequest(Target *targ, Plugin *linker, SInt32 dropinflags);
extern Boolean SendLinkerRequest(Plugin *plugin, SInt32 dropinflags, CWTargetInfo *targetInfo);
extern Boolean SendDisassemblerRequest(Plugin *linker, File *file);
extern Boolean SendInitOrTermRequest(Plugin *plugin, Boolean reqIsInitialize);

/********************************/
/* command_line/CmdLine/Src/CLFileOps.c */
// PRO8 ONLY ??? Boolean CanFlushObjectData(File *file);
// PRO8 ONLY ??? void FlushObjectData(File *file);
// PRO8 ONLY ??? Boolean RetrieveObjectData(File *file);
// static int OutputTextData(File *file, SInt16 stage, OSType maccreator, OSType mactype);
// static int fstrcat(const char *file, const char *add, SInt32 length);
// static void extstrcat(char *file, const char *ext);
extern int GetOutputFile(File *file, SInt16 stage);
// static int SyntaxCheckFile(File *file);
// static int PreprocessFile(File *file);
// static int DependencyMapFile(File *file, Boolean compileifnecessary);
// static int RecordBrowseInfo(File *file);
// static int RecordObjectData(File *file);
extern int StoreObjectFile(File *file);
// static int CompileFile(File *file);
// static int DisassembleWithLinker(File *file, Plugin *linker, SInt32 linkerDropinFlags);
// static int DisassembleFile(File *file, Plugin *disasm);
// static int CompileEntry(File *file, Boolean *compiled);
// static void DumpFileAndPathInfo();
extern int CompileFilesInProject();
// static int PostLinkFilesInProject();
extern int LinkProject();

/********************************/
/* command_line/CmdLine/Src/Project/CLPrefs.c */
extern PrefPanel *PrefPanel_New(const char *name, void *initdata, SInt32 initdatasize);
extern Handle PrefPanel_GetHandle(PrefPanel *panel);
extern int PrefPanel_PutHandle(PrefPanel *panel, Handle handle);
extern void Prefs_Initialize();
extern void Prefs_Terminate();
extern Boolean Prefs_AddPanel(PrefPanel *panel);
extern PrefPanel *Prefs_FindPanel(const char *name);

/********************************/
/* command_line/CmdLine/Src/Project/CLTarg.c */
extern Target *Target_New(const char *name, OSType cpu, OSType os, OSType lang);
extern void Target_Free(Target *targ);
extern void Targets_Term(Target *list);
extern void Target_Add(Target **list, Target *targ);

/********************************/
/* command_line/CmdLine/Src/Project/CLAccessPaths.c */
// 0,40=Path
// 0,41=OSPathSpec
// 0,43=Paths
// 0,44=Path**
// 0,45=Path*
// 0,46=OSPathSpec*
// 0,47=Paths*
// 0,48=Path*
extern Path *Path_Init(const OSPathSpec *dir, Path *path);
extern Path *Path_New(const OSPathSpec *dir);
extern void Path_Free(Path *path);
extern Boolean Paths_Initialize(Paths *paths);
extern Boolean Paths_Terminate(Paths *paths);
//static Boolean Paths_GrowPaths(Paths *paths, UInt16 *index);
extern Boolean Paths_AddPath(Paths *paths, Path *path);
extern Boolean Paths_InsertPath(Paths *paths, UInt16 index, Path *path);
extern Boolean Paths_RemovePath(Paths *paths, UInt16 index);
extern Boolean Paths_DeletePath(Paths *paths, UInt16 index);
extern Path *Paths_GetPath(Paths *paths, UInt16 pathnum);
extern UInt16 Paths_Count(const Paths *paths);
extern Boolean Paths_FindPath(const Paths *paths, const Path *path);
extern Path *Paths_FindPathSpec(const Paths *paths, const OSPathSpec *dir);
//static Boolean GatherRecurse(Paths *paths, Path *path);
extern Boolean Paths_GatherRecurse(Paths *paths);
extern int Paths_CountRecurse(Paths *paths);
//static void CopyRecurseFSS(FSSpec **pFss, Paths *paths, UInt16 *pCount);
extern void Paths_CopyRecurseFSS(FSSpec *fss, Paths *paths, UInt16 count);
//static Boolean Frameworks_Initialize(Frameworks *fws);
//static Boolean Frameworks_Grow(Frameworks *fws, UInt16 *index);
//static Boolean Frameworks_Add(Frameworks *fws, Paths_FWInfo *info);
//static Paths_FWInfo *Framework_Init(OSSpec *dir, const char *name, const char *version, Paths_FWInfo *info, Path *p, Boolean hidden);
//static Paths_FWInfo *Framework_New(OSSpec *dir, const char *name, const char *version, Path *p, Boolean hidden);
//static Boolean CheckForFileInFrameworkDir(char *out, const char *framework_path, OSPathSpec *osps, const char *fname);
//static Boolean CheckForFileInFramework(char *out, int i, const char *fname);
extern Boolean MakeFrameworkPath(char *out, const char *filename, OSPathSpec **globalpath);
extern Boolean Frameworks_AddPath(const OSPathSpec *oss);
extern Boolean Frameworks_AddFramework(const char *frameworkName, const char *version, Boolean flag);
extern void Framework_GetEnvInfo();
extern int Frameworks_GetCount();
extern Paths_FWInfo *Frameworks_GetInfo(int which);

/********************************/
/* ??? */
extern int AddFileTypeMappingList(void *a, void *b); // TODO sig
extern void UseFileTypeMappings(void *a); // TODO sig
extern OSErr SetMacFileType(const FSSpec *fss, void *a); // TODO sig
extern OSErr GetMacFileType(const FSSpec *fss, void *a); // TODO sig

/********************************/
/* command_line/CmdLine/Src/Project/CLFiles.c */
extern File *File_New();
extern void File_Free(File *file);
extern Boolean Files_Initialize(Files *this);
extern Boolean Files_Terminate(Files *this);
extern Boolean Files_AddFile(Files *this, File *file);
extern Boolean Files_InsertFile(Files *this, File *file, SInt32 position);
extern File *Files_GetFile(Files *this, SInt32 filenum);
extern File *Files_FindFile(Files *this, OSSpec *spec);
extern int Files_Count(Files *this);
extern Boolean VFiles_Initialize(VFile **list);
extern void VFiles_Terminate(VFile **list);
extern VFile *VFile_New(const char *name, OSHandle *data);
extern Boolean VFiles_Add(VFile **list, VFile *entry);
extern VFile *VFiles_Find(VFile *list, const char *name);

/********************************/
/* command_line/CmdLine/Src/Project/CLOverlays.c */
extern Boolean Overlays_Initialize(Overlays *this);
extern Boolean Overlays_Terminate(Overlays *this);
extern Boolean Overlays_AddOvlGroup(Overlays *this, OvlGroup *grp, SInt32 *grpnum);
extern OvlGroup *Overlays_GetOvlGroup(Overlays *this, SInt32 grpnum);
extern SInt32 Overlays_CountGroups(Overlays *this);
extern Boolean Overlays_AddFileToOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filenum);
extern Overlay *Overlays_GetOverlayInGroup(Overlays *this, SInt32 grpnum, SInt32 ovlnum);
extern SInt32 Overlays_GetFileInOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filnum);
extern OvlGroup *OvlGroup_New(const char *name, OvlAddr addr);
extern void OvlGroup_Delete(OvlGroup *grp);
extern Boolean OvlGroup_AddOverlay(OvlGroup *this, Overlay *oly, SInt32 *olynum);
extern Overlay *OvlGroup_GetOverlay(OvlGroup *this, SInt32 olynum);
extern SInt32 OvlGroup_CountOverlays(OvlGroup *this);
extern Overlay *Overlay_New(const char *name);
extern void Overlay_Delete(Overlay *oly);
extern Boolean Overlay_AddFile(Overlay *oly, SInt32 filenum, SInt32 *filnum);
extern SInt32 Overlay_GetFile(Overlay *oly, SInt32 filnul);
extern SInt32 Overlay_CountFiles(Overlay *oly);

/********************************/
/* command_line/CmdLine/Src/Project/CLSegs.c */
extern Segment *Segment_New(const char *name, UInt16 attrs);
extern void Segment_Free(Segment *seg);
extern Boolean Segments_Initialize(Segments *segs);
extern Boolean Segments_Terminate(Segments *segs);
//static Boolean Segments_GrowSegments(Segments *segs, UInt16 *index);
extern Boolean Segments_AddSegment(Segments *segs, Segment *seg, UInt16 *index);
extern Boolean Segments_InsertSegment(Segments *segs, UInt16 index, Segment *seg);
extern Boolean Segments_DeleteSegment(Segments *segs, UInt16 index);
extern Segment *Segments_GetSegment(Segments *segs, UInt16 segnum);
extern UInt16 Segments_Count(const Segments *segs);

/********************************/
/* CLDropinCallbacks_V10.cpp */
// TODO

/********************************/
/* command_line/CmdLine/Src/Callbacks/CLCompilerLinkerDropin_V10.cpp */
// TODO

/********************************/
/* command_line/CmdLine/Src/CLDependencies.c */
extern Boolean Incls_Initialize(Incls *incls, Target *targ);
extern void Incls_Terminate(Incls *incls);
// static Boolean IsSysIncl(Incls *incls, SInt32 idx);
// static void MakeInclFileSpec(Incls *incls, SInt32 idx, OSSpec *spec);
// static Boolean QuickFindFileInIncls(Incls *incls, Boolean fullsearch, const char *filename, OSSpec *spec, SInt32 *index, InclFile **f);
// static Boolean SameIncl(Incls *incls, SInt32 a, SInt32 b);
// static Path *FindOrAddGlobalInclPath(Paths *paths, OSPathSpec *spec);
// static Boolean _FindFileInPath(Path *path, const char *filename, Path **thepath, OSSpec *spec);
// static Boolean FindFileInPaths(Paths *paths, const char *filename, Path **thepath, OSSpec *spec);
// static void AddFileToIncls(Incls *incls, const char *infilename, Boolean syspath, Path *accesspath, Path *globalpath, SInt32 *index);
extern Boolean Incls_FindFileInPaths(Incls *incls, const char *filename, Boolean fullsearch, OSSpec *spec, SInt32 *inclidx);
extern Boolean Deps_Initialize(Deps *deps, Incls *incls);
extern void Deps_Terminate(Deps *deps);
extern int Deps_ChangeSpecialAccessPath(OSSpec *srcfss, Boolean initialize);
extern Path *Deps_GetSpecialAccessPath();
// static void SetSpecialAccessPathFromIncludeStackTOS();
// static Boolean FindDepFile(Deps *deps, SInt32 incl);
// static void AddDepFile(Deps *deps, SInt32 incl);
extern void Deps_AddDependency(Deps *deps, SInt32 incl, OSSpec *spec, SInt16 dependencyType);
// static char *EscapeName(Boolean spaces, char *escbuf, const char *path);
extern void Deps_ListDependencies(Incls *incls, File *file, Handle h);

/********************************/
/* command_line/CmdLine/Src/CLWriteObjectFile.c */
extern Boolean WriteObjectFile(File *file, OSType maccreator, OSType mactype);
extern Boolean WriteBrowseData(File *file, OSType maccreator, OSType mactype);

/********************************/
/* command_line/CmdLine/Src/CLBrowser.c */
// GetBrowseTableInfoAndLock
extern int Browser_Initialize(OSHandle *browsetableptr);
//static int Destroy(OSHandle *browsetable);
extern int Browser_Terminate(OSHandle *browsetableptr);
extern int Browser_SearchFile(OSHandle *browsetable, const char *fullpath, SInt16 *ID);
extern int Browser_SearchAndAddFile(OSHandle *browsetable, const char *fullpath, SInt16 *ID);
//static SInt32 CalcDiskSpaceRequirements(...); // needs table type
//static int ConvertMemToDisk(...); // needs table type
extern int Browser_PackBrowseFile(OSHandle *browsedata, OSHandle *browsetable, OSHandle *browsefileptr);

/********************************/
/* command_line/CmdLine/Src/CLIncludeFileCache.c */
// TODO

/********************************/
/* ?? Error */
extern char *GetSysErrText(SInt16 code, char *buffer);

/********************************/
/* Might be cc-mach-ppc-mw.c? */
extern void GetStaticTarget(OSType *cpu, OSType *os);
extern void GetStaticPluginType(OSType *language, OSType *plugintype);
extern void GetStaticParserPluginType(OSType *style);
extern int RegisterStaticTargetResources();
extern int RegisterStaticTargetPlugins();

/********************************/
/* Might be ParserGlue-mach-ppc-cc.c? */
extern int RegisterStaticParserToolInfo();

/********************************/
/* Might be cc-mach-ppc.c? */
extern CW_PASCAL SInt16 CWPlugin_GetDropInFlags(const DropInFlags **flags, SInt32 *flagsSize);
extern CW_PASCAL SInt16 CWPlugin_GetTargetList(const CWTargetList **targetList);
extern CW_PASCAL SInt16 CWPlugin_GetDropInName(const char **dropinName);
extern CW_PASCAL SInt16 CWPlugin_GetDisplayName(const char **displayName);
extern CW_PASCAL SInt16 CWPlugin_GetDefaultMappingList(const CWExtMapList **defaultMappingList);
extern CW_PASCAL SInt16 CWPlugin_GetPanelList(const CWPanelList **panelList);
//_CmdLine_GetObjectFlags
//_CWPlugin_GetVersionInfo
//_CWPlugin_GetFileTypeMappings
//_Linker_GetDropInFlags
//_Linker_GetDropInName
//_Linker_GetDisplayName
//_Linker_GetPanelList
//_Linker_GetTargetList
//_Linker_GetDefaultMappingList
extern int RegisterStaticCompilerPlugin();
extern int RegisterCompilerResources();

/********************************/
/* libimp-mach-ppc.c */
// some statics here
extern int RegisterStaticLibImporterPlugin();
extern int RegisterLibImporterResources();

/********************************/
/* TargetOptimizer-ppc-mach.c */
extern int TargetSetOptFlags(SInt16 val, Boolean set);
extern void TargetDisplayOptimizationOptions(Handle txt);
extern void TargetSetPragmaOptimizationsToUnspecified();

/********************************/
/* OptimizerHelpers.c */
extern int SetPragmaOptimizationsToUnspecified();
extern int SetOptFlags(char *opt, void *str, ...); // two unknown args
extern int DisplayOptimizationOptions();

/********************************/
/* Unk name lol */
extern int TargetSetWarningFlags(SInt16 val, Boolean set);
extern int TargetDisplayWarningOptions(Handle txt);

/********************************/
/* WarningHelpers.c */
extern int SetWarningFlags(char *opt, void *str, ...); // two unknown args
extern int DisplayWarningOptions();

/********************************/
/* CCompiler.c */

// LOTS OF STUFF

/********************************/
/* StaticParserGlue.c */
extern int RegisterStaticParserResources();
extern int RegisterStaticParserPlugins();

/********************************/
/* ParserFace.c */
extern Handle Parser_FindPrefPanel(char *name);
extern SInt32 Parser_StorePanels(struct CWPluginPrivateContext *context);
extern SInt16 CWParser_GetDropInFlags(const DropInFlags **flags, SInt32 *flagsSize);
extern SInt16 CWParser_GetDropInName(const char **dropinName);
extern SInt16 CWParser_GetDisplayName(const char **displayName);
extern SInt16 CWParser_GetPanelList(const CWPanelList **panelList);
extern SInt16 CWParser_GetTargetList(const CWTargetList **targetList);
extern SInt16 CWParser_GetVersionInfo(const VersionInfo **versioninfo);
extern SInt16 Parser_SupportsPlugin(struct CLPluginInfo *pluginfo, OSType cpu, OSType os, Boolean *isSupported);
extern SInt16 Parser_SupportsPanels(int numPanels, char **panelNames, Boolean *isSupported);
extern SInt16 parser_main(struct CWPluginPrivateContext *context);

extern struct ParseOptsType parseopts;

/********************************/
/* ParserHelpers.c */
extern int FindFileInPath(const char *filename, OSSpec *fss);
extern char *GetEnvVar(const char *name, Boolean warn, char **match);
//static Boolean MatchesExtension(const char *list, const char *filename);
extern int Opt_AddAccessPath(const char *opt, void *var, const char *arg);
extern int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg);
extern int Opt_AddFramework(const char *opt, void *var, const char *arg);
extern void ListParseMessage(void *errprint, const char *envvar, SInt16 id); // TODO funcptr sig - same as CLPReportWarning_V, CLPReportError_V
extern int AddAccessPathList(const char *list, char sep1, char sep2, int source, char *text, Boolean system, SInt32 position, Boolean recursive);
extern int Opt_FindAndAddFile(const char *opt, void *var, const char *arg);
extern int Opt_FindAndAddFileRef(const char *opt, void *var, const char *arg);
extern int Opt_AddUnixLibraryFile(const char *opt, void *var, const char *arg);
extern int AddFileList(const char *list, char sep1, char sep2, int source, char *text, SInt32 position);
extern int IsFileInOutputDirectory(const OSSpec *file);
extern void GetCFileNameInOutputDirectory(const char *input, char *name, int maxlen);
extern void GetPFileNameInOutputDirectory(const char *input, unsigned char *name, int len);
extern void AddStringLenToHandle(Handle h, const char *str, int len);
extern void AddStringToHandle(Handle h, const char *str);
extern int Opt_PrintVersion(const char *opt, void *var, const char *arg);
extern void GetFirstSourceFilenameBase(char *buffer, char *defaul);
extern int Opt_SavePrefs(const char *opt, void *var, const char *arg);
extern int ParseNumber(const char *arg, Boolean emit_error, SInt32 *ret, const char **endptr);
extern int Opt_MaybeMoveAccessPaths(const char *opt, void *var, const char *arg);

/********************************/
/* ToolHelpers.c */
extern int Opt_HandleOutputName(const char *opt, void *, const char *filename);
extern int ValidateToolState(Boolean mustHaveFiles);
extern void ToolReportMessage(SInt16 errid, SInt16 type, va_list va);
extern void ToolReportWarning(SInt16 id, ...);
extern void ToolReportError(SInt16 id, ...);
extern void ToolReportOSError(SInt16 id, ...);
extern void ToolReportInfo(SInt16 id, ...);
extern int Opt_DoNotLink(const char *opt, void *var, const char *arg);
extern int Opt_IncreaseVerbosity(const char *opt, void *var, const char *arg);
extern int Opt_SetStage(const char *opt, void *str, const char *arg, void *unk);
// lots of the Opt_ funcs have weird sigs, need to double check them
extern int Opt_RedirectStream(const char *opt, void *file, const char *filename);

/********************************/
/* ParserHelpers-cc.c */
typedef struct {
    void *value;
    const char *pragma;
    int flags;
} Pragma; // assumed name
extern int Opt_AddStringToDefines(const char *opt, void *str, const char *param);
extern int Opt_DefineSymbol(const char *var, const char *value);
extern int Opt_UndefineSymbol(const char *opt, void *, const char *arg);
extern int Opt_AddPrefixFile(const char *opt, void *handle, const char *filename);
extern int Opt_PragmaTrueFalse(const char *, void *flag, const char *, int flags);
extern int Opt_PragmaFalseTrue(const char *, void *flag, const char *, int flags);
extern int Opt_PragmaOnOff(const char *, void *flag, const char *arg);
extern int Opt_PragmaOffOn(const char *, void *flag, const char *arg);
extern int SetupPragmas(const Pragma *pragmas);

/********************************/
/* Arguments.c */
typedef struct {
    SInt16 val;
    char *text;
} ArgToken;
enum {
    ATK_0,
    ATK_1,
    ATK_2,
    ATK_3,
    ATK_4,
    ATK_5
};
typedef struct {
    int argc;
    int nargv;
    char **argv;
} anon0_50;

extern void Arg_Init(int theargc, char **theargv);
extern void Arg_Terminate();
extern void Arg_Reset();
extern void Arg_Stop(ArgToken *where);
extern ArgToken *Arg_PeekToken();
extern ArgToken *Arg_UsedToken();
extern int Arg_IsEmpty();
extern ArgToken *Arg_GetToken();
extern ArgToken *Arg_UndoToken();
extern const char *Arg_GetTokenName(ArgToken *tok);
extern const char *Arg_GetTokenText(ArgToken *tok, char *buffer, int maxlen, unsigned char warn);
extern void Arg_InitToolArgs(anon0_50 *ta);
extern void Arg_AddToToolArgs(anon0_50 *ta, SInt16 tokval, char *toktxt);
extern void Arg_FinishToolArgs(anon0_50 *ta);
extern void Arg_ToolArgsForPlugin(anon0_50 *ta, struct CWCommandLineArgs *args);
extern void Arg_FreeToolArgs(anon0_50 *ta);

/********************************/
/* ToolHelpers-cc.c */
extern int Opt_DummyLinkerRoutine(const char *opt);
extern int Opt_DummyLinkerSettingRoutine(const char *var, const char *val);
extern void FinishCompilerTool();

/********************************/
/* IO.c */
extern void ShowTextHandle(const char *description, Handle text);
extern void ShowVersion(Boolean decorate);

/********************************/
/* Projects.c */
extern int GetFileCount();
extern void SetFileOutputName(SInt32 position, SInt16 which, char *outfilename);
extern int AddFileToProject(OSSpec *oss, SInt16 which, char *outfilename, Boolean exists, SInt32 position);
extern Boolean GetFileInfo(SInt32 position, OSSpec *spec, char *plugin);
extern int AddAccessPath(const OSPathSpec *oss, SInt16 type, SInt32 position, Boolean recursive);
extern int MoveSystemPathsIntoUserList();
extern void AddVirtualFile(const char *filename, Handle *text);
extern void GetOutputFileDirectory(OSPathSpec *dir);
extern void SetOutputFileDirectory(const OSPathSpec *dir);
extern void AddOverlayGroup(const char *name, OvlAddr *addr, SInt32 *groupnum, SInt32 *overlaynum);
extern void AddOverlay(SInt32 groupnum, const char *name, SInt32 *overlaynum);
extern void AddSegment(const char *name, SInt16 attrs, SInt32 *segmentnum);
extern void ChangeSegment(SInt32 segmentnum, const char *name, SInt16 attrs);
extern int GetSegment(SInt32 segmentnum, char *name, SInt16 *attrs);

/********************************/
/* Targets.c */
extern int SetParserToolInfo(ParserTool *tool);
extern Boolean ParserToolMatchesPlugin(OSType type, OSType lang, OSType cpu, OSType os);
extern Boolean ParserToolHandlesPanels(int numPanels, const char **panelNames);
extern Boolean SetupParserToolOptions();

/********************************/
/* Option.c */
typedef struct {
    void *first;
    void *second;
} Opt50;
typedef struct {
    Option *opt;
    char *curopt;
} Opt52;
typedef struct {
    union {
        Opt50 v;
        OptionList *lst;
        Opt52 o;
        char *param;
    } e;
    SInt16 flags;
} Opt48;
//static void Option_PushList(OptionList *lst);
//static void Option_PushOpt(Option *opt, const char *optname);
//static void Option_PopOpt(const char *optname);
//static void Option_PopList();
extern void Args_InitStack();
extern int Args_StackSize();
extern void Args_Push(SInt16 flags, void *first, void *second);
extern Opt48 *Args_Pop(SInt16 flags);
extern void Args_SpellStack(char *buffer, SInt16 flags);
extern void Args_AddToToolArgs(anon0_50 *ta);
extern void Options_Init();
extern OptionList *Options_GetOptions();
extern void Options_SortOptions();
//static void Options_AddOption(Option *opt);
extern int Options_AddList(OptionList *optlst);
extern int Options_AddLists(OptionList **optlst);
//static void Options_Reset(OptionList *optlst);
//static void Option_SpellList(char *buffer, OptionList *conflicts, int flags);
extern int Option_ForTool(Option *opt, int which);
extern int Option_ThisTool();
extern int Option_ForThisTool(Option *opt);
extern int Option_AlsoPassedToTool(Option *opt, int which);
extern int Option_AlsoPassedFromThisTool(Option *opt);
//static Boolean Option_ContinuesThisLevel(int level, ArgToken *tok);
//static Boolean Option_IsEndingThisLevel(int level, ArgToken *tok);
//static Boolean Option_IsEndingLevel(int level, ArgToken *tok);
extern int Option_Parse(Option *opt, int oflags);
//static int Option_MatchString(char *list, char *str, int flags, int *result);
//static Option *Option_Lookup(OptionList *search, void *unk, int *flags);
//static int Options_DoParse(OptionList *search, int flags);
extern int Options_Parse(OptionList *options, int flags);
extern int Option_ParseDefaultOption(OptionList *options);
extern void Option_ParamError(SInt16 id, va_list ap);
extern void Option_ParamWarning(SInt16 id, va_list ap);
extern void Option_OptionError(SInt16 id, va_list ap);
extern void Option_OptionWarning(SInt16 id, va_list ap);
extern void Option_Error(SInt16 id, ...);
extern void Option_Warning(SInt16 id, ...);
extern int Options_Help(const char *keyword);
extern int Option_Help(const char *opt);
extern int Options_DisplayHelp();

/********************************/
/* ParserErrors.c */
extern void CLPReportError_V(const char *format, va_list ap);
extern void CLPReportWarning_V(const char *format, va_list ap);
extern void CLPReport_V(const char *format, va_list ap);
extern void CLPStatus_V(const char *format, va_list ap);
extern void CLPAlert_V(const char *format, va_list ap);
extern void CLPOSAlert_V(const char *format, SInt32 err, va_list ap);
extern void CLPGetErrorString(SInt16 errid, char *buffer);
extern void CLPReportError(SInt16 errid, ...);
extern void CLPReportWarning(SInt16 errid, ...);
extern void CLPReport(SInt16 errid, ...);
extern void CLPAlert(SInt16 errid, ...);
extern void CLPOSAlert(SInt16 errid, SInt16 err, ...);
extern void CLPProgress(SInt16 errid, ...);
extern void CLPStatus(SInt16 errid, ...);
extern void CLPFatalError(const char *format, ...);

extern char curopt[1024];

/********************************/
/* Utils.c */
// something is weird with these parameters
// they're supposed to be just "char"...
extern int my_tolower(unsigned char c);
extern int my_isdigit(unsigned char c);
extern int my_isalpha(unsigned char c);
extern int my_isalnum(unsigned char c);
extern int my_isxdigit(unsigned char c);
extern char *Utils_SpellList(char *list, char *buffer, char opts);
extern int Utils_CompareOptionString(const char *a, const char *b, int cased, int sticky);

/********************************/
/* Parameter.c */
extern void Param_DescHelp(PARAM_T *param, const char **desc, const char **help, const char **defaul);
extern int Param_Compare(PARAM_T *param);
extern int Params_Parse(PARAM_T *param, int flags);
extern void Param_Error(SInt16 id, ...);
extern void Param_Warning(SInt16 id, ...);

/********************************/
/* Help.c */
extern int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const char *keyword);
extern void Help_Options(struct OptionList *lst, int subprint, const char *keyword);
extern void Help_Usage();
extern void Help_Null();
extern void Help_Init();
extern void Help_Line(char ch);
extern void Help_Term();

/********************************/
/* */

/********************************/
/* */

/********************************/
/* ?? COS */
// static COS_pstrcpy
// static COS_pstrcat
// static COS_pstrcharcat
// static COS_pstrcmp
extern Handle COS_NewHandle(SInt32 byteCount);
extern Handle COS_NewOSHandle(SInt32 logicalSize);
extern void COS_FreeHandle(Handle handle);
extern Boolean COS_ResizeHandle(Handle handle, SInt32 newSize);
extern SInt32 COS_GetHandleSize(Handle handle);
extern void COS_LockHandle(Handle handle);
extern void COS_LockHandleHi(Handle handle);
extern void COS_UnlockHandle(Handle handle);
extern int COS_GetHandleState(Handle handle);
extern void COS_SetHandleState(Handle handle, int state);
extern Boolean COS_IsLockedState(int state);
extern char *COS_NewPtr(SInt32 byteCount);
extern char *COS_NewPtrClear(SInt32 byteCount);
extern void COS_FreePtr(char *ptr);
extern void COS_AppendPtrToHandle(char *ptr1, Handle hand2, SInt32 size);
extern OSErr COS_GetMemErr();
extern SInt32 COS_GetTicks();
extern SInt32 COS_GetTime();
extern void COS_GetString(char *buffer, SInt16 strListID, SInt16 index);
extern void COS_GetPString(unsigned char *buffer, SInt16 strListID, SInt16 index);
extern Boolean COS_IsMultiByte(char *buffer, char *str);
extern SInt16 COS_FileNew(const FSSpec *spec, SInt16 *refNum, OSType creator, OSType fileType);
extern SInt16 COS_FileOpen(const FSSpec *spec, SInt16 *refNum);
extern SInt16 COS_FileGetType(const FSSpec *spec, OSType *fileType);
extern SInt16 COS_FileGetSize(SInt16 refNum, SInt32 *logEOF);
extern SInt16 COS_FileRead(SInt16 refNum, void *buffPtr, SInt32 count);
extern SInt16 COS_FileWrite(SInt16 refNum, const void *buffPtr, SInt32 count);
extern SInt16 COS_FileGetPos(SInt16 refNum, SInt32 *filePos);
extern SInt16 COS_FileSetPos(SInt16 refNum, SInt32 filePos);
extern SInt16 COS_FileClose(SInt16 refNum);
extern void COS_FileSetFSSpec(FSSpec *spec, unsigned char *path);
extern SInt16 COS_FileMakeFSSpec(SInt16 vRefNum, SInt32 dirID, unsigned char *fileName, FSSpec *spec);
extern SInt16 COS_FileMakeFSSpecWithPath(const FSSpec *inputSpec, unsigned char *fileName, FSSpec *spec);
extern SInt16 COS_FileGetFileInfo(const FSSpec *spec, OSType *creator, OSType *fileType);
extern void COS_FileGetFSSpecInfo(const FSSpec *spec, SInt16 *vRefNum, SInt32 *dirID, unsigned char *fileName);
//static void COS_MakePath(SInt16 vRefNum, SInt32 dirID, char *path);
extern void COS_FileGetPathName(char *buffer, const FSSpec *spec, SInt32 *mdDat);
extern Boolean COS_EqualFileSpec(const FSSpec *a, const FSSpec *b);


// TODO sort me
extern Project *gProj;
extern ParserTool *pTool;
extern PCmdLine optsCmdLine;
extern PCmdLineEnvir optsEnvir;
extern PCmdLineCompiler optsCompiler;
extern PCmdLineLinker optsLinker;
extern CLState clState;

/********************************/
/* CmdLineBuildDate.c */
extern char CMDLINE_BUILD_DATE[];
extern char CMDLINE_BUILD_TIME[];


/********************************/
/* MISC */
extern char cmdline_build_date[32];
extern char cmdline_build_time[32];

extern StringPtr pstrcpy(StringPtr dst, ConstStringPtr src);
extern int (*PrefPanelsChangedCallback)(const char *);
extern Boolean systemHandles;
extern char *MAINOPTCHAR;
extern char *SEPOPTSTR;
extern char compat;
extern anon0_50 linkargs;

#ifdef __cplusplus
}
#endif