X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=rmac.h;h=1fa419bc172d153c7f7f0d7ea92e301619827873;hp=f660a0d788295c711d39bbebcd6e240dbd30692b;hb=0fd4b86c9899d254d9aea0660e5046c4234cfd42;hpb=49cce96fba11282e4244187f15be418d5ae5bb8d diff --git a/rmac.h b/rmac.h index f660a0d..1fa419b 100644 --- a/rmac.h +++ b/rmac.h @@ -3,18 +3,27 @@ // RMAC.H - Main Application Code // Copyright (C) 199x Landon Dyer, 2011 Reboot & Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 -// Source Utilised with the Kind Permission of Landon Dyer +// Source utilised with the kind permission of Landon Dyer // #ifndef __RMAC_H__ #define __RMAC_H__ +#include +#include +#include +#include +#include +#include + // // TARGET SPECIFIC BUILD SETTINGS // - -#ifdef WIN32 - #define PLATFORM "Win32" // Release platform - windows +#if defined(WIN32) || defined (WIN64) + #include + #include + // Release platform - windows + #define PLATFORM "Win32" #define _OPEN_FLAGS _O_TRUNC|_O_CREAT|_O_BINARY|_O_RDWR #define _OPEN_INC _O_RDONLY|_O_BINARY #define _PERM_MODE _S_IREAD|_S_IWRITE @@ -22,45 +31,56 @@ #if _MSC_VER > 1000 #pragma warning(disable:4996) #endif + + // Makes warnings double clickable on visual studio (ggn) + #define STRINGIZE_HELPER(x) #x + #define STRINGIZE(x) STRINGIZE_HELPER(x) + #define WARNING(desc) __pragma(message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc)) + + // usage: + // 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 - #include - #include - #include - #include - #include - #include - #include + #else #ifdef __GCCUNIX__ - #define PLATFORM "OSX/Linux" // Release platform - mac OS-X or linux - #define _OPEN_FLAGS O_TRUNC|O_CREAT|O_RDWR - #define _OPEN_INC O_RDONLY - #define _PERM_MODE S_IREAD|S_IWRITE #include - #include - #include - #include - #include - #include - #include #include -#else - #define PLATFORM "Unknown" // Release platform - not specified + // 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 + #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 - #include - #include - #include - #include - #include - #include + #define PLATFORM "Unknown" + #define _OPEN_FLAGS O_TRUNC|O_CREAT|O_RDWR + #define _OPEN_INC O_RDONLY + #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 +// +// Non-target specific stuff +// #include +#include "symbol.h" #define BYTE uint8_t #define WORD uint16_t @@ -69,7 +89,7 @@ #define ERROR (-1) // Generic error return #define EOS '\0' // End of string -#define SPACE ' ' // Ascii space +#define SPACE ' ' // ASCII space #define SLASHCHAR '/' #define SLASHSTRING "/" #define VALUE LONG // Assembler value @@ -113,21 +133,6 @@ #define MWC 1 // Mark Williams object format #define BSD 2 // BSD object format -// Symbols -#define SYM struct _sym -SYM -{ - SYM * snext; // * -> Next symbol on hash-chain - SYM * sorder; // * -> Next sym in order of refrence - SYM * sdecl; // * -> Next sym in order of declaration - BYTE stype; // Symbol type - WORD sattr; // Attribute bits - LONG sattre; // Extended attribute bits - WORD senv; // Enviroment number - LONG svalue; // Symbol value - char * sname; // * -> Symbol's print-name -}; - // Pointer type that can point to (almost) anything #define PTR union _ptr PTR @@ -177,9 +182,19 @@ PTR #define EQUATEDCC 0x0020 #define UNDEF_CC 0x0040 -#define RISCSYM 0x00010000 +//#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 +// Globals, externals, etc. extern int verb_flag; extern int debug; extern int rgpu, rdsp; @@ -194,20 +209,14 @@ extern int glob_flag; extern int lsym_flag; extern int sbra_flag; extern int obj_format; -extern LONG amemtot; -extern int in_main; +extern int legacy_flag; +extern LONG PRGFLAGS; +extern int optim_flags[OPT_COUNT]; -// Prototypes -void init_sym(void); -SYM * newsym(char *, int, int); +// Exported functions char * fext(char *, char *, int); -void cantcreat(char *); -int kmatch(char *, int *, int *, int *, int *); -void autoeven(int); int nthpath(char *, int, char *); -void clear(char *, LONG); -char * copy(char *, char *, LONG); -int rmac_qsort(char *, int, int, int (*)()); -//char * amem(LONG); +int ParseOptimization(char * optstring); #endif // __RMAC_H__ +