--- declare.c-dist Fri Dec 17 11:51:13 1999 +++ declare.c Sun Apr 21 18:55:33 2002 @@ -36,6 +36,7 @@ FORWARD void declselt P((struct typestruct *structype, offset_T *psoffset, struct typelist ** ptypelist)); FORWARD bool_pt declspec P((void)); +FORWARD void doasm2 P((void)); FORWARD struct typestruct *declsu P((void)); FORWARD void idecllist P((void)); FORWARD void initarray P((struct typestruct *type)); @@ -47,6 +48,23 @@ FORWARD void rdeclarator P((void)); FORWARD bool_pt regdecl P((void)); +PRIVATE void doasm2() +{ + lparen(); + if (sym!=STRINGCONST) + error("string const expected"); + else { + nextsym(); + constant.value.s[charptr-constant.value.s]='\0'; + outnstr("!BCC_ASM"); + outbyte('\t'); + outnstr(constant.value.s); + outnstr("!BCC_ENDASM"); + rparen(); + semicolon(); + } +} + PRIVATE struct typestruct *chainprefix(pretype, sufftype) struct typestruct *pretype; struct typestruct *sufftype; @@ -487,6 +505,10 @@ case UNSIGNDECL: ++nunsigned; nextsym(); + break; + case ASMSYM: + nextsym(); + doasm2(); break; default: goto break2; --- preproc.c-dist Sat Jan 12 12:02:18 2002 +++ preproc.c Sun Apr 21 18:55:43 2002 @@ -53,6 +53,7 @@ FORWARD void asmcontrol P((void)); FORWARD void control P((void)); FORWARD void defineorundefinestring P((char *str, bool_pt defineflag)); +FORWARD void elifcontrol P((void)); FORWARD void elsecontrol P((void)); FORWARD void endif P((void)); FORWARD fastin_pt getparnames P((void)); @@ -193,7 +194,7 @@ } ctlcase = symptr->offset.offsym; if (ifstate.ifflag == FALSE && - (ctlcase < ELSECNTL || ctlcase > IFNDEFCNTL)) + (ctlcase < ELIFCNTL || ctlcase > IFNDEFCNTL)) return; switch (ctlcase) { @@ -209,6 +210,9 @@ case DEFINECNTL: define(); break; + case ELIFCNTL: + elifcontrol(); + break; case ELSECNTL: elsecontrol(); break; @@ -345,7 +349,14 @@ gch1(); skipcomment(); /* comment is space in modern cpp's but they have '##' too */ +#if 0 ch = *--lineptr = ' '; +#else + /* With this, we can define a paste macro. */ + --lineptr; + gch1(); + continue; +#endif } } #ifdef TS @@ -495,6 +506,29 @@ } skipline(); } + } +} + +/* elifcontrol() - process #elif */ + +PRIVATE void elifcontrol() +{ + if (iflevel == 0) + { + error("elif without if"); + return; + } + if (ifstate.elseflag) { + register struct ifstruct *ifptr; + + ifptr = &ifstack[(int)--iflevel]; + ifstate.elseflag = ifptr->elseflag; + ifstate.ifflag = ifptr->ifflag; + + ifcontrol(IFCNTL); + } else { + ifstate.ifflag = ifstate.elseflag; + ifstate.elseflag = FALSE; } } --- table.c-dist Sat Mar 16 04:28:26 2002 +++ table.c Sun Apr 21 18:55:58 2002 @@ -30,7 +30,7 @@ #define MAXEXPR 500 #endif #define MAXLOCAL 100 -#define NKEYWORDS 35 +#define NKEYWORDS 36 #ifdef NOFLOAT #define NSCALTYPES 10 #else @@ -116,6 +116,7 @@ { "#asm", ASMCNTL, }, { "#define", DEFINECNTL, }, + { "#elif", ELIFCNTL, }, { "#else", ELSECNTL, }, { "#endasm", ENDASMCNTL, }, { "#endif", ENDIFCNTL, },