summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-10-13 17:56:43 +0100
committerAsh Wolf <ninji@wuffs.org>2022-10-13 17:56:43 +0100
commitb8df05413a4e8b299de07b915cddce73a3bb16e3 (patch)
tree74260aa4137676a7dc40fab0d07526d39a1de688 /includes
parent59a724bd4cc7a543686c633572510e6763b34d39 (diff)
downloadMWCC-b8df05413a4e8b299de07b915cddce73a3bb16e3.tar.gz
MWCC-b8df05413a4e8b299de07b915cddce73a3bb16e3.zip
finish CLMain.c
Diffstat (limited to 'includes')
-rw-r--r--includes/common.h1
-rw-r--r--includes/macemul.h2
-rw-r--r--includes/mwcc_decomp.h72
-rw-r--r--includes/oslib.h2
4 files changed, 52 insertions, 25 deletions
diff --git a/includes/common.h b/includes/common.h
index 39a9abf..6a0b12c 100644
--- a/includes/common.h
+++ b/includes/common.h
@@ -4,6 +4,7 @@
* Common imports and Mac OS types
*/
#include <ctype.h>
+#include <setjmp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/includes/macemul.h b/includes/macemul.h
index 03b6c68..4d0e502 100644
--- a/includes/macemul.h
+++ b/includes/macemul.h
@@ -146,7 +146,7 @@ extern Boolean LMGetResLoad();
/********************************/
/* ResourceStrings */
extern void Res_Initialize();
-extern int Res_AddResource(const char *name, SInt16 rsrcid, const char **strings);
+extern int Res_AddResource(const char *name, SInt16 rsrcid, Handle strings);
extern const char *Res_GetResource(SInt16 rsrcid, SInt16 index);
extern void Res_Cleanup();
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);
diff --git a/includes/oslib.h b/includes/oslib.h
index bb841ac..22e8ddc 100644
--- a/includes/oslib.h
+++ b/includes/oslib.h
@@ -101,7 +101,7 @@ extern int OS_AppendHandle(OSHandle *hand, const void *data, UInt32 len);
/* Platform-Specific */
extern uOSTypePair OS_TEXTTYPE;
extern const char *OS_GetErrText(int err);
-extern int OS_InitProgram(int *pArgc, const char ***pArgv);
+extern int OS_InitProgram(int *pArgc, char ***pArgv);
extern int OS_TermProgram();
extern int OS_Create(const OSSpec *spec, const uOSTypePair *type);
extern int OS_Status(const OSSpec *spec);