-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathm2dm.def
199 lines (179 loc) · 8.53 KB
/
m2dm.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
DEFINITION MODULE M2DM; (* NW 23.3.85; WH 22.5.85 / 9.1.85; *)
(* HS 19.2.86 / 31.5.86 *)
FROM M2Sets IMPORT aFakeSet;
FROM SYSTEM IMPORT ADDRESS;
CONST WordSize = 16;
MaxChar = 377C;
MaxCard = 65535;
MinInt = -32767 - 1;
MaxInt = 32767;
MinDouble = 80000000H;
MaxDouble = 7FFFFFFFH;
NilVal = 0;
WorkingStorage = 22; (* preserve 22 bytes of working storage
on the stack below the procedure
local variables. *)
ExpResult = 16; (* location on direct page where results of
expressions are kept *)
DirectPageSize = 256;
TYPE ObjPtr = POINTER TO Object;
StrPtr = POINTER TO Structure;
ParPtr = POINTER TO Parameter;
PDPtr = POINTER TO PDesc;
KeyPtr = POINTER TO Key;
aAdr = INTEGER;
aSize = LONGINT;
ObjClass = (Header, Const, Typ, Var, Field, Proc, Tool, Module, Temp);
sObjClass = SET OF ObjClass;
(* Note: for scalar types: form <= Double *)
(* for subrange types: RBaseTyp^.form < form *)
(* for structured types: form > Opaque *)
StrForm = (Undef, Bool, Char, Card, CardInt, Int, Enum, LCard, Double,
Range, Real, LongReal, Pointer, Set, ProcTyp, Opaque,
String, Array, Record);
(* Note: basic standard procedures : Abs .. Val *)
(* floating point supplement : ACos .. Round *)
Standard = (Abs, Adr, Cap, Chr, Dec, Dispose, Excl, Float, FloatD,
Getreg, Halt, High, Inc, Incl, Inline, IOTransfer,
Long, Max, Min, New, NewProcess, Odd, Ord, Setreg,
Shift, Short, Size, Transfer, Tsize, Trunc, TruncD,
Val,
ACos, ASin, ATan, ATanH, Cos, CosH, EtoX, EtoXM1, GetExp,
GetMan, LogN, LogNP1, Log10, Log2, Scale, Sin, SinH,
Sqrt, Tan, TanH, TentoX, TwotoX, CRom, CRomD, Entier,
Round,
NonStand);
ConstValue = RECORD
strChar: BOOLEAN;
modNo: CARDINAL;
CASE :StrForm OF
Undef: U: LONGINT;
| Bool: B: BOOLEAN;
| Char, Enum: Ch: CHAR;
prev: ObjPtr;
| Card, CardInt: C: CARDINAL;
| Int: I: INTEGER;
| LCard, Double: D: LONGINT;
| Real: R: REAL;
| Set: FS: aFakeSet;
| String: D0, D1, D2, D3: CARDINAL;
| LongReal: X: LONGREAL;
(* M2RM assumes correct overlaying of X *)
(* with the fields D0, D1, D2 and D3. *)
END;
END;
PDesc = RECORD
forward, exp: BOOLEAN;
num, lev, size: CARDINAL;
adr: aAdr;
entryPoint: CARDINAL;
accessLink: CARDINAL;
END;
language = (modula2, pascal);
Object = RECORD
name: CARDINAL; (* index to name buffer *)
typ: StrPtr;
left,
right,
next: ObjPtr;
exported: BOOLEAN;
parent: ObjPtr;
CASE class: ObjClass OF
Header: kind: ObjClass; (* Typ, Proc, Module *)
last, heap: ObjPtr;
withadr: aAdr;
| Const: conval: ConstValue;
| Typ: mod: ObjPtr;
| Var: varpar: BOOLEAN;
vmod, vlev: CARDINAL;
vadr: aAdr;
vpar: BOOLEAN;
| Field: offset: aAdr;
| Proc: pd: PDPtr;
firstParam: ParPtr;
firstLocal: ObjPtr;
pmod: CARDINAL;
procType: language;
| Tool: cd: PDPtr;
firstArg: ParPtr;
std: Standard;
cnum: CARDINAL;
GSOSproc: BOOLEAN;
| Module: key: KeyPtr;
firstObj,
root: ObjPtr;
modno: CARDINAL;
isInt: BOOLEAN;
parentMod: CARDINAL;
| Temp: baseref: INTEGER;
END;
END;
Structure = RECORD
strobj: ObjPtr; (* object (type) naming structure *)
size: aSize;
ref: CARDINAL;
CASE form: StrForm OF
| Undef, Bool, Char, Card, CardInt, Int, (* V2.6y *)
LCard, Double, Real, LongReal, String: (* V2.6y *)
| Enum: ConstLink: ObjPtr;
NofConst: CARDINAL;
| Range: RBaseTyp: StrPtr;
min, max: LONGINT;
BndAdr: aAdr;
| Pointer: PBaseTyp: StrPtr;
BaseId: CARDINAL; (* forward refs *)
| Set: SBaseTyp: StrPtr;
| Array: ElemTyp,
IndexTyp: StrPtr;
dyn: BOOLEAN;
| Record: firstFld: ObjPtr;
debugOffset: CARDINAL;
debugDefining: BOOLEAN;
| ProcTyp: firstPar: ParPtr;
resTyp: StrPtr;
| Opaque: (* no field *)
END;
END;
Parameter = RECORD
name: CARDINAL;
varpar: BOOLEAN;
typ: StrPtr;
next: ParPtr;
END;
Key = RECORD
k0, k1, k2: CARDINAL;
END;
VAR mainmod: ObjPtr;
sysmod: ObjPtr;
notyp: StrPtr;
undftyp: StrPtr;
booltyp: StrPtr;
chartyp: StrPtr;
cardtyp: StrPtr;
cardinttyp: StrPtr;
inttyp: StrPtr;
bitstyp: StrPtr;
lcardtyp: StrPtr;
dbltyp: StrPtr;
realtyp: StrPtr;
lrltyp: StrPtr;
proctyp: StrPtr;
stringtyp: StrPtr;
addrtyp: StrPtr;
wordtyp: StrPtr;
bytetyp: StrPtr;
rngchk: BOOLEAN;
ovflchk: BOOLEAN;
stackchk: BOOLEAN;
nilchk: BOOLEAN;
databank: BOOLEAN;
PROCEDURE ALLOCATE(VAR a: ADDRESS; n: CARDINAL);
PROCEDURE Available(): CARDINAL;
PROCEDURE CloseHeaps;
PROCEDURE CloseMainHeap;
PROCEDURE NewHeap;
PROCEDURE ResetHeap(a: ADDRESS);
PROCEDURE ResizeHeap;
PROCEDURE RevertToMainHeap;
PROCEDURE InitM2DM;
END M2DM.