Next batch of changes!
authorGodzil <godzil@godzil.net>
Wed, 20 Mar 2013 00:58:06 +0000 (01:58 +0100)
committerManoël Trapier <godzil@MacBook-Pro.home>
Wed, 24 Jun 2015 22:41:47 +0000 (23:41 +0100)
29 files changed:
modules/src/object/object.h
util/amisc/aelflod.c
util/amisc/anm.c
util/amisc/ashow.c
util/amisc/asize.c
util/amisc/aslod.c
util/amisc/astrip.c
util/led/archive.c
util/led/archive.h [new file with mode: 0644]
util/led/error.c
util/led/extract.c
util/led/finish.c
util/led/main.c
util/led/memory.c
util/led/output.c
util/led/read.c
util/led/relocate.c
util/led/save.c
util/led/scan.c
util/led/sym.c
util/led/write.c
util/topgen/LLlex.c
util/topgen/hash.c
util/topgen/hash.h [new file with mode: 0644]
util/topgen/main.c
util/topgen/main.h [new file with mode: 0644]
util/topgen/pattern.h [new file with mode: 0644]
util/topgen/symtab.c
util/topgen/topgen.g

index ed4face..63560e8 100644 (file)
@@ -51,5 +51,6 @@ _PROTOTYPE(unsigned int rd_unsigned2, (int fd));
 _PROTOTYPE(long rd_long, (int fd));
 _PROTOTYPE(void rd_bytes, (int fd, char *buf, long l));
 _PROTOTYPE(int rd_fd, (void));
+_PROTOTYPE(void rd_rew_relos, (struct outhead *head));
 
 #endif /* __OBJECT_INCLUDED__ */
index 2174943..657800e 100644 (file)
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <string.h>
index 1eece0e..e3b7efb 100644 (file)
 #include    <string.h>
 #include       <ctype.h>
 
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
 #include       "out.h"
 #include       "arch.h"
 #include       "ranlib.h"
+#include       "object.h"
 
 int    numsort_flg;
 int    sectsort_flg;
@@ -98,8 +104,6 @@ int main(int argc, char *argv[])
        exit(0);
 }
 
-int rd_unsigned2(int fd);
-
 void process(int fd)
 {
        unsigned int    magic;
index e8ec12a..906683f 100644 (file)
@@ -1,4 +1,3 @@
-static char    rcsid[] = "$Id$";
 /*
  * show - make the contents of an ACK object file human readable.
  */
@@ -9,6 +8,7 @@ static char     rcsid[] = "$Id$";
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <out.h>
+#include "object.h"
 
 #define OK     0       /* Return value of gethead if Orl Korekt. */
 #define BMASK  0xFF    /* To extract least significant 8 bits from an int. */
index 998be44..9c4bf37 100644 (file)
@@ -7,7 +7,7 @@
 #include       <stdlib.h>
 #include       <stdio.h>
 #include       "out.h"
-
+#include       "object.h"
 /*
        asize -- determine object size
 
index e436438..871398b 100644 (file)
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <stdarg.h>
 #include <string.h>
 #include "out.h"
index 83b059d..0870707 100644 (file)
@@ -6,9 +6,13 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <signal.h>
 #include "out.h"
-
+#include "object.h"
 /*
 
        astrip -- remove symbols and relocation bits
 
 char   temp_name[] = "/tmp/sXXXXXX";
 char   *tname;
-char   *mktemp();
-FILE   *fopen();
 FILE   *tf;
 struct outhead buf;
 int    readerror, writeerror;
 
+int strip(char *name);
+int copy(char *fnam, char *tnam, long size, int fr, int fw);
+
 int main(int argc, char *argv[])
 {
        int     status;
@@ -113,7 +118,7 @@ int strip(char *name)
 
 int copy(char *fnam, char *tnam, long size, int fr, int fw)
 {
-       int s, n;
+       int s/*, n*/;
        char lbuf[512];
 
        while(size != (long)0) {
index 82fd8de..3dc056a 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include "arch.h"
@@ -15,6 +11,7 @@ static char rcsid[] = "$Id$";
 #include "debug.h"
 #include "memory.h"
 #include "defs.h"
+#include "object.h"
 
 #define ENDLIB         ((long)0)
 
diff --git a/util/led/archive.h b/util/led/archive.h
new file mode 100644 (file)
index 0000000..6f6bf83
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * The Amsterdam Compiler Kit
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+#ifndef UTIL_LED_ARCHIVE_H
+#define UTIL_LED_ARCHIVE_H
+
+/* util/led/archive.c */
+void arch(void);
+void arch2(void);
+
+#endif /* UTIL_LED_ARCHIVE_H */
+
index d89cc89..6da2ef2 100644 (file)
@@ -2,16 +2,15 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <out.h>
 #include "const.h"
 
+
+
 static short   nerrors = 0;
 static void    diag(char *, char *, va_list);
 
index 70aa7c6..5bf5c41 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include "arch.h"
index 0785db7..132b958 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <out.h>
 #include "const.h"
 #include "arch.h"
@@ -13,6 +9,7 @@ static char rcsid[] = "$Id$";
 #include "defs.h"
 #include "orig.h"
 #include "scan.h"
+#include "object.h"
 
 extern bool    incore;
 extern unsigned short  NLocals;
@@ -22,8 +19,9 @@ static void adjust_names(struct outname *name, struct outhead *head, char *chars
 static void handle_relos(struct outhead *head, struct outsect *sects, struct outname *names);
 static void put_locals(struct outname *name, unsigned int nnames);
 static void compute_origins(struct outsect *sect, unsigned int nsect);
-
-static put_dbug(long offdbug);
+#ifdef SYMDBUG
+static void put_dbug(long offdbug);
+#endif
 /*
  * We know all there is to know about the current module.
  * Now we relocate the values in the emitted bytes and write
@@ -235,7 +233,7 @@ static void compute_origins(struct outsect *sect, unsigned int nsect)
  * Write out what is after the string area. This is likely to be
  * debugging information.
  */
-static put_dbug(long offdbug)
+static void put_dbug(long offdbug)
 {
        char            buf[512];
        int     nbytes;
index 319e564..82bec89 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 /*
  * led - linkage editor for ACK assemblers output format
  */
index 82ab20c..742de35 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 /*
  * Memory manager. Memory is divided into NMEMS pieces. There is a struct
  * for each piece telling where it is, how many bytes are used, and how may
@@ -22,6 +18,7 @@ static char rcsid[] = "$Id$";
  */
 
 #include <stdio.h>
+#include <unistd.h>
 #include <out.h>
 #include "const.h"
 #include "assert.h"
@@ -29,6 +26,9 @@ static char rcsid[] = "$Id$";
 #include "arch.h"
 #include "memory.h"
 #include "defs.h"
+#include "object.h"
+
+#include <missing_proto.h>
 
 static ind_t move_up(int piece, ind_t incr);
 static bool compact(int piece, ind_t incr, int flag);
@@ -56,7 +56,7 @@ int sbreak(ind_t incr)
        if ((refused && refused < incr) ||
            (sizeof(char *) < sizeof(long) &&
             (inc != incr || BASE + inc < BASE)) ||
-           brk(BASE + incr) == -1) {
+           brk(BASE + incr) == (void *)-1) {
                if (!refused || refused > incr)
                        refused = incr;
                return -1;
@@ -74,17 +74,16 @@ void init_core()
        char            *base;
        ind_t           total_size;
        struct memory   *mem;
-       extern char             *sbrk();
 
 #include "mach.c"
 #define ALIGN 8                        /* minimum alignment for pieces */
 #define AT_LEAST       (ind_t)2*ALIGN  /* See comment about string areas. */
 
        total_size = (ind_t)0;  /* Will accumulate the sizes. */
-       BASE = base = sbrk(0);          /* First free. */
+       BASE = base = (char *)sbrk(0);          /* First free. */
        if ((int)base % ALIGN) {
-               base  = sbrk(ALIGN - (int)base % ALIGN);
-               BASE = base = sbrk(0);
+               base  = (char *)sbrk(ALIGN - (int)base % ALIGN);
+               BASE = base = (char *)sbrk(0);
        }
        /*
         * String areas are special-cased. The first byte is unused as a way to
@@ -537,7 +536,7 @@ void write_bytes()
        extern int              flagword;
        extern struct outhead   outhead;
        extern struct outsect   outsect[];
-       extern char             *outputname;
+       /* extern char          *outputname; */
        int                     sectionno = 0;
 
        nsect = outhead.oh_nsect;
index 49fc470..2703a1b 100644 (file)
@@ -2,13 +2,11 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <out.h>
 #include "const.h"
 #include "memory.h"
+#include "object.h"
+#include "defs.h"
 
 static void generate_section_names();
 
index bd3e154..bacff5d 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdio.h>
 #include <out.h>
 #include "const.h"
index 76319b8..12758ef 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include "out.h"
index a0eab4a..c3bf337 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 /*
  * If everything is kept in core, we must save some things for the second pass.
  */
index d079958..b4afcbd 100644 (file)
@@ -2,17 +2,13 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifdef SYMDBUG
+#include <unistd.h>
+#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#endif /* SYMDBUG */
 #include "arch.h"
 #include "out.h"
 #include "ranlib.h"
@@ -22,6 +18,7 @@ static char rcsid[] = "$Id$";
 #include "scan.h"
 #include "debug.h"
 #include "defs.h"
+#include "object.h"
 
 #define READ   0
 
index 78ae0e7..be0a4c6 100644 (file)
@@ -2,10 +2,6 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 /*
  * Symbol table management.
  */
index 009a0d8..4d97af8 100644 (file)
@@ -2,19 +2,21 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#ifndef lint
-static char rcsid[] = "$Id$";
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include "out.h"
 #include "const.h"
 #include "assert.h"
 #include "memory.h"
 #include "arch.h"
 #include "defs.h"
+#include "object.h"
+
 extern struct outhead  outhead;
 extern struct outsect  outsect[];
 extern int             flagword;
index 541f301..6495285 100644 (file)
@@ -13,6 +13,7 @@
 # include "tunable.h"
 # include "token.h"
 # include "Lpars.h"
+# include "main.h"
 
 struct token dot;              /* current token */
 static struct token aside;     /* to put currrent token aside, when a token
index edefc2a..f7b918c 100644 (file)
@@ -14,6 +14,8 @@
 #include <string.h>
 #include "misc.h"
 
+
+
 struct hlist {                 /* linear list of pattern numbers */
     int        h_patno;
     struct hlist *h_next;
@@ -76,7 +78,7 @@ void printhashtable()
      * pointers to them
      */
     int i;
-    struct hlist *p;
+    /*struct hlist *p;*/
 
     for (i = 1; i <= 128; i++) {
        fprintf(genc,"int hash%d[] = { ",i);
diff --git a/util/topgen/hash.h b/util/topgen/hash.h
new file mode 100644 (file)
index 0000000..99ea923
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * The Amsterdam Compiler Kit
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+#ifndef UTIL_TOPGEN_HASH_H
+#define UTIL_TOPGEN_HASH_H
+
+/* util/topgen/hash.c */
+void addtohashtable(char *s, int n);
+void printhashtable(void);
+
+#endif /* UTIL_TOPGEN_HASH_H */
+
index 4847ef6..0bb36d3 100644 (file)
@@ -11,6 +11,7 @@
  
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdarg.h>
 
 extern int lineno, newline;
 
@@ -19,6 +20,9 @@ static int nerrors;
 char *linedir = "#line %d \"%s\"\n";   /* format of line directive */
 char *inpfile;
 
+/* From Lexer */
+void LLparse(void);
+
 int main(int argc, char *argv[])
 {
     newline = 1;
@@ -44,11 +48,14 @@ int main(int argc, char *argv[])
 }
 
 /* VARARGS1 */
-void error(char *s,  char *s1)
+void error(char *s, ...)
 {
+       va_list va;
     nerrors++;
     fprintf(stderr,"\"%s\", line %d: ",inpfile,lineno);
-    fprintf(stderr,s,s1);
+       va_start(va, s);
+    vfprintf(stderr, s, va);
+       va_end(va);
     putc('\n',stderr);
 }
 
diff --git a/util/topgen/main.h b/util/topgen/main.h
new file mode 100644 (file)
index 0000000..ad5c997
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * The Amsterdam Compiler Kit
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+#ifndef UTIL_TOPGEN_MAIN_H
+#define UTIL_TOPGEN_MAIN_H
+
+/* util/topgen/main.c */
+int main(int argc, char *argv[]);
+void error(char *s, ...);
+int onlyspace(char *s);
+
+#endif /* UTIL_TOPGEN_MAIN_H */
+
diff --git a/util/topgen/pattern.h b/util/topgen/pattern.h
new file mode 100644 (file)
index 0000000..2774a3b
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * The Amsterdam Compiler Kit
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+#ifndef UTIL_TOPGEN_PATTERN_H
+#define UTIL_TOPGEN_PATTERN_H
+
+/* util/topgen/pattern.c */
+void addpattern(char *str, int l, int np, int nr);
+void printpatterns(void);
+
+#endif /* UTIL_TOPGEN_PATTERN_H */
+
index b5511d0..8310e6f 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include "symtab.h"
+#include "main.h"
 
 struct symtab *idtable, *deftable;
 
-struct symtab *
-findident(s, mode, table) char *s; struct symtab **table; {
+struct symtab *findident(char *s, int mode, struct symtab **table)
+{
     /*
      * Look for identifier s in the symboltable referred to by *table.
      * If mode = LOOKING, no new entry's will be made.
      * If mode = ENTERING, a new entry will be made if s is not in the
      * table yet, otherwise an error results
      */
-    register struct symtab *p;
-    register n;
+    struct symtab *p;
+    int n;
 
     if (!*table) {     /* No entry for this symbol */
        if (mode == LOOKING) return (struct symtab *) 0;
index 45c573e..5d39ed5 100644 (file)
@@ -21,6 +21,9 @@
 #include "token.h"
 #include "symtab.h"
 #include "misc.h"
+#include "main.h"
+#include "pattern.h"
+#include "hash.h"
 
 char   idbuf[BUFSIZ], buf[BUFSIZ];
 int    countid;                /* # of variables */