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