From b8df05413a4e8b299de07b915cddce73a3bb16e3 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Thu, 13 Oct 2022 17:56:43 +0100 Subject: finish CLMain.c --- includes/mwcc_decomp.h | 72 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 23 deletions(-) (limited to 'includes/mwcc_decomp.h') diff --git a/includes/mwcc_decomp.h b/includes/mwcc_decomp.h index 5efb2a1..52f25c6 100644 --- a/includes/mwcc_decomp.h +++ b/includes/mwcc_decomp.h @@ -268,6 +268,11 @@ enum { #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; @@ -367,6 +372,21 @@ 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 @@ -472,6 +492,12 @@ struct CWPluginPrivateContext { #ifdef __MWERKS__ #pragma options align=mac68k #endif +enum { + OptsCmdLineState_0 = 0, + OptsCmdLineState_1 = 1, + OptsCmdLineState_2 = 2, + OptsCmdLineState_3 = 3 +}; typedef struct PCmdLine { SInt16 version; SInt16 state; @@ -485,8 +511,8 @@ typedef struct PCmdLine { Boolean timeWorking; Boolean noWarnings; Boolean warningsAreErrors; - Boolean maxErrors; - Boolean maxWarnings; + UInt16 maxErrors; + UInt16 maxWarnings; SInt16 msgStyle; Boolean noWrapOutput; Boolean stderr2stdout; @@ -640,9 +666,6 @@ typedef struct { Str255 mapfilename; Str255 symfilename; } PCLTExtras; -#ifdef __MWERKS__ -#pragma options align=reset -#endif typedef struct CWCommandLineArgs { int argc; @@ -672,6 +695,9 @@ typedef struct ToolVersionInfo { char *copyright; char *version; } ToolVersionInfo; +#ifdef __MWERKS__ +#pragma options align=reset +#endif // may not actually be named this struct ParseOptsType { @@ -715,7 +741,7 @@ struct ParseOptsType { typedef struct { int argc; - const char **argv; + char **argv; OSType cpu; OSType os; OSType plugintype; @@ -732,7 +758,7 @@ typedef struct { OSSpec makefileSpec; OSPathSpec sbmPathSpec; OSHandle browseTableHandle; - const char *stdout_base; + char *stdout_base; int stdout_written; } CLState; // assumed name @@ -1028,7 +1054,7 @@ 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 RegisterResource(const char *name, SInt16 rsrcid, const char **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); @@ -1041,9 +1067,9 @@ 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 void Main_PreParse(int *argc, char ***argv); +extern void Main_PassSpecialArgs(int *argc, char ***argv); +extern int Main_Initialize(int argc, char **argv); extern int Main_Terminate(int code); extern int Main_Driver(); @@ -1099,10 +1125,10 @@ 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 int Plugins_GetPluginList(Plugin *list, int *numPlugins, CLPluginInfo **pluginInfo); +extern int Plugins_GetPrefPanelUnion(Plugin *list, int *numPanels, char ***panelNames); +extern int Plugin_AddFileTypeMappings(Plugin *pl, OSFileTypeMappingList *ftml); +extern int Plugins_AddFileTypeMappingsForTarget(Plugin *list, OSFileTypeMappings **mlist, OSType cpu, OSType os); extern SInt16 Plugin_Call(Plugin *pl, void *context); /********************************/ @@ -1139,19 +1165,19 @@ 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 void CLPrint(const char *format, ...); +extern void CLPrintWarning(const char *format, ...); +extern void CLPrintErr(const char *format, ...); 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); +extern void AppendArgumentList(int *argc, 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 SetupTemporaries(); +extern int DeleteTemporaries(); extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile); /********************************/ @@ -1183,12 +1209,12 @@ extern Boolean SendParserRequest( int numPlugins, CLPluginInfo *pluginInfo, int numPanels, - const char **panelNames, + char **panelNames, CWCommandLineArgs *plugin_args, CWCommandLineArgs *panel_args, const char *build_date, const char *build_time, - ToolVersionInfo *build_tool + const ToolVersionInfo *build_tool ); extern Boolean SendCompilerRequest(Plugin *plugin, File *file, SInt16 stage); extern Boolean SendTargetInfoRequest(Target *targ, Plugin *linker, SInt32 dropinflags); -- cgit v1.2.3