ld09: ANSI clean up and prepare for Fuzix work
authorAlan Cox <alan@linux.intel.com>
Tue, 28 Jun 2016 12:24:54 +0000 (13:24 +0100)
committerAlan Cox <alan@linux.intel.com>
Tue, 28 Jun 2016 12:24:54 +0000 (13:24 +0100)
13 files changed:
Applications/ld09/config.h
Applications/ld09/const.h
Applications/ld09/dumps.c
Applications/ld09/io.c
Applications/ld09/ld.c
Applications/ld09/linksyms.c
Applications/ld09/readobj.c
Applications/ld09/syshead.h
Applications/ld09/table.c
Applications/ld09/type.h
Applications/ld09/typeconv.c
Applications/ld09/writebin.c
Applications/ld09/writex86.c

index dc5fed4..f4d9ec9 100644 (file)
@@ -10,8 +10,9 @@
 
 /* one of these target operating systems must be defined */
 
-#define EDOS                   /* generate EDOS executable */
+#undef EDOS                    /* generate EDOS executable */
 #undef  MINIX                  /* generate Minix executable */
+#define FUZIX                  /* FUZIX executable */
 
 /* these may need to be defined to suit the source processor */
 
index 04d6330..da6ff67 100644 (file)
@@ -7,8 +7,6 @@
 #define TRUE   1
 
 #define EXTERN extern
-#define FORWARD        static
-#define PRIVATE        static
 #define PUBLIC
 
 #include "config.h"
index 10879b7..5d2c685 100644 (file)
@@ -10,7 +10,7 @@
 
 /* print list of modules and whether they are loaded */
 
-PUBLIC void dumpmods()
+void dumpmods(void)
 {
     struct modstruct *modptr;
     char *s, *d;
@@ -39,7 +39,7 @@ PUBLIC void dumpmods()
 
 /* print data about symbols (in loaded modules only) */
 
-PUBLIC void dumpsyms()
+void dumpsyms(void)
 {
     flags_t flags;
     struct modstruct *modptr;
index 7c092d3..186f0cd 100644 (file)
 #define TRELBUFSIZE    1024
 
 #ifdef REL_OUTPUT
-PRIVATE char *drelbuf;         /* extra output buffer for data relocations */
-PRIVATE char *drelbufptr;      /* data relocation output buffer ptr */
-PRIVATE char *drelbuftop;      /* data relocation output buffer top */
+static char *drelbuf;          /* extra output buffer for data relocations */
+static char *drelbufptr;       /* data relocation output buffer ptr */
+static char *drelbuftop;       /* data relocation output buffer top */
 #endif
-PRIVATE char *errbuf;          /* error buffer (actually uses STDOUT) */
-PRIVATE char *errbufptr;       /* error buffer ptr */
-PRIVATE char *errbuftop;       /* error buffer top */
-PRIVATE int  errfil = STDOUT_FILENO;
-PRIVATE char *inbuf;           /* input buffer */
-PRIVATE char *inbufend;                /* input buffer top */
-PRIVATE char *inbufptr;                /* end of input in input buffer */
-PRIVATE int infd;              /* input file descriptor */
-PRIVATE char *inputname;       /* name of current input file */
-PRIVATE char *outbuf;          /* output buffer */
-PRIVATE char *outbufptr;       /* output buffer ptr */
-PRIVATE char *outbuftop;       /* output buffer top */
-PRIVATE int outfd;             /* output file descriptor */
-PRIVATE mode_t outputperms;    /* permissions of output file */
-PRIVATE char *outputname;      /* name of output file */
-PRIVATE const char *refname;   /* name of program for error reference */
+static char *errbuf;           /* error buffer (actually uses STDOUT) */
+static char *errbufptr;        /* error buffer ptr */
+static char *errbuftop;        /* error buffer top */
+static int  errfil = STDOUT_FILENO;
+static char *inbuf;            /* input buffer */
+static char *inbufend;         /* input buffer top */
+static char *inbufptr;         /* end of input in input buffer */
+static int infd;               /* input file descriptor */
+static char *inputname;        /* name of current input file */
+static char *outbuf;           /* output buffer */
+static char *outbufptr;        /* output buffer ptr */
+static char *outbuftop;        /* output buffer top */
+static int outfd;              /* output file descriptor */
+static mode_t outputperms;     /* permissions of output file */
+static char *outputname;       /* name of output file */
+static const char *refname;    /* name of program for error reference */
 #ifdef REL_OUTPUT
-PRIVATE char *trelbuf;         /* extra output buffer for text relocations */
-PRIVATE char *trelbufptr;      /* text relocation output buffer ptr */
-PRIVATE char *trelbuftop;      /* text relocation output buffer top */
-PRIVATE int trelfd;            /* text relocation output file descriptor */
+static char *trelbuf;          /* extra output buffer for text relocations */
+static char *trelbufptr;       /* text relocation output buffer ptr */
+static char *trelbuftop;       /* text relocation output buffer top */
+static int trelfd;             /* text relocation output file descriptor */
 #endif
-PRIVATE unsigned warncount;    /* count of warnings */
+static unsigned warncount;     /* count of warnings */
 
 #ifdef MSDOS
 #define off_t  long            /* NOT a typedef */
 #endif
 
-FORWARD void errexit P((char *message));
-FORWARD void flushout P((void));
+static void errexit(char *message);
+static void flushout(void);
 #ifdef REL_OUTPUT
-FORWARD void flushtrel P((void));
+static void flushtrel(void);
 #endif
-FORWARD void outhexdigs P((bin_off_t num));
-FORWARD void outputerror P((char *message));
-FORWARD void put04x P((unsigned num));
-FORWARD void putstrn P((const char *message));
-FORWARD void refer P((void));
-FORWARD void stderr_out P((void));
+static void outhexdigs(bin_off_t num);
+static void outputerror(char *message);
+static void put04x(unsigned num);
+static void putstrn(const char *message);
+static void refer(void);
+static void stderr_out(void);
 
-PUBLIC void ioinit(char *progname)
+void ioinit(char *progname)
 {
     infd = ERR;
     if (*progname)
@@ -88,14 +88,14 @@ PUBLIC void ioinit(char *progname)
 #endif
 }
 
-PUBLIC void closein(void)
+void closein(void)
 {
     if (infd != ERR && close(infd) < 0)
        inputerror("cannot close");
     infd = ERR;
 }
 
-PUBLIC void closeout()
+void closeout()
 {
 #ifdef REL_OUTPUT
     unsigned nbytes;
@@ -116,14 +116,14 @@ PUBLIC void closeout()
 #endif
 }
 
-PUBLIC void errtrace(char *name, int level)
+void errtrace(char *name, int level)
 {
     while (level-- > 0)
        putbyte(' ');
     putstrn(name);
 }
 
-PUBLIC void executable(void)
+void executable(void)
 {
     if (errcount)
         unlink(outputname);
@@ -133,14 +133,14 @@ PUBLIC void executable(void)
 #endif
 }
 
-PUBLIC void flusherr(void)
+void flusherr(void)
 {
     if( errbufptr != errbuf )
        write(errfil, errbuf, (unsigned) (errbufptr - errbuf));
     errbufptr = errbuf;
 }
 
-PRIVATE void stderr_out(void)
+static void stderr_out(void)
 {
    if( errfil != STDERR_FILENO )
    {
@@ -149,7 +149,7 @@ PRIVATE void stderr_out(void)
    }
 }
 
-PRIVATE void flushout(void)
+static void flushout(void)
 {
     unsigned nbytes;
 
@@ -160,7 +160,7 @@ PRIVATE void flushout(void)
 }
 
 #ifdef REL_OUTPUT
-PRIVATE void flushtrel(void)
+static void flushtrel(void)
 {
     unsigned nbytes;
 
@@ -171,7 +171,7 @@ PRIVATE void flushtrel(void)
 }
 #endif
 
-PUBLIC void openin(char *filename)
+void openin(char *filename)
 {
 #if 0 /* XXX - this probably won't work with constructed lib names? */
     if (infd == ERR || strcmp(inputname, filename) != 0)
@@ -189,7 +189,7 @@ PUBLIC void openin(char *filename)
     }
 }
 
-PUBLIC void openout(char *filename)
+void openout(char *filename)
 {
     mode_t oldmask;
 
@@ -223,7 +223,7 @@ PUBLIC void openout(char *filename)
 #endif
 }
 
-PRIVATE void outhexdigs(bin_off_t num)
+static void outhexdigs(bin_off_t num)
 {
     if (num >= 0x10)
     {
@@ -233,7 +233,7 @@ PRIVATE void outhexdigs(bin_off_t num)
     putbyte(hexdigit[num]);
 }
 
-PRIVATE void put04x(unsigned num)
+static void put04x(unsigned num)
 {
     putbyte(hexdigit[num / 0x1000]);
     putbyte(hexdigit[(num / 0x100) & 0x0F]);
@@ -243,7 +243,7 @@ PRIVATE void put04x(unsigned num)
 
 #ifdef LONG_OFFSETS
 
-PUBLIC void put08lx(bin_off_t num)
+void put08lx(bin_off_t num)
 {
     put04x(num / 0x10000);
     put04x(num % 0x10000);
@@ -251,7 +251,7 @@ PUBLIC void put08lx(bin_off_t num)
 
 #else /* not LONG_OFFSETS */
 
-PUBLIC void put08x(bin_off_t num)
+void put08x(bin_off_t num)
 {
     putstr("0000");
     put04x(num);
@@ -259,7 +259,7 @@ PUBLIC void put08x(bin_off_t num)
 
 #endif /* not LONG_OFFSETS */
 
-PUBLIC void putbstr(unsigned width, char *str)
+void putbstr(unsigned width, char *str)
 {
     unsigned length;
     
@@ -268,7 +268,7 @@ PUBLIC void putbstr(unsigned width, char *str)
     putstr(str);
 }
 
-PUBLIC void putbyte(int ch)
+void putbyte(int ch)
 {
     register char *ebuf;
 
@@ -282,20 +282,20 @@ PUBLIC void putbyte(int ch)
     errbufptr = ebuf;
 }
 
-PUBLIC void putstr(const char *message)
+void putstr(const char *message)
 {
     while (*message != 0)
        putbyte(*message++);
 }
 
-PRIVATE void putstrn(char *message)
+static void putstrn(char *message)
 {
     putstr(message);
     putbyte('\n');
     flusherr(); errfil = STDOUT_FILENO;
 }
 
-PUBLIC int readchar(void)
+int readchar(void)
 {
     int ch;
        
@@ -319,7 +319,7 @@ PUBLIC int readchar(void)
     return ch;
 }
 
-PUBLIC void readin(char *buf, unsigned count)
+void readin(char *buf, unsigned count)
 {
     int ch;
     
@@ -331,7 +331,7 @@ PUBLIC void readin(char *buf, unsigned count)
     }
 }
 
-PUBLIC bool_pt readineofok(char *buf, unsigned count)
+bool_pt readineofok(char *buf, unsigned count)
 {
     int ch;
     
@@ -344,14 +344,14 @@ PUBLIC bool_pt readineofok(char *buf, unsigned count)
     return FALSE;
 }
 
-PUBLIC void seekin(unsigned long offset)
+void seekin(unsigned long offset)
 {
     inbufptr = inbufend = inbuf;
     if (lseek(infd, (off_t) offset, SEEK_SET) != offset)
        prematureeof();
 }
 
-PUBLIC void seekout(unsigned long offset)
+void seekout(unsigned long offset)
 {
     flushout();
     if (lseek(outfd, (off_t) offset, SEEK_SET) != offset)
@@ -359,7 +359,7 @@ PUBLIC void seekout(unsigned long offset)
 }
 
 #ifdef REL_OUTPUT
-PUBLIC void seektrel(unsigned long offset)
+void seektrel(unsigned long offset)
 {
     flushtrel();
     if (lseek(trelfd, (off_t) offset, SEEK_SET) != offset)
@@ -367,7 +367,7 @@ PUBLIC void seektrel(unsigned long offset)
 }
 #endif
 
-PUBLIC void writechar(int ch)
+void writechar(int ch)
 {
     register char *obuf;
 
@@ -382,7 +382,7 @@ PUBLIC void writechar(int ch)
 }
 
 #ifdef REL_OUTPUT
-PUBLIC void writedrel(char *buf, unsigned count)
+void writedrel(char *buf, unsigned count)
 {
     register char *rbuf;
 
@@ -397,7 +397,7 @@ PUBLIC void writedrel(char *buf, unsigned count)
 }
 #endif
 
-PUBLIC void writeout(char *buf, unsigned count)
+void writeout(char *buf, unsigned count)
 {
     register char *obuf;
 
@@ -416,7 +416,7 @@ PUBLIC void writeout(char *buf, unsigned count)
 }
 
 #ifdef REL_OUTPUT
-PUBLIC void writetrel(char *buf, unsigned count)
+void writetrel(char *buf, unsigned count)
 {
     register char *rbuf;
 
@@ -437,19 +437,19 @@ PUBLIC void writetrel(char *buf, unsigned count)
 
 /* error module */
 
-PRIVATE void errexit(char *message)
+static void errexit(char *message)
 {
     putstrn(message);
     exit(2);
 }
 
-PUBLIC void fatalerror(char *message)
+void fatalerror(char *message)
 {
     refer();
     errexit(message);
 }
 
-PUBLIC void inputerror(char *message)
+void inputerror(char *message)
 {
     refer();
     putstr(message);
@@ -457,14 +457,14 @@ PUBLIC void inputerror(char *message)
     errexit(inputname);
 }
 
-PUBLIC void input1error(char *message)
+void input1error(char *message)
 {
     refer();
     putstr(inputname);
     errexit(message);
 }
 
-PRIVATE void outputerror(char *message)
+static void outputerror(char *message)
 {
     refer();
     putstr(message);
@@ -472,17 +472,17 @@ PRIVATE void outputerror(char *message)
     errexit(outputname);
 }
 
-PUBLIC void outofmemory(void)
+void outofmemory(void)
 {
     inputerror("out of memory while processing");
 }
 
-PUBLIC void prematureeof(void)
+void prematureeof(void)
 {
     inputerror("premature end of");
 }
 
-PUBLIC void redefined(char *name, char *message, char *archentry,
+void redefined(char *name, char *message, char *archentry,
                      char *deffilename, char *defarchentry)
 {
     ++warncount;
@@ -510,7 +510,7 @@ PUBLIC void redefined(char *name, char *message, char *archentry,
     putstrn("");
 }
 
-PUBLIC void interseg(char *fname, char *aname, char *name)
+void interseg(char *fname, char *aname, char *name)
 {
     ++errcount;
     refer();
@@ -529,14 +529,14 @@ PUBLIC void interseg(char *fname, char *aname, char *name)
     putstrn("");
 }
 
-PRIVATE void refer(void)
+static void refer(void)
 {
     stderr_out();
     putstr(refname);
     putstr(": ");
 }
 
-PUBLIC void reserved(char *name)
+void reserved(char *name)
 {
     ++errcount;
     stderr_out();
@@ -544,7 +544,7 @@ PUBLIC void reserved(char *name)
     putstrn(name);
 }
 
-PUBLIC void size_error(int seg, bin_off_t count, bin_off_t size)
+void size_error(int seg, bin_off_t count, bin_off_t size)
 {
     refer();
     putstr("seg ");
@@ -556,7 +556,7 @@ PUBLIC void size_error(int seg, bin_off_t count, bin_off_t size)
     errexit("");
 }
 
-PUBLIC void undefined(char *name)
+void undefined(char *name)
 {
     ++errcount;
     stderr_out();
@@ -564,7 +564,7 @@ PUBLIC void undefined(char *name)
     putstrn(name);
 }
 
-PUBLIC void usage(void)
+void usage(void)
 {
     stderr_out();
     putstr("usage: ");
@@ -580,7 +580,7 @@ PUBLIC void usage(void)
 #endif
 }
 
-PUBLIC void version_msg(void)
+void version_msg(void)
 {
     stderr_out();
 #ifdef VERSION
@@ -591,7 +591,7 @@ PUBLIC void version_msg(void)
 #endif
 }
 
-PUBLIC void use_error(char *message)
+void use_error(char *message)
 {
     refer();
     putstrn(message);
index 61c970d..05b8d75 100644 (file)
 #define NR_STDLIBS     0
 #endif
 
-PUBLIC bin_off_t text_base_value = 0;  /* XXX */
-PUBLIC bin_off_t data_base_value = 0;  /* XXX */
-PUBLIC bin_off_t heap_top_value  = 0;  /* XXX */
-PUBLIC int headerless = 0;
+bin_off_t text_base_value = 0; /* XXX */
+bin_off_t data_base_value = 0; /* XXX */
+bin_off_t heap_top_value  = 0; /* XXX */
+int headerless = 0;
 #ifndef VERY_SMALL_MEMORY
-PUBLIC int v7 = 0;
+int v7 = 0;
 #endif
 #ifndef MSDOS
-PUBLIC int cpm86 = 0;
+int cpm86 = 0;
 #endif
-PUBLIC char hexdigit[] = "0123456789abcdef";
+char hexdigit[] = "0123456789abcdef";
 
-PRIVATE bool_t flag[128];
-PRIVATE char *libs[MAX_LIBS] = {
+static bool_t flag[128];
+static char *libs[MAX_LIBS] = {
 #ifdef MC6809
     "/usr/local/lib/m09/",
 #endif
     0
 };
-PRIVATE int lastlib = NR_STDLIBS;
+static int lastlib = NR_STDLIBS;
 
-FORWARD char *buildname P((char *pre, char *mid, char *suf));
-FORWARD char *expandlib P((char *fn));
+static char *buildname(char *pre, char *mid, char *suf);
+static char *expandlib(char *fn);
 
-PRIVATE char *buildname(char *pre, char *mid, char *suf)
+static char *buildname(char *pre, char *mid, char *suf)
 {
     char *name;
 
@@ -50,7 +50,7 @@ PRIVATE char *buildname(char *pre, char *mid, char *suf)
     return name;
 }
 
-PRIVATE char *expandlib(char *fn)
+static char *expandlib(char *fn)
 {
     char *path, *s;
     int i;
@@ -69,7 +69,7 @@ PRIVATE char *expandlib(char *fn)
     return NUL_PTR;
 }
 
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
 {
     register char *arg;
     int argn;
index 1444c59..1a19622 100644 (file)
 #undef EXTERN
 #include "globvar.h"
 
-FORWARD void linkrefs P((struct modstruct *modptr));
-PUBLIC bool_t reloc_output = 0;
+static void linkrefs(struct modstruct *modptr);
+bool_t reloc_output = 0;
 
 /* link all symbols connected to entry symbols */
 
-PUBLIC void linksyms(bool_pt argreloc_output)
+void linksyms(bool_pt argreloc_output)
 {
     char needlink;
     struct entrylist *elptr;
@@ -69,7 +69,7 @@ PUBLIC void linksyms(bool_pt argreloc_output)
     while (needlink);
 }
 
-PRIVATE void linkrefs(struct modstruct *modptr)
+static void linkrefs(struct modstruct *modptr)
 {
     register struct symstruct **symparray;
     register struct symstruct *symptr;
index 7988482..2b858c0 100644 (file)
@@ -25,22 +25,22 @@ The symbols referred to in a given module are linked together by a chain
 beginning in the module descriptor.
 */
 
-PRIVATE unsigned convertsize[NSEG / 4] = {0, 1, 2, 4};
-PRIVATE struct entrylist *entrylast;   /* last on list of entry symbols */
-PRIVATE struct redlist *redlast;       /* last on list of redefined symbols */
-PRIVATE struct modstruct *modlast;     /* data for last module */
-
-FORWARD long readarheader P((char **parchentry));
-FORWARD unsigned readfileheader P((void));
-FORWARD void readmodule P((char *filename, char *archentry));
-FORWARD void reedmodheader P((void));
-FORWARD bool_pt redsym P((struct symstruct *symptr, bin_off_t value));
-FORWARD unsigned checksum P((char *string, unsigned length));
-FORWARD unsigned segbits P((unsigned seg, char *sizedesc));
+static unsigned convertsize[NSEG / 4] = {0, 1, 2, 4};
+static struct entrylist *entrylast;    /* last on list of entry symbols */
+static struct redlist *redlast;        /* last on list of redefined symbols */
+static struct modstruct *modlast;      /* data for last module */
+
+static long readarheader(char **parchentry);
+static unsigned readfileheader(void);
+static void readmodule(char *filename, char *archentry);
+static void reedmodheader(void);
+static bool_pt redsym(struct symstruct *symptr, bin_off_t value);
+static unsigned checksum(char *string, unsigned length);
+static unsigned segbits(unsigned seg, char *sizedesc);
 
 /* initialise object file handler */
 
-PUBLIC void objinit(void)
+void objinit(void)
 {
     modfirst = modlast = NUL_PTR;
     entryfirst = entrylast = NUL_PTR;
@@ -49,7 +49,7 @@ PUBLIC void objinit(void)
 
 /* read all symbol definitions in an object file */
 
-PUBLIC void readsyms(char *filename, bool_pt trace)
+void readsyms(char *filename, bool_pt trace)
 {
     char *archentry;
     long filelength;
@@ -100,7 +100,7 @@ PUBLIC void readsyms(char *filename, bool_pt trace)
 
 /* read archive header and return length */
 
-PRIVATE long readarheader(char **parchentry)
+static long readarheader(char **parchentry)
 {
     struct ar_hdr arheader;
     char *endptr;
@@ -119,7 +119,7 @@ PRIVATE long readarheader(char **parchentry)
 
 /* read and check file header of the object file just opened */
 
-PRIVATE unsigned readfileheader(void)
+static unsigned readfileheader(void)
 {
     struct
     {
@@ -138,7 +138,7 @@ PRIVATE unsigned readfileheader(void)
 
 /* read the next module */
 
-PRIVATE void readmodule(char *filename, char *archentry)
+static void readmodule(char *filename, char *archentry)
 {
     struct symdstruct          /* to save parts of symbol before name known */
     {
@@ -219,7 +219,7 @@ PRIVATE void readmodule(char *filename, char *archentry)
 
 /* put symbol on entry symbol list if it is not already */
 
-PUBLIC void entrysym(struct symstruct *symptr)
+void entrysym(struct symstruct *symptr)
 {
     register struct entrylist *elptr;
 
@@ -238,7 +238,7 @@ PUBLIC void entrysym(struct symstruct *symptr)
 
 /* read the header of the next module */
 
-PRIVATE void reedmodheader(void)
+static void reedmodheader(void)
 {
     struct
     {
@@ -281,7 +281,7 @@ PRIVATE void reedmodheader(void)
     modlast = modptr;
 }
 
-PRIVATE bool_pt redsym(struct symstruct *symptr, bin_off_t value)
+static bool_pt redsym(struct symstruct *symptr, bin_off_t value)
 {
     register struct redlist *rlptr;
     char class;
@@ -321,7 +321,7 @@ PRIVATE bool_pt redsym(struct symstruct *symptr, bin_off_t value)
     return TRUE;
 }
 
-PRIVATE unsigned checksum(char *string, unsigned length)
+static unsigned checksum(char *string, unsigned length)
 {
     unsigned char sum;         /* this is a 1-byte checksum */
 
@@ -330,12 +330,12 @@ PRIVATE unsigned checksum(char *string, unsigned length)
     return sum;
 }
 
-PUBLIC bin_off_t readconvsize(unsigned countindex)
+bin_off_t readconvsize(unsigned countindex)
 {
     return readsize(convertsize[countindex]);
 }
 
-PUBLIC bin_off_t readsize(unsigned count)
+bin_off_t readsize(unsigned count)
 {
     char buf[MAX_OFFSET_SIZE];
 
@@ -345,13 +345,13 @@ PUBLIC bin_off_t readsize(unsigned count)
     return cntooffset(buf, count);
 }
 
-PRIVATE unsigned segbits(unsigned seg, char *sizedesc)
+static unsigned segbits(unsigned seg, char *sizedesc)
 {
     return 3 & ((unsigned) sizedesc[((NSEG - 1) - seg) / 4] >> (2 * (seg % 4)));
     /* unsigned to give logical shift */
 }
 
-PUBLIC unsigned segsizecount(unsigned seg, struct modstruct *modptr)
+unsigned segsizecount(unsigned seg, struct modstruct *modptr)
 {
     return convertsize[segbits(seg, modptr->segsizedesc)];
 }
index f107ac3..4ab0b63 100644 (file)
@@ -6,13 +6,3 @@
 #include <string.h>
 #include <errno.h>
 
-/******************************************************************************/
-
-/* EEEEyuk!! */
-
-#ifdef __STDC__
-#define P(x)   x
-#else
-#define P(x)   ()
-#endif
-
index 1ddb716..0508da1 100644 (file)
 #define GOLDEN         157     /* GOLDEN/HASHTABSIZE approx golden ratio */
 #define HASHTABSIZE    256
 
-PRIVATE struct symstruct *hashtab[HASHTABSIZE];        /* hash table */
-PRIVATE char *tableptr;                /* next free spot in catchall table */
-PRIVATE char *tableend;                /* ptr to spot after last in table */
+static struct symstruct *hashtab[HASHTABSIZE]; /* hash table */
+static char *tableptr;         /* next free spot in catchall table */
+static char *tableend;         /* ptr to spot after last in table */
 
-PUBLIC  int maxused = 0;       /* Stats */
-PRIVATE int mainavail, usedtop;        /* Stats */
+int maxused = 0;       /* Stats */
+static int mainavail, usedtop; /* Stats */
 
-FORWARD struct symstruct **gethashptr P((char *name));
-FORWARD void check_used P((void));
+static struct symstruct **gethashptr(char *name);
+static void check_used(void);
 
 /* initialise symbol table */
 
-PUBLIC void syminit(void)
+void syminit(void)
 {
     unsigned i;
 
@@ -45,7 +45,7 @@ PUBLIC void syminit(void)
 /* add named symbol to end of table - initialise only name and next fields */
 /* caller must not duplicate names of externals for findsym() to work */
 
-PUBLIC struct symstruct *addsym(char *name)
+struct symstruct *addsym(char *name)
 {
     struct symstruct **hashptr;
     struct symstruct *oldsymptr = 0;
@@ -75,7 +75,7 @@ PUBLIC struct symstruct *addsym(char *name)
 
 /* lookup named symbol */
 
-PUBLIC struct symstruct *findsym(char *name)
+struct symstruct *findsym(char *name)
 {
     struct symstruct *symptr;
 
@@ -88,7 +88,7 @@ PUBLIC struct symstruct *findsym(char *name)
 
 /* convert name to a hash table ptr */
 
-PRIVATE struct symstruct **gethashptr(char *name)
+static struct symstruct **gethashptr(char *name)
 {
     register unsigned hashval;
 
@@ -128,7 +128,7 @@ HASHVAL.EXIT
 
 /* move symbol descriptor entries to top of table (no error checking) */
 
-PUBLIC char *moveup(unsigned nbytes)
+char *moveup(unsigned nbytes)
 {
     register char *source;
     register char *target;
@@ -146,7 +146,7 @@ PUBLIC char *moveup(unsigned nbytes)
 
 /* our version of malloc */
 
-PUBLIC char *ourmalloc(unsigned nbytes)
+char *ourmalloc(unsigned nbytes)
 {
     char *allocptr;
 
@@ -159,7 +159,7 @@ PUBLIC char *ourmalloc(unsigned nbytes)
 
 /* our version of free (release from bottom of table) */
 
-PUBLIC void ourfree(char *cptr)
+void ourfree(char *cptr)
 {
     check_used();
     tableptr = cptr;
@@ -168,7 +168,7 @@ PUBLIC void ourfree(char *cptr)
 
 /* read string from file into table at offset suitable for next symbol */
 
-PUBLIC char *readstring(void)
+char *readstring(void)
 {
     int c;
     char *s;
@@ -191,7 +191,7 @@ PUBLIC char *readstring(void)
 
 /* release from top of table */
 
-PUBLIC void release(char *cptr)
+void release(char *cptr)
 {
     check_used();
     mainavail += cptr - tableend;
@@ -200,7 +200,7 @@ PUBLIC void release(char *cptr)
     tableend = cptr;
 }
 
-PRIVATE void check_used(void)
+static void check_used(void)
 {
    int used;
 
@@ -208,7 +208,7 @@ PRIVATE void check_used(void)
    if (used > maxused) maxused = used;
 }
 
-PUBLIC int memory_used(void)
+int memory_used(void)
 {
    check_used();
    return maxused;
@@ -216,7 +216,7 @@ PUBLIC int memory_used(void)
 
 /* allocate space for string */
 
-PUBLIC char *stralloc(char *s)
+char *stralloc(char *s)
 {
     return strcpy(ourmalloc((unsigned) strlen(s) + 1), s);
 }
index 5301b6f..6a7acd4 100644 (file)
@@ -71,106 +71,98 @@ struct symstruct           /* symbol table entry format */
 
 /* prototypes */
 
-#ifndef P
-#ifdef __STDC__
-#define P(x)   x
-#else
-#define P(x)   ()
-#endif
-#endif
-
 /* dump.c */
-void dumpmods P((void));
-void dumpsyms P((void));
+void dumpmods(void);
+void dumpsyms(void);
 
 /* io.c */
-void ioinit P((char *progname));
-void closein P((void));
-void closeout P((void));
-void errtrace P((char *name, int level));
-void executable P((void));
-void flusherr P((void));
-void openin P((char *filename));
-void openout P((char *filename));
-void putstr P((char *message));
-void put08x P((bin_off_t num));
-void put08lx P((bin_off_t num));
-void putbstr P((unsigned width, char *str));
-void putbyte P((int ch));
-int readchar P((void));
-void readin P((char *buf, unsigned count));
-bool_pt readineofok P((char *buf, unsigned count));
-void seekin P((unsigned long offset));
-void seekout P((unsigned long offset));
-void seektrel P((unsigned long offset));
-void writechar P((int c));
-void writedrel P((char *buf, unsigned count));
-void writeout P((char *buf, unsigned count));
-void writetrel P((char *buf, unsigned count));
-void fatalerror P((char *message));
-void inputerror P((char *message));
-void input1error P((char *message));
-void outofmemory P((void));
-void prematureeof P((void));
-void redefined P((char *name, char *message, char *archentry,
-                 char *deffilename, char *defarchentry));
-void interseg P((char *fname, char *aname, char *name));
-void reserved P((char *name));
-void size_error P((int seg, bin_off_t count, bin_off_t size));
-void undefined P((char *name));
-void usage P((void));
-void version_msg P((void));
-void use_error P((char *message));
+void ioinit(char *progname);
+void closein(void);
+void closeout(void);
+void errtrace(char *name, int level);
+void executable(void);
+void flusherr(void);
+void openin(char *filename);
+void openout(char *filename);
+void putstr(char *message);
+void put08x(bin_off_t num);
+void put08lx(bin_off_t num);
+void putbstr(unsigned width, char *str);
+void putbyte(int ch);
+int readchar(void);
+void readin(char *buf, unsigned count);
+bool_pt readineofok(char *buf, unsigned count);
+void seekin(unsigned long offset);
+void seekout(unsigned long offset);
+void seektrel(unsigned long offset);
+void writechar(int c);
+void writedrel(char *buf, unsigned count);
+void writeout(char *buf, unsigned count);
+void writetrel(char *buf, unsigned count);
+void fatalerror(char *message);
+void inputerror(char *message);
+void input1error(char *message);
+void outofmemory(void);
+void prematureeof(void);
+void redefined(char *name, char *message, char *archentry,
+                 char *deffilename, char *defarchentry);
+void interseg(char *fname, char *aname, char *name);
+void reserved(char *name);
+void size_error(int seg, bin_off_t count, bin_off_t size);
+void undefined(char *name);
+void usage(void);
+void version_msg(void);
+void use_error(char *message);
 
 /* ld.c */
-int main P((int argc, char **argv));
+int main(int argc, char **argv);
 
 /* readobj.c */
-void objinit P((void));
-void readsyms P((char *filename, bool_pt trace));
+void objinit(void);
+void readsyms(char *filename, bool_pt trace);
 #ifdef OBJ_H
-void entrysym P((struct symstruct *symptr));
-unsigned segsizecount P((unsigned seg, struct modstruct *modptr));
+void entrysym(struct symstruct *symptr);
+unsigned segsizecount(unsigned seg, struct modstruct *modptr);
 #endif
-bin_off_t readconvsize P((unsigned countindex));
-bin_off_t readsize P((unsigned count));
+bin_off_t readconvsize(unsigned countindex);
+bin_off_t readsize(unsigned count);
 
 /* table.c */
-void syminit P((void));
-struct symstruct *addsym P((char *name));
-struct symstruct *findsym P((char *name));
-char *moveup P((unsigned nbytes));
-char *ourmalloc P((unsigned nbytes));
-void ourfree P((char *cptr));
-char *readstring P((void));
-void release P((char *cptr));
-int memory_used P((void));
-char *stralloc P((char *s));
+void syminit(void);
+struct symstruct *addsym(char *name);
+struct symstruct *findsym(char *name);
+char *moveup(unsigned nbytes);
+char *ourmalloc(unsigned nbytes);
+void ourfree(char *cptr);
+char *readstring(void);
+void release(char *cptr);
+int memory_used(void);
+char *stralloc(char *s);
 
 /* typeconvert.c */
-u2_pt c2u2 P((char *buf));
-u4_t c4u4 P((char *buf));
-u2_pt cnu2 P((char *buf, unsigned count));
-u4_t cnu4 P((char *buf, unsigned count));
-void u2c2 P((char *buf, u2_pt offset));
-void u4c4 P((char *buf, u4_t offset));
-void u2cn P((char *buf, u2_pt offset, unsigned count));
-void u4cn P((char *buf, u4_t offset, unsigned count));
-bool_pt typeconv_init P((bool_pt big_endian, bool_pt long_big_endian));
+u2_pt c2u2(char *buf);
+u4_t c4u4(char *buf);
+u2_pt cnu2(char *buf, unsigned count);
+u4_t cnu4(char *buf, unsigned count);
+void u2c2(char *buf, u2_pt offset);
+void u4c4(char *buf, u4_t offset);
+void u2cn(char *buf, u2_pt offset, unsigned count);
+void u4cn(char *buf, u4_t offset, unsigned count);
+bool_pt typeconv_init(bool_pt big_endian, bool_pt long_big_endian);
 
 /* writebin.c */
-void writebin P((char *outfilename, bool_pt argsepid, bool_pt argbits32,
-                bool_pt argstripflag, bool_pt arguzp));
+void writebin(char *outfilename, bool_pt argsepid, bool_pt argbits32,
+                bool_pt argstripflag, bool_pt arguzp);
 
-void write_dosemu P((char *outfilename, bool_pt argsepid, bool_pt argbits32,
-                bool_pt argstripflag, bool_pt arguzp));
+void write_dosemu(char *outfilename, bool_pt argsepid, bool_pt argbits32,
+                bool_pt argstripflag, bool_pt arguzp);
 
 /* write_elks.c */
-void write_elks P((char *outfilename, bool_pt argsepid, bool_pt argbits32,
-                bool_pt argstripflag, bool_pt arguzp, bool_pt nsym));
+void write_elks(char *outfilename, bool_pt argsepid, bool_pt argbits32,
+                bool_pt argstripflag, bool_pt arguzp, bool_pt nsym);
 
 /* linksym.c */
-void linksyms P((bool_pt argreloc_output));
+void linksyms(bool_pt argreloc_output);
 
 /* mkar.c */
-void ld86r P((int argc, char ** argv));
+void ld86r(int argc, char ** argv);
index 6387b4a..9590cad 100644 (file)
@@ -20,7 +20,7 @@ static int no_swap   = 1;
 static int long_off[4] = {0,1,2,3};
 static int int_off[2] = {0,1};
 
-PUBLIC bool_pt typeconv_init(bool_pt big_endian, bool_pt long_big_endian)
+bool_pt typeconv_init(bool_pt big_endian, bool_pt long_big_endian)
 {
    int i;
    no_swap = (!big_endian && !long_big_endian);
@@ -43,7 +43,7 @@ PUBLIC bool_pt typeconv_init(bool_pt big_endian, bool_pt long_big_endian)
    return 1;
 }
 
-PUBLIC void u2c2(char *buf, u2_pt offset)
+void u2c2(char *buf, u2_pt offset)
 {
 #ifdef __AS386_16__
    if( no_swap )
@@ -56,7 +56,7 @@ PUBLIC void u2c2(char *buf, u2_pt offset)
    buf[int_off[1]] = (offset>>8);
 }
 
-PUBLIC void u4c4(char *buf, u4_t offset)
+void u4c4(char *buf, u4_t offset)
 {
    int i;
 #ifdef __AS386_16__
@@ -73,7 +73,7 @@ PUBLIC void u4c4(char *buf, u4_t offset)
    }
 }
 
-PUBLIC void u4cn(char *buf, u4_t offset, unsigned count)
+void u4cn(char *buf, u4_t offset, unsigned count)
 {
     switch(count)
     {
@@ -92,7 +92,7 @@ PUBLIC void u4cn(char *buf, u4_t offset, unsigned count)
     }
 }
 
-PUBLIC void u2cn(char *buf, u2_pt offset, unsigned count)
+void u2cn(char *buf, u2_pt offset, unsigned count)
 {
     switch(count)
     {
@@ -111,7 +111,7 @@ PUBLIC void u2cn(char *buf, u2_pt offset, unsigned count)
     }
 }
 
-PUBLIC u2_pt c2u2(char *buf)
+u2_pt c2u2(char *buf)
 {
     u2_pt res;
 #ifdef __AS386_16__
@@ -123,7 +123,7 @@ PUBLIC u2_pt c2u2(char *buf)
     return res;
 }
 
-PUBLIC u4_t c4u4(char *buf)
+u4_t c4u4(char *buf)
 {
     u4_t res;
     int i;
@@ -138,7 +138,7 @@ PUBLIC u4_t c4u4(char *buf)
     return res;
 }
 
-PUBLIC u4_t cnu4(char *buf, unsigned count)
+u4_t cnu4(char *buf, unsigned count)
 {
     switch (count)
     {
@@ -156,7 +156,7 @@ PUBLIC u4_t cnu4(char *buf, unsigned count)
     }
 }
 
-PUBLIC u2_pt cnu2(char *buf, unsigned count)
+u2_pt cnu2(char *buf, unsigned count)
 {
     switch (count)
     {
index 2b21671..ada78bd 100644 (file)
 #define offsetof(struc, mem) ((int) &((struc *) 0)->mem)
 #define memsizeof(struc, mem) sizeof(((struc *) 0)->mem)
 
-PRIVATE bool_t bits32;         /* nonzero for 32-bit executable */
-PRIVATE bin_off_t combase[NSEG];/* bases of common parts of segments */
-PRIVATE bin_off_t comsz[NSEG]; /* sizes of common parts of segments */
-PRIVATE fastin_t curseg;       /* current segment, 0 to $F */
-PRIVATE bin_off_t edataoffset; /* end of data */
-PRIVATE bin_off_t endoffset;   /* end of bss */
-PRIVATE bin_off_t etextoffset; /* end of text */
-PRIVATE bin_off_t etextpadoff; /* end of padded text */
+static bool_t bits32;          /* nonzero for 32-bit executable */
+static bin_off_t combase[NSEG];/* bases of common parts of segments */
+static bin_off_t comsz[NSEG];  /* sizes of common parts of segments */
+static fastin_t curseg;        /* current segment, 0 to $F */
+static bin_off_t edataoffset;  /* end of data */
+static bin_off_t endoffset;    /* end of bss */
+static bin_off_t etextoffset;  /* end of text */
+static bin_off_t etextpadoff;  /* end of padded text */
 #ifdef REL_OUTPUT
-PRIVATE unsigned ndreloc;      /* number of data relocations */
+static unsigned ndreloc;       /* number of data relocations */
 #endif
-PRIVATE unsigned nsym;         /* number of symbols written */
+static unsigned nsym;          /* number of symbols written */
 #ifdef REL_OUTPUT
-PRIVATE unsigned ntreloc;      /* number of text relocations */
+static unsigned ntreloc;       /* number of text relocations */
 extern bool_t reloc_output;    /* nonzero to leave reloc info in output */
 #endif
-PRIVATE unsigned relocsize;    /* current relocation size 1, 2 or 4 */
-PRIVATE bin_off_t segadj[NSEG];        /* adjusts (file offset - seg offset) */
+static unsigned relocsize;     /* current relocation size 1, 2 or 4 */
+static bin_off_t segadj[NSEG]; /* adjusts (file offset - seg offset) */
                                /* depends on zero init */
-PRIVATE bin_off_t segbase[NSEG];/* bases of data parts of segments */
-PRIVATE char segboundary[9] = "__seg0DH";
+static bin_off_t segbase[NSEG];/* bases of data parts of segments */
+static char segboundary[9] = "__seg0DH";
                                /* name of seg boundary __seg0DL to __segfCH */
-PRIVATE bin_off_t segpos[NSEG];        /* segment positions for current module */
-PRIVATE bin_off_t segsz[NSEG]; /* sizes of data parts of segments */
+static bin_off_t segpos[NSEG]; /* segment positions for current module */
+static bin_off_t segsz[NSEG];  /* sizes of data parts of segments */
                                /* depends on zero init */
-PRIVATE bool_t sepid;          /* nonzero for separate I & D */
-PRIVATE bool_t stripflag;      /* nonzero to strip symbols */
-PRIVATE bin_off_t spos;                /* position in current seg */
-PRIVATE bool_t uzp;            /* nonzero for unmapped zero page */
+static bool_t sepid;           /* nonzero for separate I & D */
+static bool_t stripflag;       /* nonzero to strip symbols */
+static bin_off_t spos;         /* position in current seg */
+static bool_t uzp;             /* nonzero for unmapped zero page */
 
 #ifdef EDOS
-FORWARD unsigned binheaderlength P((char *commandname));
-FORWARD char *idconvert P((struct entrylist *elptr, char *commandname));
-#endif
-FORWARD void linkmod P((struct modstruct *modptr));
-FORWARD void padmod P((struct modstruct *modptr));
-FORWARD void setsym P((char *name, bin_off_t value));
-FORWARD void symres P((char *name));
-FORWARD void setseg P((fastin_pt newseg));
-FORWARD void skip P((unsigned countsize));
+unsigned binheaderlength(char *commandname);
+char *idconvert(struct entrylist *elptr, char *commandname);
+#endif
+void linkmod(struct modstruct *modptr);
+void padmod(struct modstruct *modptr);
+void setsym(char *name, bin_off_t value);
+void symres(char *name);
+void setseg(fastin_pt newseg);
+void skip(unsigned countsize);
 #ifdef EDOS
-FORWARD void writeheader P((char *commandname));
+void writeheader(char *commandname);
 #else
-FORWARD void writeheader P((void));
+void writeheader(void);
 #endif
-FORWARD void writenulls P((bin_off_t count));
+void writenulls(bin_off_t count);
 
 /* write binary file */
 #ifndef FUNCNAME 
 #define FUNCNAME writebin
 #endif
 
-PUBLIC void FUNCNAME(char *outfilename, bool_pt argsepid, bool_pt argbits32,
+void FUNCNAME(char *outfilename, bool_pt argsepid, bool_pt argbits32,
                      bool_pt argstripflag, bool_pt arguzp)
 {
     char buf4[4];
@@ -581,7 +581,7 @@ PUBLIC void FUNCNAME(char *outfilename, bool_pt argsepid, bool_pt argbits32,
 
 #ifdef EDOS
 
-PRIVATE unsigned binheaderlength(char *commandname)
+static unsigned binheaderlength(char *commandname)
 {
     unsigned count;
     char *name;
@@ -606,7 +606,7 @@ PRIVATE unsigned binheaderlength(char *commandname)
 /* the special name  _main  is converted to the command name first */
 /* copy upper case and numerals, convert lower case to upper, ignore rest */
 
-PRIVATE char *idconvert(struct entrylist *elptr, char *commandname)
+static char *idconvert(struct entrylist *elptr, char *commandname)
 {
     char *name;
     char *newname;
@@ -637,7 +637,7 @@ PRIVATE char *idconvert(struct entrylist *elptr, char *commandname)
 
 #endif /* EDOS */
 
-PRIVATE void linkmod(struct modstruct *modptr)
+static void linkmod(struct modstruct *modptr)
 {
     char buf[ABS_TEXT_MAX];
     int command;
@@ -812,7 +812,7 @@ PRIVATE void linkmod(struct modstruct *modptr)
     }
 }
 
-PRIVATE void padmod(struct modstruct *modptr)
+static void padmod(struct modstruct *modptr)
 {
     bin_off_t count;
     fastin_t seg;
@@ -840,7 +840,7 @@ PRIVATE void padmod(struct modstruct *modptr)
     }
 }
 
-PRIVATE void setsym(char *name, bin_off_t value)
+static void setsym(char *name, bin_off_t value)
 {
     struct symstruct *symptr;
 
@@ -851,7 +851,7 @@ PRIVATE void setsym(char *name, bin_off_t value)
            symptr->value = value;
 }
 
-PRIVATE void symres(char *name)
+static void symres(char *name)
 {
     register struct symstruct *symptr;
 
@@ -870,7 +870,7 @@ PRIVATE void symres(char *name)
 
 /* set new segment */
 
-PRIVATE void setseg(fastin_pt newseg)
+static void setseg(fastin_pt newseg)
 {
     if (newseg != curseg)
     {
@@ -881,14 +881,14 @@ PRIVATE void setseg(fastin_pt newseg)
     }
 }
 
-PRIVATE void skip(unsigned countsize)
+static void skip(unsigned countsize)
 {
     writenulls((bin_off_t) readsize(countsize));
 }
 
 #ifdef EDOS
 
-PRIVATE void writeheader(char *commandname)
+static void writeheader(char *commandname)
 {
     char buf[MAX_OFFSET_SIZE];
     bin_off_t offset;
@@ -937,7 +937,7 @@ PRIVATE void writeheader(char *commandname)
 
 #ifdef MINIX
 
-PRIVATE void writeheader(void)
+static void writeheader(void)
 {
     struct exec header;
 
@@ -1020,7 +1020,7 @@ PRIVATE void writeheader(void)
 
 #endif /* MINIX */
 
-PRIVATE void writenulls(bin_off_t count)
+static void writenulls(bin_off_t count)
 {
     long lcount = count;
     if( lcount < 0 )
@@ -1035,7 +1035,7 @@ PRIVATE void writenulls(bin_off_t count)
 #define FUNCNAME writebin
 #endif
 
-PUBLIC void FUNCNAME(char *outfilename, bool_pt argsepid, bool_pt argbits32,
+void FUNCNAME(char *outfilename, bool_pt argsepid, bool_pt argbits32,
                      bool_pt argstripflag, bool_pt arguzp)
 {
     char * s  = "WARNING: Native a.out generation not included, sorry\n";
index feb7b55..5ddb873 100644 (file)
 #define offsetof(struc, mem) ((int) &((struc *) 0)->mem)
 #define memsizeof(struc, mem) sizeof(((struc *) 0)->mem)
 
-PRIVATE bool_t bits32;         /* nonzero for 32-bit executable */
-PRIVATE bin_off_t combase[NSEG];/* bases of common parts of segments */
-PRIVATE bin_off_t comsz[NSEG]; /* sizes of common parts of segments */
-PRIVATE fastin_t curseg;       /* current segment, 0 to $F */
-PRIVATE bin_off_t edataoffset; /* end of data */
-PRIVATE bin_off_t endoffset;   /* end of bss */
-PRIVATE bin_off_t etextoffset; /* end of text */
-PRIVATE bin_off_t etextpadoff; /* end of padded text */
-PRIVATE unsigned nsym;         /* number of symbols written */
-PRIVATE unsigned relocsize;    /* current relocation size 1, 2 or 4 */
-PRIVATE bin_off_t segadj[NSEG];        /* adjusts (file offset - seg offset) */
+static bool_t bits32;          /* nonzero for 32-bit executable */
+static bin_off_t combase[NSEG];/* bases of common parts of segments */
+static bin_off_t comsz[NSEG];  /* sizes of common parts of segments */
+static fastin_t curseg;        /* current segment, 0 to $F */
+static bin_off_t edataoffset;  /* end of data */
+static bin_off_t endoffset;    /* end of bss */
+static bin_off_t etextoffset;  /* end of text */
+static bin_off_t etextpadoff;  /* end of padded text */
+static unsigned nsym;          /* number of symbols written */
+static unsigned relocsize;     /* current relocation size 1, 2 or 4 */
+static bin_off_t segadj[NSEG]; /* adjusts (file offset - seg offset) */
                                /* depends on zero init */
-PRIVATE bin_off_t segbase[NSEG];/* bases of data parts of segments */
-PRIVATE char segboundary[9] = "__seg0DH";
+static bin_off_t segbase[NSEG];/* bases of data parts of segments */
+static char segboundary[9] = "__seg0DH";
                                /* name of seg boundary __seg0DL to __segfCH */
-PRIVATE bin_off_t segpos[NSEG];        /* segment positions for current module */
-PRIVATE bin_off_t segsz[NSEG]; /* sizes of data parts of segments */
+static bin_off_t segpos[NSEG]; /* segment positions for current module */
+static bin_off_t segsz[NSEG];  /* sizes of data parts of segments */
                                /* depends on zero init */
-PRIVATE bool_t sepid;          /* nonzero for separate I & D */
-PRIVATE bool_t stripflag;      /* nonzero to strip symbols */
-PRIVATE bin_off_t spos;                /* position in current seg */
-PRIVATE bool_t uzp;            /* nonzero for unmapped zero page */
-PRIVATE bool_t xsym;           /* extended symbol table */
-
-FORWARD void linkmod P((struct modstruct *modptr));
-FORWARD void padmod P((struct modstruct *modptr));
-FORWARD void setsym P((char *name, bin_off_t value));
-FORWARD void symres P((char *name));
-FORWARD void setseg P((fastin_pt newseg));
-FORWARD void skip P((unsigned countsize));
-FORWARD void writeheader P((void));
+static bool_t sepid;           /* nonzero for separate I & D */
+static bool_t stripflag;       /* nonzero to strip symbols */
+static bin_off_t spos;         /* position in current seg */
+static bool_t uzp;             /* nonzero for unmapped zero page */
+static bool_t xsym;            /* extended symbol table */
+
+static void linkmod(struct modstruct *modptr);
+static void padmod(struct modstruct *modptr);
+static void setsym(char *name, bin_off_t value);
+static void symres(char *name);
+static void setseg(fastin_pt newseg);
+static void skip(unsigned countsize);
+static void writeheader(void);
 #ifndef VERY_SMALL_MEMORY
-FORWARD void v7header P((void));
+static void v7header(void);
 #endif
 #ifndef MSDOS
-FORWARD void cpm86header P((void));
+static void cpm86header(void);
 #endif
-FORWARD void writenulls P((bin_off_t count));
+static void writenulls(bin_off_t count);
 
 EXTERN bool_t reloc_output;
 
 /* write binary file */
 
-PUBLIC void write_elks(outfilename, argsepid, argbits32, argstripflag, arguzp, argxsym)
-char *outfilename;
-bool_pt argsepid;
-bool_pt argbits32;
-bool_pt argstripflag;
-bool_pt arguzp;
-bool_pt argxsym;
+void write_elks(char *outfilename, bool_pt argsepid, bool_pt argbits32,
+                bool_pt argstripflag, bool_pt arguzp, bool_pt argxsym)
 {
     char buf4[4];
     char *cptr;
@@ -454,7 +449,7 @@ bool_pt argxsym;
     executable();
 }
 
-PRIVATE void linkmod(modptr)
+static void linkmod(modptr)
 struct modstruct *modptr;
 {
     char buf[ABS_TEXT_MAX];
@@ -555,7 +550,7 @@ struct modstruct *modptr;
     }
 }
 
-PRIVATE void padmod(modptr)
+static void padmod(modptr)
 struct modstruct *modptr;
 {
     bin_off_t count;
@@ -584,7 +579,7 @@ struct modstruct *modptr;
     }
 }
 
-PRIVATE void setsym(name, value)
+static void setsym(name, value)
 char *name;
 bin_off_t value;
 {
@@ -594,7 +589,7 @@ bin_off_t value;
        symptr->value = value;
 }
 
-PRIVATE void symres(name)
+static void symres(name)
 register char *name;
 {
     register struct symstruct *symptr;
@@ -611,7 +606,7 @@ register char *name;
 
 /* set new segment */
 
-PRIVATE void setseg(newseg)
+static void setseg(newseg)
 fastin_pt newseg;
 {
     if (newseg != curseg)
@@ -623,14 +618,14 @@ fastin_pt newseg;
     }
 }
 
-PRIVATE void skip(countsize)
+static void skip(countsize)
 unsigned countsize;
 {
     writenulls((bin_off_t) readsize(countsize));
 }
 
 #ifndef MSDOS
-PRIVATE void cpm86header()
+static void cpm86header()
 {
     struct cpm86_exec header;
     memset(&header, 0, sizeof header);
@@ -656,7 +651,7 @@ PRIVATE void cpm86header()
 }
 #endif
 
-PRIVATE void writeheader()
+static void writeheader()
 {
     struct exec header;
 
@@ -685,7 +680,7 @@ PRIVATE void writeheader()
 }
 
 #ifndef VERY_SMALL_MEMORY
-PRIVATE void v7header()
+static void v7header()
 {
     struct v7_exec header;
 
@@ -721,7 +716,7 @@ PRIVATE void v7header()
 }
 #endif
 
-PRIVATE void writenulls(count)
+static void writenulls(count)
 bin_off_t count;
 {
     long lcount = count;