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