Annotation of researchv10no/cmd/ccom/common/manifest.h, revision 1.1

1.1     ! root        1: /* @(#) manifest.h: 1.4 3/26/84                                */
        !             2: 
        !             3: 
        !             4: # include <stdio.h>
        !             5: 
        !             6:        /* macro definitions for common cases of type collapsing */
        !             7: # ifdef NOSHORT
        !             8: # define SZSHORT SZINT
        !             9: # define ALSHORT ALINT
        !            10: # endif
        !            11: 
        !            12: # ifdef NOLONG
        !            13: # define SZLONG SZINT
        !            14: # define ALLONG ALINT
        !            15: # endif
        !            16: 
        !            17: # ifdef NOFLOAT
        !            18: # define SZFLOAT SZLONG
        !            19: # define SZDOUBLE SZLONG
        !            20: # define ALFLOAT ALLONG
        !            21: # define ALDOUBLE ALLONG
        !            22: # endif
        !            23: 
        !            24: # ifdef ONEFLOAT
        !            25: # define SZFLOAT SZDOUBLE
        !            26: # define ALFLOAT ALDOUBLE
        !            27: # endif
        !            28: 
        !            29: /* define default assembly language comment starter */
        !            30: 
        !            31: # ifndef COMMENTSTR
        !            32: # define COMMENTSTR    "#"
        !            33: #endif
        !            34: 
        !            35: /*     manifest constant file for the lex/yacc interface */
        !            36: 
        !            37: # define ERROR 1
        !            38: # define NAME 2
        !            39: # define STRING 3
        !            40: # define ICON 4
        !            41: # define FCON 5
        !            42: # define PLUS 6
        !            43: # define MINUS 8
        !            44: # define MUL 11
        !            45: # define STAR (UNARY MUL)
        !            46: # define AND 14
        !            47: # define OR 17
        !            48: # define ER 19
        !            49: # define QUEST 21
        !            50: # define COLON 22
        !            51: # define ANDAND 23
        !            52: # define OROR 24
        !            53: 
        !            54: /*     special interfaces for yacc alone */
        !            55: /*     These serve as abbreviations of 2 or more ops:
        !            56:        ASOP    =, = ops
        !            57:        RELOP   LE,LT,GE,GT
        !            58:        EQUOP   EQ,NE
        !            59:        DIVOP   DIV,MOD
        !            60:        SHIFTOP LS,RS
        !            61:        ICOP    INCR,DECR
        !            62:        UNOP    NOT,COMPL
        !            63:        STROP   DOT,STREF
        !            64: 
        !            65:        */
        !            66: # define ASOP 25
        !            67: # define RELOP 26
        !            68: # define EQUOP 27
        !            69: # define DIVOP 28
        !            70: # define SHIFTOP 29
        !            71: # define INCOP 30
        !            72: # define UNOP 31
        !            73: # define STROP 32
        !            74: 
        !            75: /*     reserved words, etc */
        !            76: # define TYPE 33
        !            77: # define CLASS 34
        !            78: # define STRUCT 35
        !            79: # define RETURN 36
        !            80: # define GOTO 37
        !            81: # define IF 38
        !            82: # define ELSE 39
        !            83: # define SWITCH 40
        !            84: # define BREAK 41
        !            85: # define CONTINUE 42
        !            86: # define WHILE 43
        !            87: # define DO 44
        !            88: # define FOR 45
        !            89: # define DEFAULT 46
        !            90: # define CASE 47
        !            91: # define SIZEOF 48
        !            92: # define ENUM 49
        !            93: 
        !            94: /*     little symbols, etc. */
        !            95: /*     namely,
        !            96: 
        !            97:        LP      (
        !            98:        RP      )
        !            99: 
        !           100:        LC      {
        !           101:        RC      }
        !           102: 
        !           103:        LB      [
        !           104:        RB      ]
        !           105: 
        !           106:        CM      ,
        !           107:        SM      ;
        !           108: 
        !           109:        */
        !           110: 
        !           111: # define LP 50
        !           112: # define RP 51
        !           113: # define LC 52
        !           114: # define RC 53
        !           115: # define LB 54
        !           116: # define RB 55
        !           117: # define CM 56
        !           118: # define SM 57
        !           119: # define ASSIGN 58
        !           120:        /* ASM returned only by yylex, and totally eaten by yyparse */
        !           121: # define ASM 59
        !           122: 
        !           123: /*     END OF YACC */
        !           124: 
        !           125: /*     left over tree building operators */
        !           126: # define COMOP 59
        !           127: # define DIV 60
        !           128: # define MOD 62
        !           129: # define LS 64
        !           130: # define RS 66
        !           131: # define DOT 68
        !           132: # define STREF 69
        !           133: # define CALL 70
        !           134: # define FORTCALL 73
        !           135: # define NOT 76
        !           136: # define COMPL 77
        !           137: # define INCR 78
        !           138: # define DECR 79
        !           139: # define EQ 80
        !           140: # define NE 81
        !           141: # define LE 82
        !           142: # define LT 83
        !           143: # define GE 84
        !           144: # define GT 85
        !           145: # define ULE 86
        !           146: # define ULT 87
        !           147: # define UGE 88
        !           148: # define UGT 89
        !           149: # define SETBIT 90
        !           150: # define TESTBIT 91
        !           151: # define RESETBIT 92
        !           152: # define ARS 93
        !           153: # define REG 94
        !           154: # define TEMP 95
        !           155: # define CCODES 96
        !           156: # define FREE 97
        !           157: # define STASG 98
        !           158: # define STARG 99
        !           159: # define STCALL 100
        !           160: 
        !           161: /*     some conversion operators */
        !           162: # define FLD 103
        !           163: # define CONV 104
        !           164: # define PMUL 105
        !           165: # define PDIV 106
        !           166: 
        !           167: /*     special node operators, used for special contexts */
        !           168: /* # define FORCE 107 */
        !           169: # define GENLAB 108
        !           170: # define CBRANCH 109
        !           171: # define GENBR 110
        !           172: # define CMP 111
        !           173: # define GENUBR 112
        !           174: # define INIT 113
        !           175: # define CAST 114
        !           176: # define FUNARG 115
        !           177: # define VAUTO 116
        !           178: # define VPARAM 117
        !           179: # define RNODE 118
        !           180: # define SNODE 119
        !           181: # define QNODE 120
        !           182: /*     a whole bunch of ops, done with unary; I don't need to tackle prec */
        !           183: # define UOP0  121
        !           184: # define UOP1  122
        !           185: # define UOP2  123
        !           186: # define UOP3  124
        !           187: # define UOP4  125
        !           188: # define UOP5  126
        !           189: # define UOP6  127
        !           190: # define UOP7  128
        !           191: # define UOP8  129
        !           192: # define UOP9  130
        !           193: /*     op used in second pass */
        !           194: #define LABELPT        131
        !           195: # define MANY 132
        !           196: #define PROLOG 133
        !           197: #define EPILOG 134
        !           198: #define SWCASE 135
        !           199: #define SWDEF  136
        !           200: #define SWEND  137
        !           201: #define SWBEG  138
        !           202: 
        !           203: /*     node types */
        !           204: # define LTYPE 02
        !           205: # define UTYPE 04
        !           206: # define BITYPE 010
        !           207: 
        !           208:        /* DSIZE is the size of the dope array */
        !           209: # define DSIZE MANY+1
        !           210: 
        !           211: /*     type names, used in symbol table building */
        !           212: # define TNULL 0
        !           213: # define FARG 1
        !           214: # define CHAR 2
        !           215: # define SHORT 3
        !           216: # define INT 4
        !           217: # define LONG 5
        !           218: # define FLOAT 6
        !           219: # define DOUBLE 7
        !           220: # define STRTY 8
        !           221: # define UNIONTY 9
        !           222: # define ENUMTY 10
        !           223: # define MOETY 11
        !           224: # define UCHAR 12
        !           225: # define USHORT 13
        !           226: # define UNSIGNED 14
        !           227: # define ULONG 15
        !           228: # define VOID 16
        !           229: # define UNDEF 17
        !           230: 
        !           231: # define ASG 1+
        !           232: # define UNARY 2+
        !           233: # define NOASG (-1)+
        !           234: # define NOUNARY (-2)+
        !           235: 
        !           236: /*     various flags */
        !           237: # define NOLAB (-1)
        !           238: 
        !           239: /* type modifiers */
        !           240: 
        !           241: # define PTR  040
        !           242: # define FTN  0100
        !           243: # define ARY  0140
        !           244: 
        !           245: /* type packing constants */
        !           246: 
        !           247: # define MTMASK 03
        !           248: # define BTMASK 037
        !           249: # define BTSHIFT 5 
        !           250: # define TSHIFT 2
        !           251: # define TMASK (MTMASK<<BTSHIFT)
        !           252: # define TMASK1 (MTMASK<<(BTSHIFT+TSHIFT))
        !           253: # define TMASK2  (TMASK||MTMASK)
        !           254: 
        !           255: /*     macros  */
        !           256: 
        !           257: # ifndef BITMASK
        !           258:        /* beware 1's complement */
        !           259: # define BITMASK(n) (((n)==SZLONG)?-1L:((1L<<(n))-1))
        !           260: # endif
        !           261: # define ONEBIT(n) (1L<<(n))
        !           262: # define MODTYPE(x,y) x = (x&(~BTMASK))|y  /* set basic type of x to y */
        !           263: # define BTYPE(x)  (x&BTMASK)   /* basic type of x */
        !           264: # define ISUNSIGNED(x) ((x)<=ULONG&&(x)>=UCHAR)
        !           265: # define UNSIGNABLE(x) ((x)<=LONG&&(x)>=CHAR)
        !           266: # define ENUNSIGN(x) ((x)+(UNSIGNED-INT))
        !           267: # define DEUNSIGN(x) ((x)+(INT-UNSIGNED))
        !           268: # define ISPTR(x) ((x&TMASK)==PTR)
        !           269: # define ISFTN(x)  ((x&TMASK)==FTN)  /* is x a function type */
        !           270: # define ISARY(x)   ((x&TMASK)==ARY)   /* is x an array type */
        !           271: # define INCREF(x) (((x&~BTMASK)<<TSHIFT)|PTR|(x&BTMASK))
        !           272: # define DECREF(x) (((x>>TSHIFT)&~BTMASK)|(x&BTMASK))
        !           273: # define SETOFF(x,y)   if( (x)%(y) != 0 ) x = ( ((x)/(y) + 1) * (y))
        !           274:                /* advance x to a multiple of y */
        !           275: # define NOFIT(x,y,z)   ( ((x)%(z) + (y)) > (z) )
        !           276:        /* can y bits be added to x without overflowing z */
        !           277:        /* pack and unpack field descriptors (size and offset) */
        !           278: # define PKFIELD(s,o) (((o)<<6)|(s))
        !           279: # define UPKFSZ(v)  ((v)&077)
        !           280: # define UPKFOFF(v) ((v)>>6)
        !           281: 
        !           282: /*     operator information */
        !           283: 
        !           284: # define TYFLG 016
        !           285: # define ASGFLG 01
        !           286: # define LOGFLG 020
        !           287: 
        !           288: # define SIMPFLG 040
        !           289: # define COMMFLG 0100
        !           290: # define DIVFLG 0200
        !           291: # define FLOFLG 0400
        !           292: # define LTYFLG 01000
        !           293: # define CALLFLG 02000
        !           294: # define MULFLG 04000
        !           295: # define SHFFLG 010000
        !           296: # define ASGOPFLG 020000
        !           297: 
        !           298: # define SPFLG 040000
        !           299: 
        !           300: #define optype(o) (dope[o]&TYFLG)
        !           301: #define asgop(o) (dope[o]&ASGFLG)
        !           302: #define asgbinop(o) (dope[o]&ASGOPFLG)
        !           303: #define logop(o) (dope[o]&LOGFLG)
        !           304: #define callop(o) (dope[o]&CALLFLG)
        !           305: 
        !           306: /*     table sizes     */
        !           307: 
        !           308: #ifdef M32B
        !           309: # define BCSZ 125 /* size of the table to save break and continue labels */
        !           310: #else
        !           311: # define BCSZ 100 /* size of the table to save break and continue labels */
        !           312: #endif
        !           313: # define MAXNEST BCSZ  /* maximum nesting depth (for scopestack) */
        !           314: # ifndef SYMTSZ
        !           315: # define SYMTSZ 6000 /* size of the symbol table (was 2000) */
        !           316: # endif
        !           317: # define DIMTABSZ 300 /* size of the dimension/size table (dynamic) */
        !           318: # define PARAMSZ 650 /* size of the parameter stack */
        !           319: # define ARGSZ 50 /* size of the argument stack */
        !           320: # ifndef TREESZ
        !           321: # ifndef FORT
        !           322: # define TREESZ 1500 /* space for building parse tree */
        !           323: # else
        !           324: # define TREESZ 1500
        !           325: # endif
        !           326: # endif
        !           327: # define SWITSZ 4000 /* size of switch table */
        !           328: 
        !           329:        char            *hash();
        !           330:        char            *savestr();
        !           331:        char            *tstr();
        !           332:        extern int      tstrused;
        !           333:        extern char     *tstrbuf[];
        !           334:        extern char     **curtstr;
        !           335: #define freestr()      ( curtstr = tstrbuf, tstrused = 0 )
        !           336: 
        !           337: #      define NCHNAM 8  /* number of characters in a truncated name */
        !           338: 
        !           339: /*     common defined variables */
        !           340: 
        !           341: extern int nerrors;  /* number of errors seen so far */
        !           342: 
        !           343: typedef union ndu NODE;
        !           344: typedef unsigned int TWORD;
        !           345: typedef long CONSZ;  /* size in which constants are converted */
        !           346: 
        !           347:        /* default is byte addressing */
        !           348:        /* BITOOR(x) converts bit width x into address offset */
        !           349: # ifndef BITOOR
        !           350: # define BITOOR(x) ((x)/SZCHAR)
        !           351: # endif
        !           352: 
        !           353: #if defined(TMPSRET) && !defined(AUXREG)
        !           354: #define AUXREG (NRGS - 1)
        !           355: #endif
        !           356: 
        !           357: # define NIL (NODE *)0
        !           358: 
        !           359: extern int dope[];  /* a vector containing operator information */
        !           360: extern char *opst[];  /* a vector containing names for ops */
        !           361: 
        !           362: # define NCOSTS (NRGS+4)
        !           363: 
        !           364:        /* in one-pass operation, define the tree nodes */
        !           365: 
        !           366: union ndu {
        !           367: 
        !           368:        struct {
        !           369:                int op;
        !           370:                int goal;
        !           371:                TWORD type;
        !           372:                int cst[NCOSTS];
        !           373:                char * name;
        !           374:                char pad[NCHNAM-sizeof(char *)];        /* padding hack! */
        !           375:                NODE *left;
        !           376:                NODE *right;
        !           377:        }in;    /* interior node */
        !           378:        struct {
        !           379:                int op;
        !           380:                int goal;
        !           381:                TWORD type;
        !           382:                int cst[NCOSTS];
        !           383:                char * name;
        !           384:                char pad[NCHNAM-sizeof(char *)];        /* padding hack! */
        !           385:                NODE *left;
        !           386:                NODE *right;
        !           387:                int lineno;
        !           388:        }ln;    /* line number? */
        !           389:        
        !           390:        struct {
        !           391:                int op;
        !           392:                int goal;
        !           393:                TWORD type;
        !           394:                int cst[NCOSTS];
        !           395:                char * name;
        !           396:                char pad[NCHNAM-sizeof(char *)];        /* padding hack! */
        !           397:                CONSZ lval;
        !           398:                int rval;
        !           399:        }tn;    /* terminal node */
        !           400:        
        !           401:        struct {
        !           402:                int op;
        !           403:                int goal;
        !           404:                TWORD type;
        !           405:                int cst[NCOSTS];
        !           406:                int label;  /* for use with branching */
        !           407:                int lop;  /* the opcode being branched on */
        !           408:        }bn;    /* branch node */
        !           409: 
        !           410:        struct {
        !           411:                int op;
        !           412:                int goal;
        !           413:                TWORD type;
        !           414:                int cst[NCOSTS];
        !           415:                int stsize;  /* sizes of structure objects */
        !           416:                short stalign;  /* alignment of structure objects */
        !           417:                short argsize;  /* size of argument list for call */
        !           418:        }stn;   /* structure node */
        !           419: 
        !           420:        struct {
        !           421:                int op;
        !           422:                int goal;
        !           423:                TWORD type;
        !           424:                int cdim;
        !           425:                int csiz;
        !           426:        }fn;    /* front node */
        !           427:        
        !           428:        struct {
        !           429:                /* this structure is used when a floating point constant
        !           430:                   is being computed */
        !           431:                int op;
        !           432:                int goal;
        !           433:                TWORD type;
        !           434:                int cdim;
        !           435:                int csiz;
        !           436:                double dval;
        !           437:        }fpn;   /* floating point node */
        !           438: 
        !           439: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.