as: more tidying up
authorAlan Cox <alan@linux.intel.com>
Sun, 24 Jul 2016 20:51:23 +0000 (21:51 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 24 Jul 2016 20:51:23 +0000 (21:51 +0100)
Applications/as09/as.c
Applications/as09/assemble.c
Applications/as09/express.c
Applications/as09/genbin.c
Applications/as09/genobj.c
Applications/as09/mops.c
Applications/as09/pops.c
Applications/as09/scan.c
Applications/as09/table.c

index 70ca16e..aa3f81e 100644 (file)
@@ -30,12 +30,12 @@ static char * binfilename = 0;
 static char * objfilename = 0;
 static int keep_bad_output = 0;
 
-static void initp1 P((void));
-static int my_creat P((char *name, char *message));
-static void process_args P((int argc, char **argv));
-static void summary P((fd_t fd));
-static void summ_number P((unsigned num));
-static void usage P((void));
+static void initp1(void);
+static int my_creat(char *name, char *message);
+static void process_args(int argc, char **argv);
+static void summary(fd_t fd);
+static void summ_number(unsigned num);
+static void usage(void);
 
 int main(int argc, char *argv[])
 {
@@ -96,11 +96,8 @@ void finishup(void)
 
 static void initp1(void)
 {
-#ifdef I80386
+#if defined(I80386)
     idefsize = defsize = 2;    /* I think this is probably safer (RDB) */
-#endif
-#if 0
-    idefsize = defsize = sizeof (char *) > 2 ? 4 : 2;
 #endif
     lctabtop = lctab + NLOC;
     lstfil = STDOUT;
@@ -139,11 +136,7 @@ static int my_creat(char *name, char *message)
 {
     int fd;
 
-#ifdef O_BINARY
-    if ((fd = open(name, O_RDWR|O_BINARY|O_CREAT|O_TRUNC, CREAT_PERMS)) < 0 || fd > 255)
-#else
     if ((fd = creat(name, CREAT_PERMS)) < 0 || fd > 255)
-#endif
        as_abort(message);
     return fd;
 }
@@ -185,7 +178,7 @@ static void process_args(int argc, char *argv[])
            {
            case 'v':
               outfd = STDOUT;
-              writes("as86 version: ");
+              writes("as version: ");
 #ifdef VERSION
               writesn(VERSION);
 #else
index 12cf6c9..9d14833 100644 (file)
@@ -9,7 +9,7 @@
 #include "scan.h"
 
 static bool_t nocolonlabel;    /* set for labels not followed by ':' */
-static void (*routine) P((void));
+static void (*routine)(void);
 #ifdef I80386
 static opcode_t rep = 0;       /* which rep/repne prefix was seen */
 #endif
index a43a919..4b8fb39 100644 (file)
@@ -8,12 +8,12 @@
 #include "scan.h"
 #include "source.h"
 
-static void experror P((char * err_str));
-static void expundefined P((void));
-static void simple2 P((void));
-static void simple P((void));
-static void term P((void));
-static void factor2 P((void));
+static void experror(char * err_str);
+static void expundefined(void);
+static void simple2(void);
+static void simple(void);
+static void term(void);
+static void factor2(void);
 
 void absexpres(void)
 {
index a6228e9..5664023 100644 (file)
@@ -27,7 +27,7 @@ static offset_t binmin;       /* minimum value of binmbuf for pass 1 */
 #define PT offset_t
 #endif
 
-static void putbinoffset P((offset_t offset, count_t size));
+static void putbinoffset(offset_t offset, count_t size);
 
 /* write header to binary file */
 
@@ -214,18 +214,7 @@ void putbin(opcode_pt ch)
            else
 #endif
            {
-#ifdef MSDOS
-static PT zapptr = 0;
-#endif
                outfd = binfil;
-#ifdef MSDOS
-               while (binfbuf < (PT)binmbuf && binfbuf >= zapptr+binmin)
-               {
-                   writec(0);
-                   ++binfbuf;
-                   ++zapptr;
-               }
-#endif
                if( binfbuf != (PT)binmbuf)
                    if( lseek(binfil, (long)((PT)binmbuf-binfbuf), 1) < 0 )
                        error(BWRAP);
@@ -256,6 +245,7 @@ static void putbinoffset(offset_t offset, count_t size)
 {
     char buf[sizeof offset];
 
+    /* FIXME: implies our binary format depends on stuff we don't want it to ? */
 #if SIZEOF_OFFSET_T > 0x2
     u4cn(buf, offset, size);
 #else
index b4ba994..8b5e0f7 100644 (file)
@@ -307,7 +307,7 @@ void initobj(void)
 
 void objheader(void)
 {
-    static char module_header[] =
+    static unsigned char module_header[] =
     {
 #ifdef I80386
        0xA3, 0x86,
@@ -346,7 +346,7 @@ void objheader(void)
 
     if ((objectc = objectg) == 0)
        return;
-    writeobj(module_header, sizeof module_header);
+    writeobj((char *)module_header, sizeof module_header);
 
     /* calculate number of imported/exported symbols */
     /* and lengths of symbol and string tables */
@@ -443,6 +443,7 @@ void objheader(void)
 
     /* offset to start of text */
 
+    /* FIXME : on 16bit need to force maths to 32bit as well ? */
     putobj4((u32_T) (sizeof module_header + 4 + 4 + 2 + 1 + 1 +
                     sizeof seg_max_sizes + 4 + segsizebytes + 2 +
                     symosiz) + strsiz);
index 8cad14e..2a85637 100644 (file)
 #define is8bitsignedoffset(offset) ((offset_t) (offset) + 0x80 < 0x100)
 #define pass2 (pass==last_pass)
 
-static void mshort2 P((void));
-static reg_pt regchk P((void));
-static void reldata P((void));
-static void segadj P((void));
+static void mshort2(void);
+static reg_pt regchk(void);
+static void reldata(void);
+static void segadj(void);
 
 #ifdef I80386
 
index a77d2e8..b233984 100644 (file)
@@ -13,17 +13,17 @@ static bool_t elseflag;     /* set if ELSE/ELSEIF are enabled */
                                /* depends on zero = FALSE init */
 static bool_t lcommflag;
 
-static void bumpsem P((struct flags_s *flagptr, int defval));
-static void constdata P((unsigned size));
-static void docomm P((void));
-static void doelseif P((pfv func));
-static void doequset P((unsigned char labits));
-static void doentexp P((unsigned char entbits, unsigned char impbits));
-static void dofcc P((void));
-static void doif P((pfv func));
-static struct sym_s *needlabel P((void));
-static void showredefinedlabel P((void));
-static void setloc P((unsigned seg));
+static void bumpsem(struct flags_s *flagptr, int defval);
+static void constdata(unsigned size);
+static void docomm(void);
+static void doelseif(pfv func);
+static void doequset(unsigned char labits);
+static void doentexp(unsigned char entbits, unsigned char impbits);
+static void dofcc(void);
+static void doif(pfv func);
+static struct sym_s *needlabel(void);
+static void showredefinedlabel(void);
+static void setloc(unsigned seg);
 
 static void bumpsem(struct flags_s *flagptr, int defval)
 {
index 0115677..19d833d 100644 (file)
@@ -86,7 +86,7 @@ static char symofchar[256] =  /* table to convert chars to their symbols */
     WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE
 };
 
-static void intconst P((void));
+static void intconst(void);
 
 void context_hexconst(void)
 {
index fa135d8..87e5b6c 100644 (file)
@@ -27,12 +27,12 @@ unsigned nhash;
 unsigned nlookup;
 unsigned nsym;
 unsigned nx[30];
-static void printchain P((void));
+static void printchain(void);
 #endif
 
-static void install P((register char *keyptr, unsigned char data));
+static void install(register char *keyptr, unsigned char data);
 
-void inst_keywords()
+void inst_keywords(void)
 {
     install(regs, REGBIT);
 #ifdef I80386