Annotation of 43BSD/usr.bin/f77/src/f77pass1/gram.io, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  *
                      6:  *     @(#)gram.io     5.1 (Berkeley) 6/7/85
                      7:  */
                      8: 
                      9:   /*  Input/Output Statements */
                     10: 
                     11: io:      io1
                     12:                { endio(); }
                     13:        ;
                     14: 
                     15: io1:     iofmove ioctl
                     16:        | iofmove unpar_fexpr
                     17:                { ioclause(IOSUNIT, $2); endioctl(); }
                     18:        | iofmove SSTAR
                     19:                { ioclause(IOSUNIT, PNULL); endioctl(); }
                     20:        | iofmove SPOWER
                     21:                { ioclause(IOSUNIT, IOSTDERR); endioctl(); }
                     22:        | iofctl ioctl
                     23:        | read ioctl
                     24:                { doio(PNULL); }
                     25:        | read infmt
                     26:                { doio(PNULL); }
                     27:        | read ioctl inlist
                     28:                { doio($3); }
                     29:        | read infmt SCOMMA inlist
                     30:                { doio($4); }
                     31:        | read ioctl SCOMMA inlist
                     32:                { doio($4); }
                     33:        | write ioctl
                     34:                { doio(PNULL); }
                     35:        | write ioctl outlist
                     36:                { doio($3); }
                     37:        | print
                     38:                { doio(PNULL); }
                     39:        | print SCOMMA outlist
                     40:                { doio($3); }
                     41:        ;
                     42: 
                     43: iofmove:   fmkwd end_spec in_ioctl
                     44:        ;
                     45: 
                     46: fmkwd:   SBACKSPACE
                     47:                { iostmt = IOBACKSPACE; }
                     48:        | SREWIND
                     49:                { iostmt = IOREWIND; }
                     50:        | SENDFILE
                     51:                { iostmt = IOENDFILE; }
                     52:        ;
                     53: 
                     54: iofctl:  ctlkwd end_spec in_ioctl
                     55:        ;
                     56: 
                     57: ctlkwd:          SINQUIRE
                     58:                { iostmt = IOINQUIRE; }
                     59:        | SOPEN
                     60:                { iostmt = IOOPEN; }
                     61:        | SCLOSE
                     62:                { iostmt = IOCLOSE; }
                     63:        ;
                     64: 
                     65: infmt:   unpar_fexpr
                     66:                {
                     67:                ioclause(IOSUNIT, PNULL);
                     68:                ioclause(IOSFMT, $1);
                     69:                endioctl();
                     70:                }
                     71:        | SSTAR
                     72:                {
                     73:                ioclause(IOSUNIT, PNULL);
                     74:                ioclause(IOSFMT, PNULL);
                     75:                endioctl();
                     76:                }
                     77:        ;
                     78: 
                     79: ioctl:   SLPAR fexpr SRPAR
                     80:                { if($2->headblock.vtype == TYCHAR)
                     81:                        {
                     82:                        ioclause(IOSUNIT, PNULL);
                     83:                        ioclause(IOSFMT, $2);
                     84:                        }
                     85:                  else
                     86:                        ioclause(IOSUNIT, $2);
                     87:                  endioctl();
                     88:                }
                     89:        | SLPAR ctllist SRPAR
                     90:                { endioctl(); }
                     91:        ;
                     92: 
                     93: ctllist:  ioclause
                     94:        | ctllist SCOMMA ioclause
                     95:        ;
                     96: 
                     97: ioclause:  fexpr
                     98:                { ioclause(IOSPOSITIONAL, $1); }
                     99:        | SSTAR
                    100:                { ioclause(IOSPOSITIONAL, PNULL); }
                    101:        | SPOWER
                    102:                { ioclause(IOSPOSITIONAL, IOSTDERR); }
                    103:        | nameeq expr
                    104:                { ioclause($1, $2); }
                    105:        | nameeq SSTAR
                    106:                { ioclause($1, PNULL); }
                    107:        | nameeq SPOWER
                    108:                { ioclause($1, IOSTDERR); }
                    109:        ;
                    110: 
                    111: nameeq:  SNAMEEQ
                    112:                { $$ = iocname(); }
                    113:        ;
                    114: 
                    115: read:    SREAD end_spec in_ioctl
                    116:                { iostmt = IOREAD; }
                    117:        ;
                    118: 
                    119: write:   SWRITE end_spec in_ioctl
                    120:                { iostmt = IOWRITE; }
                    121:        ;
                    122: 
                    123: print:   SPRINT end_spec fexpr in_ioctl
                    124:                {
                    125:                iostmt = IOWRITE;
                    126:                ioclause(IOSUNIT, PNULL);
                    127:                ioclause(IOSFMT, $3);
                    128:                endioctl();
                    129:                }
                    130:        | SPRINT end_spec SSTAR in_ioctl
                    131:                {
                    132:                iostmt = IOWRITE;
                    133:                ioclause(IOSUNIT, PNULL);
                    134:                ioclause(IOSFMT, PNULL);
                    135:                endioctl();
                    136:                }
                    137:        ;
                    138: 
                    139: inlist:          inelt
                    140:                { $$ = mkchain($1, CHNULL); }
                    141:        | inlist SCOMMA inelt
                    142:                { $$ = hookup($1, mkchain($3, CHNULL)); }
                    143:        ;
                    144: 
                    145: inelt:   lhs
                    146:                { $$ = (tagptr) $1; }
                    147:        | SLPAR inlist SCOMMA dospec SRPAR
                    148:                { $$ = (tagptr) mkiodo($4,$2); }
                    149:        ;
                    150: 
                    151: outlist:  uexpr
                    152:                { $$ = mkchain($1, CHNULL); }
                    153:        | other
                    154:                { $$ = mkchain($1, CHNULL); }
                    155:        | out2
                    156:        ;
                    157: 
                    158: out2:    uexpr SCOMMA uexpr
                    159:                { $$ = mkchain($1, mkchain($3, CHNULL) ); }
                    160:        | uexpr SCOMMA other
                    161:                { $$ = mkchain($1, mkchain($3, CHNULL) ); }
                    162:        | other SCOMMA uexpr
                    163:                { $$ = mkchain($1, mkchain($3, CHNULL) ); }
                    164:        | other SCOMMA other
                    165:                { $$ = mkchain($1, mkchain($3, CHNULL) ); }
                    166:        | out2  SCOMMA uexpr
                    167:                { $$ = hookup($1, mkchain($3, CHNULL) ); }
                    168:        | out2  SCOMMA other
                    169:                { $$ = hookup($1, mkchain($3, CHNULL) ); }
                    170:        ;
                    171: 
                    172: other:   complex_const
                    173:                { $$ = (tagptr) $1; }
                    174:        | SLPAR uexpr SCOMMA dospec SRPAR
                    175:                { $$ = (tagptr) mkiodo($4, mkchain($2, CHNULL) ); }
                    176:        | SLPAR other SCOMMA dospec SRPAR
                    177:                { $$ = (tagptr) mkiodo($4, mkchain($2, CHNULL) ); }
                    178:        | SLPAR out2  SCOMMA dospec SRPAR
                    179:                { $$ = (tagptr) mkiodo($4, $2); }
                    180:        ;
                    181: 
                    182: in_ioctl:
                    183:                { startioctl(); }
                    184:        ;

unix.superglobalmegacorp.com

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