diff options
Diffstat (limited to 'src/cmd/8a/lex.c')
-rw-r--r-- | src/cmd/8a/lex.c | 77 |
1 files changed, 27 insertions, 50 deletions
diff --git a/src/cmd/8a/lex.c b/src/cmd/8a/lex.c index a7840f625..f2ccc3361 100644 --- a/src/cmd/8a/lex.c +++ b/src/cmd/8a/lex.c @@ -74,7 +74,7 @@ main(int argc, char *argv[]) ARGBEGIN { default: c = ARGC(); - if(c >= 0 || c < sizeof(debug)) + if(c >= 0 && c < sizeof(debug)) debug[c] = 1; break; @@ -799,7 +799,8 @@ struct "XORPD", LTYPE3, AXORPD, "XORPS", LTYPE3, AXORPS, "USEFIELD", LTYPEN, AUSEFIELD, - + "PCDATA", LTYPEPC, APCDATA, + "FUNCDATA", LTYPEF, AFUNCDATA, 0 }; @@ -879,15 +880,14 @@ void zname(char *n, int t, int s) { - Bputc(&obuf, ANAME); /* as(2) */ - Bputc(&obuf, ANAME>>8); - Bputc(&obuf, t); /* type */ - Bputc(&obuf, s); /* sym */ + BPUTLE2(&obuf, ANAME); /* as(2) */ + BPUTC(&obuf, t); /* type */ + BPUTC(&obuf, s); /* sym */ while(*n) { - Bputc(&obuf, *n); + BPUTC(&obuf, *n); n++; } - Bputc(&obuf, 0); + BPUTC(&obuf, 0); } void @@ -922,52 +922,38 @@ zaddr(Gen *a, int s) case D_NONE: break; } - Bputc(&obuf, t); + BPUTC(&obuf, t); if(t & T_INDEX) { /* implies index, scale */ - Bputc(&obuf, a->index); - Bputc(&obuf, a->scale); + BPUTC(&obuf, a->index); + BPUTC(&obuf, a->scale); } if(t & T_OFFSET) { /* implies offset */ l = a->offset; - Bputc(&obuf, l); - Bputc(&obuf, l>>8); - Bputc(&obuf, l>>16); - Bputc(&obuf, l>>24); + BPUTLE4(&obuf, l); } if(t & T_OFFSET2) { l = a->offset2; - Bputc(&obuf, l); - Bputc(&obuf, l>>8); - Bputc(&obuf, l>>16); - Bputc(&obuf, l>>24); + BPUTLE4(&obuf, l); } if(t & T_SYM) /* implies sym */ - Bputc(&obuf, s); + BPUTC(&obuf, s); if(t & T_FCONST) { ieeedtod(&e, a->dval); - l = e.l; - Bputc(&obuf, l); - Bputc(&obuf, l>>8); - Bputc(&obuf, l>>16); - Bputc(&obuf, l>>24); - l = e.h; - Bputc(&obuf, l); - Bputc(&obuf, l>>8); - Bputc(&obuf, l>>16); - Bputc(&obuf, l>>24); + BPUTLE4(&obuf, e.l); + BPUTLE4(&obuf, e.h); return; } if(t & T_SCONST) { n = a->sval; for(i=0; i<NSNAME; i++) { - Bputc(&obuf, *n); + BPUTC(&obuf, *n); n++; } return; } if(t & T_TYPE) - Bputc(&obuf, a->type); + BPUTC(&obuf, a->type); } void @@ -1026,12 +1012,8 @@ jackpot: goto jackpot; break; } - Bputc(&obuf, a); - Bputc(&obuf, a>>8); - Bputc(&obuf, stmtline); - Bputc(&obuf, stmtline>>8); - Bputc(&obuf, stmtline>>16); - Bputc(&obuf, stmtline>>24); + BPUTLE2(&obuf, a); + BPUTLE4(&obuf, stmtline); zaddr(&g2->from, sf); zaddr(&g2->to, st); @@ -1106,13 +1088,12 @@ outhist(void) q = 0; } if(n) { - Bputc(&obuf, ANAME); - Bputc(&obuf, ANAME>>8); - Bputc(&obuf, D_FILE); /* type */ - Bputc(&obuf, 1); /* sym */ - Bputc(&obuf, '<'); + BPUTLE2(&obuf, ANAME); + BPUTC(&obuf, D_FILE); /* type */ + BPUTC(&obuf, 1); /* sym */ + BPUTC(&obuf, '<'); Bwrite(&obuf, p, n); - Bputc(&obuf, 0); + BPUTC(&obuf, 0); } p = q; if(p == 0 && op) { @@ -1122,12 +1103,8 @@ outhist(void) } g.offset = h->offset; - Bputc(&obuf, AHISTORY); - Bputc(&obuf, AHISTORY>>8); - Bputc(&obuf, h->line); - Bputc(&obuf, h->line>>8); - Bputc(&obuf, h->line>>16); - Bputc(&obuf, h->line>>24); + BPUTLE2(&obuf, AHISTORY); + BPUTLE4(&obuf, h->line); zaddr(&nullgen, 0); zaddr(&g, 0); |