home *** CD-ROM | disk | FTP | other *** search
- /* mac.h */
- /* rt1 macros */
-
- #define PRNL putcher('\012'); /* cr/lf */
- #define CLRERR errix = errnum = 0; /* reset errors */
-
- /* character type macros*/
- /* char c;*/
- #define ISALPH(c) (ctype[(c)]&ALPH) /* alphabetic*/
- #define ISDIG(c) (ctype[(c)]&DIG) /* digit*/
- #define ISLDIG(c) (ctype[(c)]&LDIG) /* number for yylex*/
- #define ISLOW(c) (ctype[(c)]&LOW) /* lower case alpha*/
- #define ISOPR(c) (ctype[(c)]&OPR) /* operators */
- #define ISSTR(c) (ctype[(c)]&STRD) /*initial string delimiter*/
- #define ISLEXD(c) (ctype[(c)]&LEXD) /*for yylex*/
- #define ISDEL1(c) (ctype[(c)]&DEL1) /* ; \n \0 */
- #define ISDEL2(c) (ctype[(c)]&DEL2) /* \n \0*/
- #define ISDEL3(c) (ctype[(c)]&DEL3) /* for namadr */
- #define ISDELIM(c) (!(ctype[(c)]&(ALPH|DIG))) /* not alphanum*/
- #define ISLABEL(c) (ctype[(c)]&DIG) /* labels start with num*/
- #define ISALNUM(c) (ctype[(c)]&(ALPH|DIG)) /* alphanumeric*/
- #define ISCMT(c) (c == '.') /* comment */
- #define ISWS(c) (ctype[(c)]&WSP) /* white space */
-
- /* decrement the use count and unchain the temp block if
- its use count is 0
- NBLOCK *nb; the argument type
- */
- /* if (temptype & (1 << ((nb)->type)))\ */
- #define DECUSE(nb)\
- if (((nb)->type == STRADR) ||\
- ((nb)->type == AADR) ||\
- ((nb)->type == CPLADR) ||\
- ((nb)->type == CGR) ||\
- ((nb)->type == SWAPADR))\
- if (--((nb)->nvalue.tptr->use) <= 0)\
- tmpunch((nb)->nvalue.tptr);
-
- /* decrement the use count
- TEMP *tp;
- */
- #define DECRUSE(tp) if (--((tp)->use) <= 0) tmpunch(tp);
-
- /* increment the use count
- VAL *vp;
- */
- /* if (temptype & (1 << ((vp)->valtype)))\*/
- #define INCUSE(vp)\
- if ( ((vp)->valtype == STRADR) ||\
- ((vp)->valtype == AADR) ||\
- ((vp)->valtype == CPLADR) ||\
- ((vp)->valtype == CGR) ||\
- ((vp)->valtype == SWAPADR) )\
- ((vp)->value.tptr->use)++;
-
- /* increment the use count
- TEMP *tp;
- */
- #define INCRUSE(tp) ((tp)->use)++;
-
- /* increment a character pointer over blanks and tabs
- char *cp;
- */
- #define SKIPWS(cp) while(ISWS(*(cp))) ++(cp);
-
-
- #ifdef ZWHILE
- /********************************************
- ** scan forward to and stop on nl or \0 **
- ** IF within a block delimited by curly **
- ** braces, ignore newlines until out of **
- ** the block. Simple rule, huh?? **
- ** char *c; **
- ********************************************/
- /* sumit, 4/21/87 */
- #define MYSCAN(c) \
- do { \
- while(*(c) != '{' && !ISDEL2(*(c))) ++(c); \
- while(*(c) == '{') { \
- FINDEND(c); \
- while(*(c) != '{' && !ISDEL2(*(c))) ++(c); \
- } \
- } while(0)
- #define FINDEND(c) /* sumit, 4/21/87 */ \
- do { \
- int _i; \
- ++(c); \
- for(_i=1 ; _i > 0 && *(c) != '\0' ; ++(c)) { \
- if(*(c) == '{') _i++; \
- else if(*(c) == '}') _i--; \
- } \
- } while(0)
- /*********************************************
- ** scan backwards to first \n or to the **
- ** starting address of the macro, which **
- ** is in 'stop' **
- ** IF in a { block }, ignore newlines **
- *********************************************/
- #define MYBSCAN(c,stop) /* sumit, 4/21/87 */ \
- do { \
- while ((c) >= stop && *(c) != '\n' && *(c) != '}') --(c); \
- while (*(c) == '}') { \
- FINDSTART(c,stop); \
- while ((c) >= stop && *(c) != '\n' && *(c) != '}') --(c); \
- } \
- } while(0)
-
- /* sumit, 4/21/87 */
- #define FINDSTART(c,stop) \
- do { \
- int _i = 1; \
- while((c) >= stop && _i > 0) { \
- --(c); \
- if(*(c) == '}') _i++; \
- else if(*(c) == '{') _i--; \
- } \
- } while(0)
- #endif
-
-
- /* scan forward to and stop on nl or \0
- char *c;
- */
- #define SCANNL(c) while(!ISDEL2(*(c))) ++(c);
-
- /* scan over alphanumerics (for labels/names)
- char *cp;
- */
- #define SCANALN(c) while(ISALNUM(*(c))) ++(c);
-
- /* scan backward to a \n and point at it, or to the address stop
- char *c, *stop;
- */
- #define BACKNL(c,stop)\
- while ((c) >= stop && *(c) != '\n') --(c);
-
- /* call to convert arguments*/
- #define CARG(args)\
- if (!convarg((args),v + 1))\
- return(NULL); /* couldn't convert */
-
-