_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__ */
#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>
#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;
exit(0);
}
-int rd_unsigned2(int fd);
-
void process(int fd)
{
unsigned int magic;
-static char rcsid[] = "$Id$";
/*
* show - make the contents of an ACK object file human readable.
*/
#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. */
#include <stdlib.h>
#include <stdio.h>
#include "out.h"
-
+#include "object.h"
/*
asize -- determine object size
#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"
#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;
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) {
* (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"
#include "debug.h"
#include "memory.h"
#include "defs.h"
+#include "object.h"
#define ENDLIB ((long)0)
--- /dev/null
+/*
+ * 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 */
+
* (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);
* (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"
* (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"
#include "defs.h"
#include "orig.h"
#include "scan.h"
+#include "object.h"
extern bool incore;
extern unsigned short NLocals;
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
* 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;
* (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
*/
* (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
*/
#include <stdio.h>
+#include <unistd.h>
#include <out.h>
#include "const.h"
#include "assert.h"
#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);
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;
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
extern int flagword;
extern struct outhead outhead;
extern struct outsect outsect[];
- extern char *outputname;
+ /* extern char *outputname; */
int sectionno = 0;
nsect = outhead.oh_nsect;
* (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();
* (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"
* (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"
* (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.
*/
* (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"
#include "scan.h"
#include "debug.h"
#include "defs.h"
+#include "object.h"
#define READ 0
* (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.
*/
* (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;
# 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
#include <string.h>
#include "misc.h"
+
+
struct hlist { /* linear list of pattern numbers */
int h_patno;
struct hlist *h_next;
* pointers to them
*/
int i;
- struct hlist *p;
+ /*struct hlist *p;*/
for (i = 1; i <= 128; i++) {
fprintf(genc,"int hash%d[] = { ",i);
--- /dev/null
+/*
+ * 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 */
+
#include <stdlib.h>
#include <stdio.h>
+#include <stdarg.h>
extern int lineno, newline;
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;
}
/* 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);
}
--- /dev/null
+/*
+ * 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 */
+
--- /dev/null
+/*
+ * 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 */
+
#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;
#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 */