1 /* $Id: simfile.c,v 1.7 1994/11/05 12:57:21 cim Exp $ */
2 
3 /* Copyright (C) 1994 Sverre Hvammen Johansen
4  * Department of Informatics, University of Oslo.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
18 
19 #include "config.h"
20 #include "cim.h"
21 #include "limit.h"
22 #include "simfile.h"
23 
24 #if STDC_HEADERS
25 #include <stdlib.h>
26 #endif
27 
28 void __m_FILE();
29 
30 /* Ytterste blokk */
31 __bs0FILE *__bp0FILE;
32 short __rl0FILE[2]
33 = {(char *)&((__bs0FILE *)0)->c1-(char *)0, (char *)&((__bs0FILE *)0)->c2-(char *)0};
34 extern __ptyp __p0FILE;
35 __pty __pl0FILE[1]
36 ={&__p0FILE};
37 __ptyp __p0FILE =
38 {'B', 0, 0, sizeof (__bs0FILE), 1, __m_FILE, 0, 2, 2,
39   0, __rl0FILE, 0, __pl0FILE};
40 
41 /* class FILE */
42 __bs1FILE *__bp1FILE;
43 short __rl1FILE[1]
44 = {(char *)&((__bs1FILE *)0)->filename-(char *)0};
45 extern __ptyp __p1FILE;
46 __pty __pl1FILE[1]
47 = {&__p1FILE};
48 __ptyp __p1FILE =
49 {'C', 0, 1, sizeof (__bs1FILE), 1, __m_FILE, 0, 0, 1,
50   0, __rl1FILE, 0, __pl1FILE};
51 
52 /* FILE class IMAGEFILE */
53 __bs2FILE *__bp2FILE;
54 short __rl2FILE[1]
55 = {(char *)&((__bs2FILE *)0)->IMAGE-(char *)0};
56 extern __ptyp __p2FILE;
57 __pty __pl2FILE[2] =
58 {&__p1FILE, &__p2FILE};
59 __ptyp __p2FILE =
60 {'C', 1, 1, sizeof (__bs2FILE), 4, __m_FILE, 0, 0, 1,
61   0, __rl2FILE, 0, __pl2FILE};
62 
63 /* IMAGEFILE class OUTFILE */
64 extern __ptyp __p3FILE;
65 __pty __pl3FILE[3] =
66 {&__p1FILE, &__p2FILE, &__p3FILE};
67 __ptyp __p3FILE =
68 {'C', 2, 1, sizeof (__bs3FILE), 7, __m_FILE, 0, 0, 0, 0, 0, 0, __pl3FILE};
69 
70 /* IMAGEFILE class INFILE */
71 extern __ptyp __p4FILE;
72 __pty __pl4FILE[3] =
73 {&__p1FILE, &__p2FILE, &__p4FILE};
74 __ptyp __p4FILE =
75 {'C', 2, 1, sizeof (__bs4FILE), 10, __m_FILE, 0, 0, 0, 0, 0, 0, __pl4FILE};
76 
77 /* IMAGEFILE class DIRECTFILE */
78 extern __ptyp __p5FILE;
79 __pty __pl5FILE[3] =
80 {&__p1FILE, &__p2FILE, &__p5FILE};
81 __ptyp __p5FILE =
82 {'C', 2, 1, sizeof (__bs5FILE), 13, __m_FILE, 0, 0, 0, 0, 0, 0, __pl5FILE};
83 
84 /* OUTFILE class PRINTFILE */
85 extern __ptyp __p6FILE;
86 __pty __pl6FILE[4] =
87 {&__p1FILE, &__p2FILE, &__p3FILE, &__p6FILE};
88 __ptyp __p6FILE =
89 {'C', 3, 1, sizeof (__bs6FILE), 16, __m_FILE, 0, 0, 0, 0, 0, 0, __pl6FILE};
90 
91 /* FILE class BYTEFILE  */
92 extern __ptyp __p7FILE;
93 __pty __pl7FILE[2] =
94 {&__p1FILE, &__p7FILE};
95 __ptyp __p7FILE =
96 {'C', 1, 1, sizeof (__bs7FILE), 19, __m_FILE, 0, 0, 0, 0, 0, 0, __pl7FILE};
97 
98 /* BYTEFILE class INBYTEFILE */
99 extern __ptyp __p8FILE;
100 __pty __pl8FILE[3] =
101 {&__p1FILE, &__p7FILE, &__p8FILE};
102 __ptyp __p8FILE =
103 {'C', 2, 1, sizeof (__bs8FILE), 22, __m_FILE, 0, 0, 0, 0, 0, 0, __pl8FILE};
104 
105 /* BYTEFILE class OUTBYTEFILE */
106 extern __ptyp __p9FILE;
107 __pty __pl9FILE[3] =
108 {&__p1FILE, &__p7FILE, &__p9FILE};
109 __ptyp __p9FILE =
110 {'C', 2, 1, sizeof (__bs9FILE), 25, __m_FILE, 0, 0, 0, 0, 0, 0, __pl9FILE};
111 
112 /* BYTEFILE class DIRECTBYTEFILE */
113 extern __ptyp __p10FILE;
114 __pty __pl10FILE[3] =
115 {&__p1FILE, &__p7FILE, &__p10FILE};
116 __ptyp __p10FILE =
117 {'C', 2, 1, sizeof (__bs10FILE), 28, __m_FILE, 0, 0, 0, 0, 0, 0, __pl10FILE};
118 
119 /* Deklarerer tekstobjekter for filnavnene stdin og stdout */
120 struct __name
121   {
122     __th h;
123     char string[9];
124   }
125 __stdinname =
126 {
127   (__pty) __TEXT, (__dhp) & __stdinname, __TRUE, 8, "/dev/tty"
128 }
129 ,
130 __stdoutname =
131 {
132   (__pty) __TEXT, (__dhp) & __stdoutname, __TRUE, 8, "/dev/tty"
133 }
134 ,
135 __stderrname =
136 {
137   (__pty) __TEXT, (__dhp) & __stderrname, __TRUE, 8, "/dev/tty"
138 };
139 
140 /* Deklarerer tekstobjekter for stdin.IMAGE og stdout.IMAGE */
141 struct __imagein
142   {
143     __th h;
144     char string[INPUT_LINE_LENGTH];
145   }
146 __stdinimage =
147 {
148   (__pty) __TEXT, (__dhp) & __stdinimage, __FALSE, INPUT_LINE_LENGTH, ""
149 };
150 
151 struct __imageout
152   {
153     __th h;
154     char string[OUTPUT_LINE_LENGTH + 1];
155   }
156 __stdoutimage =
157 {
158   (__pty) __TEXT, (__dhp) & __stdoutimage, __FALSE, OUTPUT_LINE_LENGTH, ""
159 }
160 ,
161 __stderrimage =
162 {
163   (__pty) __TEXT, (__dhp) & __stderrimage, __FALSE, OUTPUT_LINE_LENGTH, ""
164 };
165 
166 /* Genererer og initierer ytterste blokk objekt */
167 
168 __bs0FILE __blokk0FILE =
169 {(__pty) & __p0FILE, (__dhp) & __blokk0FILE, (__dhp) & __blokk0FILE,
170   __FALSE, __TERMINATED, 0, 0,
171   (__dhp) & __blokk0FILE, __NULL, __NULL};
172 
173 /* Genererer og initierer et infile objekt (SYSIN) */
174 
175 __bs4FILE __sysin =
176 {(__pty) & __p4FILE, (__dhp) & __sysin, (__dhp) & __blokk0FILE,
177   __FALSE, __TERMINATED, 0, __NULL,
178   (__dhp) & __blokk0FILE, (__textref) & __stdinname, 5, 1, 1, __NULL, __TRUE,
179  __NOSHARED, __NOAPPEND, __NOCREATE, __READWRITE, __NOREWIND, __NOPURGE,
180  (__textref) & __stdinimage, INPUT_LINE_LENGTH, INPUT_LINE_LENGTH + 1, 1,
181  __FALSE};
182 
183 /* Genererer og initierer et printfile objekt (SYSOUT) */
184 
185 __bs6FILE __sysout =
186 {(__pty) & __p6FILE, (__dhp) & __sysout, (__dhp) & __blokk0FILE,
187  __FALSE, __TERMINATED, 0, __NULL,
188  (__dhp) & __blokk0FILE, (__textref) & __stdoutname, 6, 1, 1, __NULL, __TRUE,
189  __NOSHARED, __NOAPPEND, __NOCREATE, __READWRITE, __NOREWIND, __NOPURGE,
190  (__textref) & __stdoutimage, OUTPUT_LINE_LENGTH, 1, 1,
191  1, MAX_INT, 1, 0};
192 
193 __bs6FILE __syserr =
194 {(__pty) & __p6FILE, (__dhp) & __syserr, (__dhp) & __blokk0FILE,
195  __FALSE, __TERMINATED, 0, __NULL,
196  (__dhp) & __blokk0FILE, (__textref) & __stderrname, 6, 1, 1, __NULL, __TRUE,
197  __NOSHARED, __NOAPPEND, __NOCREATE, __READWRITE, __NOREWIND, __NOPURGE,
198  (__textref) & __stderrimage, OUTPUT_LINE_LENGTH, 1, 1,
199  1, MAX_INT, 1, 0};
200 
__m_FILE()201 void __m_FILE()
202 { goto __s;
203 
204 /* C - k o d e n   f o r   C L A S S   B A S I C I O */
205 
206                                           /* class FILE */
207 __l1: __renddecl(0);goto __sw;
208 __l2: if(((__bs1 *)__lb)->filename.obj==__NULL)
209        __rerror("NEW File: Can't open file with no name");
210       __rinner(0);goto __sw;
211 __l3: __rendclass(0);goto __sw;
212                                           /* FILE class IMAGEFILE */
213 
214 __l4: __renddecl(1);goto __sw;
215 __l5: __rinner(1);goto __sw;
216 __l6: __rendclass(0);goto __sw;
217                                           /* IMAGEFILE class OUTFILE */
218 
219 __l7: __renddecl(2);goto __sw;
220 __l8: ((__bs1 *)__lb)->create=__ANYCREATE;
221       __rinner(2);goto __sw;
222 __l9: __rendclass(0);goto __sw;
223                                           /* IMAGEFILE class INFILE */
224 
225 __l10: __renddecl(2);goto __sw;
226 __l11: ((__bs4 *)__lb)->endfile=__TRUE;
227        ((__bs1 *)__lb)->shared=__SHARED;
228        __rinner(2);goto __sw;
229 __l12: __rendclass(0);goto __sw;
230                                           /* IMAGEFILE class DIRECTFILE */
231 
232 __l13: __renddecl(2);goto __sw;
233 __l14: ((__bs5 *)__lb)->endfile=__TRUE;
234        __rinner(2);goto __sw;
235 __l15: __rendclass(0);goto __sw;
236                                           /* OUTFILE class PRINTFILE */
237 
238 __l16: __renddecl(3);goto __sw;
239 __l17: ((__bs6 *)__lb)->spacing=1;
240        ((__bs6 *)__lb)->lines_per_page=__lines_per_page;
241        ((__bs6 *)__lb)->line=((__bs6 *)__lb)->page=0;
242        __rinner(3);goto __sw;
243 __l18: __rendclass(0);goto __sw;
244                                           /* FILE class BYTEFILE  */
245 
246 __l19: __renddecl(1);goto __sw;
247 __l20: ((__bs7 *)__lb)->endfile=__TRUE;
248        ((__bs7 *)__lb)->bytesize=__BYTESIZE;
249        __rinner(1);goto __sw;
250 __l21: __rendclass(0);goto __sw;
251                                           /* BYTEFILE class INBYTEFILE */
252 
253 __l22: __renddecl(2);goto __sw;
254 __l23: ((__bs1 *)__lb)->shared=__SHARED;
255        __rinner(2);goto __sw;
256 __l24: __rendclass(0);goto __sw;
257 
258                                           /* BYTEFILE class OUTBYTEFILE */
259 
260 __l25: __renddecl(2);goto __sw;
261 __l26: ((__bs1 *)__lb)->create=__ANYCREATE;
262        __rinner(2);goto __sw;
263 __l27: __rendclass(0);goto __sw;
264 
265                                           /* BYTEFILE class DIRECTBYTEFILE */
266 
267 __l28: __renddecl(2);goto __sw;
268 __l29: __rinner(2);goto __sw;
269 __l30: __rendclass(0);goto __sw;
270 
271 /* C-koden for koden etter INNER i class BASICIO */
272 __l31:
273 __rslutt();
274 
275 exit(0);
276 
277 __sw:if(__goto.ment!=(void (*)())__m_FILE)return;
278 __s:switch(__goto.ent){
279 case 1: goto __l1;case 2: goto __l2;
280 case 3: goto __l3;case 4: goto __l4;case 5: goto __l5;
281 case 6: goto __l6;case 7: goto __l7;case 8: goto __l8;
282 case 9: goto __l9;case 10: goto __l10;case 11: goto __l11;
283 case 12: goto __l12;case 13: goto __l13;case 14: goto __l14;
284 case 15: goto __l15;case 16: goto __l16;case 17: goto __l17;
285 case 18: goto __l18;case 19: goto __l19;case 20: goto __l20;
286 case 21: goto __l21;case 22: goto __l22;case 23: goto __l23;
287 case 24: goto __l24;case 25: goto __l25;case 26: goto __l26;
288 case 27: goto __l27;case 28: goto __l28;case 29: goto __l29;
289 case 30: goto __l30;case 31: goto __l31;
290 }
291 }
292 
__init_FILE()293 void __init_FILE()
294 {
295   /*  I N I T I E R I N G   a v   B A S I C I O */
296 #if 0
297   __rl0FILE[0]=(char *)&__bp0FILE->c1-(char *)__bp0FILE;
298   __rl0FILE[1]=(char *)&__bp0FILE->c2-(char *)__bp0FILE;
299 
300   /* class FILE */
301   __rl1FILE[0]=(char *)&__bp1FILE->filename-(char *)__bp1FILE;
302 
303   /* FILE class IMAGEFILE */
304 
305   __rl2FILE[0]=(char *)&__bp2FILE->IMAGE-(char *)__bp2FILE;
306 
307 #endif
308 }
309