update b.c to compile

This commit is contained in:
Tom Everett
2016-03-25 10:34:25 -06:00
parent c638044dc0
commit 1783f1789a
2 changed files with 18 additions and 10 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ $(BINDIR)/od: $(OTHERSRC)/wktod.s
# B compiler # B compiler
$(BINDIR)/bc: $(CMDSRC)/bl.s $(CMDSRC)/bi.s ../tools/b.c $(OTHERSRC)/b.b $(BINDIR)/bc: $(CMDSRC)/bl.s $(CMDSRC)/bi.s ../tools/b.c $(OTHERSRC)/b.b
$(CC) -o b ../tools/b.c 2> /dev/null $(CC) -o b ../tools/b.c
./b $(OTHERSRC)/b.b b.s ./b $(OTHERSRC)/b.b b.s
$(AS) $(ASARGS) -o $(BINDIR)/bc $(CMDSRC)/bl.s b.s $(CMDSRC)/bi.s $(AS) $(ASARGS) -o $(BINDIR)/bc $(CMDSRC)/bl.s b.s $(CMDSRC)/bi.s
rm b b.s rm b b.s
+17 -9
View File
@@ -26,6 +26,14 @@
int fin; int fin;
int fout = 1; int fout = 1;
void pexpr();
void error(int code);
void stmt();
void blkend();
void stmtlist();
void getcc();
void extdef();
xread() { xread() {
char buf[1]; char buf[1];
if (read(fin, buf, 1) <= 0) if (read(fin, buf, 1) <= 0)
@@ -237,7 +245,7 @@ subseq(c,a,b) {
return(b); return(b);
} }
getcc() { void getcc() {
extern cval; extern cval;
auto c; auto c;
@@ -292,7 +300,7 @@ mapch(c) {
return(a); return(a);
} }
expr(lev) { void expr(lev) {
extern peeksym, *csym, cval, isn; extern peeksym, *csym, cval, isn;
auto o; auto o;
@@ -447,7 +455,7 @@ loop:
peeksym = o; peeksym = o;
} }
pexpr() { void pexpr() {
if (symbol()==6) { /* ( */ if (symbol()==6) { /* ( */
expr(15); expr(15);
if (symbol()==7) /* ) */ if (symbol()==7) /* ) */
@@ -456,7 +464,7 @@ pexpr() {
error('()'); error('()');
} }
declare(kw) { void declare(kw) {
extern *csym, cval, nauto; extern *csym, cval, nauto;
auto o; auto o;
@@ -485,7 +493,7 @@ syntax:
error('[]'); /* declaration syntax */ error('[]'); /* declaration syntax */
} }
extdef() { void extdef() {
extern peeksym, *csym, cval, nauto; extern peeksym, *csym, cval, nauto;
auto o, c; auto o, c;
@@ -586,7 +594,7 @@ syntax:
stmt(); stmt();
} }
stmtlist() { void stmtlist() {
extern peeksym, eof; extern peeksym, eof;
auto o; auto o;
@@ -599,7 +607,7 @@ stmtlist() {
error('$)'); /* missing $) */ error('$)'); /* missing $) */
} }
stmt() { void stmt() {
extern peeksym, peekc, *csym, cval, isn, nauto; extern peeksym, peekc, *csym, cval, isn, nauto;
auto o, o1, o2; auto o, o1, o2;
@@ -701,7 +709,7 @@ syntax:
goto next; goto next;
} }
blkend() { void blkend() {
extern isn; extern isn;
auto i; auto i;
@@ -771,7 +779,7 @@ name(int *s) {
} }
} }
error(code) { void error(code) {
extern line, eof, *csym, nerror, fout; extern line, eof, *csym, nerror, fout;
auto f; auto f;