--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+/* @(#)comm0.h 1.8 */
+/*
+ * All preprocessor based options/constants/functions
+ */
+
+/* ========== ON/OFF options (use #define in mach0.c) ========== */
+
+/*
+ * The following options are available, to be set/removed in "mach0.c":
+ * THREE_PASS: three passes needed for branch optimization
+ * BYTES_REVERSED: lowest target address for word high-order byte
+ * WORDS_REVERSED: lowest target address for long high-order byte
+ * LISTING: include listing facilities
+ * RELOCATION: relocatable code generated
+ * DEBUG: for debugging purposes only
+ * TMPDIR: directory for temporary files
+ * ASLD: combined assembler/linker
+ * AOUTSEEK: seek on a.out instead of multiple opens
+ */
+
+/* ========== constants (use #undef, #define in mach0.c) ========== */
+
+/* table sizes */
+#define STRINGMAX 200 /* <= 256 */
+#define BITMAX 2000 /* for short or long branches */
+#define SECTMAX 64
+#define NAMEMAX 80
+#define MEMINCR 2048
+
+/* Some character constants for parsing */
+#define ASC_LPAR '['
+#define ASC_RPAR ']'
+#define ASC_SQUO '\''
+#define ASC_DQUO '"'
+#define ASC_COMM '!'
+#define ISALPHA(c) (isalpha(c) || (c) == '_' || (c) == '.')
+#define ISALNUM(c) (isalnum(c) || (c) == '_')
+
+#define GENLAB "I" /* compiler generated labels */
+
+#define ushort unsigned short
+
+#define valu_t short /* type of expression values */
+#define addr_t ushort /* type of dot */
+#define word_t short /* type of keyword value */
+/*
+ * NOTE: word_t is introduced to reduce the tokenfile size for machines
+ * with large expressions but smaller opcodes (68000)
+ */
+
+#define ALIGNWORD 1
+#define ALIGNSECT 1
+
+#define machstart(x) /* nothing */
+#define machfinish(x) /* nothing */
+
+#define SETBASE(sp) ((long)(sp)->s_base)
+
+#define VALWIDTH 4
+
+/* ========== Machine dependent option/constant settings ========== */
+
+#include "mach0.c"
+
+/* ========== default option setting ========== */
+
+#ifndef NOLD
+#define ASLD /* default ON */
+#endif
+
+#ifndef ASLD
+#ifndef RELOCATION
+separate linker only possible if relocation info produced
+#endif RELOCATION
+#endif ASLD
+
+#ifndef DEBUG
+#define DEBUG 1
+#endif
+
+/* ========== Machine independent type declarations ========== */
+
+#ifdef _include
+_include <stdio.h>
+_include <ctype.h>
+_include <signal.h>
+#else
+#include <stdio.h>
+#include <ctype.h>
+#include <signal.h>
+#endif
+
+#ifdef ASLD
+#include "aar.h"
+#endif
+#include "out.h"
+
+#if DEBUG == 0
+#define assert(ex) /* nothing */
+#endif
+
+#if DEBUG == 1
+#define assert(ex) {if (!(ex)) assert1();}
+#endif
+
+#if DEBUG == 2
+#define assert(ex) {if (!(ex)) assert2(__FILE__, __LINE__);}
+#endif
+
+#define CTRL(x) ((x) & 037)
+
+#define lowb(z) ((int)(z) & 0xFF)
+#define loww(z) ((int)(z) & 0xFFFF)
+
+#define fitb(x) ((((x) + 0x80) & ~0xFF) == 0)
+#define fitw(x) ((((x) + 0x8000) & ~0xFFFF) == 0)
+
+#define fit(x) if (!(x)) nofit()
+
+#define PASS_1 0
+#define PASS_2 1
+#define PASS_3 2
+
+#ifdef THREE_PASS
+#define PASS_SYMB (pass != PASS_1)
+#define PASS_RELO (pass != PASS_1)
+#else
+#define PASS_SYMB 1
+#define PASS_RELO 1
+#endif THREE_PASS
+
+#ifdef ASLD
+#define RELOMOVE(a,b) /* empty */
+#else
+#define RELOMOVE(a,b) {a = b; b = 0;}
+#endif
+
+/* symbol table management */
+#define H_SIZE 256 /* hash size */
+#define H_KEY (0*H_SIZE) /* key symbol headers */
+#define H_LOCAL (1*H_SIZE) /* module symbol headers */
+#ifdef ASLD
+#define H_GLOBAL (2*H_SIZE) /* external symbol headers */
+#define H_TOTAL (3*H_SIZE)
+#else
+#define H_TOTAL (2*H_SIZE)
+#endif
+
+/* numeric label table management */
+#define FB_SIZE 10
+#define FB_HEAD (0*FB_SIZE)
+#define FB_TAIL (1*FB_SIZE)
+#define FB_BACK (2*FB_SIZE)
+#define FB_FORW (3*FB_SIZE)
+
+/* miscellaneous */
+#define KEYDEFINE 0
+#define DOTGAIN DOTSCT->s_gain
+
+/* ========== type declarations ========== */
+
+struct expr_t {
+ short typ;
+ valu_t val;
+};
+
+typedef struct expr_t expr_t;
+
+struct item_t {
+ struct item_t *
+ i_next; /* linked lists with same hash value */
+ short i_type;
+ /*
+ * the i_type field is used for two different purposes:
+ * - the token type for keywords, returned by yylex()
+ * - the symbol type for IDENT and FBSYM tokens
+ */
+ valu_t i_valu; /* symbol value */
+ char *i_name; /* symbol name */
+};
+
+typedef struct item_t item_t;
+
+struct sect_t {
+ short s_flag; /* some flag bits */
+ addr_t s_base; /* section base */
+ addr_t s_size; /* section size */
+ addr_t s_comm; /* length of commons */
+ addr_t s_zero; /* delayed emit1(0) */
+ addr_t s_lign; /* section alignment */
+ long s_foff; /* section file offset */
+ item_t *s_item; /* points to section name */
+#ifdef THREE_PASS
+ addr_t s_gain; /* gain in PASS_2 */
+#endif
+};
+
+typedef struct sect_t sect_t;
+
+/* ========== flag field bits ========== */
+
+/* s_flag bits: */
+#define BASED 1 /* at fixed position */
+
+/* sflag bits: */
+#define SYM_EXT 001 /* external symbols */
+#define SYM_LOC 002 /* local symbols */
+#define SYM_LAB 004 /* local, compiler-generated labels */
+#define SYM_SMB 010 /* .symb symbols */
+#define SYM_LIN 020 /* .line and .file */
+#define SYM_SCT 040 /* section names */
+#define SYM_DEF 073 /* default value */
+
+/*
+ * extra type bits out of S_ETC, internal use only
+#ifndef DUK
+ * S_COM:
+ * - symbols declared by .comm
+#endif DUK
+ * S_VAR:
+ * - type not known at end of PASS_1 (S_VAR|S_UND)
+ * - value not known at end of PASS_2 (S_VAR|S_ABS)
+ * S_DOT:
+ * - dot expression
+ */
+#ifndef DUK
+#define S_COM 0x0100
+#endif DUK
+#define S_VAR 0x0200
+#define S_DOT 0x0400
+/* should be tested by preprocessor
+ * due to error in preprocessor it cannot
+ * test performed at runtime now
+ * #if (S_ETC|S_COM|S_VAR|S_DOT) != S_ETC
+ * incorrect type bits
+ * #endif
+ */
+
+/* parts of the a.out file */
+#define PARTEMIT 0
+#define PARTRELO 1
+#define PARTNAME 2
+#define PARTCHAR 3
+#define PARTS 4
+
+#ifdef AOUTSEEK
+#define AOUTPART(p) if(aoutpart!=p){aoutpart=p;fseek(aoutfile,aoutseek[p],0);}
+#define AOUTPUTC(c,p) {putc(c,aoutfile);aoutseek[p]++;if(ferror(aoutfile))werror();}
+#else
+#define AOUTPART(p) /* empty */
+#define AOUTPUTC(c,p) {putc(c,aoutfile[p]);if(ferror(aoutfile[p]))werror();}
+#endif
--- /dev/null
+/* @(#)comm1.h 1.5 */
+/*
+ * variable declarations
+ */
+
+#ifdef extern
+#define INIT(x) = x
+#else
+#define INIT(x) /* empty */
+#endif
+
+extern short pass INIT(PASS_1);
+ /* PASS 1, 2 or 3 */
+extern short peekc; /* push back symbol (PASS_1) */
+extern short unresolved; /* number of unresolved references */
+extern short lineno; /* input line number */
+extern short hllino; /* high-level language line number */
+extern short nerrors; /* terminate at end of pass if set */
+extern short sflag INIT(SYM_DEF);
+ /* -s option (symbol table info) */
+extern char *progname; /* for error messages */
+extern char *modulename; /* for error messages */
+
+#ifdef ASLD
+extern short archmode; /* scanning archives */
+extern long archsize; /* size of individual archive entries */
+#else
+extern short uflag; /* if 1 make undefineds extern */
+ /* symbol table index for last S_UND */
+#endif
+
+#ifdef LISTING
+extern short dflag; /* -d option (list mode) */
+#endif
+
+#ifdef ASLD
+#ifdef RELOCATION
+extern short rflag; /* -r option (relocation info) */
+#endif RELOCATION
+#else
+#define rflag 1
+extern valu_t relonami;
+#endif ASLD
+
+#ifdef THREE_PASS
+extern short bflag; /* -b option (no optimizations) */
+#endif
+
+extern char *aoutpath INIT("a.out");
+extern char temppath[50];
+
+extern FILE *input;
+extern FILE *tempfile;
+
+#ifdef AOUTSEEK
+extern FILE *aoutfile;
+extern int aoutpart INIT(-1);
+extern long aoutseek[PARTS];
+#else
+extern FILE *aoutfile[PARTS];
+#endif
+
+extern char stringbuf[STRINGMAX];
+ /* contains last string value */
+
+extern sect_t sect[SECTMAX];
+
+/*
+ * specials for the location counter
+ */
+extern sect_t *DOTSCT; /* §[DOTTYP-S_MIN] or NULL */
+extern addr_t DOTVAL; /* DOTSCT->s_size + DOTSCT->s_base */
+extern short DOTTYP; /* S_MIN..S_MAX or S_UND */
+
+extern item_t *hashtab[H_TOTAL];
+extern short hashindex; /* see item_search() */
+
+extern item_t *fb_ptr[4*FB_SIZE];
+
+#ifdef THREE_PASS
+extern char bittab[BITMAX>>3];
+ /* one bit per small-large decision */
+extern short nbits; /* number of decisions so far */
+#endif
+
+#ifdef LISTING
+extern short listmode; /* -d option for current pass */
+extern short listtemp; /* listmode if .list seen */
+extern short listflag; /* copied from listtemp at '\n' */
+extern short listcolm; /* column on output */
+extern short listeoln INIT(1);
+ /* set by endline, tested by emit1 */
+extern FILE *listfile; /* copy of source text */
+extern char listpath[50];
+#endif
+
+#ifndef extern
+extern item_t keytab[];
+extern struct outhead outhead;
+#endif
+
+/* forward function declarations */
+extern char *libname();
+extern char *readident();
+extern char *remember();
+extern item_t *fb_shift();
+extern item_t *fb_alloc();
+extern item_t *item_alloc();
+extern item_t *item_search();
+extern valu_t load();
+extern FILE *ffcreat();
+extern FILE *fftemp();
+
+/* some library functions used */
+extern long atol();
+extern char *mktemp();
+extern char *sbrk();
+extern char *getenv();
+
+/* ========== Machine dependent C declarations ========== */
+
+#include "mach1.c"
--- /dev/null
+/* @(#)comm2.y 1.7 */
+
+/*
+ * delay inclusion of machine dependent stuff (see comm0.h)
+ */
+#define _include #include
+
+%{
+#include "comm0.h"
+#include "comm1.h"
+%}
+
+/* ========== Machine independent Yacc definitions ========== */
+
+%union {
+ word_t y_word;
+ valu_t y_valu;
+ expr_t y_expr;
+ item_t *y_item;
+#ifdef ASLD
+ char *y_strp;
+#endif
+};
+
+#ifdef ASLD
+%token <y_strp> MODULE
+#endif
+%token STRING
+%token <y_item> IDENT
+%token <y_item> FBSYM
+%token <y_valu> CODE1
+%token <y_valu> CODE2
+%token <y_valu> CODE4
+%token NUMBER0 /* keep NUMBER* in this order */
+%token NUMBER1
+%token NUMBER2
+%token NUMBER3
+%token <y_valu> NUMBER
+%token DOT
+%token EXTERN
+%token <y_word> DATA
+%token <y_word> ASCII
+%token SECTION
+%token COMMON
+%token BASE
+%token SYMB
+%token ALIGN
+%token ASSERT
+%token SPACE
+%token <y_word> LINE
+%token FILe
+%token <y_word> LIST
+%token OP_EQ
+%token OP_NE
+%token OP_LE
+%token OP_GE
+%token OP_LL
+%token OP_RR
+%token OP_OO
+%token OP_AA
+
+%left OP_OO
+%left OP_AA
+%left '|'
+%left '^'
+%left '&'
+%left OP_EQ OP_NE
+%left '<' '>' OP_LE OP_GE
+%left OP_LL OP_RR
+%left '+' '-'
+%left '*' '/' '%'
+%nonassoc '~'
+
+%type <y_valu> absexp optabs1 optabs2
+%type <y_expr> expr
+%type <y_item> id_fb
+
+/* ========== Machine dependent Yacc definitions ========== */
+
+#include "mach2.c"
+
+%%
+
+/* ========== Machine independent rules ========== */
+
+#ifdef LISTING
+#define LISTLINE(n) listline(n)
+#else
+#define LISTLINE(n) /* empty */
+#endif LISTING
+
+#ifdef ASLD
+#define RELODONE /* empty */
+#else
+#define RELODONE assert(relonami == 0)
+#endif
+
+program : /* empty */
+#ifdef ASLD
+ | program MODULE /* not in PASS_1 */
+ { newmodule($2);}
+#endif
+ | program IDENT ':'
+ { newident($2, DOTTYP); newlabel($2);}
+ | program NUMBER ':'
+ { if ($2 < 0 || $2 > 9) {
+ serror("bad f/b label");
+ $2 = 0;
+ }
+ newlabel(fb_shift((int)$2));
+ }
+ | program CODE1
+ { emit1((char)$2); LISTLINE(0);}
+ | program CODE2
+ { emit2((short)$2); LISTLINE(0);}
+ | program CODE4
+ { emit4((long)$2); LISTLINE(0);}
+ | program operation ';'
+ | program operation '\n'
+ { lineno++; LISTLINE(1); RELODONE;}
+ | program '#' NUMBER STRING '\n'
+ { lineno++; LISTLINE(1); RELODONE;}
+ | program error '\n'
+ { serror("syntax error"); yyerrok;
+ lineno++; LISTLINE(1); RELODONE;
+ }
+ ;
+#undef LISTLINE
+#undef RELODONE
+operation
+ : /* empty */
+ | IDENT '=' expr
+ {
+#ifdef LISTING
+ if (listflag & 1)
+ listcolm += printx(VALWIDTH, $3.val);
+#endif
+ newequate($1, $3.typ);
+ store($1, $3.val);
+ }
+#ifdef LISTING
+ | LIST
+ { if ($1)
+ listtemp = listmode;
+ else if ((dflag & 01000) == 0)
+ listtemp = 0;
+ }
+#endif
+ | SECTION IDENT
+ { newsect($2);}
+ | COMMON IDENT ',' absexp
+ { newcomm($2, $4);}
+ | BASE absexp
+ { if (pass == PASS_1) newbase($2);}
+ | ASSERT expr
+ { if ($2.val == 0 && pass == PASS_3)
+ warning("assertion failed");
+ }
+ | SYMB STRING ',' expr optabs2 optabs2
+ { if ((sflag & SYM_SMB) && PASS_SYMB) {
+#ifndef ASLD
+ if (
+ pass == PASS_3
+ &&
+ ($4.typ & S_TYP) == S_UND
+ ) {
+ serror("expression undefined");
+ relonami = -1;
+ }
+#endif
+ newsymb(
+ stringbuf+1,
+ (short)(
+ ($4.typ & (S_EXT|S_TYP))
+ |
+ ((ushort)$5<<8)
+ ),
+ (short)$6,
+ $4.val
+ );
+ }
+ }
+ | LINE optabs1
+ { if ((sflag & SYM_LIN) && PASS_SYMB) {
+ if ($2)
+ hllino = (short)$2;
+ else
+ hllino++;
+ newsymb(
+ (char *)0,
+ (short)(DOTTYP | S_LIN),
+ (short)hllino,
+ (valu_t)DOTVAL
+ );
+ }
+ }
+ | FILe STRING
+ { if ((sflag & SYM_LIN) && PASS_SYMB) {
+ hllino = 0;
+ newsymb(
+ stringbuf+1,
+ (short)(DOTTYP | S_FIL),
+ (short)0,
+ (valu_t)DOTVAL
+ );
+ }
+ }
+ | EXTERN externlist
+ | ALIGN optabs1
+ { align($2);}
+ | SPACE absexp
+ { if (DOTSCT == NULL)
+ nosect();
+ DOTVAL += $2;
+ DOTSCT->s_zero += $2;
+ }
+ | DATA datalist
+ | ASCII STRING
+ { emitstr($1);}
+ ;
+externlist
+ : IDENT
+ { $1->i_type |= S_EXT;}
+ | externlist ',' IDENT
+ { $3->i_type |= S_EXT;}
+ ;
+datalist
+ : expr
+ {
+#ifdef RELOCATION
+ if (rflag != 0 && PASS_RELO)
+#ifdef DUK
+#ifdef BYTES_REVERSED
+#ifdef WORDS_REVERSED
+ newrelo($1.typ,
+ (int)$<y_word>0 | RELBR | RELWR
+ );
+#else WORDS_REVERSED
+ newrelo($1.typ, (int)$<y_word>0|RELBR);
+#endif WORDS_REVERSED
+#else BYTES_REVERSED
+#ifdef WORDS_REVERSED
+ newrelo($1.typ, (int)$<y_word>0|RELWR);
+#else WORDS_REVERSED
+ newrelo($1.typ, (int)$<y_word>0);
+#endif WORDS_REVERSED
+#endif BYTES_REVERSED
+#else DUK
+ newrelo($1.typ, (int)$<y_word>0);
+#endif DUK
+#endif
+ emitx($1.val, (int)$<y_word>0);
+ }
+ | datalist ',' expr
+ {
+#ifdef RELOCATION
+ if (rflag != 0 && PASS_RELO)
+#ifdef DUK
+#ifdef BYTES_REVERSED
+#ifdef WORDS_REVERSED
+ newrelo($3.typ,
+ (int)$<y_word>0 | RELBR | RELWR
+ );
+#else WORDS_REVERSED
+ newrelo($3.typ, (int)$<y_word>0|RELBR);
+#endif WORDS_REVERSED
+#else BYTES_REVERSED
+#ifdef WORDS_REVERSED
+ newrelo($3.typ, (int)$<y_word>0|RELWR);
+#else WORDS_REVERSED
+ newrelo($3.typ, (int)$<y_word>0);
+#endif WORDS_REVERSED
+#endif BYTES_REVERSED
+#else DUK
+ newrelo($3.typ, (int)$<y_word>0);
+#endif DUK
+#endif
+ emitx($3.val, (int)$<y_word>0);
+ }
+ ;
+expr : error
+ { serror("expr syntax err");
+ $$.val = 0; $$.typ = S_UND;
+ }
+ | NUMBER
+ { $$.val = $1; $$.typ = S_ABS;}
+ | id_fb
+ { $$.val = load($1);
+ $$.typ = $1->i_type & ~S_EXT;
+ }
+ | STRING
+ { if (stringbuf[0] != 1)
+ serror("too many chars");
+ $$.val = stringbuf[1];
+ $$.typ = S_ABS;
+ }
+ | ASC_LPAR expr ASC_RPAR
+ { $$ = $2;}
+ | expr OP_OO expr
+ { $$.val = ($1.val || $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr OP_AA expr
+ { $$.val = ($1.val && $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr '|' expr
+ { $$.val = ($1.val | $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr '^' expr
+ { $$.val = ($1.val ^ $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr '&' expr
+ { $$.val = ($1.val & $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr OP_EQ expr
+ { $$.val = ($1.val == $3.val);
+ $$.typ = combine($1.typ, $3.typ, '>');
+ }
+ | expr OP_NE expr
+ { $$.val = ($1.val != $3.val);
+ $$.typ = combine($1.typ, $3.typ, '>');
+ }
+ | expr '<' expr
+ { $$.val = ($1.val < $3.val);
+ $$.typ = combine($1.typ, $3.typ, '>');
+ }
+ | expr '>' expr
+ { $$.val = ($1.val > $3.val);
+ $$.typ = combine($1.typ, $3.typ, '>');
+ }
+ | expr OP_LE expr
+ { $$.val = ($1.val <= $3.val);
+ $$.typ = combine($1.typ, $3.typ, '>');
+ }
+ | expr OP_GE expr
+ { $$.val = ($1.val >= $3.val);
+ $$.typ = combine($1.typ, $3.typ, '>');
+ }
+ | expr OP_RR expr
+ { $$.val = ($1.val >> $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr OP_LL expr
+ { $$.val = ($1.val << $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr '+' expr
+ { $$.val = ($1.val + $3.val);
+ $$.typ = combine($1.typ, $3.typ, '+');
+ }
+ | expr '-' expr
+ { $$.val = ($1.val - $3.val);
+ $$.typ = combine($1.typ, $3.typ, '-');
+ }
+ | expr '*' expr
+ { $$.val = ($1.val * $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr '/' expr
+ { if ($3.val == 0) {
+ if (pass == PASS_3)
+ serror("divide by zero");
+ $$.val = 0;
+ } else
+ $$.val = ($1.val / $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | expr '%' expr
+ { if ($3.val == 0) {
+ if (pass == PASS_3)
+ serror("divide by zero");
+ $$.val = 0;
+ } else
+ $$.val = ($1.val % $3.val);
+ $$.typ = combine($1.typ, $3.typ, 0);
+ }
+ | '+' expr %prec '*'
+ { $$.val = $2.val;
+ $$.typ = combine(S_ABS, $2.typ, 0);
+ }
+ | '-' expr %prec '*'
+ { $$.val = -$2.val;
+ $$.typ = combine(S_ABS, $2.typ, 0);
+ }
+ | '~' expr
+ { $$.val = ~$2.val;
+ $$.typ = combine(S_ABS, $2.typ, 0);
+ }
+ | DOT
+ { $$.val = DOTVAL;
+ $$.typ = DOTTYP|S_DOT;
+ }
+ ;
+id_fb : IDENT
+ | FBSYM
+ ;
+absexp : expr
+ { if (($1.typ & ~S_EXT) != S_ABS)
+ serror("must be absolute");
+ $$ = $1.val;
+ }
+ ;
+optabs1
+ : /* empty */
+ { $$ = 0;}
+ | absexp
+ { $$ = $1;}
+ ;
+optabs2
+ : /* empty */
+ { $$ = 0;}
+ | ',' absexp
+ { $$ = $2;}
+ ;
+
+/* ========== Machine dependent rules ========== */
+
+#include "mach4.c"
+
+%%
--- /dev/null
+/* @(#)comm3.c 1.1 */
+/*
+ * storage allocation for variables
+ */
+
+#include "comm0.h"
+
+#define extern /* empty, to force storage allocation */
+
+#include "comm1.h"
+
+struct outhead outhead = {
+ O_MAGIC, O_STAMP, 0
+#ifndef DUK
+#ifdef BYTES_REVERSED
+ | HF_BREV
+#endif
+#ifdef WORDS_REVERSED
+ | HF_WREV
+#endif
+#endif DUK
+};
+
+#include "y.tab.h"
+
+item_t keytab[] = {
+ 0, EXTERN, 0, ".define",
+ 0, EXTERN, 0, ".extern",
+ 0, DOT, 0, ".",
+ 0, DATA, 1, ".data1",
+ 0, DATA, 2, ".data2",
+ 0, DATA, 4, ".data4",
+ 0, ASCII, 0, ".ascii",
+ 0, ASCII, 1, ".asciz",
+ 0, ALIGN, 0, ".align",
+ 0, ASSERT, 0, ".assert",
+ 0, SPACE, 0, ".space",
+ 0, COMMON, 0, ".comm",
+ 0, SECTION, 0, ".sect",
+ 0, BASE, 0, ".base",
+ 0, SYMB, 0, ".symb",
+ 0, LINE, 0, ".line",
+ 0, FILe, 0, ".file",
+#ifdef LISTING
+ 0, LIST, 0, ".nolist",
+ 0, LIST, 1, ".list",
+#endif
+#include "mach3.c"
+ 0, 0, 0, 0
+};
--- /dev/null
+/* @(#)comm4.c 1.6 */
+/*
+ * Micro processor assembler framework written by
+ * Johan Stevenson, Vrije Universiteit, Amsterdam
+ * modified by
+ * Johan Stevenson, Han Schaminee and Hans de Vries
+ * Philips S&I, T&M, PMDS, Eindhoven
+ */
+
+#include "comm0.h"
+#include "comm1.h"
+#include "y.tab.h"
+
+extern YYSTYPE yylval;
+
+/* ========== Machine independent C routines ========== */
+
+stop() {
+#if DEBUG < 2
+ unlink(temppath);
+#ifdef LISTING
+ unlink(listpath);
+#endif
+#endif
+ exit(nerrors != 0);
+}
+
+main(argc, argv)
+char **argv;
+{
+ register char *p;
+ register i;
+ static char sigs[] = {
+ SIGHUP, SIGINT, SIGQUIT, SIGTERM, 0
+ };
+
+ /* this test should be performed by the
+ * preprocessor, but it cannot
+ */
+ if ((S_ETC|S_COM|S_VAR|S_DOT) != S_ETC)
+ fatal("incorrect type bits");
+
+ progname = *argv++; argc--;
+ for (p = sigs; i = *p++; )
+ if (signal(i, SIG_IGN) != SIG_IGN)
+ signal(i, stop);
+ for (i = 0; i < argc; i++) {
+ p = argv[i];
+ if (*p++ != '-')
+ continue;
+ switch (*p++) {
+ case 'o':
+ if (*p != NULL) {
+ aoutpath = p;
+ break;
+ }
+ argv[i] = 0;
+ if (++i >= argc)
+ fatal("-o needs filename");
+ aoutpath = argv[i];
+ break;
+ case 'd':
+#ifdef LISTING
+ dflag = 0;
+ while (*p >= '0' && *p <= '7')
+ dflag = (dflag << 3) + *p++ - '0';
+ if ((dflag & 0777) == 0)
+ dflag |= 0700;
+ dflag &= ~4;
+#endif
+ break;
+ case 's':
+ sflag = 0;
+ while (*p >= '0' && *p <= '7')
+ sflag = (sflag << 3) + *p++ - '0';
+ break;
+ case 'r':
+#ifdef RELOCATION
+#ifdef ASLD
+ rflag = 1;
+#endif ASLD
+#endif RELOCATION
+ break;
+ case 'b':
+#ifdef THREE_PASS
+ bflag = 1;
+#endif
+ break;
+#ifndef ASLD
+ case 'u':
+ case '\0':
+ uflag = 1;
+ break;
+#endif
+ default:
+ continue;
+ }
+ argv[i] = 0;
+ }
+#ifdef RELOCATION
+ if (rflag)
+ sflag |= SYM_SCT;
+#endif RELOCATION
+ pass_1(argc, argv);
+#ifdef THREE_PASS
+ pass_23(PASS_2);
+#endif
+ pass_23(PASS_3);
+ stop();
+}
+
+/* ---------- pass 1: arguments, modules, archives ---------- */
+
+pass_1(argc, argv)
+char **argv;
+{
+ register i;
+ register char *p;
+ register item_t *ip;
+#ifdef ASLD
+ char armagic[SZMAGIC];
+#else
+ register nfile = 0;
+#endif
+
+ tempfile = fftemp(temppath, "asTXXXXXX");
+#ifdef LISTING
+ listmode = dflag;
+ if (listmode & 0440)
+ listfile = fftemp(listpath, "asLXXXXXX");
+#endif
+ for (ip = keytab; ip->i_type; ip++)
+ item_insert(ip, H_KEY+hash(ip->i_name));
+ machstart(PASS_1);
+ while (--argc >= 0) {
+ p = *argv++;
+ if (p == 0)
+ continue;
+#ifdef ASLD
+ if (p[0] == '-' && p[1] == '\0') {
+ input = stdin;
+ parse("STDIN");
+ continue;
+ }
+#else
+ if (nfile != 0)
+ fatal("second source file %s", p);
+ nfile++;
+#endif
+ if ((input = fopen(p, "r")) == NULL)
+ fatal("can't open %s", p);
+#ifdef ASLD
+ if (
+ fread(armagic, SZMAGIC, 1, input) == 1
+ &&
+ strncmp(armagic, ARMAGIC, SZMAGIC) == 0
+ ) {
+ archive();
+ fclose(input);
+ continue;
+ }
+ rewind(input);
+#endif
+ parse(p);
+ fclose(input);
+ }
+ commfinish();
+ machfinish(PASS_1);
+#ifdef ASLD
+ if (unresolved) {
+ nerrors++;
+ fflush(stdout);
+ fprintf(stderr, "unresolved references:\n");
+ for (i = 0; i < H_SIZE; i++) {
+ ip = hashtab[H_GLOBAL+i];
+ while (ip != 0) {
+ if ((ip->i_type & (S_EXT|S_TYP)) == (S_EXT|S_UND))
+ fprintf(stderr, "\t%s\n", ip->i_name);
+ ip = ip->i_next;
+ }
+ }
+ }
+#else
+ if (unresolved)
+ outhead.oh_flags |= HF_LINK;
+ if (nfile == 0)
+ fatal("no source file");
+#endif
+}
+
+#ifdef ASLD
+archive()
+{
+ register long offset;
+ register i;
+ register long modsize;
+ char modhead[SZMHEAD];
+
+ archmode++;
+ offset = SZMAGIC;
+ for (;;) {
+ if (unresolved == 0)
+ break;
+ fseek(input, offset, 0);
+ if (fread(modhead, SZMHEAD, 1, input) != 1)
+ break;
+ if (
+ strncmp(&modhead[OFF_BEG], STR_BEG, LEN_BEG)
+ ||
+ strncmp(&modhead[OFF_END], STR_END, LEN_END)
+ )
+ fatal("bad archive");
+ offset += SZMHEAD;
+ modsize = atol(&modhead[OFF_SIZ]);
+ archsize = modsize;
+ if (needed()) {
+ fseek(input, offset, 0);
+ archsize = modsize;
+ for (i = 0; i < LEN_NAM; i++)
+ if (modhead[OFF_NAM+i] == ' ')
+ break;
+ modhead[OFF_NAM+i] = '\0';
+ parse(remember(&modhead[OFF_NAM]));
+ }
+ offset += modsize;
+ }
+ archmode = 0;
+}
+
+needed()
+{
+ register c, first;
+ register item_t *ip;
+ register need;
+
+#ifdef LISTING
+ register save;
+
+ save = listflag; listflag = 0;
+#endif
+ need = 0;
+ peekc = -1;
+ first = 1;
+ for (;;) {
+ c = nextchar();
+ if (c == '\n') {
+ first = 1;
+ continue;
+ }
+ if (c == ' ' || c == '\t' || c == ',')
+ continue;
+ if (ISALPHA(c) == 0)
+ break;
+ if ((ip = item_search(readident(c))) == 0) {
+ if (first)
+ break;
+ continue;
+ }
+ if (first) {
+ if (ip != &keytab[KEYDEFINE])
+ break;
+ first = 0;
+ }
+ if ((ip->i_type & S_TYP) == S_UND) {
+ need++;
+ break;
+ }
+ }
+#ifdef LISTING
+ listflag = save;
+#endif
+ return(need);
+}
+#endif ASLD
+
+parse(s)
+char *s;
+{
+ register i;
+ register item_t *ip;
+ register char *p;
+
+ for (p = s; *p; )
+ if (*p++ == '/')
+ s = p;
+#ifdef ASLD
+ yylval.y_strp = s;
+ putval(MODULE);
+#endif
+ for (i = 0; i < FB_SIZE; i++)
+ fb_ptr[FB_BACK+i] = 0;
+ newmodule(s);
+ peekc = -1;
+ yyparse();
+ /*
+ * Check for undefined symbols
+ */
+#ifdef ASLD
+ for (i = 0; i < H_SIZE; i++) {
+ while (ip = hashtab[H_LOCAL+i]) {
+ /*
+ * cleanup local queue
+ */
+ hashtab[H_LOCAL+i] = ip->i_next;
+ /*
+ * make undefined references extern
+ */
+ if ((ip->i_type & (S_VAR|S_TYP)) == S_UND)
+ ip->i_type |= S_EXT;
+ /*
+ * relink externals in global queue
+ */
+ if (ip->i_type & S_EXT)
+ item_insert(ip, H_GLOBAL+i);
+ }
+ }
+#else
+ for (i = 0; i < H_SIZE; i++) {
+ for (ip = hashtab[H_LOCAL+i]; ip; ip = ip->i_next) {
+ if (ip->i_type & S_EXT)
+ continue;
+ if (ip->i_type != S_UND)
+ continue;
+ if (uflag == 0)
+ serror("undefined symbol %s", ip->i_name);
+ ip->i_type |= S_EXT;
+ }
+ }
+#endif
+ /*
+ * Check for undefined numeric labels
+ */
+ for (i = 0; i < FB_SIZE; i++) {
+ if ((ip = fb_ptr[FB_FORW+i]) == 0)
+ continue;
+ serror("undefined label %d", i);
+ fb_ptr[FB_FORW+i] = 0;
+ }
+}
+
+pass_23(n)
+{
+ register i;
+#ifdef ASLD
+ register addr_t base = 0;
+#endif
+ register sect_t *sp;
+
+ if (nerrors)
+ stop();
+ pass = n;
+#ifdef LISTING
+ listmode >>= 3;
+ if (listmode & 4)
+ ffreopen(listpath, listfile);
+ listeoln = 1;
+#endif
+#ifdef THREE_PASS
+ nbits = 0;
+#endif
+ for (i = 0; i < FB_SIZE; i++)
+ fb_ptr[FB_FORW+i] = fb_ptr[FB_HEAD+i];
+ outhead.oh_nemit = 0;
+ for (sp = sect; sp < §[outhead.oh_nsect]; sp++) {
+#ifdef ASLD
+ if (sp->s_flag & BASED) {
+ base = sp->s_base;
+ if (base % sp->s_lign)
+ fatal("base not aligned");
+ } else {
+ base += (sp->s_lign - 1);
+ base -= (base % sp->s_lign);
+ sp->s_base = base;
+ }
+ base += sp->s_size;
+ base += sp->s_comm;
+#endif
+ outhead.oh_nemit += sp->s_size - sp->s_zero;
+ }
+ if (pass == PASS_3)
+ setupoutput();
+ for (sp = sect; sp < §[outhead.oh_nsect]; sp++) {
+ sp->s_size = 0;
+ sp->s_zero = 0;
+#ifdef THREE_PASS
+ sp->s_gain = 0;
+#endif
+ }
+ machstart(n);
+#ifndef ASLD
+ newmodule(modulename);
+#endif ASLD
+ ffreopen(temppath, tempfile);
+ yyparse();
+ commfinish();
+ machfinish(n);
+}
+
+newmodule(s)
+char *s;
+{
+ switchsect(S_UND);
+ modulename = s;
+ lineno = 1;
+ if ((sflag & (SYM_EXT|SYM_LOC|SYM_LAB)) && PASS_SYMB)
+ newsymb(s, S_MOD, (short)0, (valu_t)0);
+#ifdef LISTING
+ listtemp = 0;
+ if (dflag & 01000)
+ listtemp = listmode;
+ listflag = listtemp;
+#endif
+}
+
+setupoutput()
+{
+ register sect_t *sp;
+ register long off;
+ struct outsect outsect;
+
+#ifdef AOUTSEEK
+#define AOUTseek(p,o) {aoutseek[p]=o;}
+ aoutfile = ffcreat(aoutpath);
+#else
+#define AOUTseek(p,o) {fseek(aoutfile[p],o,0);}
+ aoutfile[PARTEMIT]=ffcreat(aoutpath);
+#ifdef RELOCATION
+ aoutfile[PARTRELO]=ffcreat(aoutpath);
+#endif
+ aoutfile[PARTNAME]=ffcreat(aoutpath);
+ aoutfile[PARTCHAR]=ffcreat(aoutpath);
+#endif
+ /*
+ * header generation
+ */
+ AOUTseek(PARTEMIT, 0);
+ putofmt((char *)&outhead, SF_HEAD, PARTEMIT);
+ /*
+ * section table generation
+ */
+ off = SZ_HEAD;
+ off += (long)outhead.oh_nsect * SZ_SECT;
+ for (sp = sect; sp < §[outhead.oh_nsect]; sp++) {
+ sp->s_foff = off;
+ outsect.os_base = SETBASE(sp);
+ outsect.os_size = sp->s_size + sp->s_comm;
+ outsect.os_foff = sp->s_foff;
+ outsect.os_flen = sp->s_size - sp->s_zero;
+ outsect.os_lign = sp->s_lign;
+ off += outsect.os_flen;
+ putofmt((char *)&outsect, SF_SECT, PARTEMIT);
+ }
+#ifdef RELOCATION
+ AOUTseek(PARTRELO, off);
+ off += (long)outhead.oh_nrelo * SZ_RELO;
+#endif
+ if (sflag == 0)
+ return;
+ AOUTseek(PARTNAME, off);
+ off += (long)outhead.oh_nname * SZ_NAME;
+ AOUTseek(PARTCHAR, off);
+ outhead.oh_nchar = off; /* see newsymb() */
+#undef AOUTseek
+}
+
+commfinish()
+{
+ register i;
+ register item_t *ip;
+ register sect_t *sp;
+ register valu_t addr;
+
+ switchsect(S_UND);
+#ifdef ASLD
+ /*
+ * assign .comm labels and produce .comm symbol table entries
+ */
+ for (i = 0; i<H_SIZE; i++)
+ for (ip = hashtab[H_GLOBAL+i]; ip; ip = ip->i_next) {
+ if ((ip->i_type & S_COM) == 0)
+ continue;
+ sp = §[(ip->i_type & S_TYP) - S_MIN];
+ if (pass == PASS_1) {
+ addr = sp->s_size + sp->s_comm;
+ sp->s_comm += ip->i_valu;
+ ip->i_valu = addr;
+ }
+#ifdef THREE_PASS
+ if (pass == PASS_2)
+ ip->i_valu -= sp->s_gain;
+#endif
+ if ((sflag & SYM_EXT) && PASS_SYMB)
+ newsymb(
+ ip->i_name,
+ ip->i_type & (S_EXT|S_TYP),
+ (short)0,
+ load(ip)
+ );
+ }
+#endif
+ if (PASS_SYMB == 0)
+ return;
+#ifndef ASLD
+ /*
+ * produce symbol table entries for undefined's
+ */
+ for (i = 0; i<H_SIZE; i++)
+ for (ip = hashtab[H_LOCAL+i]; ip; ip = ip->i_next) {
+ if (ip->i_type != (S_EXT|S_UND))
+ continue;
+ if (pass != PASS_3)
+ /*
+ * save symbol table index
+ * for possible relocation
+ */
+ ip->i_valu = outhead.oh_nname;
+ if (sflag & SYM_SCT)
+ newsymb(
+ ip->i_name,
+ S_EXT|S_UND,
+ (short)0,
+ (valu_t)0
+ );
+ }
+#endif ASLD
+ /*
+ * produce symbol table entries for sections
+ */
+ if (sflag & SYM_SCT)
+ for (sp = sect; sp < §[outhead.oh_nsect]; sp++) {
+ ip = sp->s_item;
+ newsymb(
+ ip->i_name,
+ (short)(ip->i_type | S_SCT),
+ (short)0,
+ load(ip)
+ );
+ }
+}
--- /dev/null
+/* @(#)comm5.c 1.1 */
+
+#include "comm0.h"
+#include "comm1.h"
+#include "y.tab.h"
+
+extern YYSTYPE yylval;
+
+yylex()
+{
+ register c;
+
+ if (pass == PASS_1) {
+ /* scan the input file */
+ do
+ c = nextchar();
+ while (isspace(c) && c != '\n');
+ if (ISALPHA(c))
+ c = inident(c);
+ else if (isdigit(c))
+ c = innumber(c);
+ else switch (c) {
+ case '=':
+ case '<':
+ case '>':
+ case '|':
+ case '&':
+ c = induo(c); break;
+ case ASC_SQUO:
+ case ASC_DQUO:
+ c = instring(c); break;
+ case ASC_COMM:
+ do
+ c = nextchar();
+ while (c != '\n' && c != '\0');
+ break;
+ case CTRL('A'):
+ c = CODE1; readcode(1); break;
+ case CTRL('B'):
+ c = CODE2; readcode(2); break;
+ case CTRL('C'):
+ c = CODE4; readcode(4); break;
+ }
+
+ /* produce the intermediate token file */
+ if (c <= 0)
+ return(0);
+ if (c <= 127)
+ putc(c, tempfile);
+ else
+ putval(c);
+ } else {
+ /* read from intermediate token file */
+ c = getc(tempfile);
+ if (c == EOF)
+ return(0);
+ if (c > 127) {
+ c += 128;
+ c = getval(c);
+ }
+ }
+ return(c);
+}
+
+putval(c)
+{
+ register valu_t v;
+ register n;
+ register char *p;
+
+ assert(c >= 256 && c < 256+128);
+ switch (c) {
+ case CODE1:
+ n = 1; goto putnum;
+ case CODE2:
+ n = 2; goto putnum;
+ case CODE4:
+ n = 4; goto putnum;
+ case NUMBER:
+ v = yylval.y_valu;
+ for (n = 0; n < sizeof(v); n++) {
+ if (v == 0)
+ break;
+ v >>= 8;
+ }
+ c = NUMBER0 + n;
+ putnum:
+ putc(c-128, tempfile);
+ v = yylval.y_valu;
+ while (--n >= 0)
+ putc(v >> (n*8), tempfile);
+ return;
+ case IDENT:
+ case FBSYM:
+ n = sizeof(item_t *);
+ p = (char *) &yylval.y_item; break;
+#ifdef ASLD
+ case MODULE:
+ n = sizeof(char *);
+ p = (char *) &yylval.y_strp; break;
+#endif
+ case STRING:
+ p = stringbuf;
+ n = (*p & 0377) + 1; break;
+ case OP_EQ:
+ case OP_NE:
+ case OP_LE:
+ case OP_GE:
+ case OP_LL:
+ case OP_RR:
+ case OP_OO:
+ case OP_AA:
+ n = 0; break;
+ default:
+ n = sizeof(word_t);
+ p = (char *) &yylval.y_word; break;
+ }
+ putc(c-128, tempfile);
+ while (--n >= 0)
+ putc(*p++, tempfile);
+}
+
+getval(c)
+{
+ register n;
+ register valu_t v;
+ register char *p;
+
+ switch (c) {
+ case CODE1:
+ n = 1; goto getnum;
+ case CODE2:
+ n = 2; goto getnum;
+ case CODE4:
+ n = 4; goto getnum;
+ case NUMBER0:
+ n = 0; c = NUMBER; goto getnum;
+ case NUMBER1:
+ n = 1; c = NUMBER; goto getnum;
+ case NUMBER2:
+ n = 2; c = NUMBER; goto getnum;
+ case NUMBER3:
+ n = 3; c = NUMBER; goto getnum;
+ case NUMBER:
+ n = 4;
+ getnum:
+ v = 0;
+ while (--n >= 0) {
+ v <<= 8;
+ v |= getc(tempfile);
+ }
+ yylval.y_valu = v;
+ return(c);
+ case IDENT:
+ case FBSYM:
+ n = sizeof(item_t *);
+ p = (char *) &yylval.y_item; break;
+#ifdef ASLD
+ case MODULE:
+ n = sizeof(char *);
+ p = (char *) &yylval.y_strp; break;
+#endif
+ case STRING:
+ p = stringbuf;
+#ifdef DUK
+ *p++ = n = getc(tempfile);
+ p[n] = '\0';
+ break;
+#else DUK
+ *p++ = n = getc(tempfile); break;
+#endif DUK
+ case OP_EQ:
+ case OP_NE:
+ case OP_LE:
+ case OP_GE:
+ case OP_LL:
+ case OP_RR:
+ case OP_OO:
+ case OP_AA:
+ n = 0; break;
+ default:
+ n = sizeof(word_t);
+ p = (char *) &yylval.y_word; break;
+ }
+ while (--n >= 0)
+ *p++ = getc(tempfile);
+ return(c);
+}
+
+/* ---------- lexical scan in pass 1 ---------- */
+
+nextchar()
+{
+ register c;
+
+ if (peekc != -1) {
+ c = peekc;
+ peekc = -1;
+ return(c);
+ }
+#ifdef ASLD
+ if (archmode && --archsize < 0)
+ return(0);
+#endif
+ if ((c = getc(input)) == EOF)
+ return(0);
+ if (isascii(c) == 0)
+ fatal("non-ascii character");
+#ifdef LISTING
+ if (listflag & 0440)
+ putc(c, listfile);
+#endif
+ return(c);
+}
+
+readcode(n)
+{
+ register c;
+
+ yylval.y_valu = 0;
+ do {
+ if (
+#ifdef ASLD
+ (archmode && --archsize < 0)
+ ||
+#endif
+ (c = getc(input)) == EOF
+ )
+ fatal("unexpected EOF in compact input");
+ yylval.y_valu <<= 8;
+ yylval.y_valu |= c;
+ } while (--n);
+}
+
+induo(c)
+register c;
+{
+ static short duo[] = {
+ ('='<<8) | '=', OP_EQ,
+ ('<'<<8) | '>', OP_NE,
+ ('<'<<8) | '=', OP_LE,
+ ('>'<<8) | '=', OP_GE,
+ ('<'<<8) | '<', OP_LL,
+ ('>'<<8) | '>', OP_RR,
+ ('|'<<8) | '|', OP_OO,
+ ('&'<<8) | '&', OP_AA,
+ };
+ register short *p;
+
+ c = (c<<8) | nextchar();
+ for (p = duo; *p; p++)
+ if (*p++ == c)
+ return(*p++);
+ peekc = c & 0377;
+ return(c>>8);
+}
+
+inident(c)
+char c;
+{
+ register char *p;
+ register item_t *ip;
+
+ p = readident(c);
+ ip = item_search(p);
+ if (ip == 0) {
+ ip = item_alloc(S_UND);
+ ip->i_name = remember(p);
+ /* printf("ident %s %o\n", ip->i_name, ip); */
+ unresolved++;
+ item_insert(ip, H_LOCAL + (hashindex%H_SIZE));
+ } else if (hashindex < H_SIZE) {
+ assert(H_KEY == 0);
+ yylval.y_word = (word_t) ip->i_valu;
+ return(ip->i_type);
+ }
+ yylval.y_item = ip;
+ return(IDENT);
+}
+
+char *
+readident(c)
+register c;
+{
+ static char name[NAMEMAX+1];
+ register n = NAMEMAX;
+ register char *p = name;
+
+ do {
+ if (--n >= 0)
+ *p++ = c;
+ c = nextchar();
+ } while (ISALNUM(c));
+ *p++ = '\0';
+ peekc = c;
+ return(name);
+}
+
+innumber(c)
+register c;
+{
+ register char *p;
+ register radix;
+ static char num[20+1];
+
+ p = num;
+ radix = 20;
+ do {
+ if (--radix < 0)
+ fatal("number too long");
+ if (isupper(c))
+ c += ('a' - 'A');
+ *p++ = c;
+ c = nextchar();
+ } while (ISALNUM(c));
+ peekc = c;
+ *p = '\0';
+ c = *--p;
+ p = num;
+ radix = 10;
+ if (*p == '0') {
+ radix = 8;
+ p++;
+ if (*p == 'x') {
+ radix = 16;
+ p++;
+ } else if (*p == 'b') {
+ radix = 2;
+ p++;
+ }
+ }
+ if (radix != 16 && (c == 'f' || c == 'b'))
+ return(infbsym(num));
+ yylval.y_valu = 0;
+ while (c = *p++) {
+ if (c > '9')
+ c -= ('a' - '9' - 1);
+ c -= '0';
+ if (c >= radix)
+ serror("digit exceeds radix");
+ yylval.y_valu = yylval.y_valu * radix + c;
+ }
+ return(NUMBER);
+}
+
+instring(termc)
+{
+ register char *p;
+ register c;
+
+ p = stringbuf+1;
+ for (;;) {
+ c = nextchar();
+ if (c == '\n' || c == '\0') {
+ peekc = c;
+ serror("non-terminated string");
+ break;
+ }
+ if (c == termc)
+ break;
+ if (c == '\\')
+ c = inescape();
+#ifdef DUK
+ if (p >= &stringbuf[STRINGMAX - 1])
+#else DUK
+ if (p >= &stringbuf[STRINGMAX])
+#endif DUK
+ fatal("string buffer overflow");
+ *p++ = c;
+ }
+ stringbuf[0] = p - stringbuf - 1;
+#ifdef DUK
+ *p = '\0';
+#endif DUK
+ return(STRING);
+}
+
+inescape()
+{
+ register c, j, r;
+
+ c = nextchar();
+ if (c >= '0' && c <= '7') {
+ r = c - '0';
+ for (j = 0; j < 2; j++) {
+ c = nextchar();
+ if (c < '0' || c > '7') {
+ peekc = c;
+ return(r);
+ }
+ r <<= 3;
+ r += (c - '0');
+ }
+ return(r);
+ }
+ switch (c) {
+ case 'b': return('\b');
+ case 'f': return('\f');
+ case 'n': return('\n');
+ case 'r': return('\r');
+ case 't': return('\t');
+ case '\'': return('\'');
+ case '"': return('"');
+ }
+ return(c);
+}
+
+infbsym(p)
+register char *p;
+{
+ register lab;
+ register item_t *ip;
+
+ lab = *p++ - '0';
+ if ((unsigned)lab < 10) {
+ if (*p++ == 'f') {
+ ip = fb_ptr[FB_FORW+lab];
+ if (ip == 0) {
+ ip = fb_alloc(lab);
+ fb_ptr[FB_FORW+lab] = ip;
+ }
+ goto ok;
+ }
+ ip = fb_ptr[FB_BACK+lab];
+ if (ip != 0 && *p == 0)
+ goto ok;
+ }
+ serror("bad numeric label");
+ ip = fb_alloc(0);
+ok:
+ yylval.y_item = ip;
+ return(FBSYM);
+}
+
+hash(p)
+register char *p;
+{
+ register unsigned h;
+ register c;
+
+ h = 0;
+ while (c = *p++) {
+ h <<= 2;
+ h += c;
+ }
+ return(h % H_SIZE);
+}
+
+item_t *
+item_search(p)
+register char *p;
+{
+ register h;
+ register item_t *ip;
+
+ for (h = hash(p); h < H_TOTAL; h += H_SIZE) {
+ ip = hashtab[h];
+ while (ip != 0) {
+ if (strcmp(p, ip->i_name) == 0)
+ goto done;
+ ip = ip->i_next;
+ }
+ }
+done:
+ hashindex = h;
+ return(ip);
+}
+
+item_insert(ip, h)
+item_t *ip;
+{
+ ip->i_next = hashtab[h];
+ hashtab[h] = ip;
+}
+
+item_t *
+item_alloc(typ)
+{
+ register item_t *ip;
+ static nleft = 0;
+ static item_t *next;
+
+ if (--nleft < 0) {
+ next = (item_t *) sbrk(MEMINCR);
+ if ((int) next == -1)
+ fatal("out of memory");
+ nleft += (MEMINCR / sizeof(item_t));
+ }
+ ip = next++;
+ ip->i_next = 0;
+ ip->i_type = typ;
+ ip->i_name = 0;
+ ip->i_valu = 0;
+ return(ip);
+}
+
+item_t *
+fb_alloc(lab)
+register lab;
+{
+ register item_t *ip, *p;
+
+ ip = item_alloc(S_UND);
+ p = fb_ptr[FB_TAIL+lab];
+ if (p == 0)
+ fb_ptr[FB_HEAD+lab] = ip;
+ else
+ p->i_next = ip;
+ fb_ptr[FB_TAIL+lab] = ip;
+ return(ip);
+}
+
+item_t *
+fb_shift(lab)
+register lab;
+{
+ register item_t *ip;
+
+ ip = fb_ptr[FB_FORW+lab];
+ if (ip == 0)
+ if (pass == PASS_1)
+ ip = fb_alloc(lab);
+ else
+ ip = fb_ptr[FB_HEAD+lab];
+ fb_ptr[FB_BACK+lab] = ip;
+ fb_ptr[FB_FORW+lab] = ip->i_next;
+ return(ip);
+}
--- /dev/null
+/* @(#)comm6.c 1.7 */
+/*
+ * implement pseudo instructions
+ */
+
+#include "comm0.h"
+#include "comm1.h"
+#include "y.tab.h"
+
+newequate(ip, typ)
+register item_t *ip;
+register short typ;
+{
+ typ &= ~S_EXT;
+ if (typ & S_COM)
+ typ = S_UND;
+ else if ((typ & S_VAR) && (typ & S_TYP) != S_ABS)
+ typ = S_UND;
+#ifdef THREE_PASS
+ else if (pass == PASS_1 && typ == S_UND)
+ typ = S_VAR;
+ else if (pass == PASS_2 && (ip->i_type & S_TYP) == S_UND)
+ ip->i_type |= typ;
+#endif THREE_PASS
+ if (typ == S_UND)
+ serror("illegal equate");
+ if (pass == PASS_3)
+ assert((ip->i_type & S_TYP) == (typ & S_TYP));
+ newident(ip, typ);
+}
+
+newident(ip, typ)
+register item_t *ip;
+{
+ register flag;
+#ifdef GENLAB
+ static char genlab[] = GENLAB;
+#endif GENLAB
+
+ if (pass == PASS_1) {
+ /* printf("declare %s: %o\n", ip->i_name, typ); */
+ if (ip->i_type & ~S_EXT)
+ serror("multiple declared");
+ else
+ --unresolved;
+ ip->i_type |= typ;
+ }
+ if (PASS_SYMB == 0)
+ return;
+#ifdef THREE_PASS
+ if (ip->i_type & S_EXT)
+ flag = SYM_EXT;
+ else
+ flag = SYM_LOC;
+#else
+ flag = SYM_EXT|SYM_LOC; /* S_EXT not stable in PASS_1 */
+#endif THREE_PASS
+#ifdef GENLAB
+ if (strncmp(ip->i_name, genlab, sizeof(genlab)-1) == 0)
+ flag = SYM_LAB;
+#endif GENLAB
+ if (sflag & flag)
+ newsymb(
+ ip->i_name,
+ ip->i_type & (S_EXT|S_TYP),
+ (short)0,
+ load(ip)
+ );
+}
+
+newlabel(ip)
+register item_t *ip;
+{
+#ifdef THREE_PASS
+ register addr_t oldval = ip->i_valu;
+#endif
+
+ if (DOTSCT == NULL)
+ nosect();
+ ip->i_type &= ~S_TYP;
+ ip->i_type |= DOTTYP;
+ if (store(ip, (valu_t) DOTVAL) == 0)
+ return;
+#ifdef THREE_PASS
+ assert(pass != PASS_2 || oldval - ip->i_valu == DOTGAIN);
+#endif
+}
+
+newsect(ip)
+register item_t *ip;
+{
+ register ushort typ;
+ register sect_t *sp = NULL;
+
+ typ = ip->i_type & S_TYP;
+ if (typ == S_UND) {
+ /*
+ * new section
+ */
+ assert(pass == PASS_1);
+ --unresolved;
+ typ = outhead.oh_nsect + S_MIN;
+ outhead.oh_nsect++;
+ if (outhead.oh_nsect > SECTMAX || typ > S_MAX)
+ fatal("too many sections");
+ sp = §[typ - S_MIN];
+ sp->s_item = ip;
+ sp->s_lign = ALIGNSECT;
+#ifdef DUK
+ ip->i_type = typ;
+#else DUK
+ ip->i_type = typ | S_EXT;
+#endif DUK
+ ip->i_valu = 0;
+ } else if (typ >= S_MIN) {
+ sp = §[typ - S_MIN];
+ if (sp->s_item != ip)
+ sp = NULL;
+ }
+ if (sp == NULL)
+ serror("multiple declared");
+ else
+ switchsect(typ);
+}
+
+newbase(base)
+valu_t base;
+{
+#ifdef ASLD
+ register sect_t *sp;
+
+ if ((sp = DOTSCT) == NULL)
+ nosect();
+ if (sp->s_flag & BASED)
+ serror("already based");
+ sp->s_base = base;
+ sp->s_flag |= BASED;
+ DOTVAL += base;
+#else
+ warning(".base ignored");
+#endif
+}
+
+/*
+ * NOTE: A rather different solution is used for ASLD and NOLD:
+ * ASLD:
+ * - maximum length of .comm is recorded in i_valu during PASS_1
+ * - address of .comm is recorded in i_valu in later passes:
+ * assigned at end of PASS_1, corrected for s_gain at end of PASS_2
+ * - symbol table entries are produced in commfinish()
+ * NOLD:
+ * - i_valu cannot be used since it is needed for relocation info
+ * - only one .comm with a particular symbol is allowed per module
+ * - symbol table entries are produced in newcomm()
+ */
+newcomm(ip, val)
+register item_t *ip;
+valu_t val;
+{
+ if (pass == PASS_1) {
+ if (DOTSCT == NULL)
+ nosect();
+ if (val == 0)
+ serror("bad size");
+ /* printf("declare %s: %o\n", ip->i_name, DOTTYP); */
+ if ((ip->i_type & ~S_EXT) == S_UND) {
+ --unresolved;
+ ip->i_type = S_COM|S_EXT|DOTTYP;
+#ifdef ASLD
+ ip->i_valu = val;
+ } else if (ip->i_type == (S_COM|S_EXT|DOTTYP)) {
+ if (ip->i_valu < val)
+ ip->i_valu = val;
+#endif
+ } else
+ serror("multiple declared");
+ }
+#ifndef ASLD
+ if (PASS_SYMB == 0)
+ return;
+ if (pass != PASS_3)
+ /*
+ * save symbol table index
+ * for possible relocation
+ */
+ ip->i_valu = outhead.oh_nname;
+#ifdef DUK
+ newsymb(ip->i_name, S_COM|S_EXT|DOTTYP, (short)0, val);
+#else DUK
+ newsymb(ip->i_name, S_EXT|DOTTYP, (short)0, val);
+#endif DUK
+#endif
+}
+
+switchsect(newtyp)
+short newtyp;
+{
+ register sect_t *sp;
+
+ if (sp = DOTSCT)
+ sp->s_size = DOTVAL - sp->s_base;
+ if (newtyp == S_UND) {
+ DOTSCT = NULL;
+ DOTTYP = newtyp;
+ return;
+ }
+ assert(newtyp >= S_MIN);
+ sp = §[newtyp - S_MIN];
+ if (pass == PASS_3) {
+#ifdef AOUTSEEK
+ aoutpart = -1;
+ aoutseek[PARTEMIT] = sp->s_foff + sp->s_size - sp->s_zero;
+#else
+ fseek(aoutfile[PARTEMIT], sp->s_foff + sp->s_size - sp->s_zero, 0);
+#endif
+ }
+ DOTVAL = sp->s_size + sp->s_base;
+ DOTSCT = sp;
+ DOTTYP = newtyp;
+}
+
+align(bytes)
+valu_t bytes;
+{
+ register valu_t gap;
+ register sect_t *sp;
+
+ if ((sp = DOTSCT) == NULL)
+ nosect();
+ if (bytes == 0)
+ bytes = ALIGNWORD;
+ if (sp->s_lign % bytes)
+ if (bytes % sp->s_lign)
+ serror("illegal alignment");
+ else
+ sp->s_lign = bytes;
+ if (pass == PASS_1)
+ /*
+ * be pessimistic: biggest gap possible
+ */
+ gap = bytes - 1;
+ else {
+ /*
+ * calculate gap correctly;
+ * will be the same in PASS_2 and PASS_3
+ */
+ if ((gap = DOTVAL % bytes) != 0)
+ gap = bytes - gap;
+#ifdef THREE_PASS
+ if (pass == PASS_2)
+ /*
+ * keep track of gain with respect to PASS_1
+ */
+ DOTGAIN += (bytes - 1) - gap;
+#endif
+ }
+ DOTVAL += gap;
+ sp->s_zero += gap;
+}
+
+#ifdef RELOCATION
+newrelo(s, n)
+short s;
+{
+ struct outrelo outrelo;
+#ifdef DUK
+ int iscomm;
+#endif DUK
+
+ if (rflag == 0)
+ return;
+ if (PASS_RELO == 0)
+ return;
+ s &= ~S_DOT;
+ assert((s & ~(S_COM|S_VAR|S_TYP)) == 0);
+#ifndef THREE_PASS
+ if (s == S_UND)
+ serror("bad relocation");
+#endif
+ /*
+ * always relocation info if S_VAR to solve problems with:
+ * move b,d0
+ * b=a
+ * a: .data2 0
+ */
+#ifdef DUK
+ iscomm = s & S_COM;
+#endif DUK
+ s &= ~S_COM;
+ if ((n & RELPC) == 0 && s == S_ABS)
+ return;
+ if ((n & RELPC) != 0 && s == DOTTYP)
+ return;
+ if (pass != PASS_3) {
+ outhead.oh_nrelo++;
+ return;
+ }
+ s &= ~S_VAR;
+ outrelo.or_type = (char)n;
+ outrelo.or_sect = (char)DOTTYP;
+#ifndef ASLD
+#ifdef DUK
+ if (s == S_UND || iscomm) {
+#else DUK
+ if (s == S_UND) {
+#endif DUK
+ assert(relonami != 0);
+ outrelo.or_nami = relonami-1;
+ relonami = 0;
+ } else
+#endif
+ if (s < S_MIN) {
+ assert(s == S_ABS);
+ /*
+ * use first non existing entry (argh)
+ */
+ outrelo.or_nami = outhead.oh_nname;
+ } else {
+ /*
+ * section symbols are at the end
+ */
+ outrelo.or_nami = outhead.oh_nname
+ - outhead.oh_nsect
+ + (s - S_MIN)
+ ;
+ }
+ outrelo.or_addr = (long)DOTVAL;
+ putofmt((char *)&outrelo, SF_RELO, PARTRELO);
+}
+#endif
+
+newsymb(name, type, desc, valu)
+register char *name;
+short type;
+short desc;
+valu_t valu;
+{
+ struct outname outname;
+
+ if (name && *name == 0)
+ name = 0;
+ assert(PASS_SYMB);
+ if (pass != PASS_3) {
+ if (name)
+ outhead.oh_nchar += strlen(name)+1;
+ outhead.oh_nname++;
+ return;
+ }
+ if (name) {
+ AOUTPART(PARTCHAR);
+ outname.on_foff = outhead.oh_nchar;
+ do {
+ AOUTPUTC(*name, PARTCHAR);
+ outhead.oh_nchar++;
+ } while (*name++);
+ } else
+ outname.on_foff = 0;
+ outname.on_type = type;
+ outname.on_desc = desc;
+ outname.on_valu = valu & ~((0xFFFFFFFF)<<(8*sizeof(valu_t)));
+ putofmt((char *)&outname, SF_NAME, PARTNAME);
+}
--- /dev/null
+/* @(#)comm7.c 1.10 */
+/*
+ * miscellaneous
+ */
+
+#include "comm0.h"
+#include "comm1.h"
+#include "y.tab.h"
+
+valu_t
+load(ip)
+register item_t *ip;
+{
+#ifdef ASLD
+ register short typ;
+
+ typ = ip->i_type & S_TYP;
+ if ((typ -= S_MIN) < 0) /* S_UND or S_ABS */
+ return(ip->i_valu);
+ return(ip->i_valu + sect[typ].s_base);
+#else
+#ifdef DUK
+ if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) {
+#else DUK
+ if ((ip->i_type & S_TYP) == S_UND) {
+#endif DUK
+ if (pass == PASS_3) {
+ if (relonami != 0)
+ serror("relocation error");
+ relonami = ip->i_valu+1;
+ }
+ return(0);
+ }
+ return(ip->i_valu);
+#endif
+}
+
+store(ip, val)
+register item_t *ip;
+valu_t val;
+{
+#ifdef ASLD
+ register short typ;
+
+ typ = ip->i_type & S_TYP;
+ if ((typ -= S_MIN) >= 0)
+ val -= sect[typ].s_base;
+#else
+ if ((ip->i_type & S_TYP) == S_UND)
+ return(0);
+#endif
+ assert(pass != PASS_3 || (ip->i_type & S_VAR) || ip->i_valu == val);
+ ip->i_valu = val;
+ return(1);
+}
+
+char *
+remember(s)
+register char *s;
+{
+ register char *p;
+ register n;
+ static nleft = 0;
+ static char *next;
+
+ p = s;
+ n = 0;
+ do
+ n++;
+ while (*p++);
+ if ((nleft -= n) < 0) {
+ next = sbrk(MEMINCR);
+ if ((int) next == -1)
+ fatal("out of memory");
+ nleft = (MEMINCR / sizeof(char)) - n;
+ assert(nleft >= 0);
+ }
+ p = next;
+ while (*p++ = *s++)
+ ;
+ s = next;
+ next = p;
+ return(s);
+}
+
+combine(typ1, typ2, op)
+register typ1, typ2;
+{
+ switch (op) {
+ case '+':
+ if (typ1 == S_ABS)
+ return(typ2);
+ if (typ2 == S_ABS)
+ return(typ1);
+ break;
+ case '-':
+ if (typ2 == S_ABS)
+ return(typ1);
+ if ((typ1 & ~S_DOT) == (typ2 & ~S_DOT) && typ1 != S_UND)
+ return(S_ABS|S_VAR);
+ break;
+ case '>':
+ if (typ1 == S_ABS && typ2 == S_ABS)
+ return(S_ABS);
+ if (
+ ((typ1 & ~S_DOT) == (typ2 & ~S_DOT) && typ1 != S_UND)
+ || (typ1 == S_ABS)
+ || (typ2 == S_ABS)
+ )
+ return(S_ABS|S_VAR);
+ break;
+ default:
+ if (typ1 == S_ABS && typ2 == S_ABS)
+ return(S_ABS);
+ break;
+ }
+ if (pass != PASS_1)
+ serror("illegal operator");
+ return(S_UND);
+}
+
+#ifdef LISTING
+printx(ndig, val)
+valu_t val;
+{
+ static char buf[8];
+ register char *p;
+ register c, n;
+
+ p = buf; n = ndig;
+ do {
+ *p++ = (int) val & 017;
+ val >>= 4;
+ } while (--n);
+ do {
+ c = "0123456789ABCDEF"[*--p];
+ putchar(c);
+ } while (p > buf);
+ return(ndig);
+}
+#endif
+
+#ifdef LISTING
+listline(textline)
+{
+ register c;
+
+ if ((listflag & 4) && (c = getc(listfile)) != '\n' && textline) {
+ if (listcolm >= 24)
+ printf(" \\\n\t\t\t");
+ else
+ do {
+ putchar('\t');
+ listcolm += 8;
+ } while (listcolm < 24);
+ do {
+ assert(c != EOF);
+ putchar(c);
+ } while ((c = getc(listfile)) != '\n');
+ }
+ if (listflag & 7)
+ putchar('\n');
+ listeoln = 1;
+ listcolm = 0;
+ listflag = listtemp;
+}
+#endif LISTING
+
+/* ---------- code optimization ---------- */
+
+#ifdef THREE_PASS
+small(fitsmall, gain)
+{
+ register bit;
+ register char *p;
+
+ if (DOTSCT == NULL)
+ nosect();
+ if (bflag)
+ return(0);
+ if ((bit = nbits++) >= BITMAX) {
+ if (bit != BITMAX)
+ nbits--; /* prevent wraparound */
+ else if (pass == PASS_1)
+ warning("bit table overflow");
+ return(0);
+ }
+ p = &bittab[bit>>3];
+ bit = 1 << (bit&7);
+ switch (pass) {
+ case PASS_1:
+ return(0);
+ case PASS_2:
+ if (fitsmall) {
+ DOTGAIN += gain;
+ *p |= bit;
+ }
+ return(fitsmall);
+ case PASS_3:
+ assert(fitsmall || (*p & bit) == 0);
+ return(*p & bit);
+ }
+}
+#endif
+
+/* ---------- output ---------- */
+
+emit1(arg)
+char arg;
+{
+#ifdef LISTING
+ if (listeoln) {
+ if (listflag & 1) {
+ listcolm += printx(VALWIDTH, DOTVAL);
+ listcolm++;
+ putchar(' ');
+ }
+ listeoln = 0;
+ }
+ if (listflag & 2)
+ listcolm += printx(2, (valu_t) arg);
+#endif
+ switch (pass) {
+ case PASS_1:
+ if (DOTSCT == NULL)
+ nosect();
+ /* no break */
+ case PASS_2:
+ DOTSCT->s_zero = 0;
+ break;
+ case PASS_3:
+ AOUTPART(PARTEMIT);
+ while (DOTSCT->s_zero) {
+ AOUTPUTC(0, PARTEMIT);
+ DOTSCT->s_zero--;
+ }
+ AOUTPUTC(arg, PARTEMIT);
+ break;
+ }
+ DOTVAL++;
+}
+
+emit2(arg)
+short arg;
+{
+#ifdef BYTES_REVERSED
+ emit1((char)(arg>>8)); emit1((char)arg);
+#else
+ emit1((char)arg); emit1((char)(arg>>8));
+#endif
+}
+
+emit4(arg)
+long arg;
+{
+#ifdef WORDS_REVERSED
+ emit2((short)(arg>>16)); emit2((short)(arg));
+#else
+ emit2((short)(arg)); emit2((short)(arg>>16));
+#endif
+}
+
+emitx(val, n)
+valu_t val;
+register n;
+{
+ switch (n) {
+ case 1:
+ emit1((char)val); break;
+ case 2:
+ emit2((short)val); break;
+ case 4:
+ emit4((long)val); break;
+ default:
+ assert(0);
+ }
+}
+
+emitstr(zero)
+{
+ register i;
+ register char *p;
+
+ p = stringbuf;
+ i = *p++ & 0377;
+ while (--i >= 0)
+ emit1(*p++);
+ if (zero)
+ emit1(0);
+}
+
+/* ---------- Error checked file I/O ---------- */
+
+ffreopen(s, f)
+char *s;
+FILE *f;
+{
+ if (freopen(s, "r", f) == NULL)
+ fatal("can't reopen %s", s);
+}
+
+FILE *
+ffcreat(s)
+char *s;
+{
+ FILE *f;
+
+ if ((f = fopen(s, "w")) == NULL)
+ fatal("can't create %s", s);
+ return(f);
+}
+
+FILE *
+fftemp(path, tail)
+char *path;
+{
+ register char *dir;
+
+ if ((dir = getenv("TMPDIR")) == NULL)
+#ifdef TMPDIR
+ dir = TMPDIR;
+#else
+ dir = "/tmp";
+#endif
+ sprintf(path, "%s/%s", dir, tail);
+ return(ffcreat(mktemp(path)));
+}
+
+putofmt(p, s, part)
+register char *p;
+register char *s;
+{
+ register i;
+ register long l;
+
+ AOUTPART(part);
+ while (i = *s++) {
+ switch (i -= '0') {
+/* case 0: p++; break; */
+ case 1:
+ l = (long) *((char *)p); p += sizeof(char );
+ break;
+ case 2:
+ l = (long) *((short *)p); p += sizeof(short);
+ break;
+ case 4:
+ l = (long) *((long *)p); p += sizeof(long );
+ break;
+ default:
+ assert(0);
+ }
+ while (--i >= 0) {
+ AOUTPUTC((int)l, part);
+ l >>= 8;
+ }
+ }
+}
+
+/* ---------- Error handling ---------- */
+
+yyerror(){} /* we will do our own error printing */
+
+nosect()
+{
+ fatal("no sections");
+}
+
+werror()
+{
+ fatal("write error");
+}
+
+/* VARARGS1 */
+fatal(s, a1, a2, a3, a4)
+char *s;
+{
+ nerrors++;
+ diag(" (fatal)\n", s, a1, a2, a3, a4);
+ stop();
+}
+
+#if DEBUG == 2
+assert2(file, line)
+char *file;
+{
+ fatal("assertion failed (%s, %d)", file, line);
+}
+#endif
+
+#if DEBUG == 1
+assert1()
+{
+ diag(" (fatal)\n", "assertion failed");
+ abort();
+}
+#endif
+
+/* VARARGS1 */
+serror(s, a1, a2, a3, a4)
+char *s;
+{
+ nerrors++;
+ diag("\n", s, a1, a2, a3, a4);
+}
+
+/* VARARGS1 */
+warning(s, a1, a2, a3, a4)
+char *s;
+{
+ diag(" (warning)\n", s, a1, a2, a3, a4);
+}
+
+/* VARARGS1 */
+diag(tail, s, a1, a2, a3, a4)
+char *tail, *s;
+{
+ fflush(stdout);
+ if (modulename)
+ fprintf(stderr, "\"%s\", line %d: ", modulename, lineno);
+ else
+ fprintf(stderr, "%s: ", progname);
+ fprintf(stderr, s, a1, a2, a3, a4);
+ fprintf(stderr, tail);
+}
+
+nofit()
+{
+ if (pass == PASS_3)
+ warning("too big");
+}
--- /dev/null
+/* @(#)comm8.c 1.1 */
+
+#include "comm0.h"
+#include "comm1.h"
+#include "y.tab.h"
+
+/* ========== Machine dependent C routines ========== */
+
+#include "mach5.c"
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
--- /dev/null
+# $Header$
+EM = ../../..
+h = $(EM)/h
+CDIR = $(EM)/mach/proto/nas
+CPP = $(EM)/lib/cpp
+DEF =
+
+FFLAG =
+CFLAGS = $(FFLAG) -O -I$h $(DEF)
+YFLAGS = -d
+LDFLAGS = $(FFLAG) -i
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = $(CDIR)/comm3.o $(CDIR)/comm4.o $(CDIR)/comm5.o \
+ $(CDIR)/comm6.o $(CDIR)/comm7.o $(CDIR)/comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ @echo "expect 1 shift/reduce conflict"
+
+lint: $(CSRC) as.c
+ lint $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c