unsigned char b[Bungetsize+Bsize];
};
+/*
+ * These macros get 1-, 2-, and 4-byte integer values by reading the
+ * next few bytes in little-endian order.
+ */
#define BGETC(bp)\
- ((bp)->icount?(bp)->bbuf[(bp)->bsize+(bp)->icount++]:Bgetc((bp)))
+ ((bp)->icount?(bp)->ebuf[(bp)->icount++]:Bgetc((bp)))
+#define BGETLE2(bp)\
+ ((bp)->icount<=-2?((bp)->icount+=2,((bp)->ebuf[(bp)->icount-2])|((bp)->ebuf[(bp)->icount-1]<<8)):Bgetle2((bp)))
+#define BGETLE4(bp)\
+ ((bp)->icount<=-4?((bp)->icount+=4,((bp)->ebuf[(bp)->icount-4])|((bp)->ebuf[(bp)->icount-3]<<8)|((bp)->ebuf[(bp)->icount-2]<<16)|((bp)->ebuf[(bp)->icount-1]<<24)):Bgetle4((bp)))
+
+/*
+ * These macros put 1-, 2-, and 4-byte integer values by writing the
+ * next few bytes in little-endian order.
+ */
#define BPUTC(bp,c)\
- ((bp)->ocount?(bp)->bbuf[(bp)->bsize+(bp)->ocount++]=(c),0:Bputc((bp),(c)))
+ ((bp)->ocount?(bp)->ebuf[(bp)->ocount++]=(unsigned char)(c),0:Bputc((bp),(c)))
+#define BPUTLE2(bp,c)\
+ ((bp)->ocount<=-2?(bp)->ocount+=2,(bp)->ebuf[(bp)->ocount-2]=(unsigned char)(c),(bp)->ebuf[(bp)->ocount-1]=(unsigned char)(c>>8),0:Bputle2((bp),(c)))
+#define BPUTLE4(bp,c)\
+ ((bp)->ocount<=-4?(bp)->ocount+=4,(bp)->ebuf[(bp)->ocount-4]=(unsigned char)(c),(bp)->ebuf[(bp)->ocount-3]=(unsigned char)(c>>8),(bp)->ebuf[(bp)->ocount-2]=(unsigned char)(c>>16),(bp)->ebuf[(bp)->ocount-1]=(unsigned char)(c>>24),0:Bputle4((bp),(c)))
+
#define BOFFSET(bp)\
(((bp)->state==Bractive)?\
(bp)->offset + (bp)->icount:\
int Bfildes(Biobuf*);
int Bflush(Biobuf*);
int Bgetc(Biobuf*);
+int Bgetle2(Biobuf*);
+int Bgetle4(Biobuf*);
int Bgetd(Biobuf*, double*);
long Bgetrune(Biobuf*);
int Binit(Biobuf*, int, int);
Biobuf* Bopen(char*, int);
int Bprint(Biobuf*, char*, ...);
int Bputc(Biobuf*, int);
+int Bputle2(Biobuf*, int);
+int Bputle4(Biobuf*, int);
int Bputrune(Biobuf*, long);
void* Brdline(Biobuf*, int);
char* Brdstr(Biobuf*, int, int);
zname(char *n, int t, int s)
{
- Bputc(&obuf, ANAME);
- Bputc(&obuf, t); /* type */
- Bputc(&obuf, s); /* sym */
+ BPUTC(&obuf, ANAME);
+ BPUTC(&obuf, t); /* type */
+ BPUTC(&obuf, s); /* sym */
while(*n) {
- Bputc(&obuf, *n);
+ BPUTC(&obuf, *n);
n++;
}
- Bputc(&obuf, 0);
+ BPUTC(&obuf, 0);
}
void
char *n;
Ieee e;
- Bputc(&obuf, a->type);
- Bputc(&obuf, a->reg);
- Bputc(&obuf, s);
- Bputc(&obuf, a->name);
- Bputc(&obuf, 0);
+ BPUTC(&obuf, a->type);
+ BPUTC(&obuf, a->reg);
+ BPUTC(&obuf, s);
+ BPUTC(&obuf, a->name);
+ BPUTC(&obuf, 0);
switch(a->type) {
default:
print("unknown type %d\n", a->type);
case D_REGREG:
case D_REGREG2:
- Bputc(&obuf, a->offset);
+ BPUTC(&obuf, a->offset);
break;
case D_CONST2:
l = a->offset2;
- Bputc(&obuf, l);
- Bputc(&obuf, l>>8);
- Bputc(&obuf, l>>16);
- Bputc(&obuf, l>>24);
+ BPUTLE4(&obuf, l);
// fall through
case D_OREG:
case D_CONST:
case D_BRANCH:
case D_SHIFT:
l = a->offset;
- Bputc(&obuf, l);
- Bputc(&obuf, l>>8);
- Bputc(&obuf, l>>16);
- Bputc(&obuf, l>>24);
+ BPUTLE4(&obuf, l);
break;
case D_SCONST:
n = a->sval;
for(i=0; i<NSNAME; i++) {
- Bputc(&obuf, *n);
+ BPUTC(&obuf, *n);
n++;
}
break;
case D_FCONST:
ieeedtod(&e, a->dval);
- Bputc(&obuf, e.l);
- Bputc(&obuf, e.l>>8);
- Bputc(&obuf, e.l>>16);
- Bputc(&obuf, e.l>>24);
- Bputc(&obuf, e.h);
- Bputc(&obuf, e.h>>8);
- Bputc(&obuf, e.h>>16);
- Bputc(&obuf, e.h>>24);
+ BPUTLE4(&obuf, e.l);
+ BPUTLE4(&obuf, e.h);
break;
}
}
goto jackpot;
break;
}
- Bputc(&obuf, a);
- Bputc(&obuf, scond);
- Bputc(&obuf, reg);
- Bputc(&obuf, stmtline);
- Bputc(&obuf, stmtline>>8);
- Bputc(&obuf, stmtline>>16);
- Bputc(&obuf, stmtline>>24);
+ BPUTC(&obuf, a);
+ BPUTC(&obuf, scond);
+ BPUTC(&obuf, reg);
+ BPUTLE4(&obuf, stmtline);
zaddr(g1, sf);
zaddr(g2, st);
q = 0;
}
if(n) {
- Bputc(&obuf, ANAME);
- Bputc(&obuf, D_FILE); /* type */
- Bputc(&obuf, 1); /* sym */
- Bputc(&obuf, '<');
+ BPUTC(&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) {
}
g.offset = h->offset;
- Bputc(&obuf, AHISTORY);
- Bputc(&obuf, Always);
- Bputc(&obuf, 0);
- Bputc(&obuf, h->line);
- Bputc(&obuf, h->line>>8);
- Bputc(&obuf, h->line>>16);
- Bputc(&obuf, h->line>>24);
+ BPUTC(&obuf, AHISTORY);
+ BPUTC(&obuf, Always);
+ BPUTC(&obuf, 0);
+ BPUTLE4(&obuf, h->line);
zaddr(&nullgen, 0);
zaddr(&g, 0);
q = 0;
}
if(n) {
- Bputc(b, ANAME);
- Bputc(b, D_FILE);
- Bputc(b, 1);
- Bputc(b, '<');
+ BPUTC(b, ANAME);
+ BPUTC(b, D_FILE);
+ BPUTC(b, 1);
+ BPUTC(b, '<');
Bwrite(b, p, n);
- Bputc(b, 0);
+ BPUTC(b, 0);
}
p = q;
if(p == 0 && op) {
void
zname(Biobuf *b, Sym *s, int t)
{
- Bputc(b, ANAME); /* as */
- Bputc(b, t); /* type */
- Bputc(b, s->sym); /* sym */
+ BPUTC(b, ANAME); /* as */
+ BPUTC(b, t); /* type */
+ BPUTC(b, s->sym); /* sym */
Bputname(b, s);
}
void
zfile(Biobuf *b, char *p, int n)
{
- Bputc(b, ANAME);
- Bputc(b, D_FILE);
- Bputc(b, 1);
- Bputc(b, '<');
+ BPUTC(b, ANAME);
+ BPUTC(b, D_FILE);
+ BPUTC(b, 1);
+ BPUTC(b, '<');
Bwrite(b, p, n);
- Bputc(b, 0);
+ BPUTC(b, 0);
}
void
{
Addr a;
- Bputc(b, AHISTORY);
- Bputc(b, C_SCOND_NONE);
- Bputc(b, NREG);
- Bputc(b, line);
- Bputc(b, line>>8);
- Bputc(b, line>>16);
- Bputc(b, line>>24);
+ BPUTC(b, AHISTORY);
+ BPUTC(b, C_SCOND_NONE);
+ BPUTC(b, NREG);
+ BPUTLE4(b, line);
zaddr(b, &zprog.from, 0, 0);
a = zprog.to;
if(offset != 0) {
fatal("We should no longer generate these as types");
default:
- Bputc(b, a->type);
- Bputc(b, a->reg);
- Bputc(b, s);
- Bputc(b, a->name);
- Bputc(b, gotype);
+ BPUTC(b, a->type);
+ BPUTC(b, a->reg);
+ BPUTC(b, s);
+ BPUTC(b, a->name);
+ BPUTC(b, gotype);
}
switch(a->type) {
case D_CONST2:
l = a->offset2;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24); // fall through
+ BPUTLE4(b, l); // fall through
case D_OREG:
case D_CONST:
case D_SHIFT:
case D_EXTERN:
case D_PARAM:
l = a->offset;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
break;
case D_BRANCH:
fatal("unpatched branch");
a->offset = a->u.branch->loc;
l = a->offset;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
break;
case D_SCONST:
n = a->u.sval;
for(i=0; i<NSNAME; i++) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
break;
case D_REGREG:
case D_REGREG2:
- Bputc(b, a->offset);
+ BPUTC(b, a->offset);
break;
case D_FCONST:
ieeedtod(&e, a->u.dval);
- l = e;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
- l = e >> 32;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, e);
+ BPUTLE4(b, e >> 32);
break;
}
}
break;
}
- Bputc(bout, p->as);
- Bputc(bout, p->scond);
- Bputc(bout, p->reg);
- Bputc(bout, p->lineno);
- Bputc(bout, p->lineno>>8);
- Bputc(bout, p->lineno>>16);
- Bputc(bout, p->lineno>>24);
+ BPUTC(bout, p->as);
+ BPUTC(bout, p->scond);
+ BPUTC(bout, p->reg);
+ BPUTLE4(bout, p->lineno);
zaddr(bout, &p->from, sf, gf);
zaddr(bout, &p->to, st, gt);
}
c = BGETC(f);
if(c < 0 || c > NSYM){
print("sym out of range: %d\n", c);
- Bputc(f, ALAST+1);
+ BPUTC(f, ALAST+1);
return;
}
a->sym = h[c];
if((schar)a->reg < 0 || a->reg > NREG) {
print("register out of range %d\n", a->reg);
- Bputc(f, ALAST+1);
+ BPUTC(f, ALAST+1);
return; /* force real diagnostic */
}
switch(a->type) {
default:
print("unknown type %d\n", a->type);
- Bputc(f, ALAST+1);
+ BPUTC(f, ALAST+1);
return; /* force real diagnostic */
case D_NONE:
break;
case D_CONST2:
- a->offset2 = Bget4(f); // fall through
+ a->offset2 = BGETLE4(f); // fall through
case D_BRANCH:
case D_OREG:
case D_CONST:
case D_OCONST:
case D_SHIFT:
- a->offset = Bget4(f);
+ a->offset = BGETLE4(f);
break;
case D_SCONST:
break;
case D_FCONST:
- a->ieee.l = Bget4(f);
- a->ieee.h = Bget4(f);
+ a->ieee.l = BGETLE4(f);
+ a->ieee.h = BGETLE4(f);
break;
}
s = a->sym;
if(o == ANAME || o == ASIGNAME) {
sig = 0;
if(o == ASIGNAME)
- sig = Bget4(f);
+ sig = BGETLE4(f);
v = BGETC(f); /* type */
o = BGETC(f); /* sym */
r = 0;
p->as = o;
p->scond = BGETC(f);
p->reg = BGETC(f);
- p->line = Bget4(f);
+ p->line = BGETLE4(f);
zaddr(pn, f, &p->from, h);
fromgotype = adrgotype;
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
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_64) {
l = a->offset>>32;
- 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);
+ BPUTLE4(&obuf, l);
l = e.h;
- Bputc(&obuf, l);
- Bputc(&obuf, l>>8);
- Bputc(&obuf, l>>16);
- Bputc(&obuf, l>>24);
+ BPUTLE4(&obuf, l);
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
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);
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) {
}
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);
goto jackpot;
break;
}
- Bputc(&b, p->as);
- Bputc(&b, p->as>>8);
- Bputc(&b, p->lineno);
- Bputc(&b, p->lineno>>8);
- Bputc(&b, p->lineno>>16);
- Bputc(&b, p->lineno>>24);
+ BPUTLE2(&b, p->as);
+ BPUTLE4(&b, p->lineno);
zaddr(&b, &p->from, sf);
zaddr(&b, &p->to, st);
}
q = 0;
}
if(n) {
- Bputc(b, ANAME);
- Bputc(b, ANAME>>8);
- Bputc(b, D_FILE);
- Bputc(b, 1);
- Bputc(b, '<');
+ BPUTLE2(b, ANAME);
+ BPUTC(b, D_FILE);
+ BPUTC(b, 1);
+ BPUTC(b, '<');
Bwrite(b, p, n);
- Bputc(b, 0);
+ BPUTC(b, 0);
}
p = q;
if(p == 0 && op) {
if(h->offset)
pg.to.type = D_CONST;
- Bputc(b, pg.as);
- Bputc(b, pg.as>>8);
- Bputc(b, pg.lineno);
- Bputc(b, pg.lineno>>8);
- Bputc(b, pg.lineno>>16);
- Bputc(b, pg.lineno>>24);
+ BPUTLE2(b, pg.as);
+ BPUTLE4(b, pg.lineno);
zaddr(b, &pg.from, 0);
zaddr(b, &pg.to, 0);
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
sig = sign(s);
- Bputc(b, ASIGNAME);
- Bputc(b, ASIGNAME>>8);
- Bputc(b, sig);
- Bputc(b, sig>>8);
- Bputc(b, sig>>16);
- Bputc(b, sig>>24);
+ BPUTLE2(b, ASIGNAME);
+ BPUTLE4(b, sig);
s->sig = SIGDONE;
}
else{
- Bputc(b, ANAME); /* as */
- Bputc(b, ANAME>>8); /* as */
+ BPUTLE2(b, ANAME); /* as */
}
- Bputc(b, t); /* type */
- Bputc(b, s->sym); /* sym */
+ BPUTC(b, t); /* type */
+ BPUTC(b, s->sym); /* sym */
n = s->name;
while(*n) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
- Bputc(b, 0);
+ BPUTC(b, 0);
}
void
t |= T_SCONST;
break;
}
- Bputc(b, t);
+ BPUTC(b, t);
if(t & T_INDEX) { /* implies index, scale */
- Bputc(b, a->index);
- Bputc(b, a->scale);
+ BPUTC(b, a->index);
+ BPUTC(b, a->scale);
}
if(t & T_OFFSET) { /* implies offset */
l = a->offset;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
if(t & T_64) {
l = a->offset>>32;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
}
}
if(t & T_SYM) /* implies sym */
- Bputc(b, s);
+ BPUTC(b, s);
if(t & T_FCONST) {
ieeedtod(&e, a->dval);
l = e.l;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
l = e.h;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
return;
}
if(t & T_SCONST) {
n = a->sval;
for(i=0; i<NSNAME; i++) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
return;
}
if(t & T_TYPE)
- Bputc(b, a->type);
+ BPUTC(b, a->type);
}
int32
void
zname(Biobuf *b, Sym *s, int t)
{
- Bputc(b, ANAME); /* as */
- Bputc(b, ANAME>>8); /* as */
- Bputc(b, t); /* type */
- Bputc(b, s->sym); /* sym */
+ BPUTLE2(b, ANAME); /* as */
+ BPUTC(b, t); /* type */
+ BPUTC(b, s->sym); /* sym */
Bputname(b, s);
}
void
zfile(Biobuf *b, char *p, int n)
{
- Bputc(b, ANAME);
- Bputc(b, ANAME>>8);
- Bputc(b, D_FILE);
- Bputc(b, 1);
- Bputc(b, '<');
+ BPUTLE2(b, ANAME);
+ BPUTC(b, D_FILE);
+ BPUTC(b, 1);
+ BPUTC(b, '<');
Bwrite(b, p, n);
- Bputc(b, 0);
+ BPUTC(b, 0);
}
void
{
Addr a;
- Bputc(b, AHISTORY);
- Bputc(b, AHISTORY>>8);
- Bputc(b, line);
- Bputc(b, line>>8);
- Bputc(b, line>>16);
- Bputc(b, line>>24);
+ BPUTLE2(b, AHISTORY);
+ BPUTLE4(b, line);
zaddr(b, &zprog.from, 0, 0);
a = zprog.to;
if(offset != 0) {
t |= T_SCONST;
break;
}
- Bputc(b, t);
+ BPUTC(b, t);
if(t & T_INDEX) { /* implies index, scale */
- Bputc(b, a->index);
- Bputc(b, a->scale);
+ BPUTC(b, a->index);
+ BPUTC(b, a->scale);
}
if(t & T_OFFSET) { /* implies offset */
l = a->offset;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
if(t & T_64) {
l = a->offset>>32;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
}
}
if(t & T_SYM) /* implies sym */
- Bputc(b, s);
+ BPUTC(b, s);
if(t & T_FCONST) {
ieeedtod(&e, a->u.dval);
- l = e;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
- l = e >> 32;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, e);
+ BPUTLE4(b, e >> 32);
return;
}
if(t & T_SCONST) {
n = a->u.sval;
for(i=0; i<NSNAME; i++) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
return;
}
if(t & T_TYPE)
- Bputc(b, a->type);
+ BPUTC(b, a->type);
if(t & T_GOTYPE)
- Bputc(b, gotype);
+ BPUTC(b, gotype);
}
static struct {
break;
}
- Bputc(bout, p->as);
- Bputc(bout, p->as>>8);
- Bputc(bout, p->lineno);
- Bputc(bout, p->lineno>>8);
- Bputc(bout, p->lineno>>16);
- Bputc(bout, p->lineno>>24);
+ BPUTLE2(bout, p->as);
+ BPUTLE4(bout, p->lineno);
zaddr(bout, &p->from, sf, gf);
zaddr(bout, &p->to, st, gt);
}
}
a->offset = 0;
if(t & T_OFFSET) {
- a->offset = Bget4(f);
+ a->offset = BGETLE4(f);
if(t & T_64) {
a->offset &= 0xFFFFFFFFULL;
- a->offset |= (vlong)Bget4(f) << 32;
+ a->offset |= (vlong)BGETLE4(f) << 32;
}
}
a->sym = S;
a->sym = zsym(pn, f, h);
a->type = D_NONE;
if(t & T_FCONST) {
- a->ieee.l = Bget4(f);
- a->ieee.h = Bget4(f);
+ a->ieee.l = BGETLE4(f);
+ a->ieee.h = BGETLE4(f);
a->type = D_FCONST;
} else
if(t & T_SCONST) {
if(o == ANAME || o == ASIGNAME) {
sig = 0;
if(o == ASIGNAME)
- sig = Bget4(f);
+ sig = BGETLE4(f);
v = BGETC(f); /* type */
o = BGETC(f); /* sym */
r = 0;
p = mal(sizeof(*p));
p->as = o;
- p->line = Bget4(f);
+ p->line = BGETLE4(f);
p->back = 2;
p->mode = mode;
zaddr(pn, f, &p->from, h);
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
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
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);
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) {
}
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);
goto jackpot;
break;
}
- Bputc(&b, p->as);
- Bputc(&b, p->as>>8);
- Bputc(&b, p->lineno);
- Bputc(&b, p->lineno>>8);
- Bputc(&b, p->lineno>>16);
- Bputc(&b, p->lineno>>24);
+ BPUTLE2(&b, p->as);
+ BPUTLE4(&b, p->lineno);
zaddr(&b, &p->from, sf);
zaddr(&b, &p->to, st);
}
q = 0;
}
if(n) {
- Bputc(b, ANAME);
- Bputc(b, ANAME>>8);
- Bputc(b, D_FILE);
- Bputc(b, 1);
- Bputc(b, '<');
+ BPUTLE2(b, ANAME);
+ BPUTC(b, D_FILE);
+ BPUTC(b, 1);
+ BPUTC(b, '<');
Bwrite(b, p, n);
- Bputc(b, 0);
+ BPUTC(b, 0);
}
p = q;
if(p == 0 && op) {
if(h->offset)
pg.to.type = D_CONST;
- Bputc(b, pg.as);
- Bputc(b, pg.as>>8);
- Bputc(b, pg.lineno);
- Bputc(b, pg.lineno>>8);
- Bputc(b, pg.lineno>>16);
- Bputc(b, pg.lineno>>24);
+ BPUTLE2(b, pg.as);
+ BPUTLE4(b, pg.lineno);
zaddr(b, &pg.from, 0);
zaddr(b, &pg.to, 0);
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
sig = sign(s);
- Bputc(b, ASIGNAME);
- Bputc(b, ASIGNAME>>8);
- Bputc(b, sig);
- Bputc(b, sig>>8);
- Bputc(b, sig>>16);
- Bputc(b, sig>>24);
+ BPUTLE2(b, ASIGNAME);
+ BPUTLE4(b, sig);
s->sig = SIGDONE;
}
else{
- Bputc(b, ANAME); /* as */
- Bputc(b, ANAME>>8); /* as */
+ BPUTLE2(b, ANAME); /* as */
}
- Bputc(b, t); /* type */
- Bputc(b, s->sym); /* sym */
+ BPUTC(b, t); /* type */
+ BPUTC(b, s->sym); /* sym */
n = s->name;
while(*n) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
- Bputc(b, 0);
+ BPUTC(b, 0);
}
void
t |= T_OFFSET|T_OFFSET2;
break;
}
- Bputc(b, t);
+ BPUTC(b, t);
if(t & T_INDEX) { /* implies index, scale */
- Bputc(b, a->index);
- Bputc(b, a->scale);
+ BPUTC(b, a->index);
+ BPUTC(b, a->scale);
}
if(t & T_OFFSET) { /* implies offset */
l = a->offset;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
}
if(t & T_OFFSET2) { /* implies offset2 */
l = a->offset2;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
}
if(t & T_SYM) /* implies sym */
- Bputc(b, s);
+ BPUTC(b, s);
if(t & T_FCONST) {
ieeedtod(&e, a->dval);
- l = e.l;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
- l = e.h;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, e.l);
+ BPUTLE4(b, e.h);
return;
}
if(t & T_SCONST) {
n = a->sval;
for(i=0; i<NSNAME; i++) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
return;
}
if(t & T_TYPE)
- Bputc(b, a->type);
+ BPUTC(b, a->type);
}
int32
void
zname(Biobuf *b, Sym *s, int t)
{
- Bputc(b, ANAME); /* as */
- Bputc(b, ANAME>>8); /* as */
- Bputc(b, t); /* type */
- Bputc(b, s->sym); /* sym */
+ BPUTLE2(b, ANAME); /* as */
+ BPUTC(b, t); /* type */
+ BPUTC(b, s->sym); /* sym */
Bputname(b, s);
}
void
zfile(Biobuf *b, char *p, int n)
{
- Bputc(b, ANAME);
- Bputc(b, ANAME>>8);
- Bputc(b, D_FILE);
- Bputc(b, 1);
- Bputc(b, '<');
+ BPUTLE2(b, ANAME);
+ BPUTC(b, D_FILE);
+ BPUTC(b, 1);
+ BPUTC(b, '<');
Bwrite(b, p, n);
- Bputc(b, 0);
+ BPUTC(b, 0);
}
void
{
Addr a;
- Bputc(b, AHISTORY);
- Bputc(b, AHISTORY>>8);
- Bputc(b, line);
- Bputc(b, line>>8);
- Bputc(b, line>>16);
- Bputc(b, line>>24);
+ BPUTLE2(b, AHISTORY);
+ BPUTLE4(b, line);
zaddr(b, &zprog.from, 0, 0);
a = zprog.to;
if(offset != 0) {
t |= T_SCONST;
break;
}
- Bputc(b, t);
+ BPUTC(b, t);
if(t & T_INDEX) { /* implies index, scale */
- Bputc(b, a->index);
- Bputc(b, a->scale);
+ BPUTC(b, a->index);
+ BPUTC(b, a->scale);
}
if(t & T_OFFSET) { /* implies offset */
l = a->offset;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
}
if(t & T_OFFSET2) { /* implies offset */
l = a->offset2;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, l);
}
if(t & T_SYM) /* implies sym */
- Bputc(b, s);
+ BPUTC(b, s);
if(t & T_FCONST) {
ieeedtod(&e, a->u.dval);
- l = e;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
- l = e >> 32;
- Bputc(b, l);
- Bputc(b, l>>8);
- Bputc(b, l>>16);
- Bputc(b, l>>24);
+ BPUTLE4(b, e);
+ BPUTLE4(b, e >> 32);
return;
}
if(t & T_SCONST) {
n = a->u.sval;
for(i=0; i<NSNAME; i++) {
- Bputc(b, *n);
+ BPUTC(b, *n);
n++;
}
return;
}
if(t & T_TYPE)
- Bputc(b, a->type);
+ BPUTC(b, a->type);
if(t & T_GOTYPE)
- Bputc(b, gotype);
+ BPUTC(b, gotype);
}
static struct {
break;
}
- Bputc(bout, p->as);
- Bputc(bout, p->as>>8);
- Bputc(bout, p->lineno);
- Bputc(bout, p->lineno>>8);
- Bputc(bout, p->lineno>>16);
- Bputc(bout, p->lineno>>24);
+ BPUTLE2(bout, p->as);
+ BPUTLE4(bout, p->lineno);
zaddr(bout, &p->from, sf, gf);
zaddr(bout, &p->to, st, gt);
}
a->type = D_NONE;
a->offset = 0;
if(t & T_OFFSET)
- a->offset = Bget4(f);
+ a->offset = BGETLE4(f);
a->offset2 = 0;
if(t & T_OFFSET2) {
- a->offset2 = Bget4(f);
+ a->offset2 = BGETLE4(f);
a->type = D_CONST2;
}
a->sym = S;
if(t & T_SYM)
a->sym = zsym(pn, f, h);
if(t & T_FCONST) {
- a->ieee.l = Bget4(f);
- a->ieee.h = Bget4(f);
+ a->ieee.l = BGETLE4(f);
+ a->ieee.h = BGETLE4(f);
a->type = D_FCONST;
} else
if(t & T_SCONST) {
if(o == ANAME || o == ASIGNAME) {
sig = 0;
if(o == ASIGNAME)
- sig = Bget4(f);
+ sig = BGETLE4(f);
v = BGETC(f); /* type */
o = BGETC(f); /* sym */
r = 0;
p = mal(sizeof(*p));
p->as = o;
- p->line = Bget4(f);
+ p->line = BGETLE4(f);
p->back = 2;
zaddr(pn, f, &p->from, h);
fromgotype = adrgotype;
curio.cp++;
} else {
loop:
- c = Bgetc(curio.bin);
+ c = BGETC(curio.bin);
if(c == 0xef) {
- c1 = Bgetc(curio.bin);
- c2 = Bgetc(curio.bin);
+ c1 = BGETC(curio.bin);
+ c2 = BGETC(curio.bin);
if(c1 == 0xbb && c2 == 0xbf) {
yyerrorl(lexlineno, "Unicode (UTF-8) BOM in middle of file");
goto loop;
Bputname(Biobuf *b, Sym *s)
{
Bprint(b, "%s", s->pkg->prefix);
- Bputc(b, '.');
+ BPUTC(b, '.');
Bwrite(b, s->name, strlen(s->name)+1);
}
pn = estrdup(pn);
- c1 = Bgetc(f);
- c2 = Bgetc(f);
- c3 = Bgetc(f);
- c4 = Bgetc(f);
+ c1 = BGETC(f);
+ c2 = BGETC(f);
+ c3 = BGETC(f);
+ c4 = BGETC(f);
Bungetc(f);
Bungetc(f);
Bungetc(f);
/* skip over exports and other info -- ends with \n!\n */
import0 = Boffset(f);
c1 = '\n'; // the last line ended in \n
- c2 = Bgetc(f);
- c3 = Bgetc(f);
+ c2 = BGETC(f);
+ c3 = BGETC(f);
while(c1 != '\n' || c2 != '!' || c3 != '\n') {
c1 = c2;
c2 = c3;
- c3 = Bgetc(f);
+ c3 = BGETC(f);
if(c3 == Beof)
goto eof;
}
s->sig = 0;
}
-int32
-Bget4(Biobuf *f)
-{
- uchar p[4];
-
- if(Bread(f, p, 4) != 4)
- return 0;
- return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
-}
-
void
mywhatsys(void)
{
void undefsym(Sym *s);
void zerosig(char *sp);
void readundefs(char *f, int t);
-int32 Bget4(Biobuf *f);
void loadlib(void);
void errorexit(void);
void mangle(char*);
// the ! comes immediately. Catch that so we can avoid
// the call to scanpkg below, since scanpkg assumes that the
// Go metadata is present.
- if(Bgetc(b) == '!')
+ if(BGETC(b) == '!')
goobject = 0;
Bseek(b, offset1, 0);
* scan until $$
*/
for (n=0; n<size; ) {
- c = Bgetc(b);
+ c = BGETC(b);
if(c == Beof)
break;
n++;
if(c != '$')
continue;
- c = Bgetc(b);
+ c = BGETC(b);
if(c == Beof)
break;
n++;
foundstart:
/* found $$; skip rest of line */
- while((c = Bgetc(b)) != '\n')
+ while((c = BGETC(b)) != '\n')
if(c == Beof)
goto bad;
wrsym(&b, len, aend->sym);
if(symdefsize&0x01)
- Bputc(&b, 0);
+ BPUTC(&b, 0);
if (gflag) {
len = pkgdefsize;
if (Bwrite(&b, pkgdefdata, pkgdefsize) != pkgdefsize)
wrerr();
if(len&0x01)
- Bputc(&b, 0);
+ BPUTC(&b, 0);
}
Bterm(&b);
}
int off;
while(as) {
- Bputc(bp, as->type);
+ BPUTC(bp, as->type);
off = as->offset+offset;
- Bputc(bp, off);
- Bputc(bp, off>>8);
- Bputc(bp, off>>16);
- Bputc(bp, off>>24);
+ BPUTLE4(bp, off);
if (Bwrite(bp, as->name, as->len+1) != as->len+1)
wrerr();
as = as->next;
n = *ap++;
while(--n>=0 && (mode&*ap++)==0)
ap++;
- Bputc(&bout, *ap);
+ BPUTC(&bout, *ap);
}
/*
rderr();
}
if(bp->size&1)
- Bgetc(b);
+ BGETC(b);
}
/*
strncpy(bp->hdr.fmag, ARFMAG, 2);
Bseek(b, end, 0);
if(Boffset(b)&1)
- Bgetc(b);
+ BGETC(b);
return 1;
}
goto loop;
}
+int
+Bgetle2(Biobuf *bp)
+{
+ int l, h;
+
+ l = Bgetc(bp);
+ h = Bgetc(bp);
+ return l|(h<<8);
+}
+
+int
+Bgetle4(Biobuf *bp)
+{
+ int l, h;
+
+ l = Bgetle2(bp);
+ h = Bgetle2(bp);
+ return l|(h<<16);
+}
+
int
Bungetc(Biobuf *bp)
{
int c;
struct bgetd *bg = vp;
- c = Bgetc(bg->b);
+ c = BGETC(bg->b);
if(c == Beof)
bg->eof = 1;
return c;
Rune rune;
char str[UTFmax];
- c = Bgetc(bp);
+ c = BGETC(bp);
if(c < Runeself) { /* one char */
bp->runesize = 1;
return c;
str[0] = (char)c;
for(i=1;;) {
- c = Bgetc(bp);
+ c = BGETC(bp);
if(c < 0)
return c;
str[i++] = (char)c;
}
return Beof;
}
+
+int
+Bputle2(Biobuf *bp, int c)
+{
+ Bputc(bp, c);
+ return Bputc(bp, c>>8);
+}
+
+int
+Bputle4(Biobuf *bp, int c)
+{
+ Bputle2(bp, c);
+ return Bputle2(bp, c>>16);
+}
rune = (Rune)c;
if(rune < Runeself) {
- Bputc(bp, (int)rune);
+ BPUTC(bp, (int)rune);
return 1;
}
n = runetochar(str, &rune);
int as, n;
Addr a;
- as = Bgetc(bp); /* as */
+ as = BGETC(bp); /* as */
if(as < 0)
return 0;
p->kind = aNone;
p->sig = leswal(p->sig);
}
p->kind = aName;
- p->type = type2char(Bgetc(bp)); /* type */
- p->sym = Bgetc(bp); /* sym */
+ p->type = type2char(BGETC(bp)); /* type */
+ p->sym = BGETC(bp); /* sym */
n = 0;
for(;;) {
- as = Bgetc(bp);
+ as = BGETC(bp);
if(as < 0)
return 0;
n++;
Addr a;
long off;
- a.type = Bgetc(bp); /* a.type */
+ a.type = BGETC(bp); /* a.type */
skip(bp,1); /* reg */
- a.sym = Bgetc(bp); /* sym index */
- a.name = Bgetc(bp); /* sym type */
- a.gotype = Bgetc(bp); /* go type */
+ a.sym = BGETC(bp); /* sym index */
+ a.name = BGETC(bp); /* sym type */
+ a.gotype = BGETC(bp); /* go type */
switch(a.type){
default:
case D_NONE:
break;
case D_REGREG:
case D_REGREG2:
- Bgetc(bp);
+ BGETC(bp);
break;
case D_CONST2:
- Bgetc(bp);
- Bgetc(bp);
- Bgetc(bp);
- Bgetc(bp); // fall through
+ BGETLE4(bp); // fall through
case D_OREG:
case D_CONST:
case D_BRANCH:
case D_SHIFT:
- off = Bgetc(bp);
- off |= Bgetc(bp) << 8;
- off |= Bgetc(bp) << 16;
- off |= Bgetc(bp) << 24;
+ off = BGETLE4(bp);
if(off < 0)
off = -off;
if(a.sym && (a.name==D_PARAM || a.name==D_AUTO))
skip(Biobuf *bp, int n)
{
while (n-- > 0)
- Bgetc(bp);
+ BGETC(bp);
}
int as, n, c;
Addr a;
- as = Bgetc(bp); /* as(low) */
+ as = BGETC(bp); /* as(low) */
if(as < 0)
return 0;
- c = Bgetc(bp); /* as(high) */
+ c = BGETC(bp); /* as(high) */
if(c < 0)
return 0;
as |= ((c & 0xff) << 8);
p->sig = leswal(p->sig);
}
p->kind = aName;
- p->type = type2char(Bgetc(bp)); /* type */
- p->sym = Bgetc(bp); /* sym */
+ p->type = type2char(BGETC(bp)); /* type */
+ p->sym = BGETC(bp); /* sym */
n = 0;
for(;;) {
- as = Bgetc(bp);
+ as = BGETC(bp);
if(as < 0)
return 0;
n++;
off = 0;
a.sym = -1;
- a.flags = Bgetc(bp); /* flags */
+ a.flags = BGETC(bp); /* flags */
a.gotype = 0;
if(a.flags & T_INDEX)
skip(bp, 2);
if(a.flags & T_OFFSET){
- l = Bgetc(bp);
- l |= Bgetc(bp) << 8;
- l |= Bgetc(bp) << 16;
- l |= Bgetc(bp) << 24;
+ l = BGETLE4(bp);
off = l;
if(a.flags & T_64){
- l = Bgetc(bp);
- l |= Bgetc(bp) << 8;
- l |= Bgetc(bp) << 16;
- l |= Bgetc(bp) << 24;
+ l = BGETLE4(bp);
off = ((vlong)l << 32) | (off & 0xFFFFFFFF);
}
if(off < 0)
off = -off;
}
if(a.flags & T_SYM)
- a.sym = Bgetc(bp);
+ a.sym = BGETC(bp);
if(a.flags & T_FCONST)
skip(bp, 8);
else
if(a.flags & T_SCONST)
skip(bp, NSNAME);
if(a.flags & T_TYPE) {
- t = Bgetc(bp);
+ t = BGETC(bp);
if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
_offset(a.sym, off);
}
if(a.flags & T_GOTYPE)
- a.gotype = Bgetc(bp);
+ a.gotype = BGETC(bp);
return a;
}
skip(Biobuf *bp, int n)
{
while (n-- > 0)
- Bgetc(bp);
+ BGETC(bp);
}
int as, n, c;
Addr a;
- as = Bgetc(bp); /* as(low) */
+ as = BGETC(bp); /* as(low) */
if(as < 0)
return 0;
- c = Bgetc(bp); /* as(high) */
+ c = BGETC(bp); /* as(high) */
if(c < 0)
return 0;
as |= ((c & 0xff) << 8);
p->sig = leswal(p->sig);
}
p->kind = aName;
- p->type = type2char(Bgetc(bp)); /* type */
- p->sym = Bgetc(bp); /* sym */
+ p->type = type2char(BGETC(bp)); /* type */
+ p->sym = BGETC(bp); /* sym */
n = 0;
for(;;) {
- as = Bgetc(bp);
+ as = BGETC(bp);
if(as < 0)
return 0;
n++;
off = 0;
a.gotype = 0;
a.sym = -1;
- a.flags = Bgetc(bp); /* flags */
+ a.flags = BGETC(bp); /* flags */
if(a.flags & T_INDEX)
skip(bp, 2);
if(a.flags & T_OFFSET){
- off = Bgetc(bp);
- off |= Bgetc(bp) << 8;
- off |= Bgetc(bp) << 16;
- off |= Bgetc(bp) << 24;
+ off = BGETLE4(bp);
if(off < 0)
off = -off;
}
if(a.flags & T_OFFSET2){
- Bgetc(bp);
- Bgetc(bp);
- Bgetc(bp);
- Bgetc(bp);
+ BGETLE4(bp);
}
if(a.flags & T_SYM)
- a.sym = Bgetc(bp);
+ a.sym = BGETC(bp);
if(a.flags & T_FCONST)
skip(bp, 8);
else
if(a.flags & T_SCONST)
skip(bp, NSNAME);
if(a.flags & T_TYPE) {
- t = Bgetc(bp);
+ t = BGETC(bp);
if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
_offset(a.sym, off);
}
if(a.flags & T_GOTYPE)
- a.gotype = Bgetc(bp);
+ a.gotype = BGETC(bp);
return a;
}
skip(Biobuf *bp, int n)
{
while (n-- > 0)
- Bgetc(bp);
+ BGETC(bp);
}
* Found one. Skip until "\n!\n"
*/
for(;;) {
- if((c = Bgetc(bp)) == Beof)
+ if((c = BGETC(bp)) == Beof)
return -1;
if(c != '\n')
continue;
- c = Bgetc(bp);
+ c = BGETC(bp);
if(c != '!'){
Bungetc(bp);
continue;
}
- c = Bgetc(bp);
+ c = BGETC(bp);
if(c != '\n'){
Bungetc(bp);
continue;
p->type &= ~0x80;
if(p->type == 'z' || p->type == 'Z') {
o = Bseek(bp, 0, 1);
- if(Bgetc(bp) < 0) {
+ if(BGETC(bp) < 0) {
werrstr("can't read symbol name");
return -1;
}
for(;;) {
- c1 = Bgetc(bp);
- c2 = Bgetc(bp);
+ c1 = BGETC(bp);
+ c2 = BGETC(bp);
if(c1 < 0 || c2 < 0) {
werrstr("can't read symbol name");
return -1;