1 /* Loglan82 Compiler&Interpreter
2 Copyright (C) 1993 Institute of Informatics, University of Warsaw
3 Copyright (C) 1993, 1994 LITA, Pau
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
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.
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.
19 contacts: Andrzej.Salwicki@univ-pau.fr
22 LITA Departement d'Informatique
24 Avenue de l'Universite
26 tel. ++33 59923154 fax. ++33 59841696
28 =======================================================================
36 /* Appetites of values : */
37 #define APINT 1 /* integer,boolean,string,char */
38 #define APREAL sizeof(real)/sizeof(word) /* real */
39 #define APVIRT 4 /* TO TELL APART A VIRTUAL ADDRESS */
40 /* (ANY REFERENCE TYPE) FROM ANY OTHER TYPE */
41 #define APREF 2 /* ACTUAL SIZE OF REFERENCE TYPE */
42 #define APFMTYPE 2 /* FORMAL TYPE VALUE */
43 #define APFMPROC 3 /* FORMAL PROCEURE OR FUNCTION VALUE, = APREF+1*/
44 #define APOPCODE (sizeof(extopcode)+sizeof(word)-1)/sizeof(word)
54 /* Values identifying types and formal parameters : */
56 #define FORMFUNC 7 /* parameter "function" */
57 #define FORMPROC 8 /* parameter "procedure" */
58 #define FORMTYPE 9 /* parameter "type", also formal type */
59 #define PARIN 11 /* parameter "input" */
60 #define PAROUT 12 /* parameter "output" */
61 #define PARINOUT 16 /* parameter "inout" */
62 #define PUREPROCESS 13 /* type PROCESS */
63 #define PURECOROUTINE 14 /* type COROUTINE */
64 #define PRIMITIVETYPE 15 /* simple type */
65 #define CLASSTYPE 17 /* class type */
66 #define FILETYPE 18 /* file type */
69 /* Values to identify kinds of array elements : */
71 #define AINT -1 /* arrayof integer */
72 #define AREAL -3 /* arrayof real */
73 #define AVIRT -2 /* arrayof reference */
74 #define APROCESS -4 /* process reference implemented as arrayof */
75 #define FILEOBJECT -11 /* file object */
76 #define SKILLED -99 /* killed object, only for compactification */
79 #define DUMMY -1 /* dummy unit or prefix : SL for main block */
80 #define MAINBLOCK 0 /* main block prototype number */
81 #define MAXPROT 500 /* limit for the number of prototypes */
84 /* L-code instruction addressing modes : */
86 #define GLOBAL 0 /* M[ N ] */
87 #define LOCAL 1 /* M[ c1+N ] */
88 #define TEMPLOCAL 2 /* M[ c2+N ] */
89 #define REMOTE 3 /* M[ M[ K ]+N ] */
90 #define INDIRECT 4 /* M[ M[ N ] ] */
91 #define IMMEDIATE 5 /* N */
92 #define CONSTANT 6 /* M[ N ] */
93 #define DOTACCESS 7 /* M[ M[ display+K ]+N ] */
94 #define NOARGUMENT 8 /* ------ */
97 /* Prototype kind : */
110 #define LRECORD RECORD
111 #define LFUNCTION FUNCTION
112 #define LPROCEDURE PROCEDURE
117 typedef int protaddr ; /* mainblock..maxprot ; mainblock = 0; */
118 /* INDIRECT ADDRESS OF PROTOTYPE */
119 typedef int dprotaddr ; /* PROTADDR + DUMMY */
120 typedef int protkind ;
123 #define dprotaddr int
132 dprotaddr slprototype ; /* PROTOTYPE OF SYNTACTIC FATHER */
133 /* OR DUMMY FOR THE MAIN BLOCK */
134 word codeaddr; /* address of code */
135 word appetite; /* object's total length */
136 word span; /* distance from beginning of object to */
137 /* temporary reference variables */
138 word reflist; /* beginning and length of table with */
140 int lthreflist; /* offsets of reference values in object; */
141 /* without SL, DL, CL and temporary values */
142 word parlist; /* beginning and length of table with */
143 int lthparlist; /* offsets of parameters */
145 word preflist; /* beginning and length of table with */
146 int lthpreflist; /* prototype numbers of prefix sequence */
148 word lastwill; /* lastwill code address */
149 word handlerlist; /* list of handlers, 0 if empty */
150 word virtlist; /* address of table for conversion: */
151 /* virtual number --> prototype */
153 /* only for processes : */
154 protaddr maskbase ; /* lowest procedure prototype number */
155 int masksize ; /* size of RPC mask for that process */
157 /* for procedures and functions */
158 int virtnumber; /* virtual number or -1 if not virtual */
161 protkind kind ; /* kind of unit */
163 /* only for procedures, functions and processes : */
164 word pfdescr; /* address of table with parameters descr. addresses */
166 /* only for functions : */
168 word finaltype; /* type of result */
170 } protdescr,*pointprdsc;