compilers: move more portable code out of swt.c [rsc] --rw-rw-r-- M 1221262 glenda sys 11028 Mar 26 09:53 sys/src/cmd/5c/swt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/5c/swt.c:174,206 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/5c/swt.c:174,179 return r; } - long - outlstring(ushort *s, long n) - { - char buf[2]; - int c; - long r; - - if(suppress) - return nstring; - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; - } - int mulcon(Node *n, Node *nn) { /n/sourcesdump/2006/0326/plan9/sys/src/cmd/5c/swt.c:296,311 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/5c/swt.c:269,274 } void - nullwarn(Node *l, Node *r) - { - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); - } - - void sextern(Sym *s, Node *a, long o, long w) { long e, lw; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/5c/swt.c:594,628 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/5c/swt.c:557,562 break; } return bp; - } - - void - ieeedtod(Ieee *ieee, double native) - { - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); } long [rsc] --rw-rw-r-- M 1221262 glenda sys 9022 Mar 26 09:53 sys/src/cmd/8c/swt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/8c/swt.c:127,170 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/8c/swt.c:127,133 return r; } - long - outlstring(ushort *s, long n) - { - char buf[2]; - int c; - long r; - - if(suppress) - return nstring; - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; - } - void - nullwarn(Node *l, Node *r) - { - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); - } - - void sextern(Sym *s, Node *a, long o, long w) { long e, lw; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/8c/swt.c:478,512 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/8c/swt.c:441,446 } if(t & T_TYPE) Bputc(b, a->type); - } - - void - ieeedtod(Ieee *ieee, double native) - { - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); } long [rsc] --rw-rw-r-- M 1221262 glenda sys 12170 Mar 26 09:53 sys/src/cmd/cc/cc.h /n/sourcesdump/2006/0326/plan9/sys/src/cmd/cc/cc.h:476,482 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/cc/cc.h:476,481 EXTERN int fproundflg; EXTERN int profileflg; EXTERN Bits zbits; - EXTERN int little; extern char *onames[], *tnames[], *gnames[]; extern char *cnames[], *qnames[], *bnames[]; [rsc] --rw-rw-r-- M 1221262 glenda sys 24178 Mar 26 09:53 sys/src/cmd/cc/lex.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/cc/lex.c:62,68 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/cc/lex.c:62,67 } thechar = '0'; thestring = "spim"; - little = 1; break; case 'o': [rsc] --rw-rw-r-- M 1221262 rsc sys 1969 Mar 26 09:53 sys/src/cmd/cc/pswt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/cc/pswt.c:64,66 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/cc/pswt.c:64,131 cases = c; } + long + outlstring(ushort *s, long n) + { + char buf[2]; + int c; + long r; + + if(suppress) + return nstring; + while(nstring & 1) + outstring("", 1); + r = nstring; + while(n > 0) { + c = *s++; + if(align(0, types[TCHAR], Aarg1)) { + buf[0] = c>>8; + buf[1] = c; + } else { + buf[0] = c; + buf[1] = c>>8; + } + outstring(buf, 2); + n -= sizeof(ushort); + } + return r; + } + + void + nullwarn(Node *l, Node *r) + { + warn(Z, "result of operation not used"); + if(l != Z) + cgen(l, Z); + if(r != Z) + cgen(r, Z); + } + + void + ieeedtod(Ieee *ieee, double native) + { + double fr, ho, f; + int exp; + + if(native < 0) { + ieeedtod(ieee, -native); + ieee->h |= 0x80000000L; + return; + } + if(native == 0) { + ieee->l = 0; + ieee->h = 0; + return; + } + fr = frexp(native, &exp); + f = 2097152L; /* shouldnt use fp constants here */ + fr = modf(fr*f, &ho); + ieee->h = ho; + ieee->h &= 0xfffffL; + ieee->h |= (exp+1022L) << 20; + f = 65536L; + fr = modf(fr*f, &ho); + ieee->l = ho; + ieee->l <<= 16; + ieee->l |= (long)(fr*f); + } [rsc] --rw-rw-r-- M 1221262 glenda sys 10226 Mar 26 09:53 sys/src/cmd/kc/swt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/kc/swt.c:146,176 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/kc/swt.c:146,151 return r; } - long - outlstring(ushort *s, long n) - { - char buf[2]; - int c; - long r; - - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; - } - int mulcon(Node *n, Node *nn) { /n/sourcesdump/2006/0326/plan9/sys/src/cmd/kc/swt.c:261,276 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/kc/swt.c:236,241 } void - nullwarn(Node *l, Node *r) - { - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); - } - - void sextern(Sym *s, Node *a, long o, long w) { long e, lw; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/kc/swt.c:555,589 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/kc/swt.c:520,525 Bputc(b, l>>24); break; } - } - - void - ieeedtod(Ieee *ieee, double native) - { - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); } long [rsc] --rw-rw-r-- M 1221262 glenda sys 10306 Mar 26 09:53 sys/src/cmd/qc/swt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/qc/swt.c:148,180 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/qc/swt.c:148,153 return r; } - long - outlstring(ushort *s, long n) - { - char buf[2]; - int c; - long r; - - if(suppress) - return nstring; - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; - } - int mulcon(Node *n, Node *nn) { /n/sourcesdump/2006/0326/plan9/sys/src/cmd/qc/swt.c:265,280 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/qc/swt.c:238,243 } void - nullwarn(Node *l, Node *r) - { - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); - } - - void sextern(Sym *s, Node *a, long o, long w) { long e, lw; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/qc/swt.c:562,596 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/qc/swt.c:525,530 break; } return bp; - } - - void - ieeedtod(Ieee *ieee, double native) - { - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); } long [rsc] --rw-rw-r-- M 1221262 glenda sys 15561 Mar 26 09:44 sys/src/cmd/tcs/tcs.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/tcs/tcs.c:54,60 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/tcs/tcs.c:54,60 clean = 1; break; case 'f': - from = ARGF(); + from = EARGF(usage()); break; case 'l': listem = 1; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/tcs/tcs.c:63,69 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/tcs/tcs.c:63,69 squawk = 0; break; case 't': - to = ARGF(); + to = EARGF(usage()); break; case 'v': verbose = 1; [rsc] --rw-rw-r-- M 1221262 glenda sys 10367 Mar 26 09:53 sys/src/cmd/vc/swt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/vc/swt.c:142,172 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/vc/swt.c:142,147 return r; } - long - outlstring(ushort *s, long n) - { - char buf[2]; - int c; - long r; - - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; - } - int mulcon(Node *n, Node *nn) { /n/sourcesdump/2006/0326/plan9/sys/src/cmd/vc/swt.c:259,274 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/vc/swt.c:234,239 } void - nullwarn(Node *l, Node *r) - { - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); - } - - void sextern(Sym *s, Node *a, long o, long w) { long e, lw; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/vc/swt.c:560,594 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/vc/swt.c:525,530 return bp; } - void - ieeedtod(Ieee *ieee, double native) - { - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); - } - long align(long i, Type *t, int op) { /n/sourcesdump/2006/0326/plan9/sys/src/cmd/vc/swt.c:636,642 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/vc/swt.c:572,578 w = SZ_LONG; break; } - if (!little) + if(thechar == 'v') o += SZ_LONG - w; /* big endian adjustment */ w = 1; break; [rsc] --rw-rw-r-- M 1221262 glenda sys 23728 Mar 26 09:53 sys/src/cmd/vl/obj.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/vl/obj.c:86,92 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/vl/obj.c:86,92 USED(argc); if(*argv == 0) { - diag("usage: vl [-options] objects"); + diag("usage: %cl [-options] objects", thechar); errorexit(); } if(!debug['9'] && !debug['U'] && !debug['B']) [rsc] --rw-rw-r-- M 1221262 glenda sys 9703 Mar 26 09:53 sys/src/cmd/7c/swt.c /n/sourcesdump/2006/0326/plan9/sys/src/cmd/7c/swt.c:162,192 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/7c/swt.c:162,167 return r; } - long - outlstring(ushort *s, long n) - { - char buf[2]; - int c; - long r; - - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; - } - int mulcon(Node *n, Node *nn) { /n/sourcesdump/2006/0326/plan9/sys/src/cmd/7c/swt.c:279,294 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/7c/swt.c:254,259 } void - nullwarn(Node *l, Node *r) - { - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); - } - - void sextern(Sym *s, Node *a, long o, long w) { long e, lw; /n/sourcesdump/2006/0326/plan9/sys/src/cmd/7c/swt.c:533,567 - /n/sourcesdump/2006/0327/plan9/sys/src/cmd/7c/swt.c:498,503 break; } return bp; - } - - void - ieeedtod(Ieee *ieee, double native) - { - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); } long [rsc] --rw-rw-r-- M 1221262 glenda sys 94721 Mar 26 09:42 sys/src/libhtml/build.c /n/sourcesdump/2006/0326/plan9/sys/src/libhtml/build.c:2246,2272 - /n/sourcesdump/2006/0327/plan9/sys/src/libhtml/build.c:2246,2265 { int obrkstate; int b; - int addit; // don't want break before our null item unless the previous item // was also a null item for the purposes of line breaking obrkstate = ps->curstate&(IFbrk|IFbrksp); b = IFnobrk; - addit = 0; if(ps->lastit != nil) { if(ps->lastit->tag == Ispacertag) { if(((Ispacer*)ps->lastit)->spkind == ISPvline) b = IFbrk; - addit = 1; } - else if(ps->lastit->tag == Ifloattag) - addit = 1; } - if(addit) { - ps->curstate = (ps->curstate&~(IFbrk|IFbrksp))|b; - additem(ps, newispacer(ISPvline), nil); - ps->curstate = (ps->curstate&~(IFbrk|IFbrksp))|obrkstate; - } + ps->curstate = (ps->curstate&~(IFbrk|IFbrksp))|b; + additem(ps, newispacer(ISPvline), nil); + ps->curstate = (ps->curstate&~(IFbrk|IFbrksp))|obrkstate; addbrk(ps, 0, clr); }