1e46b4f78783c2e5f104d6857d7148fe5208c0ff
[vlp.git] / src / int / intdt.c
1 #include "depend.h"
2 #include "genint.h"
3 #include "int.h"
4 #include "process.h"
5 #include "intproto.h"
6
7 /**
8  * \defgroup Variables common with generator :
9  * @{
10  */
11  
12 /**
13  * prototypes
14  */
15 protdescr *prototype[MAXPROT + 1];
16
17 /**
18  * address of primitive types descriptions
19  */
20 word ipradr;
21
22 /**
23  * address of global temporary variables
24  */
25 word temporary;
26
27 /** 
28  * base for string constants
29  */
30 word strings;
31
32 /**
33  * the last used prototype number
34  */
35 word lastprot;
36
37 /**
38  * first free cell in M
39  */
40 word freem;
41
42 /**
43  * current file virtual address
44  */
45 word currfile = 2;
46 /** @} */
47
48 /**
49  * Interpreter own variables :
50  * @{
51  **/
52  
53 /**
54  * main memory for code and data
55  */
56 memory M;
57
58 /**
59  * for comunication with standard procs
60  */
61 union value *param;
62 /** @} */
63
64 /**
65  * offset conversion table for compactification
66  */
67 int offset[] = { DUMMY, SL, DL, CL, CHD, VIRTSC };
68
69 /**
70  * signal to number conversion table 
71  * -1 stands for an unrecoverable error which cannot be serviced by handler
72  */
73 int scot[] = {
74         /** RTESLCOF */
75         20,
76         /** RTEUNSTP */
77         20,
78         /** RTEILLAT */
79         20,
80         /** RTEILLDT */
81         20,
82         /** RTECORTM */
83         20,
84         /** RTECORAC */
85         20,
86         /** RTEINVIN */
87         23,
88         /** RTEILLAB */
89         23,
90         /** RTEINCQA */
91         21,
92         /** RTEINCAS */
93         24,
94         /** RTEFTPMS */
95         20,
96         /** RTEILLKL */
97         20,
98         /** RTEILLCP */
99         20,
100         /** RTEINCHS */
101         24,
102         /** RTEHNDNF */
103         -1,
104         /** RTEMEMOV */
105         22,
106         /** RTEFHTLG */
107         22,
108         /** RTEILLRT */
109         -1,
110         /** RTEREFTN */
111         21,
112         /** RTEDIVBZ */
113         01,
114         /** RTESYSER */
115         02,
116         /** RTEILLIO */
117         02,
118         /** RTEIOERR */
119         02,
120         /** RTECNTOP */
121         02,
122         /** RTEBADFM */
123         02,
124         /** RTEILLRS */
125         20,
126         /** RTETMPRC */
127         02,
128         /** RTEINVND */
129         02,
130         /** RTENEGST */
131         23,
132         /** RTENONGL */
133         -1
134 };
135
136 /**
137  * Primitive type appetites for moveparams() :
138  */
139 int primapet[] = {
140         /** INTEGER */
141         APINT,
142         /** REAL */
143         APREAL,
144         /** BOOLEAN */
145         APINT,
146         /** CHAR */
147         APINT,
148         /** COROUTINE */
149         APREF,
150         /** PROCESS */
151         APREF,
152         /** STRING */
153         APINT
154 };
155
156 /**
157  * instruction counter
158  */
159 word ic;
160
161 /**
162  * previous ic for redecoding after compact.
163  */
164 word lastic;
165
166 /**
167  * opcode of L-code instruction
168  */
169 int opcode;
170
171 /**
172  * arguments of L-code instructions
173  */
174 word a1, a2, a3;
175
176 /**
177  * \defgroup kernel variables for the running system:
178  */
179 /**@{*/
180 /**
181  * code and data memory size
182  */
183 word memorysize = DEFMEMSIZE;
184
185 /**
186  * pointers to current object
187  */
188 word c1, c2;
189
190 /**
191  * DISPLAY offset in process object
192  */
193 word dispoff;
194 /**
195  * indirect DISPLAY offset in process object
196  */
197 word disp2off;
198
199 /**
200  * DISPLAY address - physical addresses
201  */
202 word display;
203 /**
204  * DISPLAY address - indirect addresses
205  */
206 word display2;
207
208 /**
209  * main block object
210  */
211 word mainprog;
212
213 /**
214  * offset of variable main
215  **/
216 word mnoff;
217
218 /**@}*/
219
220 /**
221  * default: no compactification message
222  */
223 bool infmode = FALSE;
224
225 /**
226  * TRUE if trace is printed
227  */
228 bool debug = FALSE;
229
230 /**
231  * output file for trace
232  */
233 FILE *tracefile;
234
235 /**
236  * for continue execution
237  */
238 jmp_buf contenv;