From 48f0b3eb836162d41622cedc1eb5f5168168fb8e Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Sun, 1 Feb 1998 11:26:21 +0100 Subject: Import Dev86src-0.13.5.tar.gz --- bcc/align.h | 2 +- bcc/assign.c | 14 ++++---- bcc/bcc.c | 106 ++++++++++++++++++++++----------------------------------- bcc/codefrag.c | 76 ++++++++++++++++++++--------------------- bcc/debug.c | 2 +- bcc/declare.c | 32 ++++++++--------- bcc/express.c | 2 +- bcc/exptree.c | 2 +- bcc/function.c | 8 ++--- bcc/gencode.c | 38 ++++++++++----------- bcc/gencode.h | 34 +++++++++--------- bcc/genloads.c | 38 ++++++++++----------- bcc/glogcode.c | 4 +-- bcc/hardop.c | 16 ++++----- bcc/label.c | 12 +++---- bcc/loadexp.c | 14 ++++---- bcc/longop.c | 2 +- bcc/output.c | 12 +++---- bcc/preserve.c | 8 ++--- bcc/proto.h | 48 +++++++++++++------------- bcc/sizes.h | 6 ++-- bcc/softop.c | 66 +++++++++++++++++++++++------------ bcc/state.c | 24 ++++++------- bcc/type.c | 20 +++++------ bcc/type.h | 12 +++---- bcc/types.h | 14 ++++---- 26 files changed, 304 insertions(+), 308 deletions(-) (limited to 'bcc') diff --git a/bcc/align.h b/bcc/align.h index 2fce75d..422471b 100644 --- a/bcc/align.h +++ b/bcc/align.h @@ -12,4 +12,4 @@ # endif #endif -extern uoffset_t alignmask; /* general alignment mask */ +extern uoffset_T alignmask; /* general alignment mask */ diff --git a/bcc/assign.c b/bcc/assign.c index 977d23e..f7e2853 100644 --- a/bcc/assign.c +++ b/bcc/assign.c @@ -12,7 +12,7 @@ FORWARD void blockmove P((struct symstruct *source, struct symstruct *target)); FORWARD void call3 P((char *funcname, struct symstruct *target, - struct symstruct *source, uoffset_t size)); + struct symstruct *source, uoffset_T size)); FORWARD void fconvert P((struct symstruct *source, struct typestruct *type)); PUBLIC void assign(source, target) @@ -129,7 +129,7 @@ struct symstruct *source; struct symstruct *target; { struct symstruct oldtarget; - uoffset_t typesize; + uoffset_T typesize; struct symstruct worksource; oldtarget = *target; @@ -176,10 +176,10 @@ PRIVATE void call3(funcname, target, source, size) char *funcname; struct symstruct *target; struct symstruct *source; -uoffset_t size; +uoffset_T size; { store_pt regpushed; - offset_t spmark; + offset_T spmark; struct symstruct *length; pushlist(regpushed = reguse & ~calleemask); @@ -203,9 +203,9 @@ struct typestruct *type; struct symstruct *target; { scalar_t newscalar; - uoffset_t newsize; + uoffset_T newsize; scalar_t oldscalar; - uoffset_t oldsize; + uoffset_T oldsize; store_pt targreg; if (type->constructor & (ARRAY | FUNCTION) @@ -356,7 +356,7 @@ PRIVATE void fconvert(source, type) struct symstruct *source; struct typestruct *type; { - offset_t spmark; + offset_T spmark; pushlist(reguse & OPREG); spmark = sp; diff --git a/bcc/bcc.c b/bcc/bcc.c index 1200926..643f766 100644 --- a/bcc/bcc.c +++ b/bcc/bcc.c @@ -45,7 +45,7 @@ #define EXESUF #endif -#if defined(__minix) || defined(_AIX) || defined(__BCC__) +#if defined(__minix) || defined(__BCC__) #define realpath(x,y) 0 #endif @@ -57,7 +57,6 @@ #define CC1_MINUS_O_BROKEN FALSE #define CPP "bcc-cc1" EXESUF #define CPPFLAGS "-E" -#define CRT0 "crt0.o" #define GCC "gcc" #define LD "ld86" EXESUF #define UNPROTO "unproto" EXESUF @@ -135,15 +134,6 @@ PRIVATE struct arg_s ccargs = { CC1, CC1_MINUS_O_BROKEN, }; PRIVATE struct arg_s cppargs = { CPP, }; PRIVATE struct arg_s unprotoargs = { UNPROTO, TRUE }; PRIVATE struct arg_s optargs = { OPTIM }; -#ifdef STANDARD_CRT0_PREFIX -PRIVATE struct prefix_s crt0_prefix = { STANDARD_CRT0_PREFIX, }; -#endif -#ifdef STANDARD_CRT0_0_PREFIX -PRIVATE struct prefix_s crt0_0_prefix = { STANDARD_CRT0_0_PREFIX, }; -#endif -#ifdef STANDARD_CRT0_3_PREFIX -PRIVATE struct prefix_s crt0_3_prefix = { STANDARD_CRT0_3_PREFIX, }; -#endif PRIVATE struct prefix_s exec_prefix; PRIVATE struct arg_s ldargs = { LD, }; #ifdef BAS86 @@ -201,7 +191,6 @@ FORWARD void startarg P((struct arg_s *argp)); FORWARD char *stralloc P((char *s)); FORWARD char *stralloc2 P((char *s1, char *s2)); FORWARD void trap P((int signum)); -FORWARD void unsupported P((char *option, char *message)); FORWARD void writen P((void)); FORWARD void writes P((char *s)); FORWARD void writesn P((char *s)); @@ -232,9 +221,6 @@ char **argv; bool_T cpp_pass = TRUE; #else bool_T cpp_pass = FALSE; -#endif -#ifdef BCC86 - char *crt0; #endif char *libc = "-lc"; #ifdef MSDOS @@ -242,12 +228,12 @@ char **argv; #else char major_mode = 0; #endif + bool_T has_crt0 = TRUE; bool_T debug = FALSE; bool_T echo = FALSE; unsigned errcount = 0; char ext; char *f_out = NUL_PTR; - bool_T float_emulation = FALSE; #ifdef BAS86 bool_T gnu_objects = FALSE; #endif @@ -263,6 +249,7 @@ char **argv; bool_T profile = FALSE; bool_T prep_only = FALSE; bool_T prep_line_numbers = FALSE; + bool_T compiler_warnings = TRUE; int status; char *temp; bool_T patch_exe = FALSE; /* Hackish patch to convert minix i386->OMAGIC */ @@ -334,13 +321,8 @@ char **argv; case 'e': cpp_pass = TRUE; break; - case 'f': - float_emulation = TRUE; - ++errcount; - unsupported(arg, "float emulation"); - break; case 'g': - debug = TRUE; /* unsupported( arg, "debug" ); */ + debug = TRUE; /* unsupported */ break; case 'o': if (argc <= 1) @@ -359,15 +341,20 @@ char **argv; break; case 'p': profile = TRUE; - ++errcount; - unsupported(arg, "profile"); break; case 'v': ++verbosity; break; + case 'w': + compiler_warnings = FALSE; + aswarn = FALSE; + break; case 'W': aswarn = TRUE; break; + case 'x': + has_crt0 = FALSE; + break; case 'I': add_default_inc = 0; break; @@ -391,6 +378,10 @@ char **argv; adddefine("-D__STDC__=0"); } break; + case 't': + addarg(&asargs, "-t"); + addarg(&asargs, arg+2); + break; case 'A': addarg(&asargs, arg + 2); break; @@ -436,10 +427,6 @@ char **argv; case 'T': tmpdir = arg + 2; break; - case 't': - ++errcount; - unsupported(arg, "pass number"); - break; default: *argdone = FALSE; break; @@ -486,7 +473,6 @@ char **argv; libc= "-ldos"; adddefine("-D__MSDOS__"); addarg(&ldargs, "-d"); - addarg(&ldargs, "-s"); addarg(&ldargs, "-T100"); break; @@ -525,7 +511,11 @@ char **argv; libc= "-lc"; adddefine("-D__linux__"); adddefine("-D__unix__"); +#ifdef __linux__ addarg(&ldargs, "-N"); /* Make OMAGIC */ +#else + patch_exe = TRUE; +#endif break; case '?': @@ -598,16 +588,10 @@ char **argv; #ifdef BCC86 #ifdef STANDARD_CRT0_3_PREFIX if (bits32) - { bits_arg = "-3"; - crt0 = fixpath(CRT0, &crt0_3_prefix, R_OK); - } else #endif - { bits_arg = "-0"; - crt0 = fixpath(CRT0, &crt0_0_prefix, R_OK); - } addarg(&ccargs, bits_arg); addarg(&cppargs, bits_arg); addarg(&asargs, bits_arg); @@ -616,15 +600,11 @@ char **argv; { addarg(&ldargs, bits_arg); addarg(&ldrargs, bits_arg); - /* addarg(&ldargs, crt0);*/ - addarg(&ldargs, "-C0"); + if( has_crt0 ) + addarg(&ldargs, "-C0"); } #endif /* BAS86 */ #endif /* BCC86 */ -#if defined(BAS86) && !defined(BCC86) - if (!gnu_objects) - addarg(&ldargs, fixpath(CRT0, &crt0_prefix, R_OK)); -#endif set_trap(); /* Pass 2 over argv to compile and assemble .c, .i, .S and .s files and @@ -839,15 +819,19 @@ char * fname; { /* OMAGIC */ -#define AOUT_MAG 0x640107L -#define ELKS_MAG1 0x1010 -#define ELKS_MAG2 0x1011 /* -z */ -#define ELKS_MAG3 0x1020 /* -i */ -#define ELKS_MAG4 0x1021 /* -i -z */ +#define AOUT_MAG "\x07\x01\x64\x00" /* 0x640107L */ +#define ELKS_MAG1 0x10 +#define ELKS_MAG2 0x11 /* -z */ +#define ELKS_MAG3 0x20 /* -i */ +#define ELKS_MAG4 0x21 /* -i -z */ static struct ELKS_exec { /* ELKS a.out header */ - long a_magic; /* magic number */ - long a_hdrlen; /* length, etc of header */ + char a_magic1; /* magic number */ + char a_magic2; /* magic number */ + char a_magic3; /* magic number */ + char a_magic4; /* magic number */ + char a_hdrlen; /* length, etc of header */ + char a_hdrlen3[3]; long a_text; /* size of text segement in bytes */ long a_data; /* size of data segment in bytes */ long a_bss; /* size of bss segment in bytes */ @@ -858,7 +842,7 @@ static struct ELKS_exec { /* ELKS a.out header */ static struct aout_exec { - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ + char a_info[4]; /* Use macros N_MAGIC, etc for access */ unsigned a_text; /* length of text, in bytes */ unsigned a_data; /* length of data, in bytes */ unsigned a_bss; /* length of uninitialized data area, in bytes */ @@ -879,32 +863,33 @@ static struct aout_exec { return; } - if( instr.a_hdrlen != 0x20 || (instr.a_magic & 0xFFFF) != 0x0301 ) + if( instr.a_hdrlen != 0x20 || instr.a_magic1 != 0x01 || + instr.a_magic2 != 0x03 || instr.a_magic4 != 0x10 ) { - writesn("Executable cannot be converted to OMAGIC"); + writesn("Executable cannot be converted to OMAGIC - bad magics"); return; } - switch((int)(instr.a_magic >> 16)) + switch((int)(instr.a_magic3)) { case ELKS_MAG1: - outstr.a_info = AOUT_MAG; break; case ELKS_MAG2: - writesn("Executable cannot be converted to OMAGIC"); + writesn("Executable cannot be converted to OMAGIC (compiled with -z)"); return; case ELKS_MAG3: case ELKS_MAG4: writesn("Executable file is split I/D, data overlaps text"); return; default: - writesn("Executable cannot be converted to OMAGIC"); + writesn("Executable cannot be converted to OMAGIC (unknown type)"); return; } if( instr.a_syms != 0 ) writesn("Warning: executable file isn't stripped"); + memcpy(outstr.a_info, AOUT_MAG, 4); outstr.a_text = instr.a_text; outstr.a_data = instr.a_data; outstr.a_bss = instr.a_bss; @@ -1337,17 +1322,6 @@ int signum; fatal(""); } -PRIVATE void unsupported(option, message) -char *option; -char *message; -{ - show_who("compiler option "); - writes(option); - writes(" ("); - writes(message); - writesn(") not supported yet"); -} - PRIVATE void writen() { writes("\n"); diff --git a/bcc/codefrag.c b/bcc/codefrag.c index 0423a44..e4359bb 100644 --- a/bcc/codefrag.c +++ b/bcc/codefrag.c @@ -121,12 +121,12 @@ PRIVATE void adjcarry() { outop3str("rcl\t"); outregname(DXREG); - outncimmadr((offset_t) 9); + outncimmadr((offset_T) 9); outand(); bumplc2(); bumplc2(); outregname(DXREG); - outncimmadr((offset_t) 0x100); + outncimmadr((offset_T) 0x100); } PUBLIC void clrBreg() { @@ -608,22 +608,22 @@ PUBLIC void adc0() { outadc(); outhiaccum(); - outncimmadr((offset_t) 0); + outncimmadr((offset_T) 0); } } /* add constant to register */ PUBLIC void addconst(offset, reg) -offset_t offset; +offset_T offset; store_pt reg; { #ifdef I8088 #ifdef I80386 - if ((i386_32 && (uoffset_t) offset + 1 <= 2) /* do -1 to 1 by dec/inc */ - || (!i386_32 && (uoffset_t) offset + 2 <= 4)) /* do -2 to 2 */ + if ((i386_32 && (uoffset_T) offset + 1 <= 2) /* do -1 to 1 by dec/inc */ + || (!i386_32 && (uoffset_T) offset + 2 <= 4)) /* do -2 to 2 */ #else - if ((uoffset_t) offset + 2 <= 4) /* do -2 to 2 */ + if ((uoffset_T) offset + 2 <= 4) /* do -2 to 2 */ #endif { if (reg == ALREG) @@ -668,7 +668,7 @@ store_pt reg; /* adjust lc for signed offset */ PUBLIC void adjlc(offset, reg) -offset_t offset; +offset_T offset; store_pt reg; { if (!(reg & CHARREGS)) @@ -704,7 +704,7 @@ label_no label; else { outplus(); - outhex((uoffset_t) - sp); + outhex((uoffset_T) - sp); } #ifdef MC6809 outcregname(LOCAL); @@ -719,18 +719,18 @@ label_no label; /* and accumulator with constant */ PUBLIC void andconst(offset) -offset_t offset; +offset_T offset; { char_t botbits; - uoffset_t topbits; + uoffset_T topbits; - if ((topbits = offset & ~(uoffset_t) CHMASKTO & intmaskto) != 0 && - topbits != (~(uoffset_t) CHMASKTO & intmaskto)) + if ((topbits = offset & ~(uoffset_T) CHMASKTO & intmaskto) != 0 && + topbits != (~(uoffset_T) CHMASKTO & intmaskto)) /* if topbits == 0, callers reduce the type */ { #ifdef OP1 outandhi(); - outncimmadr((offset_t) (topbits >> (INT16BITSTO - CHBITSTO))); + outncimmadr((offset_T) (topbits >> (INT16BITSTO - CHBITSTO))); #else outandac(); #ifdef I80386 @@ -746,7 +746,7 @@ offset_t offset; else if (botbits != CHMASKTO) { outandlo(); - outncimmadr((offset_t) botbits); + outncimmadr((offset_T) botbits); } } @@ -805,7 +805,7 @@ PUBLIC label_no casejump() PRIVATE void clr(reg) store_pt reg; { - loadconst((offset_t) 0, reg); + loadconst((offset_T) 0, reg); } /* define common storage */ @@ -838,19 +838,19 @@ PUBLIC void cseg() /* define long */ PUBLIC void deflong(value) -uoffset_t value; +uoffset_T value; { - uoffset_t longhigh; - uoffset_t longlow; + uoffset_T longhigh; + uoffset_T longlow; - longlow = value & (uoffset_t) intmaskto; + longlow = value & (uoffset_T) intmaskto; #ifdef I80386 if (i386_32) defdword(); else #endif { - longhigh = (value >> INT16BITSTO) & (uoffset_t) intmaskto; + longhigh = (value >> INT16BITSTO) & (uoffset_T) intmaskto; defword(); #if DYNAMIC_LONG_ORDER if (long_big_endian) @@ -875,7 +875,7 @@ uoffset_t value; /* define null storage */ PUBLIC void defnulls(nullcount) -uoffset_t nullcount; +uoffset_T nullcount; { if (nullcount != 0) { @@ -946,7 +946,7 @@ bool_pt dataflag; { if (count < DEFSTR_BYTEMAX - 1) outcomma(); /* byte separator */ - outhex((uoffset_t) byte); + outhex((uoffset_T) byte); byte = (unsigned char) *sptr++; } outnl(); @@ -1044,7 +1044,7 @@ char *string; PUBLIC void equlab(label, offset) label_no label; -offset_t offset; +offset_T offset; { outbyte(LOCALSTARTCHAR); outlabel(label); @@ -1092,7 +1092,7 @@ store_pt reg; clr(reg); testhi(); sbranch(GE, exitlab = getlabel()); - loadconst((offset_t) - 1, reg); + loadconst((offset_T) - 1, reg); outnlabel(exitlab); #endif } @@ -1124,7 +1124,7 @@ char *name; /* load effective address */ PUBLIC void lea(offset, sourcereg, targreg) -offset_t offset; +offset_T offset; store_pt sourcereg; store_pt targreg; { @@ -1140,7 +1140,7 @@ store_pt targreg; /* load constant into given register */ PUBLIC void loadconst(offset, reg) -offset_t offset; +offset_T offset; store_pt reg; { #ifdef I8088 @@ -1304,7 +1304,7 @@ bool_pt uflag; { if (sign) negDreg(); - andconst((offset_t) divisor); /* if original divisor 0, this is + andconst((offset_T) divisor); /* if original divisor 0, this is null */ if (sign) negDreg(); @@ -1440,7 +1440,7 @@ PUBLIC void outhiaccum() /* print immediate address */ PUBLIC void outimmadr(offset) -offset_t offset; +offset_T offset; { #ifdef I8088 if (!isbyteoffset(offset)) @@ -1456,7 +1456,7 @@ offset_t offset; /* print register, comma, immediate address and adjust lc */ PUBLIC void outimadj(offset, targreg) -offset_t offset; +offset_T offset; store_pt targreg; { outregname(targreg); @@ -1492,7 +1492,7 @@ char *name; /* print separator, immediate address, newline */ PUBLIC void outncimmadr(offset) -offset_t offset; +offset_T offset; { #ifdef I8088 outcomma(); @@ -1507,7 +1507,7 @@ offset_t offset; /* print signed offset and adjust lc */ PUBLIC void outoffset(offset) -offset_t offset; +offset_T offset; { #ifdef MC6809 if (!is5bitoffset(offset)) @@ -1595,7 +1595,7 @@ PUBLIC void sbc0() { outsbc(); outhiaccum(); - outncimmadr((offset_t) 0); + outncimmadr((offset_T) 0); } } @@ -1603,7 +1603,7 @@ PUBLIC void sbc0() PUBLIC void set(name, value) char *name; -offset_t value; +offset_T value; { outccname(funcname); outbyte(LOCALSTARTCHAR); @@ -1644,7 +1644,7 @@ store_pt reg; if (shift != 1) bumplc(); outregname(reg); - outncimmadr((offset_t) shift); + outncimmadr((offset_T) shift); } return; } @@ -1666,7 +1666,7 @@ store_pt reg; outload(); outregname(SHIFTREG); outcomma(); - outimmadr((offset_t) shift); + outimmadr((offset_T) shift); outnl(); outsl(); outregname(reg); @@ -1698,7 +1698,7 @@ bool_pt uflag; if (shift != 1) bumplc(); outaccum(); - outncimmadr((offset_t) shift); + outncimmadr((offset_T) shift); } return; } @@ -1728,7 +1728,7 @@ bool_pt uflag; outload(); outregname(SHIFTREG); outcomma(); - outimmadr((offset_t) shift); + outimmadr((offset_T) shift); outnl(); if ((bool_t) uflag) outusr(); diff --git a/bcc/debug.c b/bcc/debug.c index 9e97ae7..e437f78 100644 --- a/bcc/debug.c +++ b/bcc/debug.c @@ -113,7 +113,7 @@ struct symstruct *item; break; default: outstr("bad storage ("); - outhex((uoffset_t) item->storage); + outhex((uoffset_T) item->storage); outbyte(')'); outstr(" offset "); } diff --git a/bcc/declare.c b/bcc/declare.c index 1c9b43a..73a8524 100644 --- a/bcc/declare.c +++ b/bcc/declare.c @@ -33,7 +33,7 @@ FORWARD void declarator P((void)); FORWARD void declarg P((void)); FORWARD struct typestruct *declenum P((void)); FORWARD void declfunc P((void)); -FORWARD void declselt P((struct typestruct *structype, offset_t *psoffset, +FORWARD void declselt P((struct typestruct *structype, offset_T *psoffset, struct typelist ** ptypelist)); FORWARD bool_pt declspec P((void)); FORWARD struct typestruct *declsu P((void)); @@ -89,7 +89,7 @@ PUBLIC void decllist() PRIVATE void declaf() { - uoffset_t asize; + uoffset_T asize; bool_t levelnew; #ifdef TESTING_PROTOTYPES char ogvarname[NAMESIZE]; @@ -253,7 +253,7 @@ PRIVATE struct typestruct *declenum() { register struct symstruct *esymptr; register struct typestruct *enumtype; - offset_t ordinal; + offset_T ordinal; nextsym(); if (sym != IDENT && sym != TYPEDEFNAME) @@ -314,13 +314,13 @@ PRIVATE struct typestruct *declenum() PRIVATE void declselt(structype, psoffset, ptypelist) struct typestruct *structype; -offset_t *psoffset; +offset_T *psoffset; struct typelist **ptypelist; { struct typestruct *basetype; value_t fieldwidth; value_t fwidth; - offset_t offset; + offset_T offset; scalar_t scalar=0; offset = *psoffset; @@ -521,8 +521,8 @@ break2: PRIVATE struct typestruct *declsu() { sym_t ogvarsc; - offset_t soffset; - offset_t struclength; + offset_T soffset; + offset_T struclength; sym_t susym; struct typelist *typelist; struct typestruct *structype; @@ -575,8 +575,8 @@ PRIVATE struct typestruct *declsu() PRIVATE void declfunc() { - offset_t argsp; - uoffset_t argsize; + offset_T argsp; + uoffset_T argsize; struct symstruct *symptr; int main_flag = 0; @@ -679,7 +679,7 @@ PRIVATE void idecllist() struct typestruct *basetype; struct typestruct *inittype; scopelev_t levelmark; - uoffset_t newoffset; + uoffset_T newoffset; argsallowed = level == GLBLEVEL; levelmark = level; @@ -862,12 +862,12 @@ PRIVATE void idecllist() PRIVATE void initarray(type) struct typestruct *type; { - uoffset_t basesize; + uoffset_T basesize; struct typestruct *basetype; - uoffset_t dimension; + uoffset_T dimension; char *stringend; - uoffset_t stringlength; - uoffset_t remaining; + uoffset_T stringlength; + uoffset_T remaining; if ((basesize = (basetype = type->nexttype)->typesize) == 0) dimension = remaining = 0; @@ -938,8 +938,8 @@ PRIVATE void initstruct(type) struct typestruct *type; { struct typestruct *memtype; - uoffset_t newoffset; - uoffset_t offset; + uoffset_T newoffset; + uoffset_T offset; struct typelist *typelist; offset = 0; diff --git a/bcc/express.c b/bcc/express.c index 22d5bed..66298d3 100644 --- a/bcc/express.c +++ b/bcc/express.c @@ -306,7 +306,7 @@ PRIVATE struct nodestruct *primary_exp() { bool_t isdefined; struct nodestruct *nodeptr; - uoffset_t stringlen; + uoffset_T stringlen; struct symstruct *symptr; struct symstruct *symptr1; bool_t waslparen; diff --git a/bcc/exptree.c b/bcc/exptree.c index 1a079e7..0f95439 100644 --- a/bcc/exptree.c +++ b/bcc/exptree.c @@ -252,7 +252,7 @@ struct nodestruct *p2; struct symstruct *source = NULL; /* for -Wall */ value_t sourceval = 0 ; /* for -Wall */ struct symstruct *target; - offset_t targszdelta; + offset_T targszdelta; value_t targval = 0; /* for -Wall */ scalar_t rscalar = 0; /* for -Wall */ bool_t uflag; diff --git a/bcc/function.c b/bcc/function.c index 5d30a40..85bf007 100644 --- a/bcc/function.c +++ b/bcc/function.c @@ -198,7 +198,7 @@ PUBLIC void loadretexpression() PUBLIC void listo(target, lastargsp) struct symstruct *target; -offset_t lastargsp; +offset_T lastargsp; { extend(target); push(target); @@ -364,11 +364,11 @@ PUBLIC void reslocals() PUBLIC void ret() { #ifdef FRAMEPOINTER - offset_t newsp; + offset_T newsp; if (framep != 0) { - newsp = -(offset_t) func1saveregsize; + newsp = -(offset_T) func1saveregsize; if (switchnow != NULL || newsp - sp >= 0x80) changesp(newsp, TRUE); else @@ -403,7 +403,7 @@ PUBLIC void ret() #else if (sp != 0) { - modstk(-(offset_t) func1saveregsize); + modstk(-(offset_T) func1saveregsize); poplist(callee1mask); } outreturn(); diff --git a/bcc/gencode.c b/bcc/gencode.c index a16ff74..8e0a0f5 100644 --- a/bcc/gencode.c +++ b/bcc/gencode.c @@ -37,7 +37,7 @@ PUBLIC store_pt allregs = BREG | DREG | DATREG1 | DATREG2 PUBLIC store_pt allregs = BREG | DREG | INDREG0 | INDREG1 | INDREG2; #endif PUBLIC store_pt allindregs = INDREG0 | INDREG1 | INDREG2; -PUBLIC uoffset_t alignmask = ~(uoffset_t) 0x0001; +PUBLIC uoffset_T alignmask = ~(uoffset_T) 0x0001; PUBLIC bool_t arg1inreg = FALSE; PUBLIC store_pt calleemask = INDREG1 | INDREG2; PUBLIC bool_t callersaves = FALSE; @@ -45,8 +45,8 @@ PUBLIC char *callstring = "call\t"; PUBLIC store_pt doubleargregs = DREG | INDREG0 | INDREG1 | INDREG2; PUBLIC store_pt doubleregs = DREG | INDREG0 | INDREG1 | INDREG2; PUBLIC store_pt doublreturnregs = DREG | INDREG0 | INDREG1 | INDREG2; -PUBLIC offset_t jcclonger = 3; -PUBLIC offset_t jmplonger = 1; +PUBLIC offset_T jcclonger = 3; +PUBLIC offset_T jmplonger = 1; PUBLIC char *jumpstring = "br \t"; PUBLIC char *regpulllist = "f2ax2ax2bx2si2di2bp2qx2qx2cx2dx2"; PUBLIC char *regpushlist = "dx2cx2qx2qx2bp2di2si2bx2ax2ax2f2"; @@ -76,7 +76,7 @@ PUBLIC char *stackregstr = "sp"; #ifdef MC6809 PUBLIC store_pt allregs = BREG | DREG | INDREG0 | INDREG1 | INDREG2; PUBLIC store_pt allindregs = INDREG0 | INDREG1 | INDREG2; -PUBLIC uoffset_t alignmask = ~(uoffset_t) 0x0000; +PUBLIC uoffset_T alignmask = ~(uoffset_T) 0x0000; PUBLIC bool_t arg1inreg = TRUE; PUBLIC store_pt calleemask = INDREG1 | INDREG2; PUBLIC bool_t callersaves = TRUE; @@ -84,8 +84,8 @@ PUBLIC char *callstring = "JSR\t>"; PUBLIC store_pt doubleargregs = DREG | INDREG0 | INDREG1 | INDREG2; PUBLIC store_pt doubleregs = DREG | INDREG0 | INDREG1 | INDREG2; PUBLIC store_pt doublreturnregs = DREG | INDREG0 | INDREG1 | INDREG2; -PUBLIC offset_t jcclonger = 2; -PUBLIC offset_t jmplonger = 1; +PUBLIC offset_T jcclonger = 2; +PUBLIC offset_T jmplonger = 1; PUBLIC char *jumpstring = "JMP\t>"; PUBLIC char *regpulllist = "CC1B1D2X2U2Y2DP1PC2"; PUBLIC char *regpushlist = "PC2DP1Y2U2X2D2B1CC1"; @@ -100,14 +100,14 @@ PUBLIC char *ireg2str = "Y"; PUBLIC char *localregstr = "S"; #endif -PUBLIC uoffset_t accregsize = 2; +PUBLIC uoffset_T accregsize = 2; #ifdef FRAMEPOINTER -PUBLIC uoffset_t frameregsize = 2; +PUBLIC uoffset_T frameregsize = 2; #endif -PUBLIC uoffset_t maxregsize = 2; -PUBLIC uoffset_t opregsize = 2; -PUBLIC uoffset_t pshregsize = 2; -PUBLIC uoffset_t returnadrsize = 2; +PUBLIC uoffset_T maxregsize = 2; +PUBLIC uoffset_T opregsize = 2; +PUBLIC uoffset_T pshregsize = 2; +PUBLIC uoffset_T returnadrsize = 2; #ifndef MC6809 PUBLIC uvalue_t intmaskto = 0xFFFFL; @@ -121,7 +121,7 @@ PUBLIC uvalue_t shortmaskto = 0xFFFFL; #endif PRIVATE store_pt callermask; -PRIVATE offset_t lastargsp; +PRIVATE offset_T lastargsp; PRIVATE smalin_t opdata[] = { @@ -391,7 +391,7 @@ PUBLIC void codeinit() #else allindregs = INDREG0 | INDREG1 | INDREG2; #endif - alignmask = ~(uoffset_t) 0x00000003; + alignmask = ~(uoffset_T) 0x00000003; calleemask = INDREG0 | INDREG1 | INDREG2; doubleargregs = DREG | DATREG2; doubleregs = DREG | DATREG2; @@ -470,11 +470,11 @@ struct nodestruct *exp; ccode_t condtrue; op_pt op; store_t regmark; - offset_t saveargsp = 0; /* for -Wall */ + offset_T saveargsp = 0; /* for -Wall */ store_t savelist = 0; /* for -Wall */ - offset_t saveoffset = 0; /* for -Wall */ + offset_T saveoffset = 0; /* for -Wall */ struct symstruct *source; - offset_t spmark; + offset_T spmark; struct symstruct *structarg = 0; /* for -Wall */ struct symstruct *target; @@ -536,7 +536,7 @@ struct nodestruct *exp; lastargsp = savelist = 0; if (exp->nodetype->constructor & STRUCTU) { - modstk(sp - (offset_t) exp->nodetype->typesize); + modstk(sp - (offset_T) exp->nodetype->typesize); onstack(structarg = constsym((value_t) 0)); } else @@ -615,7 +615,7 @@ struct nodestruct *exp; /* -2 skips for ax and bx */ /* need dirtymask to mostly avoid this */ savereturn(regmark & callermask & regregs, - spmark - 2 * (offset_t) pshregsize); + spmark - 2 * (offset_T) pshregsize); if (exp->nodetype->constructor & STRUCTU) { address(structarg); diff --git a/bcc/gencode.h b/bcc/gencode.h index a6b99ec..03de445 100644 --- a/bcc/gencode.h +++ b/bcc/gencode.h @@ -10,10 +10,10 @@ #define OPERANDSEPARATOR ',' /* char separating operands */ #define OPSEPARATOR '\t' /* char separating op string and operand */ -EXTERN uoffset_t arg1size; /* size of 1st arg to function */ +EXTERN uoffset_T arg1size; /* size of 1st arg to function */ /* zero after allocation of 1st arg */ EXTERN store_pt callee1mask; /* calleemask with doubleregs masked if nec */ -EXTERN uoffset_t dataoffset; /* amount of initialized data so far */ +EXTERN uoffset_T dataoffset; /* amount of initialized data so far */ #ifdef DEBUG EXTERN bool_t debugon; /* nonzero to print debugging messages */ /* depends on zero init */ @@ -21,11 +21,11 @@ EXTERN bool_t debugon; /* nonzero to print debugging messages */ #ifdef FRAMEPOINTER EXTERN store_pt framelist; /* bit pattern for frame and saved regs */ EXTERN store_pt frame1list; /* framelist with doubleregs masked if nec */ -EXTERN offset_t framep; /* hardware relative frame ptr */ +EXTERN offset_T framep; /* hardware relative frame ptr */ #endif -EXTERN uoffset_t func1saveregsize; /* choice of next two values */ -EXTERN uoffset_t funcdsaveregsize; /* funcsaveregsize adjusted for doubles */ -EXTERN uoffset_t funcsaveregsize; /* tot size of framelist/calleemask regs */ +EXTERN uoffset_T func1saveregsize; /* choice of next two values */ +EXTERN uoffset_T funcdsaveregsize; /* funcsaveregsize adjusted for doubles */ +EXTERN uoffset_T funcsaveregsize; /* tot size of framelist/calleemask regs */ #ifdef I80386 EXTERN bool_t i386_32; /* nonzero to generate 386 32 bit code */ /* depends on zero init */ @@ -34,7 +34,7 @@ EXTERN bool_t i386_32; /* nonzero to generate 386 32 bit code */ EXTERN bool_t long_big_endian; /* nonzero if high long word is first */ /* depends on zero init */ #endif -EXTERN offset_t lowsp; /* low water sp (collects locals in switch) */ +EXTERN offset_T lowsp; /* low water sp (collects locals in switch) */ #ifdef POSINDEPENDENT EXTERN bool_t posindependent; /* nonzero to generate pos-independent code */ /* depends on zero init */ @@ -44,8 +44,8 @@ EXTERN bool_t regarg; /* nonzero to show unloaded register arg */ /* depends on zero init */ EXTERN store_t reguse; /* registers in use */ EXTERN bool_t scanf_fp; /* nonzero if *scanf called with ptr-to-FP */ -EXTERN offset_t softsp; /* software sp (leads sp during declares) */ -EXTERN offset_t sp; /* hardware relative stack ptr */ +EXTERN offset_T softsp; /* software sp (leads sp during declares) */ +EXTERN offset_T sp; /* hardware relative stack ptr */ /* depends on zero init */ #ifdef FRAMEPOINTER EXTERN bool_t stackarg; /* nonzero to show function has arg on stack */ @@ -64,8 +64,8 @@ extern char *callstring; /* opcode string for call */ extern store_pt doubleargregs; /* mask (in) for regs for 1st arg if double */ extern store_pt doubleregs; /* mask (in) for regs to temp contain double */ extern store_pt doublreturnregs; /* mask (in) for regs for returning double */ -extern offset_t jcclonger; /* amount jcc long jumps are longer */ -extern offset_t jmplonger; /* amount long jumps is longer */ +extern offset_T jcclonger; /* amount jcc long jumps are longer */ +extern offset_T jmplonger; /* amount long jumps is longer */ extern char *jumpstring; /* opcode string for jump */ extern char *regpulllist; /* reg names and sizes (0 store_t bit first) */ extern char *regpushlist; /* reg names and sizes (0 store_t bit last) */ @@ -91,11 +91,11 @@ extern char *stackregstr; /* register sizes */ -extern uoffset_t accregsize; +extern uoffset_T accregsize; #ifdef FRAMEPOINTER -extern uoffset_t frameregsize; +extern uoffset_T frameregsize; #endif -extern uoffset_t maxregsize; -extern uoffset_t opregsize; -extern uoffset_t pshregsize; -extern uoffset_t returnadrsize; +extern uoffset_T maxregsize; +extern uoffset_T opregsize; +extern uoffset_T pshregsize; +extern uoffset_T returnadrsize; diff --git a/bcc/genloads.c b/bcc/genloads.c index 26933f8..652127e 100644 --- a/bcc/genloads.c +++ b/bcc/genloads.c @@ -71,14 +71,14 @@ PRIVATE void blockpush(source) struct symstruct *source; { struct symstruct *length; - offset_t spmark; - uoffset_t typesize; + offset_T spmark; + uoffset_T typesize; typesize = source->type->typesize; length = constsym((value_t) typesize); length->type = uitype; address(source); - modstk(spmark = sp - (offset_t) typesize); + modstk(spmark = sp - (offset_T) typesize); #ifdef STACKREG regtransfer(STACKREG, DREG); #else @@ -157,7 +157,7 @@ struct symstruct *target; #ifdef MC6809 bool_t canABX; #endif - uoffset_t size; + uoffset_T size; store_pt sourcereg; struct typestruct *targtype; store_pt targreg; @@ -348,8 +348,8 @@ store_pt targreg; if (source->storage == CONSTANT) { /* XXX - more for non-386 */ - loadconst(((offset_t *) source->offset.offd)[0], DREG); - loadconst(((offset_t *) source->offset.offd)[1], targreg); + loadconst(((offset_T *) source->offset.offd)[0], DREG); + loadconst(((offset_T *) source->offset.offd)[1], targreg); } else { @@ -368,7 +368,7 @@ store_pt targreg; float val; val = *source->offset.offd; - loadconst(((offset_t *) &val)[0], targreg); + loadconst(((offset_T *) &val)[0], targreg); } else if (source->indcount == 0 && source->storage != CONSTANT) loadadr(source, targreg); @@ -454,7 +454,7 @@ struct symstruct *source; store_pt targreg; { sc_t flags; - offset_t offset; + offset_T offset; store_t reg; struct typestruct *type; @@ -478,19 +478,19 @@ PUBLIC void loadreg(source, targreg) struct symstruct *source; store_pt targreg; { - offset_t longhigh; - offset_t longlow; + offset_T longhigh; + offset_T longlow; if (source->storage == CONSTANT) { if (source->type->scalar & CHAR && (store_t) targreg & ALLDATREGS) targreg = BREG; - longlow = (offset_t) source->offset.offv; + longlow = (offset_T) source->offset.offv; if (source->type->scalar & DLONG) { - longlow &= (offset_t) intmaskto; - longhigh = (offset_t) (source->offset.offv >> INT16BITSTO) - & (offset_t) intmaskto; + longlow &= (offset_T) intmaskto; + longhigh = (offset_T) (source->offset.offv >> INT16BITSTO) + & (offset_T) intmaskto; if ((store_t) targreg != LONGREG2) /* loading the whole long */ { #if DYNAMIC_LONG_ORDER @@ -589,7 +589,7 @@ store_pt targreg; #endif outregname(targreg); if (source->storage == CONSTANT) - adjlc((offset_t) source->offset.offv, targreg); + adjlc((offset_T) source->offset.offv, targreg); #ifdef I8088 outcomma(); #endif @@ -677,7 +677,7 @@ struct symstruct *adr; switch (adr->storage) { case CONSTANT: - outimmadr((offset_t) adr->offset.offv); + outimmadr((offset_T) adr->offset.offv); break; #ifdef I8088 case DREG: @@ -827,7 +827,7 @@ struct symstruct *adr; outlabel(adr->name.label); else if (*adr->name.namep == 0) /* constant address */ { - outhex((uoffset_t) adr->offset.offi); + outhex((uoffset_T) adr->offset.offi); break; } else @@ -998,7 +998,7 @@ struct symstruct *source; { store_t reg; #ifdef I8088 - uoffset_t size; + uoffset_T size; #endif scalar_t sscalar; @@ -1047,7 +1047,7 @@ struct symstruct *source; if (source->storage == CONSTANT) { unbumplc(); - adjlc((offset_t) source->offset.offv, INDREG0); + adjlc((offset_T) source->offset.offv, INDREG0); } if (size == 2) { diff --git a/bcc/glogcode.c b/bcc/glogcode.c index 279d625..782730f 100644 --- a/bcc/glogcode.c +++ b/bcc/glogcode.c @@ -219,7 +219,7 @@ ccode_t *pcondtrue; targreg = YREG; if (target->indcount != 0) load(target, targreg); - target->offset.offi -= (offset_t) intconst; + target->offset.offi -= (offset_T) intconst; loadreg(target, targreg); return TRUE; } @@ -237,7 +237,7 @@ bool_pt nojump; /* NB if nonzero, is ~0 so complement is 0 */ ccode_t condtrue; store_t regmark; struct symstruct *source; - offset_t spmark; + offset_T spmark; struct symstruct *target; regmark = reguse; diff --git a/bcc/hardop.c b/bcc/hardop.c index 187a4f5..2aa8f55 100644 --- a/bcc/hardop.c +++ b/bcc/hardop.c @@ -38,7 +38,7 @@ struct symstruct *target; extend(target); if (target->indcount != 0 || target->storage & reguse) loadany(target); - target->offset.offi += (offset_t) source->offset.offv; + target->offset.offi += (offset_T) source->offset.offv; } else if (source->indcount == 0) { @@ -64,7 +64,7 @@ PUBLIC void incdec(op, source) op_pt op; struct symstruct *source; { - offset_t bump; + offset_T bump; bool_t postflag; store_t regmark; struct symstruct *target; @@ -315,7 +315,7 @@ struct symstruct *target; load(target, DREG); opstr = opstring(op); if (source->storage == CONSTANT && op == ANDOP) - andconst((offset_t) source->offset.offv); + andconst((offset_T) source->offset.offv); #ifdef OP1 else if (tscalar & CHAR && !(sscalar & CHAR) && op != ANDOP) outload(); @@ -337,12 +337,12 @@ struct symstruct *target; if (!(sscalar & CHAR)) { outhiaccum(); - outncimmadr((offset_t) ((uoffset_t) source->offset.offv + outncimmadr((offset_T) ((uoffset_T) source->offset.offv >> (INT16BITSTO - CHBITSTO))); outop2str(opstr); } outregname(BREG); - outncimmadr((offset_t) source->offset.offv & CHMASKTO); + outncimmadr((offset_T) source->offset.offv & CHMASKTO); #else /* OP1 */ if (!(sscalar & CHAR)) { @@ -355,7 +355,7 @@ struct symstruct *target; if (i386_32 && !(sscalar & CHAR)) bumplc2(); # endif - outncimmadr((offset_t) source->offset.offv); + outncimmadr((offset_T) source->offset.offv); #endif /* OP1 */ } @@ -429,7 +429,7 @@ struct symstruct *source; struct symstruct *target; { label_no exitlab; - uoffset_t factor; + uoffset_T factor; label_no usignlab; if (source->indcount == 0 && source->storage != CONSTANT) @@ -482,7 +482,7 @@ struct symstruct *target; extend(target); if (target->indcount != 0 || target->storage & reguse) loadany(target); - target->offset.offi -= (offset_t) source->offset.offv; + target->offset.offi -= (offset_T) source->offset.offv; } else sub1(source, target); diff --git a/bcc/label.c b/bcc/label.c index b250d2b..64800d4 100644 --- a/bcc/label.c +++ b/bcc/label.c @@ -26,7 +26,7 @@ struct labdatstruct { label_no labnum; /* 0 if not active */ - offset_t lablc; /* location counter for branch or label */ + offset_T lablc; /* location counter for branch or label */ char *labpatch; /* buffer ptr for branch, NULL for label */ ccode_t labcond; /* condition code for branch */ }; @@ -58,7 +58,7 @@ PRIVATE char condnames[][2] = /* names of condition codes */ PRIVATE label_no lasthighlab = 0xFFFF+1; /* temp & temp init so labels fixed */ /* lint */ PRIVATE label_no lastlab; /* bss init to 0 */ -PRIVATE offset_t lc; /* bss init to 0 */ +PRIVATE offset_T lc; /* bss init to 0 */ PRIVATE struct labdatstruct vislab[MAXVISLAB]; /* bss, all labnum's init 0 */ PRIVATE smalin_t nextvislab; /* bss init to NULL */ @@ -159,9 +159,9 @@ PUBLIC void clearswitchlabels() /* return location counter */ -PUBLIC uoffset_t getlc() +PUBLIC uoffset_T getlc() { - return (uoffset_t) lc; + return (uoffset_T) lc; } /* define location of label and backpatch references to it */ @@ -174,7 +174,7 @@ label_no label; struct labdatstruct *labmax; struct labdatstruct *labmid; struct labdatstruct *labptrsave; - offset_t nlonger; + offset_T nlonger; outnlabel(label); { @@ -379,7 +379,7 @@ PUBLIC void outlabel(label) label_no label; { outbyte(LABELSTARTCHAR); - outhexdigs((uoffset_t) label); + outhexdigs((uoffset_T) label); } /* print label and newline */ diff --git a/bcc/loadexp.c b/bcc/loadexp.c index 6ecb82f..30f0b50 100644 --- a/bcc/loadexp.c +++ b/bcc/loadexp.c @@ -40,7 +40,7 @@ struct typestruct *type; struct symstruct *exprmark; struct nodestruct *lhs; struct symstruct *symptr; - uoffset_t value; + uoffset_T value; if (gvarsymptr->storage != GLOBAL) reslocals(); @@ -76,12 +76,12 @@ struct typestruct *type; float val; val = *symptr->offset.offd; - deflong(((uoffset_t *) &val)[0]); + deflong(((uoffset_T *) &val)[0]); } else { - deflong(((uoffset_t *) symptr->offset.offd)[0]); - deflong(((uoffset_t *) symptr->offset.offd)[1]); + deflong(((uoffset_T *) symptr->offset.offd)[0]); + deflong(((uoffset_T *) symptr->offset.offd)[1]); } etptr = etmark; /* XXX - stuff from end of function */ exprptr = exprmark; @@ -98,7 +98,7 @@ struct typestruct *type; switch (symptr->storage) { case CONSTANT: - value = (uoffset_t) symptr->offset.offv; + value = (uoffset_T) symptr->offset.offv; if (type->scalar & DLONG) { deflong(value); @@ -119,12 +119,12 @@ struct typestruct *type; { outlabel(symptr->name.label); outplus(); - outnhex((uoffset_t) symptr->offset.offi); + outnhex((uoffset_T) symptr->offset.offi); break; } if (*symptr->name.namep == 0) /* constant address */ { - outnhex((uoffset_t) symptr->offset.offi); + outnhex((uoffset_T) symptr->offset.offi); break; } outccname(symptr->name.namep); diff --git a/bcc/longop.c b/bcc/longop.c index 412ac25..2cdf62a 100644 --- a/bcc/longop.c +++ b/bcc/longop.c @@ -27,7 +27,7 @@ struct symstruct *target; store_t regmark; bool_t shiftflag; scalar_t scalar; - offset_t spmark; + offset_T spmark; pushlist(reglist = (regmark = reguse) & (OPREG | OPWORKREG)); reguse &= ~reglist; diff --git a/bcc/output.c b/bcc/output.c index 6bc4d04..e5db292 100644 --- a/bcc/output.c +++ b/bcc/output.c @@ -354,7 +354,7 @@ char *str; /* print unsigned offset, hex format */ PUBLIC void outhex(num) -uoffset_t num; +uoffset_T num; { #ifdef HEXSTARTCHAR if (num >= 10) @@ -370,7 +370,7 @@ uoffset_t num; /* print unsigned offset, hex format with digits only (no hex designator) */ PUBLIC void outhexdigs(num) -register uoffset_t num; +register uoffset_T num; { if (num >= 0x10) { @@ -431,7 +431,7 @@ int byte; /* print unsigned offset, hex format, then newline */ PUBLIC void outnhex(num) -uoffset_t num; +uoffset_T num; { outhex(num); outnl(); @@ -530,14 +530,14 @@ PUBLIC void outplus() /* print signed offset, hex format */ PUBLIC void outshex(num) -offset_t num; +offset_T num; { if (num >= -(maxoffsetto + 1)) { outminus(); num = -num; } - outhex((uoffset_t) num); + outhex((uoffset_T) num); } /* print string */ @@ -771,7 +771,7 @@ register value_t num; outminus(); num = -num; } - outuvalue((uoffset_t) num); + outuvalue((uoffset_T) num); } #endif /* DEBUG */ diff --git a/bcc/preserve.c b/bcc/preserve.c index 17ded07..c8a8cea 100644 --- a/bcc/preserve.c +++ b/bcc/preserve.c @@ -10,7 +10,7 @@ /* change stack ptr without changing condition codes */ PUBLIC void changesp(newsp, absflag) -offset_t newsp; +offset_T newsp; bool_pt absflag; { if (newsp != sp || ((bool_t) absflag && switchnow != NULL)) @@ -74,7 +74,7 @@ struct symstruct *target; /* change stack ptr */ PUBLIC void modstk(newsp) -offset_t newsp; +offset_T newsp; { if (newsp != sp) { @@ -173,11 +173,11 @@ PRIVATE smalin_t regoffset[] = {0, 0, 0, 1, 3, 2}; PUBLIC void savereturn(savelist, saveoffset) store_pt savelist; -offset_t saveoffset; +offset_T saveoffset; { store_t reg; smalin_t *regoffptr; - offset_t spoffset; + offset_T spoffset; if (savelist == 0) return; diff --git a/bcc/proto.h b/bcc/proto.h index 69eebb2..e4a6b38 100644 --- a/bcc/proto.h +++ b/bcc/proto.h @@ -13,7 +13,7 @@ void clrBreg P((void)); void comment P((void)); void ctoi P((void)); void defbyte P((void)); -void deflong P((uoffset_t value)); +void deflong P((uoffset_T value)); void defword P((void)); void defdword P((void)); void even P((void)); @@ -53,27 +53,27 @@ void outextended P((void)); void outncspregname P((void)); void outindframereg P((void)); void adc0 P((void)); -void addconst P((offset_t offset, store_pt reg)); -void adjlc P((offset_t offset, store_pt reg)); -void andconst P((offset_t offset)); +void addconst P((offset_T offset, store_pt reg)); +void adjlc P((offset_T offset, store_pt reg)); +void andconst P((offset_T offset)); void bssseg P((void)); label_no casejump P((void)); void common P((char *name)); void cseg P((void)); -void defnulls P((uoffset_t nullcount)); +void defnulls P((uoffset_T nullcount)); label_no defstr P((char *sptr, char *stop, bool_pt dataflag)); bool_pt diveasy P((value_t divisor, bool_pt uflag)); void dpseg P((void)); void dseg P((void)); void equ P((char *name, char *string)); -void equlab P((label_no label, offset_t offset)); +void equlab P((label_no label, offset_T offset)); void globl P((char *name)); void import P((char *name)); void itol P((store_pt reg)); void lcommlab P((label_no label)); void lcommon P((char *name)); -void lea P((offset_t offset, store_pt sourcereg, store_pt targreg)); -void loadconst P((offset_t offset, store_pt reg)); +void lea P((offset_T offset, store_pt sourcereg, store_pt targreg)); +void loadconst P((offset_T offset, store_pt reg)); int lslconst P((value_t shift, store_pt reg)); int lsrconst P((value_t shift, store_pt reg, bool_pt uflag)); bool_pt modeasy P((value_t divisor, bool_pt uflag)); @@ -82,19 +82,19 @@ void negreg P((store_pt reg)); char *opstring P((op_pt op)); void outccname P((char *name)); void outhiaccum P((void)); -void outimmadr P((offset_t offset)); -void outimadj P((offset_t offset, store_pt targreg)); +void outimmadr P((offset_T offset)); +void outimadj P((offset_T offset, store_pt targreg)); void outimmed P((void)); void outjumpstring P((void)); void outnccname P((char *name)); -void outncimmadr P((offset_t offset)); -void outoffset P((offset_t offset)); +void outncimmadr P((offset_T offset)); +void outoffset P((offset_T offset)); void public P((char *name)); void private P((char *name)); void regexchange P((store_pt sourcereg, store_pt targreg)); void regtransfer P((store_pt sourcereg, store_pt targreg)); void sbc0 P((void)); -void set P((char *name, offset_t value)); +void set P((char *name, offset_T value)); void sl1 P((store_pt reg)); void slconst P((value_t shift, store_pt reg)); void srconst P((value_t shift, bool_pt uflag)); @@ -144,7 +144,7 @@ void call P((char *name)); void function P((struct symstruct *source)); void ldregargs P((void)); void loadretexpression P((void)); -void listo P((struct symstruct *target, offset_t lastargsp)); +void listo P((struct symstruct *target, offset_T lastargsp)); void listroot P((struct symstruct *target)); void popframe P((void)); void reslocals P((void)); @@ -219,7 +219,7 @@ void bumplc3 P((void)); void clearfunclabels P((void)); void clearlabels P((char *patchbuf, char *patchtop)); void clearswitchlabels P((void)); -uoffset_t getlc P((void)); +uoffset_T getlc P((void)); void deflabel P((label_no label)); label_no gethighlabel P((void)); label_no getlabel P((void)); @@ -257,13 +257,13 @@ void openout P((char *oname)); void outbyte P((int ch)); void outcomma P((void)); void outcpplinenumber P((unsigned nr, char *fname, char *str)); -void outhex P((uoffset_t num)); -void outhexdigs P((uoffset_t num)); +void outhex P((uoffset_T num)); +void outhexdigs P((uoffset_T num)); void outline P((char *s)); void outminus P((void)); void outnl P((void)); void outnbyte P((int byte)); -void outnhex P((uoffset_t num)); +void outnhex P((uoffset_T num)); void outnop1str P((char *s)); void outnop2str P((char *s)); void outnstr P((char *s)); @@ -272,7 +272,7 @@ void outop1str P((char *s)); void outop2str P((char *s)); void outop3str P((char *s)); void outplus P((void)); -void outshex P((offset_t num)); +void outshex P((offset_T num)); void outstr P((char *s)); void outtab P((void)); void outudec P((unsigned num)); @@ -299,14 +299,14 @@ void skipline P((void)); void undefinestring P((char *str)); /* preserve.c */ -void changesp P((offset_t newsp, bool_pt absflag)); +void changesp P((offset_T newsp, bool_pt absflag)); void loadpres P((struct symstruct *source, struct symstruct *target)); -void modstk P((offset_t newsp)); +void modstk P((offset_T newsp)); void pres2 P((struct symstruct *source, struct symstruct *target)); void preserve P((struct symstruct *source)); store_pt preslval P((struct symstruct *source, struct symstruct *target)); void recovlist P((store_pt reglist)); -void savereturn P((store_pt savelist, offset_t saveoffset)); +void savereturn P((store_pt savelist, offset_T saveoffset)); /* sc.c */ int main P((int argc, char **argv)); @@ -323,7 +323,7 @@ void softop P((op_pt op, struct symstruct *source, struct symstruct *target)); /* state.c */ void compound P((void)); -void outswoffset P((offset_t offset)); +void outswoffset P((offset_T offset)); void outswstacklab P((void)); /* table.c */ @@ -359,7 +359,7 @@ struct typestruct *iscalartotype P((scalar_pt scalar)); struct typestruct *newtype P((void)); void outntypechar P((struct typestruct *type)); struct typestruct *pointype P((struct typestruct *type)); -struct typestruct *prefix P((constr_pt constructor, uoffset_t size, +struct typestruct *prefix P((constr_pt constructor, uoffset_T size, struct typestruct *type)); struct typestruct *promote P((struct typestruct *type)); struct typestruct *tounsigned P((struct typestruct *type)); diff --git a/bcc/sizes.h b/bcc/sizes.h index df0d141..866b203 100644 --- a/bcc/sizes.h +++ b/bcc/sizes.h @@ -21,12 +21,12 @@ #define MINSCHTO (-128) /* minimum signed character */ #ifdef MC6809 -# define is5bitoffset(n) ((uoffset_t) (n) + 0x10 < 0x20) +# define is5bitoffset(n) ((uoffset_T) (n) + 0x10 < 0x20) #endif -#define isbyteoffset(n) ((uoffset_t) (n) - MINSCHTO <= MAXSCHTO - MINSCHTO) +#define isbyteoffset(n) ((uoffset_T) (n) - MINSCHTO <= MAXSCHTO - MINSCHTO) #define ischarconst(n) ((uvalue_t) (n) <= MAXUCHTO) #define isnegbyteoffset(n) ((uvalue_t) (n) + MAXSCHTO <= MAXSCHTO - MINSCHTO) -#define isshortbranch(n) ((uoffset_t) (n) - MINSCHTO <= MAXSCHTO - MINSCHTO) +#define isshortbranch(n) ((uoffset_T) (n) - MINSCHTO <= MAXSCHTO - MINSCHTO) #ifdef MC6809 /* Hack to reduce number of direct page variables. */ diff --git a/bcc/softop.c b/bcc/softop.c index 6f2dbce..e2e2b25 100644 --- a/bcc/softop.c +++ b/bcc/softop.c @@ -188,36 +188,58 @@ struct symstruct *target; extend(target); load(target, DREG); - load(source, OPREG); - switch ((op_t) op) +#ifndef IN_FUNC /* I8088 ? */ + if ((op_t) op != DIVOP && (op_t) op != MODOP ) { - case DIVOP: + load(source, DATREG1); /* CX */ + switch ((op_t) op) + { + case MULOP: + outnop2str("imul\tcx"); + break; + case SLOP: + outnop2str("shl\tax,cl"); + break; + case SROP: + if (uflag) outnop2str("shr\tax,cl"); + else outnop2str("sar\tax,cl"); + break; + } + } + else +#endif + { + load(source, OPREG); + switch ((op_t) op) + { + case DIVOP: #ifdef I8088 - call("idiv_"); + call("idiv_"); #else - call("idiv"); + call("idiv"); #endif - break; - case MODOP: - call("imod"); - break; - case MULOP: + break; + case MODOP: + call("imod"); + break; + case MULOP: #ifdef I8088 - call("imul_"); + call("imul_"); #else - call("imul"); + call("imul"); #endif - break; - case SLOP: - call("isl"); - break; - case SROP: - call("isr"); - break; + break; + case SLOP: + call("isl"); + break; + case SROP: + call("isr"); + break; + } + if (uflag) + outbyte('u'); + outnl(); } - if (uflag) - outbyte('u'); - outnl(); target->type = iscalartotype(resultscalar); poplist(regpushed); reguse = regmark; diff --git a/bcc/state.c b/bcc/state.c index 6a83963..9fdb224 100644 --- a/bcc/state.c +++ b/bcc/state.c @@ -28,7 +28,7 @@ struct loopstruct struct symstruct *exprmark; /* expression symbols built during loop */ struct symstruct *locmark; /* local variables built during loop */ struct loopstruct *prevloop; /* previous active for, switch or while */ - offset_t spmark; /* stack value for continue and break */ + offset_T spmark; /* stack value for continue and break */ }; struct switchstruct @@ -105,7 +105,7 @@ PRIVATE void deleteloop() PRIVATE void evalexpression(exp) struct nodestruct *exp; { - offset_t spmark; + offset_T spmark; spmark = sp; makeleaf(exp); @@ -172,13 +172,13 @@ PUBLIC void compound() /* have just seen "{" */ struct symstruct *locmark; store_t regmark; #ifdef FRAMEPOINTER - offset_t framepmark; - offset_t softspmark; + offset_T framepmark; + offset_T softspmark; #else /* softsp == sp here unless level == ARGLEVEL so mark is unnec */ /* this is also true if funcsaveregsize != 0 but the tests are too messy */ #endif - offset_t spmark; + offset_T spmark; locmark = locptr; regmark = reguse; @@ -249,7 +249,7 @@ PRIVATE void doasm() PRIVATE void dobreak() { - offset_t spmark; + offset_T spmark; if (loopnow == NULL) badloop(); @@ -312,7 +312,7 @@ ts_s_case_tot += GROWCASES * sizeof (struct casestruct); PRIVATE void docont() { struct loopstruct *contloop; - offset_t spmark; + offset_T spmark; struct switchstruct *switchthen; for (contloop = loopnow, switchthen = switchnow; ; @@ -472,7 +472,7 @@ PRIVATE void doif() PRIVATE void doreturn() { - offset_t spmark; + offset_T spmark; spmark = sp; if (sym != SEMICOLON) /* returning expression */ @@ -485,7 +485,7 @@ PRIVATE void doswitch() { struct switchstruct *sw; struct loopstruct switchloop; - offset_t spmark = 0; /* for -Wall */ + offset_T spmark = 0; /* for -Wall */ label_no sdecidelab; sw = (struct switchstruct *) ourmalloc(sizeof *sw); @@ -590,7 +590,7 @@ PRIVATE void jumptocases() while (caseptr <= casetop) { outsub(); - outimadj((offset_t) (caseptr->casevalue - basevalue), targreg); + outimadj((offset_T) (caseptr->casevalue - basevalue), targreg); basevalue = caseptr->casevalue; for (case1ptr = caseptr; case1ptr < casetop; ++case1ptr) if (case1ptr->casevalue < (case1ptr + 1)->casevalue - 10) @@ -604,7 +604,7 @@ PRIVATE void jumptocases() { lbranch(lowcondition, dfaultlab); outcmp(); - outimadj((offset_t) (case1ptr->casevalue - basevalue), targreg); + outimadj((offset_T) (case1ptr->casevalue - basevalue), targreg); lbranch(HI, zjtablelab = getlabel()); if (charselector) ctoi(); @@ -657,7 +657,7 @@ PRIVATE void jumptocases() } PUBLIC void outswoffset (offset) -offset_t offset; +offset_T offset; { #ifdef FRAMEPOINTER outoffset(offset - softsp - framep); diff --git a/bcc/type.c b/bcc/type.c index fe66b33..97d88d7 100644 --- a/bcc/type.c +++ b/bcc/type.c @@ -13,12 +13,12 @@ #define EXTERN #include "type.h" -PUBLIC uoffset_t ctypesize = 1; -PUBLIC uoffset_t dtypesize = 8; -PUBLIC uoffset_t ftypesize = 0; -PUBLIC uoffset_t itypesize = 2; -PUBLIC uoffset_t ptypesize = 2; -PUBLIC uoffset_t stypesize = 2; +PUBLIC uoffset_T ctypesize = 1; +PUBLIC uoffset_T dtypesize = 8; +PUBLIC uoffset_T ftypesize = 0; +PUBLIC uoffset_T itypesize = 2; +PUBLIC uoffset_T ptypesize = 2; +PUBLIC uoffset_T stypesize = 2; PRIVATE char skey0; PRIVATE char skey1; @@ -79,7 +79,7 @@ PUBLIC struct typestruct *newtype() ++ts_n_type; ts_s_type += sizeof *type; #endif - type->typesize = /* (uoffset_t) */ + type->typesize = /* (uoffset_T) */ type->scalar = /* (scalar_t) */ type->constructor = /* (constr_t) */ type->structkey[0] = 0; @@ -105,7 +105,7 @@ struct typestruct *type; PUBLIC struct typestruct *prefix(constructor, size, type) constr_pt constructor; -uoffset_t size; +uoffset_T size; struct typestruct *type; { register struct typestruct *searchtype; @@ -121,7 +121,7 @@ struct typestruct *type; searchtype->alignmask = type->alignmask; break; case FUNCTION: - searchtype->alignmask = ~(uoffset_t) 0; + searchtype->alignmask = ~(uoffset_T) 0; break; case POINTER: searchtype->alignmask = ~(ptypesize - 1) | alignmask; @@ -190,7 +190,7 @@ PUBLIC void typeinit() uitype->alignmask = ltype->alignmask = ultype->alignmask = - itype->alignmask = ~(uoffset_t) (4 - 1); + itype->alignmask = ~(uoffset_T) (4 - 1); ltype->scalar = LONG; /* not DLONG */ ultype->scalar = UNSIGNED | LONG; } diff --git a/bcc/type.h b/bcc/type.h index c451283..61f89cf 100644 --- a/bcc/type.h +++ b/bcc/type.h @@ -63,12 +63,12 @@ /* type sizes */ /* default sizes and long and float sizes are hard-coded into type data */ -extern uoffset_t ctypesize; -extern uoffset_t dtypesize; -extern uoffset_t ftypesize; -extern uoffset_t itypesize; -extern uoffset_t ptypesize; -extern uoffset_t stypesize; +extern uoffset_T ctypesize; +extern uoffset_T dtypesize; +extern uoffset_T ftypesize; +extern uoffset_T itypesize; +extern uoffset_T ptypesize; +extern uoffset_T stypesize; /* basic scalar types */ diff --git a/bcc/types.h b/bcc/types.h index da34a3a..effcfcd 100644 --- a/bcc/types.h +++ b/bcc/types.h @@ -13,14 +13,14 @@ typedef long value_t; /* target ints, longs and offsets */ typedef unsigned long uvalue_t; /* target unsigned ints, longs and offsets */ #ifdef I8088 -typedef long offset_t; /* target machine offset */ -typedef unsigned long uoffset_t; /* target unsigned machine offset */ +typedef long offset_T; /* target machine offset */ +typedef unsigned long uoffset_T; /* target unsigned machine offset */ #define outuvalue outhex #define outvalue outshex #endif #ifdef MC6809 -typedef int offset_t; -typedef unsigned uoffset_t; +typedef int offset_T; +typedef unsigned uoffset_T; #endif @@ -146,7 +146,7 @@ struct symstruct union { double *offd; /* value for double constants */ - offset_t offi; /* offset for register or global storage */ + offset_T offi; /* offset for register or global storage */ label_no offlabel; /* label number for strings */ char *offp; /* to string for macro definitions */ sym_pt offsym; /* symbol code for keywords */ @@ -173,8 +173,8 @@ struct typestruct char structkey[2]; /* unique prefix for member names */ /* ranges from "\001\001" to "@\377" */ /* avoiding nulls */ - uoffset_t alignmask; /* alignment mask, typesize - 1 for scalars */ - uoffset_t typesize; /* size of this type */ + uoffset_T alignmask; /* alignment mask, typesize - 1 for scalars */ + uoffset_T typesize; /* size of this type */ char *tname; /* name of scalar type or constructor */ struct typelist *listtype; /* list of member types */ struct typestruct *nexttype; -- cgit v1.2.1