--- /dev/null
+/build
+/stage
REFER=refer
TBL=tbl
-all: $(TARGET_HOME)/doc/LLgen.doc $(TARGET_HOME)/doc/LLgen_NCER.doc
+#all: $(TARGET_HOME)/doc/LLgen.doc $(TARGET_HOME)/doc/LLgen_NCER.doc
$(TARGET_HOME)/doc/LLgen.doc: $(SRC_DIR)/LLgen.n $(SRC_DIR)/LLgen.refs
$(REFER) -sA+T -p $(SRC_DIR)/LLgen.refs $(SRC_DIR)/LLgen.n | $(EQN) | $(TBL) > $@
--- /dev/null
+TARGET_HOME="/home/nick/src/Ack-5.5/stage"; export TARGET_HOME
+UTIL_HOME="/home/nick/src/Ack-5.5/stage"; export UTIL_HOME
+SRC_HOME="/home/nick/src/Ack-5.5"; export SRC_HOME
+SYSNAME=""; export SYSNAME
+ACM="z80"; export ACM
+CURRENT="y"; export CURRENT
+SYS="V7"; export SYS
+LIMIT="y"; export LIMIT
+CONFIG="/home/nick/src/Ack-5.5/build"; export CONFIG
+DISABLE_LANG=" Modula-2 Pascal Occam Basic Fortran"; export DISABLE_LANG
+DISABLE_SUP=" i86 xenix3 minix i386 6500 6800 6805 6809 i80 em22 em24 em44 m68k2 pmds minixST m68k4 pmds4 sun2 mantra m68020 sun3 sparc sparc_solaris ns pdp s2650 vax4 z8000 arm"; export DISABLE_SUP
+DO_MACHINE_INDEP="y"; export DO_MACHINE_INDEP
+MACH_LIST="i86 xenix3 minix i386 6500 6800 6805 6809 i80 em22 em24 em44 m68k2 pmds minixST m68k4 pmds4 sun2 mantra m68020 sun3 sparc sparc_solaris ns pdp s2650 vax4 z80 z8000 arm"; export MACH_LIST
+SYSVAX=""; export SYSVAX
+MACH="XXX"; export MACH
+WS="4"; export WS
+PS="8"; export PS
+DO_FAST="n"; export DO_FAST
+
+PATH=::$CONFIG/bin:$UTIL_HOME/bin:/usr/ccs/bin:/usr/ucb:$PATH
+export PATH
#include "Lpars.h"
#include "assert.h"
-arith full_mask[MAXSIZE];/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
+arith full_mask[MAXSIZE + 1];/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
#ifndef NOCROSS
arith max_int; /* maximum integer on target machine */
arith max_unsigned; /* maximum unsigned on target machine */
while (!(bt < 0)) {
bt = (bt << 8) + 0377, i++;
- if (i == MAXSIZE)
+ if (i == MAXSIZE + 1)
fatal("array full_mask too small for this machine");
full_mask[i] = bt;
}
long mach_long_sign; /* sign bit of the machine long */
int mach_long_size; /* size of long on this machine == sizeof(long) */
-long full_mask[MAXSIZE];/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
+long full_mask[MAXSIZE + 1];/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
arith max_int; /* maximum integer on target machine */
arith max_unsigned; /* maximum unsigned on target machine */
while (!(bt < 0)) {
bt = (bt << 8) + 0377, i++;
- if (i == MAXSIZE)
+ if (i == MAXSIZE + 1)
fatal("array full_mask too small for this machine");
full_mask[i] = bt;
}
mach_long_size = i;
mach_long_sign = 1L << (mach_long_size * 8 - 1);
- if ((int)long_size < mach_long_size)
+ if ((int)long_size > mach_long_size) /* Nick changed < to >, bug?? */
fatal("sizeof (long) insufficient on this machine");
max_int = full_mask[(int)int_size] & ~(1L << ((int)int_size * 8 - 1));
max_unsigned = full_mask[(int)int_size];
}
/*** the compact code generating routines ***/
-#define fit16i(x) ((x) >= (long)0xFFFF8000 && (x) <= (long)0x00007FFF)
+#define fit16i(x) ((x) >= -0x8000L && (x) <= 0x7FFFL)
#define fit8u(x) ((x) <= 0xFF) /* x is already unsigned */
void
--- /dev/null
+#!/bin/sh
+#sudo apt-get install groff
+rm -rf build stage
+sh INSTALL
#else
extern int debug ;
#endif
+
+#ifdef __STDC__
+/* Some arch need to be told not to use regcall for varargs functions */
+void fatal(const char *fmt, ...);
+void vprint(const char *fmt, ...);
+void fuerror(const char *fmt, ...);
+void werror(const char *fmt, ...);
+void error(const char *fmt, ...);
+#endif
extern growstring scanb();
extern growstring scanvars();
-int getline() ;
+int _getline() ;
int getinchar() ;
static char *ty_name ;
static char *bol ;
inname=name ;
open_in(name) ;
- while ( getline() ) {
+ while ( _getline() ) {
if ( strcmp(VAR,ty_name)==0 ) {
doassign(bol,(char *)0,0) ;
} else
new= (trf *)getcore(sizeof *new) ;
new->t_name= keeps(bol) ;
for (;;) {
- if ( !getline() ) {
+ if ( !_getline() ) {
fuerror("unexpected EOF on %s",inname) ;
}
twice= NO ;
return token ;
}
-int getline() {
+int _getline() {
register char *c_ptr ;
do {
Other routines called
- fatal(args*) When something goes wrong
getcore(size) Core allocation
*/
extern char *getcore();
-extern fatal();
struct vars {
char *v_name;
return ptr ;
}
+#ifdef __STDC__
+#include <stdarg.h>
+
+/* VARARGS1 */
+void fatal(const char *fmt, ...) {
+ va_list ap;
+
+ /* Fatal internal error */
+ fprintf(STDOUT,"%s: fatal internal error, ",progname) ;
+ va_start(ap, fmt);
+ vfprintf(STDOUT,fmt,ap);
+ va_end(ap);
+ fprintf(STDOUT,"\n") ;
+ quit(-2) ;
+}
+
+
+/* VARARGS1 */
+void vprint(const char *fmt, ...) {
+ va_list ap;
+
+ /* Diagnostic print, no auto NL */
+ va_start(ap, fmt);
+ vfprintf(STDOUT,fmt,ap);
+ va_end(ap);
+}
+
+#ifdef DEBUG
+prns(s) register char *s ; {
+ for ( ; *s ; s++ ) {
+ putc((*s&0377)&~NO_SCAN,STDOUT) ;
+ }
+ putc('\n',STDOUT) ;
+}
+#endif
+
+/* VARARGS1 */
+void fuerror(const char *fmt, ...) {
+ va_list ap;
+
+ /* Fatal user error */
+ fprintf(STDOUT,"%s: ",progname) ;
+ va_start(ap, fmt);
+ vfprintf(STDOUT,fmt,ap);
+ va_end(ap);
+ fprintf(STDOUT,"\n") ;
+ quit(-1) ;
+}
+
+/* VARARGS1 */
+void werror(const char *fmt, ...) {
+ va_list ap;
+
+ /* Warning user error, w_flag */
+ if ( w_flag ) return ;
+ fprintf(STDOUT,"%s: warning, ",progname) ;
+ va_start(ap, fmt);
+ vfprintf(STDOUT,fmt,ap);
+ va_end(ap);
+ fprintf(STDOUT,"\n") ;
+}
+
+/* VARARGS1 */
+void error(const char *fmt, ...) {
+ va_list ap;
+
+ /* User error, it is the callers responsibility to quit */
+ fprintf(STDOUT,"%s: ",progname) ;
+ va_start(ap, fmt);
+ vfprintf(STDOUT,fmt,ap);
+ va_end(ap);
+ fprintf(STDOUT,"\n") ;
+ n_error++ ;
+}
+#
+#else
/* VARARGS1 */
fatal(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
/* Fatal internal error */
fprintf(STDOUT,"\n") ;
n_error++ ;
}
+#endif
do_flush() {
fflush(stdout) ;
*/
{
+#include <stdio.h>
#include <system.h>
#include "decl.h"
#include "em.h"
int argc;
char **argv;
{
+ extern FILE *infile;
+ infile = stdin;
+
outfile = STDOUT;
if ( argc > 1) {
if ( strcmp( argv[1], "-l") == 0)
static char buf[BUF_SIZE], /* Bufer to save backc()-characters */
*bufptr = buf; /* Pointer to space for backc()-character */
-static FILE *infile = stdin;
+FILE *infile; /*static FILE *infile = stdin;*/
}
char *
-getline(s, n, fp)
+_getline(s, n, fp)
char *s;
FILE *fp;
{
fprintf(stderr, "%s: cannot read file %s\n", ProgCall, name);
exit(1);
}
- while (getline(text, BUFSIZE, fp) != NULL) {
+ while (_getline(text, BUFSIZE, fp) != NULL) {
if (text[0] == FILECOM) {
option(text);
}
+STATIC app_block();
STATIC block_entry(b,prev)
bblock_p b,prev;
{
#include "mem.h"
#include "warn.h"
-#include <sgtty.h>
+#include "v7_sgtty.h"
#ifdef V7IOCTL /* define the proper V7 requests */
#endif
#include <sys/times.h>
-extern int errno; /* UNIX error number */
+#include <errno.h>
+/*extern int errno;*/ /* UNIX error number */
extern int running; /* from main.c */
extern int fd_limit; /* from io.c */
#ifdef BSD_X /* from system.h */
#include <sys/timeb.h>
#endif /* BSD_X */
-#ifdef SYS_V
+#if 1 //def SYS_V
struct timeb { /* non-existing; we use an ad-hoc definition */
long time;
unsigned short millitm;
#include <time.h>
#endif
#include <sys/times.h>
-#include <sgtty.h>
+#include "v7_sgtty.h"
#ifdef BSD_X /* from system.h */
#include <sys/timeb.h>
#endif /* BSD_X */
-#ifdef SYS_V /* from system.h */
+#if 1 //def SYS_V /* from system.h */
struct timeb { /* non-existing; we use an ad-hoc definition */
long time;
unsigned short millitm;
--- /dev/null
+/*
+ * Structure for stty and gtty system calls.
+ */
+
+struct sgttyb {
+ char sg_ispeed; /* input speed */
+ char sg_ospeed; /* output speed */
+ char sg_erase; /* erase character */
+ char sg_kill; /* kill character */
+ int sg_flags; /* mode flags */
+};
+
+/*
+ * List of special characters
+ */
+struct tchars {
+ char t_intrc; /* interrupt */
+ char t_quitc; /* quit */
+ char t_startc; /* start output */
+ char t_stopc; /* stop output */
+ char t_eofc; /* end-of-file */
+ char t_brkc; /* input delimiter (like nl) */
+};
+
+/*
+ * Modes
+ */
+#define TANDEM 01
+#define CBREAK 02
+#define LCASE 04
+#define ECHO 010
+#define CRMOD 020
+#define RAW 040
+#define ODDP 0100
+#define EVENP 0200
+#define ANYP 0300
+#define NLDELAY 001400
+#define TBDELAY 006000
+#define XTABS 06000
+#define CRDELAY 030000
+#define VTDELAY 040000
+#define BSDELAY 0100000
+#define ALLDELAY 0177400
+
+/*
+ * Delay algorithms
+ */
+#define CR0 0
+#define CR1 010000
+#define CR2 020000
+#define CR3 030000
+#define NL0 0
+#define NL1 000400
+#define NL2 001000
+#define NL3 001400
+#define TAB0 0
+#define TAB1 002000
+#define TAB2 004000
+#define FF0 0
+#define FF1 040000
+#define BS0 0
+#define BS1 0100000
+
+/*
+ * Speeds
+ */
+#define B0 0
+#define B50 1
+#define B75 2
+#define B110 3
+#define B134 4
+#define B150 5
+#define B200 6
+#define B300 7
+#define B600 8
+#define B1200 9
+#define B1800 10
+#define B2400 11
+#define B4800 12
+#define B9600 13
+#define EXTA 14
+#define EXTB 15
+
+/*
+ * tty ioctl commands
+ */
+#define TIOCGETD (('t'<<8)|0)
+#define TIOCSETD (('t'<<8)|1)
+#define TIOCHPCL (('t'<<8)|2)
+#define TIOCMODG (('t'<<8)|3)
+#define TIOCMODS (('t'<<8)|4)
+#define TIOCGETP (('t'<<8)|8)
+#define TIOCSETP (('t'<<8)|9)
+#define TIOCSETN (('t'<<8)|10)
+#define TIOCEXCL (('t'<<8)|13)
+#define TIOCNXCL (('t'<<8)|14)
+#define TIOHMODE (('t'<<8)|15)
+#define TIOCTSTP (('t'<<8)|16)
+#define TIOCSETC (('t'<<8)|17)
+#define TIOCGETC (('t'<<8)|18)
+#define DIOCLSTN (('d'<<8)|1)
+#define DIOCNTRL (('d'<<8)|2)
+#define DIOCMPX (('d'<<8)|3)
+#define DIOCNMPX (('d'<<8)|4)
+#define DIOCSCALL (('d'<<8)|5)
+#define DIOCRCALL (('d'<<8)|6)
+#define DIOCPGRP (('d'<<8)|7)
+#define DIOCGETP (('d'<<8)|8)
+#define DIOCSETP (('d'<<8)|9)
+#define DIOCLOSE (('d'<<8)|10)
+#define DIOCTIME (('d'<<8)|11)
+#define DIOCRESET (('d'<<8)|12)
+#define FIOCLEX (('f'<<8)|1)
+#define FIONCLEX (('f'<<8)|2)
+#define MXLSTN (('x'<<8)|1)
+#define MXNBLK (('x'<<8)|2)
extern oldloc();
extern oldreg();
-#undef USEMALLOC /* if defined malloc() and free() are used */
+#define USEMALLOC /* if defined malloc() and free() are used */
#undef COREDEBUG /* keep records and print statistics */
case EX_SFIT:
mask = 0;
for (i=leaf2.e_v.e_con - 1;i < 8*sizeof(offset); i++)
- mask |= 1<<i;
+ mask |= ((offset)1)<<i;
res.e_v.e_con = (leaf1.e_v.e_con&mask) == 0 ||
(leaf1.e_v.e_con&mask) == mask;
break;
case EX_UFIT:
mask = 0;
for (i=leaf2.e_v.e_con;i < 8*sizeof(offset); i++)
- mask |= 1<<i;
+ mask |= ((offset)1)<<i;
res.e_v.e_con = (leaf1.e_v.e_con&mask) == 0;
break;
case EX_ROTATE:
print
print "char *pop_push[] = {"
print "\"\","
- switch = 0
+ s = 0
}
-/aar/ { switch = NR }
- { if (switch) {
+/aar/ { s = NR }
+ { if (s) {
if ($1 == "cal" || $1 == "cai") $3 = "-?"
printf("/* %s */ \"%s\",\n",$1,$3)
- col_2[NR-switch] = $2
- comment[NR-switch] = $1
+ col_2[NR-s] = $2
+ comment[NR-s] = $1
}
}
END { print "};"
print
print "char flow_tab[]= {"
- print "'\000',"
- for(i=0; i < NR-switch; i++) {
+ print "'\\000',"
+ for(i=0; i < NR-s; i++) {
inf = col_2[i]
f_out = "/* " comment[i] " */ "
if (substr(inf,1,1)=="b") f_out = f_out "HASLABEL|"
if (substr(inf,2,1)=="c") f_out = f_out "CONDBRA"
else if (substr(inf,2,1)=="t") f_out = f_out "JUMP"
- else f_out = f_out "'\000'"
+ else f_out = f_out "'\\000'"
print f_out","
}
print "};"