libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / m2 / mc / keyc.mod
blobf3f09309ad5c90cebaf3af34c2ac181ac84ee126
1 (* keyc maintains the C name scope and avoids C/C++ name conflicts.
2 Copyright (C) 2016-2024 Free Software Foundation, Inc.
4 This file is part of GNU Modula-2.
6 GNU Modula-2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. *)
20 IMPLEMENTATION MODULE keyc ;
22 FROM mcPretty IMPORT pretty, print, prints, setNeedSpace, noSpace ;
23 FROM Storage IMPORT ALLOCATE ;
24 FROM DynamicStrings IMPORT InitString, KillString, ConCat, ConCatChar,
25 Mark, string, InitStringCharStar ;
26 FROM symbolKey IMPORT symbolTree, getSymKey, putSymKey, initTree, killTree ;
27 FROM nameKey IMPORT makeKey, makekey, keyToCharStar ;
28 FROM mcOptions IMPORT getHPrefix, getGccConfigSystem, useBool ;
31 TYPE
32 scope = POINTER TO RECORD
33 scoped : node ;
34 symbols: symbolTree ;
35 next : scope ;
36 END ;
38 VAR
39 stack,
40 freeList : scope ;
41 keywords,
42 macros : symbolTree ;
44 initializedCP,
45 initializedGCC,
47 seenGccTree,
48 seenGccLocation,
49 seenIntMin,
50 seenUIntMin,
51 seenLongMin,
52 seenULongMin,
53 seenCharMin,
54 seenUCharMin,
55 seenIntMax,
56 seenUIntMax,
57 seenLongMax,
58 seenULongMax,
59 seenCharMax,
60 seenUCharMax,
61 seenLabs,
62 seenAbs,
63 seenFabs,
64 seenFabsl,
65 seenSize_t,
66 seenSSize_t,
68 seenUnistd,
69 seenSysTypes,
70 seenThrow,
71 seenFree,
72 seenMalloc,
73 seenStorage,
74 seenProc,
75 seenTrue,
76 seenFalse,
77 seenNull,
78 seenMemcpy,
79 seenException,
80 seenComplex,
81 seenM2RTS,
82 seenStrlen,
83 seenCtype : BOOLEAN ;
87 checkGccConfigSystem - issues the GCC include config.h, include system.h
88 instead of the standard host include.
91 PROCEDURE checkGccConfigSystem (p: pretty) ;
92 BEGIN
93 IF getGccConfigSystem ()
94 THEN
95 IF NOT initializedGCC
96 THEN
97 initializedGCC := TRUE ;
98 print (p, '#include "config.h"\n');
99 print (p, '#include "system.h"\n');
100 checkGccTypes (p)
103 END checkGccConfigSystem ;
107 useGccTree - indicate we have imported tree from gcctypes.
110 PROCEDURE useGccTree ;
111 BEGIN
112 seenGccTree := TRUE
113 END useGccTree ;
117 useGccLocation - indicate we have imported tree from gcctypes.
120 PROCEDURE useGccLocation ;
121 BEGIN
122 seenGccLocation := TRUE
123 END useGccLocation ;
127 useStorage - indicate we have used storage.
130 PROCEDURE useStorage ;
131 BEGIN
132 seenStorage := TRUE
133 END useStorage ;
137 useFree - indicate we have used free.
140 PROCEDURE useFree ;
141 BEGIN
142 seenFree := TRUE
143 END useFree ;
147 useMalloc - indicate we have used malloc.
150 PROCEDURE useMalloc ;
151 BEGIN
152 seenMalloc := TRUE
153 END useMalloc ;
157 useProc - indicate we have used proc.
160 PROCEDURE useProc ;
161 BEGIN
162 seenProc := TRUE
163 END useProc ;
167 useTrue - indicate we have used TRUE.
170 PROCEDURE useTrue ;
171 BEGIN
172 seenTrue := TRUE
173 END useTrue ;
177 useFalse - indicate we have used FALSE.
180 PROCEDURE useFalse ;
181 BEGIN
182 seenFalse := TRUE
183 END useFalse ;
187 useNull - indicate we have used NULL.
190 PROCEDURE useNull ;
191 BEGIN
192 seenNull := TRUE
193 END useNull ;
197 useMemcpy - indicate we have used memcpy.
200 PROCEDURE useMemcpy ;
201 BEGIN
202 seenMemcpy := TRUE
203 END useMemcpy ;
207 useIntMin - indicate we have used INT_MIN.
210 PROCEDURE useIntMin ;
211 BEGIN
212 seenIntMin := TRUE
213 END useIntMin ;
217 useUIntMin - indicate we have used UINT_MIN.
220 PROCEDURE useUIntMin ;
221 BEGIN
222 seenUIntMin := TRUE
223 END useUIntMin ;
227 useLongMin - indicate we have used LONG_MIN.
230 PROCEDURE useLongMin ;
231 BEGIN
232 seenLongMin := TRUE
233 END useLongMin ;
237 useULongMin - indicate we have used ULONG_MIN.
240 PROCEDURE useULongMin ;
241 BEGIN
242 seenULongMin := TRUE
243 END useULongMin ;
247 useCharMin - indicate we have used CHAR_MIN.
250 PROCEDURE useCharMin ;
251 BEGIN
252 seenCharMin := TRUE
253 END useCharMin ;
257 useUCharMin - indicate we have used UCHAR_MIN.
260 PROCEDURE useUCharMin ;
261 BEGIN
262 seenUCharMin := TRUE
263 END useUCharMin ;
267 useUIntMin - indicate we have used UINT_MIN.
270 PROCEDURE useUIntMin ;
271 BEGIN
272 seenUIntMin := TRUE
273 END useUIntMin ;
277 useIntMax - indicate we have used INT_MAX.
280 PROCEDURE useIntMax ;
281 BEGIN
282 seenIntMax := TRUE
283 END useIntMax ;
287 useUIntMax - indicate we have used UINT_MAX.
290 PROCEDURE useUIntMax ;
291 BEGIN
292 seenUIntMax := TRUE
293 END useUIntMax ;
297 useLongMax - indicate we have used LONG_MAX.
300 PROCEDURE useLongMax ;
301 BEGIN
302 seenLongMax := TRUE
303 END useLongMax ;
307 useULongMax - indicate we have used ULONG_MAX.
310 PROCEDURE useULongMax ;
311 BEGIN
312 seenULongMax := TRUE
313 END useULongMax ;
317 useCharMax - indicate we have used CHAR_MAX.
320 PROCEDURE useCharMax ;
321 BEGIN
322 seenCharMax := TRUE
323 END useCharMax ;
327 useUCharMax - indicate we have used UChar_MAX.
330 PROCEDURE useUCharMax ;
331 BEGIN
332 seenUCharMax := TRUE
333 END useUCharMax ;
337 useUIntMax - indicate we have used UINT_MAX.
340 PROCEDURE useUIntMax ;
341 BEGIN
342 seenUIntMax := TRUE
343 END useUIntMax ;
347 useSize_t - indicate we have used size_t.
350 PROCEDURE useSize_t ;
351 BEGIN
352 seenSize_t := TRUE
353 END useSize_t ;
357 useSSize_t - indicate we have used ssize_t.
360 PROCEDURE useSSize_t ;
361 BEGIN
362 seenSSize_t := TRUE ;
363 seenSysTypes := TRUE
364 END useSSize_t ;
368 useLabs - indicate we have used labs.
371 PROCEDURE useLabs ;
372 BEGIN
373 seenLabs := TRUE
374 END useLabs ;
378 useAbs - indicate we have used abs.
381 PROCEDURE useAbs ;
382 BEGIN
383 seenAbs := TRUE
384 END useAbs ;
388 useFabs - indicate we have used fabs.
391 PROCEDURE useFabs ;
392 BEGIN
393 seenFabs := TRUE
394 END useFabs ;
398 useFabsl - indicate we have used fabsl.
401 PROCEDURE useFabsl ;
402 BEGIN
403 seenFabsl := TRUE
404 END useFabsl ;
408 useM2RTS - indicate we have used M2RTS in the converted code.
411 PROCEDURE useM2RTS ;
412 BEGIN
413 seenM2RTS := TRUE
414 END useM2RTS ;
418 useStrlen - indicate we have used strlen in the converted code.
421 PROCEDURE useStrlen ;
422 BEGIN
423 seenStrlen := TRUE
424 END useStrlen ;
428 useCtype - indicate we have used the toupper function.
431 PROCEDURE useCtype ;
432 BEGIN
433 seenCtype := TRUE
434 END useCtype ;
438 checkGccTypes - if we have imported tree or location_t from gcctypes
439 then we include the gcc headers.
442 PROCEDURE checkGccTypes (p: pretty) ;
443 BEGIN
444 IF seenGccTree OR seenGccLocation
445 THEN
446 print (p, '#include "gcc-consolidation.h"\n\n')
448 END checkGccTypes ;
452 checkCtype -
455 PROCEDURE checkCtype (p: pretty) ;
456 BEGIN
457 IF seenCtype
458 THEN
459 checkGccConfigSystem (p) ;
460 IF getGccConfigSystem ()
461 THEN
462 (* GCC header files use a safe variant. *)
463 print (p, "#include <safe-ctype.h>\n")
464 ELSE
465 print (p, "#include <ctype.h>\n")
468 END checkCtype ;
472 checkAbs - check to see if the abs family, size_t or ssize_t have been used.
475 PROCEDURE checkAbs (p: pretty) ;
476 BEGIN
477 IF seenLabs OR seenAbs OR seenFabs OR seenFabsl OR seenSize_t OR seenSSize_t
478 THEN
479 checkGccConfigSystem (p);
480 IF NOT getGccConfigSystem ()
481 THEN
482 print (p, "#include <stdlib.h>\n")
485 END checkAbs ;
489 checkLimits -
492 PROCEDURE checkLimits (p: pretty) ;
493 BEGIN
494 IF seenMemcpy OR seenIntMin OR seenUIntMin OR
495 seenLongMin OR seenULongMin OR seenCharMin OR
496 seenUCharMin OR (* seenUIntMin OR *) seenIntMax OR
497 seenUIntMax OR seenLongMax OR seenULongMax OR
498 seenCharMax OR seenUCharMax (* OR seenUIntMax *)
499 THEN
500 checkGccConfigSystem (p);
501 IF NOT getGccConfigSystem ()
502 THEN
503 print (p, "#include <limits.h>\n")
506 END checkLimits ;
510 checkFreeMalloc -
513 PROCEDURE checkFreeMalloc (p: pretty) ;
514 BEGIN
515 IF seenFree OR seenMalloc
516 THEN
517 checkGccConfigSystem (p);
518 IF NOT getGccConfigSystem ()
519 THEN
520 print (p, "#include <stdlib.h>\n")
523 END checkFreeMalloc ;
527 checkStorage -
530 PROCEDURE checkStorage (p: pretty) ;
531 BEGIN
532 IF seenStorage
533 THEN
534 print (p, '# include "') ;
535 prints (p, getHPrefix ()) ;
536 print (p, 'Storage.h"\n')
538 END checkStorage ;
542 checkProc -
545 PROCEDURE checkProc (p: pretty) ;
546 BEGIN
547 IF seenProc
548 THEN
549 print (p, "# if !defined (PROC_D)\n") ;
550 print (p, "# define PROC_D\n") ;
551 print (p, " typedef void (*PROC_t) (void);\n") ;
552 print (p, " typedef struct { PROC_t proc; } PROC;\n") ;
553 print (p, "# endif\n\n")
555 END checkProc ;
559 checkTrue -
562 PROCEDURE checkTrue (p: pretty) ;
563 BEGIN
564 IF seenTrue
565 THEN
566 print (p, "# if !defined (TRUE)\n") ;
567 print (p, "# define TRUE (1==1)\n") ;
568 print (p, "# endif\n\n")
570 END checkTrue ;
574 checkFalse -
577 PROCEDURE checkFalse (p: pretty) ;
578 BEGIN
579 IF seenFalse
580 THEN
581 print (p, "# if !defined (FALSE)\n") ;
582 print (p, "# define FALSE (1==0)\n") ;
583 print (p, "# endif\n\n")
585 END checkFalse ;
589 checkNull -
592 PROCEDURE checkNull (p: pretty) ;
593 BEGIN
594 IF seenNull
595 THEN
596 checkGccConfigSystem (p);
597 IF NOT getGccConfigSystem ()
598 THEN
599 print (p, "#include <stddef.h>\n")
602 END checkNull ;
606 checkMemcpy -
609 PROCEDURE checkMemcpy (p: pretty) ;
610 BEGIN
611 IF seenMemcpy OR seenStrlen
612 THEN
613 checkGccConfigSystem (p);
614 IF NOT getGccConfigSystem ()
615 THEN
616 print (p, "#include <string.h>\n")
619 END checkMemcpy ;
623 checkM2RTS -
626 PROCEDURE checkM2RTS (p: pretty) ;
627 BEGIN
628 IF seenM2RTS
629 THEN
630 print (p, '# include "') ;
631 prints (p, getHPrefix ()) ;
632 print (p, 'M2RTS.h"\n')
634 END checkM2RTS ;
638 useException - use the exceptions module, mcrts.
641 PROCEDURE useException ;
642 BEGIN
643 seenException := TRUE
644 END useException ;
648 checkException - check to see if exceptions were used.
651 PROCEDURE checkException (p: pretty) ;
652 BEGIN
653 IF seenException
654 THEN
655 print (p, '# include "Gmcrts.h"\n')
657 END checkException ;
661 useThrow - use the throw function.
664 PROCEDURE useThrow ;
665 BEGIN
666 seenThrow := TRUE
667 END useThrow ;
671 checkThrow - check to see if the throw function is used.
674 PROCEDURE checkThrow (p: pretty) ;
675 BEGIN
676 IF seenThrow
677 THEN
678 (* print (p, '# include "sys/cdefs.h"\n') ; *)
679 print (p, '#ifndef __cplusplus\n') ;
680 print (p, 'extern void throw (unsigned int);\n') ;
681 print (p, '#endif\n')
683 END checkThrow ;
687 useUnistd - need to use unistd.h call using open/close/read/write require this header.
690 PROCEDURE useUnistd ;
691 BEGIN
692 seenUnistd := TRUE
693 END useUnistd ;
697 checkUnistd - check to see if the unistd.h header file is required.
700 PROCEDURE checkUnistd (p: pretty) ;
701 BEGIN
702 IF seenUnistd
703 THEN
704 checkGccConfigSystem (p);
705 IF NOT getGccConfigSystem ()
706 THEN
707 print (p, '#include <unistd.h>\n')
710 END checkUnistd ;
714 useComplex - use the complex data type.
717 PROCEDURE useComplex ;
718 BEGIN
719 seenComplex := TRUE
720 END useComplex ;
724 checkComplex - check to see if the type complex was used.
727 PROCEDURE checkComplex (p: pretty) ;
728 BEGIN
729 IF seenComplex
730 THEN
731 checkGccConfigSystem (p);
732 IF NOT getGccConfigSystem ()
733 THEN
734 print (p, '# include <complex.h>\n')
737 END checkComplex ;
741 checkSysTypes - emit header for sys/types.h if necessary.
744 PROCEDURE checkSysTypes (p: pretty) ;
745 BEGIN
746 IF seenSysTypes
747 THEN
748 checkGccConfigSystem (p);
749 IF NOT getGccConfigSystem ()
750 THEN
751 print (p, '# include <sys/types.h>\n')
754 END checkSysTypes ;
758 fixNullPointerConst - fixup for NULL on some C++11 systems.
761 PROCEDURE fixNullPointerConst (p: pretty) ;
762 BEGIN
763 IF seenNull
764 THEN
765 print (p, '#if defined(__cplusplus)\n') ;
766 print (p, '# undef NULL\n') ;
767 print (p, '# define NULL 0\n') ;
768 print (p, '#endif\n')
770 END fixNullPointerConst ;
774 genBool -
777 PROCEDURE genBool (p: pretty) ;
778 BEGIN
779 IF useBool ()
780 THEN
781 print (p, '#include <stdbool.h>\n') ;
783 END genBool ;
787 genDefs - generate definitions or includes for all
788 macros and prototypes used.
791 PROCEDURE genDefs (p: pretty) ;
792 BEGIN
793 genBool (p) ;
794 checkFreeMalloc (p) ;
795 checkProc (p) ;
796 checkTrue (p) ;
797 checkFalse (p) ;
798 checkNull (p) ;
799 checkMemcpy (p) ;
800 checkLimits (p) ;
801 checkAbs (p) ;
802 checkStorage (p) ;
803 checkException (p) ;
804 checkComplex (p) ;
805 checkCtype (p) ;
806 checkUnistd (p) ;
807 checkSysTypes (p) ;
808 checkM2RTS (p) ;
809 checkThrow (p) ;
810 fixNullPointerConst (p)
811 END genDefs ;
815 genConfigSystem - generate include files for config.h and system.h
816 within the GCC framework.
819 PROCEDURE genConfigSystem (p: pretty) ;
820 BEGIN
821 checkGccConfigSystem (p)
822 END genConfigSystem ;
826 new -
829 PROCEDURE new (n: node) : scope ;
831 s: scope ;
832 BEGIN
833 IF freeList = NIL
834 THEN
835 NEW (s)
836 ELSE
837 s := freeList ;
838 freeList := freeList^.next
839 END ;
840 RETURN s
841 END new ;
845 enterScope - enter a scope defined by, n.
848 PROCEDURE enterScope (n: node) ;
850 s: scope ;
851 BEGIN
852 s := new (n) ;
853 WITH s^ DO
854 scoped := n ;
855 symbols := initTree () ;
856 next := stack
857 END ;
858 stack := s
859 END enterScope ;
863 leaveScope - leave the scope defined by, n.
866 PROCEDURE leaveScope (n: node) ;
868 s: scope ;
869 BEGIN
870 IF n = stack^.scoped
871 THEN
872 s := stack ;
873 stack := stack^.next ;
874 WITH s^ DO
875 scoped := NIL ;
876 killTree (symbols) ;
877 next := NIL
879 ELSE
880 HALT
882 END leaveScope ;
886 mangle1 - returns TRUE if name is unique if we add _
887 to its end.
890 PROCEDURE mangle1 (n: Name; VAR m: String; scopes: BOOLEAN) : BOOLEAN ;
891 BEGIN
892 m := KillString (m) ;
893 m := InitStringCharStar (keyToCharStar (n)) ;
894 m := ConCatChar (m, '_') ;
895 RETURN NOT clash (makekey (string (m)), scopes)
896 END mangle1 ;
900 mangle2 - returns TRUE if name is unique if we prepend _
901 to, n.
904 PROCEDURE mangle2 (n: Name; VAR m: String; scopes: BOOLEAN) : BOOLEAN ;
905 BEGIN
906 m := KillString (m) ;
907 m := InitStringCharStar (keyToCharStar (n)) ;
908 m := ConCat (InitString ('_'), Mark (m)) ;
909 RETURN NOT clash (makekey (string (m)), scopes)
910 END mangle2 ;
914 mangleN - keep adding '_' to the end of n until it
915 no longer clashes.
918 PROCEDURE mangleN (n: Name; VAR m: String; scopes: BOOLEAN) : BOOLEAN ;
919 BEGIN
920 m := KillString (m) ;
921 m := InitStringCharStar (keyToCharStar (n)) ;
922 LOOP
923 m := ConCatChar (m, '_') ;
924 IF NOT clash (makekey (string (m)), scopes)
925 THEN
926 RETURN TRUE
929 END mangleN ;
933 clash - returns TRUE if there is a clash with name, n,
934 in the current scope or C keywords or C macros.
937 PROCEDURE clash (n: Name; scopes: BOOLEAN) : BOOLEAN ;
938 BEGIN
939 IF (getSymKey (macros, n) # NIL) OR
940 (getSymKey (keywords, n) # NIL)
941 THEN
942 RETURN TRUE
943 END ;
944 RETURN scopes AND (getSymKey (stack^.symbols, n) # NIL)
945 END clash ;
949 cname - attempts to declare a symbol with name, n, in the
950 current scope. If there is no conflict with the
951 target language then NIL is returned, otherwise
952 a mangled name is returned as a String.
953 If scopes is FALSE then only the keywords and
954 macros are detected for a clash (all scoping
955 is ignored).
958 PROCEDURE cname (n: Name; scopes: BOOLEAN) : String ;
960 m: String ;
961 BEGIN
962 m := NIL ;
963 IF clash (n, scopes)
964 THEN
965 IF mangle1 (n, m, scopes) OR mangle2 (n, m, scopes) OR mangleN (n, m, scopes)
966 THEN
967 IF scopes
968 THEN
969 (* no longer a clash with, m, so add it to the current scope. *)
970 n := makekey (string (m)) ;
971 putSymKey (stack^.symbols, n, m)
973 ELSE
974 (* mangleN must always succeed. *)
975 HALT
977 ELSIF scopes
978 THEN
979 (* no clash, add it to the current scope. *)
980 putSymKey (stack^.symbols, n, InitStringCharStar (keyToCharStar (n)))
981 END ;
982 RETURN m
983 END cname ;
987 cnamen - attempts to declare a symbol with name, n, in the
988 current scope. If there is no conflict with the
989 target language then NIL is returned, otherwise
990 a mangled name is returned as a Name
991 If scopes is FALSE then only the keywords and
992 macros are detected for a clash (all scoping
993 is ignored).
996 PROCEDURE cnamen (n: Name; scopes: BOOLEAN) : Name ;
998 m: String ;
999 BEGIN
1000 m := NIL ;
1001 IF clash (n, scopes)
1002 THEN
1003 IF mangle1 (n, m, scopes) OR mangle2 (n, m, scopes) OR mangleN (n, m, scopes)
1004 THEN
1005 n := makekey (string (m)) ;
1006 IF scopes
1007 THEN
1008 (* no longer a clash with, m, so add it to the current scope. *)
1009 putSymKey (stack^.symbols, n, m)
1011 ELSE
1012 (* mangleN must always succeed. *)
1013 HALT
1015 ELSIF scopes
1016 THEN
1017 (* no clash, add it to the current scope. *)
1018 putSymKey (stack^.symbols, n, InitStringCharStar (keyToCharStar (n)))
1019 END ;
1020 m := KillString (m) ;
1021 RETURN n
1022 END cnamen ;
1026 cp - include C++ keywords and standard declarations to avoid.
1029 PROCEDURE cp ;
1030 BEGIN
1031 IF NOT initializedCP
1032 THEN
1033 initializedCP := TRUE ;
1034 initCP
1036 END cp ;
1040 initCP - add the extra keywords and standard definitions used by C++.
1043 PROCEDURE initCP ;
1044 BEGIN
1045 add (keywords, 'delete') ;
1046 add (keywords, 'try') ;
1047 add (keywords, 'catch') ;
1048 add (keywords, 'operator') ;
1049 add (keywords, 'complex') ;
1050 add (keywords, 'export') ;
1051 add (keywords, 'public')
1052 END initCP ;
1056 add -
1059 PROCEDURE add (s: symbolTree; a: ARRAY OF CHAR) ;
1060 BEGIN
1061 putSymKey (s, makeKey (a), InitString (a))
1062 END add ;
1066 initMacros - macros and library function names to avoid.
1069 PROCEDURE initMacros ;
1070 BEGIN
1071 macros := initTree () ;
1072 add (macros, 'FILE') ;
1073 add (macros, 'EOF') ;
1074 add (macros, 'stdio') ;
1075 add (macros, 'stdout') ;
1076 add (macros, 'stderr') ;
1077 add (macros, 'write') ;
1078 add (macros, 'read') ;
1079 add (macros, 'exit') ;
1080 add (macros, 'abs') ;
1081 add (macros, 'optarg') ;
1082 add (macros, 'div') ;
1083 add (macros, 'sin') ;
1084 add (macros, 'cos') ;
1085 add (macros, 'tan') ;
1086 add (macros, 'log10') ;
1087 add (macros, 'trunc') ;
1088 add (macros, 'I') ;
1089 add (macros, 'csqrt') ;
1090 add (macros, 'strlen') ;
1091 add (macros, 'strcpy') ;
1092 add (macros, 'free') ;
1093 add (macros, 'malloc') ;
1094 add (macros, 'time') ;
1095 add (macros, 'main') ;
1096 add (macros, 'true') ;
1097 add (macros, 'false') ;
1098 add (macros, 'sigfpe')
1099 END initMacros ;
1103 initKeywords - keywords to avoid.
1106 PROCEDURE initKeywords ;
1107 BEGIN
1108 keywords := initTree () ;
1109 add (keywords, 'auto') ;
1110 add (keywords, 'break') ;
1111 add (keywords, 'case') ;
1112 add (keywords, 'char') ;
1113 add (keywords, 'const') ;
1114 add (keywords, 'continue') ;
1115 add (keywords, 'default') ;
1116 add (keywords, 'do') ;
1117 add (keywords, 'double') ;
1118 add (keywords, 'else') ;
1119 add (keywords, 'enum') ;
1120 add (keywords, 'extern') ;
1121 add (keywords, 'float') ;
1122 add (keywords, 'for') ;
1123 add (keywords, 'goto') ;
1124 add (keywords, 'if') ;
1125 add (keywords, 'int') ;
1126 add (keywords, 'long') ;
1127 add (keywords, 'register') ;
1128 add (keywords, 'return') ;
1129 add (keywords, 'short') ;
1130 add (keywords, 'signed') ;
1131 add (keywords, 'sizeof') ;
1132 add (keywords, 'static') ;
1133 add (keywords, 'struct') ;
1134 add (keywords, 'switch') ;
1135 add (keywords, 'typedef') ;
1136 add (keywords, 'union') ;
1137 add (keywords, 'unsigned') ;
1138 add (keywords, 'void') ;
1139 add (keywords, 'volatile') ;
1140 add (keywords, 'while') ;
1141 add (keywords, 'and') ;
1142 add (keywords, 'or') ;
1143 add (keywords, 'not') ;
1144 add (keywords, 'throw') ;
1145 add (keywords, 'new')
1146 END initKeywords ;
1150 init -
1153 PROCEDURE init ;
1154 BEGIN
1155 seenUnistd := FALSE ;
1156 seenThrow := FALSE ;
1157 seenFree := FALSE ;
1158 seenMalloc := FALSE ;
1159 seenStorage := FALSE ;
1160 seenProc := FALSE ;
1161 seenTrue := FALSE ;
1162 seenFalse := FALSE ;
1163 seenNull := FALSE ;
1164 seenMemcpy := FALSE ;
1165 seenIntMin := FALSE ;
1166 seenUIntMin := FALSE ;
1167 seenLongMin := FALSE ;
1168 seenULongMin := FALSE ;
1169 seenCharMin := FALSE ;
1170 seenUCharMin := FALSE ;
1171 seenIntMax := FALSE ;
1172 seenUIntMax := FALSE ;
1173 seenLongMax := FALSE ;
1174 seenULongMax := FALSE ;
1175 seenCharMax := FALSE ;
1176 seenUCharMax := FALSE ;
1177 seenLabs := FALSE ;
1178 seenAbs := FALSE ;
1179 seenFabs := FALSE ;
1180 seenFabsl := FALSE ;
1181 seenException := FALSE ;
1182 seenComplex := FALSE ;
1183 seenM2RTS := FALSE ;
1184 seenStrlen := FALSE ;
1185 seenCtype := FALSE ;
1186 seenSize_t := FALSE ;
1187 seenSSize_t := FALSE ;
1188 seenSysTypes := FALSE ;
1189 seenGccTree := FALSE ;
1190 seenGccLocation := FALSE ;
1191 initializedCP := FALSE ;
1192 initializedGCC := FALSE ;
1194 stack := NIL ;
1195 freeList := NIL ;
1196 initKeywords ;
1197 initMacros
1198 END init ;
1201 BEGIN
1202 init
1203 END keyc.