1 (* keyc.def provides an interface to emitting symbols which.
3 Copyright (C) 2016-2022 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
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)
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.
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/>. *)
22 DEFINITION MODULE keyc ;
24 FROM mcPretty IMPORT pretty ;
25 FROM DynamicStrings IMPORT String ;
26 FROM decl IMPORT node ;
27 FROM nameKey IMPORT Name ;
31 useUnistd - need to use unistd.h call using open/close/read/write require this header.
38 useThrow - use the throw function.
45 useStorage - indicate we have used storage.
48 PROCEDURE useStorage ;
52 useFree - indicate we have used free.
59 useMalloc - indicate we have used malloc.
66 useProc - indicate we have used proc.
73 useTrue - indicate we have used TRUE.
80 useFalse - indicate we have used FALSE.
87 useNull - indicate we have used NULL.
94 useMemcpy - indicate we have used memcpy.
101 useIntMin - indicate we have used INT_MIN.
104 PROCEDURE useIntMin ;
108 useUIntMin - indicate we have used UINT_MIN.
111 PROCEDURE useUIntMin ;
115 useLongMin - indicate we have used LONG_MIN.
118 PROCEDURE useLongMin ;
122 useULongMin - indicate we have used ULONG_MIN.
125 PROCEDURE useULongMin ;
129 useCharMin - indicate we have used CHAR_MIN.
132 PROCEDURE useCharMin ;
136 useUCharMin - indicate we have used UCHAR_MIN.
139 PROCEDURE useUCharMin ;
143 useIntMax - indicate we have used INT_MAX.
146 PROCEDURE useIntMax ;
150 useUIntMax - indicate we have used UINT_MAX.
153 PROCEDURE useUIntMax ;
157 useLongMax - indicate we have used LONG_MAX.
160 PROCEDURE useLongMax ;
164 useULongMax - indicate we have used ULONG_MAX.
167 PROCEDURE useULongMax ;
171 useCharMax - indicate we have used CHAR_MAX.
174 PROCEDURE useCharMax ;
178 useUCharMax - indicate we have used UChar_MAX.
181 PROCEDURE useUCharMax ;
185 useSize_t - indicate we have used size_t.
188 PROCEDURE useSize_t ;
192 useSSize_t - indicate we have used ssize_t.
195 PROCEDURE useSSize_t ;
199 useLabs - indicate we have used labs.
206 useAbs - indicate we have used abs.
213 useFabs - indicate we have used fabs.
220 useFabsl - indicate we have used fabsl.
227 useException - use the exceptions module, mcrts.
230 PROCEDURE useException ;
234 useComplex - use the complex data type.
237 PROCEDURE useComplex ;
241 useM2RTS - indicate we have used M2RTS in the converted code.
248 useStrlen - indicate we have used strlen in the converted code.
251 PROCEDURE useStrlen ;
255 useCtype - indicate we have used the toupper function.
262 genDefs - generate definitions or includes for all
263 macros and prototypes used.
266 PROCEDURE genDefs (p: pretty) ;
270 genConfigSystem - generate include files for config.h and system.h
271 within the GCC framework.
274 PROCEDURE genConfigSystem (p: pretty) ;
278 enterScope - enter a scope defined by, n.
281 PROCEDURE enterScope (n: node) ;
285 leaveScope - leave the scope defined by, n.
288 PROCEDURE leaveScope (n: node) ;
292 cname - attempts to declare a symbol with name, n, in the
293 current scope. If there is no conflict with the
294 target language then NIL is returned, otherwise
295 a mangled name is returned as a String.
296 If scopes is FALSE then only the keywords and
297 macros are detected for a clash (all scoping
301 PROCEDURE cname (n: Name; scopes: BOOLEAN) : String ;
305 cnamen - attempts to declare a symbol with name, n, in the
306 current scope. If there is no conflict with the
307 target language then NIL is returned, otherwise
308 a mangled name is returned as a Name
309 If scopes is FALSE then only the keywords and
310 macros are detected for a clash (all scoping
314 PROCEDURE cnamen (n: Name; scopes: BOOLEAN) : Name ;
318 cp - include C++ keywords and standard declarations to avoid.