]> Shamusworld >> Repos - rmac/blobdiff - rmac.h
Removed -w flag, added +o[n], ~o[n] switches to control individual optimisations...
[rmac] / rmac.h
diff --git a/rmac.h b/rmac.h
index 5ef9953c1559fe83ce93f14bc0f7cb0bfad39f90..39b8ae67a5dcca8d240f3b81816e475e6b7f8a6d 100644 (file)
--- a/rmac.h
+++ b/rmac.h
@@ -9,10 +9,19 @@
 #ifndef __RMAC_H__
 #define __RMAC_H__
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
 //
 // TARGET SPECIFIC BUILD SETTINGS
 //
 #if defined(WIN32) || defined (WIN64)
+       #include <io.h>
+       #include <fcntl.h>
        // Release platform - windows
        #define PLATFORM        "Win32"
        #define _OPEN_FLAGS     _O_TRUNC|_O_CREAT|_O_BINARY|_O_RDWR
                        #pragma warning(disable:4996)
                #endif
 
-       //Makes warnings double clickable on visual studio
+       // Makes warnings double clickable on visual studio (ggn)
        #define STRINGIZE_HELPER(x) #x
        #define STRINGIZE(x) STRINGIZE_HELPER(x)
-       #define WARNING(desc) message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc)
+       #define WARNING(desc) __pragma(message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc))
 
        // usage:
-       //#pragma WARNING(FIXME: Code removed because...)
+       // WARNING(FIXME: Code removed because...)
+
+       #else
+       //If we're not compiling for Visual Studio let's assume that we're using
+       //some flavour of gcc instead. So let's use the gcc compliant macro instead.
+       //If some weirdo uses something else (I dunno, Intel compiler or something?)
+       //this is probably going to explode spectacularly. Let's wait for the fireworks!
+       #define DO_PRAGMA(x) _Pragma (#x)
+       #define WARNING(desc) DO_PRAGMA(message (#desc))
+       #define inline __inline
 
        #endif
-       #include <io.h>
-       #include <fcntl.h>
-       #include <stdio.h>
-       #include <stdlib.h>
-       #include <string.h>
-       #include <ctype.h>
-       #include <sys/types.h>
-       #include <sys/stat.h>
 
 #else 
        #ifdef __GCCUNIX__
+       #include <sys/fcntl.h>
+       #include <unistd.h>
        // Release platform - mac OS-X or linux
        #define PLATFORM        "OSX/Linux"
        #define _OPEN_FLAGS     O_TRUNC|O_CREAT|O_RDWR
        #define _OPEN_INC       O_RDONLY
-       #define _PERM_MODE      S_IREAD|S_IWRITE 
-       #include <sys/fcntl.h>
-       #include <stdio.h>
-       #include <stdlib.h>
-       #include <string.h>
-       #include <ctype.h>
-       #include <sys/types.h>
-       #include <sys/stat.h>
-       #include <unistd.h>
+       #define _PERM_MODE      S_IRUSR|S_IWUSR
+       // WARNING WARNING WARNING
+       #define DO_PRAGMA(x) _Pragma (#x)
+       #define WARNING(desc) DO_PRAGMA(message (#desc))
 #else
        // Release platform - not specified 
+       #include <sys/fcntl.h>
        #define PLATFORM        "Unknown"
        #define _OPEN_FLAGS     O_TRUNC|O_CREAT|O_RDWR
        #define _OPEN_INC       O_RDONLY
-       #define _PERM_MODE      S_IREAD|S_IWRITE 
-       #include <sys/fcntl.h>
-       #include <stdio.h>
-       #include <stdlib.h>
-       #include <string.h>
-       #include <ctype.h>
-       #include <sys/types.h>
-       #include <sys/stat.h>
+       #define _PERM_MODE      S_IREAD|S_IWRITE
+       // Defined here, even though the platform may not support it...
+       #define DO_PRAGMA(x) _Pragma (#x)
+       #define WARNING(desc) DO_PRAGMA(message (#desc))
        #endif
 #endif
 
@@ -180,6 +184,16 @@ PTR
 
 //#define RISCSYM      0x00010000
 
+// Optimisation defines
+enum
+{
+       OPT_ABS_SHORT       = 0,
+       OPT_MOVEL_MOVEQ     = 1,
+       OPT_BSR_BCC_S       = 2,
+       OPT_INDIRECT_DISP   = 3,
+       OPT_COUNT   // Dummy, used to count number of optimisation switches
+};
+
 // Globals, externals, etc.
 extern int verb_flag;
 extern int debug;
@@ -196,6 +210,8 @@ extern int lsym_flag;
 extern int sbra_flag;
 extern int obj_format;
 extern int legacy_flag;
+extern LONG PRGFLAGS;
+extern int optim_flags[OPT_COUNT];
 
 // Exported functions
 char * fext(char *, char *, int);