--- /dev/null
+#ifndef H_MISSING_PROTO_H
+#define H_MISSING_PROTO_H
+
+#ifdef NOSBRK
+void *sbrk(__intptr_t increment);
+#endif
+
+#ifdef NOMKTEMP
+char *mktemp(char *template);
+#endif
+
+#endif /* H_MISSING_H */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#ifndef H_EM_CODE_H
+#define H_EM_CODE_H
#include "em_mesX.h"
#include "ansi.h"
+void C_flush();
+void C_internal_error();
+
_PROTOTYPE(void C_ms_com, (char *));
_PROTOTYPE(void C_ms_ego, (int, arith, arith, int));
_PROTOTYPE(void C_ms_emx, ( arith, arith));
#include "em_codeEK.h"
#endif
#endif
+
+#endif /* H_EM_CODE_H */
\ No newline at end of file
#include <stdio.h>
#include <string.h>
#include "alloc.h"
+#include "print.h"
#include "em_arith.h"
#include "insert.h"
#include "em_private.h"
#ifndef INCORE
File *C_tfr;
char *C_tmpfile;
-char *strcpy(), *strcat();
char *C_ibuf = 0;
long C_current_out;
#endif
#include <em_path.h>
#include <alloc.h>
+
+#include <em_code.h>
+
#include "insert.h"
char *C_tmpdir = TMP_DIR;
*/
#include "obj.h"
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
/*
* Parts of the output file.
*/
static int sectionnr;
-static void
-OUTREAD(p, b, n)
- char *b;
- long n;
+static void OUTREAD(int p, char *b, long n)
{
- register long l = outseek[p];
+ long l = outseek[p];
if (currpos != l) {
lseek(outfile, l, 0);
/*
* Open the output file according to the chosen strategy.
*/
-int
-rd_open(f)
- char *f;
+int rd_open(char *f)
{
if ((outfile = open(f, 0)) < 0)
static int offcnt;
-int
-rd_fdopen(fd)
+int rd_fdopen(int fd)
{
- register int i;
+ int i;
for (i = 0; i < NPARTS; i++) outseek[i] = 0;
offcnt = 0;
return 1;
}
-void
-rd_close()
+void rd_close()
{
close(outfile);
outfile = -1;
}
-int
-rd_fd()
+int rd_fd()
{
return outfile;
}
-void
-rd_ohead(head)
- register struct outhead *head;
+void rd_ohead(struct outhead *head)
{
- register long off;
+ long off;
OUTREAD(PARTEMIT, (char *) head, (long) SZ_HEAD);
#if BYTE_ORDER == 0x0123
if (sizeof(struct outhead) != SZ_HEAD)
#endif
{
- register char *c = (char *) head + (SZ_HEAD-4);
+ char *c = (char *) head + (SZ_HEAD-4);
head->oh_nchar = get4(c);
c -= 4; head->oh_nemit = get4(c);
#endif
}
-void
-rd_rew_relos(head)
- register struct outhead *head;
+void rd_rew_relos(struct outhead *head)
{
- register long off = OFF_RELO(*head) + rd_base;
+ long off = OFF_RELO(*head) + rd_base;
BEGINSEEK(PARTRELO, off);
}
-void
-rd_sect(sect, cnt)
- register struct outsect *sect;
- register unsigned int cnt;
+void rd_sect(struct outsect *sect, unsigned int cnt)
{
- register char *c = (char *) sect + cnt * SZ_SECT;
+ char *c = (char *) sect + cnt * SZ_SECT;
OUTREAD(PARTEMIT, (char *) sect, (long)cnt * SZ_SECT);
sect += cnt;
}
}
-void
-rd_outsect(s)
+void rd_outsect(int s)
{
OUTSECT(s);
sectionnr = s;
/*
* We don't have to worry about byte order here.
*/
-void
-rd_emit(emit, cnt)
- char *emit;
- long cnt;
+void rd_emit(char *emit, long cnt)
{
OUTREAD(PARTEMIT, emit, cnt);
offset[sectionnr] += cnt;
}
-void
-rd_relo(relo, cnt)
- register struct outrelo *relo;
- register unsigned int cnt;
+void rd_relo(struct outrelo *relo, unsigned int cnt)
{
-
OUTREAD(PARTRELO, (char *) relo, (long) cnt * SZ_RELO);
#if BYTE_ORDER == 0x0123
if (sizeof(struct outrelo) != SZ_RELO)
#endif
{
- register char *c = (char *) relo + (long) cnt * SZ_RELO;
+ char *c = (char *) relo + (long) cnt * SZ_RELO;
relo += cnt;
while (cnt--) {
}
}
-void
-rd_name(name, cnt)
- register struct outname *name;
- register unsigned int cnt;
+void rd_name(struct outname *name, unsigned int cnt)
{
-
OUTREAD(PARTNAME, (char *) name, (long) cnt * SZ_NAME);
#if BYTE_ORDER == 0x0123
if (sizeof(struct outname) != SZ_NAME)
#endif
{
- register char *c = (char *) name + (long) cnt * SZ_NAME;
+ char *c = (char *) name + (long) cnt * SZ_NAME;
name += cnt;
while (cnt--) {
}
}
-void
-rd_string(addr, len)
- char *addr;
- long len;
+void rd_string(char *addr, long len)
{
-
OUTREAD(PARTCHAR, addr, len);
}
#ifdef SYMDBUG
-void
-rd_dbug(buf, size)
- char *buf;
- long size;
+void rd_dbug(char *buf, long size)
{
OUTREAD(PARTDBUG, buf, size);
}
*/
#include "obj.h"
-int
-rd_arhdr(fd, arhdr)
- register struct ar_hdr *arhdr;
+void rd_fatal();
+
+#include <unistd.h>
+
+int rd_arhdr(int fd, struct ar_hdr *arhdr)
{
char buf[AR_TOTAL];
- register char *c = buf;
- register char *p = arhdr->ar_name;
- register int i;
+ char *c = buf;
+ char *p = arhdr->ar_name;
+ int i;
i = read(fd, c, AR_TOTAL);
if (i == 0) return 0;
#include "obj.h"
+#include <unistd.h>
+
#define MININT (1 << (sizeof(int) * 8 - 1))
#define MAXCHUNK (~MININT) /* Highest count we read(2). */
/* Unfortunately, MAXCHUNK is too large with some compilers. Put it in
an int!
*/
+void rd_fatal();
+
static int maxchunk = MAXCHUNK;
/*
* We don't have to worry about byte order here.
* Just read "cnt" bytes from file-descriptor "fd".
*/
-void
-rd_bytes(fd, string, cnt)
- register char *string;
- register long cnt;
+void rd_bytes(int fd, char *string, long cnt)
{
-
while (cnt) {
register int n = cnt >= maxchunk ? maxchunk : cnt;
#define sectionnr __sectionnr
static int offcnt;
-void
-__wr_flush(ptr)
- register struct fil *ptr;
+void __wr_flush(struct fil *ptr)
{
#ifdef OUTSEEK
/* seek to correct position even if we aren't going to write now */
*/
#include "obj.h"
-void
-wr_arhdr(fd, arhdr)
- register struct ar_hdr *arhdr;
+void wr_arhdr(int fd, struct ar_hdr *arhdr)
{
char buf[AR_TOTAL];
- register char *c = buf;
- register char *p = arhdr->ar_name;
- register int i = 14;
+ char *c = buf;
+ char *p = arhdr->ar_name;
+ int i = 14;
while (i--) {
*c++ = *p++;
#include "obj.h"
+#include <unistd.h>
+
+void wr_fatal();
+
#define MININT (1 << (sizeof(int) * 8 - 1))
#define MAXCHUNK (~MININT) /* Highest count we write(2). */
/* Notice that MAXCHUNK itself might be too large with some compilers.
/*
* Just write "cnt" bytes to file-descriptor "fd".
*/
-void
-wr_bytes(fd, string, cnt)
- register char *string;
- register long cnt;
+void wr_bytes(int fd, char *string, long cnt)
{
-
while (cnt) {
- register int n = cnt >= maxchunk ? maxchunk : cnt;
+ int n = cnt >= maxchunk ? maxchunk : cnt;
if (write(fd, string, n) != n)
wr_fatal();
#include "system.h"
-int
-sys_access(path, mode)
- char *path;
- int mode;
+int sys_access(char *path, int mode)
{
return access(path, mode) == 0;
}
#include "system.h"
-int
-sys_chmode(path, mode)
- char *path;
- int mode;
+int sys_chmode(char *path, int mode)
{
return chmod(path, mode) == 0;
}
#include "system.h"
-void
-sys_close(fp)
- register File *fp;
+void sys_close(File *fp)
{
if (fp) {
fp->o_flags = 0;
extern File *_get_entry();
-int
-sys_create(filep, path, mode)
- File **filep;
- char *path;
- int mode;
+int sys_create(File **filep, char *path, int mode)
{
register fd;
register File *fp;
#include <ansi.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <missing_proto.h>
+
struct _sys_fildes {
int o_fd; /* UNIX filedescriptor */
int o_flags; /* flags for open; 0 if not used */
* This file is copied into Lpars.c.
*/
-#ifndef lint
-static char *rcsid = "$Id$";
-#endif
-
unsigned int LLtcnt[LL_NTERMINALS];
unsigned int LLscnt[LL_NSETS];
int LLcsymb, LLsymb;
* alloc.c
* Interface to malloc() and realloc()
*/
-
+#include <stdio.h>
#include <stdlib.h>
# include "types.h"
# include "extern.h"
-
-# ifndef NORCSID
-static string rcsid = "$Id$";
-# endif
+# include "LLgen.h"
static string e_nomem = "Out of memory";
-p_mem
-alloc(size) unsigned size; {
+p_mem alloc(unsigned int size)
+{
/*
Allocate "size" bytes. Panic if it fails
*/
p_mem p;
- if ((p = malloc(size)) == 0) fatal(linecount,e_nomem);
+ if ((p = malloc(size)) == 0) fatal(linecount,e_nomem, NULL, NULL);
return p;
}
-p_mem
-ralloc(p,size) p_mem p; unsigned size; {
+p_mem ralloc(p_mem p, unsigned int size)
+{
/*
Re-allocate the chunk of memory indicated by "p", to
occupy "size" bytes
*/
- if ((p = realloc(p,size)) == 0) fatal(linecount,e_nomem);
+ if ((p = realloc(p,size)) == 0) fatal(linecount,e_nomem, NULL, NULL);
return p;
}
-p_mem
-new_mem(p) register p_info p; {
+p_mem new_mem(p_info p)
+{
/*
This routine implements arrays that can grow.
It must be called every time a new element is added to it.
be updated each time this routine is called
*/
p_mem rp;
- unsigned sz;
+ unsigned int sz;
if (p->i_max >= p->i_top) { /* No more free elements */
sz = p->i_size;
return follow(p->n_nc_follow, p->n_rule);
}
+#if 0
static int nc_follow(p_set setp, p_gram p)
{
/*
p++;
}
}
+#endif
#endif
# include "extern.h"
# include "io.h"
-# ifndef NORCSID
-static string rcsid4 = "$Id$";
-# endif
-
char ltext[LTEXTSZ];
p_nont nonterms;
p_nont maxnt;
#include "LLgen.h"
-# ifndef NORCSID
-static string rcsid5 = "$Id$";
-# endif
-
/* In this file the following routines are defined: */
-/* extern UNLINK(); */
-/* extern RENAME(); */
-/* extern string libpath(); */
-
-void UNLINK(string x) {
+void UNLINK(string x)
+{
/* Must remove the file "x" */
#ifdef USE_SYS
#include "assert.h"
#include "LLgen.h"
+#include <missing_proto.h>
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-int main(int argc, char *argv[]) {
- register string arg;
+int main(int argc, char *argv[])
+{
+ string arg;
string libpath();
char *beg_sbrk = 0;
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#include <stdlib.h>
-
#include "../share/types.h"
#include "../share/alloc.h"
#include "cs.h"