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
|
#pragma once
#include "cw_common.h"
#include "pref_structs.h"
#include "option_system.h"
enum {
PRAGMA_FLAGS_0,
PRAGMA_FLAGS_1
};
enum {
PR_UNSET = 0, // this is the only one we know the name of (from asserts)
PR_ON = 1,
PR_OFF = 2,
PR_AUTO = 3,
PR_RESET = 4
};
typedef struct {
void *value;
const char *pragma;
int flags;
} Pragma; // assumed name
enum {
// "Option missing"
CLPStr1 = 1,
// "Command-line argument '%.15s...%.15s' is much too long, maximum accepted length is %d characters"
CLPStr2 = 2,
// "Parameter for '%s' missing"
CLPStr3 = 3,
// "Numeric constant '%s' overflowed 32-bit range"
CLPStr4 = 4,
// "Invalid %sconstant '%s'"
CLPStr5 = 5,
// "Numeric constant %lu is out of the legal range %lu - %lu"
CLPStr6 = 6,
// "Numeric constant %lu is out of the legal range %lu - %lu; clipping to %lu"
CLPStr7 = 7,
// "Four-char type '%s' is too long, expected maximum four characters"
CLPStr8 = 8,
// "String constant '%.16s...%.16s' too long, expected maximum %ld characters"
CLPStr9 = 9,
// "Identifier '%s' cannot start with a digit"
CLPStr10 = 10,
// "Identifier '%s' cannot contain the character '%c'"
CLPStr11 = 11,
// "Expected 'on' or 'off', but got '%s'"
CLPStr12 = 12,
// "Filename or directory '...%32s' is too long, expected maximum %ld characters"
CLPStr13 = 13,
// "Directory '...%32s' combined with filename '...%32s' is too long, maximum path is %ld characters"
CLPStr14 = 14,
// "File '%s' does not exist"
CLPStr15 = 15,
// "'%s' is a directory or volume, filename expected"
CLPStr16 = 16,
// "'%s' does not refer to a directory"
CLPStr17 = 17,
// "File path '%s' not accepted\n(%s)"
CLPStr18 = 18,
// "Unknown option '%s'"
CLPStr19_UnknownOptionX = 19,
// "Unknown option '%s'; expected one of '%s'"
CLPStr20_UnknownOptionX_ExpectedOneOfX = 20,
// "Option is obsolete"
CLPStr21_OptionObsolete = 21,
// "Option is obsolete; %s"
CLPStr22_OptionObsoleteWithHelp = 22,
// "Option '%s' substituted with %s"
CLPStr23_OptionXSubstitutedWithX = 23,
// "Option deprecated; accepted this time"
CLPStr24_OptionDeprecated = 24,
// "Option deprecated, accepted this time; use '%s' instead"
CLPStr25_OptionDeprecatedWithHelp = 25,
// "Option ignored"
CLPStr26_OptionIgnored = 26,
// "Option ignored;\n%s"
CLPStr27_OptionIgnoredWithText = 27,
// "%s"
CLPStr28_WarningText = 28,
// "Option has no effect on this target"
CLPStr29_OptionHasNoEffect = 29,
// "Option should not be specified multiple times"
CLPStr30_OptionShouldNotBeSpecifiedMultipleTimes = 30,
// "Option overrides the effect of '%s'; only one of '%s' should be specified"
CLPStr31_OptionOverridesEffect = 31,
// "Option overrides the effect of '%s'; only one of '%s' should be specified;\n%s"
CLPStr32_OptionOverridesEffectWithHelp = 32,
// "No default handler set up for '%s', ignoring"
CLPStr33_NoDefaultHandlerSetUpForX_Ignoring = 33,
// "Argument(s) expected"
CLPStr34_ArgumentsExpected = 34,
// "Token '%s' not expected"
CLPStr35_TokenXNotExpected = 35,
// "Unexpected additional argument '%s'"
CLPStr36_UnexpectedAdditionalArgumentX = 36,
// "Encountered extraneous arguments"
CLPStr37 = 37,
// "No help available for option '%s'"
CLPStr38_NoHelpAvailableForOptionX = 38,
// "Empty (zero-length) argument not accepted"
CLPStr39 = 39,
// "Variable name missing"
CLPStr40 = 40,
// "Only one output filename allowed; '%s' not accepted"
CLPStr41 = 41,
// "Output filenames found without source; '%s' not accepted"
CLPStr42 = 42,
// "Multiple outputs expected, output is ambiguous; '%s' not accepted"
CLPStr43 = 43,
// "Specified file '%s' not found"
CLPStr44 = 44,
// "Specified directory '%s' not found"
CLPStr45 = 45,
// "'%s' is a filename, not a directory; not accepted"
CLPStr46 = 46,
// "'%s' is a directory, not a filename; not accepted"
CLPStr47 = 47,
// "Library search found shared library '%s' instead of export library '%s.LIB'"
CLPStr48 = 48,
// "No library file found matching 'lib%s{%s}' or '%s'"
CLPStr49 = 49,
// "Redudant use of '%c%s%s'; linker always searches library paths;\ntypically one finds, e.g., libXXX.a with '%c%sXXX'"
CLPStr50 = 50,
// "Empty filename in library list ignored"
CLPStr51 = 51,
// "Environment variable '%s' not found"
CLPStr52 = 52,
// "In environment variable '%s':"
CLPStr53 = 53,
// "Option name expected for 'opt'"
CLPStr54 = 54,
// "Token '%s' ignored"
CLPStr55 = 55,
// "Token '%s[...%s]' was truncated to %d characters"
CLPStr56 = 56,
// "Expected %s, but got %s"
CLPStr57 = 57,
// "No output expected from this process, ignoring output name '%s'"
CLPStr58 = 58,
// "Only one output directory allowed, '%s' not accepted"
CLPStr59 = 59,
// "Storing browse info for '%s' in '%s'"
CLPStr60 = 60,
// "All linker output will be created in the same directory; ignoring path for '%s'"
CLPStr61 = 61,
// "Option overrides previously specified optimizations"
CLPStr62 = 62,
// "Could not initialize command line parser"
CLPStr63 = 63,
// "Output filename '%s' is invalid"
CLPStr64 = 64,
// "Truncated output filename '%s' to %d characters"
CLPStr65 = 65,
// "Output directory '%s' cannot be found"
CLPStr66 = 66,
// "Cannot add access path '%s'"
CLPStr67 = 67,
// "Cannot set preferences for '%s'"
CLPStr68 = 68,
// "Some of the files specified could not be found; build aborted"
CLPStr69 = 69,
// "Nothing to do: no source or object files specified"
CLPStr70 = 70,
// "Contents of %s:"
CLPStr71 = 71,
// "Overlays not supported on this target"
CLPStr72 = 72,
// "Segments not supported on this target"
CLPStr73 = 73,
// "Cannot open %s file '%s'"
CLPStr74 = 74,
// ""
CLPStr75 = 75,
// "The file \"%s\" may be ignored unless it has one of the following\nextensions: \"%s\""
CLPStr76 = 76,
// "Not using non-text file '%s' as optional argument"
CLPStr77 = 77,
// "Cannot redirect stream to '%s' (%s)"
CLPStr78 = 78
};
// State
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)(void);
int (*MidParse)(void);
int (*PostParse)(void);
} ParserTool; // assumed name
typedef struct {
struct CWPluginPrivateContext *context;
char helpKey[64];
SInt32 helpFlags;
UInt16 ioCols;
UInt16 ioRows;
CWCommandLineArgs *args;
const ToolVersionInfo *toolVersion;
int numPlugins;
const CLPluginInfo *plugins;
int numPanels;
const 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];
} ParseOptsType; // assumed name
#ifdef __cplusplus
extern "C" {
#endif
/********************************/
/* IO.c */
extern void ShowTextHandle(const char *description, Handle text);
extern void ShowVersion(Boolean decorate);
/********************************/
/* OptimizerHelpers.c */
extern Pragma irPragmas[];
extern int SetPragmaOptimizationsToUnspecified(const char *opt, void *, const char *, int);
extern int SetOptFlags(const char *opt, void *str, const char *, int flags);
extern int DisplayOptimizationOptions(const char *, void *, const char *, int);
/********************************/
/* 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 char *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, ...);
/********************************/
/* ParserFace.c */
extern const char *failedCallback;
extern jmp_buf exit_plugin;
extern ParseOptsType parseopts;
extern Handle Parser_FindPrefPanel(const char *name);
extern SInt32 Parser_StorePanels(struct CWPluginPrivateContext *context);
extern CWPLUGIN_ENTRY (CWParser_GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize);
extern CWPLUGIN_ENTRY (CWParser_GetDropInName)(const char **dropinName);
extern CWPLUGIN_ENTRY (CWParser_GetDisplayName)(const char **displayName);
extern CWPLUGIN_ENTRY (CWParser_GetPanelList)(const CWPanelList **panelList);
extern CWPLUGIN_ENTRY (CWParser_GetTargetList)(const CWTargetList **targetList);
extern CWPLUGIN_ENTRY (CWParser_GetVersionInfo)(const VersionInfo **versioninfo);
extern CWPLUGIN_ENTRY (Parser_SupportsPlugin)(const struct CLPluginInfo *pluginfo, OSType cpu, OSType os, Boolean *isSupported);
extern CWPLUGIN_ENTRY (Parser_SupportsPanels)(int numPanels, const char **panelNames, Boolean *isSupported);
extern CWPLUGIN_ENTRY (parser_main)(struct CWPluginPrivateContext *context);
/********************************/
/* ParserGlue-mach-ppc-c.c */
extern PCmdLine pCmdLine;
extern PCmdLineCompiler pCmdLineCompiler;
extern PCmdLineLinker pCmdLineLinker;
extern PFrontEndC pFrontEndC;
extern PWarningC pWarningC;
extern PGlobalOptimizer pGlobalOptimizer;
extern PBackEnd pBackEnd;
extern PDisassembler pDisassembler;
extern PMachOLinker pLinker;
extern PMachOProject pMachOProject;
extern PCLTExtras pCLTExtras;
/********************************/
/* ParserHelpers.c */
extern SInt16 lastStage;
extern Boolean dashIMinusMovesPaths;
extern Boolean usedDashIMinus;
extern Boolean namingSysPaths;
extern int FindFileInPath(const char *filename, OSSpec *fss);
extern char *GetEnvVar(const char *name, Boolean warn, const char **match);
extern int Opt_AddAccessPath(const char *opt, void *var, const char *arg, int flags);
extern int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg, int flags);
extern int Opt_AddFramework(const char *opt, void *var, const char *arg, int flags);
extern void ListParseMessage(void (*errprint)(const char *, va_list), const char *envvar, SInt16 id, ...);
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, int flags);
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, int flags);
extern void GetFirstSourceFilenameBase(char *buffer, char *defaul);
extern int Opt_SavePrefs(const char *opt, void *var, const char *arg, int flags);
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, int flags);
/********************************/
/* ParserHelpers-cc.c */
extern Handle definesHandle;
extern int Opt_AddStringToDefines(const char *opt, void *str, const char *param, int flags);
extern int Opt_DefineSymbol(const char *var, const char *value);
extern int Opt_UndefineSymbol(const char *opt, void *, const char *arg, int flags);
extern int Opt_AddPrefixFile(const char *opt, void *handle, const char *filename, int flags);
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);
/********************************/
/* Projects.c */
extern int GetFileCount(void);
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(OSPathSpec *oss, SInt16 type, SInt32 position, Boolean recursive);
extern int MoveSystemPathsIntoUserList(void);
extern void AddVirtualFile(const char *filename, Handle *text);
extern void GetOutputFileDirectory(OSPathSpec *dir);
extern void SetOutputFileDirectory(OSPathSpec *dir);
extern void AddOverlayGroup(const char *name, CWAddr64 *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);
/********************************/
/* TargetOptimizer-ppc-mach.c */
extern char schedule_ppc_default;
extern int TargetSetOptFlags(short val, Boolean set);
extern void TargetDisplayOptimizationOptions(Handle txt);
extern void TargetSetPragmaOptimizationsToUnspecified(void);
/********************************/
/* TargetWarningHelpers-ppc-cc.c */
extern Pragma warningPragmas[];
extern int TargetSetWarningFlags(short val, Boolean set);
extern void TargetDisplayWarningOptions(Handle txt);
/********************************/
/* Targets.c */
extern ParserTool *pTool;
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(void);
/********************************/
/* ToolHelpers.c */
enum {
OutputOrdering0 = 0,
OutputOrdering1 = 1,
OutputOrdering2 = 2
};
extern char linkerOutputFilename[256];
extern Boolean setLinkerOutputFilename;
extern Boolean setOutputDirectory;
extern SInt16 outputOrdering;
extern int Opt_HandleOutputName(const char *opt, void *, const char *filename, int flags);
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, int err, ...);
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, int flags);
extern int Opt_SetStage(const char *opt, void *str, const char *arg, int flags);
extern int Opt_RedirectStream(const char *opt, void *file, const char *filename);
/********************************/
/* ToolHelpers-cc.c */
extern int Opt_DummyLinkerRoutine(const char *opt, void *, const char *, int);
extern int Opt_DummyLinkerSettingRoutine(const char *var, const char *val);
extern void FinishCompilerTool(void);
/********************************/
/* Utils.c */
extern int my_tolower(char c);
extern int my_isdigit(char c);
extern int my_isalpha(char c);
extern int my_isalnum(char c);
extern int my_isxdigit(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);
/********************************/
/* WarningHelpers.c */
extern int SetWarningFlags(const char *opt, void *str, const char *, int flags);
extern int DisplayWarningOptions(const char *, void *, const char *, int);
#ifdef __cplusplus
extern "C" }
#endif
|