summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-13 01:36:56 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-13 01:36:56 +0000
commit9d985413ce2b60a1a8cf001913ee8dac81c03aac (patch)
tree348ab31884f2dd89d285e06c42e656e35835ff38 /includes
parent3a6db389b250439a0cce6b45ef1424a5728f5d18 (diff)
downloadMWCC-9d985413ce2b60a1a8cf001913ee8dac81c03aac.tar.gz
MWCC-9d985413ce2b60a1a8cf001913ee8dac81c03aac.zip
fix lots more issues, add endian conversions to ObjGenMachO, add 64-bit kludge to Switch.c
Diffstat (limited to '')
-rw-r--r--includes/common.h1
-rw-r--r--includes/compiler/CompilerTools.h18
-rw-r--r--includes/compiler/PCodeInfo.h1
-rw-r--r--includes/mwcc_decomp.h94
4 files changed, 19 insertions, 95 deletions
diff --git a/includes/common.h b/includes/common.h
index ba9b54c..9ea51fb 100644
--- a/includes/common.h
+++ b/includes/common.h
@@ -15,7 +15,6 @@
#ifdef __MWERKS__
#define macintosh
-//#include <MacHeadersMach-O>
#define CW_PASCAL pascal
#undef toupper
#undef tolower
diff --git a/includes/compiler/CompilerTools.h b/includes/compiler/CompilerTools.h
index b218925..1338f29 100644
--- a/includes/compiler/CompilerTools.h
+++ b/includes/compiler/CompilerTools.h
@@ -3,6 +3,10 @@
#include "compiler/common.h"
+#ifdef __LITTLE_ENDIAN__
+#define ENDIAN_CONVERSION
+#endif
+
extern void CompilerGetPString(short index, unsigned char *string);
extern void CompilerGetCString(short index, char *string);
extern unsigned char *CTool_CtoPstr(char *cstr);
@@ -49,6 +53,20 @@ struct GList {
extern long hash_name_id;
extern HashNameNode **name_hash_nodes;
+
+#ifdef __LP64__
+#define CW_64_BIT_SUPPORT
+#endif
+
+// These don't exist in the original source, but are kind of necessary in the 2020s
+#ifdef CW_64_BIT_SUPPORT
+extern void *CTool_ResolveIndexToPointer(UInt32 index);
+extern UInt32 CTool_CreateIndexFromPointer(void *ptr);
+#else
+#define CTool_ResolveIndexToPointer(index) ((void *) (index))
+#define CTool_CreateIndexFromPointer(ptr) ((UInt32) (ptr))
+#endif
+
extern void (*GListErrorProc)(void);
extern short InitGList(GList *gl, SInt32 size);
diff --git a/includes/compiler/PCodeInfo.h b/includes/compiler/PCodeInfo.h
index 330a422..bc29b26 100644
--- a/includes/compiler/PCodeInfo.h
+++ b/includes/compiler/PCodeInfo.h
@@ -17,6 +17,7 @@ typedef enum {
PCOp_PLACEHOLDEROPERAND
} PCOpKind;
+// unify me with RefType?
typedef enum {
PCOpMemory0 = 0,
PCOpMemory1 = 1
diff --git a/includes/mwcc_decomp.h b/includes/mwcc_decomp.h
deleted file mode 100644
index 312c858..0000000
--- a/includes/mwcc_decomp.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#pragma once
-#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
-
-/********************************/
-/* command_line/CmdLine/Src/Clients/CLStaticMain.c */
-extern int main(int argc, const char **argv);
-
-/********************************/
-/* ??? */
-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
-
-/********************************/
-/* 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(void);
-extern int RegisterStaticTargetPlugins(void);
-
-/********************************/
-/* Might be ParserGlue-mach-ppc-cc.c? */
-extern int RegisterStaticParserToolInfo(void);
-
-/********************************/
-/* Might be cc-mach-ppc.c? */
-extern int RegisterStaticCompilerPlugin(void);
-extern int RegisterCompilerResources(void);
-
-/********************************/
-/* libimp-mach-ppc.c */
-// some statics here
-extern int RegisterStaticLibImporterPlugin(void);
-extern int RegisterLibImporterResources(void);
-
-/********************************/
-/* TargetOptimizer-ppc-mach.c */
-extern int TargetSetOptFlags(SInt16 val, Boolean set);
-extern void TargetDisplayOptimizationOptions(Handle txt);
-extern void TargetSetPragmaOptimizationsToUnspecified(void);
-
-/********************************/
-/* OptimizerHelpers.c */
-extern int SetPragmaOptimizationsToUnspecified(void);
-extern int SetOptFlags(char *opt, void *str, ...); // two unknown args
-extern int DisplayOptimizationOptions(void);
-
-/********************************/
-/* 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(void);
-
-/********************************/
-/* CCompiler.c */
-extern CWPLUGIN_ENTRY(MWC_main)(CWPluginContext context);
-
-// LOTS OF STUFF
-
-/********************************/
-/* StaticParserGlue.c */
-extern int RegisterStaticParserPlugins(void);
-extern int RegisterStaticParserResources(void);
-
-/********************************/
-/* 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];
-
-
-#ifdef __cplusplus
-}
-#endif