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 =======================================================================
38 * \defgroup AppetitesOfValues Appetites of values
41 /** integer,boolean,string,char */
45 #define APREAL sizeof(real)/sizeof(word)
48 * To tell apart a virtual address
49 * (any reference type) from any other type
53 /** actual size of reference type */
56 /** formal type value */
59 /** formal procedure or function value, = apref + 1 */
62 #define APOPCODE (sizeof(extopcode) + sizeof(word) - 1) / sizeof(word)
74 /* Values identifying types and formal parameters: */
77 #define FORMFUNC 7 /* parameter "function" */
78 #define FORMPROC 8 /* parameter "procedure" */
79 #define FORMTYPE 9 /* parameter "type", also formal type */
80 #define PARIN 11 /* parameter "input" */
81 #define PAROUT 12 /* parameter "output" */
82 #define PARINOUT 16 /* parameter "inout" */
83 #define PUREPROCESS 13 /* type PROCESS */
84 #define PURECOROUTINE 14 /* type COROUTINE */
85 #define PRIMITIVETYPE 15 /* simple type */
86 #define CLASSTYPE 17 /* class type */
87 #define FILETYPE 18 /* file type */
90 /* Values to identify kinds of array elements : */
92 #define AINT -1 /* arrayof integer */
93 #define AREAL -3 /* arrayof real */
94 #define AVIRT -2 /* arrayof reference */
95 #define APROCESS -4 /* process reference implemented as arrayof */
96 #define FILEOBJECT -11 /* file object */
97 #define SKILLED -99 /* killed object, only for compactification */
101 #define DUMMY -1 /* dummy unit or prefix : SL for main block */
102 #define MAINBLOCK 0 /* main block prototype number */
103 #define MAXPROT 500 /* limit for the number of prototypes */
106 /* L-code instruction addressing modes : */
108 #define GLOBAL 0 /* M[ N ] */
109 #define LOCAL 1 /* M[ c1+N ] */
110 #define TEMPLOCAL 2 /* M[ c2+N ] */
111 #define REMOTE 3 /* M[ M[ K ]+N ] */
112 #define INDIRECT 4 /* M[ M[ N ] ] */
113 #define IMMEDIATE 5 /* N */
114 #define CONSTANT 6 /* M[ N ] */
115 #define DOTACCESS 7 /* M[ M[ display+K ]+N ] */
116 #define NOARGUMENT 8 /* ------ */
120 /* Prototype kind : */
134 #define LRECORD RECORD
135 #define LFUNCTION FUNCTION
136 #define LPROCEDURE PROCEDURE
141 typedef int protaddr; /* mainblock..maxprot ; mainblock = 0; */
142 /* INDIRECT ADDRESS OF PROTOTYPE */
143 typedef int dprotaddr; /* PROTADDR + DUMMY */
144 typedef int protkind;
147 #define dprotaddr int
151 /* TODO: Conditionally restore it:*/
152 /*typedef int word;*/
156 * \defgroup Prototype Prototype
161 * Prototype of syntactic father
162 * or dummy for the main block
164 dprotaddr slprototype;
166 /** address of code */
168 /** object's total length */
171 * distance from beginning of object to
172 * temporary reference variables
176 /** beginning and length of table with */
180 * offsets of reference values in object;
181 * without SL, DL, CL and temporary values
184 /** beginning and length of table with */
186 /** offsets of parameters */
189 /** beginning and length of table with */
191 /** prototype numbers of prefix sequence */
194 /** lastwill code address */
196 /** list of handlers, 0 if empty */
199 * address of table for conversion:
200 * virtual number --> prototype
205 * only for processes:
208 /** lowest procedure prototype number */
210 /** size of RPC mask for that process */
215 * for procedures and functions
216 * \defgroup PrototypeForFunctions
219 /* virtual number or -1 if not virtual */
225 * \defgroup PrototypeForAll
233 * only for procedures, functions and processes:
234 * \defgroup PrototypeForProceduresFunctionsProcesses
237 /** address of table with parameters descr. addresses */
242 * only for functions:
243 * \defgroup PrototypeForFunctions
251 } protdescr,*pointprdsc;