From 4f1858350c95f3f9981d1a9bd5d9757061c4d257 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 24 Jul 2016 21:51:23 +0100 Subject: [PATCH] as: more tidying up --- Applications/as09/as.c | 23 ++++++++--------------- Applications/as09/assemble.c | 2 +- Applications/as09/express.c | 12 ++++++------ Applications/as09/genbin.c | 14 ++------------ Applications/as09/genobj.c | 5 +++-- Applications/as09/mops.c | 8 ++++---- Applications/as09/pops.c | 22 +++++++++++----------- Applications/as09/scan.c | 2 +- Applications/as09/table.c | 6 +++--- 9 files changed, 39 insertions(+), 55 deletions(-) diff --git a/Applications/as09/as.c b/Applications/as09/as.c index 70ca16eb..aa3f81e7 100644 --- a/Applications/as09/as.c +++ b/Applications/as09/as.c @@ -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 diff --git a/Applications/as09/assemble.c b/Applications/as09/assemble.c index 12cf6c94..9d148335 100644 --- a/Applications/as09/assemble.c +++ b/Applications/as09/assemble.c @@ -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 diff --git a/Applications/as09/express.c b/Applications/as09/express.c index a43a9194..4b8fb398 100644 --- a/Applications/as09/express.c +++ b/Applications/as09/express.c @@ -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) { diff --git a/Applications/as09/genbin.c b/Applications/as09/genbin.c index a6228e9b..56640238 100644 --- a/Applications/as09/genbin.c +++ b/Applications/as09/genbin.c @@ -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 diff --git a/Applications/as09/genobj.c b/Applications/as09/genobj.c index b4ba994e..8b5e0f70 100644 --- a/Applications/as09/genobj.c +++ b/Applications/as09/genobj.c @@ -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); diff --git a/Applications/as09/mops.c b/Applications/as09/mops.c index 8cad14e3..2a856371 100644 --- a/Applications/as09/mops.c +++ b/Applications/as09/mops.c @@ -14,10 +14,10 @@ #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 diff --git a/Applications/as09/pops.c b/Applications/as09/pops.c index a77d2e80..b2339846 100644 --- a/Applications/as09/pops.c +++ b/Applications/as09/pops.c @@ -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) { diff --git a/Applications/as09/scan.c b/Applications/as09/scan.c index 0115677a..19d833d4 100644 --- a/Applications/as09/scan.c +++ b/Applications/as09/scan.c @@ -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) { diff --git a/Applications/as09/table.c b/Applications/as09/table.c index fa135d85..87e5b6c0 100644 --- a/Applications/as09/table.c +++ b/Applications/as09/table.c @@ -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 -- 2.34.1