1 /* Input/Output Statements */ 2 3io: io1 4 { endio(); } 5 ; 6 7io1: iofmove ioctl 8 | iofmove unpar_fexpr 9 { ioclause(IOSUNIT, $2); endioctl(); } 10 | iofctl ioctl 11 | read ioctl 12 { doio(NULL); } 13 | read ioctl inlist 14 { doio($3); } 15 | read infmt SCOMMA inlist 16 { doio($4); } 17 | read ioctl SCOMMA inlist 18 { doio($4); } 19 | write ioctl 20 { doio(NULL); } 21 | write ioctl outlist 22 { doio($3); } 23 | print 24 { doio(NULL); } 25 | print SCOMMA outlist 26 { doio($3); } 27 ; 28 29iofmove: fmkwd end_spec in_ioctl 30 ; 31 32fmkwd: SBACKSPACE 33 { iostmt = IOREWIND; } 34 | SREWIND 35 { iostmt = IOREWIND; } 36 | SENDFILE 37 { iostmt = IOENDFILE; } 38 ; 39 40iofctl: ctlkwd end_spec in_ioctl 41 ; 42 43ctlkwd: SINQUIRE 44 { iostmt = IOINQUIRE; } 45 | SOPEN 46 { iostmt = IOOPEN; } 47 | SCLOSE 48 { iostmt = IOCLOSE; } 49 ; 50 51infmt: unpar_fexpr 52 { 53 ioclause(IOSUNIT, NULL); 54 ioclause(IOSFMT, $1); 55 endioctl(); 56 } 57 | SSTAR 58 { 59 ioclause(IOSUNIT, NULL); 60 ioclause(IOSFMT, NULL); 61 endioctl(); 62 } 63 ; 64 65ioctl: SLPAR fexpr SRPAR 66 { ioclause(IOSUNIT, $2); endioctl(); } 67 | SLPAR ctllist SRPAR 68 { endioctl(); } 69 ; 70 71ctllist: ioclause SCOMMA ioclause 72 | ctllist SCOMMA ioclause 73 ; 74 75ioclause: fexpr 76 { ioclause(IOSPOSITIONAL, $1); } 77 | SSTAR 78 { ioclause(IOSPOSITIONAL, NULL); } 79 | nameeq expr 80 { ioclause($1, $2); } 81 | nameeq SSTAR 82 { ioclause($1, NULL); } 83 ; 84 85nameeq: SNAMEEQ 86 { $$ = iocname(); } 87 ; 88 89read: SREAD end_spec in_ioctl 90 { iostmt = IOREAD; } 91 ; 92 93write: SWRITE end_spec in_ioctl 94 { iostmt = IOWRITE; } 95 ; 96 97print: SPRINT end_spec fexpr in_ioctl 98 { 99 iostmt = IOWRITE; 100 ioclause(IOSUNIT, NULL); 101 ioclause(IOSFMT, $3); 102 endioctl(); 103 } 104 | SPRINT end_spec SSTAR in_ioctl 105 { 106 iostmt = IOWRITE; 107 ioclause(IOSUNIT, NULL); 108 ioclause(IOSFMT, NULL); 109 endioctl(); 110 } 111 ; 112 113inlist: inelt 114 { $$ = mkchain($1,0); } 115 | inlist SCOMMA inelt 116 { $$ = hookup($1, mkchain($3,0)); } 117 ; 118 119inelt: lhs 120 | SLPAR inlist SCOMMA dospec SRPAR 121 { $$ = mkiodo($4,$2); } 122 ; 123 124outlist: uexpr 125 { $$ = mkchain($1, 0); } 126 | other 127 { $$ = mkchain($1, 0); } 128 | out2 129 ; 130 131out2: uexpr SCOMMA uexpr 132 { $$ = mkchain($1, mkchain($3, 0) ); } 133 | uexpr SCOMMA other 134 { $$ = mkchain($1, mkchain($3, 0) ); } 135 | other SCOMMA uexpr 136 { $$ = mkchain($1, mkchain($3, 0) ); } 137 | other SCOMMA other 138 { $$ = mkchain($1, mkchain($3, 0) ); } 139 | out2 SCOMMA uexpr 140 { $$ = hookup($1, mkchain($3, 0) ); } 141 | out2 SCOMMA other 142 { $$ = hookup($1, mkchain($3, 0) ); } 143 ; 144 145other: complex_const 146 | SLPAR uexpr SCOMMA dospec SRPAR 147 { $$ = mkiodo($4, mkchain($2, 0) ); } 148 | SLPAR other SCOMMA dospec SRPAR 149 { $$ = mkiodo($4, mkchain($2, 0) ); } 150 | SLPAR out2 SCOMMA dospec SRPAR 151 { $$ = mkiodo($4, $2); } 152 ; 153 154in_ioctl: 155 { startioctl(); } 156 ; 157