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