]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | (* M2System.def defines the SYSTEM builtin types. |
2 | ||
83ffe9cd | 3 | Copyright (C) 2001-2023 Free Software Foundation, Inc. |
1eee94d3 GM |
4 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
5 | ||
6 | This file is part of GNU Modula-2. | |
7 | ||
8 | GNU Modula-2 is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GNU Modula-2 is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GNU Modula-2; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. *) | |
21 | ||
22 | DEFINITION MODULE M2System ; | |
23 | ||
24 | (* | |
25 | Title : M2System | |
26 | Author : Gaius Mulley | |
27 | System : UNIX (gm2) | |
28 | Date : Tue Jul 11 08:39:17 2000 | |
29 | Description: Implements the base types of the module SYSTEM | |
30 | for the GNU Modula-2 compiler. Note that the base types | |
31 | are mapped onto their equivalents in the gcc backend. | |
32 | *) | |
33 | ||
34 | FROM m2linemap IMPORT location_t ; | |
35 | ||
36 | EXPORT QUALIFIED | |
37 | System, (* The SYSTEM module symbol. *) | |
38 | Loc, (* ISO specific System Type. *) | |
39 | ||
40 | Word, (* System Type *) | |
41 | Byte, (* System Type *) | |
42 | Address, (* System Type *) | |
43 | CSizeT, (* System Type *) | |
44 | CSSizeT, (* System Type *) | |
45 | ||
46 | Adr, (* System Function *) | |
47 | TSize, (* System Function *) | |
48 | ||
49 | AddAdr, (* ISO specific System Function *) | |
50 | SubAdr, (* ISO specific System Function *) | |
51 | DifAdr, (* ISO specific System Function *) | |
52 | MakeAdr, (* ISO specific System Function *) | |
53 | Rotate, (* ISO specific System Function *) | |
54 | Shift, (* ISO specific System Function *) | |
55 | Cast, (* ISO specific System Function *) | |
56 | Throw, (* GNU Modula-2 extension *) | |
57 | TBitSize, (* GNU Modula-2 extension *) | |
58 | ||
59 | GetSystemTypeMinMax, | |
60 | IsPseudoSystemFunction, IsPseudoSystemProcedure, | |
61 | IsSystemType, | |
62 | IsPseudoSystemFunctionConstExpression, | |
63 | ||
64 | IntegerN, CardinalN, WordN, RealN, SetN, ComplexN, | |
65 | IsIntegerN, IsCardinalN, IsWordN, | |
66 | IsRealN, IsSetN, IsComplexN, | |
67 | IsGenericSystemType, | |
68 | IsSameSizePervasiveType, IsSameSize, | |
69 | InitSystem ; | |
70 | ||
71 | ||
72 | VAR | |
73 | System, | |
74 | Loc, | |
75 | Word, Byte, | |
76 | Address, | |
77 | CSizeT, CSSizeT, | |
78 | ||
79 | Adr, | |
80 | TSize, TBitSize, | |
81 | AddAdr, SubAdr, | |
82 | DifAdr, MakeAdr, | |
83 | Rotate, Shift, | |
84 | Cast, Throw : CARDINAL ; | |
85 | ||
86 | ||
87 | (* | |
88 | InitSystem - initializes the base types Word and Byte in the module | |
89 | SYSTEM. | |
90 | *) | |
91 | ||
92 | PROCEDURE InitSystem ; | |
93 | ||
94 | ||
95 | (* | |
96 | GetSystemTypeMinMax - returns the minimum and maximum values for a given system type. | |
97 | *) | |
98 | ||
99 | PROCEDURE GetSystemTypeMinMax (type: CARDINAL; VAR min, max: CARDINAL) ; | |
100 | ||
101 | ||
102 | (* | |
103 | IsPseudoSystemFunction - returns true if Sym is a SYSTEM pseudo function. | |
104 | *) | |
105 | ||
106 | PROCEDURE IsPseudoSystemFunction (sym: CARDINAL) : BOOLEAN ; | |
107 | ||
108 | ||
109 | (* | |
110 | IsPseudoSystemProcedure - returns true if Sym is a SYSTEM pseudo procedure. | |
111 | *) | |
112 | ||
113 | PROCEDURE IsPseudoSystemProcedure (sym: CARDINAL) : BOOLEAN ; | |
114 | ||
115 | ||
116 | (* | |
117 | IsPseudoSystemFunctionConstExpression - returns TRUE if this procedure | |
118 | is legal in a constant expression. | |
119 | *) | |
120 | ||
121 | PROCEDURE IsPseudoSystemFunctionConstExpression (sym: CARDINAL) : BOOLEAN ; | |
122 | ||
123 | ||
124 | (* | |
125 | IsSystemType - returns TRUE if Sym is a SYSTEM (inbuilt) type. | |
126 | It does not search your SYSTEM implementation module. | |
127 | *) | |
128 | ||
129 | PROCEDURE IsSystemType (sym: CARDINAL) : BOOLEAN ; | |
130 | ||
131 | ||
132 | (* | |
133 | IntegerN - returns the symbol associated with INTEGER[N]. | |
134 | NulSym is returned if the type does not exist. | |
135 | *) | |
136 | ||
137 | PROCEDURE IntegerN (bitlength: CARDINAL) : CARDINAL ; | |
138 | ||
139 | ||
140 | (* | |
141 | CardinalN - returns the symbol associated with CARDINAL[N]. | |
142 | NulSym is returned if the type does not exist. | |
143 | *) | |
144 | ||
145 | PROCEDURE CardinalN (bitlength: CARDINAL) : CARDINAL ; | |
146 | ||
147 | ||
148 | (* | |
149 | WordN - returns the symbol associated with WORD[N]. | |
150 | NulSym is returned if the type does not exist. | |
151 | *) | |
152 | ||
153 | PROCEDURE WordN (bitlength: CARDINAL) : CARDINAL ; | |
154 | ||
155 | ||
156 | (* | |
157 | SetN - returns the symbol associated with SET[N]. | |
158 | NulSym is returned if the type does not exist. | |
159 | *) | |
160 | ||
161 | PROCEDURE SetN (bitlength: CARDINAL) : CARDINAL ; | |
162 | ||
163 | ||
164 | (* | |
165 | RealN - returns the symbol associated with REAL[N]. | |
166 | NulSym is returned if the type does not exist. | |
167 | *) | |
168 | ||
169 | PROCEDURE RealN (bitlength: CARDINAL) : CARDINAL ; | |
170 | ||
171 | ||
172 | (* | |
173 | ComplexN - returns the symbol associated with COMPLEX[N]. | |
174 | NulSym is returned if the type does not exist. | |
175 | *) | |
176 | ||
177 | PROCEDURE ComplexN (bitlength: CARDINAL) : CARDINAL ; | |
178 | ||
179 | ||
180 | (* | |
181 | IsIntegerN - returns the TRUE if, sym, is one of the SYSTEM | |
182 | INTEGER types (not the base INTEGER type). | |
183 | *) | |
184 | ||
185 | PROCEDURE IsIntegerN (sym: CARDINAL) : BOOLEAN ; | |
186 | ||
187 | ||
188 | (* | |
189 | IsCardinalN - returns the TRUE if, sym, is one of the SYSTEM | |
190 | CARDINAL types (not the base CARDINAL type). | |
191 | *) | |
192 | ||
193 | PROCEDURE IsCardinalN (sym: CARDINAL) : BOOLEAN ; | |
194 | ||
195 | ||
196 | (* | |
197 | IsWordN - returns the TRUE if, sym, is one of the SYSTEM | |
198 | WORD[n] types (not the default SYSTEM WORD type). | |
199 | *) | |
200 | ||
201 | PROCEDURE IsWordN (sym: CARDINAL) : BOOLEAN ; | |
202 | ||
203 | ||
204 | (* | |
205 | IsSetN - returns the TRUE if, sym, is one of the SYSTEM | |
206 | SET[n] types (not the default SYSTEM BITSET type). | |
207 | *) | |
208 | ||
209 | PROCEDURE IsSetN (sym: CARDINAL) : BOOLEAN ; | |
210 | ||
211 | ||
212 | (* | |
213 | IsRealN - returns the TRUE if, sym, is one of the SYSTEM | |
214 | REAL[n] types (not the default base REAL type). | |
215 | *) | |
216 | ||
217 | PROCEDURE IsRealN (sym: CARDINAL) : BOOLEAN ; | |
218 | ||
219 | ||
220 | (* | |
221 | IsComplexN - returns the TRUE if, sym, is one of the SYSTEM | |
222 | COMPLEX[n] types (not the default base COMPLEX, | |
223 | LONGCOMPLEX or SHORTCOMPLEX types). | |
224 | *) | |
225 | ||
226 | PROCEDURE IsComplexN (sym: CARDINAL) : BOOLEAN ; | |
227 | ||
228 | ||
229 | (* | |
230 | IsGenericSystemType - returns TRUE if, sym, is of type | |
231 | BYTE, WORD or any other length. | |
232 | *) | |
233 | ||
234 | PROCEDURE IsGenericSystemType (sym: CARDINAL) : BOOLEAN ; | |
235 | ||
236 | ||
237 | (* | |
238 | IsSameSizePervasiveType - returns TRUE if a or b are CARDINAL, INTEGER, REAL, | |
239 | LONGREAL, SHORTREAL and the other type is the same | |
240 | size and of the same type. | |
241 | *) | |
242 | ||
243 | PROCEDURE IsSameSizePervasiveType (a, b: CARDINAL) : BOOLEAN ; | |
244 | ||
245 | ||
246 | (* | |
247 | IsSameSize - return TRUE if SIZE(a)=SIZE(b) | |
248 | *) | |
249 | ||
250 | PROCEDURE IsSameSize (a, b: CARDINAL) : BOOLEAN ; | |
251 | ||
252 | ||
253 | END M2System. |