]> Shamusworld >> Repos - rmac/commitdiff
Fixed WARNING macro to be system agnostic, added doco for -p switch.
authorShamus Hammons <jlhamm@acm.org>
Wed, 7 Oct 2015 03:23:59 +0000 (22:23 -0500)
committerShamus Hammons <jlhamm@acm.org>
Wed, 7 Oct 2015 03:23:59 +0000 (22:23 -0500)
macro.c
object.c
rmac.c
rmac.h
sect.c
token.c
version.h

diff --git a/macro.c b/macro.c
index 4232f1af60e53d323e20ebb242e0c23c02529f59..e7d51dd0ba5e76ff9982de4d4f541e4735e72796 100644 (file)
--- a/macro.c
+++ b/macro.c
@@ -40,7 +40,6 @@ void InitMacro(void)
 {
        macuniq = 0;
        macnum = 1;
-//     argp = NULL;
        argp = 0;
 }
 
@@ -53,11 +52,7 @@ void InitMacro(void)
 //
 int ExitMacro(void)
 {
-#ifndef _MSC_VER
-#pragma message !!! Bad macro exiting !!!
-#else
-#pragma WARNING(!!! Bad macro exiting !!!)
-#endif
+WARNING(!!! Bad macro exiting !!!)
 
 /*
 This is a problem. Currently, the argument logic just keeps the current
@@ -253,11 +248,7 @@ int defr1(char * ln, int kwno)
                rptlevel++;
        default:
 //MORE stupidity here...
-#ifndef _MSC_VER
-#pragma warning "!!! Casting (char *) as LONG !!!"
-#else
-#pragma WARNING(!!! Casting (char *) as LONG !!!)
-#endif
+WARNING(!!! Casting (char *) as LONG !!!)
        addln:
                // Allocate length of line + 1('\0') + LONG
                len = strlen(ln) + 1 + sizeof(LONG);
index 3412740f7654dba19769c76731fbe49ab4ac4b35..2702c54ad4dd4cdf586f63351d5fc6bb7d60474b 100644 (file)
--- a/object.c
+++ b/object.c
@@ -187,7 +187,7 @@ char * constr_symtab(register char * buf, SYM * sym, int globflag)
 //
 int WriteObject(int fd)
 {
-//     LONG t;                                 // Scratch long
+       LONG t;                                 // Scratch long
        LONG tds;                               // TEXT & DATA segment size
        int i;                                  // Temporary int
        CHUNK * cp;                             // Chunk (for gather)
diff --git a/rmac.c b/rmac.c
index a7d1770b1a2348fc81ac1ccbedca0495c1f806df..0c663b40a0af0cca1b76faed1e2e73bad35f9f82 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -132,6 +132,7 @@ void DisplayHelp(void)
                "  -l[filename]      Create an output listing file\n"
                "  -n                Don't do things behind your back in RISC assembler\n"
                "  -o file           Output file name\n"
+               "  -p[n]             Create an ST .prg (1=normal, 2=w/symbols)\n"
                "  -r[size]          Pad segments to boundary size specified\n"
                "                    w: word (2 bytes, default alignment)\n"
                "                    l: long (4 bytes)\n"
diff --git a/rmac.h b/rmac.h
index 5ef9953c1559fe83ce93f14bc0f7cb0bfad39f90..62fb5427e0fc80b48dc1909352273369366e2931 100644 (file)
--- a/rmac.h
+++ b/rmac.h
                        #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...)
 
        #endif
        #include <io.h>
@@ -48,6 +48,9 @@
        #define _OPEN_FLAGS     O_TRUNC|O_CREAT|O_RDWR
        #define _OPEN_INC       O_RDONLY
        #define _PERM_MODE      S_IREAD|S_IWRITE 
+       // WARNING WARNING WARNING
+       #define DO_PRAGMA(x) _Pragma (#x)
+       #define WARNING(desc) DO_PRAGMA(message (#desc))
        #include <sys/fcntl.h>
        #include <stdio.h>
        #include <stdlib.h>
@@ -62,6 +65,9 @@
        #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 platfrom may not support it...
+       #define DO_PRAGMA(x) _Pragma (#x)
+       #define WARNING(desc) DO_PRAGMA(message (#desc))
        #include <sys/fcntl.h>
        #include <stdio.h>
        #include <stdlib.h>
diff --git a/sect.c b/sect.c
index 64ccb441b759cb6f212fc96faf5210bbc4ee045e..5690b1bd52c7ed8688617b4282ceb2989055d9df 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -274,11 +274,7 @@ int AddFixup(WORD attr, LONG loc, TOKEN * fexpr)
        SECT * p;
        // Shamus: Expression lengths are voodoo ATM (variable "i"). Need to fix
        //         this.
-#ifndef _MSC_VER
-#pragma warning "!!! AddFixup() is filled with VOODOO !!!"
-#else
-#pragma WARNING(!!! AddFixup() is filled with VOODOO !!!)
-#endif
+WARNING(!!! AddFixup() is filled with VOODOO !!!)
        DEBUG printf("FIXUP@$%X: $%X\n", loc, attr);
 
        // Compute length of expression (could be faster); determine if it's the
@@ -613,45 +609,6 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        else
                                                reg2 = (signed)((eval - (loc + 2)) / 2);// & 0x1F;
 
-#if 0
-                                       if ((w & 0x0F00) == FU_MJR)
-                                       {
-                                               // Main code destination alignment checking here for
-                                               // forward declared labels
-                                               address = (oaddr) ? oaddr : loc;
-
-                                               if (((address >= 0xF03000) && (address < 0xF04000)
-                                                       && (eval < 0xF03000)) || ((eval >= 0xF03000)
-                                                       && (eval < 0xF04000) && (address < 0xF03000)))
-                                               {
-                                                       warni("* \'jr\' at $%08X - cannot jump relative between "
-                                                               "main memory and local gpu ram", address);
-                                               }
-                                               else
-                                               {
-                                                       page_jump = (address & 0xFFFFFF00) - (eval & 0xFFFFFF00);
-
-                                                       if (page_jump)
-                                                       {
-                                                               // This jump is to a page outside of the
-                                                               // current 256 byte page
-                                                               if (eval % 4)
-                                                               {
-                                                                       warni("* \'jr\' at $%08X - destination address not aligned for long page jump, insert a \'nop\' before the destination address", address);
-                                                               }
-                                                       }
-                                                       else
-                                                       {
-                                                               // This jump is in the current 256 byte page
-                                                               if ((eval - 2) % 4)
-                                                               {
-                                                                       warni("* \'jr\' at $%08X - destination address not aligned for short page jump, insert a \'nop\' before the destination address", address);
-                                                               }
-                                                       }
-                                               }
-                                       }
-#endif
-
                                        if ((reg2 < -16) || (reg2 > 15))
                                        {
                                                error("relative jump out of range");
@@ -778,58 +735,6 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                        case FU_LONG:
                                if ((w & FUMASKRISC) == FU_MOVEI)
                                {
-#if 0
-                                       address = loc + 4;
-
-                                       if (eattr & DEFINED)
-                                       {
-                                               for(j=0; j<fwindex; j++)
-                                               {
-                                                       if (fwdjump[j] == address)
-                                                       {
-                                                               page_jump = (address & 0xFFFFFF00) - (eval & 0xFFFFFF00);
-
-                                                               if (page_jump)
-                                                               {
-                                                                       if (eval % 4)
-                                                                       {
-                                                                               err_setup();
-                                                                               sprintf(buf, "* \'jump\' at $%08X - destination address not aligned for long page jump, insert a \'nop\' before the destination address", address);
-
-                                                                               if (listing > 0)
-                                                                                       ship_ln(buf);
-
-                                                                               if (err_flag)
-                                                                                       write(err_fd, buf, (LONG)strlen(buf));
-                                                                               else
-                                                                                       printf("%s\n", buf);
-                                                                       }          
-                                                               }
-                                                               else
-                                                               {
-                                                                       if (!(eval & 0x0000000F) || ((eval - 2) % 4))
-                                                                       {
-                                                                               err_setup();
-                                                                               sprintf(buf, "* \'jump\' at $%08X - destination address not aligned for short page jump, insert a \'nop\' before the destination address", address);
-
-                                                                               if (listing > 0)
-                                                                                       ship_ln(buf);
-
-                                                                               if (err_flag)
-                                                                                       write(err_fd, buf, (LONG)strlen(buf));
-                                                                               else
-                                                                                       printf("%s\n", buf);
-                                                                       }          
-                                                               }
-
-                                                               // Clear this jump as it has been checked
-                                                               fwdjump[j] = 0;
-                                                               j = fwindex;
-                                                       }
-                                               }
-                                       }
-#endif
-
                                        // Long constant in MOVEI # is word-swapped, so fix it here
                                        eval = ((eval >> 16) & 0x0000FFFF) | ((eval << 16) & 0xFFFF0000);
                                        flags = (MLONG | MMOVEI);
diff --git a/token.c b/token.c
index 1cd9ebadc5df82706d94a683cdc5e02570fc5d24..cc754ab88e65e2f683977a09b44a24f8ba624e38 100644 (file)
--- a/token.c
+++ b/token.c
@@ -1547,11 +1547,7 @@ int d_goto(WORD unused)
                        // Compare names (sleazo string compare)
                        // This string compare is not right. Doesn't check for lengths.
                        // (actually it does, but in a crappy, unclear way.)
-#ifndef _MSC_VER
-                       #warning "!!! Bad string comparison !!!"
-#else
-                       #pragma WARNING(!!!! Bad string comparison !!!)
-#endif
+WARNING(!!!! Bad string comparison !!!)
                        s1 = sym;
 //                     s2 = (char *)(defln + 1) + 1;
                        s2 = defln->line;
index 31ce8213baab7eb71e7e5aeb5ce34719c6b95a46..64a0c5ece9912637602fbcea3fb120d433999d6f 100644 (file)
--- a/version.h
+++ b/version.h
@@ -13,6 +13,6 @@
 
 #define MAJOR   1              // Major version number
 #define MINOR   3              // Minor version number
-#define PATCH   7              // Patch release number
+#define PATCH   8              // Patch release number
 
 #endif // __VERSION_H__