Annotation of researchv8dc/cmd/sh/mode.h, revision 1.1.1.1

1.1       root        1: /*     @(#)mode.h      1.5     */
                      2: /*
                      3:  *     UNIX shell
                      4:  */
                      5: 
                      6: #ifdef pdp11
                      7: typedef char BOOL;
                      8: #else
                      9: typedef short BOOL;
                     10: #endif
                     11: 
                     12: #define BYTESPERWORD   (sizeof (char *))
                     13: #define        NIL     ((char*)0)
                     14: 
                     15: 
                     16: /* the following nonsense is required
                     17:  * because casts turn an Lvalue
                     18:  * into an Rvalue so two cheats
                     19:  * are necessary, one for each context.
                     20:  */
                     21: union { int _cheat;};
                     22: #define Lcheat(a)      ((a)._cheat)
                     23: #define Rcheat(a)      ((int)(a))
                     24: 
                     25: 
                     26: /* address puns for storage allocation */
                     27: typedef union
                     28: {
                     29:        struct forknod  *_forkptr;
                     30:        struct comnod   *_comptr;
                     31:        struct fndnod   *_fndptr;
                     32:        struct parnod   *_parptr;
                     33:        struct ifnod    *_ifptr;
                     34:        struct whnod    *_whptr;
                     35:        struct fornod   *_forptr;
                     36:        struct lstnod   *_lstptr;
                     37:        struct blk      *_blkptr;
                     38:        struct namnod   *_namptr;
                     39:        char    *_bytptr;
                     40: } address;
                     41: 
                     42: 
                     43: /* heap storage */
                     44: struct blk
                     45: {
                     46:        struct blk      *word;
                     47: };
                     48: 
                     49: #define        BUFSIZ  128
                     50: struct fileblk
                     51: {
                     52:        int     fdes;
                     53:        unsigned flin;
                     54:        BOOL    feof;
                     55:        unsigned char   fsiz;
                     56:        char    *fnxt;
                     57:        char    *fend;
                     58:        char    **feval;
                     59:        struct fileblk  *fstak;
                     60:        char    fbuf[BUFSIZ];
                     61: };
                     62: 
                     63: struct tempblk
                     64: {
                     65:        int fdes;
                     66:        struct tempblk *fstak;
                     67: };
                     68: 
                     69: 
                     70: /* for files not used with file descriptors */
                     71: struct filehdr
                     72: {
                     73:        int     fdes;
                     74:        unsigned        flin;
                     75:        BOOL    feof;
                     76:        unsigned char   fsiz;
                     77:        char    *fnxt;
                     78:        char    *fend;
                     79:        char    **feval;
                     80:        struct fileblk  *fstak;
                     81:        char    _fbuf[1];
                     82: };
                     83: 
                     84: struct sysnod
                     85: {
                     86:        char    *sysnam;
                     87:        int     sysval;
                     88: };
                     89: 
                     90: /* this node is a proforma for those that follow */
                     91: struct trenod
                     92: {
                     93:        int     tretyp;
                     94:        struct ionod    *treio;
                     95: };
                     96: 
                     97: /* dummy for access only */
                     98: struct argnod
                     99: {
                    100:        struct argnod   *argnxt;
                    101:        char    argval[1];
                    102: };
                    103: 
                    104: struct dolnod
                    105: {
                    106:        struct dolnod   *dolnxt;
                    107:        int     doluse;
                    108:        char    *dolarg[1];
                    109: };
                    110: 
                    111: struct forknod
                    112: {
                    113:        int     forktyp;
                    114:        struct ionod    *forkio;
                    115:        struct trenod   *forktre;
                    116: };
                    117: 
                    118: struct comnod
                    119: {
                    120:        int     comtyp;
                    121:        struct ionod    *comio;
                    122:        struct argnod   *comarg;
                    123:        struct argnod   *comset;
                    124: };
                    125: 
                    126: struct fndnod
                    127: {
                    128:        int     fndtyp;
                    129:        char    *fndnam;
                    130:        struct trenod   *fndval;
                    131: };
                    132: 
                    133: struct ifnod
                    134: {
                    135:        int     iftyp;
                    136:        struct trenod   *iftre;
                    137:        struct trenod   *thtre;
                    138:        struct trenod   *eltre;
                    139: };
                    140: 
                    141: struct whnod
                    142: {
                    143:        int     whtyp;
                    144:        struct trenod   *whtre;
                    145:        struct trenod   *dotre;
                    146: };
                    147: 
                    148: struct fornod
                    149: {
                    150:        int     fortyp;
                    151:        struct trenod   *fortre;
                    152:        char    *fornam;
                    153:        struct comnod   *forlst;
                    154: };
                    155: 
                    156: struct swnod
                    157: {
                    158:        int     swtyp;
                    159:        char *swarg;
                    160:        struct regnod   *swlst;
                    161: };
                    162: 
                    163: struct regnod
                    164: {
                    165:        struct argnod   *regptr;
                    166:        struct trenod   *regcom;
                    167:        struct regnod   *regnxt;
                    168: };
                    169: 
                    170: struct parnod
                    171: {
                    172:        int     partyp;
                    173:        struct trenod   *partre;
                    174: };
                    175: 
                    176: struct lstnod
                    177: {
                    178:        int     lsttyp;
                    179:        struct trenod   *lstlef;
                    180:        struct trenod   *lstrit;
                    181: };
                    182: 
                    183: struct ionod
                    184: {
                    185:        int     iofile;
                    186:        char    *ioname;
                    187:        char    *iolink;
                    188:        struct ionod    *ionxt;
                    189:        struct ionod    *iolst;
                    190: };
                    191: 
                    192: struct fdsave
                    193: {
                    194:        int org_fd;
                    195:        int dup_fd;
                    196: };
                    197: 
                    198: 
                    199: #define                fndptr(x)       ((struct fndnod *)x)
                    200: #define                comptr(x)       ((struct comnod *)x)
                    201: #define                forkptr(x)      ((struct forknod *)x)
                    202: #define                parptr(x)       ((struct parnod *)x)
                    203: #define                lstptr(x)       ((struct lstnod *)x)
                    204: #define                forptr(x)       ((struct fornod *)x)
                    205: #define                whptr(x)        ((struct whnod *)x)
                    206: #define                ifptr(x)        ((struct ifnod *)x)
                    207: #define                swptr(x)        ((struct swnod *)x)

unix.superglobalmegacorp.com

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