summaryrefslogtreecommitdiff
path: root/includes/mwcc_decomp.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--includes/mwcc_decomp.h693
1 files changed, 89 insertions, 604 deletions
diff --git a/includes/mwcc_decomp.h b/includes/mwcc_decomp.h
index 52f25c6..c5fa000 100644
--- a/includes/mwcc_decomp.h
+++ b/includes/mwcc_decomp.h
@@ -2,294 +2,14 @@
#include "common.h"
#include "oslib.h"
#include "macemul.h"
+#include "plugin.h"
+
+#define OPTION_ASSERT(cond) do { if (!!(cond) == 0) { printf("%s:%u: failed assertion\n", __FILE__, __LINE__); abort(); } } while(0)
#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
-
-#define CWFOURCHAR(a, b, c, d) \
- (((OSType) ((a) & 0xff) << 24) \
- | ((OSType) ((b) & 0xff) << 16) \
- | ((OSType) ((c) & 0xff) << 8) \
- | ((OSType) ((d) & 0xff)))
-
-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
@@ -314,179 +34,10 @@ typedef struct CWObjectFlags {
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;
-
-#define kCurrentDropInFlagsVersion 2
-#define kCurrentCWPanelListVersion 1
-#define kCurrentCWFamilyListVersion 1
-#define kCurrentCWFamilyResourceVersion 1
-#define kCurrentCWHelpInfoVersion 1
-#define kCurrentCWPluginInfoVersion 1
-#define kCurrentCWTargetListVersion 1
-#define kCurrentCWTargetListResourceVersion 1
-
-enum {
- CWDROPINCOMPILERTYPE = CWFOURCHAR('C', 'o', 'm', 'p'),
- CWDROPINLINKERTYPE = CWFOURCHAR('L', 'i', 'n', 'k')
-};
-
#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__
@@ -498,6 +49,17 @@ enum {
OptsCmdLineState_2 = 2,
OptsCmdLineState_3 = 3
};
+enum {
+ CmdLineStage_Cg = 1,
+ CmdLineStage_Pp = 2,
+ CmdLineStage_Ds = 3
+};
+enum {
+ CmdLineStageMask_Pp = 1,
+ CmdLineStageMask_Cg = 2,
+ CmdLineStageMask_Ds = 4,
+ CmdLineStageMask_Dp = 8
+};
typedef struct PCmdLine {
SInt16 version;
SInt16 state;
@@ -667,12 +229,6 @@ typedef struct {
Str255 symfilename;
} PCLTExtras;
-typedef struct CWCommandLineArgs {
- int argc;
- char **argv;
- char **envp;
-} CWCommandLineArgs;
-
typedef struct VersionInfo {
UInt16 major;
UInt16 minor;
@@ -680,7 +236,7 @@ typedef struct VersionInfo {
UInt16 build;
} VersionInfo;
-typedef struct CLPluginInfo {
+/*typedef struct CLPluginInfo {
OSType plugintype;
OSType language;
SInt32 dropinflags;
@@ -694,7 +250,7 @@ typedef struct ToolVersionInfo {
char *tool;
char *copyright;
char *version;
-} ToolVersionInfo;
+} ToolVersionInfo;*/
#ifdef __MWERKS__
#pragma options align=reset
#endif
@@ -707,11 +263,11 @@ struct ParseOptsType {
UInt16 ioCols;
UInt16 ioRows;
CWCommandLineArgs *args;
- ToolVersionInfo *toolVersion;
+ const ToolVersionInfo *toolVersion;
int numPlugins;
- CLPluginInfo *plugins;
+ const CLPluginInfo *plugins;
int numPanels;
- char **panelNames;
+ const char **panelNames;
OSType cpu;
OSType os;
char lastoutputname[256];
@@ -763,7 +319,7 @@ typedef struct {
} CLState; // assumed name
typedef struct BasePluginCallbacks {
- SInt16 (*main)(void *context);
+ SInt16 (*main)(CWPluginContext context);
SInt16 (*GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize);
SInt16 (*GetDisplayName)(const char **displayName);
SInt16 (*GetDropInName)(const char **dropInName);
@@ -804,12 +360,12 @@ typedef struct {
char *toolInfo;
char *copyright;
int numOptionLists;
- OptionList **optionLists;
+ struct OptionList **optionLists;
int numPrefDataPanels;
PrefDataPanel *prefDataPanels;
- int (*PreParse)(); // sig?
- int (*MidParse)(); // sig?
- int (*PostParse)(); // sig?
+ int (*PreParse)();
+ int (*MidParse)();
+ int (*PostParse)();
} ParserTool; // assumed name
// I think this is internally defined in its .c file
@@ -985,7 +541,7 @@ typedef struct CLTargetInfo {
OSSpec runfile;
OSSpec linkAgainstFile;
} CLTargetInfo;
-typedef struct CWTargetInfo {
+/*typedef struct CWTargetInfo {
SInt16 outputType;
FSSpec outfile;
FSSpec symfile;
@@ -1000,7 +556,7 @@ typedef struct CWTargetInfo {
OSType debuggerCreator;
OSType runHelperCreator;
FSSpec linkAgainstFile;
-} CWTargetInfo;
+} CWTargetInfo;*/
typedef struct Target {
struct BuildInfo {
UInt32 linesCompiled;
@@ -1186,8 +742,10 @@ typedef struct Project {
Target *targets;
OSSpec projectDirectory;
} Project;
+#ifndef __cplusplus
extern int Proj_Initialize(Project *this);
extern int Proj_Terminate(Project *this);
+#endif
/********************************/
/* command_line/CmdLine/Src/CLLicenses.c */
@@ -1300,8 +858,8 @@ extern void Paths_CopyRecurseFSS(FSSpec *fss, Paths *paths, UInt16 count);
//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 Frameworks_AddPath(const OSPathSpec *oss);
+extern int 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);
@@ -1315,6 +873,7 @@ extern OSErr GetMacFileType(const FSSpec *fss, void *a); // TODO sig
/********************************/
/* command_line/CmdLine/Src/Project/CLFiles.c */
+#ifndef __cplusplus
extern File *File_New();
extern void File_Free(File *file);
extern Boolean Files_Initialize(Files *this);
@@ -1329,9 +888,11 @@ 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);
+#endif
/********************************/
/* command_line/CmdLine/Src/Project/CLOverlays.c */
+#ifndef __cplusplus
extern Boolean Overlays_Initialize(Overlays *this);
extern Boolean Overlays_Terminate(Overlays *this);
extern Boolean Overlays_AddOvlGroup(Overlays *this, OvlGroup *grp, SInt32 *grpnum);
@@ -1350,6 +911,7 @@ 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);
+#endif
/********************************/
/* command_line/CmdLine/Src/Project/CLSegs.c */
@@ -1488,12 +1050,12 @@ extern int DisplayWarningOptions();
/********************************/
/* StaticParserGlue.c */
-extern int RegisterStaticParserResources();
extern int RegisterStaticParserPlugins();
+extern int RegisterStaticParserResources();
/********************************/
/* ParserFace.c */
-extern Handle Parser_FindPrefPanel(char *name);
+extern Handle Parser_FindPrefPanel(const 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);
@@ -1502,20 +1064,23 @@ 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_SupportsPanels(int numPanels, const char **panelNames, Boolean *isSupported);
extern SInt16 parser_main(struct CWPluginPrivateContext *context);
+extern const char *failedCallback;
+extern jmp_buf exit_plugin;
extern struct ParseOptsType parseopts;
/********************************/
/* ParserHelpers.c */
+extern SInt16 lastStage;
+
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 char *GetEnvVar(const char *name, Boolean warn, const char **match);
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 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);
extern int Opt_FindAndAddFileRef(const char *opt, void *var, const char *arg);
@@ -1524,8 +1089,8 @@ extern int AddFileList(const char *list, char sep1, char sep2, int source, char
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 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);
@@ -1534,21 +1099,42 @@ extern int Opt_MaybeMoveAccessPaths(const char *opt, void *var, const char *arg)
/********************************/
/* ToolHelpers.c */
+enum {
+ OutputOrdering0 = 0,
+ OutputOrdering1 = 1,
+ OutputOrdering2 = 2
+};
+extern SInt16 outputOrdering;
+extern Boolean setOutputDirectory;
+
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 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);
-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_SetStage(const char *opt, void *str, const char *arg, int flags);
extern int Opt_RedirectStream(const char *opt, void *file, const char *filename);
/********************************/
/* ParserHelpers-cc.c */
+extern Handle definesHandle;
+
+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;
@@ -1565,43 +1151,6 @@ 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);
@@ -1618,12 +1167,12 @@ 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 AddAccessPath(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 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);
@@ -1631,73 +1180,14 @@ extern int GetSegment(SInt32 segmentnum, char *name, SInt16 *attrs);
/********************************/
/* 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();
/********************************/
-/* 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);
@@ -1705,7 +1195,7 @@ 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 char *CLPGetErrorString(SInt16 errid, char *buffer);
extern void CLPReportError(SInt16 errid, ...);
extern void CLPReportWarning(SInt16 errid, ...);
extern void CLPReport(SInt16 errid, ...);
@@ -1721,33 +1211,23 @@ extern char curopt[1024];
/* Utils.c */
// something is weird with these parameters
// they're supposed to be just "char"...
+#ifdef UNSIGNED_CHAR_FOR_MY_UTILS
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);
+#else
+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);
+#endif
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();
-
-/********************************/
/* */
/********************************/
@@ -1798,10 +1278,11 @@ extern void COS_FileGetFSSpecInfo(const FSSpec *spec, SInt16 *vRefNum, SInt32 *d
extern void COS_FileGetPathName(char *buffer, const FSSpec *spec, SInt32 *mdDat);
extern Boolean COS_EqualFileSpec(const FSSpec *a, const FSSpec *b);
+#include "option_system.h"
+
// TODO sort me
extern Project *gProj;
-extern ParserTool *pTool;
extern PCmdLine optsCmdLine;
extern PCmdLineEnvir optsEnvir;
extern PCmdLineCompiler optsCompiler;
@@ -1826,6 +1307,10 @@ extern char *MAINOPTCHAR;
extern char *SEPOPTSTR;
extern char compat;
extern anon0_50 linkargs;
+extern anon0_50 prelinkargs;
+extern anon0_50 postlinkargs;
+extern PCmdLine pCmdLine;
+extern PCmdLineCompiler pCmdLineCompiler;
#ifdef __cplusplus
}