Added upstream version.
[vlp.git] / 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 /* Variables common with generator : */
8
9 protdescr *prototype[ MAXPROT+1 ]; /* prototypes */
10 word ipradr;                    /* address of primitive types descriptions */
11 word temporary;                 /* address of global temporary variables */
12 word strings;                   /* base for string constants */
13 word lastprot;                  /* the last used prototype number */
14 word freem;                     /* first free cell in M */
15 word currfile = 2;              /* current file virtual address */
16
17 /* Interpreter own variables : */
18
19 memory M;                       /* main memory for code and data */
20 union value *param;             /* for comunication with standard procs */
21
22 /* offset conversion table for compactification */
23 int offset[] = { DUMMY, SL, DL, CL, CHD, VIRTSC };
24
25 /* signal to number conversion table */
26 /* -1 stands for an unrecoverable error which cannot be serviced by handler */
27
28 int scot[] =
29 {
30                 20,             /* RTESLCOF */
31                 20,             /* RTEUNSTP */
32                 20,             /* RTEILLAT */
33                 20,             /* RTEILLDT */
34                 20,             /* RTECORTM */
35                 20,             /* RTECORAC */
36                 23,             /* RTEINVIN */
37                 23,             /* RTEILLAB */
38                 21,             /* RTEINCQA */
39                 24,             /* RTEINCAS */
40                 20,             /* RTEFTPMS */
41                 20,             /* RTEILLKL */
42                 20,             /* RTEILLCP */
43                 24,             /* RTEINCHS */
44                 -1,             /* RTEHNDNF */
45                 22,             /* RTEMEMOV */
46                 22,             /* RTEFHTLG */
47                 -1,             /* RTEILLRT */
48                 21,             /* RTEREFTN */
49                 01,             /* RTEDIVBZ */
50                 02,             /* RTESYSER */
51                 02,             /* RTEILLIO */
52                 02,             /* RTEIOERR */
53                 02,             /* RTECNTOP */
54                 02,             /* RTEBADFM */
55                 20,             /* RTEILLRS */
56                 02,             /* RTETMPRC */
57                 02,             /* RTEINVND */
58                 23,             /* RTENEGST */
59                 -1              /* RTENONGL */
60 };
61
62 /* Primitive type appetites for moveparams() : */
63
64 int primapet[] =
65 {
66                 APINT,          /* INTEGER */
67                 APREAL,         /* REAL */
68                 APINT,          /* BOOLEAN */
69                 APINT,          /* CHAR */
70                 APREF,          /* COROUTINE */
71                 APREF,          /* PROCESS */
72                 APINT           /* STRING */
73 };
74
75 word ic;                        /* instruction counter */
76 word lastic;                    /* previous ic for redecoding after compact. */
77 int opcode;                     /* opcode of L-code instruction */
78 word a1, a2, a3;                /* arguments of L-code instructions */
79
80 /* kernel variables for the running system: */
81
82 word memorysize = DEFMEMSIZE;   /* code and data memory size */
83 word c1, c2;                    /* pointers to current object */
84 word dispoff;                   /* DISPLAY offset in process object */
85 word disp2off;                  /* indirect DISPLAY offset in process object */
86 word display;                   /* DISPLAY address - physical addresses */
87 word display2;                  /* DISPLAY address - indirect addresses */
88 word mainprog;                  /* main block object */
89 word mnoff;                     /* offset of variable main */
90
91
92 bool infmode = FALSE;           /* default: no compactification message */
93 bool debug = FALSE;             /* TRUE if trace is printed */
94 FILE *tracefile;                /* output file for trace */
95
96 jmp_buf contenv;                /* for continue execution */