diff options
author | Gaius Mulley <gaiusmod2@gmail.com> | 2023-03-12 13:27:23 +0000 |
---|---|---|
committer | Gaius Mulley <gaiusmod2@gmail.com> | 2023-03-12 13:27:23 +0000 |
commit | 431c06691dcbb84c7d999d91202537442e6a60f0 (patch) | |
tree | 78e5bff7771c2fcc12adf318fdc3f456a2dc4baf | |
parent | fa0ecd22f850cf50805380dc626e67a8cb7257d8 (diff) | |
download | gcc-431c06691dcbb84c7d999d91202537442e6a60f0.zip gcc-431c06691dcbb84c7d999d91202537442e6a60f0.tar.gz gcc-431c06691dcbb84c7d999d91202537442e6a60f0.tar.bz2 |
[PR modula2/109089] implementation of boolean should be C++/C bool
[PR modula2/109089]. This patch implements BOOLEAN using bool
(boolean_type_node) thoughout cc1gm2. The patch also includes a
patched version of the bootstrap tool mc.
gcc/ChangeLog:
* doc/gm2.texi (Elementary data types): Equivalence BOOLEAN with
bool.
gcc/m2/ChangeLog:
PR modula2/109089
* gm2-compiler/M2GCCDeclare.mod (DeclareKnownType): Import.
* gm2-gcc/gcc-consolidation.h (stdbool.h): Include.
* gm2-gcc/init.h (defined): Change block start.
* gm2-gcc/m2block.cc: Change FALSE to false, change TRUE to true.
* gm2-gcc/m2block.h: Change int to bool.
* gm2-gcc/m2builtins.cc: Ditto.
* gm2-gcc/m2builtins.h: Ditto.
* gm2-gcc/m2convert.cc: Change FALSE to false, TRUE to true and
int to bool.
* gm2-gcc/m2convert.h: Change int to bool.
* gm2-gcc/m2decl.cc: Change int to bool.
* gm2-gcc/m2decl.h: Change int to bool.
* gm2-gcc/m2expr.cc: Change FALSE to false, TRUE to true and
int to bool.
* gm2-gcc/m2expr.h: Change int to bool.
* gm2-gcc/m2statement.cc: Change FALSE to false, TRUE to true and
int to bool.
* gm2-gcc/m2statement.h: Change int to bool.
* gm2-gcc/m2top.cc: Change int to bool.
* gm2-gcc/m2top.h: Change int to bool.
* gm2-gcc/m2tree.cc: Change int to bool.
* gm2-gcc/m2tree.h: Change int to bool.
* gm2-gcc/m2type.cc: Change int to bool.
* gm2-gcc/m2type.h: Change int to bool.
* gm2-lang.cc (convert_loc): Call convert_to_integer for BOOLEAN_TYPE.
* gm2-libs/Builtins.def (isfinitef): Change return value from
BOOLEAN to INTEGER.
(isfinite): Ditto.
(isfinitel): Ditto.
* gm2-libs/Builtins.mod (isfinitef): Change return value from
BOOLEAN to INTEGER.
(isfinite): Ditto.
(isfinitel): Ditto.
* mc-boot/GASCII.cc: Rebuild.
* mc-boot/GASCII.h: Rebuild.
* mc-boot/GArgs.cc: Rebuild.
* mc-boot/GArgs.h: Rebuild.
* mc-boot/GAssertion.cc: Rebuild.
* mc-boot/GAssertion.h: Rebuild.
* mc-boot/GBreak.cc: Rebuild.
* mc-boot/GBreak.h: Rebuild.
* mc-boot/GCOROUTINES.h: Rebuild.
* mc-boot/GCmdArgs.cc: Rebuild.
* mc-boot/GCmdArgs.h: Rebuild.
* mc-boot/GDebug.cc: Rebuild.
* mc-boot/GDebug.h: Rebuild.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GDynamicStrings.h: Rebuild.
* mc-boot/GEnvironment.cc: Rebuild.
* mc-boot/GEnvironment.h: Rebuild.
* mc-boot/GFIO.cc: Rebuild.
* mc-boot/GFIO.h: Rebuild.
* mc-boot/GFormatStrings.cc: Rebuild.
* mc-boot/GFormatStrings.h: Rebuild.
* mc-boot/GFpuIO.cc: Rebuild.
* mc-boot/GFpuIO.h: Rebuild.
* mc-boot/GIO.cc: Rebuild.
* mc-boot/GIO.h: Rebuild.
* mc-boot/GIndexing.cc: Rebuild.
* mc-boot/GIndexing.h: Rebuild.
* mc-boot/GM2Dependent.cc: Rebuild.
* mc-boot/GM2Dependent.h: Rebuild.
* mc-boot/GM2EXCEPTION.cc: Rebuild.
* mc-boot/GM2EXCEPTION.h: Rebuild.
* mc-boot/GM2LINK.h: Rebuild.
* mc-boot/GM2RTS.cc: Rebuild.
* mc-boot/GM2RTS.h: Rebuild.
* mc-boot/GMemUtils.cc: Rebuild.
* mc-boot/GMemUtils.h: Rebuild.
* mc-boot/GNumberIO.cc: Rebuild.
* mc-boot/GNumberIO.h: Rebuild.
* mc-boot/GPushBackInput.cc: Rebuild.
* mc-boot/GPushBackInput.h: Rebuild.
* mc-boot/GRTExceptions.cc: Rebuild.
* mc-boot/GRTExceptions.h: Rebuild.
* mc-boot/GRTco.h: Rebuild.
* mc-boot/GRTentity.h: Rebuild.
* mc-boot/GRTint.cc: Rebuild.
* mc-boot/GRTint.h: Rebuild.
* mc-boot/GSArgs.cc: Rebuild.
* mc-boot/GSArgs.h: Rebuild.
* mc-boot/GSFIO.cc: Rebuild.
* mc-boot/GSFIO.h: Rebuild.
* mc-boot/GSYSTEM.h: Rebuild.
* mc-boot/GSelective.h: Rebuild.
* mc-boot/GStdIO.cc: Rebuild.
* mc-boot/GStdIO.h: Rebuild.
* mc-boot/GStorage.cc: Rebuild.
* mc-boot/GStorage.h: Rebuild.
* mc-boot/GStrCase.cc: Rebuild.
* mc-boot/GStrCase.h: Rebuild.
* mc-boot/GStrIO.cc: Rebuild.
* mc-boot/GStrIO.h: Rebuild.
* mc-boot/GStrLib.cc: Rebuild.
* mc-boot/GStrLib.h: Rebuild.
* mc-boot/GStringConvert.cc: Rebuild.
* mc-boot/GStringConvert.h: Rebuild.
* mc-boot/GSysExceptions.h: Rebuild.
* mc-boot/GSysStorage.cc: Rebuild.
* mc-boot/GSysStorage.h: Rebuild.
* mc-boot/GTimeString.cc: Rebuild.
* mc-boot/GTimeString.h: Rebuild.
* mc-boot/GUnixArgs.h: Rebuild.
* mc-boot/Galists.cc: Rebuild.
* mc-boot/Galists.h: Rebuild.
* mc-boot/Gdecl.cc: Rebuild.
* mc-boot/Gdecl.h: Rebuild.
* mc-boot/Gdtoa.h: Rebuild.
* mc-boot/Gerrno.h: Rebuild.
* mc-boot/Gkeyc.cc: Rebuild.
* mc-boot/Gkeyc.h: Rebuild.
* mc-boot/Gldtoa.h: Rebuild.
* mc-boot/Glibc.h: Rebuild.
* mc-boot/Glibm.h: Rebuild.
* mc-boot/Glists.cc: Rebuild.
* mc-boot/Glists.h: Rebuild.
* mc-boot/GmcComment.cc: Rebuild.
* mc-boot/GmcComment.h: Rebuild.
* mc-boot/GmcComp.cc: Rebuild.
* mc-boot/GmcComp.h: Rebuild.
* mc-boot/GmcDebug.cc: Rebuild.
* mc-boot/GmcDebug.h: Rebuild.
* mc-boot/GmcError.cc: Rebuild.
* mc-boot/GmcError.h: Rebuild.
* mc-boot/GmcFileName.cc: Rebuild.
* mc-boot/GmcFileName.h: Rebuild.
* mc-boot/GmcLexBuf.cc: Rebuild.
* mc-boot/GmcLexBuf.h: Rebuild.
* mc-boot/GmcMetaError.cc: Rebuild.
* mc-boot/GmcMetaError.h: Rebuild.
* mc-boot/GmcOptions.cc: Rebuild.
* mc-boot/GmcOptions.h: Rebuild.
* mc-boot/GmcPreprocess.cc: Rebuild.
* mc-boot/GmcPreprocess.h: Rebuild.
* mc-boot/GmcPretty.cc: Rebuild.
* mc-boot/GmcPretty.h: Rebuild.
* mc-boot/GmcPrintf.cc: Rebuild.
* mc-boot/GmcPrintf.h: Rebuild.
* mc-boot/GmcQuiet.cc: Rebuild.
* mc-boot/GmcQuiet.h: Rebuild.
* mc-boot/GmcReserved.cc: Rebuild.
* mc-boot/GmcReserved.h: Rebuild.
* mc-boot/GmcSearch.cc: Rebuild.
* mc-boot/GmcSearch.h: Rebuild.
* mc-boot/GmcStack.cc: Rebuild.
* mc-boot/GmcStack.h: Rebuild.
* mc-boot/GmcStream.cc: Rebuild.
* mc-boot/GmcStream.h: Rebuild.
* mc-boot/Gmcflex.h: Rebuild.
* mc-boot/Gmcp1.cc: Rebuild.
* mc-boot/Gmcp1.h: Rebuild.
* mc-boot/Gmcp2.cc: Rebuild.
* mc-boot/Gmcp2.h: Rebuild.
* mc-boot/Gmcp3.cc: Rebuild.
* mc-boot/Gmcp3.h: Rebuild.
* mc-boot/Gmcp4.cc: Rebuild.
* mc-boot/Gmcp4.h: Rebuild.
* mc-boot/Gmcp5.cc: Rebuild.
* mc-boot/Gmcp5.h: Rebuild.
* mc-boot/GnameKey.cc: Rebuild.
* mc-boot/GnameKey.h: Rebuild.
* mc-boot/GsymbolKey.cc: Rebuild.
* mc-boot/GsymbolKey.h: Rebuild.
* mc-boot/Gtermios.h: Rebuild.
* mc-boot/Gtop.cc: Rebuild.
* mc-boot/Gvarargs.cc: Rebuild.
* mc-boot/Gvarargs.h: Rebuild.
* mc-boot/Gwlists.cc: Rebuild.
* mc-boot/Gwlists.h: Rebuild.
* mc-boot/Gwrapc.h: Rebuild.
* mc/decl.mod (doBoolC): New procedure.
(doBaseC): Call doBoolC.
* mc/keyc.mod: Import useBool.
(genBool): New procedure.
(genDefs): Call genBool.
* mc/mcOptions.def (useBool): New procedure.
* mc/mcOptions.mod (useBool): New procedure.
(useBoolType): New variable.
(optionIs): Assign useBoolType to TRUE.
gcc/testsuite/ChangeLog:
PR modula2/109089
* gm2/pimlib/run/pass/limittests.mod: Rewritten to reflect
the external definitions of isfinite.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
167 files changed, 2667 insertions, 2369 deletions
diff --git a/gcc/doc/gm2.texi b/gcc/doc/gm2.texi index 07729f8..c08bb89 100644 --- a/gcc/doc/gm2.texi +++ b/gcc/doc/gm2.texi @@ -814,7 +814,7 @@ SHORTINT short int CARDINAL unsigned int LONGCARD long long unsigned int SHORTCARD short unsigned int -BOOLEAN int +BOOLEAN bool REAL double LONGREAL long double SHORTREAL float diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod index ef1859f..f6fb239 100644 --- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod +++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod @@ -179,7 +179,7 @@ FROM m2type IMPORT MarkFunctionReferenced, BuildStartRecord, BuildStartVarient, SetRecordFieldOffset, ChainOn, BuildEndRecord, BuildFieldRecord, BuildEndFieldVarient, BuildArrayIndexType, BuildEndFunctionType, BuildSetType, BuildEndVarient, BuildEndArrayType, InitFunctionTypeParameters, - BuildProcTypeParameterDeclaration, + BuildProcTypeParameterDeclaration, DeclareKnownType, ValueOutOfTypeRange, ExceedsTypeRange ; FROM m2convert IMPORT BuildConvert ; diff --git a/gcc/m2/gm2-gcc/gcc-consolidation.h b/gcc/m2/gm2-gcc/gcc-consolidation.h index 33ef4c1..6abb182 100644 --- a/gcc/m2/gm2-gcc/gcc-consolidation.h +++ b/gcc/m2/gm2-gcc/gcc-consolidation.h @@ -90,3 +90,4 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "ipa-ref.h" #include "cgraph.h" #include "stmt.h" +#include <stdbool.h> diff --git a/gcc/m2/gm2-gcc/init.h b/gcc/m2/gm2-gcc/init.h index 6580cbd..bb8c7a1 100644 --- a/gcc/m2/gm2-gcc/init.h +++ b/gcc/m2/gm2-gcc/init.h @@ -24,12 +24,13 @@ along with GNU Modula-2; see the file COPYING3. If not see #if defined(init_cpp) extern "C" { +#endif + void init_FrontEndInit (void); void init_PerCompilationInit (const char *filename); + +#if defined(init_cpp) } -#else /* !init_cpp. */ -void init_FrontEndInit (void); -void init_PerCompilationInit (const char *filename); #endif /* !init_cpp. */ #endif /*! init_h. */ diff --git a/gcc/m2/gm2-gcc/m2block.cc b/gcc/m2/gm2-gcc/m2block.cc index 69e0345..d2d8946 100644 --- a/gcc/m2/gm2-gcc/m2block.cc +++ b/gcc/m2/gm2-gcc/m2block.cc @@ -112,7 +112,7 @@ typedef struct stmt_tree_s *stmt_tree_t; #undef DEBUGGING static location_t pending_location; -static int pending_statement = FALSE; +static int pending_statement = false; /* assert_global_names asserts that the global_binding_level->names can be chained. */ @@ -215,8 +215,8 @@ m2block_cur_stmt_list (void) return *t; } -/* is_building_stmt_list returns TRUE if we are building a - statement list. TRUE is returned if we are in a binding level and +/* is_building_stmt_list returns true if we are building a + statement list. true is returned if we are in a binding level and a statement list is under construction. */ int @@ -280,7 +280,7 @@ findLevel (tree fndecl) b = newLevel (); b->fndecl = fndecl; b->context = fndecl; - b->is_global = FALSE; + b->is_global = false; b->list = head_binding_level; b->next = NULL; } @@ -414,14 +414,14 @@ m2block_finishFunctionDecl (location_t location, tree fndecl) { block = make_node (BLOCK); DECL_INITIAL (fndecl) = block; - TREE_USED (block) = TRUE; + TREE_USED (block) = true; BLOCK_SUBBLOCKS (block) = NULL_TREE; } BLOCK_SUPERCONTEXT (block) = context; BLOCK_VARS (block) = chainon (BLOCK_VARS (block), current_binding_level->names); - TREE_USED (fndecl) = TRUE; + TREE_USED (fndecl) = true; if (bind_expr == NULL_TREE) { @@ -647,16 +647,16 @@ m2block_RememberInitModuleFunction (tree t) return t; } -/* toplevel return TRUE if we are in the global scope. */ +/* toplevel return true if we are in the global scope. */ -int +bool m2block_toplevel (void) { if (current_binding_level == NULL) - return TRUE; + return true; if (current_binding_level->fndecl == NULL) - return TRUE; - return FALSE; + return true; + return false; } /* GetErrorNode returns the gcc error_mark_node. */ @@ -711,12 +711,12 @@ flush_pending_note (void) tree note = build_stmt (pending_location, ASM_EXPR, string, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE); - ASM_INPUT_P (note) = FALSE; - ASM_VOLATILE_P (note) = FALSE; + ASM_INPUT_P (note) = false; + ASM_VOLATILE_P (note) = false; #else tree note = build_empty_stmt (pending_location); #endif - pending_statement = FALSE; + pending_statement = false; do_add_stmt (note); } } @@ -732,7 +732,7 @@ m2block_add_stmt (location_t location, tree t) if (pending_statement && (pending_location != location)) flush_pending_note (); - pending_statement = FALSE; + pending_statement = false; return do_add_stmt (t); } @@ -746,14 +746,14 @@ m2block_addStmtNote (location_t location) if (pending_statement && (pending_location != location)) flush_pending_note (); - pending_statement = TRUE; + pending_statement = true; pending_location = location; } void m2block_removeStmtNote (void) { - pending_statement = FALSE; + pending_statement = false; } /* init - initialize the data structures in this module. */ @@ -763,7 +763,7 @@ m2block_init (void) { global_binding_level = newLevel (); global_binding_level->context = build_translation_unit_decl (NULL); - global_binding_level->is_global = TRUE; + global_binding_level->is_global = true; current_binding_level = NULL; } diff --git a/gcc/m2/gm2-gcc/m2block.h b/gcc/m2/gm2-gcc/m2block.h index 9d6922b..f5fbb38 100644 --- a/gcc/m2/gm2-gcc/m2block.h +++ b/gcc/m2/gm2-gcc/m2block.h @@ -35,6 +35,8 @@ along with GNU Modula-2; see the file COPYING3. If not see #endif /* !m2block_c. */ #endif /* !m2block_h. */ +#include <stdbool.h> + EXTERN tree m2block_getLabel (location_t location, char *name); EXTERN void m2block_pushFunctionScope (tree fndecl); EXTERN tree m2block_popFunctionScope (void); @@ -55,7 +57,7 @@ EXTERN tree m2block_RememberConstant (tree t); EXTERN tree m2block_DumpGlobalConstants (void); EXTERN tree m2block_RememberInitModuleFunction (tree t); EXTERN tree m2block_global_constant (tree t); -EXTERN int m2block_toplevel (void); +EXTERN bool m2block_toplevel (void); EXTERN tree m2block_GetErrorNode (void); EXTERN void m2block_addStmtNote (location_t location); diff --git a/gcc/m2/gm2-gcc/m2builtins.cc b/gcc/m2/gm2-gcc/m2builtins.cc index 2df6e54..b9ac7fc 100644 --- a/gcc/m2/gm2-gcc/m2builtins.cc +++ b/gcc/m2/gm2-gcc/m2builtins.cc @@ -801,7 +801,7 @@ m2builtins_BuiltInIsfinite (location_t location, tree expression) /* BuiltinExists - returns TRUE if the builtin function, name, exists for this target architecture. */ -int +bool m2builtins_BuiltinExists (char *name) { struct builtin_function_entry *fe; diff --git a/gcc/m2/gm2-gcc/m2builtins.h b/gcc/m2/gm2-gcc/m2builtins.h index 5de9753..487a41a 100644 --- a/gcc/m2/gm2-gcc/m2builtins.h +++ b/gcc/m2/gm2-gcc/m2builtins.h @@ -36,6 +36,8 @@ along with GNU Modula-2; see the file COPYING3. If not see #endif /* !__GNUG__. */ #endif /* !m2builtins_c. */ +#include <stdbool.h> + EXTERN tree m2builtins_GetBuiltinConst (char *name); EXTERN unsigned int m2builtins_GetBuiltinConstType (char *name); EXTERN unsigned int m2builtins_GetBuiltinTypeInfoType (const char *ident); @@ -45,7 +47,7 @@ EXTERN tree m2builtins_BuiltInMemCopy (location_t location, tree dest, tree src, tree n); EXTERN tree m2builtins_BuiltInAlloca (location_t location, tree n); EXTERN tree m2builtins_BuiltInIsfinite (location_t location, tree e); -EXTERN int m2builtins_BuiltinExists (char *name); +EXTERN bool m2builtins_BuiltinExists (char *name); EXTERN tree m2builtins_BuildBuiltinTree (location_t location, char *name); EXTERN tree m2builtins_BuiltInHugeVal (location_t location); EXTERN tree m2builtins_BuiltInHugeValShort (location_t location); diff --git a/gcc/m2/gm2-gcc/m2convert.cc b/gcc/m2/gm2-gcc/m2convert.cc index fa09be3..f806669 100644 --- a/gcc/m2/gm2-gcc/m2convert.cc +++ b/gcc/m2/gm2-gcc/m2convert.cc @@ -352,12 +352,12 @@ converting_ISO_generic (location_t location, tree type, tree value, if (value_type == type) /* We let the caller deal with this. */ - return FALSE; + return false; if ((TREE_CODE (value) == INTEGER_CST) && (type == generic_type)) { *result = const_to_ISO_type (location, value, generic_type); - return TRUE; + return true; } if (same_size_types (location, type, value_type)) @@ -368,7 +368,7 @@ converting_ISO_generic (location_t location, tree type, tree value, tree a = build1 (ADDR_EXPR, pt, value); tree t = build1 (INDIRECT_REF, type, a); *result = build1 (NOP_EXPR, type, t); - return TRUE; + return true; } else if (type == generic_type) { @@ -376,10 +376,10 @@ converting_ISO_generic (location_t location, tree type, tree value, tree a = build1 (ADDR_EXPR, pt, value); tree t = build1 (INDIRECT_REF, type, a); *result = build1 (NOP_EXPR, type, t); - return TRUE; + return true; } } - return FALSE; + return false; } /* convert_char_to_array - convert a single char, value, into an @@ -400,7 +400,7 @@ convert_char_to_array (location_t location, tree type, tree value) /* Store the initial char. */ m2type_BuildArrayConstructorElement (c, value, i); - i = m2expr_BuildAdd (location, i, m2decl_BuildIntegerConstant (1), FALSE); + i = m2expr_BuildAdd (location, i, m2decl_BuildIntegerConstant (1), false); /* Now pad out the remaining elements with nul chars. */ while (m2expr_CompareTrees (i, n) < 0) @@ -408,7 +408,7 @@ convert_char_to_array (location_t location, tree type, tree value) m2type_BuildArrayConstructorElement ( c, m2type_BuildCharConstant (location, &nul[0]), i); i = m2expr_BuildAdd (location, i, m2decl_BuildIntegerConstant (1), - FALSE); + false); } return m2type_BuildEndArrayConstructor (c); } @@ -431,7 +431,7 @@ convert_string_to_array (location_t location, tree type, tree value) tree m2convert_BuildConvert (location_t location, tree type, tree value, - int checkOverflow) + bool checkOverflow) { type = m2tree_skip_type_decl (type); tree t; @@ -444,7 +444,7 @@ m2convert_BuildConvert (location_t location, tree type, tree value, && (m2tree_IsOrdinal (type))) value = doOrdinal (value); else if (TREE_CODE (value) == FUNCTION_DECL && TREE_TYPE (value) != type) - value = m2expr_BuildAddr (0, value, FALSE); + value = m2expr_BuildAddr (0, value, false); if (converting_ISO_generic (location, type, value, m2type_GetByteType (), &t) || converting_ISO_generic (location, type, value, @@ -516,35 +516,35 @@ const_to_ISO_aggregate_type (location_t location, tree expr, tree iso_type) while (m2expr_CompareTrees (i, n) < 0) { max_uint = m2expr_BuildMult (location, max_uint, - m2decl_BuildIntegerConstant (256), FALSE); + m2decl_BuildIntegerConstant (256), false); i = m2expr_BuildAdd (location, i, m2decl_BuildIntegerConstant (1), - FALSE); + false); } max_uint = m2expr_BuildDivFloor (location, max_uint, - m2decl_BuildIntegerConstant (2), FALSE); + m2decl_BuildIntegerConstant (2), false); if (m2expr_CompareTrees (expr, m2decl_BuildIntegerConstant (0)) < 0) - expr = m2expr_BuildAdd (location, expr, max_uint, FALSE); + expr = m2expr_BuildAdd (location, expr, max_uint, false); i = m2decl_BuildIntegerConstant (0); c = m2type_BuildStartArrayConstructor (iso_type); while (m2expr_CompareTrees (i, n) < 0) { byte = m2expr_BuildModTrunc (location, expr, - m2decl_BuildIntegerConstant (256), FALSE); + m2decl_BuildIntegerConstant (256), false); if (BYTES_BIG_ENDIAN) m2type_BuildArrayConstructorElement ( c, m2convert_ToLoc (location, byte), - m2expr_BuildSub (location, m2expr_BuildSub (location, n, i, FALSE), - m2decl_BuildIntegerConstant (1), FALSE)); + m2expr_BuildSub (location, m2expr_BuildSub (location, n, i, false), + m2decl_BuildIntegerConstant (1), false)); else m2type_BuildArrayConstructorElement ( c, m2convert_ToLoc (location, byte), i); i = m2expr_BuildAdd (location, i, m2decl_BuildIntegerConstant (1), - FALSE); + false); expr = m2expr_BuildDivFloor (location, expr, - m2decl_BuildIntegerConstant (256), FALSE); + m2decl_BuildIntegerConstant (256), false); } return m2type_BuildEndArrayConstructor (c); @@ -568,7 +568,7 @@ m2convert_ConvertConstantAndCheck (location_t location, tree type, tree expr) return expr; if (TREE_CODE (expr) == FUNCTION_DECL) - expr = m2expr_BuildAddr (location, expr, FALSE); + expr = m2expr_BuildAddr (location, expr, false); type = m2tree_skip_type_decl (type); if (type == m2type_GetByteType () || type == m2type_GetISOLocType () @@ -586,7 +586,7 @@ m2convert_ConvertConstantAndCheck (location_t location, tree type, tree expr) tree m2convert_ToWord (location_t location, tree expr) { - return m2convert_BuildConvert (location, m2type_GetWordType (), expr, FALSE); + return m2convert_BuildConvert (location, m2type_GetWordType (), expr, false); } /* ToCardinal - convert an expression, expr, to a CARDINAL. */ @@ -595,7 +595,7 @@ tree m2convert_ToCardinal (location_t location, tree expr) { return m2convert_BuildConvert (location, m2type_GetCardinalType (), expr, - FALSE); + false); } /* convertToPtr - if the type of tree, t, is not a ptr_type_node then @@ -608,7 +608,7 @@ m2convert_convertToPtr (location_t location, tree type) return type; else return m2convert_BuildConvert (location, m2type_GetPointerType (), type, - FALSE); + false); } /* ToInteger - convert an expression, expr, to an INTEGER. */ @@ -617,7 +617,7 @@ tree m2convert_ToInteger (location_t location, tree expr) { return m2convert_BuildConvert (location, m2type_GetIntegerType (), expr, - FALSE); + false); } /* ToBitset - convert an expression, expr, to a BITSET type. */ @@ -626,7 +626,7 @@ tree m2convert_ToBitset (location_t location, tree expr) { return m2convert_BuildConvert (location, m2type_GetBitsetType (), expr, - FALSE); + false); } /* ToLoc - convert an expression, expr, to a LOC. */ @@ -635,7 +635,7 @@ tree m2convert_ToLoc (location_t location, tree expr) { return m2convert_BuildConvert (location, m2type_GetISOByteType (), expr, - FALSE); + false); } /* GenericToType - converts, expr, into, type, providing that expr is diff --git a/gcc/m2/gm2-gcc/m2convert.h b/gcc/m2/gm2-gcc/m2convert.h index fc3a5b9..1d9dc75 100644 --- a/gcc/m2/gm2-gcc/m2convert.h +++ b/gcc/m2/gm2-gcc/m2convert.h @@ -36,7 +36,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #endif /* m2convert_c. */ EXTERN tree m2convert_BuildConvert (location_t location, tree type, tree value, - int checkOverflow); + bool checkOverflow); EXTERN tree m2convert_ConvertToPtr (location_t location_t, tree p); EXTERN tree m2convert_ConvertString (tree type, tree expr); EXTERN tree m2convert_ConvertConstantAndCheck (location_t location, tree type, diff --git a/gcc/m2/gm2-gcc/m2decl.cc b/gcc/m2/gm2-gcc/m2decl.cc index eb3d98d..8f814db 100644 --- a/gcc/m2/gm2-gcc/m2decl.cc +++ b/gcc/m2/gm2-gcc/m2decl.cc @@ -77,8 +77,8 @@ m2decl_DeclareM2linkForcedModuleInitOrder (location_t location, tree m2decl_DeclareKnownVariable (location_t location, const char *name, tree type, - int exported, int imported, int istemporary, - int isglobal, tree scope, tree initial) + bool exported, bool imported, bool istemporary, + bool isglobal, tree scope, tree initial) { tree id; tree decl; @@ -165,7 +165,7 @@ m2decl_DeclareKnownConstant (location_t location, tree type, tree value) tree m2decl_BuildParameterDeclaration (location_t location, char *name, tree type, - int isreference) + bool isreference) { tree parm_decl; @@ -210,8 +210,8 @@ m2decl_BuildStartFunctionDeclaration (int uses_varargs) tree m2decl_BuildEndFunctionDeclaration (location_t location_begin, location_t location_end, const char *name, - tree returntype, int isexternal, - int isnested, int ispublic, int isnoreturn) + tree returntype, bool isexternal, + bool isnested, bool ispublic, bool isnoreturn) { tree fntype; tree fndecl; @@ -290,7 +290,7 @@ m2decl_DeclareModuleCtor (tree decl) void m2decl_DetermineSizeOfConstant (location_t location, const char *str, unsigned int base, - int *needsLong, int *needsUnsigned) + bool *needsLong, bool *needsUnsigned) { unsigned int ulow; int high; @@ -311,8 +311,8 @@ m2decl_BuildConstLiteralNumber (location_t location, const char *str, unsigned i unsigned HOST_WIDE_INT low; HOST_WIDE_INT high; HOST_WIDE_INT ival[3]; - int overflow = m2expr_interpret_integer (str, base, &low, &high); - int needLong, needUnsigned; + bool overflow = m2expr_interpret_integer (str, base, &low, &high); + bool needLong, needUnsigned; ival[0] = low; ival[1] = high; diff --git a/gcc/m2/gm2-gcc/m2decl.h b/gcc/m2/gm2-gcc/m2decl.h index 19dbb7b..465f7d1 100644 --- a/gcc/m2/gm2-gcc/m2decl.h +++ b/gcc/m2/gm2-gcc/m2decl.h @@ -52,22 +52,22 @@ EXTERN tree m2decl_BuildConstLiteralNumber (location_t location, unsigned int base); EXTERN void m2decl_DetermineSizeOfConstant (location_t location, const char *str, unsigned int base, - int *needsLong, - int *needsUnsigned); + bool *needsLong, + bool *needsUnsigned); EXTERN void m2decl_RememberVariables (tree l); EXTERN tree m2decl_BuildEndFunctionDeclaration ( location_t location_begin, location_t location_end, const char *name, - tree returntype, int isexternal, int isnested, int ispublic, - int isnoreturn); + tree returntype, bool isexternal, bool isnested, bool ispublic, + bool isnoreturn); EXTERN void m2decl_BuildStartFunctionDeclaration (int uses_varargs); EXTERN tree m2decl_BuildParameterDeclaration (location_t location, char *name, - tree type, int isreference); + tree type, bool isreference); EXTERN tree m2decl_DeclareKnownConstant (location_t location, tree type, tree value); EXTERN tree m2decl_DeclareKnownVariable (location_t location, const char *name, - tree type, int exported, int imported, - int istemporary, int isglobal, + tree type, bool exported, bool imported, + bool istemporary, bool isglobal, tree scope, tree initial); EXTERN tree m2decl_BuildStringConstantType (int length, const char *string, diff --git a/gcc/m2/gm2-gcc/m2expr.cc b/gcc/m2/gm2-gcc/m2expr.cc index f0a45c0..95e5d48 100644 --- a/gcc/m2/gm2-gcc/m2expr.cc +++ b/gcc/m2/gm2-gcc/m2expr.cc @@ -96,24 +96,24 @@ CheckAddressToCardinal (location_t location, tree op) { if (m2type_IsAddress (TREE_TYPE (op))) return m2convert_BuildConvert (location, m2type_GetCardinalAddressType (), - op, FALSE); + op, false); return op; } -/* BuildTruthAndIf return TRUE if a && b. Retain order left to right. */ +/* BuildTruthAndIf return true if a && b. Retain order left to right. */ static tree m2expr_BuildTruthAndIf (location_t location, tree a, tree b) { - return m2expr_build_binary_op (location, TRUTH_ANDIF_EXPR, a, b, FALSE); + return m2expr_build_binary_op (location, TRUTH_ANDIF_EXPR, a, b, false); } -/* BuildTruthOrIf return TRUE if a || b. Retain order left to right. */ +/* BuildTruthOrIf return true if a || b. Retain order left to right. */ static tree m2expr_BuildTruthOrIf (location_t location, tree a, tree b) { - return m2expr_build_binary_op (location, TRUTH_ORIF_EXPR, a, b, FALSE); + return m2expr_build_binary_op (location, TRUTH_ORIF_EXPR, a, b, false); } /* BuildTruthNotIf inverts the boolean value of expr and returns the result. */ @@ -121,7 +121,7 @@ m2expr_BuildTruthOrIf (location_t location, tree a, tree b) static tree m2expr_BuildTruthNot (location_t location, tree expr) { - return m2expr_build_unary_op (location, TRUTH_NOT_EXPR, expr, FALSE); + return m2expr_build_unary_op (location, TRUTH_NOT_EXPR, expr, false); } /* BuildPostInc builds a post increment tree, the second operand is @@ -130,7 +130,7 @@ m2expr_BuildTruthNot (location_t location, tree expr) static tree m2expr_BuildPostInc (location_t location, tree op) { - return m2expr_BuildAdd (location, op, build_int_cst (TREE_TYPE (op), 1), FALSE); + return m2expr_BuildAdd (location, op, build_int_cst (TREE_TYPE (op), 1), false); } /* BuildPostDec builds a post decrement tree, the second operand is @@ -139,7 +139,7 @@ m2expr_BuildPostInc (location_t location, tree op) static tree m2expr_BuildPostDec (location_t location, tree op) { - return m2expr_BuildSub (location, op, build_int_cst (TREE_TYPE (op), 1), FALSE); + return m2expr_BuildSub (location, op, build_int_cst (TREE_TYPE (op), 1), false); } /* BuildAddCheck builds an addition tree. */ @@ -158,7 +158,7 @@ m2expr_BuildAddCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, PLUS_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, PLUS_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -166,7 +166,7 @@ m2expr_BuildAddCheck (location_t location, tree op1, tree op2, tree lowest, /* BuildAdd builds an addition tree. */ tree -m2expr_BuildAdd (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildAdd (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -198,7 +198,7 @@ m2expr_BuildSubCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, MINUS_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, MINUS_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -206,7 +206,7 @@ m2expr_BuildSubCheck (location_t location, tree op1, tree op2, tree lowest, /* BuildSub builds a subtraction tree. */ tree -m2expr_BuildSub (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildSub (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -225,7 +225,7 @@ m2expr_BuildSub (location_t location, tree op1, tree op2, int needconvert) /* BuildDivTrunc builds a trunc division tree. */ tree -m2expr_BuildDivTrunc (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildDivTrunc (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -257,7 +257,7 @@ m2expr_BuildDivTruncCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, TRUNC_DIV_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, TRUNC_DIV_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -278,7 +278,7 @@ m2expr_BuildModTruncCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, TRUNC_MOD_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, TRUNC_MOD_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -286,7 +286,7 @@ m2expr_BuildModTruncCheck (location_t location, tree op1, tree op2, tree lowest, /* BuildModTrunc builds a trunc modulus tree. */ tree -m2expr_BuildModTrunc (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildModTrunc (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -318,7 +318,7 @@ m2expr_BuildModCeilCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, CEIL_MOD_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, CEIL_MOD_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -339,7 +339,7 @@ m2expr_BuildModFloorCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, FLOOR_MOD_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, FLOOR_MOD_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -347,7 +347,7 @@ m2expr_BuildModFloorCheck (location_t location, tree op1, tree op2, tree lowest, /* BuildDivCeil builds a ceil division tree. */ tree -m2expr_BuildDivCeil (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildDivCeil (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -379,7 +379,7 @@ m2expr_BuildDivCeilCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, CEIL_DIV_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, CEIL_DIV_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -387,7 +387,7 @@ m2expr_BuildDivCeilCheck (location_t location, tree op1, tree op2, tree lowest, /* BuildModCeil builds a ceil modulus tree. */ tree -m2expr_BuildModCeil (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildModCeil (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -406,7 +406,7 @@ m2expr_BuildModCeil (location_t location, tree op1, tree op2, int needconvert) /* BuildDivFloor builds a floor division tree. */ tree -m2expr_BuildDivFloor (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildDivFloor (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -438,7 +438,7 @@ m2expr_BuildDivFloorCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, FLOOR_DIV_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, FLOOR_DIV_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -447,7 +447,7 @@ m2expr_BuildDivFloorCheck (location_t location, tree op1, tree op2, tree lowest, REAL and COMPLEX types and NEVER for integer based types). */ tree -m2expr_BuildRDiv (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildRDiv (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -463,7 +463,7 @@ m2expr_BuildRDiv (location_t location, tree op1, tree op2, int needconvert) /* BuildModFloor builds a modulus tree. */ tree -m2expr_BuildModFloor (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildModFloor (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -482,7 +482,7 @@ m2expr_BuildModFloor (location_t location, tree op1, tree op2, int needconvert) /* BuildLSL builds and returns tree (op1 << op2). */ tree -m2expr_BuildLSL (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildLSL (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -498,7 +498,7 @@ m2expr_BuildLSL (location_t location, tree op1, tree op2, int needconvert) /* BuildLSR builds and returns tree (op1 >> op2). */ tree -m2expr_BuildLSR (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildLSR (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -537,7 +537,7 @@ createUniqueLabel (void) void m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, tree op3, - tree nBits ATTRIBUTE_UNUSED, int needconvert) + tree nBits ATTRIBUTE_UNUSED, bool needconvert) { tree res; @@ -557,7 +557,7 @@ m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, tree op3, res = m2expr_BuildLSL (location, op2, m2convert_ToWord (location, op3), needconvert); res = m2convert_BuildConvert ( - location, m2tree_skip_type_decl (TREE_TYPE (op1)), res, FALSE); + location, m2tree_skip_type_decl (TREE_TYPE (op1)), res, false); m2statement_BuildAssignmentTree (location, op1, res); } else @@ -573,7 +573,7 @@ m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, tree op3, op3 = m2convert_ToWord (location, op3); res = m2expr_BuildLSL (location, op2, op3, needconvert); res = m2convert_BuildConvert ( - location, m2tree_skip_type_decl (TREE_TYPE (op1)), res, FALSE); + location, m2tree_skip_type_decl (TREE_TYPE (op1)), res, false); m2statement_BuildAssignmentTree (location, op1, res); m2statement_BuildGoto (location, labelEndName); m2statement_DeclareLabel (location, labelElseName); @@ -581,7 +581,7 @@ m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, tree op3, m2expr_BuildNegate (location, op3, needconvert), needconvert); res = m2convert_BuildConvert ( - location, m2tree_skip_type_decl (TREE_TYPE (op1)), res, FALSE); + location, m2tree_skip_type_decl (TREE_TYPE (op1)), res, false); m2statement_BuildAssignmentTree (location, op1, res); m2statement_DeclareLabel (location, labelEndName); } @@ -590,7 +590,7 @@ m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, tree op3, /* BuildLRL builds and returns tree (op1 rotate left by op2 bits). */ tree -m2expr_BuildLRL (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildLRL (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -606,7 +606,7 @@ m2expr_BuildLRL (location_t location, tree op1, tree op2, int needconvert) /* BuildLRR builds and returns tree (op1 rotate right by op2 bits). */ tree -m2expr_BuildLRR (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildLRR (location_t location, tree op1, tree op2, bool needconvert) { tree t; @@ -623,7 +623,7 @@ m2expr_BuildLRR (location_t location, tree op1, tree op2, int needconvert) It assumes nBits is <= TSIZE (WORD). */ tree -m2expr_BuildMask (location_t location, tree nBits, int needconvert) +m2expr_BuildMask (location_t location, tree nBits, bool needconvert) { tree mask = m2expr_BuildLSL (location, m2expr_GetIntegerOne (location), nBits, needconvert); @@ -637,7 +637,7 @@ m2expr_BuildMask (location_t location, tree nBits, int needconvert) tree m2expr_BuildLRotate (location_t location, tree op1, tree nBits, - int needconvert) + bool needconvert) { tree t; @@ -652,7 +652,7 @@ m2expr_BuildLRotate (location_t location, tree op1, tree nBits, tree m2expr_BuildRRotate (location_t location, tree op1, tree nBits, - int needconvert) + bool needconvert) { tree t; @@ -667,7 +667,7 @@ m2expr_BuildRRotate (location_t location, tree op1, tree nBits, tree m2expr_BuildLRLn (location_t location, tree op1, tree op2, tree nBits, - int needconvert) + bool needconvert) { tree op2min; @@ -709,7 +709,7 @@ m2expr_BuildLRLn (location_t location, tree op1, tree op2, tree nBits, tree m2expr_BuildLRRn (location_t location, tree op1, tree op2, tree nBits, - int needconvert) + bool needconvert) { tree op2min; @@ -750,7 +750,7 @@ m2expr_BuildLRRn (location_t location, tree op1, tree op2, tree nBits, void m2expr_BuildLogicalRotate (location_t location, tree op1, tree op2, tree op3, - tree nBits, int needconvert) + tree nBits, bool needconvert) { tree res; @@ -817,14 +817,14 @@ buildUnboundedArrayOf (tree unbounded, tree contentsPtr, tree high) void m2expr_BuildBinarySetDo (location_t location, tree settype, tree op1, tree op2, tree op3, void (*binop) (location_t, tree, tree, tree, - tree, int), - int is_op1lvalue, int is_op2lvalue, int is_op3lvalue, + tree, bool), + bool is_op1lvalue, bool is_op2lvalue, bool is_op3lvalue, tree nBits, tree unbounded, tree varproc, tree leftproc, tree rightproc) { tree size = m2expr_GetSizeOf (location, settype); - int is_const = FALSE; - int is_left = FALSE; + int is_const = false; + int is_left = false; m2assert_AssertLocation (location); @@ -840,7 +840,7 @@ m2expr_BuildBinarySetDo (location_t location, tree settype, tree op1, tree op2, m2treelib_get_rvalue (location, op1, settype, is_op1lvalue), m2treelib_get_rvalue (location, op2, settype, is_op2lvalue), m2treelib_get_rvalue (location, op3, settype, is_op3lvalue), - nBits, FALSE); + nBits, false); else { tree result; @@ -851,8 +851,8 @@ m2expr_BuildBinarySetDo (location_t location, tree settype, tree op1, tree op2, m2expr_BuildDivTrunc ( location, size, m2expr_GetSizeOf (location, m2type_GetBitsetType ()), - FALSE)), - m2expr_GetCardinalOne (location), FALSE); + false)), + m2expr_GetCardinalOne (location), false); /* If op3 is constant then make op3 positive and remember which direction we are shifting. */ @@ -860,13 +860,13 @@ m2expr_BuildBinarySetDo (location_t location, tree settype, tree op1, tree op2, op3 = m2tree_skip_const_decl (op3); if (TREE_CODE (op3) == INTEGER_CST) { - is_const = TRUE; + is_const = true; if (tree_int_cst_sgn (op3) < 0) - op3 = m2expr_BuildNegate (location, op3, FALSE); + op3 = m2expr_BuildNegate (location, op3, false); else - is_left = TRUE; + is_left = true; op3 = m2convert_BuildConvert (location, m2type_GetM2CardinalType (), - op3, FALSE); + op3, false); } /* These parameters must match the prototypes of the procedures: @@ -883,13 +883,13 @@ m2expr_BuildBinarySetDo (location_t location, tree settype, tree op1, tree op2, m2treelib_get_rvalue (location, op3, m2tree_skip_type_decl (TREE_TYPE (op3)), is_op3lvalue), - FALSE)); + false)); /* Parameter 3 nBits. */ m2statement_BuildParam ( location, m2convert_BuildConvert (location, m2type_GetM2CardinalType (), - m2expr_FoldAndStrip (nBits), FALSE)); + m2expr_FoldAndStrip (nBits), false)); /* Parameter 2 destination set. */ m2statement_BuildParam ( @@ -934,7 +934,7 @@ m2expr_ConstantExpressionWarning (tree value) pedwarn (input_location, OPT_Woverflow, "overflow in constant expression"); } -/* TreeOverflow return TRUE if the contant expression, t, has caused +/* TreeOverflow return true if the contant expression, t, has caused an overflow. No error message or warning is emitted and no modification is made to, t. */ @@ -945,14 +945,14 @@ m2expr_TreeOverflow (tree t) || (TREE_CODE (t) == COMPLEX_CST && TREE_CODE (TREE_REALPART (t)) == INTEGER_CST)) && TREE_OVERFLOW (t)) - return TRUE; + return true; else if ((TREE_CODE (t) == REAL_CST || (TREE_CODE (t) == COMPLEX_CST && TREE_CODE (TREE_REALPART (t)) == REAL_CST)) && TREE_OVERFLOW (t)) - return TRUE; + return true; else - return FALSE; + return false; } /* RemoveOverflow if tree, t, is a constant expression it removes any @@ -1101,10 +1101,10 @@ m2expr_BuildLessThanZero (location_t location, tree value, tree type, tree min, if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) >= 0) /* min is greater than or equal to zero therefore value will always be >= 0. */ - return m2expr_GetIntegerZero (location); + return m2type_GetBooleanFalse (); else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) == -1) /* max is less than zero therefore value will always be < 0. */ - return m2expr_GetIntegerOne (location); + return m2type_GetBooleanTrue (); /* We now know 0 lies in the range min..max so we can safely cast zero to type. */ return m2expr_BuildLessThan ( @@ -1122,11 +1122,11 @@ m2expr_BuildGreaterThanZero (location_t location, tree value, tree type, { if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) == 1) /* min is greater than zero therefore value will always be > 0. */ - return m2expr_GetIntegerOne (location); + return m2type_GetBooleanTrue (); else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) <= 0) /* max is less than or equal to zero therefore value will always be <= 0. */ - return m2expr_GetIntegerZero (location); + return m2type_GetBooleanFalse (); /* We now know 0 lies in the range min..max so we can safely cast zero to type. */ return m2expr_BuildGreaterThan ( @@ -1144,11 +1144,11 @@ m2expr_BuildEqualToZero (location_t location, tree value, tree type, tree min, { if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) == 1) /* min is greater than zero therefore value will always be > 0. */ - return m2expr_GetIntegerZero (location); + return m2type_GetBooleanFalse (); else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) < 0) /* max is less than or equal to zero therefore value will always be < 0. */ - return m2expr_GetIntegerZero (location); + return m2type_GetBooleanFalse (); /* We now know 0 lies in the range min..max so we can safely cast zero to type. */ return m2expr_BuildEqualTo ( @@ -1166,11 +1166,11 @@ m2expr_BuildNotEqualToZero (location_t location, tree value, tree type, { if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) == 1) /* min is greater than zero therefore value will always be true. */ - return m2expr_GetIntegerOne (location); + return m2type_GetBooleanTrue (); else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) < 0) /* max is less than or equal to zero therefore value will always be true. */ - return m2expr_GetIntegerOne (location); + return m2type_GetBooleanTrue (); /* We now know 0 lies in the range min..max so we can safely cast zero to type. */ return m2expr_BuildNotEqualTo ( @@ -1189,10 +1189,10 @@ m2expr_BuildGreaterThanOrEqualZero (location_t location, tree value, tree type, { if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) >= 0) /* min is greater than or equal to zero therefore value will always be >= 0. */ - return m2expr_GetIntegerOne (location); + return m2type_GetBooleanTrue (); else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) < 0) /* max is less than zero therefore value will always be < 0. */ - return m2expr_GetIntegerZero (location); + return m2type_GetBooleanFalse (); /* We now know 0 lies in the range min..max so we can safely cast zero to type. */ return m2expr_BuildGreaterThan ( @@ -1211,10 +1211,10 @@ m2expr_BuildLessThanOrEqualZero (location_t location, tree value, tree type, { if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) > 0) /* min is greater than zero therefore value will always be > 0. */ - return m2expr_GetIntegerZero (location); + return m2type_GetBooleanFalse (); else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) <= 0) /* max is less than or equal to zero therefore value will always be <= 0. */ - return m2expr_GetIntegerOne (location); + return m2type_GetBooleanTrue (); /* We now know 0 lies in the range min..max so we can safely cast zero to type. */ return m2expr_BuildLessThanOrEqual ( @@ -1289,15 +1289,15 @@ checkWholeNegateOverflow (location_t location, tree c8 = m2expr_BuildGreaterThanZero (location, max, type, min, max); /* max > 0. */ tree c9 = m2expr_BuildGreaterThanZero ( - location, m2expr_BuildAdd (location, min, max, FALSE), type, min, + location, m2expr_BuildAdd (location, min, max, false), type, min, max); /* min + max > 0. */ tree c10 = m2expr_BuildGreaterThan ( - location, i, m2expr_BuildNegate (location, min, FALSE)); /* i > -min. */ + location, i, m2expr_BuildNegate (location, min, false)); /* i > -min. */ tree c11 = m2expr_BuildLessThanZero ( - location, m2expr_BuildAdd (location, min, max, FALSE), type, min, + location, m2expr_BuildAdd (location, min, max, false), type, min, max); /* min + max < 0. */ tree c12 = m2expr_BuildLessThan ( - location, i, m2expr_BuildNegate (location, max, FALSE)); /* i < -max. */ + location, i, m2expr_BuildNegate (location, max, false)); /* i < -max. */ tree b1 = m2expr_BuildTruthOrIf (location, c1, c2); tree b2 = m2expr_BuildTruthOrIf (location, c8, c5); @@ -1337,10 +1337,10 @@ checkWholeAddOverflow (location_t location, tree i, tree j, tree lowest, { tree j_gt_zero = m2expr_BuildGreaterThanZero (location, j, lowest, min, max); tree i_gt_max_sub_j = m2expr_BuildGreaterThan ( - location, i, m2expr_BuildSub (location, max, j, FALSE)); + location, i, m2expr_BuildSub (location, max, j, false)); tree j_lt_zero = m2expr_BuildLessThanZero (location, j, lowest, min, max); tree i_lt_min_sub_j = m2expr_BuildLessThan (location, i, - m2expr_BuildSub (location, min, j, FALSE)); + m2expr_BuildSub (location, min, j, false)); tree lhs_or = m2expr_FoldAndStrip (m2expr_BuildTruthAndIf (location, j_gt_zero, i_gt_max_sub_j)); tree rhs_or = m2expr_FoldAndStrip (m2expr_BuildTruthAndIf (location, j_lt_zero, i_lt_min_sub_j)); tree condition @@ -1368,10 +1368,10 @@ checkWholeSubOverflow (location_t location, tree i, tree j, tree lowest, { tree c1 = m2expr_BuildGreaterThanZero (location, j, lowest, min, max); tree c2 = m2expr_BuildLessThan (location, i, - m2expr_BuildAdd (location, min, j, FALSE)); + m2expr_BuildAdd (location, min, j, false)); tree c3 = m2expr_BuildLessThanZero (location, j, lowest, min, max); tree c4 = m2expr_BuildGreaterThan (location, i, - m2expr_BuildAdd (location, max, j, FALSE)); + m2expr_BuildAdd (location, max, j, false)); tree c5 = m2expr_FoldAndStrip (m2expr_BuildTruthAndIf (location, c1, c2)); tree c6 = m2expr_FoldAndStrip (m2expr_BuildTruthAndIf (location, c3, c4)); tree condition @@ -1382,7 +1382,7 @@ checkWholeSubOverflow (location_t location, tree i, tree j, tree lowest, return t; } -/* Build4TruthAndIf - return TRUE if a && b && c && d. Retain order left to +/* Build4TruthAndIf - return true if a && b && c && d. Retain order left to * right. */ static tree @@ -1393,7 +1393,7 @@ m2expr_Build4TruthAndIf (location_t location, tree a, tree b, tree c, tree d) return m2expr_FoldAndStrip (m2expr_BuildTruthAndIf (location, t2, d)); } -/* Build3TruthAndIf - return TRUE if a && b && c. Retain order left to right. +/* Build3TruthAndIf - return true if a && b && c. Retain order left to right. */ static tree @@ -1403,7 +1403,7 @@ m2expr_Build3TruthAndIf (location_t location, tree op1, tree op2, tree op3) return m2expr_FoldAndStrip (m2expr_BuildTruthAndIf (location, t, op3)); } -/* Build3TruthOrIf - return TRUE if a || b || c. Retain order left to right. +/* Build3TruthOrIf - return true if a || b || c. Retain order left to right. */ static tree @@ -1413,7 +1413,7 @@ m2expr_Build3TruthOrIf (location_t location, tree op1, tree op2, tree op3) return m2expr_FoldAndStrip (m2expr_BuildTruthOrIf (location, t, op3)); } -/* Build4TruthOrIf - return TRUE if op1 || op2 || op3 || op4. Retain order +/* Build4TruthOrIf - return true if op1 || op2 || op3 || op4. Retain order left to right. */ static tree @@ -1425,18 +1425,18 @@ m2expr_Build4TruthOrIf (location_t location, tree op1, tree op2, tree op3, return m2expr_FoldAndStrip (m2expr_BuildTruthOrIf (location, t2, op4)); } -/* Build4LogicalOr - return TRUE if op1 || op2 || op3 || op4. */ +/* Build4LogicalOr - return true if op1 || op2 || op3 || op4. */ static tree m2expr_Build4LogicalOr (location_t location, tree op1, tree op2, tree op3, tree op4) { tree t1 = m2expr_FoldAndStrip ( - m2expr_BuildLogicalOr (location, op1, op2, FALSE)); + m2expr_BuildLogicalOr (location, op1, op2, false)); tree t2 - = m2expr_FoldAndStrip (m2expr_BuildLogicalOr (location, t1, op3, FALSE)); + = m2expr_FoldAndStrip (m2expr_BuildLogicalOr (location, t1, op3, false)); return m2expr_FoldAndStrip ( - m2expr_BuildLogicalOr (location, t2, op4, FALSE)); + m2expr_BuildLogicalOr (location, t2, op4, false)); } /* checkWholeMultOverflow - check to see whether i * j will overflow @@ -1468,15 +1468,15 @@ testWholeMultOverflow (location_t location, tree lhs, tree rhs, tree c3 = m2expr_BuildGreaterThanZero (location, rhs, lowest, min, max); tree c4 = m2expr_BuildGreaterThan ( - location, lhs, m2expr_BuildDivTrunc (location, max, rhs, FALSE)); + location, lhs, m2expr_BuildDivTrunc (location, max, rhs, false)); tree c5 = m2expr_BuildLessThanZero (location, rhs, lowest, min, max); tree c6 = m2expr_BuildLessThan ( - location, rhs, m2expr_BuildDivTrunc (location, min, lhs, FALSE)); + location, rhs, m2expr_BuildDivTrunc (location, min, lhs, false)); tree c7 = m2expr_BuildLessThan ( - location, lhs, m2expr_BuildDivTrunc (location, min, rhs, FALSE)); + location, lhs, m2expr_BuildDivTrunc (location, min, rhs, false)); tree c8 = m2expr_BuildLessThan ( - location, lhs, m2expr_BuildDivTrunc (location, max, rhs, FALSE)); + location, lhs, m2expr_BuildDivTrunc (location, max, rhs, false)); tree c9 = m2expr_Build3TruthAndIf (location, c1, c3, c4); tree c10 = m2expr_Build3TruthAndIf (location, c1, c5, c6); @@ -1503,7 +1503,7 @@ checkWholeMultOverflow (location_t location, tree i, tree j, tree lowest, static tree divMinUnderflow (location_t location, tree value, tree lowest, tree min, tree max) { - tree min2 = m2expr_BuildMult (location, min, min, FALSE); + tree min2 = m2expr_BuildMult (location, min, min, false); tree rhs = m2expr_BuildGreaterThanOrEqual (location, value, min2); tree lhs = testWholeMultOverflow (location, min, min, lowest, min, max); return m2expr_BuildTruthAndIf (location, lhs, rhs); @@ -1575,13 +1575,13 @@ checkWholeDivTruncOverflow (location_t location, tree i, tree j, tree lowest, tree b5 = m2expr_BuildTruthAndIf (location, b5a, b4b); tree c1 = m2expr_BuildEqualToZero (location, j, lowest, min, max); tree c2 = m2expr_BuildLessThanZero (location, max, lowest, min, max); - tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, m2expr_BuildMult (location, j, min, FALSE)); + tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, m2expr_BuildMult (location, j, min, false)); tree j_mult_min_overflow = testWholeMultOverflow (location, j, min, lowest, min, max); tree b6 = m2expr_BuildTruthOrIf (location, j_mult_min_overflow, i_lt_j_mult_min); tree c3 = m2expr_BuildTruthAndIf (location, b4, b6); - tree s1 = m2expr_BuildDivTrunc (location, i, min, FALSE); - tree s2 = m2expr_BuildDivTrunc (location, i, max, FALSE); - tree s3 = m2expr_BuildDivTrunc (location, i, j, FALSE); + tree s1 = m2expr_BuildDivTrunc (location, i, min, false); + tree s2 = m2expr_BuildDivTrunc (location, i, max, false); + tree s3 = m2expr_BuildDivTrunc (location, i, j, false); tree j_gt_s1 = m2expr_BuildGreaterThan (location, j, s1); tree i_div_min_overflow = divMinUnderflow (location, i, lowest, min, max); @@ -1626,7 +1626,7 @@ END divceilexpr ; (* divCeilOverflowCases - precondition: i, j are in range values. - postcondition: TRUE is returned if i divceil will + postcondition: true is returned if i divceil will result in an overflow/underflow. *) @@ -1641,7 +1641,7 @@ END divCeilOverflowCases ; (* divCeilOverflowPosPos - precondition: i, j are legal and are both >= 0. - postcondition: TRUE is returned if i divceil will + postcondition: true is returned if i divceil will result in an overflow/underflow. *) @@ -1654,7 +1654,7 @@ END divCeilOverflowPosPos ; (* divCeilOverflowNegNeg - precondition: i, j are in range values and both < 0. - postcondition: TRUE is returned if i divceil will + postcondition: true is returned if i divceil will result in an overflow/underflow. *) @@ -1672,7 +1672,7 @@ END divCeilOverflowNegNeg ; (* divCeilOverflowNegPos - precondition: i, j are in range values. i < 0, j >= 0. - postcondition: TRUE is returned if i divceil will + postcondition: true is returned if i divceil will result in an overflow/underflow. *) @@ -1688,7 +1688,7 @@ END divCeilOverflowNegPos ; (* divCeilOverflowPosNeg - precondition: i, j are in range values. i >= 0, j < 0. - postcondition: TRUE is returned if i divceil will + postcondition: true is returned if i divceil will result in an overflow/underflow. *) @@ -1722,11 +1722,11 @@ static tree divCeilOverflowPosPos (location_t location, tree i, tree j, tree lowest, tree min, tree max) { - tree i_mod_j = m2expr_BuildModTrunc (location, i, j, FALSE); + tree i_mod_j = m2expr_BuildModTrunc (location, i, j, false); tree i_mod_j_eq_zero = m2expr_BuildEqualToZero (location, i_mod_j, lowest, min, max); tree i_mod_j_ne_zero = m2expr_BuildNotEqualToZero (location, i_mod_j, lowest, min, max); - tree j_min = m2expr_BuildMult (location, j, min, FALSE); - tree j_min_1 = m2expr_BuildAdd (location, j_min, m2expr_GetIntegerOne (location), FALSE); + tree j_min = m2expr_BuildMult (location, j, min, false); + tree j_min_1 = m2expr_BuildAdd (location, j_min, m2expr_GetIntegerOne (location), false); tree i_lt_j_min = m2expr_BuildLessThan (location, i, j_min); tree i_lt_j_min_1 = m2expr_BuildLessThan (location, i, j_min_1); tree a = m2expr_BuildTruthAndIf (location, i_mod_j_eq_zero, i_lt_j_min); @@ -1760,10 +1760,10 @@ static tree divCeilOverflowPosNeg (location_t location, tree i, tree j, tree lowest, tree min, tree max) { tree abs_j = m2expr_BuildAbs (location, j); - tree i_mod_abs_j = m2expr_BuildModFloor (location, i, abs_j, FALSE); + tree i_mod_abs_j = m2expr_BuildModFloor (location, i, abs_j, false); tree i_mod_abs_j_eq_0 = m2expr_BuildEqualToZero (location, i_mod_abs_j, lowest, min, max); tree i_mod_abs_j_ne_0 = m2expr_BuildNotEqualToZero (location, i_mod_abs_j, lowest, min, max); - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); tree j_mult_min_1 = m2expr_BuildPostDec (location, j_mult_min); tree i_gt_j_mult_min = m2expr_BuildGreaterThan (location, i, j_mult_min); tree i_gt_j_mult_min_1 = m2expr_BuildGreaterThan (location, i, j_mult_min_1); @@ -1799,10 +1799,10 @@ static tree divCeilOverflowNegPos (location_t location, tree i, tree j, tree lowest, tree min, tree max) { tree abs_i = m2expr_BuildAbs (location, i); - tree abs_i_mod_j = m2expr_BuildModFloor (location, abs_i, j, FALSE); + tree abs_i_mod_j = m2expr_BuildModFloor (location, abs_i, j, false); tree abs_i_mod_j_eq_0 = m2expr_BuildEqualToZero (location, abs_i_mod_j, lowest, min, max); tree abs_i_mod_j_ne_0 = m2expr_BuildNotEqualToZero (location, abs_i_mod_j, lowest, min, max); - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); tree j_mult_min_1 = m2expr_BuildPostDec (location, j_mult_min); tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, j_mult_min); tree i_lt_j_mult_min_1 = m2expr_BuildLessThan (location, i, j_mult_min_1); @@ -1859,17 +1859,17 @@ divCeilOverflowNegNeg (location_t location, tree i, tree j, tree lowest, tree max_lte_0 = m2expr_BuildLessThanOrEqualZero (location, max, lowest, min, max); tree abs_i = m2expr_BuildAbs (location, i); tree abs_j = m2expr_BuildAbs (location, j); - tree abs_i_mod_abs_j = m2expr_BuildModFloor (location, abs_i, abs_j, FALSE); + tree abs_i_mod_abs_j = m2expr_BuildModFloor (location, abs_i, abs_j, false); tree abs_i_mod_abs_j_eq_0 = m2expr_BuildEqualToZero (location, abs_i_mod_abs_j, lowest, min, max); tree abs_i_mod_abs_j_ne_0 = m2expr_BuildNotEqualToZero (location, abs_i_mod_abs_j, lowest, min, max); - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); tree j_mult_min_1 = m2expr_BuildPostDec (location, j_mult_min); tree i_ge_j_mult_min = m2expr_BuildGreaterThanOrEqual (location, i, j_mult_min); tree i_ge_j_mult_min_1 = m2expr_BuildGreaterThanOrEqual (location, i, j_mult_min_1); - tree abs_i_mod_max = m2expr_BuildModFloor (location, abs_i, max, FALSE); - tree abs_i_div_max = m2expr_BuildDivFloor (location, abs_i, max, FALSE); + tree abs_i_mod_max = m2expr_BuildModFloor (location, abs_i, max, false); + tree abs_i_div_max = m2expr_BuildDivFloor (location, abs_i, max, false); tree abs_j_1 = m2expr_BuildPostInc (location, abs_j); tree abs_i_mod_max_eq_0 = m2expr_BuildEqualToZero (location, abs_i_mod_max, lowest, min, max); tree abs_i_mod_max_ne_0 = m2expr_BuildNotEqualToZero (location, abs_i_mod_max, lowest, min, max); @@ -2026,8 +2026,8 @@ checkWholeModTruncOverflow (location_t location, tree i, tree j, tree lowest, tree c2 = m2expr_BuildLessThanZero (location, j, lowest, min, max); tree c3 = m2expr_BuildNotEqualToZero (location, i, lowest, min, max); tree c4 = m2expr_BuildLessThanOrEqual (location, j, i); - tree c6 = m2expr_BuildDivTrunc (location, i, j, FALSE); - tree c7 = m2expr_BuildSub (location, i, m2expr_BuildMult (location, c6, j, FALSE), FALSE); + tree c6 = m2expr_BuildDivTrunc (location, i, j, false); + tree c7 = m2expr_BuildSub (location, i, m2expr_BuildMult (location, c6, j, false), false); tree c5 = m2expr_BuildLessThan (location, c7, min); tree c8 = m2expr_Build3TruthAndIf (location, c3, c4, c5); tree condition = m2expr_Build3TruthOrIf (location, c1, c2, c8); @@ -2076,9 +2076,9 @@ checkWholeModCeilOverflow (location_t location, tree min, tree max) { tree c1 = m2expr_BuildEqualToZero (location, j, lowest, min, max); - tree c2 = m2expr_BuildSub (location, i, j, FALSE); - tree c3 = m2expr_BuildDivCeil (location, i, j, FALSE); - tree t = m2expr_BuildMult (location, c2, c3, FALSE); + tree c2 = m2expr_BuildSub (location, i, j, false); + tree c3 = m2expr_BuildDivCeil (location, i, j, false); + tree t = m2expr_BuildMult (location, c2, c3, false); tree c4 = m2expr_BuildGreaterThanOrEqual (location, t, min); tree c5 = m2expr_BuildLessThanOrEqual (location, t, max); tree c6 = m2expr_BuildTruthAndIf (location, c4, c5); @@ -2129,9 +2129,9 @@ checkWholeModFloorOverflow (location_t location, tree min, tree max) { tree c1 = m2expr_BuildEqualToZero (location, j, lowest, min, max); - tree c2 = m2expr_BuildSub (location, i, j, FALSE); - tree c3 = m2expr_BuildDivFloor (location, i, j, FALSE); - tree t = m2expr_BuildMult (location, c2, c3, FALSE); + tree c2 = m2expr_BuildSub (location, i, j, false); + tree c3 = m2expr_BuildDivFloor (location, i, j, false); + tree t = m2expr_BuildMult (location, c2, c3, false); tree c4 = m2expr_BuildGreaterThanOrEqual (location, t, min); tree c5 = m2expr_BuildLessThanOrEqual (location, t, max); tree c6 = m2expr_BuildTruthAndIf (location, c4, c5); @@ -2149,7 +2149,7 @@ checkWholeModFloorOverflow (location_t location, this code has been hand translated into GCC trees. */ (* - divFloorOverflow2 - returns TRUE if an overflow will occur + divFloorOverflow2 - returns true if an overflow will occur if i divfloor j is performed. *) @@ -2169,7 +2169,7 @@ END divFloorOverflow ; (* divFloorOverflowCases - precondition: i, j are in range values. - postcondition: TRUE is returned if i divfloor will + postcondition: true is returned if i divfloor will result in an overflow/underflow. *) @@ -2184,7 +2184,7 @@ END divFloorOverflowCases ; (* divFloorOverflowPosPos - precondition: lhs, rhs are legal and are both >= 0. - postcondition: TRUE is returned if lhs divfloor rhs will + postcondition: true is returned if lhs divfloor rhs will result in an overflow/underflow. *) @@ -2196,7 +2196,7 @@ END divFloorOverflowPosPos ; (* divFloorOverflowNegNeg - precondition: i, j are in range values and both < 0. - postcondition: TRUE is returned if i divfloor will + postcondition: true is returned if i divfloor will result in an overflow/underflow. *) @@ -2212,7 +2212,7 @@ END divFloorOverflowNegNeg ; (* divFloorOverflowNegPos - precondition: i, j are in range values. i < 0, j >= 0. - postcondition: TRUE is returned if i divfloor will + postcondition: true is returned if i divfloor will result in an overflow/underflow. *) @@ -2227,7 +2227,7 @@ END divFloorOverflowNegPos ; (* divFloorOverflowPosNeg - precondition: i, j are in range values. i >= 0, j < 0. - postcondition: TRUE is returned if i divfloor will + postcondition: true is returned if i divfloor will result in an overflow/underflow. *) @@ -2242,7 +2242,7 @@ END divFloorOverflowPosNeg ; /* divFloorOverflowPosPos, precondition: i, j are legal and are both >= 0. - Postcondition: TRUE is returned if i divfloor will result in an overflow/underflow. + Postcondition: true is returned if i divfloor will result in an overflow/underflow. A handbuilt expression of trees implementing: @@ -2254,14 +2254,14 @@ END divFloorOverflowPosNeg ; static tree divFloorOverflowPosPos (location_t location, tree i, tree j, tree min) { - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, j_mult_min); return i_lt_j_mult_min; } /* divFloorOverflowNegNeg precondition: i, j are in range values and both < 0. - Postcondition: TRUE is returned if i divfloor j will result in an + Postcondition: true is returned if i divfloor j will result in an overflow/underflow. A handbuilt expression of trees implementing: @@ -2291,9 +2291,9 @@ divFloorOverflowNegNeg (location_t location, tree i, tree j, tree lowest, tree max_lte_0 = m2expr_BuildLessThanOrEqualZero (location, max, lowest, min, max); tree abs_i = m2expr_BuildAbs (location, i); tree abs_j = m2expr_BuildAbs (location, j); - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); tree i_ge_j_mult_min = m2expr_BuildGreaterThanOrEqual (location, i, j_mult_min); - tree abs_i_div_max = m2expr_BuildDivFloor (location, abs_i, max, FALSE); + tree abs_i_div_max = m2expr_BuildDivFloor (location, abs_i, max, false); tree abs_i_div_max_gt_abs_j = m2expr_BuildGreaterThan (location, abs_i_div_max, abs_j); return m2expr_Build3TruthOrIf (location, max_lte_0, i_ge_j_mult_min, abs_i_div_max_gt_abs_j); @@ -2301,7 +2301,7 @@ divFloorOverflowNegNeg (location_t location, tree i, tree j, tree lowest, /* divFloorOverflowPosNeg precondition: i, j are in range values and i >=0, j < 0. - Postcondition: TRUE is returned if i divfloor j will result in an + Postcondition: true is returned if i divfloor j will result in an overflow/underflow. A handbuilt expression of trees implementing: @@ -2317,15 +2317,15 @@ divFloorOverflowNegNeg (location_t location, tree i, tree j, tree lowest, static tree divFloorOverflowPosNeg (location_t location, tree i, tree j, tree min) { - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); - tree j_mult_min_sub_j = m2expr_BuildSub (location, j_mult_min, j, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); + tree j_mult_min_sub_j = m2expr_BuildSub (location, j_mult_min, j, false); tree i_ge_j_mult_min_sub_j = m2expr_BuildGreaterThanOrEqual (location, i, j_mult_min_sub_j); return i_ge_j_mult_min_sub_j; } /* divFloorOverflowNegPos precondition: i, j are in range values and i < 0, j > 0. - Postcondition: TRUE is returned if i divfloor j will result in an + Postcondition: true is returned if i divfloor j will result in an overflow/underflow. A handbuilt expression of trees implementing: @@ -2338,14 +2338,14 @@ divFloorOverflowPosNeg (location_t location, tree i, tree j, tree min) static tree divFloorOverflowNegPos (location_t location, tree i, tree j, tree min) { - tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE); + tree j_mult_min = m2expr_BuildMult (location, j, min, false); tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, j_mult_min); return i_lt_j_mult_min; } /* divFloorOverflowCases, precondition: i, j are in range values. - Postcondition: TRUE is returned if i divfloor will result in an + Postcondition: true is returned if i divfloor will result in an overflow/underflow. A handbuilt expression of trees implementing: @@ -2533,7 +2533,7 @@ m2expr_checkRealOverflow (location_t location, enum tree_code code, tree m2expr_build_binary_op_check (location_t location, enum tree_code code, - tree op1, tree op2, int needconvert, tree lowest, + tree op1, tree op2, bool needconvert, tree lowest, tree min, tree max) { tree type1, type2, result; @@ -2654,7 +2654,7 @@ m2expr_BuildNegateCheck (location_t location, tree arg, tree lowest, tree min, /* BuildNegate build a negate expression and returns the tree. */ tree -m2expr_BuildNegate (location_t location, tree op1, int needconvert) +m2expr_BuildNegate (location_t location, tree op1, bool needconvert) { m2assert_AssertLocation (location); op1 = m2expr_FoldAndStrip (op1); @@ -2666,21 +2666,21 @@ m2expr_BuildNegate (location_t location, tree op1, int needconvert) /* BuildSetNegate build a set negate expression and returns the tree. */ tree -m2expr_BuildSetNegate (location_t location, tree op1, int needconvert) +m2expr_BuildSetNegate (location_t location, tree op1, bool needconvert) { m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, BIT_XOR_EXPR, m2convert_BuildConvert (location, m2type_GetWordType (), - m2expr_FoldAndStrip (op1), FALSE), + m2expr_FoldAndStrip (op1), false), set_full_complement, needconvert); } /* BuildMult build a multiplication tree. */ tree -m2expr_BuildMult (location_t location, tree op1, tree op2, int needconvert) +m2expr_BuildMult (location_t location, tree op1, tree op2, bool needconvert) { op1 = m2expr_FoldAndStrip (op1); op2 = m2expr_FoldAndStrip (op2); @@ -2709,7 +2709,7 @@ m2expr_BuildMultCheck (location_t location, tree op1, tree op2, tree lowest, op1 = CheckAddressToCardinal (location, op1); op2 = CheckAddressToCardinal (location, op2); - t = m2expr_build_binary_op_check (location, MULT_EXPR, op1, op2, FALSE, + t = m2expr_build_binary_op_check (location, MULT_EXPR, op1, op2, false, lowest, min, max); return m2expr_FoldAndStrip (t); } @@ -2726,7 +2726,7 @@ testLimits (location_t location, tree type, tree min, tree max) && (m2expr_CompareTrees (TYPE_MIN_VALUE (type), min) == 0)) return m2expr_BuildMult (location, m2expr_GetSizeOf (location, type), m2decl_BuildIntegerConstant (BITS_PER_UNIT), - FALSE); + false); return NULL_TREE; } @@ -2760,7 +2760,7 @@ getMax (tree a, tree b) static tree calcNbits (location_t location, tree min, tree max) { - int negative = FALSE; + int negative = false; tree t = testLimits (location, m2type_GetIntegerType (), min, max); m2assert_AssertLocation (location); @@ -2773,19 +2773,19 @@ calcNbits (location_t location, tree min, tree max) if (m2expr_CompareTrees (min, m2expr_GetIntegerZero (location)) < 0) { min = m2expr_BuildAdd (location, min, - m2expr_GetIntegerOne (location), FALSE); - min = fold (m2expr_BuildNegate (location, min, FALSE)); - negative = TRUE; + m2expr_GetIntegerOne (location), false); + min = fold (m2expr_BuildNegate (location, min, false)); + negative = true; } if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) < 0) { - max = fold (m2expr_BuildNegate (location, max, FALSE)); - negative = TRUE; + max = fold (m2expr_BuildNegate (location, max, false)); + negative = true; } t = noBitsRequired (getMax (min, max)); if (negative) t = m2expr_BuildAdd (location, t, m2expr_GetIntegerOne (location), - FALSE); + false); } return t; } @@ -2808,16 +2808,16 @@ m2expr_BuildTBitSize (location_t location, tree type) case INTEGER_TYPE: case ENUMERAL_TYPE: max = m2convert_BuildConvert (location, m2type_GetIntegerType (), - TYPE_MAX_VALUE (type), FALSE); + TYPE_MAX_VALUE (type), false); min = m2convert_BuildConvert (location, m2type_GetIntegerType (), - TYPE_MIN_VALUE (type), FALSE); + TYPE_MIN_VALUE (type), false); return calcNbits (location, min, max); case BOOLEAN_TYPE: return m2expr_GetIntegerOne (location); default: return m2expr_BuildMult (location, m2expr_GetSizeOf (location, type), m2decl_BuildIntegerConstant (BITS_PER_UNIT), - FALSE); + false); } } @@ -2825,18 +2825,18 @@ m2expr_BuildTBitSize (location_t location, tree type) tree m2expr_BuildSize (location_t location, tree op1, - int needconvert ATTRIBUTE_UNUSED) + bool needconvert ATTRIBUTE_UNUSED) { m2assert_AssertLocation (location); return m2expr_GetSizeOf (location, op1); } /* BuildAddr return an expression which calculates the address of op1 - and returns the tree. If use_generic is TRUE then create a generic + and returns the tree. If use_generic is true then create a generic pointer type. */ tree -m2expr_BuildAddr (location_t location, tree op1, int use_generic) +m2expr_BuildAddr (location_t location, tree op1, bool use_generic) { tree type = m2tree_skip_type_decl (TREE_TYPE (op1)); tree ptrType = build_pointer_type (type); @@ -2862,7 +2862,7 @@ m2expr_BuildAddr (location_t location, tree op1, int use_generic) tree m2expr_BuildOffset1 (location_t location, tree field, - int needconvert ATTRIBUTE_UNUSED) + bool needconvert ATTRIBUTE_UNUSED) { m2assert_AssertLocation (location); return m2expr_BuildOffset (location, DECL_CONTEXT (field), field, @@ -2911,7 +2911,7 @@ expression is returned. */ tree m2expr_BuildOffset (location_t location, tree record, tree field, - int needconvert ATTRIBUTE_UNUSED) + bool needconvert ATTRIBUTE_UNUSED) { m2assert_AssertLocation (location); @@ -2922,9 +2922,9 @@ m2expr_BuildOffset (location_t location, tree record, tree field, location, DECL_FIELD_OFFSET (field), m2expr_BuildDivTrunc (location, DECL_FIELD_BIT_OFFSET (field), m2decl_BuildIntegerConstant (BITS_PER_UNIT), - FALSE), - FALSE), - FALSE); + false), + false), + false); else { tree r1 = DECL_CONTEXT (field); @@ -2933,8 +2933,8 @@ m2expr_BuildOffset (location_t location, tree record, tree field, location, m2type_GetIntegerType (), m2expr_BuildAdd ( location, m2expr_BuildOffset (location, r1, field, needconvert), - m2expr_BuildOffset (location, record, r2, needconvert), FALSE), - FALSE); + m2expr_BuildOffset (location, record, r2, needconvert), false), + false); } } @@ -2942,7 +2942,7 @@ m2expr_BuildOffset (location_t location, tree record, tree field, tree m2expr_BuildLogicalOrAddress (location_t location, tree op1, tree op2, - int needconvert) + bool needconvert) { m2assert_AssertLocation (location); return m2expr_build_binary_op (location, BIT_IOR_EXPR, op1, op2, @@ -2953,13 +2953,13 @@ m2expr_BuildLogicalOrAddress (location_t location, tree op1, tree op2, tree m2expr_BuildLogicalOr (location_t location, tree op1, tree op2, - int needconvert) + bool needconvert) { m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, BIT_IOR_EXPR, - m2convert_BuildConvert (location, m2type_GetWordType (), op1, FALSE), - m2convert_BuildConvert (location, m2type_GetWordType (), op2, FALSE), + m2convert_BuildConvert (location, m2type_GetWordType (), op1, false), + m2convert_BuildConvert (location, m2type_GetWordType (), op2, false), needconvert); } @@ -2967,13 +2967,13 @@ m2expr_BuildLogicalOr (location_t location, tree op1, tree op2, tree m2expr_BuildLogicalAnd (location_t location, tree op1, tree op2, - int needconvert) + bool needconvert) { m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, BIT_AND_EXPR, - m2convert_BuildConvert (location, m2type_GetWordType (), op1, FALSE), - m2convert_BuildConvert (location, m2type_GetWordType (), op2, FALSE), + m2convert_BuildConvert (location, m2type_GetWordType (), op1, false), + m2convert_BuildConvert (location, m2type_GetWordType (), op2, false), needconvert); } @@ -2982,13 +2982,13 @@ m2expr_BuildLogicalAnd (location_t location, tree op1, tree op2, tree m2expr_BuildSymmetricDifference (location_t location, tree op1, tree op2, - int needconvert) + bool needconvert) { m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, BIT_XOR_EXPR, - m2convert_BuildConvert (location, m2type_GetWordType (), op1, FALSE), - m2convert_BuildConvert (location, m2type_GetWordType (), op2, FALSE), + m2convert_BuildConvert (location, m2type_GetWordType (), op1, false), + m2convert_BuildConvert (location, m2type_GetWordType (), op2, false), needconvert); } @@ -2997,12 +2997,12 @@ return the tree. (op1 and (not op2)). */ tree m2expr_BuildLogicalDifference (location_t location, tree op1, tree op2, - int needconvert) + bool needconvert) { m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, BIT_AND_EXPR, - m2convert_BuildConvert (location, m2type_GetWordType (), op1, FALSE), + m2convert_BuildConvert (location, m2type_GetWordType (), op1, false), m2expr_BuildSetNegate (location, op2, needconvert), needconvert); } @@ -3030,9 +3030,9 @@ boolean_enum_to_unsigned (location_t location, tree t) tree type = TREE_TYPE (t); if (TREE_CODE (base_type (type)) == BOOLEAN_TYPE) - return m2convert_BuildConvert (location, unsigned_type_node, t, FALSE); + return m2convert_BuildConvert (location, unsigned_type_node, t, false); else if (TREE_CODE (base_type (type)) == ENUMERAL_TYPE) - return m2convert_BuildConvert (location, unsigned_type_node, t, FALSE); + return m2convert_BuildConvert (location, unsigned_type_node, t, false); else return t; } @@ -3049,7 +3049,7 @@ check_for_comparison (location_t location, tree op, tree badType, if (m2tree_skip_type_decl (TREE_TYPE (op)) == badType) /* Cannot compare array contents in m2expr_build_binary_op. */ return m2expr_BuildIndirect ( - location, m2expr_BuildAddr (location, op, FALSE), goodType); + location, m2expr_BuildAddr (location, op, false), goodType); return op; } @@ -3082,7 +3082,7 @@ m2expr_BuildLessThan (location_t location, tree op1, tree op2) m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, LT_EXPR, boolean_enum_to_unsigned (location, op1), - boolean_enum_to_unsigned (location, op2), TRUE); + boolean_enum_to_unsigned (location, op2), true); } /* BuildGreaterThan return a tree which computes >. */ @@ -3093,7 +3093,7 @@ m2expr_BuildGreaterThan (location_t location, tree op1, tree op2) m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, GT_EXPR, boolean_enum_to_unsigned (location, op1), - boolean_enum_to_unsigned (location, op2), TRUE); + boolean_enum_to_unsigned (location, op2), true); } /* BuildLessThanOrEqual return a tree which computes <. */ @@ -3104,7 +3104,7 @@ m2expr_BuildLessThanOrEqual (location_t location, tree op1, tree op2) m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, LE_EXPR, boolean_enum_to_unsigned (location, op1), - boolean_enum_to_unsigned (location, op2), TRUE); + boolean_enum_to_unsigned (location, op2), true); } /* BuildGreaterThanOrEqual return a tree which computes >=. */ @@ -3115,7 +3115,7 @@ m2expr_BuildGreaterThanOrEqual (location_t location, tree op1, tree op2) m2assert_AssertLocation (location); return m2expr_build_binary_op ( location, GE_EXPR, boolean_enum_to_unsigned (location, op1), - boolean_enum_to_unsigned (location, op2), TRUE); + boolean_enum_to_unsigned (location, op2), true); } /* BuildEqualTo return a tree which computes =. */ @@ -3126,7 +3126,7 @@ m2expr_BuildEqualTo (location_t location, tree op1, tree op2) m2assert_AssertLocation (location); return m2expr_build_binary_op (location, EQ_EXPR, convert_for_comparison (location, op1), - convert_for_comparison (location, op2), TRUE); + convert_for_comparison (location, op2), true); } /* BuildEqualNotTo return a tree which computes #. */ @@ -3137,7 +3137,7 @@ m2expr_BuildNotEqualTo (location_t location, tree op1, tree op2) m2assert_AssertLocation (location); return m2expr_build_binary_op (location, NE_EXPR, convert_for_comparison (location, op1), - convert_for_comparison (location, op2), TRUE); + convert_for_comparison (location, op2), true); } /* BuildIsSuperset return a tree which computes: op1 & op2 == op2. */ @@ -3147,7 +3147,7 @@ m2expr_BuildIsSuperset (location_t location, tree op1, tree op2) { m2assert_AssertLocation (location); return m2expr_BuildEqualTo ( - location, op2, m2expr_BuildLogicalAnd (location, op1, op2, FALSE)); + location, op2, m2expr_BuildLogicalAnd (location, op1, op2, false)); } /* BuildIsNotSuperset return a tree which computes: op1 & op2 != op2. */ @@ -3157,7 +3157,7 @@ m2expr_BuildIsNotSuperset (location_t location, tree op1, tree op2) { m2assert_AssertLocation (location); return m2expr_BuildNotEqualTo ( - location, op2, m2expr_BuildLogicalAnd (location, op1, op2, FALSE)); + location, op2, m2expr_BuildLogicalAnd (location, op1, op2, false)); } /* BuildIsSubset return a tree which computes: op1 & op2 == op1. */ @@ -3167,7 +3167,7 @@ m2expr_BuildIsSubset (location_t location, tree op1, tree op2) { m2assert_AssertLocation (location); return m2expr_BuildEqualTo ( - location, op1, m2expr_BuildLogicalAnd (location, op1, op2, FALSE)); + location, op1, m2expr_BuildLogicalAnd (location, op1, op2, false)); } /* BuildIsNotSubset return a tree which computes: op1 & op2 != op1. */ @@ -3177,7 +3177,7 @@ m2expr_BuildIsNotSubset (location_t location, tree op1, tree op2) { m2assert_AssertLocation (location); return m2expr_BuildNotEqualTo ( - location, op1, m2expr_BuildLogicalAnd (location, op1, op2, FALSE)); + location, op1, m2expr_BuildLogicalAnd (location, op1, op2, false)); } /* BuildIfConstInVar generates: if constel in varset then goto label. */ @@ -3262,9 +3262,9 @@ m2expr_BuildIfVarInVar (location_t location, tree type, tree varset, /* Calculate the index from the first bit, ie bit 0 represents low value. */ tree index = m2expr_BuildSub ( location, m2convert_BuildConvert (location, m2type_GetIntegerType (), - varel, FALSE), - m2convert_BuildConvert (location, m2type_GetIntegerType (), low, FALSE), - FALSE); + varel, false), + m2convert_BuildConvert (location, m2type_GetIntegerType (), low, false), + false); m2assert_AssertLocation (location); @@ -3282,14 +3282,14 @@ m2expr_BuildIfVarInVar (location_t location, tree type, tree varset, /* Which word do we need to fetch? */ tree word_index = m2expr_FoldAndStrip (m2expr_BuildDivTrunc ( location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), - FALSE)); + false)); /* Calculate the bit in this word. */ tree offset_into_word = m2expr_FoldAndStrip (m2expr_BuildModTrunc ( location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), - FALSE)); + false)); tree p2 = m2expr_FoldAndStrip (m2expr_BuildMult ( location, word_index, - m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), FALSE)); + m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), false)); /* Calculate the address of the word we are interested in. */ p1 = m2expr_BuildAddAddress (location, @@ -3314,10 +3314,10 @@ m2expr_BuildIfNotVarInVar (location_t location, tree type, tree varset, /* Calculate the index from the first bit, ie bit 0 represents low value. */ tree index = m2expr_BuildSub ( location, m2convert_BuildConvert (location, m2type_GetIntegerType (), - m2expr_FoldAndStrip (varel), FALSE), + m2expr_FoldAndStrip (varel), false), m2convert_BuildConvert (location, m2type_GetIntegerType (), - m2expr_FoldAndStrip (low), FALSE), - FALSE); + m2expr_FoldAndStrip (low), false), + false); index = m2expr_FoldAndStrip (index); m2assert_AssertLocation (location); @@ -3338,14 +3338,14 @@ m2expr_BuildIfNotVarInVar (location_t location, tree type, tree varset, /* Which word do we need to fetch? */ tree word_index = m2expr_FoldAndStrip (m2expr_BuildDivTrunc ( location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), - FALSE)); + false)); /* Calculate the bit in this word. */ tree offset_into_word = m2expr_FoldAndStrip (m2expr_BuildModTrunc ( location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), - FALSE)); + false)); tree p2 = m2expr_FoldAndStrip (m2expr_BuildMult ( location, word_index, - m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), FALSE)); + m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), false)); /* Calculate the address of the word we are interested in. */ p1 = m2expr_BuildAddAddress (location, p1, p2); @@ -3415,7 +3415,7 @@ m2expr_BuildIfInRangeGoto (location_t location, tree var, tree low, tree high, m2expr_build_binary_op ( location, TRUTH_ANDIF_EXPR, m2expr_BuildGreaterThanOrEqual (location, var, low), - m2expr_BuildLessThanOrEqual (location, var, high), FALSE), + m2expr_BuildLessThanOrEqual (location, var, high), false), NULL, label); } @@ -3436,7 +3436,7 @@ m2expr_BuildIfNotInRangeGoto (location_t location, tree var, tree low, location, m2expr_build_binary_op ( location, TRUTH_ORIF_EXPR, m2expr_BuildLessThan (location, var, low), - m2expr_BuildGreaterThan (location, var, high), FALSE), + m2expr_BuildGreaterThan (location, var, high), false), NULL, label); } @@ -3453,7 +3453,7 @@ m2expr_BuildArray (location_t location, tree type, tree array, tree index, // ASSERT_CONDITION (low_indice == TYPE_MIN_VALUE (index_type)); low_indice - = m2convert_BuildConvert (location, index_type, low_indice, FALSE); + = m2convert_BuildConvert (location, index_type, low_indice, false); return build4_loc (location, ARRAY_REF, type, array, index, low_indice, NULL_TREE); } @@ -3499,10 +3499,10 @@ m2expr_BuildIndirect (location_t location ATTRIBUTE_UNUSED, tree target, m2assert_AssertLocation (location); return build1 (INDIRECT_REF, t1, - m2convert_BuildConvert (location, t2, target, FALSE)); + m2convert_BuildConvert (location, t2, target, false)); } -/* IsTrue - returns TRUE if, t, is known to be TRUE. */ +/* IsTrue - returns true if, t, is known to be true. */ int m2expr_IsTrue (tree t) @@ -3510,7 +3510,7 @@ m2expr_IsTrue (tree t) return (m2expr_FoldAndStrip (t) == m2type_GetBooleanTrue ()); } -/* IsFalse - returns FALSE if, t, is known to be FALSE. */ +/* IsFalse - returns false if, t, is known to be false. */ int m2expr_IsFalse (tree t) @@ -3519,7 +3519,7 @@ m2expr_IsFalse (tree t) } /* AreConstantsEqual - maps onto tree.cc (tree_int_cst_equal). It - returns TRUE if the value of e1 is the same as e2. */ + returns true if the value of e1 is the same as e2. */ int m2expr_AreConstantsEqual (tree e1, tree e2) @@ -3527,7 +3527,7 @@ m2expr_AreConstantsEqual (tree e1, tree e2) return tree_int_cst_equal (e1, e2) != 0; } -/* AreRealOrComplexConstantsEqual - returns TRUE if constants, e1 and +/* AreRealOrComplexConstantsEqual - returns true if constants, e1 and e2 are equal according to IEEE rules. This does not perform bit equivalence for example IEEE states that -0 == 0 and NaN != NaN. */ @@ -3621,7 +3621,7 @@ m2expr_BuildCap (location_t location, tree t) tree m2expr_BuildDivM2 (location_t location, tree op1, tree op2, - unsigned int needsconvert) + bool needsconvert) { op1 = m2expr_FoldAndStrip (op1); op2 = m2expr_FoldAndStrip (op2); @@ -3633,7 +3633,7 @@ m2expr_BuildDivM2 (location_t location, tree op1, tree op2, m2expr_BuildLessThan ( location, op2, m2convert_BuildConvert (location, TREE_TYPE (op2), - m2expr_GetIntegerZero (location), FALSE)), + m2expr_GetIntegerZero (location), false)), m2expr_BuildDivCeil (location, op1, op2, needsconvert), m2expr_BuildDivFloor (location, op1, op2, needsconvert)); else @@ -3659,7 +3659,7 @@ m2expr_BuildDivM2Check (location_t location, tree op1, tree op2, m2expr_BuildLessThan ( location, op2, m2convert_BuildConvert (location, TREE_TYPE (op2), - m2expr_GetIntegerZero (location), FALSE)), + m2expr_GetIntegerZero (location), false)), m2expr_BuildDivCeilCheck (location, op1, op2, lowest, min, max), m2expr_BuildDivFloorCheck (location, op1, op2, lowest, min, max)); else @@ -3673,7 +3673,7 @@ m2expr_BuildISOModM2Check (location_t location, { tree cond = m2expr_BuildLessThan (location, op2, m2convert_BuildConvert (location, TREE_TYPE (op2), - m2expr_GetIntegerZero (location), FALSE)); + m2expr_GetIntegerZero (location), false)); /* Return the result of the modulus. */ return fold_build3 (COND_EXPR, TREE_TYPE (op1), cond, @@ -3707,7 +3707,7 @@ m2expr_BuildModM2Check (location_t location, tree op1, tree op2, tree m2expr_BuildModM2 (location_t location, tree op1, tree op2, - unsigned int needsconvert) + bool needsconvert) { op1 = m2expr_FoldAndStrip (op1); op2 = m2expr_FoldAndStrip (op2); @@ -3719,7 +3719,7 @@ m2expr_BuildModM2 (location_t location, tree op1, tree op2, m2expr_BuildLessThan ( location, op2, m2convert_BuildConvert (location, TREE_TYPE (op2), - m2expr_GetIntegerZero (location), FALSE)), + m2expr_GetIntegerZero (location), false)), m2expr_BuildModCeil (location, op1, op2, needsconvert), m2expr_BuildModFloor (location, op1, op2, needsconvert)); else @@ -3773,9 +3773,9 @@ m2expr_BuildCmplx (location_t location, tree type, tree real, tree imag) scalor = TREE_TYPE (type); if (scalor != TREE_TYPE (real)) - real = m2convert_BuildConvert (location, scalor, real, FALSE); + real = m2convert_BuildConvert (location, scalor, real, false); if (scalor != TREE_TYPE (imag)) - imag = m2convert_BuildConvert (location, scalor, imag, FALSE); + imag = m2convert_BuildConvert (location, scalor, imag, false); if ((TREE_CODE (real) == REAL_CST) && (TREE_CODE (imag) == REAL_CST)) return build_complex (type, real, imag); @@ -3790,10 +3790,10 @@ m2expr_BuildCmplx (location_t location, tree type, tree real, tree imag) void m2expr_BuildBinaryForeachWordDo (location_t location, tree type, tree op1, tree op2, tree op3, - tree (*binop) (location_t, tree, tree, int), - int is_op1lvalue, int is_op2lvalue, - int is_op3lvalue, int is_op1const, - int is_op2const, int is_op3const) + tree (*binop) (location_t, tree, tree, bool), + bool is_op1lvalue, bool is_op2lvalue, + bool is_op3lvalue, bool is_op1const, + bool is_op2const, bool is_op3const) { tree size = m2expr_GetSizeOf (location, type); @@ -3813,7 +3813,7 @@ m2expr_BuildBinaryForeachWordDo (location_t location, tree type, tree op1, location, m2treelib_get_rvalue (location, op1, type, is_op1lvalue), (*binop) ( location, m2treelib_get_rvalue (location, op2, type, is_op2lvalue), - m2treelib_get_rvalue (location, op3, type, is_op3lvalue), FALSE)); + m2treelib_get_rvalue (location, op3, type, is_op3lvalue), false)); else { /* Large set size > TSIZE(WORD). */ @@ -3842,7 +3842,7 @@ m2expr_BuildBinaryForeachWordDo (location_t location, tree type, tree op1, is_op2lvalue, op2, fieldNo), m2treelib_get_set_value (location, p3, field3, is_op3const, is_op3lvalue, op3, fieldNo), - FALSE)); + false)); fieldNo++; field1 = m2treelib_get_field_no (type, op1, is_op1const, fieldNo); field2 = m2treelib_get_field_no (type, op2, is_op2const, fieldNo); @@ -3887,9 +3887,9 @@ append_digit (unsigned HOST_WIDE_INT *low, HOST_WIDE_INT *high, /* Multiply by 2, 8 or 16. Catching this overflow here means we don't need to worry about add_high overflowing. */ if (((*high) >> (INT_TYPE_SIZE - shift)) == 0) - overflow = FALSE; + overflow = false; else - overflow = TRUE; + overflow = true; res_high = *high << shift; res_low = *low << shift; @@ -3913,7 +3913,7 @@ append_digit (unsigned HOST_WIDE_INT *low, HOST_WIDE_INT *high, add_high++; test_high = res_high + add_high; if (test_high < res_high) - overflow = TRUE; + overflow = true; *low = res_low + add_low; *high = res_high + add_high; @@ -3929,7 +3929,7 @@ m2expr_interpret_integer (const char *str, unsigned int base, unsigned HOST_WIDE_INT *low, HOST_WIDE_INT *high) { unsigned const char *p, *end; - int overflow = FALSE; + int overflow = false; int len; *low = 0; @@ -3978,10 +3978,10 @@ m2expr_interpret_integer (const char *str, unsigned int base, static int append_m2_digit (unsigned int *low, int *high, unsigned int digit, - unsigned int base, int *needsUnsigned) + unsigned int base, bool *needsUnsigned) { unsigned int shift; - int overflow; + bool overflow; int add_high, res_high, test_high; unsigned int add_low, res_low, test_low; unsigned int add_uhigh, res_uhigh, test_uhigh; @@ -4010,9 +4010,9 @@ append_m2_digit (unsigned int *low, int *high, unsigned int digit, /* Multiply by 2, 8 or 16. Catching this overflow here means we don't need to worry about add_high overflowing. */ if (((*high) >> (INT_TYPE_SIZE - shift)) == 0) - overflow = FALSE; + overflow = false; else - overflow = TRUE; + overflow = true; res_high = *high << shift; res_low = *low << shift; @@ -4041,9 +4041,9 @@ append_m2_digit (unsigned int *low, int *high, unsigned int digit, add_uhigh = add_high; test_uhigh = res_uhigh + add_uhigh; if (test_uhigh < res_uhigh) - overflow = TRUE; + overflow = true; else - *needsUnsigned = TRUE; + *needsUnsigned = true; } *low = res_low + add_low; @@ -4062,12 +4062,12 @@ append_m2_digit (unsigned int *low, int *high, unsigned int digit, int m2expr_interpret_m2_integer (const char *str, unsigned int base, unsigned int *low, int *high, - int *needsLong, int *needsUnsigned) + bool *needsLong, bool *needsUnsigned) { const unsigned char *p, *end; int len; - *needsLong = FALSE; - *needsUnsigned = FALSE; + *needsLong = false; + *needsUnsigned = false; *low = 0; *high = 0; @@ -4095,22 +4095,22 @@ m2expr_interpret_m2_integer (const char *str, unsigned int base, if (ISDIGIT (c) || (base == 16 && ISXDIGIT (c))) c = hex_value (c); else - return FALSE; /* End of string and no overflow found. */ + return false; /* End of string and no overflow found. */ /* Strict inequality for when max is set to zero. */ if (*low < max) *low = (*low) * base + c; else { - *needsLong = TRUE; + *needsLong = true; if (append_m2_digit (low, high, c, base, needsUnsigned)) - return TRUE; /* We have overflowed so bail out. */ + return true; /* We have overflowed so bail out. */ max = 0; /* From now on we always use append_digit. */ } } } - return FALSE; + return false; } /* GetSizeOfInBits return the number of bits used to contain, type. */ @@ -4266,9 +4266,9 @@ build_set_full_complement (location_t location) m2expr_BuildLSL ( location, m2expr_GetWordOne (location), m2convert_BuildConvert (location, m2type_GetWordType (), - m2decl_BuildIntegerConstant (i), FALSE), - FALSE), - FALSE); + m2decl_BuildIntegerConstant (i), false), + false), + false); } return value; } diff --git a/gcc/m2/gm2-gcc/m2expr.h b/gcc/m2/gm2-gcc/m2expr.h index 405472a..b65ec88 100644 --- a/gcc/m2/gm2-gcc/m2expr.h +++ b/gcc/m2/gm2-gcc/m2expr.h @@ -37,9 +37,9 @@ along with GNU Modula-2; see the file COPYING3. If not see EXTERN void m2expr_BuildBinaryForeachWordDo ( location_t location, tree type, tree op1, tree op2, tree op3, - tree (*binop) (location_t, tree, tree, int), int is_op1lvalue, - int is_op2lvalue, int is_op3lvalue, int is_op1const, int is_op2const, - int is_op3const); + tree (*binop) (location_t, tree, tree, bool), bool is_op1lvalue, + bool is_op2lvalue, bool is_op3lvalue, bool is_op1const, bool is_op2const, + bool is_op3const); EXTERN tree m2expr_BuildCmplx (location_t location, tree type, tree real, tree imag); EXTERN tree m2expr_BuildIm (tree op1); @@ -93,27 +93,27 @@ EXTERN tree m2expr_BuildLessThanOrEqual (location_t location, tree op1, EXTERN tree m2expr_BuildGreaterThan (location_t location, tree op1, tree op2); EXTERN tree m2expr_BuildLessThan (location_t location, tree op1, tree op2); EXTERN tree m2expr_BuildLogicalDifference (location_t location, tree op1, - tree op2, int needconvert); + tree op2, bool needconvert); EXTERN tree m2expr_BuildSymmetricDifference (location_t location, tree op1, - tree op2, int needconvert); + tree op2, bool needconvert); EXTERN tree m2expr_BuildLogicalAnd (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLogicalOr (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLogicalOrAddress (location_t location, tree op1, - tree op2, int needconvert); + tree op2, bool needconvert); EXTERN tree m2expr_BuildOffset (location_t location, tree record, tree field, - int needconvert ATTRIBUTE_UNUSED); + bool needconvert ATTRIBUTE_UNUSED); EXTERN tree m2expr_BuildOffset1 (location_t location, tree field, - int needconvert ATTRIBUTE_UNUSED); -EXTERN tree m2expr_BuildAddr (location_t location, tree op1, int needconvert); + bool needconvert ATTRIBUTE_UNUSED); +EXTERN tree m2expr_BuildAddr (location_t location, tree op1, bool needconvert); EXTERN tree m2expr_BuildSize (location_t location, tree op1, - int needconvert ATTRIBUTE_UNUSED); + bool needconvert ATTRIBUTE_UNUSED); EXTERN tree m2expr_BuildTBitSize (location_t location, tree type); EXTERN tree m2expr_BuildSetNegate (location_t location, tree op1, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildNegate (location_t location, tree op1, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildNegateCheck (location_t location, tree arg, tree lowest, tree min, tree max); EXTERN tree m2expr_BuildTrunc (tree op1); @@ -129,7 +129,7 @@ EXTERN int m2expr_interpret_integer (const char *str, unsigned int base, HOST_WIDE_INT *high); EXTERN int m2expr_interpret_m2_integer (const char *str, unsigned int base, unsigned int *low, int *high, - int *needsLong, int *needsUnsigned); + bool *needsLong, bool *needsUnsigned); EXTERN tree m2expr_BuildAddCheck (location_t location, tree op1, tree op2, tree lowest, tree min, tree max); @@ -139,30 +139,30 @@ EXTERN tree m2expr_BuildMultCheck (location_t location, tree op1, tree op2, tree lowest, tree min, tree max); EXTERN tree m2expr_BuildAdd (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildSub (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildDivTrunc (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildDivTruncCheck (location_t location, tree op1, tree op2, tree lowest, tree min, tree max); EXTERN tree m2expr_BuildModTrunc (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildDivCeil (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildModCeil (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildDivFloor (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildModFloor (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildDivM2 (location_t location, tree op1, tree op2, - unsigned int needsconvert); + bool needsconvert); EXTERN tree m2expr_BuildModM2 (location_t location, tree op1, tree op2, - unsigned int needsconvert); + bool needsconvert); EXTERN tree m2expr_BuildDivM2Check (location_t location, tree op1, tree op2, tree lowest, tree min, tree max); @@ -170,40 +170,40 @@ EXTERN tree m2expr_BuildModM2Check (location_t location, tree op1, tree op2, tree lowest, tree min, tree max); EXTERN tree m2expr_BuildLSL (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLSR (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN void m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, tree op3, tree nBits ATTRIBUTE_UNUSED, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLRL (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLRR (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildMult (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildRRotate (location_t location, tree op1, tree nBits, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLRotate (location_t location, tree op1, tree nBits, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildMask (location_t location, tree nBits, - int needconvert); + bool needconvert); EXTERN tree m2expr_BuildLRLn (location_t location, tree op1, tree op2, - tree nBits, int needconvert); + tree nBits, bool needconvert); EXTERN tree m2expr_BuildLRRn (location_t location, tree op1, tree op2, - tree nBits, int needconvert); + tree nBits, bool needconvert); EXTERN void m2expr_BuildLogicalRotate (location_t location, tree op1, tree op2, - tree op3, tree nBits, int needconvert); + tree op3, tree nBits, bool needconvert); EXTERN void m2expr_BuildBinarySetDo ( location_t location, tree settype, tree op1, tree op2, tree op3, - void (*binop) (location_t, tree, tree, tree, tree, int), int is_op1lvalue, - int is_op2lvalue, int is_op3lvalue, tree nBits, tree unbounded, + void (*binop) (location_t, tree, tree, tree, tree, bool), bool is_op1lvalue, + bool is_op2lvalue, bool is_op3lvalue, tree nBits, tree unbounded, tree varproc, tree leftproc, tree rightproc); EXTERN tree m2expr_GetSizeOf (location_t location, tree type); @@ -231,12 +231,12 @@ EXTERN tree m2expr_build_binary_op (location_t location, enum tree_code code, tree op1, tree op2, int convert); EXTERN tree m2expr_build_binary_op_check (location_t location, enum tree_code code, tree op1, - tree op2, int needconvert, + tree op2, bool needconvert, tree lowest, tree min, tree max); EXTERN void m2expr_ConstantExpressionWarning (tree value); EXTERN tree m2expr_BuildAddAddress (location_t location, tree op1, tree op2); EXTERN tree m2expr_BuildRDiv (location_t location, tree op1, tree op2, - int needconvert); + bool needconvert); EXTERN void m2expr_init (location_t location); diff --git a/gcc/m2/gm2-gcc/m2statement.cc b/gcc/m2/gm2-gcc/m2statement.cc index c3307db..fa799c8 100644 --- a/gcc/m2/gm2-gcc/m2statement.cc +++ b/gcc/m2/gm2-gcc/m2statement.cc @@ -46,7 +46,7 @@ static GTY (()) tree last_function = NULL_TREE; void m2statement_BuildStartFunctionCode (location_t location, tree fndecl, - int isexported, int isinline) + bool isexported, bool isinline) { tree param_decl; @@ -87,7 +87,7 @@ m2statement_BuildStartFunctionCode (location_t location, tree fndecl, /* BuildEndFunctionCode - generates the function epilogue. */ void -m2statement_BuildEndFunctionCode (location_t location, tree fndecl, int nested) +m2statement_BuildEndFunctionCode (location_t location, tree fndecl, bool nested) { tree block = DECL_INITIAL (fndecl); @@ -162,7 +162,7 @@ m2statement_BuildAssignmentTree (location_t location, tree des, tree expr) if (TREE_CODE (expr) == FUNCTION_DECL) result = build2 (MODIFY_EXPR, TREE_TYPE (des), des, - m2expr_BuildAddr (location, expr, FALSE)); + m2expr_BuildAddr (location, expr, false)); else { gcc_assert (TREE_CODE (TREE_TYPE (des)) != TYPE_DECL); @@ -171,7 +171,7 @@ m2statement_BuildAssignmentTree (location_t location, tree des, tree expr) else result = build2 ( MODIFY_EXPR, TREE_TYPE (des), des, - m2convert_BuildConvert (location, TREE_TYPE (des), expr, FALSE)); + m2convert_BuildConvert (location, TREE_TYPE (des), expr, false)); } TREE_SIDE_EFFECTS (result) = 1; @@ -219,7 +219,7 @@ m2statement_BuildParam (location_t location, tree param) m2assert_AssertLocation (location); if (TREE_CODE (param) == FUNCTION_DECL) - param = m2expr_BuildAddr (location, param, FALSE); + param = m2expr_BuildAddr (location, param, false); param_list = chainon (build_tree_list (NULL_TREE, param), param_list); } @@ -258,7 +258,7 @@ m2statement_BuildProcedureCallTree (location_t location, tree procedure, ASSERT_CONDITION ( last_function == NULL_TREE); /* Previous function value has not been collected. */ - TREE_USED (procedure) = TRUE; + TREE_USED (procedure) = true; for (i = 0; i < n; i++) { @@ -270,8 +270,8 @@ m2statement_BuildProcedureCallTree (location_t location, tree procedure, { rettype = void_type_node; call = build_call_array_loc (location, rettype, funcptr, n, argarray); - TREE_USED (call) = TRUE; - TREE_SIDE_EFFECTS (call) = TRUE; + TREE_USED (call) = true; + TREE_SIDE_EFFECTS (call) = true; #if defined(DEBUG_PROCEDURE_CALLS) fprintf (stderr, "built the modula-2 call, here is the tree\n"); @@ -288,8 +288,8 @@ m2statement_BuildProcedureCallTree (location_t location, tree procedure, { last_function = build_call_array_loc ( location, m2tree_skip_type_decl (rettype), funcptr, n, argarray); - TREE_USED (last_function) = TRUE; - TREE_SIDE_EFFECTS (last_function) = TRUE; + TREE_USED (last_function) = true; + TREE_SIDE_EFFECTS (last_function) = true; param_list = NULL_TREE; /* Ready for the next time we call a procedure. */ return last_function; @@ -310,8 +310,8 @@ m2statement_BuildIndirectProcedureCallTree (location_t location, int i; m2assert_AssertLocation (location); - TREE_USED (procedure) = TRUE; - TREE_SIDE_EFFECTS (procedure) = TRUE; + TREE_USED (procedure) = true; + TREE_SIDE_EFFECTS (procedure) = true; for (i = 0; i < n; i++) { @@ -323,8 +323,8 @@ m2statement_BuildIndirectProcedureCallTree (location_t location, { rettype = void_type_node; call = build_call_array_loc (location, rettype, procedure, n, argarray); - TREE_USED (call) = TRUE; - TREE_SIDE_EFFECTS (call) = TRUE; + TREE_USED (call) = true; + TREE_SIDE_EFFECTS (call) = true; #if defined(DEBUG_PROCEDURE_CALLS) fprintf (stderr, "built the modula-2 call, here is the tree\n"); @@ -341,8 +341,8 @@ m2statement_BuildIndirectProcedureCallTree (location_t location, { last_function = build_call_array_loc ( location, m2tree_skip_type_decl (rettype), procedure, n, argarray); - TREE_USED (last_function) = TRUE; - TREE_SIDE_EFFECTS (last_function) = TRUE; + TREE_USED (last_function) = true; + TREE_SIDE_EFFECTS (last_function) = true; param_list = NULL_TREE; /* Ready for the next time we call a procedure. */ return last_function; @@ -363,8 +363,8 @@ m2statement_BuildFunctValue (location_t location, tree value) last_function != NULL_TREE); /* No value available, possible used before. */ - TREE_SIDE_EFFECTS (assign) = TRUE; - TREE_USED (assign) = TRUE; + TREE_SIDE_EFFECTS (assign) = true; + TREE_USED (assign) = true; last_function = NULL_TREE; return assign; } @@ -483,8 +483,8 @@ m2statement_BuildCleanUp (tree param) /* BuildAsm - generates an inline assembler instruction. */ void -m2statement_BuildAsm (location_t location, tree instr, int isVolatile, - int isSimple, tree inputs, tree outputs, tree trash, +m2statement_BuildAsm (location_t location, tree instr, bool isVolatile, + bool isSimple, tree inputs, tree outputs, tree trash, tree labels) { tree string = resolve_asm_operand_names (instr, outputs, inputs, labels); @@ -508,9 +508,9 @@ m2statement_BuildAsm (location_t location, tree instr, int isVolatile, void m2statement_BuildUnaryForeachWordDo (location_t location, tree type, tree op1, tree op2, - tree (*unop) (location_t, tree, int), - int is_op1lvalue, int is_op2lvalue, - int is_op1const, int is_op2const) + tree (*unop) (location_t, tree, bool), + bool is_op1lvalue, bool is_op2lvalue, + bool is_op1const, bool is_op2const) { tree size = m2expr_GetSizeOf (location, type); @@ -527,7 +527,7 @@ m2statement_BuildUnaryForeachWordDo (location_t location, tree type, tree op1, location, m2treelib_get_rvalue (location, op1, type, is_op1lvalue), (*unop) (location, m2treelib_get_rvalue (location, op2, type, is_op2lvalue), - FALSE)); + false)); else { /* Large set size > TSIZE(WORD). */ @@ -544,7 +544,7 @@ m2statement_BuildUnaryForeachWordDo (location_t location, tree type, tree op1, location, m2treelib_get_set_field_des (location, op1, field1), (*unop) (location, m2treelib_get_set_field_rhs (location, op2, field2), - FALSE)); + false)); fieldNo++; field1 = m2treelib_get_field_no (type, op1, is_op1const, fieldNo); field2 = m2treelib_get_field_no (type, op2, is_op2const, fieldNo); @@ -558,7 +558,7 @@ m2statement_BuildUnaryForeachWordDo (location_t location, tree type, tree op1, void m2statement_BuildExcludeVarConst (location_t location, tree type, tree op1, - tree op2, int is_lvalue, int fieldno) + tree op2, bool is_lvalue, int fieldno) { tree size = m2expr_GetSizeOf (location, type); @@ -576,9 +576,9 @@ m2statement_BuildExcludeVarConst (location_t location, tree type, tree op1, m2expr_BuildSetNegate ( location, m2expr_BuildLSL (location, m2expr_GetWordOne (location), op2, - FALSE), - FALSE), - FALSE)); + false), + false), + false)); } else { @@ -596,9 +596,9 @@ m2statement_BuildExcludeVarConst (location_t location, tree type, tree op1, m2expr_BuildSetNegate ( location, m2expr_BuildLSL (location, m2expr_GetWordOne (location), op2, - FALSE), - FALSE), - FALSE)); + false), + false), + false)); } } @@ -607,7 +607,7 @@ m2statement_BuildExcludeVarConst (location_t location, tree type, tree op1, void m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, - tree varel, int is_lvalue, tree low) + tree varel, bool is_lvalue, tree low) { tree size = m2expr_GetSizeOf (location, type); @@ -616,7 +616,7 @@ m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, /* Calculate the index from the first bit, ie bit 0 represents low value. */ tree index = m2expr_BuildSub (location, m2convert_ToInteger (location, varel), - m2convert_ToInteger (location, low), FALSE); + m2convert_ToInteger (location, low), false); if (m2expr_CompareTrees ( size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT)) @@ -629,9 +629,9 @@ m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, m2expr_BuildSetNegate ( location, m2expr_BuildLSL (location, m2expr_GetWordOne (location), - m2convert_ToWord (location, index), FALSE), - FALSE), - FALSE)); + m2convert_ToWord (location, index), false), + false), + false)); else { tree p1 = m2treelib_get_set_address (location, varset, is_lvalue); @@ -639,10 +639,10 @@ m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, /* Which word do we need to fetch? */ tree word_index = m2expr_BuildDivTrunc ( - location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), FALSE); + location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), false); /* Calculate the bit in this word. */ tree offset_into_word = m2expr_BuildModTrunc ( - location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), FALSE); + location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), false); tree v1; @@ -652,7 +652,7 @@ m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, m2expr_BuildMult ( location, word_index, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), - FALSE)); + false)); v1 = m2expr_BuildLogicalAnd ( location, @@ -661,9 +661,9 @@ m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, location, m2expr_BuildLSL (location, m2expr_GetWordOne (location), m2convert_ToWord (location, offset_into_word), - FALSE), - FALSE), - FALSE); + false), + false), + false); /* Set bit offset_into_word within the word pointer at by p1. */ m2statement_BuildAssignmentTree ( @@ -679,7 +679,7 @@ m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, void m2statement_BuildIncludeVarConst (location_t location, tree type, tree op1, - tree op2, int is_lvalue, int fieldno) + tree op2, bool is_lvalue, int fieldno) { tree size = m2expr_GetSizeOf (location, type); @@ -695,8 +695,8 @@ m2statement_BuildIncludeVarConst (location_t location, tree type, tree op1, m2expr_BuildLogicalOr ( location, m2treelib_get_rvalue (location, op1, type, is_lvalue), m2expr_BuildLSL (location, m2expr_GetWordOne (location), - m2convert_ToWord (location, op2), FALSE), - FALSE)); + m2convert_ToWord (location, op2), false), + false)); } else { @@ -717,8 +717,8 @@ m2statement_BuildIncludeVarConst (location_t location, tree type, tree op1, m2expr_BuildLogicalOr ( location, m2treelib_get_set_field_rhs (location, op1, field), m2expr_BuildLSL (location, m2expr_GetWordOne (location), - m2convert_ToWord (location, op2), FALSE), - FALSE)); + m2convert_ToWord (location, op2), false), + false)); } } @@ -727,7 +727,7 @@ m2statement_BuildIncludeVarConst (location_t location, tree type, tree op1, void m2statement_BuildIncludeVarVar (location_t location, tree type, tree varset, - tree varel, int is_lvalue, tree low) + tree varel, bool is_lvalue, tree low) { tree size = m2expr_GetSizeOf (location, type); @@ -736,7 +736,7 @@ m2statement_BuildIncludeVarVar (location_t location, tree type, tree varset, /* Calculate the index from the first bit, ie bit 0 represents low value. */ tree index = m2expr_BuildSub (location, m2convert_ToInteger (location, varel), - m2convert_ToInteger (location, low), FALSE); + m2convert_ToInteger (location, low), false); tree indexw = m2convert_ToWord (location, index); if (m2expr_CompareTrees ( @@ -751,21 +751,21 @@ m2statement_BuildIncludeVarVar (location_t location, tree type, tree varset, location, m2treelib_get_rvalue (location, varset, type, is_lvalue), m2expr_BuildLSL (location, m2expr_GetWordOne (location), - indexw, FALSE), - FALSE))); + indexw, false), + false))); else { tree p1 = m2treelib_get_set_address (location, varset, is_lvalue); /* Which word do we need to fetch? */ tree word_index = m2expr_BuildDivTrunc ( - location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), FALSE); + location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), false); /* Calculate the bit in this word. */ tree offset_into_word = m2convert_BuildConvert ( location, m2type_GetWordType (), m2expr_BuildModTrunc (location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE), - FALSE), - FALSE); + false), + false); tree v1; /* Calculate the address of the word we are interested in. */ @@ -774,15 +774,15 @@ m2statement_BuildIncludeVarVar (location_t location, tree type, tree varset, m2expr_BuildMult ( location, word_index, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), - FALSE)); + false)); v1 = m2expr_BuildLogicalOr ( location, m2expr_BuildIndirect (location, p1, m2type_GetBitsetType ()), m2convert_ToBitset (location, m2expr_BuildLSL (location, m2expr_GetWordOne (location), - offset_into_word, FALSE)), - FALSE); + offset_into_word, false)), + false); /* Set bit offset_into_word within the word pointer at by p1. */ m2statement_BuildAssignmentTree ( @@ -798,7 +798,7 @@ m2statement_BuildIncludeVarVar (location_t location, tree type, tree varset, the initialization sequence for all modules. */ tree -m2statement_BuildStart (location_t location, char *name, int inner_module) +m2statement_BuildStart (location_t location, char *name, bool inner_module) { tree fntype; tree fndecl; @@ -831,7 +831,7 @@ m2statement_BuildStart (location_t location, char *name, int inner_module) /* BuildEnd - complete the initialization function for this module. */ void -m2statement_BuildEnd (location_t location, tree fndecl, int nested) +m2statement_BuildEnd (location_t location, tree fndecl, bool nested) { m2statement_BuildEndFunctionCode (location, fndecl, nested); current_function_decl = NULL; @@ -892,14 +892,14 @@ m2statement_BuildReturnValueCode (location_t location, tree fndecl, tree value) MODIFY_EXPR, TREE_TYPE (DECL_RESULT (fndecl)), DECL_RESULT (fndecl), m2convert_BuildConvert ( location, m2tree_skip_type_decl (TREE_TYPE (DECL_RESULT (fndecl))), - value, FALSE)); + value, false)); ret_stmt = build_stmt (location, RETURN_EXPR, t); add_stmt (location, ret_stmt); } /* DoJump - jump to the appropriate label depending whether result of - the expression is TRUE or FALSE. */ + the expression is true or false. */ void m2statement_DoJump (location_t location, tree exp, char *falselabel, diff --git a/gcc/m2/gm2-gcc/m2statement.h b/gcc/m2/gm2-gcc/m2statement.h index 37b2785..1ca70f8 100644 --- a/gcc/m2/gm2-gcc/m2statement.h +++ b/gcc/m2/gm2-gcc/m2statement.h @@ -42,22 +42,22 @@ EXTERN tree m2statement_BuildStart (location_t location, char *name, int inner_module); EXTERN void m2statement_BuildIncludeVarVar (location_t location, tree type, tree varset, tree varel, - int is_lvalue, tree low); + bool is_lvalue, tree low); EXTERN void m2statement_BuildIncludeVarConst (location_t location, tree type, tree op1, tree op2, - int is_lvalue, int fieldno); + bool is_lvalue, int fieldno); EXTERN void m2statement_BuildExcludeVarVar (location_t location, tree type, tree varset, tree varel, - int is_lvalue, tree low); + bool is_lvalue, tree low); EXTERN void m2statement_BuildExcludeVarConst (location_t location, tree type, tree op1, tree op2, - int is_lvalue, int fieldno); + bool is_lvalue, int fieldno); EXTERN void m2statement_BuildUnaryForeachWordDo ( location_t location, tree type, tree op1, tree op2, - tree (*unop) (location_t, tree, int), int is_op1lvalue, int is_op2lvalue, - int is_op1const, int is_op2const); + tree (*unop) (location_t, tree, bool), bool is_op1lvalue, bool is_op2lvalue, + bool is_op1const, bool is_op2const); EXTERN void m2statement_BuildAsm (location_t location, tree instr, - int isVolatile, int isSimple, tree inputs, + bool isVolatile, bool isSimple, tree inputs, tree outputs, tree trash, tree labels); EXTERN tree m2statement_BuildFunctValue (location_t location, tree value); EXTERN tree m2statement_BuildIndirectProcedureCallTree (location_t location, @@ -84,10 +84,10 @@ EXTERN void m2statement_BuildPushFunctionContext (void); EXTERN void m2statement_BuildReturnValueCode (location_t location, tree fndecl, tree value); EXTERN void m2statement_BuildEndFunctionCode (location_t location, tree fndecl, - int nested); + bool nested); EXTERN void m2statement_BuildStartFunctionCode (location_t location, - tree fndecl, int isexported, - int isinline); + tree fndecl, bool isexported, + bool isinline); EXTERN void m2statement_DoJump (location_t location, tree exp, char *falselabel, char *truelabel); EXTERN tree m2statement_BuildCall2 (location_t location, tree function, diff --git a/gcc/m2/gm2-gcc/m2top.cc b/gcc/m2/gm2-gcc/m2top.cc index d1d9b89..df8e0c0 100644 --- a/gcc/m2/gm2-gcc/m2top.cc +++ b/gcc/m2/gm2-gcc/m2top.cc @@ -59,7 +59,7 @@ m2top_FinishBackend (void) /* SetFlagUnitAtATime - sets GCC flag_unit_at_a_time to b. */ void -m2top_SetFlagUnitAtATime (int b) +m2top_SetFlagUnitAtATime (bool b) { flag_unit_at_a_time = b; } diff --git a/gcc/m2/gm2-gcc/m2top.h b/gcc/m2/gm2-gcc/m2top.h index 5f474c9..3d57775 100644 --- a/gcc/m2/gm2-gcc/m2top.h +++ b/gcc/m2/gm2-gcc/m2top.h @@ -38,7 +38,7 @@ along with GNU Modula-2; see the file COPYING3. If not see EXTERN void m2top_StartGlobalContext (void); EXTERN void m2top_EndGlobalContext (void); -EXTERN void m2top_SetFlagUnitAtATime (int b); +EXTERN void m2top_SetFlagUnitAtATime (bool b); #undef EXTERN #endif /* m2top_h. */ diff --git a/gcc/m2/gm2-gcc/m2tree.cc b/gcc/m2/gm2-gcc/m2tree.cc index c8e126c..33dc57d 100644 --- a/gcc/m2/gm2-gcc/m2tree.cc +++ b/gcc/m2/gm2-gcc/m2tree.cc @@ -26,19 +26,19 @@ along with GNU Modula-2; see the file COPYING3. If not see #define m2tree_c #include "m2tree.h" -int +bool m2tree_is_var (tree var) { return TREE_CODE (var) == VAR_DECL; } -int +bool m2tree_is_array (tree array) { return TREE_CODE (array) == ARRAY_TYPE; } -int +bool m2tree_is_type (tree type) { switch (TREE_CODE (type)) @@ -105,7 +105,7 @@ m2tree_skip_reference_type (tree exp) /* m2tree_IsOrdinal - return TRUE if code is an INTEGER, BOOLEAN or ENUMERAL type. */ -int +bool m2tree_IsOrdinal (tree type) { enum tree_code code = TREE_CODE (type); @@ -116,7 +116,7 @@ m2tree_IsOrdinal (tree type) /* is_a_constant - returns TRUE if tree, t, is a constant. */ -int +bool m2tree_IsAConstant (tree t) { return (TREE_CODE (t) == INTEGER_CST) || (TREE_CODE (t) == REAL_CST) diff --git a/gcc/m2/gm2-gcc/m2tree.h b/gcc/m2/gm2-gcc/m2tree.h index da7a957..43eeebb 100644 --- a/gcc/m2/gm2-gcc/m2tree.h +++ b/gcc/m2/gm2-gcc/m2tree.h @@ -36,15 +36,16 @@ along with GNU Modula-2; see the file COPYING3. If not see #endif /* m2tree_c. */ #include "input.h" +#include <stdbool.h> -EXTERN int m2tree_is_var (tree var); -EXTERN int m2tree_is_array (tree array); -EXTERN int m2tree_is_type (tree type); +EXTERN bool m2tree_is_var (tree var); +EXTERN bool m2tree_is_array (tree array); +EXTERN bool m2tree_is_type (tree type); EXTERN tree m2tree_skip_type_decl (tree type); EXTERN tree m2tree_skip_const_decl (tree exp); -EXTERN int m2tree_IsTreeOverflow (tree value); -EXTERN int m2tree_IsOrdinal (tree type); -EXTERN int m2tree_IsAConstant (tree t); +EXTERN bool m2tree_IsTreeOverflow (tree value); +EXTERN bool m2tree_IsOrdinal (tree type); +EXTERN bool m2tree_IsAConstant (tree t); EXTERN void m2tree_debug_tree (tree t); EXTERN tree m2tree_skip_reference_type (tree exp); diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc index 634fad8..6ee68a9 100644 --- a/gcc/m2/gm2-gcc/m2type.cc +++ b/gcc/m2/gm2-gcc/m2type.cc @@ -38,8 +38,8 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "m2type.h" #include "m2options.h" -#undef USE_BOOLEAN -static int broken_set_debugging_info = TRUE; +#define USE_BOOLEAN +static int broken_set_debugging_info = true; struct GTY (()) struct_constructor @@ -191,7 +191,7 @@ m2type_GetArrayNoOfElements (location_t location, tree arraytype) tree max = TYPE_MAX_VALUE (index_type); m2assert_AssertLocation (location); - return m2expr_FoldAndStrip (m2expr_BuildSub (location, max, min, FALSE)); + return m2expr_FoldAndStrip (m2expr_BuildSub (location, max, min, false)); } /* gm2_finish_build_array_type complete building the partially @@ -255,10 +255,10 @@ gm2_build_array_type (tree elementtype, tree indextype, int fetype) return m2type_BuildEndArrayType (arrayType, elementtype, indextype, fetype); } -/* ValueInTypeRange returns TRUE if the constant, value, lies within +/* ValueInTypeRange returns true if the constant, value, lies within the range of type. */ -int +bool m2type_ValueInTypeRange (tree type, tree value) { tree low_type = m2tree_skip_type_decl (type); @@ -270,29 +270,29 @@ m2type_ValueInTypeRange (tree type, tree value) && (tree_int_cst_compare (value, max_value) <= 0)); } -/* ValueOutOfTypeRange returns TRUE if the constant, value, exceeds +/* ValueOutOfTypeRange returns true if the constant, value, exceeds the range of type. */ -int +bool m2type_ValueOutOfTypeRange (tree type, tree value) { return (!m2type_ValueInTypeRange (type, value)); } -/* ExceedsTypeRange return TRUE if low or high exceed the range of +/* ExceedsTypeRange return true if low or high exceed the range of type. */ -int +bool m2type_ExceedsTypeRange (tree type, tree low, tree high) { return (m2type_ValueOutOfTypeRange (type, low) || m2type_ValueOutOfTypeRange (type, high)); } -/* WithinTypeRange return TRUE if low and high are within the range +/* WithinTypeRange return true if low and high are within the range of type. */ -int +bool m2type_WithinTypeRange (tree type, tree low, tree high) { return (m2type_ValueInTypeRange (type, low) @@ -847,7 +847,7 @@ m2type_GetPackedBooleanType (void) return m2_packed_boolean_type_node; } -/* GetBooleanTrue return modula-2 TRUE. */ +/* GetBooleanTrue return modula-2 true. */ tree m2type_GetBooleanTrue (void) @@ -1004,7 +1004,7 @@ build_bitset_type (location_t location) return m2type_BuildSetTypeFromSubrange ( location, NULL, bitnum_type_node, m2decl_BuildIntegerConstant (0), - m2decl_BuildIntegerConstant (m2decl_GetBitsPerBitset () - 1), FALSE); + m2decl_BuildIntegerConstant (m2decl_GetBitsPerBitset () - 1), false); } /* BuildSetTypeFromSubrange constructs a set type from a @@ -1014,7 +1014,7 @@ tree m2type_BuildSetTypeFromSubrange (location_t location, char *name __attribute__ ((unused)), tree subrangeType __attribute__ ((unused)), - tree lowval, tree highval, int ispacked) + tree lowval, tree highval, bool ispacked) { m2assert_AssertLocation (location); lowval = m2expr_FoldAndStrip (lowval); @@ -1028,12 +1028,12 @@ m2type_BuildSetTypeFromSubrange (location_t location, if (ispacked) { tree noelements = m2expr_BuildAdd ( - location, m2expr_BuildSub (location, highval, lowval, FALSE), - integer_one_node, FALSE); + location, m2expr_BuildSub (location, highval, lowval, false), + integer_one_node, false); highval = m2expr_FoldAndStrip (m2expr_BuildSub ( location, m2expr_BuildLSL (location, m2expr_GetWordOne (location), - noelements, FALSE), - m2expr_GetIntegerOne (location), FALSE)); + noelements, false), + m2expr_GetIntegerOne (location), false)); lowval = m2expr_GetIntegerZero (location); return m2type_BuildSmallestTypeRange (location, lowval, highval); } @@ -1061,7 +1061,7 @@ build_m2_size_set_type (location_t location, int precision) return m2type_BuildSetTypeFromSubrange ( location, NULL, bitnum_type_node, m2decl_BuildIntegerConstant (0), - m2decl_BuildIntegerConstant (precision - 1), FALSE); + m2decl_BuildIntegerConstant (precision - 1), false); } /* build_m2_specific_size_type build a specific data type matching @@ -1095,12 +1095,12 @@ build_m2_specific_size_type (location_t location, enum tree_code base, if (is_signed) { fixup_signed_type (c); - TYPE_UNSIGNED (c) = FALSE; + TYPE_UNSIGNED (c) = false; } else { fixup_unsigned_type (c); - TYPE_UNSIGNED (c) = TRUE; + TYPE_UNSIGNED (c) = true; } } @@ -1119,8 +1119,8 @@ m2type_BuildSmallestTypeRange (location_t location, tree low, tree high) low = fold (low); high = fold (high); bits = fold (noBitsRequired ( - m2expr_BuildAdd (location, m2expr_BuildSub (location, high, low, FALSE), - m2expr_GetIntegerOne (location), FALSE))); + m2expr_BuildAdd (location, m2expr_BuildSub (location, high, low, false), + m2expr_GetIntegerOne (location), false))); return build_m2_specific_size_type (location, INTEGER_TYPE, TREE_INT_CST_LOW (bits), tree_int_cst_sgn (low) < 0); @@ -1162,7 +1162,7 @@ finish_build_pointer_type (tree t, tree to_type, enum machine_mode mode, tree m2type_BuildProcTypeParameterDeclaration (location_t location, tree type, - int isreference) + bool isreference) { m2assert_AssertLocation (location); ASSERT_BOOL (isreference); @@ -1332,11 +1332,11 @@ m2type_BuildVariableArrayAndDeclare (location_t location, tree elementtype, m2assert_AssertLocation (location); decl = build_decl (location, VAR_DECL, id, arraytype); - DECL_EXTERNAL (decl) = FALSE; - TREE_PUBLIC (decl) = TRUE; + DECL_EXTERNAL (decl) = false; + TREE_PUBLIC (decl) = true; DECL_CONTEXT (decl) = scope; - TREE_USED (arraytype) = TRUE; - TREE_USED (decl) = TRUE; + TREE_USED (arraytype) = true; + TREE_USED (decl) = true; m2block_pushDecl (decl); @@ -1367,7 +1367,7 @@ build_m2_iso_word_node (location_t location, int loc) (m2expr_BuildSub (location, m2decl_BuildIntegerConstant ( m2decl_GetBitsPerInt () / BITS_PER_UNIT), - m2expr_GetIntegerOne (location), FALSE))), + m2expr_GetIntegerOne (location), false))), loc); return c; } @@ -1547,56 +1547,56 @@ static tree build_m2_integer8_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 8, TRUE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 8, true); } static tree build_m2_integer16_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 16, TRUE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 16, true); } static tree build_m2_integer32_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 32, TRUE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 32, true); } static tree build_m2_integer64_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 64, TRUE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 64, true); } static tree build_m2_cardinal8_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 8, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 8, false); } static tree build_m2_cardinal16_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 16, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 16, false); } static tree build_m2_cardinal32_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 32, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 32, false); } static tree build_m2_cardinal64_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, INTEGER_TYPE, 64, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 64, false); } static tree @@ -1604,9 +1604,9 @@ build_m2_bitset8_type_node (location_t location) { m2assert_AssertLocation (location); if (broken_set_debugging_info) - return build_m2_specific_size_type (location, INTEGER_TYPE, 8, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 8, false); else - return build_m2_specific_size_type (location, SET_TYPE, 8, FALSE); + return build_m2_specific_size_type (location, SET_TYPE, 8, false); } static tree @@ -1614,9 +1614,9 @@ build_m2_bitset16_type_node (location_t location) { m2assert_AssertLocation (location); if (broken_set_debugging_info) - return build_m2_specific_size_type (location, INTEGER_TYPE, 16, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 16, false); else - return build_m2_specific_size_type (location, SET_TYPE, 16, FALSE); + return build_m2_specific_size_type (location, SET_TYPE, 16, false); } static tree @@ -1624,37 +1624,37 @@ build_m2_bitset32_type_node (location_t location) { m2assert_AssertLocation (location); if (broken_set_debugging_info) - return build_m2_specific_size_type (location, INTEGER_TYPE, 32, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, 32, false); else - return build_m2_specific_size_type (location, SET_TYPE, 32, FALSE); + return build_m2_specific_size_type (location, SET_TYPE, 32, false); } static tree build_m2_real32_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, REAL_TYPE, 32, TRUE); + return build_m2_specific_size_type (location, REAL_TYPE, 32, true); } static tree build_m2_real64_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, REAL_TYPE, 64, TRUE); + return build_m2_specific_size_type (location, REAL_TYPE, 64, true); } static tree build_m2_real96_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, REAL_TYPE, 96, TRUE); + return build_m2_specific_size_type (location, REAL_TYPE, 96, true); } static tree build_m2_real128_type_node (location_t location) { m2assert_AssertLocation (location); - return build_m2_specific_size_type (location, REAL_TYPE, 128, TRUE); + return build_m2_specific_size_type (location, REAL_TYPE, 128, true); } static tree @@ -1725,7 +1725,16 @@ build_m2_cardinal_address_type_node (location_t location) tree size = size_in_bytes (ptr_type_node); int bits = TREE_INT_CST_LOW (size) * BITS_PER_UNIT; - return build_m2_specific_size_type (location, INTEGER_TYPE, bits, FALSE); + return build_m2_specific_size_type (location, INTEGER_TYPE, bits, false); +} + +static void +build_m2_boolean (location_t location) +{ + tree tname = get_identifier ("BOOLEAN"); + tree typedecl = build_decl (location, TYPE_DECL, tname, boolean_type_node); + DECL_ARTIFICIAL (typedecl) = 1; + TYPE_NAME (boolean_type_node) = typedecl; } /* InitBaseTypes create the Modula-2 base types. */ @@ -1781,7 +1790,8 @@ m2type_InitBaseTypes (location_t location) m2_cardinal_address_type_node = build_m2_cardinal_address_type_node (location); - m2_packed_boolean_type_node = build_nonstandard_integer_type (1, TRUE); + m2_packed_boolean_type_node = build_nonstandard_integer_type (1, true); + build_m2_boolean (location); if (M2Options_GetPPOnly ()) return; @@ -1932,7 +1942,7 @@ m2type_GetMaxFrom (location_t location, tree type) return do_max_real (type); if (type == ptr_type_node) return fold (m2expr_BuildSub (location, m2expr_GetPointerZero (location), - m2expr_GetPointerOne (location), FALSE)); + m2expr_GetPointerOne (location), false)); return TYPE_MAX_VALUE (m2tree_skip_type_decl (type)); } @@ -2118,7 +2128,7 @@ gm2_finish_enum (location_t location, tree enumtype, tree values) /* BuildStartEnumeration create an enumerated type in gcc. */ tree -m2type_BuildStartEnumeration (location_t location, char *name, int ispacked) +m2type_BuildStartEnumeration (location_t location, char *name, bool ispacked) { tree id; @@ -2201,7 +2211,7 @@ tree m2type_BuildConstPointerType (tree totype) { tree t = build_pointer_type (m2tree_skip_type_decl (totype)); - TYPE_READONLY (t) = TRUE; + TYPE_READONLY (t) = true; return t; } @@ -2209,7 +2219,7 @@ m2type_BuildConstPointerType (tree totype) tree m2type_BuildSetType (location_t location, char *name, tree type, tree lowval, - tree highval, int ispacked) + tree highval, bool ispacked) { tree range = build_range_type (m2tree_skip_type_decl (type), m2expr_FoldAndStrip (lowval), @@ -2386,8 +2396,8 @@ m2type_BuildEndArrayConstructor (void *p) constructor = build_constructor (c->constructor_type, c->constructor_elements); - TREE_CONSTANT (constructor) = TRUE; - TREE_STATIC (constructor) = TRUE; + TREE_CONSTANT (constructor) = true; + TREE_STATIC (constructor) = true; pop_constructor (c); @@ -2454,13 +2464,13 @@ m2type_BuildArrayStringConstructor (location_t location, tree arrayType, { if (i < len) val = m2convert_BuildConvert ( - location, type, m2type_BuildCharConstant (location, &p[i]), FALSE); + location, type, m2type_BuildCharConstant (location, &p[i]), false); else val = m2type_BuildCharConstant (location, &nul[0]); m2type_BuildArrayConstructorElement (c, val, n); i += 1; n = m2expr_BuildAdd (location, n, m2expr_GetIntegerOne (location), - FALSE); + false); } return m2type_BuildEndArrayConstructor (c); } @@ -2512,7 +2522,7 @@ tree m2type_BuildCharConstantChar (location_t location, char ch) { tree id = build_int_cst (char_type_node, (int) ch); - id = m2convert_BuildConvert (location, m2type_GetM2CharType (), id, FALSE); + id = m2convert_BuildConvert (location, m2type_GetM2CharType (), id, false); return m2block_RememberConstant (id); } @@ -2548,7 +2558,7 @@ gm2_start_struct (location_t location, enum tree_code code, char *name) else id = get_identifier (name); - TYPE_PACKED (s) = FALSE; /* This maybe set TRUE later if necessary. */ + TYPE_PACKED (s) = false; /* This maybe set true later if necessary. */ m2block_pushDecl (build_decl (location, TYPE_DECL, id, s)); return s; @@ -2590,7 +2600,7 @@ m2type_BuildStartVarient (location_t location, char *name) tree m2type_BuildEndVarient (location_t location, tree varientField, - tree varientList, int isPacked) + tree varientList, bool isPacked) { tree varient = TREE_TYPE (varientField); m2assert_AssertLocation (location); @@ -2618,7 +2628,7 @@ m2type_BuildStartFieldVarient (location_t location, char *name) tree m2type_BuildEndRecord (location_t location, tree record, tree fieldlist, - int isPacked) + bool isPacked) { tree x, d; @@ -2682,7 +2692,7 @@ m2type_BuildEndRecord (location_t location, tree record, tree fieldlist, tree m2type_BuildEndFieldVarient (location_t location, tree varientField, - tree varientList, int isPacked) + tree varientList, bool isPacked) { tree record = TREE_TYPE (varientField); @@ -2764,7 +2774,7 @@ m2type_SetAlignment (tree node, tree align) { tree type = NULL_TREE; tree decl = NULL_TREE; - int is_type = FALSE; + bool is_type = false; int i; if (DECL_P (node)) @@ -2775,7 +2785,7 @@ m2type_SetAlignment (tree node, tree align) } else if (TYPE_P (node)) { - is_type = 1; + is_type = true; type = node; } @@ -2874,8 +2884,8 @@ m2type_BuildNumberOfArrayElements (location_t location, tree arrayType) tree high = TYPE_MAX_VALUE (index); tree low = TYPE_MIN_VALUE (index); tree elements = m2expr_BuildAdd ( - location, m2expr_BuildSub (location, high, low, FALSE), - m2expr_GetIntegerOne (location), FALSE); + location, m2expr_BuildSub (location, high, low, false), + m2expr_GetIntegerOne (location), false); m2assert_AssertLocation (location); return elements; } @@ -2912,7 +2922,7 @@ m2type_GarbageCollect (void) signed. */ tree -m2type_gm2_type_for_size (unsigned int bits, int unsignedp) +m2type_gm2_type_for_size (unsigned int bits, bool unsignedp) { if (bits == TYPE_PRECISION (integer_type_node)) return unsignedp ? unsigned_type_node : integer_type_node; @@ -2976,7 +2986,7 @@ m2type_gm2_unsigned_type (tree type) if (type1 == intQI_type_node) return unsigned_intQI_type_node; - return m2type_gm2_signed_or_unsigned_type (TRUE, type); + return m2type_gm2_signed_or_unsigned_type (true, type); } /* gm2_signed_type return a signed type the same as TYPE in other @@ -3010,7 +3020,7 @@ m2type_gm2_signed_type (tree type) if (type1 == unsigned_intQI_type_node) return intQI_type_node; - return m2type_gm2_signed_or_unsigned_type (FALSE, type); + return m2type_gm2_signed_or_unsigned_type (false, type); } /* check_type if the precision of baseType and type are the same @@ -3027,9 +3037,9 @@ check_type (tree baseType, tree type, int unsignedp, tree baseu, tree bases, *result = baseu; else *result = bases; - return TRUE; + return true; } - return FALSE; + return false; } /* gm2_signed_or_unsigned_type return a type the same as TYPE @@ -3085,7 +3095,7 @@ m2type_gm2_signed_or_unsigned_type (int unsignedp, tree type) return type; } -/* IsAddress returns TRUE if the type is an ADDRESS. */ +/* IsAddress returns true if the type is an ADDRESS. */ int m2type_IsAddress (tree type) diff --git a/gcc/m2/gm2-gcc/m2type.h b/gcc/m2/gm2-gcc/m2type.h index fa4c25d..ab0488c 100644 --- a/gcc/m2/gm2-gcc/m2type.h +++ b/gcc/m2/gm2-gcc/m2type.h @@ -35,12 +35,14 @@ along with GNU Modula-2; see the file COPYING3. If not see #endif /* !__GNUG__. */ #endif /* !m2type_c. */ +#include <stdbool.h> + typedef void *m2type_Constructor; -EXTERN int m2type_ValueInTypeRange (tree type, tree value); -EXTERN int m2type_ExceedsTypeRange (tree type, tree low, tree high); -EXTERN int m2type_ValueOutOfTypeRange (tree type, tree value); -EXTERN int m2type_WithinTypeRange (tree type, tree low, tree high); +EXTERN bool m2type_ValueInTypeRange (tree type, tree value); +EXTERN bool m2type_ExceedsTypeRange (tree type, tree low, tree high); +EXTERN bool m2type_ValueOutOfTypeRange (tree type, tree value); +EXTERN bool m2type_WithinTypeRange (tree type, tree low, tree high); EXTERN tree m2type_BuildStartArrayType (tree index_type, tree elt_type, int type); EXTERN void m2type_PutArrayType (tree array, tree type); @@ -62,7 +64,7 @@ EXTERN tree m2type_SetTypePacked (tree node); EXTERN tree m2type_SetDeclPacked (tree node); EXTERN tree m2type_SetAlignment (tree node, tree align); EXTERN tree m2type_BuildEndRecord (location_t location, tree record, - tree fieldlist, int isPacked); + tree fieldlist, bool isPacked); EXTERN tree m2type_AddStringToTreeList (tree list, tree string); EXTERN tree m2type_ChainOnParamValue (tree list, tree name, tree str, tree value); @@ -73,10 +75,10 @@ EXTERN tree m2type_BuildStartFieldRecord (location_t location, char *name, tree type); EXTERN tree m2type_BuildEndFieldVarient (location_t location, tree varientField, tree varientList, - int isPacked); + bool isPacked); EXTERN tree m2type_BuildStartFieldVarient (location_t location, char *name); EXTERN tree m2type_BuildEndVarient (location_t location, tree varientField, - tree varientList, int isPacked); + tree varientList, bool isPacked); EXTERN tree m2type_BuildStartVarient (location_t location, char *name); EXTERN tree m2type_BuildStartUnion (location_t location, char *name); EXTERN tree m2type_BuildStartRecord (location_t location, char *name); @@ -160,7 +162,7 @@ EXTERN tree m2type_BuildSmallestTypeRange (location_t location, tree low, tree high); EXTERN tree m2type_BuildSetTypeFromSubrange (location_t location, char *name, tree subrangeType, tree lowval, - tree highval, int ispacked); + tree highval, bool ispacked); EXTERN int m2type_GetBitsPerBitset (void); EXTERN tree m2type_GetM2RType (void); EXTERN tree m2type_GetM2ZType (void); @@ -185,7 +187,7 @@ EXTERN tree m2type_GetMinFrom (location_t location, tree type); EXTERN tree m2type_GetMaxFrom (location_t location, tree type); EXTERN void m2type_BuildTypeDeclaration (location_t location, tree type); EXTERN tree m2type_BuildStartEnumeration (location_t location, char *name, - int ispacked); + bool ispacked); EXTERN tree m2type_BuildEndEnumeration (location_t location, tree enumtype, tree enumvalues); EXTERN tree m2type_BuildEnumerator (location_t location, char *name, @@ -193,7 +195,7 @@ EXTERN tree m2type_BuildEnumerator (location_t location, char *name, EXTERN tree m2type_BuildPointerType (tree totype); EXTERN tree m2type_BuildConstPointerType (tree totype); EXTERN tree m2type_BuildSetType (location_t location, char *name, tree type, - tree lowval, tree highval, int ispacked); + tree lowval, tree highval, bool ispacked); EXTERN void *m2type_BuildStartSetConstructor (tree type); EXTERN void m2type_BuildSetConstructorElement (void *p, tree value); EXTERN tree m2type_BuildEndSetConstructor (void *p); @@ -214,7 +216,7 @@ EXTERN tree m2type_gm2_signed_or_unsigned_type (int unsignedp, tree type); EXTERN tree m2type_gm2_type_for_size (unsigned int bits, int unsignedp); EXTERN tree m2type_BuildProcTypeParameterDeclaration (location_t location, tree type, - int isreference); + bool isreference); EXTERN int m2type_IsAddress (tree type); EXTERN tree m2type_GetCardinalAddressType (void); diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc index 162baf7..a1b32d8 100644 --- a/gcc/m2/gm2-lang.cc +++ b/gcc/m2/gm2-lang.cc @@ -1033,7 +1033,7 @@ convert_loc (location_t location, tree type, tree expr) { case VOID_TYPE: case BOOLEAN_TYPE: - return fold_convert (type, expr); + return fold (convert_to_integer (type, expr)); case INTEGER_TYPE: return fold (convert_to_integer (type, expr)); case POINTER_TYPE: diff --git a/gcc/m2/gm2-libs/Builtins.def b/gcc/m2/gm2-libs/Builtins.def index e619e8f..eda36c3 100644 --- a/gcc/m2/gm2-libs/Builtins.def +++ b/gcc/m2/gm2-libs/Builtins.def @@ -30,9 +30,9 @@ FROM SYSTEM IMPORT ADDRESS ; (* floating point intrinsic procedure functions *) -PROCEDURE __BUILTIN__ isfinitef (x: SHORTREAL) : BOOLEAN ; -PROCEDURE __BUILTIN__ isfinite (x: REAL) : BOOLEAN ; -PROCEDURE __BUILTIN__ isfinitel (x: LONGREAL) : BOOLEAN ; +PROCEDURE __BUILTIN__ isfinitef (x: SHORTREAL) : INTEGER ; +PROCEDURE __BUILTIN__ isfinite (x: REAL) : INTEGER ; +PROCEDURE __BUILTIN__ isfinitel (x: LONGREAL) : INTEGER ; PROCEDURE __BUILTIN__ sinf (x: SHORTREAL) : SHORTREAL ; PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ; diff --git a/gcc/m2/gm2-libs/Builtins.mod b/gcc/m2/gm2-libs/Builtins.mod index af5cd29..98ab3a3 100644 --- a/gcc/m2/gm2-libs/Builtins.mod +++ b/gcc/m2/gm2-libs/Builtins.mod @@ -57,19 +57,19 @@ BEGIN RETURN cbuiltin.memcpy (dest, src, nbytes) END memcpy ; -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinitef (x: SHORTREAL) : BOOLEAN ; +PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinitef (x: SHORTREAL) : INTEGER ; BEGIN - RETURN wrapc.isfinitef (x)=1 + RETURN wrapc.isfinitef END isfinitef ; -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinite (x: REAL) : BOOLEAN ; +PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinite (x: REAL) : INTEGER ; BEGIN - RETURN wrapc.isfinite (x)=1 + RETURN wrapc.isfinite (x) END isfinite ; -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinitel (x: LONGREAL) : BOOLEAN ; +PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinitel (x: LONGREAL) : INTEGER ; BEGIN - RETURN wrapc.isfinitel (x)=1 + RETURN wrapc.isfinitel (x) END isfinitel ; PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_sin)) sin (x: REAL) : REAL ; diff --git a/gcc/m2/mc-boot/GASCII.cc b/gcc/m2/mc-boot/GASCII.cc index 2f768ce..0758c8f 100644 --- a/gcc/m2/mc-boot/GASCII.cc +++ b/gcc/m2/mc-boot/GASCII.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GASCII.h b/gcc/m2/mc-boot/GASCII.h index b5091fd..952fbf3 100644 --- a/gcc/m2/mc-boot/GASCII.h +++ b/gcc/m2/mc-boot/GASCII.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GArgs.cc b/gcc/m2/mc-boot/GArgs.cc index 106ddfd..cc98f01 100644 --- a/gcc/m2/mc-boot/GArgs.cc +++ b/gcc/m2/mc-boot/GArgs.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -56,7 +57,7 @@ static Args__T1 Source; The success of the operation is returned. */ -extern "C" unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int n); +extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n); /* Narg - returns the number of arguments available from @@ -71,7 +72,7 @@ extern "C" unsigned int Args_Narg (void); The success of the operation is returned. */ -extern "C" unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int n) +extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n) { int i; unsigned int High; diff --git a/gcc/m2/mc-boot/GArgs.h b/gcc/m2/mc-boot/GArgs.h index d7c93ea..9866f43 100644 --- a/gcc/m2/mc-boot/GArgs.h +++ b/gcc/m2/mc-boot/GArgs.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -53,7 +54,7 @@ extern "C" { The success of the operation is returned. */ -EXTERN unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int n); +EXTERN bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n); /* Narg - returns the number of arguments available from diff --git a/gcc/m2/mc-boot/GAssertion.cc b/gcc/m2/mc-boot/GAssertion.cc index 21ee6c0..2f1cac6 100644 --- a/gcc/m2/mc-boot/GAssertion.cc +++ b/gcc/m2/mc-boot/GAssertion.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -44,14 +45,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see Assert - tests the boolean Condition, if it fails then HALT is called. */ -extern "C" void Assertion_Assert (unsigned int Condition); +extern "C" void Assertion_Assert (bool Condition); /* Assert - tests the boolean Condition, if it fails then HALT is called. */ -extern "C" void Assertion_Assert (unsigned int Condition) +extern "C" void Assertion_Assert (bool Condition) { if (! Condition) { diff --git a/gcc/m2/mc-boot/GAssertion.h b/gcc/m2/mc-boot/GAssertion.h index f983353..0e0af34 100644 --- a/gcc/m2/mc-boot/GAssertion.h +++ b/gcc/m2/mc-boot/GAssertion.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -53,7 +54,7 @@ extern "C" { is called. */ -EXTERN void Assertion_Assert (unsigned int Condition); +EXTERN void Assertion_Assert (bool Condition); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GBreak.cc b/gcc/m2/mc-boot/GBreak.cc index 9be003b..15e55d8 100644 --- a/gcc/m2/mc-boot/GBreak.cc +++ b/gcc/m2/mc-boot/GBreak.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GBreak.h b/gcc/m2/mc-boot/GBreak.h index 397328c..328bc8b 100644 --- a/gcc/m2/mc-boot/GBreak.h +++ b/gcc/m2/mc-boot/GBreak.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GCOROUTINES.h b/gcc/m2/mc-boot/GCOROUTINES.h index 89cfbd9..ae1ee92 100644 --- a/gcc/m2/mc-boot/GCOROUTINES.h +++ b/gcc/m2/mc-boot/GCOROUTINES.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GCmdArgs.cc b/gcc/m2/mc-boot/GCmdArgs.cc index c304a40..101fd23 100644 --- a/gcc/m2/mc-boot/GCmdArgs.cc +++ b/gcc/m2/mc-boot/GCmdArgs.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -51,7 +52,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see The result of the operation is returned. */ -extern "C" unsigned int CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high); +extern "C" bool CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high); /* Narg - returns the number of arguments available from @@ -66,7 +67,7 @@ extern "C" unsigned int CmdArgs_Narg (const char *CmdLine_, unsigned int _CmdLin Arg is filled with the found argument. */ -static unsigned int GetNextArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int *CmdIndex, char *Arg, unsigned int _Arg_high); +static bool GetNextArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int *CmdIndex, char *Arg, unsigned int _Arg_high); /* CopyUntilSpace - copies characters until a Space character is found. @@ -87,10 +88,10 @@ static void CopyUntil (const char *From_, unsigned int _From_high, unsigned int */ static void CopyChar (const char *From_, unsigned int _From_high, unsigned int *FromIndex, unsigned int FromHigh, char *To, unsigned int _To_high, unsigned int *ToIndex, unsigned int ToHigh); -static unsigned int Escape (char ch); -static unsigned int Space (char ch); -static unsigned int DoubleQuote (char ch); -static unsigned int SingleQuote (char ch); +static bool Escape (char ch); +static bool Space (char ch); +static bool DoubleQuote (char ch); +static bool SingleQuote (char ch); /* @@ -99,7 +100,7 @@ static unsigned int SingleQuote (char ch); Arg is filled with the found argument. */ -static unsigned int GetNextArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int *CmdIndex, char *Arg, unsigned int _Arg_high) +static bool GetNextArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int *CmdIndex, char *Arg, unsigned int _Arg_high) { unsigned int ArgIndex; unsigned int HighA; @@ -222,28 +223,28 @@ static void CopyChar (const char *From_, unsigned int _From_high, unsigned int * } } -static unsigned int Escape (char ch) +static bool Escape (char ch) { return ch == esc; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } -static unsigned int Space (char ch) +static bool Space (char ch) { return (ch == space) || (ch == tab); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } -static unsigned int DoubleQuote (char ch) +static bool DoubleQuote (char ch) { return ch == dquote; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } -static unsigned int SingleQuote (char ch) +static bool SingleQuote (char ch) { return ch == squote; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -257,11 +258,11 @@ static unsigned int SingleQuote (char ch) The result of the operation is returned. */ -extern "C" unsigned int CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high) +extern "C" bool CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high) { unsigned int Index; unsigned int i; - unsigned int Another; + bool Another; char CmdLine[_CmdLine_high+1]; /* make a local copy of each unbounded array. */ diff --git a/gcc/m2/mc-boot/GCmdArgs.h b/gcc/m2/mc-boot/GCmdArgs.h index f35ef0d..65668aa 100644 --- a/gcc/m2/mc-boot/GCmdArgs.h +++ b/gcc/m2/mc-boot/GCmdArgs.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -53,7 +54,7 @@ extern "C" { the success of the operation is returned. */ -EXTERN unsigned int CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high); +EXTERN bool CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high); /* Narg - returns the number of arguments available from diff --git a/gcc/m2/mc-boot/GDebug.cc b/gcc/m2/mc-boot/GDebug.cc index 6329abb..98de9df 100644 --- a/gcc/m2/mc-boot/GDebug.cc +++ b/gcc/m2/mc-boot/GDebug.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GDebug.h b/gcc/m2/mc-boot/GDebug.h index ed509a2..3a02b54 100644 --- a/gcc/m2/mc-boot/GDebug.h +++ b/gcc/m2/mc-boot/GDebug.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GDynamicStrings.cc b/gcc/m2/mc-boot/GDynamicStrings.cc index dfc1636..41d25f1 100644 --- a/gcc/m2/mc-boot/GDynamicStrings.cc +++ b/gcc/m2/mc-boot/GDynamicStrings.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -58,10 +59,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GM2RTS.h" # define MaxBuf 127 -# define PoisonOn FALSE -# define DebugOn FALSE -# define CheckOn FALSE -# define TraceOn FALSE +# define PoisonOn false +# define DebugOn false +# define CheckOn false +# define TraceOn false typedef struct DynamicStrings_Contents_r DynamicStrings_Contents; typedef struct DynamicStrings_DebugInfo_r DynamicStrings_DebugInfo; @@ -90,10 +91,10 @@ struct DynamicStrings_DebugInfo_r { }; struct DynamicStrings_descriptor_r { - unsigned int charStarUsed; + bool charStarUsed; void *charStar; unsigned int charStarSize; - unsigned int charStarValid; + bool charStarValid; DynamicStrings_desState state; DynamicStrings_String garbage; }; @@ -117,7 +118,7 @@ struct DynamicStrings_stringRecord_r { DynamicStrings_DebugInfo debug; }; -static unsigned int Initialized; +static bool Initialized; static DynamicStrings_frame frameHead; static DynamicStrings_String captured; @@ -202,21 +203,21 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy Equal - returns TRUE if String, a, and, b, are equal. */ -extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b); +extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b); /* EqualCharStar - returns TRUE if contents of String, s, is the same as the string, a. */ -extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a); +extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a); /* EqualArray - returns TRUE if contents of String, s, is the same as the string, a. */ -extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high); +extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high); /* Mult - returns a new string which is n concatenations of String, s. @@ -363,7 +364,7 @@ extern "C" void DynamicStrings_PushAllocation (void); with an exit code of 1. */ -extern "C" void DynamicStrings_PopAllocation (unsigned int halt); +extern "C" void DynamicStrings_PopAllocation (bool halt); /* PopAllocationExemption - test to see that all strings are deallocated, except @@ -375,7 +376,7 @@ extern "C" void DynamicStrings_PopAllocation (unsigned int halt); with an exit code of 1. */ -extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e); +extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e); /* writeStringDesc write out debugging information about string, s. */ @@ -483,7 +484,7 @@ static DynamicStrings_String AssignDebug (DynamicStrings_String s, const char *f IsOn - returns TRUE if, s, is on one of the debug lists. */ -static unsigned int IsOn (DynamicStrings_String list, DynamicStrings_String s); +static bool IsOn (DynamicStrings_String list, DynamicStrings_String s); /* AddTo - adds string, s, to, list. @@ -513,13 +514,13 @@ static void AddDeallocated (DynamicStrings_String s); IsOnAllocated - returns TRUE if the string, s, has ever been allocated. */ -static unsigned int IsOnAllocated (DynamicStrings_String s); +static bool IsOnAllocated (DynamicStrings_String s); /* IsOnDeallocated - returns TRUE if the string, s, has ever been deallocated. */ -static unsigned int IsOnDeallocated (DynamicStrings_String s); +static bool IsOnDeallocated (DynamicStrings_String s); /* SubAllocated - removes string, s, from the list of allocated strings. @@ -589,13 +590,13 @@ static DynamicStrings_String AddToGarbage (DynamicStrings_String a, DynamicStrin IsOnGarbage - returns TRUE if, s, is on string, e, garbage list. */ -static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s); +static bool IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s); /* IsWhite - returns TRUE if, ch, is a space or a tab. */ -static unsigned int IsWhite (char ch); +static bool IsWhite (char ch); /* DumpState - @@ -735,7 +736,7 @@ static void doDSdbExit (DynamicStrings_String s) { if (CheckOn) { - s = DynamicStrings_PopAllocationExemption (TRUE, s); + s = DynamicStrings_PopAllocationExemption (true, s); } } @@ -957,7 +958,7 @@ static DynamicStrings_String AssignDebug (DynamicStrings_String s, const char *f IsOn - returns TRUE if, s, is on one of the debug lists. */ -static unsigned int IsOn (DynamicStrings_String list, DynamicStrings_String s) +static bool IsOn (DynamicStrings_String list, DynamicStrings_String s) { while ((list != s) && (list != NULL)) { @@ -1047,7 +1048,7 @@ static void AddDeallocated (DynamicStrings_String s) IsOnAllocated - returns TRUE if the string, s, has ever been allocated. */ -static unsigned int IsOnAllocated (DynamicStrings_String s) +static bool IsOnAllocated (DynamicStrings_String s) { DynamicStrings_frame f; @@ -1056,14 +1057,14 @@ static unsigned int IsOnAllocated (DynamicStrings_String s) do { if (IsOn (f->alloc, s)) { - return TRUE; + return true; } else { f = f->next; } } while (! (f == NULL)); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1073,7 +1074,7 @@ static unsigned int IsOnAllocated (DynamicStrings_String s) IsOnDeallocated - returns TRUE if the string, s, has ever been deallocated. */ -static unsigned int IsOnDeallocated (DynamicStrings_String s) +static bool IsOnDeallocated (DynamicStrings_String s) { DynamicStrings_frame f; @@ -1082,14 +1083,14 @@ static unsigned int IsOnDeallocated (DynamicStrings_String s) do { if (IsOn (f->dealloc, s)) { - return TRUE; + return true; } else { f = f->next; } } while (! (f == NULL)); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1235,10 +1236,10 @@ static void DeallocateCharStar (DynamicStrings_String s) { Storage_DEALLOCATE (&s->head->charStar, s->head->charStarSize); } - s->head->charStarUsed = FALSE; + s->head->charStarUsed = false; s->head->charStar = NULL; s->head->charStarSize = 0; - s->head->charStarValid = FALSE; + s->head->charStarValid = false; } } @@ -1272,7 +1273,7 @@ static void MarkInvalid (DynamicStrings_String s) } if (s->head != NULL) { - s->head->charStarValid = FALSE; + s->head->charStarValid = false; } } @@ -1368,7 +1369,7 @@ static DynamicStrings_String AddToGarbage (DynamicStrings_String a, DynamicStrin IsOnGarbage - returns TRUE if, s, is on string, e, garbage list. */ -static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s) +static bool IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s) { if ((e != NULL) && (s != NULL)) { @@ -1376,7 +1377,7 @@ static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String { if (e->head->garbage == s) { - return TRUE; + return true; } else { @@ -1384,7 +1385,7 @@ static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String } } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1394,7 +1395,7 @@ static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String IsWhite - returns TRUE if, ch, is a space or a tab. */ -static unsigned int IsWhite (char ch) +static bool IsWhite (char ch) { return (ch == ' ') || (ch == ASCII_tab); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1503,7 +1504,7 @@ static void Init (void) { if (! Initialized) { - Initialized = TRUE; + Initialized = true; frameHead = NULL; DynamicStrings_PushAllocation (); } @@ -1528,10 +1529,10 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi s->contents.next = NULL; ConcatContents (&s->contents, (const char *) a, _a_high, StrLib_StrLen ((const char *) a, _a_high), 0); Storage_ALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor)); - s->head->charStarUsed = FALSE; + s->head->charStarUsed = false; s->head->charStar = NULL; s->head->charStarSize = 0; - s->head->charStarValid = FALSE; + s->head->charStarValid = false; s->head->garbage = NULL; s->head->state = DynamicStrings_inuse; AddDebugInfo (s); @@ -1631,10 +1632,10 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) ConcatContentsAddress (&s->contents, a, static_cast<unsigned int> (libc_strlen (a))); } Storage_ALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor)); - s->head->charStarUsed = FALSE; + s->head->charStarUsed = false; s->head->charStar = NULL; s->head->charStarSize = 0; - s->head->charStarValid = FALSE; + s->head->charStarValid = false; s->head->garbage = NULL; s->head->state = DynamicStrings_inuse; AddDebugInfo (s); @@ -1857,7 +1858,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy Equal - returns TRUE if String, a, and, b, are equal. */ -extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b) +extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b) { unsigned int i; @@ -1876,18 +1877,18 @@ extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicSt { if (a->contents.buf.array[i] != b->contents.buf.array[i]) { - return FALSE; + return false; } i += 1; } a = a->contents.next; b = b->contents.next; } - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -1899,7 +1900,7 @@ extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicSt string, a. */ -extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a) +extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a) { DynamicStrings_String t; @@ -1916,12 +1917,12 @@ extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, v if (DynamicStrings_Equal (t, s)) { t = DynamicStrings_KillString (t); - return TRUE; + return true; } else { t = DynamicStrings_KillString (t); - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -1933,7 +1934,7 @@ extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, v string, a. */ -extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high) +extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high) { DynamicStrings_String t; char a[_a_high+1]; @@ -1954,12 +1955,12 @@ extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, cons if (DynamicStrings_Equal (t, s)) { t = DynamicStrings_KillString (t); - return TRUE; + return true; } else { t = DynamicStrings_KillString (t); - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -2435,7 +2436,7 @@ extern "C" void * DynamicStrings_string (DynamicStrings_String s) DeallocateCharStar (s); Storage_ALLOCATE (&s->head->charStar, l+1); s->head->charStarSize = l+1; - s->head->charStarUsed = TRUE; + s->head->charStarUsed = true; } p = static_cast<string__T2> (s->head->charStar); a = s; @@ -2451,7 +2452,7 @@ extern "C" void * DynamicStrings_string (DynamicStrings_String s) a = a->contents.next; } (*p) = ASCII_nul; - s->head->charStarValid = TRUE; + s->head->charStarValid = true; } return s->head->charStar; } @@ -2596,7 +2597,7 @@ extern "C" void DynamicStrings_PushAllocation (void) with an exit code of 1. */ -extern "C" void DynamicStrings_PopAllocation (unsigned int halt) +extern "C" void DynamicStrings_PopAllocation (bool halt) { if (CheckOn) { @@ -2616,11 +2617,11 @@ extern "C" void DynamicStrings_PopAllocation (unsigned int halt) with an exit code of 1. */ -extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e) +extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e) { DynamicStrings_String s; DynamicStrings_frame f; - unsigned int b; + bool b; Init (); if (CheckOn) @@ -2636,7 +2637,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned { if (frameHead->alloc != NULL) { - b = FALSE; + b = false; s = frameHead->alloc; while (s != NULL) { @@ -2646,7 +2647,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned { writeString ((const char *) "the following strings have been lost", 36); writeLn (); - b = TRUE; + b = true; } DumpStringInfo (s, 0); } @@ -2667,7 +2668,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { - Initialized = FALSE; + Initialized = false; Init (); } diff --git a/gcc/m2/mc-boot/GDynamicStrings.h b/gcc/m2/mc-boot/GDynamicStrings.h index c602ebc..a69f703 100644 --- a/gcc/m2/mc-boot/GDynamicStrings.h +++ b/gcc/m2/mc-boot/GDynamicStrings.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -139,21 +140,21 @@ EXTERN DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dynami Equal - returns TRUE if String, a, and, b, are equal. */ -EXTERN unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b); +EXTERN bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b); /* EqualCharStar - returns TRUE if contents of String, s, is the same as the string, a. */ -EXTERN unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a); +EXTERN bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a); /* EqualArray - returns TRUE if contents of String, s, is the same as the string, a. */ -EXTERN unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high); +EXTERN bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high); /* Mult - returns a new string which is n concatenations of String, s. @@ -310,7 +311,7 @@ EXTERN void DynamicStrings_PushAllocation (void); with an exit code of 1. */ -EXTERN void DynamicStrings_PopAllocation (unsigned int halt); +EXTERN void DynamicStrings_PopAllocation (bool halt); /* PopAllocationExemption - test to see that all strings are @@ -325,7 +326,7 @@ EXTERN void DynamicStrings_PopAllocation (unsigned int halt); The string, e, is returned unmodified, */ -EXTERN DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e); +EXTERN DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GEnvironment.cc b/gcc/m2/mc-boot/GEnvironment.cc index aa5e766..53e248d 100644 --- a/gcc/m2/mc-boot/GEnvironment.cc +++ b/gcc/m2/mc-boot/GEnvironment.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -53,7 +54,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see the processes environment. */ -extern "C" unsigned int Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high); +extern "C" bool Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high); /* PutEnvironment - change or add an environment variable definition EnvDef. @@ -61,7 +62,7 @@ extern "C" unsigned int Environment_GetEnvironment (const char *Env_, unsigned i set or changed successfully. */ -extern "C" unsigned int Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high); +extern "C" bool Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high); /* @@ -71,7 +72,7 @@ extern "C" unsigned int Environment_PutEnvironment (const char *EnvDef_, unsigne the processes environment. */ -extern "C" unsigned int Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high) +extern "C" bool Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high) { typedef char *GetEnvironment__T1; @@ -108,7 +109,7 @@ extern "C" unsigned int Environment_GetEnvironment (const char *Env_, unsigned i set or changed successfully. */ -extern "C" unsigned int Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high) +extern "C" bool Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high) { char EnvDef[_EnvDef_high+1]; diff --git a/gcc/m2/mc-boot/GEnvironment.h b/gcc/m2/mc-boot/GEnvironment.h index 82501c4..d0b44d1 100644 --- a/gcc/m2/mc-boot/GEnvironment.h +++ b/gcc/m2/mc-boot/GEnvironment.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -55,7 +56,7 @@ extern "C" { the processes environment. */ -EXTERN unsigned int Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high); +EXTERN bool Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high); /* PutEnvironment - change or add an environment variable definition @@ -64,7 +65,7 @@ EXTERN unsigned int Environment_GetEnvironment (const char *Env_, unsigned int _ set or changed successfully. */ -EXTERN unsigned int Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high); +EXTERN bool Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GFIO.cc b/gcc/m2/mc-boot/GFIO.cc index 65819a1..c25d754 100644 --- a/gcc/m2/mc-boot/GFIO.cc +++ b/gcc/m2/mc-boot/GFIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -95,7 +96,7 @@ struct FIO_NameInfo_r { }; struct FIO_buf_r { - unsigned int valid; + bool valid; long int bufstart; unsigned int position; void *address; @@ -111,7 +112,7 @@ struct FIO_fds_r { FIO_NameInfo name; FIO_FileStatus state; FIO_FileUsage usage; - unsigned int output; + bool output; FIO_Buffer buffer; long int abspos; }; @@ -123,17 +124,17 @@ static FIO_File Error; IsNoError - returns a TRUE if no error has occured on file, f. */ -extern "C" unsigned int FIO_IsNoError (FIO_File f); +extern "C" bool FIO_IsNoError (FIO_File f); /* IsActive - returns TRUE if the file, f, is still active. */ -extern "C" unsigned int FIO_IsActive (FIO_File f); -extern "C" unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high); +extern "C" bool FIO_IsActive (FIO_File f); +extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high); extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high); extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_high); -extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile); +extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile); /* Close - close a file which has been previously opened using: @@ -147,7 +148,7 @@ extern "C" void FIO_Close (FIO_File f); exists - returns TRUE if a file named, fname exists for reading. */ -extern "C" unsigned int FIO_exists (void * fname, unsigned int flength); +extern "C" bool FIO_exists (void * fname, unsigned int flength); /* openToRead - attempts to open a file, fname, for reading and @@ -176,7 +177,7 @@ extern "C" FIO_File FIO_openToWrite (void * fname, unsigned int flength); opened for writing or reading. */ -extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile); +extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile); /* FlushBuffer - flush contents of file, f. @@ -229,20 +230,20 @@ extern "C" void FIO_WriteChar (FIO_File f, char ch); EOF - tests to see whether a file, f, has reached end of file. */ -extern "C" unsigned int FIO_EOF (FIO_File f); +extern "C" bool FIO_EOF (FIO_File f); /* EOLN - tests to see whether a file, f, is upon a newline. It does NOT consume the newline. */ -extern "C" unsigned int FIO_EOLN (FIO_File f); +extern "C" bool FIO_EOLN (FIO_File f); /* WasEOLN - tests to see whether a file, f, has just seen a newline. */ -extern "C" unsigned int FIO_WasEOLN (FIO_File f); +extern "C" bool FIO_WasEOLN (FIO_File f); /* ReadChar - returns a character read from file f. @@ -381,13 +382,13 @@ static void SetState (FIO_File f, FIO_FileStatus s); InitializeFile - initialize a file descriptor */ -static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_FileUsage use, unsigned int towrite, unsigned int buflength); +static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_FileUsage use, bool towrite, unsigned int buflength); /* ConnectToUnix - connects a FIO file to a UNIX file descriptor. */ -static void ConnectToUnix (FIO_File f, unsigned int towrite, unsigned int newfile); +static void ConnectToUnix (FIO_File f, bool towrite, bool newfile); /* ReadFromBuffer - attempts to read, nBytes, from file, f. @@ -456,7 +457,7 @@ static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned c opened for read/write. */ -static void CheckAccess (FIO_File f, FIO_FileUsage use, unsigned int towrite); +static void CheckAccess (FIO_File f, FIO_FileUsage use, bool towrite); /* SetEndOfLine - @@ -478,7 +479,7 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a); PreInitialize - preinitialize the file descriptor. */ -static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, unsigned int towrite, int osfd, unsigned int bufsize); +static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, bool towrite, int osfd, unsigned int bufsize); /* Init - initialize the modules, global variables. @@ -577,7 +578,7 @@ static void SetState (FIO_File f, FIO_FileStatus s) InitializeFile - initialize a file descriptor */ -static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_FileUsage use, unsigned int towrite, unsigned int buflength) +static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_FileUsage use, bool towrite, unsigned int buflength) { FIO_PtrToChar p; FIO_FileDescriptor fd; @@ -615,7 +616,7 @@ static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, } else { - fd->buffer->valid = FALSE; + fd->buffer->valid = false; fd->buffer->bufstart = 0; fd->buffer->size = buflength; fd->buffer->position = 0; @@ -655,7 +656,7 @@ static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, ConnectToUnix - connects a FIO file to a UNIX file descriptor. */ -static void ConnectToUnix (FIO_File f, unsigned int towrite, unsigned int newfile) +static void ConnectToUnix (FIO_File f, bool towrite, bool newfile) { FIO_FileDescriptor fd; @@ -761,7 +762,7 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes) /* now disable the buffer as we read directly into, a. */ if (fd->buffer != NULL) { - fd->buffer->valid = FALSE; + fd->buffer->valid = false; } } else @@ -778,7 +779,7 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes) /* indicate buffer is empty */ if (fd->buffer != NULL) { - fd->buffer->valid = FALSE; + fd->buffer->valid = false; fd->buffer->left = 0; fd->buffer->position = 0; if (fd->buffer->address != NULL) @@ -864,7 +865,7 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) if (n >= 0) { /* avoid dangling else. */ - fd->buffer->valid = TRUE; + fd->buffer->valid = true; fd->buffer->position = 0; fd->buffer->left = n; fd->buffer->filled = n; @@ -879,7 +880,7 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) } else { - fd->buffer->valid = FALSE; + fd->buffer->valid = false; fd->buffer->position = 0; fd->buffer->left = 0; fd->buffer->filled = 0; @@ -1138,7 +1139,7 @@ static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned c opened for read/write. */ -static void CheckAccess (FIO_File f, FIO_FileUsage use, unsigned int towrite) +static void CheckAccess (FIO_File f, FIO_FileUsage use, bool towrite) { FIO_FileDescriptor fd; @@ -1212,7 +1213,7 @@ static void SetEndOfLine (FIO_File f, char ch) { FIO_FileDescriptor fd; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); if (f != Error) { fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f)); @@ -1307,7 +1308,7 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) PreInitialize - preinitialize the file descriptor. */ -static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, unsigned int towrite, int osfd, unsigned int bufsize) +static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, bool towrite, int osfd, unsigned int bufsize) { FIO_FileDescriptor fd; FIO_FileDescriptor fe; @@ -1353,13 +1354,13 @@ static void Init (void) { FileInfo = Indexing_InitIndex (0); Error = 0; - PreInitialize (Error, (const char *) "error", 5, FIO_toomanyfilesopen, FIO_unused, FALSE, -1, 0); + PreInitialize (Error, (const char *) "error", 5, FIO_toomanyfilesopen, FIO_unused, false, -1, 0); FIO_StdIn = 1; - PreInitialize (FIO_StdIn, (const char *) "<stdin>", 7, FIO_successful, FIO_openedforread, FALSE, 0, MaxBufferLength); + PreInitialize (FIO_StdIn, (const char *) "<stdin>", 7, FIO_successful, FIO_openedforread, false, 0, MaxBufferLength); FIO_StdOut = 2; - PreInitialize (FIO_StdOut, (const char *) "<stdout>", 8, FIO_successful, FIO_openedforwrite, TRUE, 1, MaxBufferLength); + PreInitialize (FIO_StdOut, (const char *) "<stdout>", 8, FIO_successful, FIO_openedforwrite, true, 1, MaxBufferLength); FIO_StdErr = 3; - PreInitialize (FIO_StdErr, (const char *) "<stderr>", 8, FIO_successful, FIO_openedforwrite, TRUE, 2, MaxBufferLength); + PreInitialize (FIO_StdErr, (const char *) "<stderr>", 8, FIO_successful, FIO_openedforwrite, true, 2, MaxBufferLength); if (! (M2RTS_InstallTerminationProcedure ((PROC ) {(PROC_t) FIO_FlushOutErr}))) { M2RTS_HALT (-1); @@ -1372,13 +1373,13 @@ static void Init (void) IsNoError - returns a TRUE if no error has occured on file, f. */ -extern "C" unsigned int FIO_IsNoError (FIO_File f) +extern "C" bool FIO_IsNoError (FIO_File f) { FIO_FileDescriptor fd; if (f == Error) { - return FALSE; + return false; } else { @@ -1394,11 +1395,11 @@ extern "C" unsigned int FIO_IsNoError (FIO_File f) IsActive - returns TRUE if the file, f, is still active. */ -extern "C" unsigned int FIO_IsActive (FIO_File f) +extern "C" bool FIO_IsActive (FIO_File f) { if (f == Error) { - return FALSE; + return false; } else { @@ -1408,7 +1409,7 @@ extern "C" unsigned int FIO_IsActive (FIO_File f) __builtin_unreachable (); } -extern "C" unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high) +extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high) { char fname[_fname_high+1]; @@ -1447,7 +1448,7 @@ extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_hig __builtin_unreachable (); } -extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile) +extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile) { char fname[_fname_high+1]; @@ -1511,7 +1512,7 @@ extern "C" void FIO_Close (FIO_File f) exists - returns TRUE if a file named, fname exists for reading. */ -extern "C" unsigned int FIO_exists (void * fname, unsigned int flength) +extern "C" bool FIO_exists (void * fname, unsigned int flength) { FIO_File f; @@ -1519,12 +1520,12 @@ extern "C" unsigned int FIO_exists (void * fname, unsigned int flength) if (FIO_IsNoError (f)) { FIO_Close (f); - return TRUE; + return true; } else { FIO_Close (f); - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -1549,8 +1550,8 @@ extern "C" FIO_File FIO_openToRead (void * fname, unsigned int flength) } else { - f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforread, FALSE, MaxBufferLength); - ConnectToUnix (f, FALSE, FALSE); + f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforread, false, MaxBufferLength); + ConnectToUnix (f, false, false); } return f; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1576,8 +1577,8 @@ extern "C" FIO_File FIO_openToWrite (void * fname, unsigned int flength) } else { - f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforwrite, TRUE, MaxBufferLength); - ConnectToUnix (f, TRUE, TRUE); + f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforwrite, true, MaxBufferLength); + ConnectToUnix (f, true, true); } return f; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1594,7 +1595,7 @@ extern "C" FIO_File FIO_openToWrite (void * fname, unsigned int flength) opened for writing or reading. */ -extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile) +extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile) { FIO_File f; @@ -1663,7 +1664,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * if (f != Error) { - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); n = ReadFromBuffer (f, dest, nBytes); if (n <= 0) { @@ -1694,7 +1695,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high) { - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high))) { SetEndOfLine (f, static_cast<char> (a[_a_high])); @@ -1715,7 +1716,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * int total; FIO_FileDescriptor fd; - CheckAccess (f, FIO_openedforwrite, TRUE); + CheckAccess (f, FIO_openedforwrite, true); FIO_FlushBuffer (f); if (f != Error) { @@ -1753,7 +1754,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high) { - CheckAccess (f, FIO_openedforwrite, TRUE); + CheckAccess (f, FIO_openedforwrite, true); if ((BufferedWrite (f, _a_high, a)) == ((int ) (_a_high))) {} /* empty. */ } @@ -1765,7 +1766,7 @@ extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high extern "C" void FIO_WriteChar (FIO_File f, char ch) { - CheckAccess (f, FIO_openedforwrite, TRUE); + CheckAccess (f, FIO_openedforwrite, true); if ((BufferedWrite (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch)))) {} /* empty. */ } @@ -1775,11 +1776,11 @@ extern "C" void FIO_WriteChar (FIO_File f, char ch) EOF - tests to see whether a file, f, has reached end of file. */ -extern "C" unsigned int FIO_EOF (FIO_File f) +extern "C" bool FIO_EOF (FIO_File f) { FIO_FileDescriptor fd; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); if (f != Error) { fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f)); @@ -1788,7 +1789,7 @@ extern "C" unsigned int FIO_EOF (FIO_File f) return fd->state == FIO_endoffile; } } - return TRUE; + return true; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1799,12 +1800,12 @@ extern "C" unsigned int FIO_EOF (FIO_File f) It does NOT consume the newline. */ -extern "C" unsigned int FIO_EOLN (FIO_File f) +extern "C" bool FIO_EOLN (FIO_File f) { char ch; FIO_FileDescriptor fd; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); /* we will read a character and then push it back onto the input stream, having noted the file status, we also reset the status. @@ -1825,7 +1826,7 @@ extern "C" unsigned int FIO_EOLN (FIO_File f) } } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1835,14 +1836,14 @@ extern "C" unsigned int FIO_EOLN (FIO_File f) WasEOLN - tests to see whether a file, f, has just seen a newline. */ -extern "C" unsigned int FIO_WasEOLN (FIO_File f) +extern "C" bool FIO_WasEOLN (FIO_File f) { FIO_FileDescriptor fd; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); if (f == Error) { - return FALSE; + return false; } else { @@ -1864,7 +1865,7 @@ extern "C" char FIO_ReadChar (FIO_File f) { char ch; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); if ((BufferedRead (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch)))) { SetEndOfLine (f, ch); @@ -1897,7 +1898,7 @@ extern "C" void FIO_UnReadChar (FIO_File f, char ch) void * a; void * b; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); if (f != Error) { fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f)); @@ -1987,7 +1988,7 @@ extern "C" void FIO_ReadString (FIO_File f, char *a, unsigned int _a_high) unsigned int i; char ch; - CheckAccess (f, FIO_openedforread, FALSE); + CheckAccess (f, FIO_openedforread, false); high = _a_high; i = 0; do { @@ -2078,7 +2079,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos) { /* always force the lseek, until we are confident that abspos is always correct, basically it needs some hard testing before we should remove the OR TRUE. */ - if ((fd->abspos != pos) || TRUE) + if ((fd->abspos != pos) || true) { FIO_FlushBuffer (f); if (fd->buffer != NULL) @@ -2106,7 +2107,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos) } if (fd->buffer != NULL) { - fd->buffer->valid = FALSE; + fd->buffer->valid = false; fd->buffer->bufstart = fd->abspos; } } @@ -2156,7 +2157,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos) } if (fd->buffer != NULL) { - fd->buffer->valid = FALSE; + fd->buffer->valid = false; fd->buffer->bufstart = offset; } } diff --git a/gcc/m2/mc-boot/GFIO.h b/gcc/m2/mc-boot/GFIO.h index 9562283..a4a9e40 100644 --- a/gcc/m2/mc-boot/GFIO.h +++ b/gcc/m2/mc-boot/GFIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -58,19 +59,19 @@ EXTERN FIO_File FIO_StdErr; IsNoError - returns a TRUE if no error has occured on file, f. */ -EXTERN unsigned int FIO_IsNoError (FIO_File f); +EXTERN bool FIO_IsNoError (FIO_File f); /* IsActive - returns TRUE if the file, f, is still active. */ -EXTERN unsigned int FIO_IsActive (FIO_File f); +EXTERN bool FIO_IsActive (FIO_File f); /* Exists - returns TRUE if a file named, fname exists for reading. */ -EXTERN unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high); +EXTERN bool FIO_Exists (const char *fname_, unsigned int _fname_high); /* OpenToRead - attempts to open a file, fname, for reading and @@ -104,7 +105,7 @@ EXTERN FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_high); and modify an existing file. */ -EXTERN FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile); +EXTERN FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile); /* Close - close a file which has been previously opened using: @@ -113,10 +114,10 @@ EXTERN FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, */ EXTERN void FIO_Close (FIO_File f); -EXTERN unsigned int FIO_exists (void * fname, unsigned int flength); +EXTERN bool FIO_exists (void * fname, unsigned int flength); EXTERN FIO_File FIO_openToRead (void * fname, unsigned int flength); EXTERN FIO_File FIO_openToWrite (void * fname, unsigned int flength); -EXTERN FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile); +EXTERN FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile); /* FlushBuffer - flush contents of the FIO file, f, to libc. @@ -169,7 +170,7 @@ EXTERN void FIO_WriteChar (FIO_File f, char ch); EOF - tests to see whether a file, f, has reached end of file. */ -EXTERN unsigned int FIO_EOF (FIO_File f); +EXTERN bool FIO_EOF (FIO_File f); /* EOLN - tests to see whether a file, f, is about to read a newline. @@ -177,14 +178,14 @@ EXTERN unsigned int FIO_EOF (FIO_File f); and then immediately unreads the character. */ -EXTERN unsigned int FIO_EOLN (FIO_File f); +EXTERN bool FIO_EOLN (FIO_File f); /* WasEOLN - tests to see whether a file, f, has just read a newline character. */ -EXTERN unsigned int FIO_WasEOLN (FIO_File f); +EXTERN bool FIO_WasEOLN (FIO_File f); /* ReadChar - returns a character read from file, f. diff --git a/gcc/m2/mc-boot/GFormatStrings.cc b/gcc/m2/mc-boot/GFormatStrings.cc index 78e7a5a..b8d0f92 100644 --- a/gcc/m2/mc-boot/GFormatStrings.cc +++ b/gcc/m2/mc-boot/GFormatStrings.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -124,7 +125,7 @@ static void DSdbExit (DynamicStrings_String s); IsDigit - returns TRUE if ch lies in the range: 0..9 */ -static unsigned int IsDigit (char ch); +static bool IsDigit (char ch); /* Cast - casts a := b @@ -136,7 +137,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b isHex - */ -static unsigned int isHex (char ch); +static bool isHex (char ch); /* toHex - @@ -154,7 +155,7 @@ static unsigned int toOct (char ch); isOct - */ -static unsigned int isOct (char ch); +static bool isOct (char ch); /* FormatString - returns a String containing, s, together with encapsulated @@ -203,7 +204,7 @@ static void doDSdbEnter (void) static void doDSdbExit (DynamicStrings_String s) { - s = DynamicStrings_PopAllocationExemption (TRUE, s); + s = DynamicStrings_PopAllocationExemption (true, s); } @@ -229,7 +230,7 @@ static void DSdbExit (DynamicStrings_String s) IsDigit - returns TRUE if ch lies in the range: 0..9 */ -static unsigned int IsDigit (char ch) +static bool IsDigit (char ch) { return (ch >= '0') && (ch <= '9'); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -268,7 +269,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b isHex - */ -static unsigned int isHex (char ch) +static bool isHex (char ch) { return (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'F'))) || ((ch >= 'a') && (ch <= 'f')); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -317,7 +318,7 @@ static unsigned int toOct (char ch) isOct - */ -static unsigned int isOct (char ch) +static bool isOct (char ch) { return (ch >= '0') && (ch <= '8'); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -363,7 +364,7 @@ static DynamicStrings_String FormatString (DynamicStrings_String fmt, int *start static DynamicStrings_String PerformFormatString (DynamicStrings_String fmt, int *startpos, DynamicStrings_String in, const unsigned char *w_, unsigned int _w_high) { - unsigned int left; + bool left; unsigned int u; int c; int width; @@ -388,12 +389,12 @@ static DynamicStrings_String PerformFormatString (DynamicStrings_String fmt, int afterperc += 1; if ((DynamicStrings_char (fmt, afterperc)) == '-') { - left = TRUE; + left = true; afterperc += 1; } else { - left = FALSE; + left = false; } ch = DynamicStrings_char (fmt, afterperc); if (ch == '0') @@ -454,7 +455,7 @@ static DynamicStrings_String PerformFormatString (DynamicStrings_String fmt, int afterperc += 1; Cast ((unsigned char *) &c, (sizeof (c)-1), (const unsigned char *) w, _w_high); in = Copy (fmt, in, (*startpos), nextperc); - in = DynamicStrings_ConCat (in, StringConvert_IntegerToString (c, static_cast<unsigned int> (width), leader, FALSE, 10, FALSE)); + in = DynamicStrings_ConCat (in, StringConvert_IntegerToString (c, static_cast<unsigned int> (width), leader, false, 10, false)); (*startpos) = afterperc; DSdbExit (static_cast<DynamicStrings_String> (NULL)); return in; @@ -465,7 +466,7 @@ static DynamicStrings_String PerformFormatString (DynamicStrings_String fmt, int afterperc += 1; Cast ((unsigned char *) &u, (sizeof (u)-1), (const unsigned char *) w, _w_high); in = DynamicStrings_ConCat (in, DynamicStrings_Slice (fmt, (*startpos), nextperc)); - in = DynamicStrings_ConCat (in, StringConvert_CardinalToString (u, static_cast<unsigned int> (width), leader, 16, TRUE)); + in = DynamicStrings_ConCat (in, StringConvert_CardinalToString (u, static_cast<unsigned int> (width), leader, 16, true)); (*startpos) = afterperc; DSdbExit (static_cast<DynamicStrings_String> (NULL)); return in; @@ -476,7 +477,7 @@ static DynamicStrings_String PerformFormatString (DynamicStrings_String fmt, int afterperc += 1; Cast ((unsigned char *) &u, (sizeof (u)-1), (const unsigned char *) w, _w_high); in = DynamicStrings_ConCat (in, DynamicStrings_Slice (fmt, (*startpos), nextperc)); - in = DynamicStrings_ConCat (in, StringConvert_CardinalToString (u, static_cast<unsigned int> (width), leader, 10, FALSE)); + in = DynamicStrings_ConCat (in, StringConvert_CardinalToString (u, static_cast<unsigned int> (width), leader, 10, false)); (*startpos) = afterperc; DSdbExit (static_cast<DynamicStrings_String> (NULL)); return in; diff --git a/gcc/m2/mc-boot/GFormatStrings.h b/gcc/m2/mc-boot/GFormatStrings.h index 69137fa..0e90b55 100644 --- a/gcc/m2/mc-boot/GFormatStrings.h +++ b/gcc/m2/mc-boot/GFormatStrings.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GFpuIO.cc b/gcc/m2/mc-boot/GFpuIO.cc index 205c27b..ab45ed4 100644 --- a/gcc/m2/mc-boot/GFpuIO.cc +++ b/gcc/m2/mc-boot/GFpuIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -231,7 +232,7 @@ extern "C" void FpuIO_WriteLongReal (long double x, unsigned int TotalWidth, uns extern "C" void FpuIO_StrToLongReal (const char *a_, unsigned int _a_high, long double *x) { - unsigned int found; + bool found; DynamicStrings_String s; char a[_a_high+1]; @@ -301,7 +302,7 @@ extern "C" void FpuIO_WriteLongInt (long int x, unsigned int n) extern "C" void FpuIO_StrToLongInt (const char *a_, unsigned int _a_high, long int *x) { DynamicStrings_String s; - unsigned int found; + bool found; char a[_a_high+1]; /* make a local copy of each unbounded array. */ @@ -322,7 +323,7 @@ extern "C" void FpuIO_LongIntToStr (long int x, unsigned int n, char *a, unsigne { DynamicStrings_String s; - s = StringConvert_LongIntegerToString (x, n, ' ', FALSE, 10, TRUE); + s = StringConvert_LongIntegerToString (x, n, ' ', false, 10, true); DynamicStrings_CopyOut ((char *) a, _a_high, s); s = DynamicStrings_KillString (s); } diff --git a/gcc/m2/mc-boot/GFpuIO.h b/gcc/m2/mc-boot/GFpuIO.h index d1a0e73..631f09b 100644 --- a/gcc/m2/mc-boot/GFpuIO.h +++ b/gcc/m2/mc-boot/GFpuIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GIO.cc b/gcc/m2/mc-boot/GIO.cc index e56c743..feaf27d 100644 --- a/gcc/m2/mc-boot/GIO.cc +++ b/gcc/m2/mc-boot/GIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -58,8 +59,8 @@ typedef struct IO_BasicFds_r IO_BasicFds; typedef struct IO__T1_a IO__T1; struct IO_BasicFds_r { - unsigned int IsEof; - unsigned int IsRaw; + bool IsEof; + bool IsRaw; }; struct IO__T1_a { IO_BasicFds array[MaxDefaultFd+1]; }; @@ -84,8 +85,8 @@ extern "C" void IO_Write (char ch); */ extern "C" void IO_Error (char ch); -extern "C" void IO_UnBufferedMode (int fd, unsigned int input); -extern "C" void IO_BufferedMode (int fd, unsigned int input); +extern "C" void IO_UnBufferedMode (int fd, bool input); +extern "C" void IO_BufferedMode (int fd, bool input); /* EchoOn - turns on echoing for file descriptor, fd. This @@ -94,7 +95,7 @@ extern "C" void IO_BufferedMode (int fd, unsigned int input); which is attached to a particular piece of hardware. */ -extern "C" void IO_EchoOn (int fd, unsigned int input); +extern "C" void IO_EchoOn (int fd, bool input); /* EchoOff - turns off echoing for file descriptor, fd. This @@ -103,13 +104,13 @@ extern "C" void IO_EchoOn (int fd, unsigned int input); which is attached to a particular piece of hardware. */ -extern "C" void IO_EchoOff (int fd, unsigned int input); +extern "C" void IO_EchoOff (int fd, bool input); /* IsDefaultFd - returns TRUE if, fd, is 0, 1 or 2. */ -static unsigned int IsDefaultFd (int fd); +static bool IsDefaultFd (int fd); /* doWrite - performs the write of a single character, ch, @@ -122,7 +123,7 @@ static void doWrite (int fd, FIO_File f, char ch); setFlag - sets or unsets the appropriate flag in, t. */ -static void setFlag (termios_TERMIOS t, termios_Flag f, unsigned int b); +static void setFlag (termios_TERMIOS t, termios_Flag f, bool b); /* doraw - sets all the flags associated with making this @@ -149,7 +150,7 @@ static void Init (void); IsDefaultFd - returns TRUE if, fd, is 0, 1 or 2. */ -static unsigned int IsDefaultFd (int fd) +static bool IsDefaultFd (int fd) { return (fd <= MaxDefaultFd) && (fd >= 0); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -184,7 +185,7 @@ static void doWrite (int fd, FIO_File f, char ch) r = errno_geterrno (); if ((r != errno_EAGAIN) && (r != errno_EINTR)) { - fdState.array[fd].IsEof = TRUE; + fdState.array[fd].IsEof = true; return ; } } @@ -202,7 +203,7 @@ static void doWrite (int fd, FIO_File f, char ch) setFlag - sets or unsets the appropriate flag in, t. */ -static void setFlag (termios_TERMIOS t, termios_Flag f, unsigned int b) +static void setFlag (termios_TERMIOS t, termios_Flag f, bool b) { if (termios_SetFlag (t, f, b)) {} /* empty. */ @@ -225,22 +226,22 @@ static void doraw (termios_TERMIOS term) * termios_p->c_cflag &= ~(CSIZE | PARENB); * termios_p->c_cflag |= CS8; */ - setFlag (term, termios_ignbrk, FALSE); - setFlag (term, termios_ibrkint, FALSE); - setFlag (term, termios_iparmrk, FALSE); - setFlag (term, termios_istrip, FALSE); - setFlag (term, termios_inlcr, FALSE); - setFlag (term, termios_igncr, FALSE); - setFlag (term, termios_icrnl, FALSE); - setFlag (term, termios_ixon, FALSE); - setFlag (term, termios_opost, FALSE); - setFlag (term, termios_lecho, FALSE); - setFlag (term, termios_lechonl, FALSE); - setFlag (term, termios_licanon, FALSE); - setFlag (term, termios_lisig, FALSE); - setFlag (term, termios_liexten, FALSE); - setFlag (term, termios_parenb, FALSE); - setFlag (term, termios_cs8, TRUE); + setFlag (term, termios_ignbrk, false); + setFlag (term, termios_ibrkint, false); + setFlag (term, termios_iparmrk, false); + setFlag (term, termios_istrip, false); + setFlag (term, termios_inlcr, false); + setFlag (term, termios_igncr, false); + setFlag (term, termios_icrnl, false); + setFlag (term, termios_ixon, false); + setFlag (term, termios_opost, false); + setFlag (term, termios_lecho, false); + setFlag (term, termios_lechonl, false); + setFlag (term, termios_licanon, false); + setFlag (term, termios_lisig, false); + setFlag (term, termios_liexten, false); + setFlag (term, termios_parenb, false); + setFlag (term, termios_cs8, true); } @@ -262,20 +263,20 @@ static void dononraw (termios_TERMIOS term) * termios_p->c_cflag &= ~(CSIZE | PARENB); * termios_p->c_cflag |= CS8; */ - setFlag (term, termios_ignbrk, TRUE); - setFlag (term, termios_ibrkint, TRUE); - setFlag (term, termios_iparmrk, TRUE); - setFlag (term, termios_istrip, TRUE); - setFlag (term, termios_inlcr, TRUE); - setFlag (term, termios_igncr, TRUE); - setFlag (term, termios_icrnl, TRUE); - setFlag (term, termios_ixon, TRUE); - setFlag (term, termios_opost, TRUE); - setFlag (term, termios_lecho, TRUE); - setFlag (term, termios_lechonl, TRUE); - setFlag (term, termios_licanon, TRUE); - setFlag (term, termios_lisig, TRUE); - setFlag (term, termios_liexten, TRUE); + setFlag (term, termios_ignbrk, true); + setFlag (term, termios_ibrkint, true); + setFlag (term, termios_iparmrk, true); + setFlag (term, termios_istrip, true); + setFlag (term, termios_inlcr, true); + setFlag (term, termios_igncr, true); + setFlag (term, termios_icrnl, true); + setFlag (term, termios_ixon, true); + setFlag (term, termios_opost, true); + setFlag (term, termios_lecho, true); + setFlag (term, termios_lechonl, true); + setFlag (term, termios_licanon, true); + setFlag (term, termios_lisig, true); + setFlag (term, termios_liexten, true); } @@ -285,12 +286,12 @@ static void dononraw (termios_TERMIOS term) static void Init (void) { - fdState.array[0].IsEof = FALSE; - fdState.array[0].IsRaw = FALSE; - fdState.array[1].IsEof = FALSE; - fdState.array[1].IsRaw = FALSE; - fdState.array[2].IsEof = FALSE; - fdState.array[2].IsRaw = FALSE; + fdState.array[0].IsEof = false; + fdState.array[0].IsRaw = false; + fdState.array[1].IsEof = false; + fdState.array[1].IsRaw = false; + fdState.array[2].IsEof = false; + fdState.array[2].IsRaw = false; } @@ -325,7 +326,7 @@ extern "C" void IO_Read (char *ch) r = errno_geterrno (); if (r != errno_EAGAIN) { - fdState.array[0].IsEof = TRUE; + fdState.array[0].IsEof = true; (*ch) = ASCII_eof; return ; } @@ -361,14 +362,14 @@ extern "C" void IO_Error (char ch) doWrite (2, FIO_StdErr, ch); } -extern "C" void IO_UnBufferedMode (int fd, unsigned int input) +extern "C" void IO_UnBufferedMode (int fd, bool input) { termios_TERMIOS term; int result; if (IsDefaultFd (fd)) { - fdState.array[fd].IsRaw = TRUE; + fdState.array[fd].IsRaw = true; } term = termios_InitTermios (); if ((termios_tcgetattr (fd, term)) == 0) @@ -386,14 +387,14 @@ extern "C" void IO_UnBufferedMode (int fd, unsigned int input) term = termios_KillTermios (term); } -extern "C" void IO_BufferedMode (int fd, unsigned int input) +extern "C" void IO_BufferedMode (int fd, bool input) { termios_TERMIOS term; int r; if (IsDefaultFd (fd)) { - fdState.array[fd].IsRaw = FALSE; + fdState.array[fd].IsRaw = false; } term = termios_InitTermios (); if ((termios_tcgetattr (fd, term)) == 0) @@ -419,7 +420,7 @@ extern "C" void IO_BufferedMode (int fd, unsigned int input) which is attached to a particular piece of hardware. */ -extern "C" void IO_EchoOn (int fd, unsigned int input) +extern "C" void IO_EchoOn (int fd, bool input) { termios_TERMIOS term; int result; @@ -427,7 +428,7 @@ extern "C" void IO_EchoOn (int fd, unsigned int input) term = termios_InitTermios (); if ((termios_tcgetattr (fd, term)) == 0) { - setFlag (term, termios_lecho, TRUE); + setFlag (term, termios_lecho, true); if (input) { result = termios_tcsetattr (fd, termios_tcsflush (), term); @@ -448,7 +449,7 @@ extern "C" void IO_EchoOn (int fd, unsigned int input) which is attached to a particular piece of hardware. */ -extern "C" void IO_EchoOff (int fd, unsigned int input) +extern "C" void IO_EchoOff (int fd, bool input) { termios_TERMIOS term; int result; @@ -456,7 +457,7 @@ extern "C" void IO_EchoOff (int fd, unsigned int input) term = termios_InitTermios (); if ((termios_tcgetattr (fd, term)) == 0) { - setFlag (term, termios_lecho, FALSE); + setFlag (term, termios_lecho, false); if (input) { result = termios_tcsetattr (fd, termios_tcsflush (), term); diff --git a/gcc/m2/mc-boot/GIO.h b/gcc/m2/mc-boot/GIO.h index c9775d2..6604ee1 100644 --- a/gcc/m2/mc-boot/GIO.h +++ b/gcc/m2/mc-boot/GIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -55,13 +56,13 @@ EXTERN void IO_Error (char ch); UnBufferedMode - places file descriptor, fd, into an unbuffered mode. */ -EXTERN void IO_UnBufferedMode (int fd, unsigned int input); +EXTERN void IO_UnBufferedMode (int fd, bool input); /* BufferedMode - places file descriptor, fd, into a buffered mode. */ -EXTERN void IO_BufferedMode (int fd, unsigned int input); +EXTERN void IO_BufferedMode (int fd, bool input); /* EchoOn - turns on echoing for file descriptor, fd. This @@ -70,7 +71,7 @@ EXTERN void IO_BufferedMode (int fd, unsigned int input); which is attached to a particular piece of hardware. */ -EXTERN void IO_EchoOn (int fd, unsigned int input); +EXTERN void IO_EchoOn (int fd, bool input); /* EchoOff - turns off echoing for file descriptor, fd. This @@ -79,7 +80,7 @@ EXTERN void IO_EchoOn (int fd, unsigned int input); which is attached to a particular piece of hardware. */ -EXTERN void IO_EchoOff (int fd, unsigned int input); +EXTERN void IO_EchoOff (int fd, bool input); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GIndexing.cc b/gcc/m2/mc-boot/GIndexing.cc index 0817ff3..4c8e7f6 100644 --- a/gcc/m2/mc-boot/GIndexing.cc +++ b/gcc/m2/mc-boot/GIndexing.cc @@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -70,7 +71,7 @@ struct Indexing__T2_r { unsigned int Used; unsigned int Low; unsigned int High; - unsigned int Debug; + bool Debug; unsigned int Map; }; @@ -98,7 +99,7 @@ extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i); of the dynamic array. */ -extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n); +extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n); /* HighIndice - returns the last legally accessible indice of this array. @@ -128,7 +129,7 @@ extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n); IsIndiceInIndex - returns TRUE if, a, is in the index, i. */ -extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a); +extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a); /* RemoveIndiceFromIndex - removes, a, from Index, i. @@ -170,7 +171,7 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low) i->ArraySize = MinSize; Storage_ALLOCATE (&i->ArrayStart, MinSize); i->ArrayStart = libc_memset (i->ArrayStart, 0, static_cast<size_t> (i->ArraySize)); - i->Debug = FALSE; + i->Debug = false; i->Used = 0; i->Map = (unsigned int) 0; return i; @@ -199,7 +200,7 @@ extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i) extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i) { - i->Debug = TRUE; + i->Debug = true; return i; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -211,7 +212,7 @@ extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i) of the dynamic array. */ -extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n) +extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n) { if (i == NULL) { @@ -363,7 +364,7 @@ extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n) IsIndiceInIndex - returns TRUE if, a, is in the index, i. */ -extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a) +extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a) { unsigned int j; Indexing_PtrToByte b; @@ -376,13 +377,13 @@ extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a) p = (Indexing_PtrToAddress) (b); if ((*p) == a) { - return TRUE; + return true; } /* we must not INC(p, ..) as p2c gets confused */ b += sizeof (void *); j += 1; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GIndexing.h b/gcc/m2/mc-boot/GIndexing.h index c94a986..9c8bdc7 100644 --- a/gcc/m2/mc-boot/GIndexing.h +++ b/gcc/m2/mc-boot/GIndexing.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -77,7 +78,7 @@ EXTERN Indexing_Index Indexing_DebugIndex (Indexing_Index i); of the dynamic array. */ -EXTERN unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n); +EXTERN bool Indexing_InBounds (Indexing_Index i, unsigned int n); /* HighIndice - returns the last legally accessible indice of this array. @@ -107,7 +108,7 @@ EXTERN void * Indexing_GetIndice (Indexing_Index i, unsigned int n); IsIndiceInIndex - returns TRUE if, a, is in the index, i. */ -EXTERN unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a); +EXTERN bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a); /* RemoveIndiceFromIndex - removes, a, from Index, i. diff --git a/gcc/m2/mc-boot/GM2Dependent.cc b/gcc/m2/mc-boot/GM2Dependent.cc index 64441ff..23fb28d 100644 --- a/gcc/m2/mc-boot/GM2Dependent.cc +++ b/gcc/m2/mc-boot/GM2Dependent.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -74,9 +75,9 @@ struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; }; struct M2Dependent_DependencyList_r { PROC proc; - unsigned int forced; - unsigned int forc; - unsigned int appl; + bool forced; + bool forc; + bool appl; M2Dependent_DependencyState state; }; @@ -92,14 +93,14 @@ struct M2Dependent__T2_r { }; static M2Dependent__T3 Modules; -static unsigned int Initialized; -static unsigned int WarningTrace; -static unsigned int ModuleTrace; -static unsigned int HexTrace; -static unsigned int DependencyTrace; -static unsigned int PreTrace; -static unsigned int PostTrace; -static unsigned int ForceTrace; +static bool Initialized; +static bool WarningTrace; +static bool ModuleTrace; +static bool HexTrace; +static bool DependencyTrace; +static bool PreTrace; +static bool PostTrace; +static bool ForceTrace; /* ConstructModules - resolve dependencies and then call each @@ -154,7 +155,7 @@ static void RemoveModule (M2Dependent_ModuleChain *head, M2Dependent_ModuleChain onChain - returns TRUE if mptr is on the Modules[state] list. */ -static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr); +static bool onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr); /* max - @@ -213,19 +214,19 @@ static int strlen_ (M2LINK_PtrToChar string); traceprintf - wrap printf with a boolean flag. */ -static void traceprintf (unsigned int flag, const char *str_, unsigned int _str_high); +static void traceprintf (bool flag, const char *str_, unsigned int _str_high); /* traceprintf2 - wrap printf with a boolean flag. */ -static void traceprintf2 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg); +static void traceprintf2 (bool flag, const char *str_, unsigned int _str_high, void * arg); /* traceprintf3 - wrap printf with a boolean flag. */ -static void traceprintf3 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2); +static void traceprintf3 (bool flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2); /* moveTo - moves mptr to the new list determined by newstate. @@ -265,7 +266,7 @@ static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *de DumpModuleData - */ -static void DumpModuleData (unsigned int flag); +static void DumpModuleData (bool flag); /* combine - dest := src + dest. Places src at the front of list dest. @@ -280,7 +281,7 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat tracemodule - */ -static void tracemodule (unsigned int flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen); +static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen); /* ForceModule - @@ -312,7 +313,7 @@ static void warning3 (const char *format_, unsigned int _format_high, void * arg equal - return TRUE if C string cstr is equal to str. */ -static unsigned int equal (void * cstr, const char *str_, unsigned int _str_high); +static bool equal (void * cstr, const char *str_, unsigned int _str_high); /* SetupDebugFlags - By default assigns ModuleTrace, DependencyTrace, @@ -430,7 +431,7 @@ static void RemoveModule (M2Dependent_ModuleChain *head, M2Dependent_ModuleChain onChain - returns TRUE if mptr is on the Modules[state] list. */ -static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr) +static bool onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr) { M2Dependent_ModuleChain ptr; @@ -440,12 +441,12 @@ static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_Modu do { if (ptr == mptr) { - return TRUE; + return true; } ptr = ptr->next; } while (! (ptr == Modules.array[state-M2Dependent_unregistered])); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -663,7 +664,7 @@ static int strlen_ (M2LINK_PtrToChar string) traceprintf - wrap printf with a boolean flag. */ -static void traceprintf (unsigned int flag, const char *str_, unsigned int _str_high) +static void traceprintf (bool flag, const char *str_, unsigned int _str_high) { char str[_str_high+1]; @@ -682,7 +683,7 @@ static void traceprintf (unsigned int flag, const char *str_, unsigned int _str_ traceprintf2 - wrap printf with a boolean flag. */ -static void traceprintf2 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg) +static void traceprintf2 (bool flag, const char *str_, unsigned int _str_high, void * arg) { char ch; char str[_str_high+1]; @@ -707,7 +708,7 @@ static void traceprintf2 (unsigned int flag, const char *str_, unsigned int _str traceprintf3 - wrap printf with a boolean flag. */ -static void traceprintf3 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2) +static void traceprintf3 (bool flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2) { char ch; char str[_str_high+1]; @@ -907,7 +908,7 @@ static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *de DumpModuleData - */ -static void DumpModuleData (unsigned int flag) +static void DumpModuleData (bool flag) { M2Dependent_ModuleChain mptr; @@ -945,7 +946,7 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat tracemodule - */ -static void tracemodule (unsigned int flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen) +static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen) { typedef struct tracemodule__T4_a tracemodule__T4; @@ -981,7 +982,7 @@ static void ForceModule (void * modname, unsigned int modlen, void * libname, un mptr = LookupModuleN (M2Dependent_ordered, modname, modlen, libname, liblen); if (mptr != NULL) { - mptr->dependency.forced = TRUE; + mptr->dependency.forced = true; moveTo (M2Dependent_user, mptr); } } @@ -1115,7 +1116,7 @@ static void warning3 (const char *format_, unsigned int _format_high, void * arg equal - return TRUE if C string cstr is equal to str. */ -static unsigned int equal (void * cstr, const char *str_, unsigned int _str_high) +static bool equal (void * cstr, const char *str_, unsigned int _str_high) { char str[_str_high+1]; @@ -1153,67 +1154,67 @@ static void SetupDebugFlags (void) SetupDebugFlags__T1 pc; - ModuleTrace = FALSE; - DependencyTrace = FALSE; - PostTrace = FALSE; - PreTrace = FALSE; - ForceTrace = FALSE; - HexTrace = FALSE; - WarningTrace = FALSE; + ModuleTrace = false; + DependencyTrace = false; + PostTrace = false; + PreTrace = false; + ForceTrace = false; + HexTrace = false; + WarningTrace = false; pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("GCC_M2LINK_RTFLAG")))); while ((pc != NULL) && ((*pc) != ASCII_nul)) { if (equal (reinterpret_cast<void *> (pc), (const char *) "all", 3)) { - ModuleTrace = TRUE; - DependencyTrace = TRUE; - PreTrace = TRUE; - PostTrace = TRUE; - ForceTrace = TRUE; - HexTrace = TRUE; - WarningTrace = TRUE; + ModuleTrace = true; + DependencyTrace = true; + PreTrace = true; + PostTrace = true; + ForceTrace = true; + HexTrace = true; + WarningTrace = true; pc += 3; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "module", 6)) { /* avoid dangling else. */ - ModuleTrace = TRUE; + ModuleTrace = true; pc += 6; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "warning", 7)) { /* avoid dangling else. */ - WarningTrace = TRUE; + WarningTrace = true; pc += 7; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "hex", 3)) { /* avoid dangling else. */ - HexTrace = TRUE; + HexTrace = true; pc += 3; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "dep", 3)) { /* avoid dangling else. */ - DependencyTrace = TRUE; + DependencyTrace = true; pc += 3; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "pre", 3)) { /* avoid dangling else. */ - PreTrace = TRUE; + PreTrace = true; pc += 3; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "post", 4)) { /* avoid dangling else. */ - PostTrace = TRUE; + PostTrace = true; pc += 4; } else if (equal (reinterpret_cast<void *> (pc), (const char *) "force", 5)) { /* avoid dangling else. */ - ForceTrace = TRUE; + ForceTrace = true; pc += 5; } else @@ -1252,7 +1253,7 @@ static void CheckInitialized (void) { if (! Initialized) { - Initialized = TRUE; + Initialized = true; Init (); } } @@ -1273,7 +1274,7 @@ extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * l mptr = LookupModule (M2Dependent_unordered, applicationmodule, libname); if (mptr != NULL) { - mptr->dependency.appl = TRUE; + mptr->dependency.appl = true; } traceprintf (PreTrace, (const char *) "Pre resolving dependents\\n", 26); DumpModuleData (PreTrace); diff --git a/gcc/m2/mc-boot/GM2Dependent.h b/gcc/m2/mc-boot/GM2Dependent.h index 068bbfe..a26f957 100644 --- a/gcc/m2/mc-boot/GM2Dependent.h +++ b/gcc/m2/mc-boot/GM2Dependent.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.cc b/gcc/m2/mc-boot/GM2EXCEPTION.cc index 387b047..7f817d1 100644 --- a/gcc/m2/mc-boot/GM2EXCEPTION.cc +++ b/gcc/m2/mc-boot/GM2EXCEPTION.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -43,7 +44,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions; extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void); -extern "C" unsigned int M2EXCEPTION_IsM2Exception (void); +extern "C" bool M2EXCEPTION_IsM2Exception (void); extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) { @@ -67,7 +68,7 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) __builtin_unreachable (); } -extern "C" unsigned int M2EXCEPTION_IsM2Exception (void) +extern "C" bool M2EXCEPTION_IsM2Exception (void) { RTExceptions_EHBlock e; diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.h b/gcc/m2/mc-boot/GM2EXCEPTION.h index 8dd781f..1ef2367 100644 --- a/gcc/m2/mc-boot/GM2EXCEPTION.h +++ b/gcc/m2/mc-boot/GM2EXCEPTION.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -50,7 +51,7 @@ extern "C" { typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions; EXTERN M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void); -EXTERN unsigned int M2EXCEPTION_IsM2Exception (void); +EXTERN bool M2EXCEPTION_IsM2Exception (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GM2LINK.h b/gcc/m2/mc-boot/GM2LINK.h index 890e3b3..edbcc9c 100644 --- a/gcc/m2/mc-boot/GM2LINK.h +++ b/gcc/m2/mc-boot/GM2LINK.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -50,7 +51,7 @@ extern "C" { typedef char *M2LINK_PtrToChar; EXTERN M2LINK_PtrToChar M2LINK_ForcedModuleInitOrder; -EXTERN unsigned int M2LINK_StaticInitialization; +EXTERN bool M2LINK_StaticInitialization; # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GM2RTS.cc b/gcc/m2/mc-boot/GM2RTS.cc index 2e8680c..93bb9c2 100644 --- a/gcc/m2/mc-boot/GM2RTS.cc +++ b/gcc/m2/mc-boot/GM2RTS.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -87,9 +88,9 @@ struct M2RTS__T1_r { static M2RTS_ProcedureList InitialProc; static M2RTS_ProcedureList TerminateProc; static int ExitValue; -static unsigned int isHalting; -static unsigned int CallExit; -static unsigned int Initialized; +static bool isHalting; +static bool CallExit; +static bool Initialized; /* ConstructModules - resolve dependencies and then call each @@ -128,7 +129,7 @@ extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void procedure is installed. */ -extern "C" unsigned int M2RTS_InstallTerminationProcedure (PROC p); +extern "C" bool M2RTS_InstallTerminationProcedure (PROC p); /* ExecuteInitialProcedures - executes the initial procedures installed by @@ -143,7 +144,7 @@ extern "C" void M2RTS_ExecuteInitialProcedures (void); main program module. */ -extern "C" unsigned int M2RTS_InstallInitialProcedure (PROC p); +extern "C" bool M2RTS_InstallInitialProcedure (PROC p); /* ExecuteTerminationProcedures - calls each installed termination procedure @@ -247,7 +248,7 @@ static void ExecuteReverse (M2RTS_ProcedureChain procptr); defined by proclist. */ -static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc); +static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc); /* ErrorString - writes a string to stderr. @@ -310,7 +311,7 @@ static void ExecuteReverse (M2RTS_ProcedureChain procptr) defined by proclist. */ -static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc) +static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc) { M2RTS_ProcedureChain pdes; @@ -323,7 +324,7 @@ static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc) (*proclist).head = pdes; } (*proclist).tail = pdes; - return TRUE; + return true; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -407,8 +408,8 @@ static void Init (void) InitProcList (&InitialProc); InitProcList (&TerminateProc); ExitValue = 0; - isHalting = FALSE; - CallExit = FALSE; /* default by calling abort */ + isHalting = false; + CallExit = false; /* default by calling abort */ } @@ -423,7 +424,7 @@ static void CheckInitialized (void) { if (! Initialized) { - Initialized = TRUE; + Initialized = true; Init (); } } @@ -482,7 +483,7 @@ extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void procedure is installed. */ -extern "C" unsigned int M2RTS_InstallTerminationProcedure (PROC p) +extern "C" bool M2RTS_InstallTerminationProcedure (PROC p) { return AppendProc (&TerminateProc, p); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -507,7 +508,7 @@ extern "C" void M2RTS_ExecuteInitialProcedures (void) main program module. */ -extern "C" unsigned int M2RTS_InstallInitialProcedure (PROC p) +extern "C" bool M2RTS_InstallInitialProcedure (PROC p) { return AppendProc (&InitialProc, p); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -554,7 +555,7 @@ extern "C" void M2RTS_HALT (int exitcode) { if (exitcode != -1) { - CallExit = TRUE; + CallExit = true; ExitValue = exitcode; } if (isHalting) @@ -564,7 +565,7 @@ extern "C" void M2RTS_HALT (int exitcode) } else { - isHalting = TRUE; + isHalting = true; M2RTS_ExecuteTerminationProcedures (); } if (CallExit) @@ -618,7 +619,7 @@ extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function extern "C" void M2RTS_ExitOnHalt (int e) { ExitValue = e; - CallExit = TRUE; + CallExit = true; } diff --git a/gcc/m2/mc-boot/GM2RTS.h b/gcc/m2/mc-boot/GM2RTS.h index eb1025c..85a5532 100644 --- a/gcc/m2/mc-boot/GM2RTS.h +++ b/gcc/m2/mc-boot/GM2RTS.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -79,7 +80,7 @@ EXTERN void M2RTS_RequestDependant (void * modulename, void * libname, void * de procedure is installed. */ -EXTERN unsigned int M2RTS_InstallTerminationProcedure (PROC p); +EXTERN bool M2RTS_InstallTerminationProcedure (PROC p); /* ExecuteInitialProcedures - executes the initial procedures installed @@ -94,7 +95,7 @@ EXTERN void M2RTS_ExecuteInitialProcedures (void); program module. */ -EXTERN unsigned int M2RTS_InstallInitialProcedure (PROC p); +EXTERN bool M2RTS_InstallInitialProcedure (PROC p); /* ExecuteTerminationProcedures - calls each installed termination procedure diff --git a/gcc/m2/mc-boot/GMemUtils.cc b/gcc/m2/mc-boot/GMemUtils.cc index a80e00e..72c024a 100644 --- a/gcc/m2/mc-boot/GMemUtils.cc +++ b/gcc/m2/mc-boot/GMemUtils.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GMemUtils.h b/gcc/m2/mc-boot/GMemUtils.h index 55dbd7f..dbf0065 100644 --- a/gcc/m2/mc-boot/GMemUtils.h +++ b/gcc/m2/mc-boot/GMemUtils.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GNumberIO.cc b/gcc/m2/mc-boot/GNumberIO.cc index 53bac45..e9c5018 100644 --- a/gcc/m2/mc-boot/GNumberIO.cc +++ b/gcc/m2/mc-boot/GNumberIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -190,7 +191,7 @@ extern "C" void NumberIO_CardToStr (unsigned int x, unsigned int n, char *a, uns extern "C" void NumberIO_StrToCard (const char *a_, unsigned int _a_high, unsigned int *x) { unsigned int i; - unsigned int ok; + bool ok; unsigned int higha; char a[_a_high+1]; @@ -200,7 +201,7 @@ extern "C" void NumberIO_StrToCard (const char *a_, unsigned int _a_high, unsign StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high); higha = StrLib_StrLen ((const char *) a, _a_high); i = 0; - ok = TRUE; + ok = true; while (ok) { if (i < higha) @@ -211,18 +212,18 @@ extern "C" void NumberIO_StrToCard (const char *a_, unsigned int _a_high, unsign } else { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } (*x) = 0; if (i < higha) { - ok = TRUE; + ok = true; do { (*x) = (10*(*x))+( ((unsigned int) (a[i]))- ((unsigned int) ('0'))); if (i < higha) @@ -231,12 +232,12 @@ extern "C" void NumberIO_StrToCard (const char *a_, unsigned int _a_high, unsign i += 1; if ((a[i] < '0') || (a[i] > '9')) { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } while (! (! ok)); } @@ -314,12 +315,12 @@ extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int unsigned int c; unsigned int Higha; IntToStr__T9 buf; - unsigned int Negative; + bool Negative; if (x < 0) { /* avoid dangling else. */ - Negative = TRUE; + Negative = true; c = ((unsigned int ) (abs (x+1)))+1; if (n > 0) { @@ -329,7 +330,7 @@ extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int else { c = x; - Negative = FALSE; + Negative = false; } i = 0; do { @@ -372,8 +373,8 @@ extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int extern "C" void NumberIO_StrToInt (const char *a_, unsigned int _a_high, int *x) { unsigned int i; - unsigned int ok; - unsigned int Negative; + bool ok; + bool Negative; unsigned int higha; char a[_a_high+1]; @@ -383,8 +384,8 @@ extern "C" void NumberIO_StrToInt (const char *a_, unsigned int _a_high, int *x) StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high); higha = StrLib_StrLen ((const char *) a, _a_high); i = 0; - Negative = FALSE; - ok = TRUE; + Negative = false; + ok = true; while (ok) { if (i < higha) @@ -402,18 +403,18 @@ extern "C" void NumberIO_StrToInt (const char *a_, unsigned int _a_high, int *x) else { /* avoid dangling else. */ - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } (*x) = 0; if (i < higha) { - ok = TRUE; + ok = true; do { if (Negative) { @@ -429,12 +430,12 @@ extern "C" void NumberIO_StrToInt (const char *a_, unsigned int _a_high, int *x) i += 1; if ((a[i] < '0') || (a[i] > '9')) { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } while (! (! ok)); } @@ -597,7 +598,7 @@ extern "C" void NumberIO_StrToBin (const char *a_, unsigned int _a_high, unsigne extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int *x) { unsigned int i; - unsigned int ok; + bool ok; unsigned int higha; char a[_a_high+1]; @@ -607,7 +608,7 @@ extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high); higha = StrLib_StrLen ((const char *) a, _a_high); i = 0; - ok = TRUE; + ok = true; while (ok) { if (i < higha) @@ -618,18 +619,18 @@ extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int } else { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } (*x) = 0; if (i < higha) { - ok = TRUE; + ok = true; do { (*x) = (2*(*x))+((int ) ( ((unsigned int) (a[i]))- ((unsigned int) ('0')))); if (i < higha) @@ -638,12 +639,12 @@ extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int i += 1; if ((a[i] < '0') || (a[i] > '1')) { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } while (! (! ok)); } @@ -652,7 +653,7 @@ extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int *x) { unsigned int i; - unsigned int ok; + bool ok; unsigned int higha; char a[_a_high+1]; @@ -662,14 +663,14 @@ extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high); higha = StrLib_StrLen ((const char *) a, _a_high); i = 0; - ok = TRUE; + ok = true; while (ok) { if (i < higha) { if (((a[i] >= '0') && (a[i] <= '9')) || ((a[i] >= 'A') && (a[i] <= 'F'))) { - ok = FALSE; + ok = false; } else { @@ -678,13 +679,13 @@ extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int } else { - ok = FALSE; + ok = false; } } (*x) = 0; if (i < higha) { - ok = TRUE; + ok = true; do { if ((a[i] >= '0') && (a[i] <= '9')) { @@ -701,12 +702,12 @@ extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int i += 1; if (((a[i] < '0') || (a[i] > '9')) && ((a[i] < 'A') || (a[i] > 'F'))) { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } while (! (! ok)); } @@ -715,7 +716,7 @@ extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int *x) { unsigned int i; - unsigned int ok; + bool ok; unsigned int higha; char a[_a_high+1]; @@ -725,7 +726,7 @@ extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high); higha = StrLib_StrLen ((const char *) a, _a_high); i = 0; - ok = TRUE; + ok = true; while (ok) { if (i < higha) @@ -736,18 +737,18 @@ extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int } else { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } (*x) = 0; if (i < higha) { - ok = TRUE; + ok = true; do { (*x) = (8*(*x))+((int ) ( ((unsigned int) (a[i]))- ((unsigned int) ('0')))); if (i < higha) @@ -756,12 +757,12 @@ extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int i += 1; if ((a[i] < '0') || (a[i] > '7')) { - ok = FALSE; + ok = false; } } else { - ok = FALSE; + ok = false; } } while (! (! ok)); } diff --git a/gcc/m2/mc-boot/GNumberIO.h b/gcc/m2/mc-boot/GNumberIO.h index 1a5690e..a18fb25 100644 --- a/gcc/m2/mc-boot/GNumberIO.h +++ b/gcc/m2/mc-boot/GNumberIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GPushBackInput.cc b/gcc/m2/mc-boot/GPushBackInput.cc index e15b3eb..fa052b4 100644 --- a/gcc/m2/mc-boot/GPushBackInput.cc +++ b/gcc/m2/mc-boot/GPushBackInput.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -68,7 +69,7 @@ static unsigned int ExitStatus; static unsigned int Column; static unsigned int StackPtr; static unsigned int LineNo; -static unsigned int Debugging; +static bool Debugging; /* Open - opens a file for reading. @@ -141,7 +142,7 @@ extern "C" unsigned int PushBackInput_GetExitStatus (void); SetDebug - sets the debug flag on or off. */ -extern "C" void PushBackInput_SetDebug (unsigned int d); +extern "C" void PushBackInput_SetDebug (bool d); /* GetColumnPosition - returns the column position of the current character. @@ -441,7 +442,7 @@ extern "C" unsigned int PushBackInput_GetExitStatus (void) SetDebug - sets the debug flag on or off. */ -extern "C" void PushBackInput_SetDebug (unsigned int d) +extern "C" void PushBackInput_SetDebug (bool d) { Debugging = d; } @@ -479,7 +480,7 @@ extern "C" unsigned int PushBackInput_GetCurrentLine (void) extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { - PushBackInput_SetDebug (FALSE); + PushBackInput_SetDebug (false); Init (); } diff --git a/gcc/m2/mc-boot/GPushBackInput.h b/gcc/m2/mc-boot/GPushBackInput.h index ce7cc8e..09a65f5 100644 --- a/gcc/m2/mc-boot/GPushBackInput.h +++ b/gcc/m2/mc-boot/GPushBackInput.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -121,7 +122,7 @@ EXTERN unsigned int PushBackInput_GetExitStatus (void); SetDebug - sets the debug flag on or off. */ -EXTERN void PushBackInput_SetDebug (unsigned int d); +EXTERN void PushBackInput_SetDebug (bool d); /* GetColumnPosition - returns the column position of the current character. diff --git a/gcc/m2/mc-boot/GRTExceptions.cc b/gcc/m2/mc-boot/GRTExceptions.cc index 23f8fed..21624a9 100644 --- a/gcc/m2/mc-boot/GRTExceptions.cc +++ b/gcc/m2/mc-boot/GRTExceptions.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -92,7 +93,7 @@ struct RTExceptions__T3_r { RTExceptions_Handler stack; }; -static unsigned int inException; +static bool inException; static RTExceptions_Handler freeHandler; static RTExceptions_EHBlock freeEHB; static RTExceptions_EHBlock currentEHB; @@ -185,7 +186,7 @@ extern "C" void RTExceptions_BaseExceptionsThrow (void); in the exception state. */ -extern "C" unsigned int RTExceptions_IsInExceptionState (void); +extern "C" bool RTExceptions_IsInExceptionState (void); /* SetExceptionState - returns the current exception state and @@ -193,7 +194,7 @@ extern "C" unsigned int RTExceptions_IsInExceptionState (void); to. */ -extern "C" unsigned int RTExceptions_SetExceptionState (unsigned int to); +extern "C" bool RTExceptions_SetExceptionState (bool to); /* SwitchExceptionState - assigns, from, with the current exception @@ -201,7 +202,7 @@ extern "C" unsigned int RTExceptions_SetExceptionState (unsigned int to); to, to. */ -extern "C" void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to); +extern "C" void RTExceptions_SwitchExceptionState (bool *from, bool to); /* GetBaseExceptionBlock - returns the initial language exception block @@ -871,7 +872,7 @@ static void exception (void * a) static void Init (void) { - inException = FALSE; + inException = false; freeHandler = NULL; freeEHB = NULL; currentEHB = RTExceptions_InitExceptionBlock (); @@ -1132,7 +1133,7 @@ extern "C" void RTExceptions_BaseExceptionsThrow (void) in the exception state. */ -extern "C" unsigned int RTExceptions_IsInExceptionState (void) +extern "C" bool RTExceptions_IsInExceptionState (void) { return inException; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1146,9 +1147,9 @@ extern "C" unsigned int RTExceptions_IsInExceptionState (void) to. */ -extern "C" unsigned int RTExceptions_SetExceptionState (unsigned int to) +extern "C" bool RTExceptions_SetExceptionState (bool to) { - unsigned int old; + bool old; old = inException; inException = to; @@ -1164,7 +1165,7 @@ extern "C" unsigned int RTExceptions_SetExceptionState (unsigned int to) to, to. */ -extern "C" void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to) +extern "C" void RTExceptions_SwitchExceptionState (bool *from, bool to) { (*from) = inException; inException = to; diff --git a/gcc/m2/mc-boot/GRTExceptions.h b/gcc/m2/mc-boot/GRTExceptions.h index 3f8e64d..c48f7bb 100644 --- a/gcc/m2/mc-boot/GRTExceptions.h +++ b/gcc/m2/mc-boot/GRTExceptions.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -146,7 +147,7 @@ EXTERN void RTExceptions_BaseExceptionsThrow (void); in the exception state. */ -EXTERN unsigned int RTExceptions_IsInExceptionState (void); +EXTERN bool RTExceptions_IsInExceptionState (void); /* SetExceptionState - returns the current exception state and @@ -154,7 +155,7 @@ EXTERN unsigned int RTExceptions_IsInExceptionState (void); to. */ -EXTERN unsigned int RTExceptions_SetExceptionState (unsigned int to); +EXTERN bool RTExceptions_SetExceptionState (bool to); /* SwitchExceptionState - assigns, from, with the current exception @@ -162,7 +163,7 @@ EXTERN unsigned int RTExceptions_SetExceptionState (unsigned int to); to, to. */ -EXTERN void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to); +EXTERN void RTExceptions_SwitchExceptionState (bool *from, bool to); /* GetBaseExceptionBlock - returns the initial language exception block diff --git a/gcc/m2/mc-boot/GRTco.h b/gcc/m2/mc-boot/GRTco.h index 180c495..09e6d8b 100644 --- a/gcc/m2/mc-boot/GRTco.h +++ b/gcc/m2/mc-boot/GRTco.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GRTentity.h b/gcc/m2/mc-boot/GRTentity.h index 9fc2492..9efb645 100644 --- a/gcc/m2/mc-boot/GRTentity.h +++ b/gcc/m2/mc-boot/GRTentity.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -58,7 +59,7 @@ EXTERN RTentity_Group RTentity_KillGroup (RTentity_Group g); EXTERN unsigned int RTentity_GetKey (RTentity_Group g, void * a); EXTERN void RTentity_PutKey (RTentity_Group g, void * a, unsigned int key); EXTERN void RTentity_DelKey (RTentity_Group g, void * a); -EXTERN unsigned int RTentity_IsIn (RTentity_Group g, void * a); +EXTERN bool RTentity_IsIn (RTentity_Group g, void * a); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GRTint.cc b/gcc/m2/mc-boot/GRTint.cc index a3030f2..f8e26c1 100644 --- a/gcc/m2/mc-boot/GRTint.cc +++ b/gcc/m2/mc-boot/GRTint.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -62,7 +63,7 @@ typedef struct RTint_DispatchVector_p RTint_DispatchVector; # define Microseconds 1000000 # define DebugTime 0 -# define Debugging FALSE +# define Debugging false typedef struct RTint__T1_r RTint__T1; typedef RTint__T1 *RTint_Vector; @@ -84,7 +85,7 @@ struct RTint__T1_r { int File; Selective_Timeval rel; Selective_Timeval abs_; - unsigned int queued; + bool queued; }; struct RTint__T2_a { RTint_Vector array[(7)-(COROUTINES_UnassignedPriority)+1]; }; @@ -92,7 +93,7 @@ static unsigned int VecNo; static RTint_Vector Exists; static RTint__T2 Pending; static int lock; -static unsigned int initialized; +static bool initialized; /* InitInputVector - returns an interrupt vector which is associated @@ -162,7 +163,7 @@ extern "C" void RTint_ExcludeVector (unsigned int vec); It only listens for interrupts > pri. */ -extern "C" void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector call, unsigned int pri); +extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, unsigned int pri); /* Init - @@ -218,7 +219,7 @@ static void AddTime (Selective_Timeval t1, Selective_Timeval t2); IsGreaterEqual - returns TRUE if, a>=b */ -static unsigned int IsGreaterEqual (Selective_Timeval a, Selective_Timeval b); +static bool IsGreaterEqual (Selective_Timeval a, Selective_Timeval b); /* SubTime - assigns, s and m, to a - b. @@ -230,7 +231,7 @@ static void SubTime (unsigned int *s, unsigned int *m, Selective_Timeval a, Sele activatePending - activates the first interrupt pending and clears it. */ -static unsigned int activatePending (unsigned int untilInterrupt, RTint_DispatchVector call, unsigned int pri, int maxFd, Selective_SetOfFd *inSet, Selective_SetOfFd *outSet, Selective_Timeval *timeval, Selective_Timeval b4, Selective_Timeval after); +static bool activatePending (bool untilInterrupt, RTint_DispatchVector call, unsigned int pri, int maxFd, Selective_SetOfFd *inSet, Selective_SetOfFd *outSet, Selective_Timeval *timeval, Selective_Timeval b4, Selective_Timeval after); /* init - @@ -428,7 +429,7 @@ static void AddTime (Selective_Timeval t1, Selective_Timeval t2) IsGreaterEqual - returns TRUE if, a>=b */ -static unsigned int IsGreaterEqual (Selective_Timeval a, Selective_Timeval b) +static bool IsGreaterEqual (Selective_Timeval a, Selective_Timeval b) { unsigned int as; unsigned int am; @@ -488,7 +489,7 @@ static void SubTime (unsigned int *s, unsigned int *m, Selective_Timeval a, Sele activatePending - activates the first interrupt pending and clears it. */ -static unsigned int activatePending (unsigned int untilInterrupt, RTint_DispatchVector call, unsigned int pri, int maxFd, Selective_SetOfFd *inSet, Selective_SetOfFd *outSet, Selective_Timeval *timeval, Selective_Timeval b4, Selective_Timeval after) +static bool activatePending (bool untilInterrupt, RTint_DispatchVector call, unsigned int pri, int maxFd, Selective_SetOfFd *inSet, Selective_SetOfFd *outSet, Selective_Timeval *timeval, Selective_Timeval b4, Selective_Timeval after) { int result; unsigned int p; @@ -520,7 +521,7 @@ static unsigned int activatePending (unsigned int untilInterrupt, RTint_Dispatch Selective_FdClr (vec->File, (*inSet)); /* so we dont activate this again from our select. */ RTco_signal (lock); /* so we dont activate this again from our select. */ (*call.proc) (vec->no, vec->priority, vec->arg); - return TRUE; + return true; } break; @@ -535,7 +536,7 @@ static unsigned int activatePending (unsigned int untilInterrupt, RTint_Dispatch Selective_FdClr (vec->File, (*outSet)); /* so we dont activate this again from our select. */ RTco_signal (lock); /* so we dont activate this again from our select. */ (*call.proc) (vec->no, vec->priority, vec->arg); - return TRUE; + return true; } break; @@ -568,7 +569,7 @@ static unsigned int activatePending (unsigned int untilInterrupt, RTint_Dispatch libc_printf ((const char *) "call (%d, %d, 0x%x)\\n", 21, vec->no, vec->priority, vec->arg); } (*call.proc) (vec->no, vec->priority, vec->arg); - return TRUE; + return true; } else if (Debugging) { @@ -588,7 +589,7 @@ static unsigned int activatePending (unsigned int untilInterrupt, RTint_Dispatch p -= 1; } RTco_signal (lock); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -609,7 +610,7 @@ static void init (void) { Pending.array[p-(COROUTINES_UnassignedPriority)] = NULL; } - initialized = TRUE; + initialized = true; RTco_signal (lock); } @@ -726,7 +727,7 @@ extern "C" unsigned int RTint_InitTimeVector (unsigned int micro, unsigned int s vptr->no = VecNo; vptr->rel = Selective_InitTime (secs+DebugTime, micro); vptr->abs_ = Selective_InitTime (0, 0); - vptr->queued = FALSE; + vptr->queued = false; Exists = vptr; } RTco_signal (lock); @@ -850,7 +851,7 @@ extern "C" void RTint_IncludeVector (unsigned int vec) Pending.array[vptr->priority-(COROUTINES_UnassignedPriority)] = vptr; if ((vptr->type == RTint_time) && ! vptr->queued) { - vptr->queued = TRUE; + vptr->queued = true; result = Selective_GetTimeOfDay (vptr->abs_); Assertion_Assert (result == 0); Selective_GetTime (vptr->abs_, &sec, µ); @@ -907,7 +908,7 @@ extern "C" void RTint_ExcludeVector (unsigned int vec) } if (vptr->type == RTint_time) { - vptr->queued = FALSE; + vptr->queued = false; } } RTco_signal (lock); @@ -923,9 +924,9 @@ extern "C" void RTint_ExcludeVector (unsigned int vec) It only listens for interrupts > pri. */ -extern "C" void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector call, unsigned int pri) +extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, unsigned int pri) { - unsigned int found; + bool found; int result; Selective_Timeval after; Selective_Timeval b4; @@ -955,7 +956,7 @@ extern "C" void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector outSet = NULL; timeval = Selective_InitTime (static_cast<unsigned int> (INT_MAX), 0); p = static_cast<unsigned int> (7); - found = FALSE; + found = false; while (p > pri) { vec = Pending.array[p-(COROUTINES_UnassignedPriority)]; @@ -981,7 +982,7 @@ extern "C" void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector libc_printf ((const char *) "shortest delay is %u.%06u\\n", 27, sec, micro); } Selective_SetTime (timeval, sec, micro); - found = TRUE; + found = true; } break; diff --git a/gcc/m2/mc-boot/GRTint.h b/gcc/m2/mc-boot/GRTint.h index ccc6afe..83fef96 100644 --- a/gcc/m2/mc-boot/GRTint.h +++ b/gcc/m2/mc-boot/GRTint.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -122,7 +123,7 @@ EXTERN void RTint_ExcludeVector (unsigned int vec); It only listens for interrupts > pri. */ -EXTERN void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector call, unsigned int pri); +EXTERN void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, unsigned int pri); /* Init - allows the user to force the initialize order. diff --git a/gcc/m2/mc-boot/GSArgs.cc b/gcc/m2/mc-boot/GSArgs.cc index 143d278..f98849f 100644 --- a/gcc/m2/mc-boot/GSArgs.cc +++ b/gcc/m2/mc-boot/GSArgs.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -64,7 +65,7 @@ typedef SArgs_PtrToChar *SArgs_PtrToPtrToChar; new string, otherwise s is set to NIL. */ -extern "C" unsigned int SArgs_GetArg (DynamicStrings_String *s, unsigned int n); +extern "C" bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n); /* Narg - returns the number of arguments available from @@ -81,7 +82,7 @@ extern "C" unsigned int SArgs_Narg (void); new string, otherwise s is set to NIL. */ -extern "C" unsigned int SArgs_GetArg (DynamicStrings_String *s, unsigned int n) +extern "C" bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n) { int i; SArgs_PtrToPtrToChar ppc; @@ -92,12 +93,12 @@ extern "C" unsigned int SArgs_GetArg (DynamicStrings_String *s, unsigned int n) /* ppc := ADDRESS (VAL (PtrToPtrToChar, ArgV) + (i * CARDINAL (TSIZE(PtrToChar)))) ; */ ppc = static_cast<SArgs_PtrToPtrToChar> ((void *) (((SArgs_PtrToChar) (UnixArgs_GetArgV ()))+(n*sizeof (SArgs_PtrToChar)))); (*s) = DynamicStrings_InitStringCharStar (reinterpret_cast<void *> ((*ppc))); - return TRUE; + return true; } else { (*s) = static_cast<DynamicStrings_String> (NULL); - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); diff --git a/gcc/m2/mc-boot/GSArgs.h b/gcc/m2/mc-boot/GSArgs.h index 631aaa7..087238a 100644 --- a/gcc/m2/mc-boot/GSArgs.h +++ b/gcc/m2/mc-boot/GSArgs.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -56,7 +57,7 @@ extern "C" { new string, otherwise s is set to NIL. */ -EXTERN unsigned int SArgs_GetArg (DynamicStrings_String *s, unsigned int n); +EXTERN bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n); /* Narg - returns the number of arguments available from diff --git a/gcc/m2/mc-boot/GSFIO.cc b/gcc/m2/mc-boot/GSFIO.cc index 1a80013..43be478 100644 --- a/gcc/m2/mc-boot/GSFIO.cc +++ b/gcc/m2/mc-boot/GSFIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -49,7 +50,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see Exists - returns TRUE if a file named, fname exists for reading. */ -extern "C" unsigned int SFIO_Exists (DynamicStrings_String fname); +extern "C" bool SFIO_Exists (DynamicStrings_String fname); /* OpenToRead - attempts to open a file, fname, for reading and @@ -81,7 +82,7 @@ extern "C" FIO_File SFIO_OpenToWrite (DynamicStrings_String fname); and modify an existing file. */ -extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile); +extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile); /* WriteS - writes a string, s, to, file. It returns the String, s. @@ -103,7 +104,7 @@ extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file); Exists - returns TRUE if a file named, fname exists for reading. */ -extern "C" unsigned int SFIO_Exists (DynamicStrings_String fname) +extern "C" bool SFIO_Exists (DynamicStrings_String fname) { return FIO_exists (DynamicStrings_string (fname), DynamicStrings_Length (fname)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -153,7 +154,7 @@ extern "C" FIO_File SFIO_OpenToWrite (DynamicStrings_String fname) and modify an existing file. */ -extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile) +extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile) { return FIO_openForRandom (DynamicStrings_string (fname), DynamicStrings_Length (fname), towrite, newfile); /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/GSFIO.h b/gcc/m2/mc-boot/GSFIO.h index 02bfa65..982016e 100644 --- a/gcc/m2/mc-boot/GSFIO.h +++ b/gcc/m2/mc-boot/GSFIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -54,7 +55,7 @@ extern "C" { Exists - returns TRUE if a file named, fname exists for reading. */ -EXTERN unsigned int SFIO_Exists (DynamicStrings_String fname); +EXTERN bool SFIO_Exists (DynamicStrings_String fname); /* OpenToRead - attempts to open a file, fname, for reading and @@ -86,7 +87,7 @@ EXTERN FIO_File SFIO_OpenToWrite (DynamicStrings_String fname); and modify an existing file. */ -EXTERN FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile); +EXTERN FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile); /* WriteS - writes a string, s, to, file. It returns the String, s. diff --git a/gcc/m2/mc-boot/GSYSTEM.h b/gcc/m2/mc-boot/GSYSTEM.h index 4460451..d355ab7 100644 --- a/gcc/m2/mc-boot/GSYSTEM.h +++ b/gcc/m2/mc-boot/GSYSTEM.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GSelective.h b/gcc/m2/mc-boot/GSelective.h index a88cc36..289c685 100644 --- a/gcc/m2/mc-boot/GSelective.h +++ b/gcc/m2/mc-boot/GSelective.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -62,7 +63,7 @@ EXTERN Selective_SetOfFd Selective_KillSet (Selective_SetOfFd s); EXTERN void Selective_FdZero (Selective_SetOfFd s); EXTERN void Selective_FdSet (int fd, Selective_SetOfFd s); EXTERN void Selective_FdClr (int fd, Selective_SetOfFd s); -EXTERN unsigned int Selective_FdIsSet (int fd, Selective_SetOfFd s); +EXTERN bool Selective_FdIsSet (int fd, Selective_SetOfFd s); EXTERN int Selective_MaxFdsPlusOne (int a, int b); EXTERN void Selective_WriteCharRaw (int fd, char ch); EXTERN char Selective_ReadCharRaw (int fd); diff --git a/gcc/m2/mc-boot/GStdIO.cc b/gcc/m2/mc-boot/GStdIO.cc index 41affe2..c15eb6d 100644 --- a/gcc/m2/mc-boot/GStdIO.cc +++ b/gcc/m2/mc-boot/GStdIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GStdIO.h b/gcc/m2/mc-boot/GStdIO.h index d1f48e0..e235a53 100644 --- a/gcc/m2/mc-boot/GStdIO.h +++ b/gcc/m2/mc-boot/GStdIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GStorage.cc b/gcc/m2/mc-boot/GStorage.cc index 5dac021..1311597 100644 --- a/gcc/m2/mc-boot/GStorage.cc +++ b/gcc/m2/mc-boot/GStorage.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -41,7 +42,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size); extern "C" void Storage_DEALLOCATE (void * *a, unsigned int Size); extern "C" void Storage_REALLOCATE (void * *a, unsigned int Size); -extern "C" unsigned int Storage_Available (unsigned int Size); +extern "C" bool Storage_Available (unsigned int Size); extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size) { @@ -58,7 +59,7 @@ extern "C" void Storage_REALLOCATE (void * *a, unsigned int Size) SysStorage_REALLOCATE (a, Size); } -extern "C" unsigned int Storage_Available (unsigned int Size) +extern "C" bool Storage_Available (unsigned int Size) { return SysStorage_Available (Size); /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/GStorage.h b/gcc/m2/mc-boot/GStorage.h index e6075f8..d7cd15ea 100644 --- a/gcc/m2/mc-boot/GStorage.h +++ b/gcc/m2/mc-boot/GStorage.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -77,7 +78,7 @@ EXTERN void Storage_REALLOCATE (void * *a, unsigned int Size); Available - returns TRUE if, Size, bytes can be allocated. */ -EXTERN unsigned int Storage_Available (unsigned int Size); +EXTERN bool Storage_Available (unsigned int Size); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GStrCase.cc b/gcc/m2/mc-boot/GStrCase.cc index e3491b6..e55c6f8 100644 --- a/gcc/m2/mc-boot/GStrCase.cc +++ b/gcc/m2/mc-boot/GStrCase.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GStrCase.h b/gcc/m2/mc-boot/GStrCase.h index dbcf1bd..2a3f410 100644 --- a/gcc/m2/mc-boot/GStrCase.h +++ b/gcc/m2/mc-boot/GStrCase.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GStrIO.cc b/gcc/m2/mc-boot/GStrIO.cc index 1e091bc..dc1ad67 100644 --- a/gcc/m2/mc-boot/GStrIO.cc +++ b/gcc/m2/mc-boot/GStrIO.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -44,7 +45,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStdIO.h" # include "Glibc.h" -static unsigned int IsATTY; +static bool IsATTY; /* WriteLn - writes a carriage return and a newline @@ -85,7 +86,7 @@ static void Echo (char ch); AlphaNum- returns true if character, ch, is an alphanumeric character. */ -static unsigned int AlphaNum (char ch); +static bool AlphaNum (char ch); /* @@ -119,7 +120,7 @@ static void Echo (char ch) AlphaNum- returns true if character, ch, is an alphanumeric character. */ -static unsigned int AlphaNum (char ch) +static bool AlphaNum (char ch) { return (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))) || ((ch >= '0') && (ch <= '9')); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -269,7 +270,7 @@ extern "C" void StrIO_WriteString (const char *a_, unsigned int _a_high) extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { /* IsATTY := isatty() */ - IsATTY = FALSE; + IsATTY = false; } extern "C" void _M2_StrIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) diff --git a/gcc/m2/mc-boot/GStrIO.h b/gcc/m2/mc-boot/GStrIO.h index 94d49ae..7883172 100644 --- a/gcc/m2/mc-boot/GStrIO.h +++ b/gcc/m2/mc-boot/GStrIO.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GStrLib.cc b/gcc/m2/mc-boot/GStrLib.cc index 537eeb9..6d07827 100644 --- a/gcc/m2/mc-boot/GStrLib.cc +++ b/gcc/m2/mc-boot/GStrLib.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -58,8 +59,8 @@ extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const ch string, b. */ -extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); -extern "C" unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +extern "C" bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +extern "C" bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); extern "C" unsigned int StrLib_StrLen (const char *a_, unsigned int _a_high); /* @@ -74,7 +75,7 @@ extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char * IsSubString - returns true if b is a subcomponent of a. */ -extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +extern "C" bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); /* StrRemoveWhitePrefix - copies string, into string, b, excluding any white @@ -87,14 +88,14 @@ extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_hig IsWhite - returns TRUE if, ch, is a space or a tab. */ -static unsigned int IsWhite (char ch); +static bool IsWhite (char ch); /* IsWhite - returns TRUE if, ch, is a space or a tab. */ -static unsigned int IsWhite (char ch) +static bool IsWhite (char ch) { return (ch == ' ') || (ch == ASCII_tab); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -142,7 +143,7 @@ extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const ch string, b. */ -extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high) +extern "C" bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high) { unsigned int Higha; unsigned int Highb; @@ -161,12 +162,12 @@ extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, co { if (a[i] < b[i]) { - return TRUE; + return true; } else if (a[i] > b[i]) { /* avoid dangling else. */ - return FALSE; + return false; } /* must be equal, move on to next character */ i += 1; @@ -176,7 +177,7 @@ extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, co __builtin_unreachable (); } -extern "C" unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high) +extern "C" bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high) { unsigned int i; unsigned int higha; @@ -195,7 +196,7 @@ extern "C" unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, c { if (a[i] != b[i]) { - return FALSE; + return false; } i += 1; } @@ -260,7 +261,7 @@ extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char * IsSubString - returns true if b is a subcomponent of a. */ -extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high) +extern "C" bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high) { unsigned int i; unsigned int j; @@ -287,7 +288,7 @@ extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high } if (j == LengthB) { - return TRUE; + return true; } else { @@ -295,7 +296,7 @@ extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high } } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GStrLib.h b/gcc/m2/mc-boot/GStrLib.h index b23c1f9..de3250b 100644 --- a/gcc/m2/mc-boot/GStrLib.h +++ b/gcc/m2/mc-boot/GStrLib.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -59,13 +60,13 @@ EXTERN void StrLib_StrConCat (const char *a_, unsigned int _a_high, const char * string, b. */ -EXTERN unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +EXTERN bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); /* StrEqual - performs a = b on two strings. */ -EXTERN unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +EXTERN bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); /* StrLen - returns the length of string, a. @@ -85,7 +86,7 @@ EXTERN void StrLib_StrCopy (const char *src_, unsigned int _src_high, char *dest IsSubString - returns true if b is a subcomponent of a. */ -EXTERN unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +EXTERN bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); /* StrRemoveWhitePrefix - copies string, into string, b, excluding any white diff --git a/gcc/m2/mc-boot/GStringConvert.cc b/gcc/m2/mc-boot/GStringConvert.cc index faa5e344..f369660 100644 --- a/gcc/m2/mc-boot/GStringConvert.cc +++ b/gcc/m2/mc-boot/GStringConvert.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -67,7 +68,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see are used. */ -extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower); +extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower); /* CardinalToString - converts CARDINAL, c, into a String. The field with can be specified @@ -78,7 +79,7 @@ extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned are used. */ -extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); +extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); /* StringToInteger - converts a string, s, of, base, into an INTEGER. @@ -88,7 +89,7 @@ extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, The parameter found is set TRUE if a number was found. */ -extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, unsigned int *found); +extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, bool *found); /* StringToCardinal - converts a string, s, of, base, into a CARDINAL. @@ -98,7 +99,7 @@ extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned The parameter found is set TRUE if a number was found. */ -extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, bool *found); /* LongIntegerToString - converts LONGINT, i, into a String. The field with @@ -112,7 +113,7 @@ extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, abcdef are used, and if FALSE then ABCDEF are used. */ -extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower); +extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower); /* StringToLongInteger - converts a string, s, of, base, into an LONGINT. @@ -122,7 +123,7 @@ extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, The parameter found is set TRUE if a number was found. */ -extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, unsigned int *found); +extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, bool *found); /* LongCardinalToString - converts LONGCARD, c, into a String. The field @@ -135,7 +136,7 @@ extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, abcdef are used, and if FALSE then ABCDEF are used. */ -extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); +extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); /* StringToLongCardinal - converts a string, s, of, base, into a LONGCARD. @@ -145,7 +146,7 @@ extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsign The parameter found is set TRUE if a number was found. */ -extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, bool *found); /* ShortCardinalToString - converts SHORTCARD, c, into a String. The field @@ -158,7 +159,7 @@ extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_ abcdef are used, and if FALSE then ABCDEF are used. */ -extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); +extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); /* StringToShortCardinal - converts a string, s, of, base, into a SHORTCARD. @@ -168,7 +169,7 @@ extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsi The parameter found is set TRUE if a number was found. */ -extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, bool *found); /* stoi - decimal string to INTEGER @@ -180,7 +181,7 @@ extern "C" int StringConvert_stoi (DynamicStrings_String s); itos - integer to decimal string. */ -extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, unsigned int sign); +extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, bool sign); /* ctos - cardinal to decimal string. @@ -234,7 +235,7 @@ extern "C" unsigned int StringConvert_bstoc (DynamicStrings_String s); StringToLongreal - returns a LONGREAL and sets found to TRUE if a legal number is seen. */ -extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, unsigned int *found); +extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, bool *found); /* LongrealToString - converts a LONGREAL number, Real, which has, @@ -319,7 +320,7 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S Assert - implement a simple assert. */ -static void Assert (unsigned int b, const char *file_, unsigned int _file_high, unsigned int line, const char *func_, unsigned int _func_high); +static void Assert (bool b, const char *file_, unsigned int _file_high, unsigned int line, const char *func_, unsigned int _func_high); /* Max - @@ -343,49 +344,49 @@ static long unsigned int LongMin (long unsigned int a, long unsigned int b); IsDigit - returns TRUE if, ch, lies between '0'..'9'. */ -static unsigned int IsDigit (char ch); +static bool IsDigit (char ch); /* IsDecimalDigitValid - returns the TRUE if, ch, is a base legal decimal digit. If legal then the value is appended numerically onto, c. */ -static unsigned int IsDecimalDigitValid (char ch, unsigned int base, unsigned int *c); +static bool IsDecimalDigitValid (char ch, unsigned int base, unsigned int *c); /* IsHexidecimalDigitValid - returns the TRUE if, ch, is a base legal hexidecimal digit. If legal then the value is appended numerically onto, c. */ -static unsigned int IsHexidecimalDigitValid (char ch, unsigned int base, unsigned int *c); +static bool IsHexidecimalDigitValid (char ch, unsigned int base, unsigned int *c); /* IsDecimalDigitValidLong - returns the TRUE if, ch, is a base legal decimal digit. If legal then the value is appended numerically onto, c. */ -static unsigned int IsDecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c); +static bool IsDecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c); /* IsHexidecimalDigitValidLong - returns the TRUE if, ch, is a base legal hexidecimal digit. If legal then the value is appended numerically onto, c. */ -static unsigned int IsHexidecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c); +static bool IsHexidecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c); /* IsDecimalDigitValidShort - returns the TRUE if, ch, is a base legal decimal digit. If legal then the value is appended numerically onto, c. */ -static unsigned int IsDecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c); +static bool IsDecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c); /* IsHexidecimalDigitValidShort - returns the TRUE if, ch, is a base legal hexidecimal digit. If legal then the value is appended numerically onto, c. */ -static unsigned int IsHexidecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c); +static bool IsHexidecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c); /* ToThePower10 - returns a LONGREAL containing the value of v * 10^power. @@ -441,7 +442,7 @@ static DynamicStrings_String carryOne (DynamicStrings_String s, unsigned int i); Assert - implement a simple assert. */ -static void Assert (unsigned int b, const char *file_, unsigned int _file_high, unsigned int line, const char *func_, unsigned int _func_high) +static void Assert (bool b, const char *file_, unsigned int _file_high, unsigned int line, const char *func_, unsigned int _func_high) { char file[_file_high+1]; char func[_func_high+1]; @@ -518,7 +519,7 @@ static long unsigned int LongMin (long unsigned int a, long unsigned int b) IsDigit - returns TRUE if, ch, lies between '0'..'9'. */ -static unsigned int IsDigit (char ch) +static bool IsDigit (char ch) { return (ch >= '0') && (ch <= '9'); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -531,16 +532,16 @@ static unsigned int IsDigit (char ch) If legal then the value is appended numerically onto, c. */ -static unsigned int IsDecimalDigitValid (char ch, unsigned int base, unsigned int *c) +static bool IsDecimalDigitValid (char ch, unsigned int base, unsigned int *c) { if ((IsDigit (ch)) && (( ((unsigned int) (ch))- ((unsigned int) ('0'))) < base)) { (*c) = ((*c)*base)+( ((unsigned int) (ch))- ((unsigned int) ('0'))); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -552,23 +553,23 @@ static unsigned int IsDecimalDigitValid (char ch, unsigned int base, unsigned in If legal then the value is appended numerically onto, c. */ -static unsigned int IsHexidecimalDigitValid (char ch, unsigned int base, unsigned int *c) +static bool IsHexidecimalDigitValid (char ch, unsigned int base, unsigned int *c) { if (((ch >= 'a') && (ch <= 'f')) && ((( ((unsigned int) (ch))- ((unsigned int) ('a')))+10) < base)) { (*c) = ((*c)*base)+(( ((unsigned int) (ch))- ((unsigned int) ('a')))+10); - return TRUE; + return true; } else if (((ch >= 'A') && (ch <= 'F')) && ((( ((unsigned int) (ch))- ((unsigned int) ('F')))+10) < base)) { /* avoid dangling else. */ (*c) = ((*c)*base)+(( ((unsigned int) (ch))- ((unsigned int) ('A')))+10); - return TRUE; + return true; } else { /* avoid dangling else. */ - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -580,16 +581,16 @@ static unsigned int IsHexidecimalDigitValid (char ch, unsigned int base, unsigne If legal then the value is appended numerically onto, c. */ -static unsigned int IsDecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c) +static bool IsDecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c) { if ((IsDigit (ch)) && (( ((unsigned int) (ch))- ((unsigned int) ('0'))) < base)) { (*c) = (*c)*((long unsigned int ) (base+( ((unsigned int) (ch))- ((unsigned int) ('0'))))); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -601,23 +602,23 @@ static unsigned int IsDecimalDigitValidLong (char ch, unsigned int base, long un If legal then the value is appended numerically onto, c. */ -static unsigned int IsHexidecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c) +static bool IsHexidecimalDigitValidLong (char ch, unsigned int base, long unsigned int *c) { if (((ch >= 'a') && (ch <= 'f')) && ((( ((unsigned int) (ch))- ((unsigned int) ('a')))+10) < base)) { (*c) = (*c)*((long unsigned int ) (base+(( ((unsigned int) (ch))- ((unsigned int) ('a')))+10))); - return TRUE; + return true; } else if (((ch >= 'A') && (ch <= 'F')) && ((( ((unsigned int) (ch))- ((unsigned int) ('F')))+10) < base)) { /* avoid dangling else. */ (*c) = (*c)*((long unsigned int ) (base+(( ((unsigned int) (ch))- ((unsigned int) ('A')))+10))); - return TRUE; + return true; } else { /* avoid dangling else. */ - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -629,16 +630,16 @@ static unsigned int IsHexidecimalDigitValidLong (char ch, unsigned int base, lon If legal then the value is appended numerically onto, c. */ -static unsigned int IsDecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c) +static bool IsDecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c) { if ((IsDigit (ch)) && (( ((unsigned int) (ch))- ((unsigned int) ('0'))) < base)) { (*c) = (*c)*((short unsigned int ) (base+( ((unsigned int) (ch))- ((unsigned int) ('0'))))); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -650,23 +651,23 @@ static unsigned int IsDecimalDigitValidShort (char ch, unsigned int base, short If legal then the value is appended numerically onto, c. */ -static unsigned int IsHexidecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c) +static bool IsHexidecimalDigitValidShort (char ch, unsigned int base, short unsigned int *c) { if (((ch >= 'a') && (ch <= 'f')) && ((( ((unsigned int) (ch))- ((unsigned int) ('a')))+10) < base)) { (*c) = (*c)*((short unsigned int ) (base+(( ((unsigned int) (ch))- ((unsigned int) ('a')))+10))); - return TRUE; + return true; } else if (((ch >= 'A') && (ch <= 'F')) && ((( ((unsigned int) (ch))- ((unsigned int) ('F')))+10) < base)) { /* avoid dangling else. */ (*c) = (*c)*((short unsigned int ) (base+(( ((unsigned int) (ch))- ((unsigned int) ('A')))+10))); - return TRUE; + return true; } else { /* avoid dangling else. */ - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -1073,7 +1074,7 @@ static DynamicStrings_String carryOne (DynamicStrings_String s, unsigned int i) are used. */ -extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower) +extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower) { DynamicStrings_String s; unsigned int c; @@ -1086,11 +1087,11 @@ extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned c = ((unsigned int ) (abs (i+1)))+1; if (width > 0) { - return DynamicStrings_ConCat (StringConvert_IntegerToString (-((int ) (c / base)), width-1, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (c % base), 0, ' ', FALSE, base, lower))); + return DynamicStrings_ConCat (StringConvert_IntegerToString (-((int ) (c / base)), width-1, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (c % base), 0, ' ', false, base, lower))); } else { - return DynamicStrings_ConCat (StringConvert_IntegerToString (-((int ) (c / base)), 0, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (c % base), 0, ' ', FALSE, base, lower))); + return DynamicStrings_ConCat (StringConvert_IntegerToString (-((int ) (c / base)), 0, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (c % base), 0, ' ', false, base, lower))); } } else @@ -1112,7 +1113,7 @@ extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned } if (i > (((int ) (base))-1)) { - s = DynamicStrings_ConCat (DynamicStrings_ConCat (s, DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (((unsigned int ) (i)) / base), 0, ' ', FALSE, base, lower))), DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (((unsigned int ) (i)) % base), 0, ' ', FALSE, base, lower))); + s = DynamicStrings_ConCat (DynamicStrings_ConCat (s, DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (((unsigned int ) (i)) / base), 0, ' ', false, base, lower))), DynamicStrings_Mark (StringConvert_IntegerToString (static_cast<int> (((unsigned int ) (i)) % base), 0, ' ', false, base, lower))); } else { @@ -1151,7 +1152,7 @@ extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned are used. */ -extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower) +extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, bool lower) { DynamicStrings_String s; @@ -1196,18 +1197,18 @@ extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, The parameter found is set TRUE if a number was found. */ -extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, unsigned int *found) +extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, bool *found) { unsigned int n; unsigned int l; unsigned int c; - unsigned int negative; + bool negative; s = DynamicStrings_RemoveWhitePrefix (s); /* returns a new string, s */ l = DynamicStrings_Length (s); /* returns a new string, s */ c = 0; n = 0; - negative = FALSE; + negative = false; if (n < l) { /* parse leading + and - */ @@ -1221,7 +1222,7 @@ extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned } while ((n < l) && ((IsDecimalDigitValid (DynamicStrings_char (s, static_cast<int> (n)), base, &c)) || (IsHexidecimalDigitValid (DynamicStrings_char (s, static_cast<int> (n)), base, &c)))) { - (*found) = TRUE; + (*found) = true; n += 1; } } @@ -1247,7 +1248,7 @@ extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned The parameter found is set TRUE if a number was found. */ -extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found) +extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, bool *found) { unsigned int n; unsigned int l; @@ -1266,7 +1267,7 @@ extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, } while ((n < l) && ((IsDecimalDigitValid (DynamicStrings_char (s, static_cast<int> (n)), base, &c)) || (IsHexidecimalDigitValid (DynamicStrings_char (s, static_cast<int> (n)), base, &c)))) { - (*found) = TRUE; + (*found) = true; n += 1; } } @@ -1289,7 +1290,7 @@ extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, abcdef are used, and if FALSE then ABCDEF are used. */ -extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower) +extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower) { DynamicStrings_String s; long unsigned int c; @@ -1303,11 +1304,11 @@ extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, c = ((long unsigned int ) (labs (i+1)))+1; if (width > 0) { - return DynamicStrings_ConCat (StringConvert_LongIntegerToString (-((long int ) (c / ((long unsigned int ) (base)))), width-1, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_LongIntegerToString (static_cast<long int> (c % ((long unsigned int ) (base))), 0, ' ', FALSE, base, lower))); + return DynamicStrings_ConCat (StringConvert_LongIntegerToString (-((long int ) (c / ((long unsigned int ) (base)))), width-1, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_LongIntegerToString (static_cast<long int> (c % ((long unsigned int ) (base))), 0, ' ', false, base, lower))); } else { - return DynamicStrings_ConCat (StringConvert_LongIntegerToString (-((long int ) (c / ((long unsigned int ) (base)))), 0, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_LongIntegerToString (static_cast<long int> (c % ((long unsigned int ) (base))), 0, ' ', FALSE, base, lower))); + return DynamicStrings_ConCat (StringConvert_LongIntegerToString (-((long int ) (c / ((long unsigned int ) (base)))), 0, padding, sign, base, lower), DynamicStrings_Mark (StringConvert_LongIntegerToString (static_cast<long int> (c % ((long unsigned int ) (base))), 0, ' ', false, base, lower))); } } else @@ -1329,7 +1330,7 @@ extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, } if (i > ((long int ) (base-1))) { - s = DynamicStrings_ConCat (DynamicStrings_ConCat (s, DynamicStrings_Mark (StringConvert_LongIntegerToString (i / ((long int ) (base)), 0, ' ', FALSE, base, lower))), DynamicStrings_Mark (StringConvert_LongIntegerToString (i % ((long int ) (base)), 0, ' ', FALSE, base, lower))); + s = DynamicStrings_ConCat (DynamicStrings_ConCat (s, DynamicStrings_Mark (StringConvert_LongIntegerToString (i / ((long int ) (base)), 0, ' ', false, base, lower))), DynamicStrings_Mark (StringConvert_LongIntegerToString (i % ((long int ) (base)), 0, ' ', false, base, lower))); } else { @@ -1367,18 +1368,18 @@ extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, The parameter found is set TRUE if a number was found. */ -extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, unsigned int *found) +extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, bool *found) { unsigned int n; unsigned int l; long unsigned int c; - unsigned int negative; + bool negative; s = DynamicStrings_RemoveWhitePrefix (s); /* returns a new string, s */ l = DynamicStrings_Length (s); /* returns a new string, s */ c = 0; n = 0; - negative = FALSE; + negative = false; if (n < l) { /* parse leading + and - */ @@ -1392,7 +1393,7 @@ extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, } while ((n < l) && ((IsDecimalDigitValidLong (DynamicStrings_char (s, static_cast<int> (n)), base, &c)) || (IsHexidecimalDigitValidLong (DynamicStrings_char (s, static_cast<int> (n)), base, &c)))) { - (*found) = TRUE; + (*found) = true; n += 1; } } @@ -1421,7 +1422,7 @@ extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, abcdef are used, and if FALSE then ABCDEF are used. */ -extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower) +extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, bool lower) { DynamicStrings_String s; @@ -1466,7 +1467,7 @@ extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsign The parameter found is set TRUE if a number was found. */ -extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found) +extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, bool *found) { unsigned int n; unsigned int l; @@ -1485,7 +1486,7 @@ extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_ } while ((n < l) && ((IsDecimalDigitValidLong (DynamicStrings_char (s, static_cast<int> (n)), base, &c)) || (IsHexidecimalDigitValidLong (DynamicStrings_char (s, static_cast<int> (n)), base, &c)))) { - (*found) = TRUE; + (*found) = true; n += 1; } } @@ -1507,7 +1508,7 @@ extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_ abcdef are used, and if FALSE then ABCDEF are used. */ -extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower) +extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, bool lower) { DynamicStrings_String s; @@ -1552,7 +1553,7 @@ extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsi The parameter found is set TRUE if a number was found. */ -extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found) +extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, bool *found) { unsigned int n; unsigned int l; @@ -1571,7 +1572,7 @@ extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicString } while ((n < l) && ((IsDecimalDigitValidShort (DynamicStrings_char (s, static_cast<int> (n)), base, &c)) || (IsHexidecimalDigitValidShort (DynamicStrings_char (s, static_cast<int> (n)), base, &c)))) { - (*found) = TRUE; + (*found) = true; n += 1; } } @@ -1588,7 +1589,7 @@ extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicString extern "C" int StringConvert_stoi (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToInteger (s, 10, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1600,9 +1601,9 @@ extern "C" int StringConvert_stoi (DynamicStrings_String s) itos - integer to decimal string. */ -extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, unsigned int sign) +extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, bool sign) { - return StringConvert_IntegerToString (i, width, padding, sign, 10, FALSE); + return StringConvert_IntegerToString (i, width, padding, sign, 10, false); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1614,7 +1615,7 @@ extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, extern "C" DynamicStrings_String StringConvert_ctos (unsigned int c, unsigned int width, char padding) { - return StringConvert_CardinalToString (c, width, padding, 10, FALSE); + return StringConvert_CardinalToString (c, width, padding, 10, false); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1626,7 +1627,7 @@ extern "C" DynamicStrings_String StringConvert_ctos (unsigned int c, unsigned in extern "C" unsigned int StringConvert_stoc (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToCardinal (s, 10, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1640,7 +1641,7 @@ extern "C" unsigned int StringConvert_stoc (DynamicStrings_String s) extern "C" int StringConvert_hstoi (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToInteger (s, 16, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1654,7 +1655,7 @@ extern "C" int StringConvert_hstoi (DynamicStrings_String s) extern "C" int StringConvert_ostoi (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToInteger (s, 8, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1668,7 +1669,7 @@ extern "C" int StringConvert_ostoi (DynamicStrings_String s) extern "C" int StringConvert_bstoi (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToInteger (s, 2, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1682,7 +1683,7 @@ extern "C" int StringConvert_bstoi (DynamicStrings_String s) extern "C" unsigned int StringConvert_hstoc (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToCardinal (s, 16, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1696,7 +1697,7 @@ extern "C" unsigned int StringConvert_hstoc (DynamicStrings_String s) extern "C" unsigned int StringConvert_ostoc (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToCardinal (s, 8, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1710,7 +1711,7 @@ extern "C" unsigned int StringConvert_ostoc (DynamicStrings_String s) extern "C" unsigned int StringConvert_bstoc (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToCardinal (s, 2, &found); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1722,9 +1723,9 @@ extern "C" unsigned int StringConvert_bstoc (DynamicStrings_String s) StringToLongreal - returns a LONGREAL and sets found to TRUE if a legal number is seen. */ -extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, unsigned int *found) +extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, bool *found) { - unsigned int error; + bool error; long double value; s = DynamicStrings_RemoveWhitePrefix (s); /* new string is created */ @@ -1763,16 +1764,16 @@ extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, extern "C" DynamicStrings_String StringConvert_LongrealToString (long double x, unsigned int TotalWidth, unsigned int FractionWidth) { - unsigned int maxprecision; + bool maxprecision; DynamicStrings_String s; void * r; int point; - unsigned int sign; + bool sign; int l; if (TotalWidth == 0) { - maxprecision = TRUE; + maxprecision = true; r = ldtoa_ldtoa (x, ldtoa_decimaldigits, 100, &point, &sign); } else @@ -1832,7 +1833,7 @@ extern "C" DynamicStrings_String StringConvert_LongrealToString (long double x, { s = DynamicStrings_Slice (DynamicStrings_Mark (StringConvert_ToDecimalPlaces (s, FractionWidth)), 0, static_cast<int> (TotalWidth-1)); s = DynamicStrings_ConCat (DynamicStrings_InitStringChar ('-'), DynamicStrings_Mark (s)); - sign = FALSE; + sign = false; } else { @@ -1846,7 +1847,7 @@ extern "C" DynamicStrings_String StringConvert_LongrealToString (long double x, { s = StringConvert_ToDecimalPlaces (s, FractionWidth); s = DynamicStrings_ConCat (DynamicStrings_InitStringChar ('-'), DynamicStrings_Mark (s)); - sign = FALSE; + sign = false; } else { @@ -1871,7 +1872,7 @@ extern "C" DynamicStrings_String StringConvert_LongrealToString (long double x, extern "C" double StringConvert_stor (DynamicStrings_String s) { - unsigned int found; + bool found; return (double ) (StringConvert_StringToLongreal (s, &found)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1885,7 +1886,7 @@ extern "C" double StringConvert_stor (DynamicStrings_String s) extern "C" long double StringConvert_stolr (DynamicStrings_String s) { - unsigned int found; + bool found; return StringConvert_StringToLongreal (s, &found); /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/GStringConvert.h b/gcc/m2/mc-boot/GStringConvert.h index fc320fa..d3826fa 100644 --- a/gcc/m2/mc-boot/GStringConvert.h +++ b/gcc/m2/mc-boot/GStringConvert.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -61,7 +62,7 @@ extern "C" { abcdef are used, and if FALSE then ABCDEF are used. */ -EXTERN DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower); +EXTERN DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower); /* CardinalToString - converts CARDINAL, c, into a String. The field @@ -74,7 +75,7 @@ EXTERN DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int abcdef are used, and if FALSE then ABCDEF are used. */ -EXTERN DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); +EXTERN DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); /* StringToInteger - converts a string, s, of, base, into an INTEGER. @@ -84,7 +85,7 @@ EXTERN DynamicStrings_String StringConvert_CardinalToString (unsigned int c, uns The parameter found is set TRUE if a number was found. */ -EXTERN int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, unsigned int *found); +EXTERN int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, bool *found); /* StringToCardinal - converts a string, s, of, base, into a CARDINAL. @@ -94,7 +95,7 @@ EXTERN int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int The parameter found is set TRUE if a number was found. */ -EXTERN unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +EXTERN unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, bool *found); /* LongIntegerToString - converts LONGINT, i, into a String. The field with @@ -108,7 +109,7 @@ EXTERN unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, uns abcdef are used, and if FALSE then ABCDEF are used. */ -EXTERN DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower); +EXTERN DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower); /* StringToLongInteger - converts a string, s, of, base, into an LONGINT. @@ -118,7 +119,7 @@ EXTERN DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsi The parameter found is set TRUE if a number was found. */ -EXTERN long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, unsigned int *found); +EXTERN long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, bool *found); /* LongCardinalToString - converts LONGCARD, c, into a String. The field @@ -131,7 +132,7 @@ EXTERN long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsi abcdef are used, and if FALSE then ABCDEF are used. */ -EXTERN DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); +EXTERN DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); /* StringToLongCardinal - converts a string, s, of, base, into a LONGCARD. @@ -141,7 +142,7 @@ EXTERN DynamicStrings_String StringConvert_LongCardinalToString (long unsigned i The parameter found is set TRUE if a number was found. */ -EXTERN long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +EXTERN long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, bool *found); /* ShortCardinalToString - converts SHORTCARD, c, into a String. The field @@ -154,7 +155,7 @@ EXTERN long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_Stri abcdef are used, and if FALSE then ABCDEF are used. */ -EXTERN DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); +EXTERN DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); /* StringToShortCardinal - converts a string, s, of, base, into a SHORTCARD. @@ -164,7 +165,7 @@ EXTERN DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned The parameter found is set TRUE if a number was found. */ -EXTERN short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +EXTERN short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, bool *found); /* stoi - decimal string to INTEGER @@ -176,7 +177,7 @@ EXTERN int StringConvert_stoi (DynamicStrings_String s); itos - integer to decimal string. */ -EXTERN DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, unsigned int sign); +EXTERN DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, bool sign); /* ctos - cardinal to decimal string. @@ -231,7 +232,7 @@ EXTERN unsigned int StringConvert_bstoc (DynamicStrings_String s); if a legal number is seen. */ -EXTERN long double StringConvert_StringToLongreal (DynamicStrings_String s, unsigned int *found); +EXTERN long double StringConvert_StringToLongreal (DynamicStrings_String s, bool *found); /* LongrealToString - converts a LONGREAL number, Real, which has, diff --git a/gcc/m2/mc-boot/GSysExceptions.h b/gcc/m2/mc-boot/GSysExceptions.h index bcc0a41..1dcb55d 100644 --- a/gcc/m2/mc-boot/GSysExceptions.h +++ b/gcc/m2/mc-boot/GSysExceptions.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GSysStorage.cc b/gcc/m2/mc-boot/GSysStorage.cc index 98c03f6..ea7d473 100644 --- a/gcc/m2/mc-boot/GSysStorage.cc +++ b/gcc/m2/mc-boot/GSysStorage.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -52,12 +53,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GDebug.h" # include "GSYSTEM.h" -# define enableDeallocation TRUE -# define enableZero FALSE -# define enableTrace FALSE +# define enableDeallocation true +# define enableZero false +# define enableTrace false static unsigned int callno; -static unsigned int zero; -static unsigned int trace; +static bool zero; +static bool trace; extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size); extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size); @@ -79,7 +80,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size); is resized accordingly. */ -extern "C" unsigned int SysStorage_Available (unsigned int size); +extern "C" bool SysStorage_Available (unsigned int size); /* Init - initializes the heap. This does nothing on a GNU/Linux system. @@ -182,7 +183,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) is resized accordingly. */ -extern "C" unsigned int SysStorage_Available (unsigned int size) +extern "C" bool SysStorage_Available (unsigned int size) { void * a; @@ -198,7 +199,7 @@ extern "C" unsigned int SysStorage_Available (unsigned int size) { libc_printf ((const char *) " no\\n", 7, size); } - return FALSE; + return false; } else { @@ -207,7 +208,7 @@ extern "C" unsigned int SysStorage_Available (unsigned int size) libc_printf ((const char *) " yes\\n", 8, size); } libc_free (a); - return TRUE; + return true; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -232,7 +233,7 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut } else { - trace = FALSE; + trace = false; } if (enableZero) { @@ -240,7 +241,7 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut } else { - zero = FALSE; + zero = false; } } diff --git a/gcc/m2/mc-boot/GSysStorage.h b/gcc/m2/mc-boot/GSysStorage.h index 10b89b3..df8bf89 100644 --- a/gcc/m2/mc-boot/GSysStorage.h +++ b/gcc/m2/mc-boot/GSysStorage.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -77,7 +78,7 @@ EXTERN void SysStorage_REALLOCATE (void * *a, unsigned int size); Available - returns TRUE if, size, bytes can be allocated. */ -EXTERN unsigned int SysStorage_Available (unsigned int size); +EXTERN bool SysStorage_Available (unsigned int size); /* Init - initializes the heap. diff --git a/gcc/m2/mc-boot/GTimeString.cc b/gcc/m2/mc-boot/GTimeString.cc index 7e50f4b..1ad7a32 100644 --- a/gcc/m2/mc-boot/GTimeString.cc +++ b/gcc/m2/mc-boot/GTimeString.cc @@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GTimeString.h b/gcc/m2/mc-boot/GTimeString.h index a5b2618..061e111 100644 --- a/gcc/m2/mc-boot/GTimeString.h +++ b/gcc/m2/mc-boot/GTimeString.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GUnixArgs.h b/gcc/m2/mc-boot/GUnixArgs.h index 9a12834..8c56ead 100644 --- a/gcc/m2/mc-boot/GUnixArgs.h +++ b/gcc/m2/mc-boot/GUnixArgs.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Galists.cc b/gcc/m2/mc-boot/Galists.cc index 3e84a50..d3e576d 100644 --- a/gcc/m2/mc-boot/Galists.cc +++ b/gcc/m2/mc-boot/Galists.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -122,7 +123,7 @@ extern "C" void alists_removeItemFromList (alists_alist l, void * c); isItemInList - returns true if a ADDRESS, c, was found in alist, l. */ -extern "C" unsigned int alists_isItemInList (alists_alist l, void * c); +extern "C" bool alists_isItemInList (alists_alist l, void * c); /* foreachItemInListDo - calls procedure, P, foreach item in alist, l. @@ -330,11 +331,11 @@ extern "C" void alists_removeItemFromList (alists_alist l, void * c) { alists_alist p; unsigned int i; - unsigned int found; + bool found; if (l != NULL) { - found = FALSE; + found = false; p = NULL; do { i = 1; @@ -344,7 +345,7 @@ extern "C" void alists_removeItemFromList (alists_alist l, void * c) } if ((i <= l->noOfelements) && (l->elements.array[i-1] == c)) { - found = TRUE; + found = true; } else { @@ -364,7 +365,7 @@ extern "C" void alists_removeItemFromList (alists_alist l, void * c) isItemInList - returns true if a ADDRESS, c, was found in alist, l. */ -extern "C" unsigned int alists_isItemInList (alists_alist l, void * c) +extern "C" bool alists_isItemInList (alists_alist l, void * c) { unsigned int i; @@ -374,7 +375,7 @@ extern "C" unsigned int alists_isItemInList (alists_alist l, void * c) { if (l->elements.array[i-1] == c) { - return TRUE; + return true; } else { @@ -383,7 +384,7 @@ extern "C" unsigned int alists_isItemInList (alists_alist l, void * c) } l = l->next; } while (! (l == NULL)); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/Galists.h b/gcc/m2/mc-boot/Galists.h index 02724784..77601a2 100644 --- a/gcc/m2/mc-boot/Galists.h +++ b/gcc/m2/mc-boot/Galists.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -110,7 +111,7 @@ EXTERN void alists_removeItemFromList (alists_alist l, void * c); isItemInList - returns true if a ADDRESS, c, was found in alist, l. */ -EXTERN unsigned int alists_isItemInList (alists_alist l, void * c); +EXTERN bool alists_isItemInList (alists_alist l, void * c); /* foreachItemInListDo - calls procedure, P, foreach item in alist, l. diff --git a/gcc/m2/mc-boot/Gdecl.cc b/gcc/m2/mc-boot/Gdecl.cc index 4a85163..a9712d3 100644 --- a/gcc/m2/mc-boot/Gdecl.cc +++ b/gcc/m2/mc-boot/Gdecl.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -143,14 +144,14 @@ typedef struct StdIO_ProcRead_p StdIO_ProcRead; # define indentation 3 # define indentationC 2 -# define debugScopes FALSE -# define debugDecl FALSE -# define caseException TRUE -# define returnException TRUE -# define forceCompoundStatement TRUE -# define enableDefForCStrings FALSE -# define enableMemsetOnAllocation TRUE -# define forceQualified TRUE +# define debugScopes false +# define debugDecl false +# define caseException true +# define returnException true +# define forceCompoundStatement true +# define enableDefForCStrings false +# define enableMemsetOnAllocation true +# define forceQualified true typedef struct decl_nodeRec_r decl_nodeRec; typedef struct decl_intrinsicT_r decl_intrinsicT; @@ -335,13 +336,13 @@ struct alists__T14_a { void * array[MaxnoOfelements-1+1]; }; typedef void (*Indexing_IndexProcedure_t) (void *); struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; }; -typedef unsigned int (*decl_isNodeF_t) (decl_node); +typedef bool (*decl_isNodeF_t) (decl_node); struct decl_isNodeF_p { decl_isNodeF_t proc; }; typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *); struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; }; -typedef unsigned int (*symbolKey_isSymbol_t) (void *); +typedef bool (*symbolKey_isSymbol_t) (void *); struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; }; struct libc_tm_r { @@ -374,7 +375,7 @@ struct mcError__T11_r { mcError_error parent; mcError_error child; mcError_error next; - unsigned int fatal; + bool fatal; DynamicStrings_String s; unsigned int token; }; @@ -407,7 +408,7 @@ struct decl_setvalueT_r { struct decl_identlistT_r { wlists_wlist names; - unsigned int cnamed; + bool cnamed; }; struct decl_commentT_r { @@ -432,8 +433,8 @@ struct decl_typeT_r { nameKey_Name name; decl_node type; decl_node scope; - unsigned int isHidden; - unsigned int isInternal; + bool isHidden; + bool isInternal; }; struct decl_recordT_r { @@ -474,13 +475,13 @@ struct decl_arrayT_r { decl_node subr; decl_node type; decl_node scope; - unsigned int isUnbounded; + bool isUnbounded; }; struct decl_stringT_r { nameKey_Name name; unsigned int length; - unsigned int isCharCompatible; + bool isCharCompatible; DynamicStrings_String cstring; unsigned int clength; DynamicStrings_String cchar; @@ -502,18 +503,18 @@ struct decl_varparamT_r { decl_node namelist; decl_node type; decl_node scope; - unsigned int isUnbounded; - unsigned int isForC; - unsigned int isUsed; + bool isUnbounded; + bool isForC; + bool isUsed; }; struct decl_paramT_r { decl_node namelist; decl_node type; decl_node scope; - unsigned int isUnbounded; - unsigned int isForC; - unsigned int isUsed; + bool isUnbounded; + bool isForC; + bool isUsed; }; struct decl_varargsT_r { @@ -536,7 +537,7 @@ struct decl_varientfieldT_r { nameKey_Name name; decl_node parent; decl_node varient; - unsigned int simple; + bool simple; Indexing_Index listOfSons; decl_node scope; }; @@ -616,8 +617,8 @@ struct decl_scopeT_r { struct decl_proctypeT_r { Indexing_Index parameters; - unsigned int returnopt; - unsigned int vararg; + bool returnopt; + bool vararg; decl_node optarg_; decl_node scope; decl_node returnType; @@ -645,7 +646,7 @@ struct decl_nodeProcedure_p { decl_nodeProcedure_t proc; }; struct decl_cnameT_r { nameKey_Name name; - unsigned int init; + bool init; }; struct Indexing__T5_r { @@ -654,7 +655,7 @@ struct Indexing__T5_r { unsigned int Used; unsigned int Low; unsigned int High; - unsigned int Debug; + bool Debug; unsigned int Map; }; @@ -662,7 +663,7 @@ struct mcComment__T6_r { mcComment_commentType type; DynamicStrings_String content; nameKey_Name procName; - unsigned int used; + bool used; }; struct wlists__T10_a { unsigned int array[maxNoOfElements-1+1]; }; @@ -678,7 +679,7 @@ struct decl_intrinsicT_r { unsigned int noArgs; decl_node type; decl_commentPair intrinsicComment; - unsigned int postUnreachable; + bool postUnreachable; }; struct decl_funccallT_r { @@ -699,17 +700,17 @@ struct decl_varT_r { decl_node type; decl_node decl; decl_node scope; - unsigned int isInitialised; - unsigned int isParameter; - unsigned int isVarParameter; - unsigned int isUsed; + bool isInitialised; + bool isParameter; + bool isVarParameter; + bool isUsed; decl_cnameT cname; }; struct decl_recordfieldT_r { nameKey_Name name; decl_node type; - unsigned int tag; + bool tag; decl_node parent; decl_node varient; decl_node scope; @@ -767,13 +768,13 @@ struct decl_procedureT_r { decl_scopeT decls; decl_node scope; Indexing_Index parameters; - unsigned int isForC; - unsigned int built; - unsigned int checking; - unsigned int returnopt; - unsigned int vararg; - unsigned int noreturnused; - unsigned int noreturn; + bool isForC; + bool built; + bool checking; + bool returnopt; + bool vararg; + bool noreturnused; + bool noreturn; unsigned int paramcount; decl_node optarg_; decl_node returnType; @@ -792,25 +793,25 @@ struct decl_moduleT_r { decl_scopeT decls; decl_node beginStatements; decl_node finallyStatements; - unsigned int enumsComplete; - unsigned int constsComplete; - unsigned int visited; + bool enumsComplete; + bool constsComplete; + bool visited; decl_commentPair com; }; struct decl_defT_r { nameKey_Name name; nameKey_Name source; - unsigned int hasHidden; - unsigned int forC; + bool hasHidden; + bool forC; Indexing_Index exported; Indexing_Index importedModules; decl_fixupInfo constFixup; decl_fixupInfo enumFixup; decl_scopeT decls; - unsigned int enumsComplete; - unsigned int constsComplete; - unsigned int visited; + bool enumsComplete; + bool constsComplete; + bool visited; decl_commentPair com; }; @@ -824,9 +825,9 @@ struct decl_impT_r { decl_node finallyStatements; decl_node definitionModule; decl_scopeT decls; - unsigned int enumsComplete; - unsigned int constsComplete; - unsigned int visited; + bool enumsComplete; + bool constsComplete; + bool visited; decl_commentPair com; }; @@ -845,8 +846,8 @@ struct wlists__T9_r { struct mcPretty__T12_r { mcPretty_writeProc write_; mcPretty_writeLnProc writeln; - unsigned int needsSpace; - unsigned int needsIndent; + bool needsSpace; + bool needsIndent; unsigned int seekPos; unsigned int curLine; unsigned int curPos; @@ -863,10 +864,10 @@ typedef struct DynamicStrings_DebugInfo_r DynamicStrings_DebugInfo; typedef enum {DynamicStrings_inuse, DynamicStrings_marked, DynamicStrings_onlist, DynamicStrings_poisoned} DynamicStrings_desState; struct DynamicStrings_descriptor_r { - unsigned int charStarUsed; + bool charStarUsed; void *charStar; unsigned int charStarSize; - unsigned int charStarValid; + bool charStarValid; DynamicStrings_desState state; DynamicStrings_String garbage; }; @@ -1017,8 +1018,8 @@ static mcPretty_pretty doP; static alists_alist todoQ; static alists_alist partialQ; static alists_alist doneQ; -static unsigned int mustVisitScope; -static unsigned int simplified; +static bool mustVisitScope; +static bool simplified; static unsigned int tempCount; static decl_node globalNode; extern "C" void SYSTEM_ShiftVal (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, int ShiftCount); @@ -1031,9 +1032,9 @@ extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname extern "C" void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp); extern "C" void M2RTS_RegisterModule (void * name, void * libname, M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies); extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); -extern "C" unsigned int M2RTS_InstallTerminationProcedure (PROC p); +extern "C" bool M2RTS_InstallTerminationProcedure (PROC p); extern "C" void M2RTS_ExecuteInitialProcedures (void); -extern "C" unsigned int M2RTS_InstallInitialProcedure (PROC p); +extern "C" bool M2RTS_InstallInitialProcedure (PROC p); extern "C" void M2RTS_ExecuteTerminationProcedures (void); extern "C" void M2RTS_Terminate (void) __attribute__ ((noreturn)); extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); @@ -1092,25 +1093,25 @@ extern "C" unsigned int decl_getFirstUsed (decl_node n); isDef - return TRUE if node, n, is a definition module. */ -extern "C" unsigned int decl_isDef (decl_node n); +extern "C" bool decl_isDef (decl_node n); /* isImp - return TRUE if node, n, is an implementation module. */ -extern "C" unsigned int decl_isImp (decl_node n); +extern "C" bool decl_isImp (decl_node n); /* isImpOrModule - returns TRUE if, n, is a program module or implementation module. */ -extern "C" unsigned int decl_isImpOrModule (decl_node n); +extern "C" bool decl_isImpOrModule (decl_node n); /* isVisited - returns TRUE if the node was visited. */ -extern "C" unsigned int decl_isVisited (decl_node n); +extern "C" bool decl_isVisited (decl_node n); /* unsetVisited - unset the visited flag on a def/imp/module node. @@ -1134,7 +1135,7 @@ extern "C" void decl_setEnumsComplete (decl_node n); getEnumsComplete - gets the field from the def or imp or module, n. */ -extern "C" unsigned int decl_getEnumsComplete (decl_node n); +extern "C" bool decl_getEnumsComplete (decl_node n); /* resetEnumPos - resets the index into the saved list of enums inside @@ -1153,7 +1154,7 @@ extern "C" decl_node decl_getNextEnum (void); isModule - return TRUE if node, n, is a program module. */ -extern "C" unsigned int decl_isModule (decl_node n); +extern "C" bool decl_isModule (decl_node n); /* isMainModule - return TRUE if node, n, is the main module specified @@ -1161,7 +1162,7 @@ extern "C" unsigned int decl_isModule (decl_node n); implementation or program module. */ -extern "C" unsigned int decl_isMainModule (decl_node n); +extern "C" bool decl_isMainModule (decl_node n); /* setMainModule - sets node, n, as the main module to be compiled. @@ -1209,13 +1210,13 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n); isConst - returns TRUE if node, n, is a const. */ -extern "C" unsigned int decl_isConst (decl_node n); +extern "C" bool decl_isConst (decl_node n); /* isType - returns TRUE if node, n, is a type. */ -extern "C" unsigned int decl_isType (decl_node n); +extern "C" bool decl_isType (decl_node n); /* putType - places, exp, as the type alias to des. @@ -1247,32 +1248,32 @@ extern "C" void decl_putTypeHidden (decl_node des); isTypeHidden - returns TRUE if type, n, is hidden. */ -extern "C" unsigned int decl_isTypeHidden (decl_node n); +extern "C" bool decl_isTypeHidden (decl_node n); /* hasHidden - returns TRUE if module, n, has a hidden type. */ -extern "C" unsigned int decl_hasHidden (decl_node n); +extern "C" bool decl_hasHidden (decl_node n); /* isVar - returns TRUE if node, n, is a type. */ -extern "C" unsigned int decl_isVar (decl_node n); +extern "C" bool decl_isVar (decl_node n); /* isTemporary - returns TRUE if node, n, is a variable and temporary. */ -extern "C" unsigned int decl_isTemporary (decl_node n); +extern "C" bool decl_isTemporary (decl_node n); /* isExported - returns TRUE if symbol, n, is exported from the definition module. */ -extern "C" unsigned int decl_isExported (decl_node n); +extern "C" bool decl_isExported (decl_node n); /* getDeclScope - returns the node representing the @@ -1291,55 +1292,55 @@ extern "C" decl_node decl_getScope (decl_node n); isLiteral - returns TRUE if, n, is a literal. */ -extern "C" unsigned int decl_isLiteral (decl_node n); +extern "C" bool decl_isLiteral (decl_node n); /* isConstSet - returns TRUE if, n, is a constant set. */ -extern "C" unsigned int decl_isConstSet (decl_node n); +extern "C" bool decl_isConstSet (decl_node n); /* isEnumerationField - returns TRUE if, n, is an enumeration field. */ -extern "C" unsigned int decl_isEnumerationField (decl_node n); +extern "C" bool decl_isEnumerationField (decl_node n); /* isEnumeration - returns TRUE if node, n, is an enumeration type. */ -extern "C" unsigned int decl_isEnumeration (decl_node n); +extern "C" bool decl_isEnumeration (decl_node n); /* isUnbounded - returns TRUE if, n, is an unbounded array. */ -extern "C" unsigned int decl_isUnbounded (decl_node n); +extern "C" bool decl_isUnbounded (decl_node n); /* isParameter - returns TRUE if, n, is a parameter. */ -extern "C" unsigned int decl_isParameter (decl_node n); +extern "C" bool decl_isParameter (decl_node n); /* isVarParam - returns TRUE if, n, is a var parameter. */ -extern "C" unsigned int decl_isVarParam (decl_node n); +extern "C" bool decl_isVarParam (decl_node n); /* isParam - returns TRUE if, n, is a non var parameter. */ -extern "C" unsigned int decl_isParam (decl_node n); +extern "C" bool decl_isParam (decl_node n); /* isNonVarParam - is an alias to isParam. */ -extern "C" unsigned int decl_isNonVarParam (decl_node n); +extern "C" bool decl_isNonVarParam (decl_node n); /* addOptParameter - returns an optarg which has been created and added to @@ -1353,79 +1354,79 @@ extern "C" decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl isOptarg - returns TRUE if, n, is an optarg. */ -extern "C" unsigned int decl_isOptarg (decl_node n); +extern "C" bool decl_isOptarg (decl_node n); /* isRecord - returns TRUE if, n, is a record. */ -extern "C" unsigned int decl_isRecord (decl_node n); +extern "C" bool decl_isRecord (decl_node n); /* isRecordField - returns TRUE if, n, is a record field. */ -extern "C" unsigned int decl_isRecordField (decl_node n); +extern "C" bool decl_isRecordField (decl_node n); /* isVarientField - returns TRUE if, n, is a varient field. */ -extern "C" unsigned int decl_isVarientField (decl_node n); +extern "C" bool decl_isVarientField (decl_node n); /* isArray - returns TRUE if, n, is an array. */ -extern "C" unsigned int decl_isArray (decl_node n); +extern "C" bool decl_isArray (decl_node n); /* isProcType - returns TRUE if, n, is a procedure type. */ -extern "C" unsigned int decl_isProcType (decl_node n); +extern "C" bool decl_isProcType (decl_node n); /* isPointer - returns TRUE if, n, is a pointer. */ -extern "C" unsigned int decl_isPointer (decl_node n); +extern "C" bool decl_isPointer (decl_node n); /* isProcedure - returns TRUE if, n, is a procedure. */ -extern "C" unsigned int decl_isProcedure (decl_node n); +extern "C" bool decl_isProcedure (decl_node n); /* isVarient - returns TRUE if, n, is a varient record. */ -extern "C" unsigned int decl_isVarient (decl_node n); +extern "C" bool decl_isVarient (decl_node n); /* isSet - returns TRUE if, n, is a set type. */ -extern "C" unsigned int decl_isSet (decl_node n); +extern "C" bool decl_isSet (decl_node n); /* isSubrange - returns TRUE if, n, is a subrange type. */ -extern "C" unsigned int decl_isSubrange (decl_node n); +extern "C" bool decl_isSubrange (decl_node n); /* isZtype - returns TRUE if, n, is the Z type. */ -extern "C" unsigned int decl_isZtype (decl_node n); +extern "C" bool decl_isZtype (decl_node n); /* isRtype - returns TRUE if, n, is the R type. */ -extern "C" unsigned int decl_isRtype (decl_node n); +extern "C" bool decl_isRtype (decl_node n); /* makeConst - create, initialise and return a const node. @@ -1589,7 +1590,7 @@ extern "C" decl_node decl_lookupSym (nameKey_Name n); module, m, scope. */ -extern "C" void decl_addImportedModule (decl_node m, decl_node i, unsigned int scoped); +extern "C" void decl_addImportedModule (decl_node m, decl_node i, bool scoped); /* setSource - sets the source filename for module, n, to s. @@ -1685,13 +1686,13 @@ extern "C" void decl_putOptReturn (decl_node proc); makeVarParameter - returns a var parameter node with, name: type. */ -extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused); +extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, bool isused); /* makeNonVarParameter - returns a non var parameter node with, name: type. */ -extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused); +extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, bool isused); /* paramEnter - reset the parameter count. @@ -1716,21 +1717,21 @@ extern "C" decl_node decl_makeIdentList (void); ident, i, is unique. */ -extern "C" unsigned int decl_putIdent (decl_node n, nameKey_Name i); +extern "C" bool decl_putIdent (decl_node n, nameKey_Name i); /* addVarParameters - adds the identlist, i, of, type, to be VAR parameters in procedure, n. */ -extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused); +extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, bool isused); /* addNonVarParameters - adds the identlist, i, of, type, to be parameters in procedure, n. */ -extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused); +extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, bool isused); /* makeVarargs - returns a varargs node. @@ -1742,7 +1743,7 @@ extern "C" decl_node decl_makeVarargs (void); isVarargs - returns TRUE if, n, is a varargs node. */ -extern "C" unsigned int decl_isVarargs (decl_node n); +extern "C" bool decl_isVarargs (decl_node n); /* addParameter - adds a parameter, param, to procedure or proctype, proc. @@ -1782,7 +1783,7 @@ extern "C" decl_node decl_makePointerRef (decl_node ptr, decl_node field); isPointerRef - returns TRUE if, n, is a pointerref node. */ -extern "C" unsigned int decl_isPointerRef (decl_node n); +extern "C" bool decl_isPointerRef (decl_node n); /* makeDeRef - dereferences the pointer defined by, n. @@ -1838,7 +1839,7 @@ extern "C" decl_node decl_makeSetValue (void); isSetValue - returns TRUE if, n, is a setvalue node. */ -extern "C" unsigned int decl_isSetValue (decl_node n); +extern "C" bool decl_isSetValue (decl_node n); /* putSetValue - assigns the type, t, to the set value, n. The @@ -1872,7 +1873,7 @@ extern "C" decl_node decl_makeExpList (void); isExpList - returns TRUE if, n, is an explist node. */ -extern "C" unsigned int decl_isExpList (decl_node n); +extern "C" bool decl_isExpList (decl_node n); /* putExpList - places, expression, e, within the explist, n. @@ -1927,7 +1928,7 @@ extern "C" decl_node decl_makeStatementSequence (void); isStatementSequence - returns TRUE if node, n, is a statement sequence. */ -extern "C" unsigned int decl_isStatementSequence (decl_node n); +extern "C" bool decl_isStatementSequence (decl_node n); /* addStatement - adds node, n, as a statement to statememt sequence, s. @@ -1975,7 +1976,7 @@ extern "C" decl_node decl_makeReturn (void); isReturn - returns TRUE if node, n, is a return. */ -extern "C" unsigned int decl_isReturn (decl_node n); +extern "C" bool decl_isReturn (decl_node n); /* putReturn - assigns node, e, as the expression on the return node. @@ -2000,7 +2001,7 @@ extern "C" void decl_putWhile (decl_node n, decl_node e, decl_node s); isWhile - returns TRUE if node, n, is a while. */ -extern "C" unsigned int decl_isWhile (decl_node n); +extern "C" bool decl_isWhile (decl_node n); /* addWhileDoComment - adds body and after comments to while node, w. @@ -2047,7 +2048,7 @@ extern "C" decl_node decl_makeExit (decl_node l, unsigned int n); isExit - returns TRUE if node, n, is an exit. */ -extern "C" unsigned int decl_isExit (decl_node n); +extern "C" bool decl_isExit (decl_node n); /* makeLoop - creates and returns a loop node. @@ -2059,7 +2060,7 @@ extern "C" decl_node decl_makeLoop (void); isLoop - returns TRUE if, n, is a loop node. */ -extern "C" unsigned int decl_isLoop (decl_node n); +extern "C" bool decl_isLoop (decl_node n); /* putLoop - places statement sequence, s, into loop, l. @@ -2091,7 +2092,7 @@ extern "C" decl_node decl_makeIf (decl_node e, decl_node s); isIf - returns TRUE if, n, is an if node. */ -extern "C" unsigned int decl_isIf (decl_node n); +extern "C" bool decl_isIf (decl_node n); /* makeElsif - creates and returns an elsif node. @@ -2105,7 +2106,7 @@ extern "C" decl_node decl_makeElsif (decl_node i, decl_node e, decl_node s); isElsif - returns TRUE if node, n, is an elsif node. */ -extern "C" unsigned int decl_isElsif (decl_node n); +extern "C" bool decl_isElsif (decl_node n); /* putElse - the else is grafted onto the if/elsif node, i, @@ -2124,7 +2125,7 @@ extern "C" decl_node decl_makeFor (void); isFor - returns TRUE if node, n, is a for node. */ -extern "C" unsigned int decl_isFor (decl_node n); +extern "C" bool decl_isFor (decl_node n); /* putFor - assigns the fields of the for node with @@ -2147,7 +2148,7 @@ extern "C" decl_node decl_makeRepeat (void); isRepeat - returns TRUE if node, n, is a repeat node. */ -extern "C" unsigned int decl_isRepeat (decl_node n); +extern "C" bool decl_isRepeat (decl_node n); /* putRepeat - places statements, s, and expression, e, into @@ -2178,7 +2179,7 @@ extern "C" decl_node decl_makeCase (void); isCase - returns TRUE if node, n, is a case statement. */ -extern "C" unsigned int decl_isCase (decl_node n); +extern "C" bool decl_isCase (decl_node n); /* putCaseExpression - places expression, e, into case statement, n. @@ -2212,7 +2213,7 @@ extern "C" decl_node decl_makeCaseLabelList (decl_node l, decl_node s); isCaseLabelList - returns TRUE if, n, is a caselabellist. */ -extern "C" unsigned int decl_isCaseLabelList (decl_node n); +extern "C" bool decl_isCaseLabelList (decl_node n); /* makeCaseList - creates and returns a case statement node. @@ -2224,7 +2225,7 @@ extern "C" decl_node decl_makeCaseList (void); isCaseList - returns TRUE if, n, is a case list. */ -extern "C" unsigned int decl_isCaseList (decl_node n); +extern "C" bool decl_isCaseList (decl_node n); /* putCaseRange - places the case range lo..hi into caselist, n. @@ -2242,13 +2243,13 @@ extern "C" decl_node decl_makeRange (decl_node lo, decl_node hi); isRange - returns TRUE if node, n, is a range. */ -extern "C" unsigned int decl_isRange (decl_node n); +extern "C" bool decl_isRange (decl_node n); /* setNoReturn - sets noreturn field inside procedure. */ -extern "C" void decl_setNoReturn (decl_node n, unsigned int value); +extern "C" void decl_setNoReturn (decl_node n, bool value); /* dupExpr - duplicate the expression nodes, it does not duplicate @@ -2288,9 +2289,9 @@ extern "C" nameKey_Name nameKey_makeKey (const char *a_, unsigned int _a_high); extern "C" nameKey_Name nameKey_makekey (void * a); extern "C" void nameKey_getKey (nameKey_Name key, char *a, unsigned int _a_high); extern "C" unsigned int nameKey_lengthKey (nameKey_Name key); -extern "C" unsigned int nameKey_isKey (const char *a_, unsigned int _a_high); +extern "C" bool nameKey_isKey (const char *a_, unsigned int _a_high); extern "C" void nameKey_writeKey (nameKey_Name key); -extern "C" unsigned int nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2); +extern "C" bool nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2); extern "C" void * nameKey_keyToCharStar (nameKey_Name key); extern "C" symbolKey_symbolTree symbolKey_initTree (void); extern "C" void symbolKey_killTree (symbolKey_symbolTree *t); @@ -2310,7 +2311,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name); isEmptyTree - returns true if symbolTree, t, is empty. */ -extern "C" unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t); +extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t); /* doesTreeContainAny - returns true if symbolTree, t, contains any @@ -2320,7 +2321,7 @@ extern "C" unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t); left, hence we need two procedures. */ -extern "C" unsigned int symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p); +extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p); /* foreachNodeDo - for each node in symbolTree, t, a procedure, p, @@ -2338,7 +2339,7 @@ extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_perfo spaces on this line. */ -extern "C" mcComment_commentDesc mcComment_initComment (unsigned int onlySpaces); +extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces); /* addText - cs is a C string (null terminated) which contains comment text. @@ -2389,51 +2390,51 @@ extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_ isProcedureComment - returns TRUE if, cd, is a procedure comment. */ -extern "C" unsigned int mcComment_isProcedureComment (mcComment_commentDesc cd); +extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd); /* isBodyComment - returns TRUE if, cd, is a body comment. */ -extern "C" unsigned int mcComment_isBodyComment (mcComment_commentDesc cd); +extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd); /* isAfterComment - returns TRUE if, cd, is an after comment. */ -extern "C" unsigned int mcComment_isAfterComment (mcComment_commentDesc cd); -extern "C" void mcDebug_assert (unsigned int q); +extern "C" bool mcComment_isAfterComment (mcComment_commentDesc cd); +extern "C" void mcDebug_assert (bool q); extern "C" void mcDebug_writeDebug (const char *a_, unsigned int _a_high); extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size); extern "C" void Storage_DEALLOCATE (void * *a, unsigned int Size); extern "C" void Storage_REALLOCATE (void * *a, unsigned int Size); -extern "C" unsigned int Storage_Available (unsigned int Size); -extern "C" unsigned int SFIO_Exists (DynamicStrings_String fname); +extern "C" bool Storage_Available (unsigned int Size); +extern "C" bool SFIO_Exists (DynamicStrings_String fname); extern "C" FIO_File SFIO_OpenToRead (DynamicStrings_String fname); extern "C" FIO_File SFIO_OpenToWrite (DynamicStrings_String fname); -extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile); +extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile); extern "C" DynamicStrings_String SFIO_WriteS (FIO_File file, DynamicStrings_String s); extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file); -extern "C" unsigned int FIO_IsNoError (FIO_File f); -extern "C" unsigned int FIO_IsActive (FIO_File f); -extern "C" unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high); +extern "C" bool FIO_IsNoError (FIO_File f); +extern "C" bool FIO_IsActive (FIO_File f); +extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high); extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high); extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_high); -extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile); +extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile); extern "C" void FIO_Close (FIO_File f); -extern "C" unsigned int FIO_exists (void * fname, unsigned int flength); +extern "C" bool FIO_exists (void * fname, unsigned int flength); extern "C" FIO_File FIO_openToRead (void * fname, unsigned int flength); extern "C" FIO_File FIO_openToWrite (void * fname, unsigned int flength); -extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile); +extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile); extern "C" void FIO_FlushBuffer (FIO_File f); extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest); extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high); extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src); extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high); extern "C" void FIO_WriteChar (FIO_File f, char ch); -extern "C" unsigned int FIO_EOF (FIO_File f); -extern "C" unsigned int FIO_EOLN (FIO_File f); -extern "C" unsigned int FIO_WasEOLN (FIO_File f); +extern "C" bool FIO_EOF (FIO_File f); +extern "C" bool FIO_EOLN (FIO_File f); +extern "C" bool FIO_WasEOLN (FIO_File f); extern "C" char FIO_ReadChar (FIO_File f); extern "C" void FIO_UnReadChar (FIO_File f, char ch); extern "C" void FIO_WriteLine (FIO_File f); @@ -2531,21 +2532,21 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy Equal - returns TRUE if String, a, and, b, are equal. */ -extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b); +extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b); /* EqualCharStar - returns TRUE if contents of String, s, is the same as the string, a. */ -extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a); +extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a); /* EqualArray - returns TRUE if contents of String, s, is the same as the string, a. */ -extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high); +extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high); /* Mult - returns a new string which is n concatenations of String, s. @@ -2692,7 +2693,7 @@ extern "C" void DynamicStrings_PushAllocation (void); with an exit code of 1. */ -extern "C" void DynamicStrings_PopAllocation (unsigned int halt); +extern "C" void DynamicStrings_PopAllocation (bool halt); /* PopAllocationExemption - test to see that all strings are deallocated, except @@ -2704,19 +2705,19 @@ extern "C" void DynamicStrings_PopAllocation (unsigned int halt); with an exit code of 1. */ -extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e); -extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower); -extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); -extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, unsigned int *found); -extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); -extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower); -extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, unsigned int *found); -extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); -extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); -extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower); -extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found); +extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e); +extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower); +extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); +extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, bool *found); +extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, bool *found); +extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower); +extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, bool *found); +extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); +extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, bool *found); +extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, bool lower); +extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, bool *found); extern "C" int StringConvert_stoi (DynamicStrings_String s); -extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, unsigned int sign); +extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, bool sign); extern "C" DynamicStrings_String StringConvert_ctos (unsigned int c, unsigned int width, char padding); extern "C" unsigned int StringConvert_stoc (DynamicStrings_String s); extern "C" int StringConvert_hstoi (DynamicStrings_String s); @@ -2725,29 +2726,30 @@ extern "C" int StringConvert_bstoi (DynamicStrings_String s); extern "C" unsigned int StringConvert_hstoc (DynamicStrings_String s); extern "C" unsigned int StringConvert_ostoc (DynamicStrings_String s); extern "C" unsigned int StringConvert_bstoc (DynamicStrings_String s); -extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, unsigned int *found); +extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, bool *found); extern "C" DynamicStrings_String StringConvert_LongrealToString (long double x, unsigned int TotalWidth, unsigned int FractionWidth); extern "C" double StringConvert_stor (DynamicStrings_String s); extern "C" long double StringConvert_stolr (DynamicStrings_String s); extern "C" DynamicStrings_String StringConvert_ToSigFig (DynamicStrings_String s, unsigned int n); extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_String s, unsigned int n); extern "C" DynamicStrings_String mcOptions_handleOptions (void); -extern "C" unsigned int mcOptions_getQuiet (void); -extern "C" unsigned int mcOptions_getVerbose (void); -extern "C" unsigned int mcOptions_getInternalDebugging (void); +extern "C" bool mcOptions_getQuiet (void); +extern "C" bool mcOptions_getVerbose (void); +extern "C" bool mcOptions_getInternalDebugging (void); extern "C" DynamicStrings_String mcOptions_getCppCommandLine (void); extern "C" DynamicStrings_String mcOptions_getOutputFile (void); -extern "C" unsigned int mcOptions_getExtendedOpaque (void); -extern "C" void mcOptions_setDebugTopological (unsigned int value); -extern "C" unsigned int mcOptions_getDebugTopological (void); +extern "C" bool mcOptions_getExtendedOpaque (void); +extern "C" void mcOptions_setDebugTopological (bool value); +extern "C" bool mcOptions_getDebugTopological (void); extern "C" DynamicStrings_String mcOptions_getHPrefix (void); -extern "C" unsigned int mcOptions_getIgnoreFQ (void); -extern "C" unsigned int mcOptions_getGccConfigSystem (void); -extern "C" unsigned int mcOptions_getScaffoldDynamic (void); -extern "C" unsigned int mcOptions_getScaffoldMain (void); +extern "C" bool mcOptions_getIgnoreFQ (void); +extern "C" bool mcOptions_getGccConfigSystem (void); +extern "C" bool mcOptions_getScaffoldDynamic (void); +extern "C" bool mcOptions_getScaffoldMain (void); extern "C" void mcOptions_writeGPLheader (FIO_File f); -extern "C" void mcOptions_setSuppressNoReturn (unsigned int value); -extern "C" unsigned int mcOptions_getSuppressNoReturn (void); +extern "C" void mcOptions_setSuppressNoReturn (bool value); +extern "C" bool mcOptions_getSuppressNoReturn (void); +extern "C" bool mcOptions_useBool (void); extern "C" DynamicStrings_String FormatStrings_Sprintf0 (DynamicStrings_String fmt); extern "C" DynamicStrings_String FormatStrings_Sprintf1 (DynamicStrings_String fmt, const unsigned char *w_, unsigned int _w_high); extern "C" DynamicStrings_String FormatStrings_Sprintf2 (DynamicStrings_String fmt, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high); @@ -2973,7 +2975,7 @@ extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high); extern "C" mcComment_commentDesc mcLexBuf_getProcedureComment (void); extern "C" mcComment_commentDesc mcLexBuf_getBodyComment (void); extern "C" mcComment_commentDesc mcLexBuf_getAfterComment (void); -extern "C" unsigned int mcLexBuf_openSource (DynamicStrings_String s); +extern "C" bool mcLexBuf_openSource (DynamicStrings_String s); extern "C" void mcLexBuf_closeSource (void); extern "C" void mcLexBuf_reInitialize (void); extern "C" void mcLexBuf_resetForNewPass (void); @@ -2996,11 +2998,11 @@ extern "C" void mcLexBuf_setFile (void * filename); extern "C" void mcLexBuf_pushFile (void * filename); extern "C" void mcLexBuf_popFile (void * filename); extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high, char *c, unsigned int _c_high); -extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); -extern "C" unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +extern "C" bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +extern "C" bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); extern "C" unsigned int StrLib_StrLen (const char *a_, unsigned int _a_high); extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char *dest, unsigned int _dest_high); -extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); +extern "C" bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high); extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_high, char *b, unsigned int _b_high); /* @@ -3113,7 +3115,7 @@ extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i); of the dynamic array. */ -extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n); +extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n); /* HighIndice - returns the last legally accessible indice of this array. @@ -3143,7 +3145,7 @@ extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n); IsIndiceInIndex - returns TRUE if, a, is in the index, i. */ -extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a); +extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a); /* RemoveIndiceFromIndex - removes, a, from Index, i. @@ -3226,7 +3228,7 @@ extern "C" void alists_removeItemFromList (alists_alist l, void * c); isItemInList - returns true if a ADDRESS, c, was found in alist, l. */ -extern "C" unsigned int alists_isItemInList (alists_alist l, void * c); +extern "C" bool alists_isItemInList (alists_alist l, void * c); /* foreachItemInListDo - calls procedure, P, foreach item in alist, l. @@ -3304,7 +3306,7 @@ extern "C" void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsign isItemInList - returns true if a WORD, c, was found in wlist, l. */ -extern "C" unsigned int wlists_isItemInList (wlists_wlist l, unsigned int c); +extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c); /* foreachItemInListDo - calls procedure, P, foreach item in wlist, l. @@ -3354,8 +3356,8 @@ extern "C" void keyc_genDefs (mcPretty_pretty p); extern "C" void keyc_genConfigSystem (mcPretty_pretty p); extern "C" void keyc_enterScope (decl_node n); extern "C" void keyc_leaveScope (decl_node n); -extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes); -extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, unsigned int scopes); +extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, bool scopes); +extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, bool scopes); extern "C" void keyc_cp (void); extern "C" FIO_File mcStream_openFrag (unsigned int id); extern "C" void mcStream_setDest (FIO_File f); @@ -3389,7 +3391,7 @@ extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int *x); extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, unsigned int LineNo, const char *Module_, unsigned int _Module_high); extern "C" void Debug_DebugString (const char *a_, unsigned int _a_high); -extern "C" void Assertion_Assert (unsigned int Condition); +extern "C" void Assertion_Assert (bool Condition); extern "C" void StdIO_Read (char *ch); extern "C" void StdIO_Write (char ch); extern "C" void StdIO_PushOutput (StdIO_ProcWrite p); @@ -3425,7 +3427,7 @@ static void disposeNode (decl_node *n); isLocal - returns TRUE if symbol, n, is locally declared in a procedure. */ -static unsigned int isLocal (decl_node n); +static bool isLocal (decl_node n); /* importEnumFields - if, n, is an enumeration type import the all fields into module, m. @@ -3437,25 +3439,25 @@ static void importEnumFields (decl_node m, decl_node n); isComplex - returns TRUE if, n, is the complex type. */ -static unsigned int isComplex (decl_node n); +static bool isComplex (decl_node n); /* isLongComplex - returns TRUE if, n, is the longcomplex type. */ -static unsigned int isLongComplex (decl_node n); +static bool isLongComplex (decl_node n); /* isShortComplex - returns TRUE if, n, is the shortcomplex type. */ -static unsigned int isShortComplex (decl_node n); +static bool isShortComplex (decl_node n); /* isAProcType - returns TRUE if, n, is a proctype or proc node. */ -static unsigned int isAProcType (decl_node n); +static bool isAProcType (decl_node n); /* initFixupInfo - initialize the fixupInfo record. @@ -3485,7 +3487,7 @@ static decl_node makeModule (nameKey_Name n); isDefForC - returns TRUE if the definition module was defined FOR "C". */ -static unsigned int isDefForC (decl_node n); +static bool isDefForC (decl_node n); /* initDecls - initialize the decls, scopeT. @@ -3535,7 +3537,7 @@ static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t); putVarBool - assigns the four booleans associated with a variable. */ -static void putVarBool (decl_node v, unsigned int init, unsigned int param, unsigned int isvar, unsigned int isused); +static void putVarBool (decl_node v, bool init, bool param, bool isvar, bool isused); /* checkPtr - in C++ we need to create a typedef for a pointer @@ -3548,13 +3550,13 @@ static decl_node checkPtr (decl_node n); isVarDecl - returns TRUE if, n, is a vardecl node. */ -static unsigned int isVarDecl (decl_node n); +static bool isVarDecl (decl_node n); /* makeVariablesFromParameters - creates variables which are really parameters. */ -static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, unsigned int isvar, unsigned int isused); +static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, bool isvar, bool isused); /* addProcedureToScope - add a procedure name n and node d to the @@ -3585,19 +3587,19 @@ static decl_node makeOptParameter (decl_node l, decl_node type, decl_node init); setwatch - assign the globalNode to n. */ -static unsigned int setwatch (decl_node n); +static bool setwatch (decl_node n); /* runwatch - set the globalNode to an identlist. */ -static unsigned int runwatch (void); +static bool runwatch (void); /* isIdentList - returns TRUE if, n, is an identlist. */ -static unsigned int isIdentList (decl_node n); +static bool isIdentList (decl_node n); /* identListLen - returns the length of identlist. @@ -3609,7 +3611,7 @@ static unsigned int identListLen (decl_node n); checkParameters - placeholder for future parameter checking. */ -static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned int isvar, unsigned int isused); +static void checkParameters (decl_node p, decl_node i, decl_node type, bool isvar, bool isused); /* checkMakeVariables - create shadow local variables for parameters providing that @@ -3617,7 +3619,7 @@ static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned a module or an implementation module. */ -static void checkMakeVariables (decl_node n, decl_node i, decl_node type, unsigned int isvar, unsigned int isused); +static void checkMakeVariables (decl_node n, decl_node i, decl_node type, bool isvar, bool isused); /* makeVarientField - create a varient field within varient, v, @@ -3672,7 +3674,7 @@ static decl_node getRecord (decl_node n); isConstExp - return TRUE if the node kind is a constexp. */ -static unsigned int isConstExp (decl_node c); +static bool isConstExp (decl_node c); /* addEnumToModule - adds enumeration type, e, into the list of enums @@ -3716,7 +3718,7 @@ static unsigned int expListLen (decl_node p); getConstExpComplete - gets the field from the def or imp or module, n. */ -static unsigned int getConstExpComplete (decl_node n); +static bool getConstExpComplete (decl_node n); /* addConstToModule - adds const exp, e, into the list of constant @@ -3735,7 +3737,7 @@ static decl_node doMakeConstExp (void); isAnyType - return TRUE if node n is any type kind. */ -static unsigned int isAnyType (decl_node n); +static bool isAnyType (decl_node n); /* makeVal - creates a VAL (type, expression) node. @@ -3782,7 +3784,7 @@ static void checkCHeaders (decl_node c); isFuncCall - returns TRUE if, n, is a function/procedure call. */ -static unsigned int isFuncCall (decl_node n); +static bool isFuncCall (decl_node n); /* putTypeInternal - marks type, des, as being an internally generated type. @@ -3794,7 +3796,7 @@ static void putTypeInternal (decl_node des); isTypeInternal - returns TRUE if type, n, is internal. */ -static unsigned int isTypeInternal (decl_node n); +static bool isTypeInternal (decl_node n); /* lookupBase - return node named n from the base symbol scope. @@ -3836,13 +3838,13 @@ static void out3 (const char *a_, unsigned int _a_high, unsigned int l, nameKey_ isUnary - returns TRUE if, n, is an unary node. */ -static unsigned int isUnary (decl_node n); +static bool isUnary (decl_node n); /* isBinary - returns TRUE if, n, is an binary node. */ -static unsigned int isBinary (decl_node n); +static bool isBinary (decl_node n); /* makeUnary - create a unary expression node with, e, as the argument @@ -3855,7 +3857,7 @@ static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res); isLeafString - returns TRUE if n is a leaf node which is a string constant. */ -static unsigned int isLeafString (decl_node n); +static bool isLeafString (decl_node n); /* getLiteralStringContents - return the contents of a literal node as a string. @@ -3911,19 +3913,19 @@ static decl_node doMakeComponentRef (decl_node rec, decl_node field); isComponentRef - */ -static unsigned int isComponentRef (decl_node n); +static bool isComponentRef (decl_node n); /* isArrayRef - returns TRUE if the node was an arrayref. */ -static unsigned int isArrayRef (decl_node n); +static bool isArrayRef (decl_node n); /* isDeref - returns TRUE if, n, is a deref node. */ -static unsigned int isDeref (decl_node n); +static bool isDeref (decl_node n); /* makeBase - create a base type or constant. @@ -3937,7 +3939,7 @@ static decl_node makeBase (decl_nodeT k); isOrdinal - returns TRUE if, n, is an ordinal type. */ -static unsigned int isOrdinal (decl_node n); +static bool isOrdinal (decl_node n); /* mixTypes - @@ -4015,7 +4017,7 @@ static decl_node getSymScope (decl_node n); isQualifiedForced - should the node be written with a module prefix? */ -static unsigned int isQualifiedForced (decl_node n); +static bool isQualifiedForced (decl_node n); /* getFQstring - @@ -4027,7 +4029,7 @@ static DynamicStrings_String getFQstring (decl_node n); getFQDstring - */ -static DynamicStrings_String getFQDstring (decl_node n, unsigned int scopes); +static DynamicStrings_String getFQDstring (decl_node n, bool scopes); /* getString - returns the name as a string. @@ -4057,13 +4059,13 @@ static void doConstC (decl_node n); needsParen - returns TRUE if expression, n, needs to be enclosed in (). */ -static unsigned int needsParen (decl_node n); +static bool needsParen (decl_node n); /* doUnary - */ -static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr, decl_node type, unsigned int l, unsigned int r); +static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr, decl_node type, bool l, bool r); /* doSetSub - perform l & (~ r) @@ -4075,13 +4077,13 @@ static void doSetSub (mcPretty_pretty p, decl_node left, decl_node right); doPolyBinary - */ -static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl_node right, unsigned int l, unsigned int r); +static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl_node right, bool l, bool r); /* doBinary - */ -static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, unsigned int l, unsigned int r, unsigned int unpackProc); +static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r, bool unpackProc); /* doPostUnary - @@ -4117,7 +4119,7 @@ static void doPointerRefC (mcPretty_pretty p, decl_node l, decl_node r); doPreBinary - */ -static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, unsigned int l, unsigned int r); +static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r); /* doConstExpr - @@ -4135,7 +4137,7 @@ static void doEnumerationField (mcPretty_pretty p, decl_node n); isZero - returns TRUE if node, n, is zero. */ -static unsigned int isZero (decl_node n); +static bool isZero (decl_node n); /* doArrayRef - @@ -4220,7 +4222,7 @@ static void doExprC (mcPretty_pretty p, decl_node n); doExprCup - */ -static void doExprCup (mcPretty_pretty p, decl_node n, unsigned int unpackProc); +static void doExprCup (mcPretty_pretty p, decl_node n, bool unpackProc); /* doExprM2 - @@ -4250,7 +4252,7 @@ static void doLiteral (mcPretty_pretty p, decl_node n); isString - returns TRUE if node, n, is a string. */ -static unsigned int isString (decl_node n); +static bool isString (decl_node n); /* doString - @@ -4293,7 +4295,7 @@ static unsigned int lenCstring (DynamicStrings_String s); outCstring - */ -static void outCstring (mcPretty_pretty p, decl_node s, unsigned int aString); +static void outCstring (mcPretty_pretty p, decl_node s, bool aString); /* doStringC - @@ -4305,13 +4307,13 @@ static void doStringC (mcPretty_pretty p, decl_node n); isPunct - */ -static unsigned int isPunct (char ch); +static bool isPunct (char ch); /* isWhite - */ -static unsigned int isWhite (char ch); +static bool isWhite (char ch); /* outText - @@ -4389,25 +4391,25 @@ static void initCname (decl_cnameT *c); doCname - */ -static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, unsigned int scopes); +static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes); /* getDName - */ -static nameKey_Name getDName (decl_node n, unsigned int scopes); +static nameKey_Name getDName (decl_node n, bool scopes); /* doDNameC - */ -static void doDNameC (mcPretty_pretty p, decl_node n, unsigned int scopes); +static void doDNameC (mcPretty_pretty p, decl_node n, bool scopes); /* doFQDNameC - */ -static void doFQDNameC (mcPretty_pretty p, decl_node n, unsigned int scopes); +static void doFQDNameC (mcPretty_pretty p, decl_node n, bool scopes); /* doFQNameC - @@ -4425,13 +4427,13 @@ static void doNameM2 (mcPretty_pretty p, decl_node n); doUsed - */ -static void doUsed (mcPretty_pretty p, unsigned int used); +static void doUsed (mcPretty_pretty p, bool used); /* doHighC - */ -static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, unsigned int isused); +static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, bool isused); /* doParamConstCast - @@ -4562,7 +4564,13 @@ static void doCompletePartialProcType (mcPretty_pretty p, decl_node t, decl_node isBase - */ -static unsigned int isBase (decl_node n); +static bool isBase (decl_node n); + +/* + doBoolC - +*/ + +static void doBoolC (mcPretty_pretty p); /* doBaseC - @@ -4574,7 +4582,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n); isSystem - */ -static unsigned int isSystem (decl_node n); +static bool isSystem (decl_node n); /* doSystemC - @@ -4622,13 +4630,13 @@ static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m); isBitset - */ -static unsigned int isBitset (decl_node n); +static bool isBitset (decl_node n); /* isNegative - returns TRUE if expression, n, is negative. */ -static unsigned int isNegative (decl_node n); +static bool isNegative (decl_node n); /* doSubrangeC - @@ -4677,7 +4685,7 @@ static void doTypeNameC (mcPretty_pretty p, decl_node n); isExternal - returns TRUE if symbol, n, was declared in another module. */ -static unsigned int isExternal (decl_node n); +static bool isExternal (decl_node n); /* doVarC - @@ -4707,13 +4715,13 @@ static void doProcedureComment (mcPretty_pretty p, DynamicStrings_String s); doProcedureHeadingC - */ -static void doProcedureHeadingC (decl_node n, unsigned int prototype); +static void doProcedureHeadingC (decl_node n, bool prototype); /* checkDeclareUnboundedParamCopyC - */ -static unsigned int checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n); +static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n); /* checkUnboundedParamCopyC - @@ -4913,14 +4921,14 @@ static void doStatementSequenceC (mcPretty_pretty p, decl_node s); isStatementSequenceEmpty - */ -static unsigned int isStatementSequenceEmpty (decl_node s); +static bool isStatementSequenceEmpty (decl_node s); /* isSingleStatement - returns TRUE if the statement sequence, s, has only one statement. */ -static unsigned int isSingleStatement (decl_node s); +static bool isSingleStatement (decl_node s); /* doCommentC - @@ -4944,13 +4952,13 @@ static void doReturnC (mcPretty_pretty p, decl_node s); isZtypeEquivalent - */ -static unsigned int isZtypeEquivalent (decl_node type); +static bool isZtypeEquivalent (decl_node type); /* isEquivalentType - returns TRUE if type1 and type2 are equivalent. */ -static unsigned int isEquivalentType (decl_node type1, decl_node type2); +static bool isEquivalentType (decl_node type1, decl_node type2); /* doExprCastC - build a cast if necessary. @@ -4962,7 +4970,7 @@ static void doExprCastC (mcPretty_pretty p, decl_node e, decl_node type); requiresUnpackProc - returns TRUE if either the expr is a procedure or the proctypes differ. */ -static unsigned int requiresUnpackProc (decl_node s); +static bool requiresUnpackProc (decl_node s); /* doAssignmentC - @@ -4974,7 +4982,7 @@ static void doAssignmentC (mcPretty_pretty p, decl_node s); containsStatement - */ -static unsigned int containsStatement (decl_node s); +static bool containsStatement (decl_node s); /* doCompoundStmt - @@ -4992,7 +5000,7 @@ static void doElsifC (mcPretty_pretty p, decl_node s); noIfElse - */ -static unsigned int noIfElse (decl_node n); +static bool noIfElse (decl_node n); /* noIfElseChained - returns TRUE if, n, is an IF statement which @@ -5001,26 +5009,26 @@ static unsigned int noIfElse (decl_node n); in a return value of TRUE. */ -static unsigned int noIfElseChained (decl_node n); +static bool noIfElseChained (decl_node n); /* hasIfElse - */ -static unsigned int hasIfElse (decl_node n); +static bool hasIfElse (decl_node n); /* isIfElse - */ -static unsigned int isIfElse (decl_node n); +static bool isIfElse (decl_node n); /* hasIfAndNoElse - returns TRUE if statement, n, is a single statement which is an IF and it has no else statement. */ -static unsigned int hasIfAndNoElse (decl_node n); +static bool hasIfAndNoElse (decl_node n); /* doIfC - issue an if statement and also place in an after comment if one exists. @@ -5105,14 +5113,14 @@ static void doAdrExprC (mcPretty_pretty p, decl_node n); typePair - */ -static unsigned int typePair (decl_node a, decl_node b, decl_node x, decl_node y); +static bool typePair (decl_node a, decl_node b, decl_node x, decl_node y); /* needsCast - return TRUE if the actual type parameter needs to be cast to the formal type. */ -static unsigned int needsCast (decl_node at, decl_node ft); +static bool needsCast (decl_node at, decl_node ft); /* checkSystemCast - checks to see if we are passing to/from @@ -5134,13 +5142,13 @@ static void emitN (mcPretty_pretty p, const char *a_, unsigned int _a_high, unsi which was declared inside a definition module for "C". */ -static unsigned int isForC (decl_node n); +static bool isForC (decl_node n); /* isDefForCNode - return TRUE if node n was declared inside a definition module for "C". */ -static unsigned int isDefForCNode (decl_node n); +static bool isDefForCNode (decl_node n); /* doFuncParamC - @@ -5166,13 +5174,13 @@ static decl_node getNthParam (Indexing_Index l, unsigned int i); doFuncArgsC - */ -static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, unsigned int needParen); +static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, bool needParen); /* doProcTypeArgsC - */ -static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args, unsigned int needParen); +static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args, bool needParen); /* doAdrArgC - @@ -5275,7 +5283,7 @@ static void doMaxC (mcPretty_pretty p, decl_node n); The intrinsic functions are represented as unary and binary nodes. */ -static unsigned int isIntrinsic (decl_node n); +static bool isIntrinsic (decl_node n); /* doHalt - @@ -5323,7 +5331,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n); isIntrinsicFunction - returns true if, n, is an instrinsic function. */ -static unsigned int isIntrinsicFunction (decl_node n); +static bool isIntrinsicFunction (decl_node n); /* doSizeC - @@ -5359,7 +5367,7 @@ static void doFuncCallC (mcPretty_pretty p, decl_node n); doCaseStatementC - */ -static void doCaseStatementC (mcPretty_pretty p, decl_node n, unsigned int needBreak); +static void doCaseStatementC (mcPretty_pretty p, decl_node n, bool needBreak); /* doExceptionC - @@ -5395,13 +5403,13 @@ static void doRangeIfListC (mcPretty_pretty p, decl_node e, decl_node c); doCaseLabels - */ -static void doCaseLabels (mcPretty_pretty p, decl_node n, unsigned int needBreak); +static void doCaseLabels (mcPretty_pretty p, decl_node n, bool needBreak); /* doCaseLabelListC - */ -static void doCaseLabelListC (mcPretty_pretty p, decl_node n, unsigned int haveElse); +static void doCaseLabelListC (mcPretty_pretty p, decl_node n, bool haveElse); /* doCaseIfLabels - @@ -5432,7 +5440,7 @@ static void doCaseIfElseC (mcPretty_pretty p, decl_node n); single values and not ranges. */ -static unsigned int canUseSwitchCaseLabels (decl_node n); +static bool canUseSwitchCaseLabels (decl_node n); /* canUseSwitch - returns TRUE if the case statement can be implement @@ -5440,7 +5448,7 @@ static unsigned int canUseSwitchCaseLabels (decl_node n); selectors are single values rather than ranges. */ -static unsigned int canUseSwitch (decl_node n); +static bool canUseSwitch (decl_node n); /* doCaseC - @@ -5495,49 +5503,49 @@ static void includeParameters (decl_node n); isHalt - */ -static unsigned int isHalt (decl_node n); +static bool isHalt (decl_node n); /* isReturnOrHalt - */ -static unsigned int isReturnOrHalt (decl_node n); +static bool isReturnOrHalt (decl_node n); /* isLastStatementReturn - */ -static unsigned int isLastStatementReturn (decl_node n); +static bool isLastStatementReturn (decl_node n); /* isLastStatementSequence - */ -static unsigned int isLastStatementSequence (decl_node n, decl_isNodeF q); +static bool isLastStatementSequence (decl_node n, decl_isNodeF q); /* isLastStatementIf - */ -static unsigned int isLastStatementIf (decl_node n, decl_isNodeF q); +static bool isLastStatementIf (decl_node n, decl_isNodeF q); /* isLastStatementElsif - */ -static unsigned int isLastStatementElsif (decl_node n, decl_isNodeF q); +static bool isLastStatementElsif (decl_node n, decl_isNodeF q); /* isLastStatementCase - */ -static unsigned int isLastStatementCase (decl_node n, decl_isNodeF q); +static bool isLastStatementCase (decl_node n, decl_isNodeF q); /* isLastStatement - returns TRUE if the last statement in, n, is, q. */ -static unsigned int isLastStatement (decl_node n, decl_isNodeF q); +static bool isLastStatement (decl_node n, decl_isNodeF q); /* doProcedureC - @@ -5766,13 +5774,13 @@ static decl_dependentState doDependants (alists_alist l, decl_node n); tryComplete - returns TRUE if node, n, can be and was completed. */ -static unsigned int tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v); +static bool tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v); /* tryCompleteFromPartial - */ -static unsigned int tryCompleteFromPartial (decl_node n, decl_nodeProcedure t); +static bool tryCompleteFromPartial (decl_node n, decl_nodeProcedure t); /* visitIntrinsicFunction - @@ -6141,7 +6149,7 @@ static void outputHiddenComplete (decl_node n); tryPartial - */ -static unsigned int tryPartial (decl_node n, decl_nodeProcedure pt); +static bool tryPartial (decl_node n, decl_nodeProcedure pt); /* outputPartialRecordArrayProcType - @@ -6551,13 +6559,13 @@ static void addGenericAfter (decl_node n, decl_node c); isAssignment - */ -static unsigned int isAssignment (decl_node n); +static bool isAssignment (decl_node n); /* isComment - returns TRUE if node, n, is a comment. */ -static unsigned int isComment (decl_node n); +static bool isComment (decl_node n); /* initPair - initialise the commentPair, c. @@ -6702,7 +6710,7 @@ static void disposeNode (decl_node *n) isLocal - returns TRUE if symbol, n, is locally declared in a procedure. */ -static unsigned int isLocal (decl_node n) +static bool isLocal (decl_node n) { decl_node s; @@ -6711,7 +6719,7 @@ static unsigned int isLocal (decl_node n) { return decl_isProcedure (s); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -6752,7 +6760,7 @@ static void importEnumFields (decl_node m, decl_node n) isComplex - returns TRUE if, n, is the complex type. */ -static unsigned int isComplex (decl_node n) +static bool isComplex (decl_node n) { return n == complexN; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -6764,7 +6772,7 @@ static unsigned int isComplex (decl_node n) isLongComplex - returns TRUE if, n, is the longcomplex type. */ -static unsigned int isLongComplex (decl_node n) +static bool isLongComplex (decl_node n) { return n == longcomplexN; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -6776,7 +6784,7 @@ static unsigned int isLongComplex (decl_node n) isShortComplex - returns TRUE if, n, is the shortcomplex type. */ -static unsigned int isShortComplex (decl_node n) +static bool isShortComplex (decl_node n) { return n == shortcomplexN; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -6788,7 +6796,7 @@ static unsigned int isShortComplex (decl_node n) isAProcType - returns TRUE if, n, is a proctype or proc node. */ -static unsigned int isAProcType (decl_node n) +static bool isAProcType (decl_node n) { mcDebug_assert (n != NULL); return (decl_isProcType (n)) || (n == procN); @@ -6824,16 +6832,16 @@ static decl_node makeDef (nameKey_Name n) d = newNode (decl_def); d->defF.name = n; d->defF.source = nameKey_NulName; - d->defF.hasHidden = FALSE; - d->defF.forC = FALSE; + d->defF.hasHidden = false; + d->defF.forC = false; d->defF.exported = Indexing_InitIndex (1); d->defF.importedModules = Indexing_InitIndex (1); d->defF.constFixup = initFixupInfo (); d->defF.enumFixup = initFixupInfo (); initDecls (&d->defF.decls); - d->defF.enumsComplete = FALSE; - d->defF.constsComplete = FALSE; - d->defF.visited = FALSE; + d->defF.enumsComplete = false; + d->defF.constsComplete = false; + d->defF.visited = false; initPair (&d->defF.com); return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -6859,9 +6867,9 @@ static decl_node makeImp (nameKey_Name n) d->impF.beginStatements = NULL; d->impF.finallyStatements = NULL; d->impF.definitionModule = NULL; - d->impF.enumsComplete = FALSE; - d->impF.constsComplete = FALSE; - d->impF.visited = FALSE; + d->impF.enumsComplete = false; + d->impF.constsComplete = false; + d->impF.visited = false; initPair (&d->impF.com); return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -6886,9 +6894,9 @@ static decl_node makeModule (nameKey_Name n) initDecls (&d->moduleF.decls); d->moduleF.beginStatements = NULL; d->moduleF.finallyStatements = NULL; - d->moduleF.enumsComplete = FALSE; - d->moduleF.constsComplete = FALSE; - d->moduleF.visited = FALSE; + d->moduleF.enumsComplete = false; + d->moduleF.constsComplete = false; + d->moduleF.visited = false; initPair (&d->moduleF.com); return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -6900,7 +6908,7 @@ static decl_node makeModule (nameKey_Name n) isDefForC - returns TRUE if the definition module was defined FOR "C". */ -static unsigned int isDefForC (decl_node n) +static bool isDefForC (decl_node n) { return (decl_isDef (n)) && n->defF.forC; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7071,17 +7079,17 @@ static void completedEnum (decl_node n) mcDebug_assert (((decl_isDef (n)) || (decl_isImp (n))) || (decl_isModule (n))); if (decl_isDef (n)) { - n->defF.enumsComplete = TRUE; + n->defF.enumsComplete = true; } else if (decl_isImp (n)) { /* avoid dangling else. */ - n->impF.enumsComplete = TRUE; + n->impF.enumsComplete = true; } else if (decl_isModule (n)) { /* avoid dangling else. */ - n->moduleF.enumsComplete = TRUE; + n->moduleF.enumsComplete = true; } } @@ -7130,7 +7138,7 @@ static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t) putVarBool - assigns the four booleans associated with a variable. */ -static void putVarBool (decl_node v, unsigned int init, unsigned int param, unsigned int isvar, unsigned int isused) +static void putVarBool (decl_node v, bool init, bool param, bool isvar, bool isused) { mcDebug_assert (decl_isVar (v)); v->varF.isInitialised = init; @@ -7171,7 +7179,7 @@ static decl_node checkPtr (decl_node n) isVarDecl - returns TRUE if, n, is a vardecl node. */ -static unsigned int isVarDecl (decl_node n) +static bool isVarDecl (decl_node n) { return n->kind == decl_vardecl; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7183,7 +7191,7 @@ static unsigned int isVarDecl (decl_node n) makeVariablesFromParameters - creates variables which are really parameters. */ -static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, unsigned int isvar, unsigned int isused) +static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, bool isvar, bool isused) { decl_node v; unsigned int i; @@ -7200,7 +7208,7 @@ static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node m = static_cast<nameKey_Name> (wlists_getItemFromList (id->identlistF.names, i)); v = decl_makeVar (m); decl_putVar (v, type, NULL); - putVarBool (v, TRUE, TRUE, isvar, isused); + putVarBool (v, true, true, isvar, isused); if (debugScopes) { libc_printf ((const char *) "adding parameter variable into top scope\\n", 42); @@ -7257,7 +7265,7 @@ static void putProcTypeReturn (decl_node proc, decl_node type) static void putProcTypeOptReturn (decl_node proc) { mcDebug_assert (decl_isProcType (proc)); - proc->proctypeF.returnopt = TRUE; + proc->proctypeF.returnopt = true; } @@ -7284,10 +7292,10 @@ static decl_node makeOptParameter (decl_node l, decl_node type, decl_node init) setwatch - assign the globalNode to n. */ -static unsigned int setwatch (decl_node n) +static bool setwatch (decl_node n) { globalNode = n; - return TRUE; + return true; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -7297,7 +7305,7 @@ static unsigned int setwatch (decl_node n) runwatch - set the globalNode to an identlist. */ -static unsigned int runwatch (void) +static bool runwatch (void) { return globalNode->kind == decl_identlist; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7309,7 +7317,7 @@ static unsigned int runwatch (void) isIdentList - returns TRUE if, n, is an identlist. */ -static unsigned int isIdentList (decl_node n) +static bool isIdentList (decl_node n) { return n->kind == decl_identlist; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7341,7 +7349,7 @@ static unsigned int identListLen (decl_node n) checkParameters - placeholder for future parameter checking. */ -static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned int isvar, unsigned int isused) +static void checkParameters (decl_node p, decl_node i, decl_node type, bool isvar, bool isused) { /* do check. */ disposeNode (&i); @@ -7354,7 +7362,7 @@ static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned a module or an implementation module. */ -static void checkMakeVariables (decl_node n, decl_node i, decl_node type, unsigned int isvar, unsigned int isused) +static void checkMakeVariables (decl_node n, decl_node i, decl_node type, bool isvar, bool isused) { if (((decl_isImp (currentModule)) || (decl_isModule (currentModule))) && ! n->procedureF.built) { @@ -7376,7 +7384,7 @@ static decl_node makeVarientField (decl_node v, decl_node p) n->varientfieldF.name = nameKey_NulName; n->varientfieldF.parent = p; n->varientfieldF.varient = v; - n->varientfieldF.simple = FALSE; + n->varientfieldF.simple = false; n->varientfieldF.listOfSons = Indexing_InitIndex (1); n->varientfieldF.scope = decl_getDeclScope (); return n; @@ -7473,7 +7481,7 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, n->recordfieldF.name = tag; n->recordfieldF.parent = r; n->recordfieldF.varient = v; - n->recordfieldF.tag = FALSE; + n->recordfieldF.tag = false; n->recordfieldF.scope = NULL; initCname (&n->recordfieldF.cname); /* @@ -7587,7 +7595,7 @@ static decl_node getRecord (decl_node n) isConstExp - return TRUE if the node kind is a constexp. */ -static unsigned int isConstExp (decl_node c) +static bool isConstExp (decl_node c) { mcDebug_assert (c != NULL); return c->kind == decl_constexp; @@ -7737,7 +7745,7 @@ static unsigned int expListLen (decl_node p) getConstExpComplete - gets the field from the def or imp or module, n. */ -static unsigned int getConstExpComplete (decl_node n) +static bool getConstExpComplete (decl_node n) { switch (n->kind) { @@ -7808,7 +7816,7 @@ static decl_node doMakeConstExp (void) isAnyType - return TRUE if node n is any type kind. */ -static unsigned int isAnyType (decl_node n) +static bool isAnyType (decl_node n) { mcDebug_assert (n != NULL); switch (n->kind) @@ -7831,12 +7839,12 @@ static unsigned int isAnyType (decl_node n) case decl_boolean: case decl_proc: case decl_type: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -8102,7 +8110,7 @@ static void checkCHeaders (decl_node c) isFuncCall - returns TRUE if, n, is a function/procedure call. */ -static unsigned int isFuncCall (decl_node n) +static bool isFuncCall (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_funccall; @@ -8119,7 +8127,7 @@ static void putTypeInternal (decl_node des) { mcDebug_assert (des != NULL); mcDebug_assert (decl_isType (des)); - des->typeF.isInternal = TRUE; + des->typeF.isInternal = true; } @@ -8127,7 +8135,7 @@ static void putTypeInternal (decl_node des) isTypeInternal - returns TRUE if type, n, is internal. */ -static unsigned int isTypeInternal (decl_node n) +static bool isTypeInternal (decl_node n) { mcDebug_assert (n != NULL); mcDebug_assert (decl_isType (n)); @@ -8270,7 +8278,7 @@ static void out3 (const char *a_, unsigned int _a_high, unsigned int l, nameKey_ isUnary - returns TRUE if, n, is an unary node. */ -static unsigned int isUnary (decl_node n) +static bool isUnary (decl_node n) { mcDebug_assert (n != NULL); switch (n->kind) @@ -8294,12 +8302,12 @@ static unsigned int isUnary (decl_node n) case decl_tsize: case decl_min: case decl_max: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -8311,7 +8319,7 @@ static unsigned int isUnary (decl_node n) isBinary - returns TRUE if, n, is an binary node. */ -static unsigned int isBinary (decl_node n) +static bool isBinary (decl_node n) { mcDebug_assert (n != NULL); switch (n->kind) @@ -8334,12 +8342,12 @@ static unsigned int isBinary (decl_node n) case decl_mult: case decl_divide: case decl_in: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -8405,7 +8413,7 @@ static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res) isLeafString - returns TRUE if n is a leaf node which is a string constant. */ -static unsigned int isLeafString (decl_node n) +static bool isLeafString (decl_node n) { return ((isString (n)) || ((decl_isLiteral (n)) && ((decl_getType (n)) == charN))) || ((decl_isConst (n)) && ((getExprType (n)) == charN)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -8652,7 +8660,7 @@ static decl_node doMakeComponentRef (decl_node rec, decl_node field) isComponentRef - */ -static unsigned int isComponentRef (decl_node n) +static bool isComponentRef (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_componentref; @@ -8665,7 +8673,7 @@ static unsigned int isComponentRef (decl_node n) isArrayRef - returns TRUE if the node was an arrayref. */ -static unsigned int isArrayRef (decl_node n) +static bool isArrayRef (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_arrayref; @@ -8678,7 +8686,7 @@ static unsigned int isArrayRef (decl_node n) isDeref - returns TRUE if, n, is a deref node. */ -static unsigned int isDeref (decl_node n) +static bool isDeref (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_deref; @@ -8769,7 +8777,7 @@ static decl_node makeBase (decl_nodeT k) isOrdinal - returns TRUE if, n, is an ordinal type. */ -static unsigned int isOrdinal (decl_node n) +static bool isOrdinal (decl_node n) { switch (n->kind) { @@ -8787,12 +8795,12 @@ static unsigned int isOrdinal (decl_node n) case decl_longcard: case decl_shortcard: case decl_bitset: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -9379,7 +9387,7 @@ static decl_node getSymScope (decl_node n) isQualifiedForced - should the node be written with a module prefix? */ -static unsigned int isQualifiedForced (decl_node n) +static bool isQualifiedForced (decl_node n) { return forceQualified && (((((decl_isType (n)) || (decl_isRecord (n))) || (decl_isArray (n))) || (decl_isEnumeration (n))) || (decl_isEnumerationField (n))); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -9428,7 +9436,7 @@ static DynamicStrings_String getFQstring (decl_node n) getFQDstring - */ -static DynamicStrings_String getFQDstring (decl_node n, unsigned int scopes) +static DynamicStrings_String getFQDstring (decl_node n, bool scopes) { DynamicStrings_String i; DynamicStrings_String s; @@ -9524,7 +9532,7 @@ static void doConstC (decl_node n) needsParen - returns TRUE if expression, n, needs to be enclosed in (). */ -static unsigned int needsParen (decl_node n) +static bool needsParen (decl_node n) { mcDebug_assert (n != NULL); switch (n->kind) @@ -9532,7 +9540,7 @@ static unsigned int needsParen (decl_node n) case decl_nil: case decl_true: case decl_false: - return FALSE; + return false; break; case decl_constexp: @@ -9556,11 +9564,11 @@ static unsigned int needsParen (decl_node n) case decl_chr: case decl_cap: case decl_high: - return FALSE; + return false; break; case decl_deref: - return FALSE; + return false; break; case decl_equal: @@ -9569,27 +9577,27 @@ static unsigned int needsParen (decl_node n) case decl_greater: case decl_greequal: case decl_lessequal: - return TRUE; + return true; break; case decl_componentref: - return FALSE; + return false; break; case decl_pointerref: - return FALSE; + return false; break; case decl_cast: - return TRUE; + return true; break; case decl_val: - return TRUE; + return true; break; case decl_abs: - return FALSE; + return false; break; case decl_plus: @@ -9599,43 +9607,43 @@ static unsigned int needsParen (decl_node n) case decl_mult: case decl_divide: case decl_in: - return TRUE; + return true; break; case decl_literal: case decl_const: case decl_enumerationfield: case decl_string: - return FALSE; + return false; break; case decl_max: - return TRUE; + return true; break; case decl_min: - return TRUE; + return true; break; case decl_var: - return FALSE; + return false; break; case decl_arrayref: - return FALSE; + return false; break; case decl_and: case decl_or: - return TRUE; + return true; break; case decl_funccall: - return TRUE; + return true; break; case decl_recordfield: - return FALSE; + return false; break; case decl_loc: @@ -9658,26 +9666,26 @@ static unsigned int needsParen (decl_node n) case decl_bitset: case decl_boolean: case decl_proc: - return FALSE; + return false; break; case decl_setvalue: - return FALSE; + return false; break; case decl_address: - return TRUE; + return true; break; case decl_procedure: - return FALSE; + return false; break; case decl_length: case decl_cmplx: case decl_re: case decl_im: - return TRUE; + return true; break; @@ -9685,7 +9693,7 @@ static unsigned int needsParen (decl_node n) CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - return TRUE; + return true; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -9695,7 +9703,7 @@ static unsigned int needsParen (decl_node n) doUnary - */ -static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr, decl_node type, unsigned int l, unsigned int r) +static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr, decl_node type, bool l, bool r) { char op[_op_high+1]; @@ -9762,7 +9770,7 @@ static void doSetSub (mcPretty_pretty p, decl_node left, decl_node right) doPolyBinary - */ -static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl_node right, unsigned int l, unsigned int r) +static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl_node right, bool l, bool r) { decl_node lt; decl_node rt; @@ -9774,7 +9782,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl switch (op) { case decl_plus: - doBinary (p, (const char *) "|", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "|", 1, left, right, l, r, false); break; case decl_sub: @@ -9782,11 +9790,11 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl break; case decl_mult: - doBinary (p, (const char *) "&", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "&", 1, left, right, l, r, false); break; case decl_divide: - doBinary (p, (const char *) "^", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "^", 1, left, right, l, r, false); break; @@ -9800,19 +9808,19 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl switch (op) { case decl_plus: - doBinary (p, (const char *) "+", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "+", 1, left, right, l, r, false); break; case decl_sub: - doBinary (p, (const char *) "-", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "-", 1, left, right, l, r, false); break; case decl_mult: - doBinary (p, (const char *) "*", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "*", 1, left, right, l, r, false); break; case decl_divide: - doBinary (p, (const char *) "/", 1, left, right, l, r, FALSE); + doBinary (p, (const char *) "/", 1, left, right, l, r, false); break; @@ -9828,7 +9836,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl doBinary - */ -static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, unsigned int l, unsigned int r, unsigned int unpackProc) +static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r, bool unpackProc) { char op[_op_high+1]; @@ -10131,7 +10139,7 @@ static void doPointerRefC (mcPretty_pretty p, decl_node l, decl_node r) doPreBinary - */ -static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, unsigned int l, unsigned int r) +static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r) { char op[_op_high+1]; @@ -10172,7 +10180,7 @@ static void doConstExpr (mcPretty_pretty p, decl_node n) static void doEnumerationField (mcPretty_pretty p, decl_node n) { - doFQDNameC (p, n, FALSE); + doFQDNameC (p, n, false); } @@ -10180,7 +10188,7 @@ static void doEnumerationField (mcPretty_pretty p, decl_node n) isZero - returns TRUE if node, n, is zero. */ -static unsigned int isZero (decl_node n) +static bool isZero (decl_node n) { if (isConstExp (n)) { @@ -10248,7 +10256,7 @@ static void doArrayRef (mcPretty_pretty p, decl_node n) static void doProcedure (mcPretty_pretty p, decl_node n) { mcDebug_assert (decl_isProcedure (n)); - doFQDNameC (p, n, TRUE); + doFQDNameC (p, n, true); } @@ -10258,7 +10266,7 @@ static void doProcedure (mcPretty_pretty p, decl_node n) static void doRecordfield (mcPretty_pretty p, decl_node n) { - doDNameC (p, n, FALSE); + doDNameC (p, n, false); } @@ -10457,7 +10465,14 @@ static void outNull (mcPretty_pretty p) static void outTrue (mcPretty_pretty p) { keyc_useTrue (); - outText (p, (const char *) "TRUE", 4); + if ((mcOptions_useBool ()) && (lang == decl_ansiCP)) + { + outText (p, (const char *) "true", 4); + } + else + { + outText (p, (const char *) "TRUE", 4); + } } @@ -10468,7 +10483,14 @@ static void outTrue (mcPretty_pretty p) static void outFalse (mcPretty_pretty p) { keyc_useFalse (); - outText (p, (const char *) "FALSE", 5); + if ((mcOptions_useBool ()) && (lang == decl_ansiCP)) + { + outText (p, (const char *) "false", 5); + } + else + { + outText (p, (const char *) "FALSE", 5); + } } @@ -10497,15 +10519,15 @@ static void doExprC (mcPretty_pretty p, decl_node n) break; case decl_constexp: - doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, FALSE, FALSE); + doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, false, false); break; case decl_neg: - doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, FALSE, FALSE); + doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, false, false); break; case decl_not: - doUnary (p, (const char *) "!", 1, n->unaryF.arg, n->unaryF.resultType, FALSE, TRUE); + doUnary (p, (const char *) "!", 1, n->unaryF.arg, n->unaryF.resultType, false, true); break; case decl_val: @@ -10586,27 +10608,27 @@ static void doExprC (mcPretty_pretty p, decl_node n) break; case decl_equal: - doBinary (p, (const char *) "==", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, TRUE); + doBinary (p, (const char *) "==", 2, n->binaryF.left, n->binaryF.right, true, true, true); break; case decl_notequal: - doBinary (p, (const char *) "!=", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, TRUE); + doBinary (p, (const char *) "!=", 2, n->binaryF.left, n->binaryF.right, true, true, true); break; case decl_less: - doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_greater: - doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_greequal: - doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_lessequal: - doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_componentref: @@ -10622,27 +10644,27 @@ static void doExprC (mcPretty_pretty p, decl_node n) break; case decl_plus: - doPolyBinary (p, decl_plus, n->binaryF.left, n->binaryF.right, FALSE, FALSE); + doPolyBinary (p, decl_plus, n->binaryF.left, n->binaryF.right, false, false); break; case decl_sub: - doPolyBinary (p, decl_sub, n->binaryF.left, n->binaryF.right, FALSE, FALSE); + doPolyBinary (p, decl_sub, n->binaryF.left, n->binaryF.right, false, false); break; case decl_div: - doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_mod: - doBinary (p, (const char *) "%", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "%", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_mult: - doPolyBinary (p, decl_mult, n->binaryF.left, n->binaryF.right, FALSE, FALSE); + doPolyBinary (p, decl_mult, n->binaryF.left, n->binaryF.right, false, false); break; case decl_divide: - doPolyBinary (p, decl_divide, n->binaryF.left, n->binaryF.right, FALSE, FALSE); + doPolyBinary (p, decl_divide, n->binaryF.left, n->binaryF.right, false, false); break; case decl_in: @@ -10650,11 +10672,11 @@ static void doExprC (mcPretty_pretty p, decl_node n) break; case decl_and: - doBinary (p, (const char *) "&&", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "&&", 2, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_or: - doBinary (p, (const char *) "||", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "||", 2, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_literal: @@ -10745,7 +10767,7 @@ static void doExprC (mcPretty_pretty p, decl_node n) doExprCup - */ -static void doExprCup (mcPretty_pretty p, decl_node n, unsigned int unpackProc) +static void doExprCup (mcPretty_pretty p, decl_node n, bool unpackProc) { decl_node t; @@ -10783,59 +10805,59 @@ static void doExprM2 (mcPretty_pretty p, decl_node n) break; case decl_constexp: - doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, FALSE, FALSE); + doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, false, false); break; case decl_neg: - doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, FALSE, FALSE); + doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, false, false); break; case decl_not: - doUnary (p, (const char *) "NOT", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "NOT", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_adr: - doUnary (p, (const char *) "ADR", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "ADR", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_size: - doUnary (p, (const char *) "SIZE", 4, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "SIZE", 4, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_tsize: - doUnary (p, (const char *) "TSIZE", 5, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "TSIZE", 5, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_float: - doUnary (p, (const char *) "FLOAT", 5, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "FLOAT", 5, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_trunc: - doUnary (p, (const char *) "TRUNC", 5, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "TRUNC", 5, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_ord: - doUnary (p, (const char *) "ORD", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "ORD", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_chr: - doUnary (p, (const char *) "CHR", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "CHR", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_cap: - doUnary (p, (const char *) "CAP", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "CAP", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_high: - doUnary (p, (const char *) "HIGH", 4, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "HIGH", 4, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_re: - doUnary (p, (const char *) "RE", 2, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "RE", 2, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_im: - doUnary (p, (const char *) "IM", 2, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "IM", 2, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_deref: @@ -10843,71 +10865,71 @@ static void doExprM2 (mcPretty_pretty p, decl_node n) break; case decl_equal: - doBinary (p, (const char *) "=", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "=", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_notequal: - doBinary (p, (const char *) "#", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "#", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_less: - doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_greater: - doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_greequal: - doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_lessequal: - doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_componentref: - doBinary (p, (const char *) ".", 1, n->componentrefF.rec, n->componentrefF.field, FALSE, FALSE, FALSE); + doBinary (p, (const char *) ".", 1, n->componentrefF.rec, n->componentrefF.field, false, false, false); break; case decl_pointerref: - doBinary (p, (const char *) "^.", 2, n->pointerrefF.ptr, n->pointerrefF.field, FALSE, FALSE, FALSE); + doBinary (p, (const char *) "^.", 2, n->pointerrefF.ptr, n->pointerrefF.field, false, false, false); break; case decl_cast: - doPreBinary (p, (const char *) "CAST", 4, n->binaryF.left, n->binaryF.right, TRUE, TRUE); + doPreBinary (p, (const char *) "CAST", 4, n->binaryF.left, n->binaryF.right, true, true); break; case decl_val: - doPreBinary (p, (const char *) "VAL", 3, n->binaryF.left, n->binaryF.right, TRUE, TRUE); + doPreBinary (p, (const char *) "VAL", 3, n->binaryF.left, n->binaryF.right, true, true); break; case decl_cmplx: - doPreBinary (p, (const char *) "CMPLX", 5, n->binaryF.left, n->binaryF.right, TRUE, TRUE); + doPreBinary (p, (const char *) "CMPLX", 5, n->binaryF.left, n->binaryF.right, true, true); break; case decl_plus: - doBinary (p, (const char *) "+", 1, n->binaryF.left, n->binaryF.right, FALSE, FALSE, FALSE); + doBinary (p, (const char *) "+", 1, n->binaryF.left, n->binaryF.right, false, false, false); break; case decl_sub: - doBinary (p, (const char *) "-", 1, n->binaryF.left, n->binaryF.right, FALSE, FALSE, FALSE); + doBinary (p, (const char *) "-", 1, n->binaryF.left, n->binaryF.right, false, false, false); break; case decl_div: - doBinary (p, (const char *) "DIV", 3, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "DIV", 3, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_mod: - doBinary (p, (const char *) "MOD", 3, n->binaryF.left, n->binaryF.right, TRUE, TRUE, FALSE); + doBinary (p, (const char *) "MOD", 3, n->binaryF.left, n->binaryF.right, true, true, false); break; case decl_mult: - doBinary (p, (const char *) "*", 1, n->binaryF.left, n->binaryF.right, FALSE, FALSE, FALSE); + doBinary (p, (const char *) "*", 1, n->binaryF.left, n->binaryF.right, false, false, false); break; case decl_divide: - doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, FALSE, FALSE, FALSE); + doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, false, false, false); break; case decl_literal: @@ -10927,11 +10949,11 @@ static void doExprM2 (mcPretty_pretty p, decl_node n) break; case decl_max: - doUnary (p, (const char *) "MAX", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "MAX", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_min: - doUnary (p, (const char *) "MIN", 3, n->unaryF.arg, n->unaryF.resultType, TRUE, TRUE); + doUnary (p, (const char *) "MIN", 3, n->unaryF.arg, n->unaryF.resultType, true, true); break; case decl_var: @@ -10956,12 +10978,12 @@ static void doVar (mcPretty_pretty p, decl_node n) if (n->varF.isVarParameter) { outText (p, (const char *) "(*", 2); - doFQDNameC (p, n, TRUE); + doFQDNameC (p, n, true); outText (p, (const char *) ")", 1); } else { - doFQDNameC (p, n, TRUE); + doFQDNameC (p, n, true); } } @@ -11038,7 +11060,7 @@ static void doLiteral (mcPretty_pretty p, decl_node n) isString - returns TRUE if node, n, is a string. */ -static unsigned int isString (decl_node n) +static bool isString (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_string; @@ -11193,7 +11215,7 @@ static unsigned int lenCstring (DynamicStrings_String s) outCstring - */ -static void outCstring (mcPretty_pretty p, decl_node s, unsigned int aString) +static void outCstring (mcPretty_pretty p, decl_node s, bool aString) { if (aString) { @@ -11265,7 +11287,7 @@ static void doStringC (mcPretty_pretty p, decl_node n) isPunct - */ -static unsigned int isPunct (char ch) +static bool isPunct (char ch) { return (((((((((ch == '.') || (ch == '(')) || (ch == ')')) || (ch == '^')) || (ch == ':')) || (ch == ';')) || (ch == '{')) || (ch == '}')) || (ch == ',')) || (ch == '*'); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -11277,7 +11299,7 @@ static unsigned int isPunct (char ch) isWhite - */ -static unsigned int isWhite (char ch) +static bool isWhite (char ch) { return ((ch == ' ') || (ch == ASCII_tab)) || (ch == ASCII_lf); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -11420,7 +11442,7 @@ static void outCard (mcPretty_pretty p, unsigned int c) { DynamicStrings_String s; - s = StringConvert_CardinalToString (c, 0, ' ', 10, FALSE); + s = StringConvert_CardinalToString (c, 0, ' ', 10, false); outTextS (p, s); s = DynamicStrings_KillString (s); } @@ -11481,7 +11503,7 @@ static void doEnumerationC (mcPretty_pretty p, decl_node n) while (i <= h) { s = static_cast<decl_node> (Indexing_GetIndice (n->enumerationF.listOfSons, i)); - doFQDNameC (p, s, FALSE); + doFQDNameC (p, s, false); if (i < h) { outText (p, (const char *) ",", 1); @@ -11526,7 +11548,7 @@ static void doNameC (mcPretty_pretty p, decl_node n) static void initCname (decl_cnameT *c) { - (*c).init = FALSE; + (*c).init = false; } @@ -11534,7 +11556,7 @@ static void initCname (decl_cnameT *c) doCname - */ -static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, unsigned int scopes) +static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes) { DynamicStrings_String s; @@ -11544,7 +11566,7 @@ static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, unsigned int scopes } else { - (*c).init = TRUE; + (*c).init = true; s = keyc_cname (n, scopes); if (s == NULL) { @@ -11566,7 +11588,7 @@ static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, unsigned int scopes getDName - */ -static nameKey_Name getDName (decl_node n, unsigned int scopes) +static nameKey_Name getDName (decl_node n, bool scopes) { nameKey_Name m; @@ -11603,7 +11625,7 @@ static nameKey_Name getDName (decl_node n, unsigned int scopes) doDNameC - */ -static void doDNameC (mcPretty_pretty p, decl_node n, unsigned int scopes) +static void doDNameC (mcPretty_pretty p, decl_node n, bool scopes) { if ((n != NULL) && ((decl_getSymName (n)) != nameKey_NulName)) { @@ -11616,7 +11638,7 @@ static void doDNameC (mcPretty_pretty p, decl_node n, unsigned int scopes) doFQDNameC - */ -static void doFQDNameC (mcPretty_pretty p, decl_node n, unsigned int scopes) +static void doFQDNameC (mcPretty_pretty p, decl_node n, bool scopes) { DynamicStrings_String s; @@ -11654,7 +11676,7 @@ static void doNameM2 (mcPretty_pretty p, decl_node n) doUsed - */ -static void doUsed (mcPretty_pretty p, unsigned int used) +static void doUsed (mcPretty_pretty p, bool used) { if (! used) { @@ -11668,7 +11690,7 @@ static void doUsed (mcPretty_pretty p, unsigned int used) doHighC - */ -static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, unsigned int isused) +static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, bool isused) { if ((decl_isArray (a)) && (decl_isUnbounded (a))) { @@ -11815,11 +11837,11 @@ static void doParamC (mcPretty_pretty p, decl_node n) v = getParameterVariable (n, i); if (v == NULL) { - doNamesC (p, keyc_cnamen (i, TRUE)); + doNamesC (p, keyc_cnamen (i, true)); } else { - doFQDNameC (p, v, TRUE); + doFQDNameC (p, v, true); } if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype))) { @@ -11897,11 +11919,11 @@ static void doVarParamC (mcPretty_pretty p, decl_node n) v = getParameterVariable (n, i); if (v == NULL) { - doNamesC (p, keyc_cnamen (i, TRUE)); + doNamesC (p, keyc_cnamen (i, true)); } else { - doFQDNameC (p, v, TRUE); + doFQDNameC (p, v, true); } doUsed (p, n->varparamF.isUsed); doHighC (p, ptype, i, n->varparamF.isUsed); @@ -12494,7 +12516,7 @@ static void doCompletePartialProcType (mcPretty_pretty p, decl_node t, decl_node isBase - */ -static unsigned int isBase (decl_node n) +static bool isBase (decl_node n) { switch (n->kind) { @@ -12514,12 +12536,12 @@ static unsigned int isBase (decl_node n) case decl_bitset: case decl_boolean: case decl_proc: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -12528,6 +12550,23 @@ static unsigned int isBase (decl_node n) /* + doBoolC - +*/ + +static void doBoolC (mcPretty_pretty p) +{ + if (mcOptions_useBool ()) + { + outText (p, (const char *) "bool", 4); + } + else + { + outText (p, (const char *) "unsigned int", 12); + } +} + + +/* doBaseC - */ @@ -12592,7 +12631,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n) break; case decl_boolean: - outText (p, (const char *) "unsigned int", 12); + doBoolC (p); break; case decl_proc: @@ -12612,37 +12651,37 @@ static void doBaseC (mcPretty_pretty p, decl_node n) isSystem - */ -static unsigned int isSystem (decl_node n) +static bool isSystem (decl_node n) { switch (n->kind) { case decl_address: - return TRUE; + return true; break; case decl_loc: - return TRUE; + return true; break; case decl_byte: - return TRUE; + return true; break; case decl_word: - return TRUE; + return true; break; case decl_csizet: - return TRUE; + return true; break; case decl_cssizet: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -12771,7 +12810,7 @@ static void doRecordFieldC (mcPretty_pretty p, decl_node f) m = NULL; mcPretty_setNeedSpace (p); doTypeC (p, f->recordfieldF.type, &m); - doDNameC (p, f, FALSE); + doDNameC (p, f, false); } @@ -12946,7 +12985,7 @@ static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m) isBitset - */ -static unsigned int isBitset (decl_node n) +static bool isBitset (decl_node n) { return n == bitsetN; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -12958,10 +12997,10 @@ static unsigned int isBitset (decl_node n) isNegative - returns TRUE if expression, n, is negative. */ -static unsigned int isNegative (decl_node n) +static bool isNegative (decl_node n) { /* --fixme-- needs to be completed. */ - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -13190,7 +13229,7 @@ static void doTypeNameC (mcPretty_pretty p, decl_node n) isExternal - returns TRUE if symbol, n, was declared in another module. */ -static unsigned int isExternal (decl_node n) +static bool isExternal (decl_node n) { decl_node s; @@ -13233,7 +13272,7 @@ static void doVarC (decl_node n) s = NULL; doTypeC (doP, decl_getType (n), &s); mcPretty_setNeedSpace (doP); - doFQDNameC (doP, n, FALSE); + doFQDNameC (doP, n, false); mcPretty_print (doP, (const char *) ";\\n", 3); } @@ -13287,7 +13326,7 @@ static void doProcedureComment (mcPretty_pretty p, DynamicStrings_String s) doProcedureHeadingC - */ -static void doProcedureHeadingC (decl_node n, unsigned int prototype) +static void doProcedureHeadingC (decl_node n, bool prototype) { unsigned int i; unsigned int h; @@ -13318,7 +13357,7 @@ static void doProcedureHeadingC (decl_node n, unsigned int prototype) q = NULL; doTypeC (doP, n->procedureF.returnType, &q); mcPretty_setNeedSpace (doP); - doFQDNameC (doP, n, FALSE); + doFQDNameC (doP, n, false); mcPretty_setNeedSpace (doP); outText (doP, (const char *) "(", 1); i = Indexing_LowIndice (n->procedureF.parameters); @@ -13352,15 +13391,15 @@ static void doProcedureHeadingC (decl_node n, unsigned int prototype) checkDeclareUnboundedParamCopyC - */ -static unsigned int checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n) +static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n) { decl_node t; unsigned int i; unsigned int c; wlists_wlist l; - unsigned int seen; + bool seen; - seen = FALSE; + seen = false; t = decl_getType (n); l = n->paramF.namelist->identlistF.names; if (((decl_isArray (t)) && (decl_isUnbounded (t))) && (l != NULL)) @@ -13376,7 +13415,7 @@ static unsigned int checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_nod outText (p, (const char *) "[_", 2); doNamesC (p, wlists_getItemFromList (l, i)); outText (p, (const char *) "_high+1];\\n", 11); - seen = TRUE; + seen = true; i += 1; } } @@ -13445,12 +13484,12 @@ static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node n) unsigned int i; unsigned int h; decl_node q; - unsigned int seen; + bool seen; mcDebug_assert (decl_isProcedure (n)); i = Indexing_LowIndice (n->procedureF.parameters); h = Indexing_HighIndice (n->procedureF.parameters); - seen = FALSE; + seen = false; while (i <= h) { q = static_cast<decl_node> (Indexing_GetIndice (n->procedureF.parameters, i)); @@ -13487,7 +13526,7 @@ static void doPrototypeC (decl_node n) if (! (decl_isExported (n))) { keyc_enterScope (n); - doProcedureHeadingC (n, TRUE); + doProcedureHeadingC (n, true); mcPretty_print (doP, (const char *) ";\\n", 3); keyc_leaveScope (n); } @@ -13597,7 +13636,7 @@ static void simplifyType (alists_alist l, decl_node *p) s = tempName (); (*p) = makeIntermediateType (s, (*p)); s = DynamicStrings_KillString (s); - simplified = FALSE; + simplified = false; } simplifyNode (l, (*p)); } @@ -13788,7 +13827,7 @@ static void doSimplify (decl_node n) static void simplifyTypes (decl_scopeT s) { do { - simplified = TRUE; + simplified = true; Indexing_ForeachIndiceInIndexDo (s.types, (Indexing_IndexProcedure) {(Indexing_IndexProcedure_t) doSimplify}); Indexing_ForeachIndiceInIndexDo (s.variables, (Indexing_IndexProcedure) {(Indexing_IndexProcedure_t) doSimplify}); } while (! (simplified)); @@ -14048,7 +14087,7 @@ static void doStatementSequenceC (mcPretty_pretty p, decl_node s) isStatementSequenceEmpty - */ -static unsigned int isStatementSequenceEmpty (decl_node s) +static bool isStatementSequenceEmpty (decl_node s) { mcDebug_assert (decl_isStatementSequence (s)); return (Indexing_HighIndice (s->stmtF.statements)) == 0; @@ -14062,7 +14101,7 @@ static unsigned int isStatementSequenceEmpty (decl_node s) only one statement. */ -static unsigned int isSingleStatement (decl_node s) +static bool isSingleStatement (decl_node s) { unsigned int h; @@ -14070,7 +14109,7 @@ static unsigned int isSingleStatement (decl_node s) h = Indexing_HighIndice (s->stmtF.statements); if ((h == 0) || (h > 1)) { - return FALSE; + return false; } s = static_cast<decl_node> (Indexing_GetIndice (s->stmtF.statements, 1)); return (! (decl_isStatementSequence (s))) || (isSingleStatement (s)); @@ -14157,7 +14196,7 @@ static void doReturnC (mcPretty_pretty p, decl_node s) isZtypeEquivalent - */ -static unsigned int isZtypeEquivalent (decl_node type) +static bool isZtypeEquivalent (decl_node type) { switch (type->kind) { @@ -14168,12 +14207,12 @@ static unsigned int isZtypeEquivalent (decl_node type) case decl_longint: case decl_shortint: case decl_ztype: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -14185,7 +14224,7 @@ static unsigned int isZtypeEquivalent (decl_node type) isEquivalentType - returns TRUE if type1 and type2 are equivalent. */ -static unsigned int isEquivalentType (decl_node type1, decl_node type2) +static bool isEquivalentType (decl_node type1, decl_node type2) { type1 = decl_skipType (type1); type2 = decl_skipType (type2); @@ -14248,7 +14287,7 @@ static void doExprCastC (mcPretty_pretty p, decl_node e, decl_node type) requiresUnpackProc - returns TRUE if either the expr is a procedure or the proctypes differ. */ -static unsigned int requiresUnpackProc (decl_node s) +static bool requiresUnpackProc (decl_node s) { mcDebug_assert (isAssignment (s)); return (decl_isProcedure (s->assignmentF.expr)) || ((decl_skipType (decl_getType (s->assignmentF.des))) != (decl_skipType (decl_getType (s->assignmentF.expr)))); @@ -14279,7 +14318,7 @@ static void doAssignmentC (mcPretty_pretty p, decl_node s) containsStatement - */ -static unsigned int containsStatement (decl_node s) +static bool containsStatement (decl_node s) { return ((s != NULL) && (decl_isStatementSequence (s))) && (! (isStatementSequenceEmpty (s))); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -14389,7 +14428,7 @@ static void doElsifC (mcPretty_pretty p, decl_node s) noIfElse - */ -static unsigned int noIfElse (decl_node n) +static bool noIfElse (decl_node n) { return (((n != NULL) && (decl_isIf (n))) && (n->ifF.else_ == NULL)) && (n->ifF.elsif == NULL); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -14404,7 +14443,7 @@ static unsigned int noIfElse (decl_node n) in a return value of TRUE. */ -static unsigned int noIfElseChained (decl_node n) +static bool noIfElseChained (decl_node n) { decl_node e; @@ -14422,7 +14461,7 @@ static unsigned int noIfElseChained (decl_node n) { /* avoid dangling else. */ /* neither else or elsif. */ - return TRUE; + return true; } else { @@ -14445,7 +14484,7 @@ static unsigned int noIfElseChained (decl_node n) { /* avoid dangling else. */ /* neither else or elsif. */ - return TRUE; + return true; } else { @@ -14457,7 +14496,7 @@ static unsigned int noIfElseChained (decl_node n) } } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -14467,7 +14506,7 @@ static unsigned int noIfElseChained (decl_node n) hasIfElse - */ -static unsigned int hasIfElse (decl_node n) +static bool hasIfElse (decl_node n) { if (n != NULL) { @@ -14476,7 +14515,7 @@ static unsigned int hasIfElse (decl_node n) /* avoid gcc warning by using compound statement even if not strictly necessary. */ if (isStatementSequenceEmpty (n)) { - return FALSE; + return false; } else if (isSingleStatement (n)) { @@ -14486,7 +14525,7 @@ static unsigned int hasIfElse (decl_node n) } } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -14496,7 +14535,7 @@ static unsigned int hasIfElse (decl_node n) isIfElse - */ -static unsigned int isIfElse (decl_node n) +static bool isIfElse (decl_node n) { return ((n != NULL) && (decl_isIf (n))) && ((n->ifF.else_ != NULL) || (n->ifF.elsif != NULL)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -14509,7 +14548,7 @@ static unsigned int isIfElse (decl_node n) which is an IF and it has no else statement. */ -static unsigned int hasIfAndNoElse (decl_node n) +static bool hasIfAndNoElse (decl_node n) { if (n != NULL) { @@ -14518,7 +14557,7 @@ static unsigned int hasIfAndNoElse (decl_node n) { if (isStatementSequenceEmpty (n)) { - return FALSE; + return false; } else if (isSingleStatement (n)) { @@ -14539,7 +14578,7 @@ static unsigned int hasIfAndNoElse (decl_node n) return noIfElseChained (n); } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -14902,14 +14941,14 @@ static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node form else if (isString (actual)) { /* avoid dangling else. */ - outCstring (p, actual, TRUE); + outCstring (p, actual, true); } else if (decl_isConst (actual)) { /* avoid dangling else. */ actual = resolveString (actual); mcDebug_assert (isString (actual)); - outCstring (p, actual, TRUE); + outCstring (p, actual, true); } else if (isFuncCall (actual)) { @@ -15012,7 +15051,7 @@ static void doAdrExprC (mcPretty_pretty p, decl_node n) typePair - */ -static unsigned int typePair (decl_node a, decl_node b, decl_node x, decl_node y) +static bool typePair (decl_node a, decl_node b, decl_node x, decl_node y) { return ((a == x) && (b == y)) || ((a == y) && (b == x)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -15025,17 +15064,17 @@ static unsigned int typePair (decl_node a, decl_node b, decl_node x, decl_node y the formal type. */ -static unsigned int needsCast (decl_node at, decl_node ft) +static bool needsCast (decl_node at, decl_node ft) { at = decl_skipType (at); ft = decl_skipType (ft); if (((((((((((((at == nilN) || (at->kind == decl_nil)) || (at == ft)) || (typePair (at, ft, cardinalN, wordN))) || (typePair (at, ft, cardinalN, ztypeN))) || (typePair (at, ft, integerN, ztypeN))) || (typePair (at, ft, longcardN, ztypeN))) || (typePair (at, ft, shortcardN, ztypeN))) || (typePair (at, ft, longintN, ztypeN))) || (typePair (at, ft, shortintN, ztypeN))) || (typePair (at, ft, realN, rtypeN))) || (typePair (at, ft, longrealN, rtypeN))) || (typePair (at, ft, shortrealN, rtypeN))) { - return FALSE; + return false; } else { - return TRUE; + return true; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -15147,7 +15186,7 @@ static void emitN (mcPretty_pretty p, const char *a_, unsigned int _a_high, unsi which was declared inside a definition module for "C". */ -static unsigned int isForC (decl_node n) +static bool isForC (decl_node n) { if (decl_isVarParam (n)) { @@ -15163,7 +15202,7 @@ static unsigned int isForC (decl_node n) /* avoid dangling else. */ return n->procedureF.isForC; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -15173,7 +15212,7 @@ static unsigned int isForC (decl_node n) isDefForCNode - return TRUE if node n was declared inside a definition module for "C". */ -static unsigned int isDefForCNode (decl_node n) +static bool isDefForCNode (decl_node n) { nameKey_Name name; @@ -15350,7 +15389,7 @@ static decl_node getNthParam (Indexing_Index l, unsigned int i) doFuncArgsC - */ -static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, unsigned int needParen) +static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, bool needParen) { decl_node actual; decl_node formal; @@ -15390,7 +15429,7 @@ static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, unsig doProcTypeArgsC - */ -static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args, unsigned int needParen) +static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args, bool needParen) { decl_node a; decl_node b; @@ -15969,7 +16008,7 @@ static void doMaxC (mcPretty_pretty p, decl_node n) The intrinsic functions are represented as unary and binary nodes. */ -static unsigned int isIntrinsic (decl_node n) +static bool isIntrinsic (decl_node n) { switch (n->kind) { @@ -15982,12 +16021,12 @@ static unsigned int isIntrinsic (decl_node n) case decl_new: case decl_dispose: case decl_halt: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -16219,7 +16258,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n) isIntrinsicFunction - returns true if, n, is an instrinsic function. */ -static unsigned int isIntrinsicFunction (decl_node n) +static bool isIntrinsicFunction (decl_node n) { switch (n->kind) { @@ -16240,12 +16279,12 @@ static unsigned int isIntrinsicFunction (decl_node n) case decl_re: case decl_im: case decl_cmplx: - return TRUE; + return true; break; default: - return FALSE; + return false; break; } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -16316,9 +16355,9 @@ static void doFuncExprC (mcPretty_pretty p, decl_node n) mcDebug_assert (isFuncCall (n)); if (decl_isProcedure (n->funccallF.function)) { - doFQDNameC (p, n->funccallF.function, TRUE); + doFQDNameC (p, n->funccallF.function, true); mcPretty_setNeedSpace (p); - doFuncArgsC (p, n, n->funccallF.function->procedureF.parameters, TRUE); + doFuncArgsC (p, n, n->funccallF.function->procedureF.parameters, true); } else { @@ -16330,12 +16369,12 @@ static void doFuncExprC (mcPretty_pretty p, decl_node n) mcPretty_setNeedSpace (p); if (t == procN) { - doProcTypeArgsC (p, n, NULL, TRUE); + doProcTypeArgsC (p, n, NULL, true); } else { mcDebug_assert (decl_isProcType (t)); - doProcTypeArgsC (p, n, t->proctypeF.parameters, TRUE); + doProcTypeArgsC (p, n, t->proctypeF.parameters, true); } } } @@ -16358,7 +16397,7 @@ static void doFuncCallC (mcPretty_pretty p, decl_node n) doCaseStatementC - */ -static void doCaseStatementC (mcPretty_pretty p, decl_node n, unsigned int needBreak) +static void doCaseStatementC (mcPretty_pretty p, decl_node n, bool needBreak) { p = mcPretty_pushPretty (p); mcPretty_setindent (p, (mcPretty_getindent (p))+indentationC); @@ -16540,7 +16579,7 @@ static void doRangeIfListC (mcPretty_pretty p, decl_node e, decl_node c) doCaseLabels - */ -static void doCaseLabels (mcPretty_pretty p, decl_node n, unsigned int needBreak) +static void doCaseLabels (mcPretty_pretty p, decl_node n, bool needBreak) { mcDebug_assert (decl_isCaseLabelList (n)); doRangeListC (p, n->caselabellistF.caseList); @@ -16559,7 +16598,7 @@ static void doCaseLabels (mcPretty_pretty p, decl_node n, unsigned int needBreak doCaseLabelListC - */ -static void doCaseLabelListC (mcPretty_pretty p, decl_node n, unsigned int haveElse) +static void doCaseLabelListC (mcPretty_pretty p, decl_node n, bool haveElse) { unsigned int i; unsigned int h; @@ -16651,7 +16690,7 @@ static void doCaseElseC (mcPretty_pretty p, decl_node n) else { outText (p, (const char *) "\\ndefault:\\n", 12); - doCaseStatementC (p, n->caseF.else_, TRUE); + doCaseStatementC (p, n->caseF.else_, true); } } @@ -16666,7 +16705,7 @@ static void doCaseIfElseC (mcPretty_pretty p, decl_node n) if (n->caseF.else_ == NULL) { /* avoid dangling else. */ - if (TRUE) + if (true) { outText (p, (const char *) "\\n", 2); outText (p, (const char *) "else {\\n", 8); @@ -16681,7 +16720,7 @@ static void doCaseIfElseC (mcPretty_pretty p, decl_node n) { outText (p, (const char *) "\\n", 2); outText (p, (const char *) "else {\\n", 8); - doCaseStatementC (p, n->caseF.else_, FALSE); + doCaseStatementC (p, n->caseF.else_, false); outText (p, (const char *) "}\\n", 3); } } @@ -16692,7 +16731,7 @@ static void doCaseIfElseC (mcPretty_pretty p, decl_node n) single values and not ranges. */ -static unsigned int canUseSwitchCaseLabels (decl_node n) +static bool canUseSwitchCaseLabels (decl_node n) { unsigned int i; unsigned int h; @@ -16708,11 +16747,11 @@ static unsigned int canUseSwitchCaseLabels (decl_node n) r = static_cast<decl_node> (Indexing_GetIndice (l->caselistF.rangePairs, i)); if ((r->rangeF.hi != NULL) && (r->rangeF.lo != r->rangeF.hi)) { - return FALSE; + return false; } i += 1; } - return TRUE; + return true; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -16724,7 +16763,7 @@ static unsigned int canUseSwitchCaseLabels (decl_node n) selectors are single values rather than ranges. */ -static unsigned int canUseSwitch (decl_node n) +static bool canUseSwitch (decl_node n) { unsigned int i; unsigned int h; @@ -16738,11 +16777,11 @@ static unsigned int canUseSwitch (decl_node n) c = static_cast<decl_node> (Indexing_GetIndice (n->caseF.caseLabelList, i)); if (! (canUseSwitchCaseLabels (c))) { - return FALSE; + return false; } i += 1; } - return TRUE; + return true; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -16957,7 +16996,7 @@ static void includeParameters (decl_node n) isHalt - */ -static unsigned int isHalt (decl_node n) +static bool isHalt (decl_node n) { return n->kind == decl_halt; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -16969,7 +17008,7 @@ static unsigned int isHalt (decl_node n) isReturnOrHalt - */ -static unsigned int isReturnOrHalt (decl_node n) +static bool isReturnOrHalt (decl_node n) { return (isHalt (n)) || (decl_isReturn (n)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -16981,7 +17020,7 @@ static unsigned int isReturnOrHalt (decl_node n) isLastStatementReturn - */ -static unsigned int isLastStatementReturn (decl_node n) +static bool isLastStatementReturn (decl_node n) { return isLastStatement (n, (decl_isNodeF) {(decl_isNodeF_t) isReturnOrHalt}); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -16993,7 +17032,7 @@ static unsigned int isLastStatementReturn (decl_node n) isLastStatementSequence - */ -static unsigned int isLastStatementSequence (decl_node n, decl_isNodeF q) +static bool isLastStatementSequence (decl_node n, decl_isNodeF q) { unsigned int h; @@ -17003,7 +17042,7 @@ static unsigned int isLastStatementSequence (decl_node n, decl_isNodeF q) { return isLastStatement (reinterpret_cast<decl_node> (Indexing_GetIndice (n->stmtF.statements, h)), q); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -17013,12 +17052,12 @@ static unsigned int isLastStatementSequence (decl_node n, decl_isNodeF q) isLastStatementIf - */ -static unsigned int isLastStatementIf (decl_node n, decl_isNodeF q) +static bool isLastStatementIf (decl_node n, decl_isNodeF q) { - unsigned int ret; + bool ret; mcDebug_assert (decl_isIf (n)); - ret = TRUE; + ret = true; if ((n->ifF.elsif != NULL) && ret) { ret = isLastStatement (n->ifF.elsif, q); @@ -17041,12 +17080,12 @@ static unsigned int isLastStatementIf (decl_node n, decl_isNodeF q) isLastStatementElsif - */ -static unsigned int isLastStatementElsif (decl_node n, decl_isNodeF q) +static bool isLastStatementElsif (decl_node n, decl_isNodeF q) { - unsigned int ret; + bool ret; mcDebug_assert (decl_isElsif (n)); - ret = TRUE; + ret = true; if ((n->elsifF.elsif != NULL) && ret) { ret = isLastStatement (n->elsifF.elsif, q); @@ -17069,14 +17108,14 @@ static unsigned int isLastStatementElsif (decl_node n, decl_isNodeF q) isLastStatementCase - */ -static unsigned int isLastStatementCase (decl_node n, decl_isNodeF q) +static bool isLastStatementCase (decl_node n, decl_isNodeF q) { - unsigned int ret; + bool ret; unsigned int i; unsigned int h; decl_node c; - ret = TRUE; + ret = true; mcDebug_assert (decl_isCase (n)); i = 1; h = Indexing_HighIndice (n->caseF.caseLabelList); @@ -17101,13 +17140,13 @@ static unsigned int isLastStatementCase (decl_node n, decl_isNodeF q) isLastStatement - returns TRUE if the last statement in, n, is, q. */ -static unsigned int isLastStatement (decl_node n, decl_isNodeF q) +static bool isLastStatement (decl_node n, decl_isNodeF q) { - unsigned int ret; + bool ret; if (n == NULL) { - return FALSE; + return false; } else if (decl_isStatementSequence (n)) { @@ -17138,9 +17177,9 @@ static unsigned int isLastStatement (decl_node n, decl_isNodeF q) else if ((*q.proc) (n)) { /* avoid dangling else. */ - return TRUE; + return true; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -17157,7 +17196,7 @@ static void doProcedureC (decl_node n) outText (doP, (const char *) "\\n", 2); includeParameters (n); keyc_enterScope (n); - doProcedureHeadingC (n, FALSE); + doProcedureHeadingC (n, false); outText (doP, (const char *) "\\n", 2); doP = outKc (doP, (const char *) "{\\n", 3); s = mcPretty_getcurline (doP); @@ -18274,28 +18313,28 @@ static decl_dependentState doDependants (alists_alist l, decl_node n) tryComplete - returns TRUE if node, n, can be and was completed. */ -static unsigned int tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v) +static bool tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v) { if (decl_isEnumeration (n)) { /* can always emit enumerated types. */ output (n, c, t, v); - return TRUE; + return true; } else if (((decl_isType (n)) && (decl_isTypeHidden (n))) && ((decl_getType (n)) == NULL)) { /* avoid dangling else. */ /* can always emit hidden types. */ outputHidden (n); - return TRUE; + return true; } else if ((allDependants (n)) == decl_completed) { /* avoid dangling else. */ output (n, c, t, v); - return TRUE; + return true; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -18305,21 +18344,21 @@ static unsigned int tryComplete (decl_node n, decl_nodeProcedure c, decl_nodePro tryCompleteFromPartial - */ -static unsigned int tryCompleteFromPartial (decl_node n, decl_nodeProcedure t) +static bool tryCompleteFromPartial (decl_node n, decl_nodeProcedure t) { if ((((decl_isType (n)) && ((decl_getType (n)) != NULL)) && (decl_isPointer (decl_getType (n)))) && ((allDependants (decl_getType (n))) == decl_completed)) { /* alists.includeItemIntoList (partialQ, getType (n)) ; */ outputHiddenComplete (n); - return TRUE; + return true; } else if ((allDependants (n)) == decl_completed) { /* avoid dangling else. */ (*t.proc) (n); - return TRUE; + return true; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -19839,7 +19878,7 @@ static void outputHiddenComplete (decl_node n) tryPartial - */ -static unsigned int tryPartial (decl_node n, decl_nodeProcedure pt) +static bool tryPartial (decl_node n, decl_nodeProcedure pt) { decl_node q; @@ -19857,18 +19896,18 @@ static unsigned int tryPartial (decl_node n, decl_nodeProcedure pt) { (*pt.proc) (n); addTodo (q); - return TRUE; + return true; } else if (decl_isArray (q)) { /* avoid dangling else. */ (*pt.proc) (n); addTodo (q); - return TRUE; + return true; } } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -20368,7 +20407,7 @@ static void runPrototypeExported (decl_node n) if (decl_isExported (n)) { keyc_enterScope (n); - doProcedureHeadingC (n, TRUE); + doProcedureHeadingC (n, true); mcPretty_print (doP, (const char *) ";\\n", 3); keyc_leaveScope (n); } @@ -21787,7 +21826,7 @@ static void addGenericAfter (decl_node n, decl_node c) isAssignment - */ -static unsigned int isAssignment (decl_node n) +static bool isAssignment (decl_node n) { return n->kind == decl_assignment; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -21799,7 +21838,7 @@ static unsigned int isAssignment (decl_node n) isComment - returns TRUE if node, n, is a comment. */ -static unsigned int isComment (decl_node n) +static bool isComment (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_comment; @@ -22355,7 +22394,7 @@ static void init (void) makeM2rts (); outputState = decl_punct; tempCount = 0; - mustVisitScope = FALSE; + mustVisitScope = false; } @@ -22402,7 +22441,7 @@ extern "C" unsigned int decl_getFirstUsed (decl_node n) isDef - return TRUE if node, n, is a definition module. */ -extern "C" unsigned int decl_isDef (decl_node n) +extern "C" bool decl_isDef (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_def; @@ -22415,7 +22454,7 @@ extern "C" unsigned int decl_isDef (decl_node n) isImp - return TRUE if node, n, is an implementation module. */ -extern "C" unsigned int decl_isImp (decl_node n) +extern "C" bool decl_isImp (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_imp; @@ -22428,7 +22467,7 @@ extern "C" unsigned int decl_isImp (decl_node n) isImpOrModule - returns TRUE if, n, is a program module or implementation module. */ -extern "C" unsigned int decl_isImpOrModule (decl_node n) +extern "C" bool decl_isImpOrModule (decl_node n) { return (decl_isImp (n)) || (decl_isModule (n)); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22440,7 +22479,7 @@ extern "C" unsigned int decl_isImpOrModule (decl_node n) isVisited - returns TRUE if the node was visited. */ -extern "C" unsigned int decl_isVisited (decl_node n) +extern "C" bool decl_isVisited (decl_node n) { switch (n->kind) { @@ -22475,15 +22514,15 @@ extern "C" void decl_unsetVisited (decl_node n) switch (n->kind) { case decl_def: - n->defF.visited = FALSE; + n->defF.visited = false; break; case decl_imp: - n->impF.visited = FALSE; + n->impF.visited = false; break; case decl_module: - n->moduleF.visited = FALSE; + n->moduleF.visited = false; break; @@ -22503,15 +22542,15 @@ extern "C" void decl_setVisited (decl_node n) switch (n->kind) { case decl_def: - n->defF.visited = TRUE; + n->defF.visited = true; break; case decl_imp: - n->impF.visited = TRUE; + n->impF.visited = true; break; case decl_module: - n->moduleF.visited = TRUE; + n->moduleF.visited = true; break; @@ -22531,15 +22570,15 @@ extern "C" void decl_setEnumsComplete (decl_node n) switch (n->kind) { case decl_def: - n->defF.enumsComplete = TRUE; + n->defF.enumsComplete = true; break; case decl_imp: - n->impF.enumsComplete = TRUE; + n->impF.enumsComplete = true; break; case decl_module: - n->moduleF.enumsComplete = TRUE; + n->moduleF.enumsComplete = true; break; @@ -22554,7 +22593,7 @@ extern "C" void decl_setEnumsComplete (decl_node n) getEnumsComplete - gets the field from the def or imp or module, n. */ -extern "C" unsigned int decl_getEnumsComplete (decl_node n) +extern "C" bool decl_getEnumsComplete (decl_node n) { switch (n->kind) { @@ -22641,7 +22680,7 @@ extern "C" decl_node decl_getNextEnum (void) isModule - return TRUE if node, n, is a program module. */ -extern "C" unsigned int decl_isModule (decl_node n) +extern "C" bool decl_isModule (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_module; @@ -22656,7 +22695,7 @@ extern "C" unsigned int decl_isModule (decl_node n) implementation or program module. */ -extern "C" unsigned int decl_isMainModule (decl_node n) +extern "C" bool decl_isMainModule (decl_node n) { mcDebug_assert (n != NULL); return n == mainModule; @@ -22759,7 +22798,7 @@ extern "C" decl_node decl_lookupModule (nameKey_Name n) extern "C" void decl_putDefForC (decl_node n) { mcDebug_assert (decl_isDef (n)); - n->defF.forC = TRUE; + n->defF.forC = true; } @@ -22805,7 +22844,7 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n) isConst - returns TRUE if node, n, is a const. */ -extern "C" unsigned int decl_isConst (decl_node n) +extern "C" bool decl_isConst (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_const; @@ -22818,7 +22857,7 @@ extern "C" unsigned int decl_isConst (decl_node n) isType - returns TRUE if node, n, is a type. */ -extern "C" unsigned int decl_isType (decl_node n) +extern "C" bool decl_isType (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_type; @@ -23210,10 +23249,10 @@ extern "C" void decl_putTypeHidden (decl_node des) mcDebug_assert (des != NULL); mcDebug_assert (decl_isType (des)); - des->typeF.isHidden = TRUE; + des->typeF.isHidden = true; s = decl_getScope (des); mcDebug_assert (decl_isDef (s)); - s->defF.hasHidden = TRUE; + s->defF.hasHidden = true; } @@ -23221,7 +23260,7 @@ extern "C" void decl_putTypeHidden (decl_node des) isTypeHidden - returns TRUE if type, n, is hidden. */ -extern "C" unsigned int decl_isTypeHidden (decl_node n) +extern "C" bool decl_isTypeHidden (decl_node n) { mcDebug_assert (n != NULL); mcDebug_assert (decl_isType (n)); @@ -23235,7 +23274,7 @@ extern "C" unsigned int decl_isTypeHidden (decl_node n) hasHidden - returns TRUE if module, n, has a hidden type. */ -extern "C" unsigned int decl_hasHidden (decl_node n) +extern "C" bool decl_hasHidden (decl_node n) { mcDebug_assert (decl_isDef (n)); return n->defF.hasHidden; @@ -23248,7 +23287,7 @@ extern "C" unsigned int decl_hasHidden (decl_node n) isVar - returns TRUE if node, n, is a type. */ -extern "C" unsigned int decl_isVar (decl_node n) +extern "C" bool decl_isVar (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_var; @@ -23261,9 +23300,9 @@ extern "C" unsigned int decl_isVar (decl_node n) isTemporary - returns TRUE if node, n, is a variable and temporary. */ -extern "C" unsigned int decl_isTemporary (decl_node n) +extern "C" bool decl_isTemporary (decl_node n) { - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -23274,7 +23313,7 @@ extern "C" unsigned int decl_isTemporary (decl_node n) the definition module. */ -extern "C" unsigned int decl_isExported (decl_node n) +extern "C" bool decl_isExported (decl_node n) { decl_node s; @@ -23289,11 +23328,11 @@ extern "C" unsigned int decl_isExported (decl_node n) default: - return FALSE; + return false; break; } } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -23579,7 +23618,7 @@ extern "C" decl_node decl_getScope (decl_node n) isLiteral - returns TRUE if, n, is a literal. */ -extern "C" unsigned int decl_isLiteral (decl_node n) +extern "C" bool decl_isLiteral (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_literal; @@ -23592,14 +23631,14 @@ extern "C" unsigned int decl_isLiteral (decl_node n) isConstSet - returns TRUE if, n, is a constant set. */ -extern "C" unsigned int decl_isConstSet (decl_node n) +extern "C" bool decl_isConstSet (decl_node n) { mcDebug_assert (n != NULL); if ((decl_isLiteral (n)) || (decl_isConst (n))) { return decl_isSet (decl_skipType (decl_getType (n))); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -23609,7 +23648,7 @@ extern "C" unsigned int decl_isConstSet (decl_node n) isEnumerationField - returns TRUE if, n, is an enumeration field. */ -extern "C" unsigned int decl_isEnumerationField (decl_node n) +extern "C" bool decl_isEnumerationField (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_enumerationfield; @@ -23622,7 +23661,7 @@ extern "C" unsigned int decl_isEnumerationField (decl_node n) isEnumeration - returns TRUE if node, n, is an enumeration type. */ -extern "C" unsigned int decl_isEnumeration (decl_node n) +extern "C" bool decl_isEnumeration (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_enumeration; @@ -23635,7 +23674,7 @@ extern "C" unsigned int decl_isEnumeration (decl_node n) isUnbounded - returns TRUE if, n, is an unbounded array. */ -extern "C" unsigned int decl_isUnbounded (decl_node n) +extern "C" bool decl_isUnbounded (decl_node n) { mcDebug_assert (n != NULL); return (n->kind == decl_array) && n->arrayF.isUnbounded; @@ -23648,7 +23687,7 @@ extern "C" unsigned int decl_isUnbounded (decl_node n) isParameter - returns TRUE if, n, is a parameter. */ -extern "C" unsigned int decl_isParameter (decl_node n) +extern "C" bool decl_isParameter (decl_node n) { mcDebug_assert (n != NULL); return (n->kind == decl_param) || (n->kind == decl_varparam); @@ -23661,7 +23700,7 @@ extern "C" unsigned int decl_isParameter (decl_node n) isVarParam - returns TRUE if, n, is a var parameter. */ -extern "C" unsigned int decl_isVarParam (decl_node n) +extern "C" bool decl_isVarParam (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_varparam; @@ -23674,7 +23713,7 @@ extern "C" unsigned int decl_isVarParam (decl_node n) isParam - returns TRUE if, n, is a non var parameter. */ -extern "C" unsigned int decl_isParam (decl_node n) +extern "C" bool decl_isParam (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_param; @@ -23687,7 +23726,7 @@ extern "C" unsigned int decl_isParam (decl_node n) isNonVarParam - is an alias to isParam. */ -extern "C" unsigned int decl_isNonVarParam (decl_node n) +extern "C" bool decl_isNonVarParam (decl_node n) { return decl_isParam (n); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23709,7 +23748,7 @@ extern "C" decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl mcDebug_assert (decl_isProcedure (proc)); l = decl_makeIdentList (); mcDebug_assert (decl_putIdent (l, id)); - checkMakeVariables (proc, l, type, FALSE, TRUE); + checkMakeVariables (proc, l, type, false, true); if (! proc->procedureF.checking) { p = makeOptParameter (l, type, init); @@ -23725,7 +23764,7 @@ extern "C" decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl isOptarg - returns TRUE if, n, is an optarg. */ -extern "C" unsigned int decl_isOptarg (decl_node n) +extern "C" bool decl_isOptarg (decl_node n) { return n->kind == decl_optarg; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23737,7 +23776,7 @@ extern "C" unsigned int decl_isOptarg (decl_node n) isRecord - returns TRUE if, n, is a record. */ -extern "C" unsigned int decl_isRecord (decl_node n) +extern "C" bool decl_isRecord (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_record; @@ -23750,7 +23789,7 @@ extern "C" unsigned int decl_isRecord (decl_node n) isRecordField - returns TRUE if, n, is a record field. */ -extern "C" unsigned int decl_isRecordField (decl_node n) +extern "C" bool decl_isRecordField (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_recordfield; @@ -23763,7 +23802,7 @@ extern "C" unsigned int decl_isRecordField (decl_node n) isVarientField - returns TRUE if, n, is a varient field. */ -extern "C" unsigned int decl_isVarientField (decl_node n) +extern "C" bool decl_isVarientField (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_varientfield; @@ -23776,7 +23815,7 @@ extern "C" unsigned int decl_isVarientField (decl_node n) isArray - returns TRUE if, n, is an array. */ -extern "C" unsigned int decl_isArray (decl_node n) +extern "C" bool decl_isArray (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_array; @@ -23789,7 +23828,7 @@ extern "C" unsigned int decl_isArray (decl_node n) isProcType - returns TRUE if, n, is a procedure type. */ -extern "C" unsigned int decl_isProcType (decl_node n) +extern "C" bool decl_isProcType (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_proctype; @@ -23802,7 +23841,7 @@ extern "C" unsigned int decl_isProcType (decl_node n) isPointer - returns TRUE if, n, is a pointer. */ -extern "C" unsigned int decl_isPointer (decl_node n) +extern "C" bool decl_isPointer (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_pointer; @@ -23815,7 +23854,7 @@ extern "C" unsigned int decl_isPointer (decl_node n) isProcedure - returns TRUE if, n, is a procedure. */ -extern "C" unsigned int decl_isProcedure (decl_node n) +extern "C" bool decl_isProcedure (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_procedure; @@ -23828,7 +23867,7 @@ extern "C" unsigned int decl_isProcedure (decl_node n) isVarient - returns TRUE if, n, is a varient record. */ -extern "C" unsigned int decl_isVarient (decl_node n) +extern "C" bool decl_isVarient (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_varient; @@ -23841,7 +23880,7 @@ extern "C" unsigned int decl_isVarient (decl_node n) isSet - returns TRUE if, n, is a set type. */ -extern "C" unsigned int decl_isSet (decl_node n) +extern "C" bool decl_isSet (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_set; @@ -23854,7 +23893,7 @@ extern "C" unsigned int decl_isSet (decl_node n) isSubrange - returns TRUE if, n, is a subrange type. */ -extern "C" unsigned int decl_isSubrange (decl_node n) +extern "C" bool decl_isSubrange (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_subrange; @@ -23867,7 +23906,7 @@ extern "C" unsigned int decl_isSubrange (decl_node n) isZtype - returns TRUE if, n, is the Z type. */ -extern "C" unsigned int decl_isZtype (decl_node n) +extern "C" bool decl_isZtype (decl_node n) { return n == ztypeN; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23879,7 +23918,7 @@ extern "C" unsigned int decl_isZtype (decl_node n) isRtype - returns TRUE if, n, is the R type. */ -extern "C" unsigned int decl_isRtype (decl_node n) +extern "C" bool decl_isRtype (decl_node n) { return n == rtypeN; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23929,8 +23968,8 @@ extern "C" decl_node decl_makeType (nameKey_Name n) d->typeF.name = n; d->typeF.type = NULL; d->typeF.scope = decl_getDeclScope (); - d->typeF.isHidden = FALSE; - d->typeF.isInternal = FALSE; + d->typeF.isHidden = false; + d->typeF.isInternal = false; return addToScope (d); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -23949,7 +23988,7 @@ extern "C" decl_node decl_makeTypeImp (nameKey_Name n) d = decl_lookupSym (n); if (d != NULL) { - d->typeF.isHidden = FALSE; + d->typeF.isHidden = false; return addToScope (d); } else @@ -23958,7 +23997,7 @@ extern "C" decl_node decl_makeTypeImp (nameKey_Name n) d->typeF.name = n; d->typeF.type = NULL; d->typeF.scope = decl_getDeclScope (); - d->typeF.isHidden = FALSE; + d->typeF.isHidden = false; return addToScope (d); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23979,9 +24018,9 @@ extern "C" decl_node decl_makeVar (nameKey_Name n) d->varF.type = NULL; d->varF.decl = NULL; d->varF.scope = decl_getDeclScope (); - d->varF.isInitialised = FALSE; - d->varF.isParameter = FALSE; - d->varF.isVarParameter = FALSE; + d->varF.isInitialised = false; + d->varF.isParameter = false; + d->varF.isVarParameter = false; initCname (&d->varF.cname); return addToScope (d); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -24151,7 +24190,7 @@ extern "C" decl_node decl_makeArray (decl_node subr, decl_node type) n->arrayF.subr = subr; n->arrayF.type = type; n->arrayF.scope = decl_getDeclScope (); - n->arrayF.isUnbounded = FALSE; + n->arrayF.isUnbounded = false; return n; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -24165,7 +24204,7 @@ extern "C" decl_node decl_makeArray (decl_node subr, decl_node type) extern "C" void decl_putUnbounded (decl_node n) { mcDebug_assert (n->kind == decl_array); - n->arrayF.isUnbounded = TRUE; + n->arrayF.isUnbounded = true; } @@ -24307,7 +24346,7 @@ extern "C" void decl_buildVarientSelector (decl_node r, decl_node v, nameKey_Nam /* avoid dangling else. */ f = putFieldRecord (r, tag, type, v); mcDebug_assert (decl_isRecordField (f)); - f->recordfieldF.tag = TRUE; + f->recordfieldF.tag = true; putVarientTag (v, f); } } @@ -24804,7 +24843,7 @@ extern "C" decl_node decl_lookupSym (nameKey_Name n) module, m, scope. */ -extern "C" void decl_addImportedModule (decl_node m, decl_node i, unsigned int scoped) +extern "C" void decl_addImportedModule (decl_node m, decl_node i, bool scoped) { mcDebug_assert ((decl_isDef (i)) || (decl_isModule (i))); if (decl_isDef (m)) @@ -24998,13 +25037,13 @@ extern "C" decl_node decl_makeProcedure (nameKey_Name n) d->procedureF.scope = decl_getDeclScope (); d->procedureF.parameters = Indexing_InitIndex (1); d->procedureF.isForC = isDefForCNode (decl_getDeclScope ()); - d->procedureF.built = FALSE; - d->procedureF.returnopt = FALSE; + d->procedureF.built = false; + d->procedureF.returnopt = false; d->procedureF.optarg_ = NULL; - d->procedureF.noreturnused = FALSE; - d->procedureF.noreturn = FALSE; - d->procedureF.vararg = FALSE; - d->procedureF.checking = FALSE; + d->procedureF.noreturnused = false; + d->procedureF.noreturn = false; + d->procedureF.vararg = false; + d->procedureF.checking = false; d->procedureF.paramcount = 0; d->procedureF.returnType = NULL; d->procedureF.beginStatements = NULL; @@ -25061,9 +25100,9 @@ extern "C" decl_node decl_makeProcType (void) d = newNode (decl_proctype); d->proctypeF.scope = decl_getDeclScope (); d->proctypeF.parameters = Indexing_InitIndex (1); - d->proctypeF.returnopt = FALSE; + d->proctypeF.returnopt = false; d->proctypeF.optarg_ = NULL; - d->proctypeF.vararg = FALSE; + d->proctypeF.vararg = false; d->proctypeF.returnType = NULL; return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -25098,11 +25137,11 @@ extern "C" void decl_putOptReturn (decl_node proc) mcDebug_assert ((decl_isProcedure (proc)) || (decl_isProcType (proc))); if (decl_isProcedure (proc)) { - proc->procedureF.returnopt = TRUE; + proc->procedureF.returnopt = true; } else { - proc->proctypeF.returnopt = TRUE; + proc->proctypeF.returnopt = true; } } @@ -25111,7 +25150,7 @@ extern "C" void decl_putOptReturn (decl_node proc) makeVarParameter - returns a var parameter node with, name: type. */ -extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused) +extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, bool isused) { decl_node d; @@ -25120,7 +25159,7 @@ extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_no d->varparamF.namelist = l; d->varparamF.type = type; d->varparamF.scope = proc; - d->varparamF.isUnbounded = FALSE; + d->varparamF.isUnbounded = false; d->varparamF.isForC = isDefForCNode (proc); d->varparamF.isUsed = isused; return d; @@ -25133,7 +25172,7 @@ extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_no makeNonVarParameter - returns a non var parameter node with, name: type. */ -extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused) +extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, bool isused) { decl_node d; @@ -25142,7 +25181,7 @@ extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl d->paramF.namelist = l; d->paramF.type = type; d->paramF.scope = proc; - d->paramF.isUnbounded = FALSE; + d->paramF.isUnbounded = false; d->paramF.isForC = isDefForCNode (proc); d->paramF.isUsed = isused; return d; @@ -25169,10 +25208,10 @@ extern "C" void decl_paramEnter (decl_node n) extern "C" void decl_paramLeave (decl_node n) { mcDebug_assert (decl_isProcedure (n)); - n->procedureF.checking = TRUE; + n->procedureF.checking = true; if ((decl_isImp (currentModule)) || (decl_isModule (currentModule))) { - n->procedureF.built = TRUE; + n->procedureF.built = true; } } @@ -25187,7 +25226,7 @@ extern "C" decl_node decl_makeIdentList (void) n = newNode (decl_identlist); n->identlistF.names = wlists_initList (); - n->identlistF.cnamed = FALSE; + n->identlistF.cnamed = false; return n; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -25199,17 +25238,17 @@ extern "C" decl_node decl_makeIdentList (void) ident, i, is unique. */ -extern "C" unsigned int decl_putIdent (decl_node n, nameKey_Name i) +extern "C" bool decl_putIdent (decl_node n, nameKey_Name i) { mcDebug_assert (isIdentList (n)); if (wlists_isItemInList (n->identlistF.names, i)) { - return FALSE; + return false; } else { wlists_putItemIntoList (n->identlistF.names, i); - return TRUE; + return true; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -25221,16 +25260,16 @@ extern "C" unsigned int decl_putIdent (decl_node n, nameKey_Name i) in procedure, n. */ -extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused) +extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, bool isused) { decl_node p; mcDebug_assert (isIdentList (i)); mcDebug_assert (decl_isProcedure (n)); - checkMakeVariables (n, i, type, TRUE, isused); + checkMakeVariables (n, i, type, true, isused); if (n->procedureF.checking) { - checkParameters (n, i, type, TRUE, isused); /* will destroy, i. */ + checkParameters (n, i, type, true, isused); /* will destroy, i. */ } else { @@ -25245,16 +25284,16 @@ extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, in procedure, n. */ -extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused) +extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, bool isused) { decl_node p; mcDebug_assert (isIdentList (i)); mcDebug_assert (decl_isProcedure (n)); - checkMakeVariables (n, i, type, FALSE, isused); + checkMakeVariables (n, i, type, false, isused); if (n->procedureF.checking) { - checkParameters (n, i, type, FALSE, isused); /* will destroy, i. */ + checkParameters (n, i, type, false, isused); /* will destroy, i. */ } else { @@ -25284,7 +25323,7 @@ extern "C" decl_node decl_makeVarargs (void) isVarargs - returns TRUE if, n, is a varargs node. */ -extern "C" unsigned int decl_isVarargs (decl_node n) +extern "C" bool decl_isVarargs (decl_node n) { return n->kind == decl_varargs; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -25305,7 +25344,7 @@ extern "C" void decl_addParameter (decl_node proc, decl_node param) Indexing_IncludeIndiceIntoIndex (proc->procedureF.parameters, reinterpret_cast<void *> (param)); if (decl_isVarargs (param)) { - proc->procedureF.vararg = TRUE; + proc->procedureF.vararg = true; } if (decl_isOptarg (param)) { @@ -25317,7 +25356,7 @@ extern "C" void decl_addParameter (decl_node proc, decl_node param) Indexing_IncludeIndiceIntoIndex (proc->proctypeF.parameters, reinterpret_cast<void *> (param)); if (decl_isVarargs (param)) { - proc->proctypeF.vararg = TRUE; + proc->proctypeF.vararg = true; } if (decl_isOptarg (param)) { @@ -25523,7 +25562,7 @@ extern "C" decl_node decl_makePointerRef (decl_node ptr, decl_node field) isPointerRef - returns TRUE if, n, is a pointerref node. */ -extern "C" unsigned int decl_isPointerRef (decl_node n) +extern "C" bool decl_isPointerRef (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_pointerref; @@ -25703,7 +25742,7 @@ extern "C" decl_node decl_makeSetValue (void) isSetValue - returns TRUE if, n, is a setvalue node. */ -extern "C" unsigned int decl_isSetValue (decl_node n) +extern "C" bool decl_isSetValue (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_setvalue; @@ -25799,7 +25838,7 @@ extern "C" decl_node decl_makeExpList (void) isExpList - returns TRUE if, n, is an explist node. */ -extern "C" unsigned int decl_isExpList (decl_node n) +extern "C" bool decl_isExpList (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_explist; @@ -25877,15 +25916,15 @@ extern "C" void decl_setConstExpComplete (decl_node n) switch (n->kind) { case decl_def: - n->defF.constsComplete = TRUE; + n->defF.constsComplete = true; break; case decl_imp: - n->impF.constsComplete = TRUE; + n->impF.constsComplete = true; break; case decl_module: - n->moduleF.constsComplete = TRUE; + n->moduleF.constsComplete = true; break; @@ -25946,7 +25985,7 @@ extern "C" decl_node decl_makeFuncCall (decl_node c, decl_node n) mcDebug_assert ((n == NULL) || (decl_isExpList (n))); if (((c == haltN) && ((decl_getMainModule ()) != (decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5))))) && ((decl_getMainModule ()) != (decl_lookupImp (nameKey_makeKey ((const char *) "M2RTS", 5))))) { - decl_addImportedModule (decl_getMainModule (), decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5)), FALSE); + decl_addImportedModule (decl_getMainModule (), decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5)), false); } f = checkIntrinsic (c, n); checkCHeaders (c); @@ -25984,7 +26023,7 @@ extern "C" decl_node decl_makeStatementSequence (void) isStatementSequence - returns TRUE if node, n, is a statement sequence. */ -extern "C" unsigned int decl_isStatementSequence (decl_node n) +extern "C" bool decl_isStatementSequence (decl_node n) { return n->kind == decl_stmtseq; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -26004,7 +26043,7 @@ extern "C" void decl_addStatement (decl_node s, decl_node n) Indexing_PutIndice (s->stmtF.statements, (Indexing_HighIndice (s->stmtF.statements))+1, reinterpret_cast<void *> (n)); if ((isIntrinsic (n)) && n->intrinsicF.postUnreachable) { - n->intrinsicF.postUnreachable = FALSE; + n->intrinsicF.postUnreachable = false; decl_addStatement (s, makeIntrinsicProc (decl_unreachable, 0, NULL)); } } @@ -26123,7 +26162,7 @@ extern "C" decl_node decl_makeReturn (void) isReturn - returns TRUE if node, n, is a return. */ -extern "C" unsigned int decl_isReturn (decl_node n) +extern "C" bool decl_isReturn (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_return; @@ -26179,7 +26218,7 @@ extern "C" void decl_putWhile (decl_node n, decl_node e, decl_node s) isWhile - returns TRUE if node, n, is a while. */ -extern "C" unsigned int decl_isWhile (decl_node n) +extern "C" bool decl_isWhile (decl_node n) { return n->kind == decl_while; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -26310,7 +26349,7 @@ extern "C" decl_node decl_makeExit (decl_node l, unsigned int n) isExit - returns TRUE if node, n, is an exit. */ -extern "C" unsigned int decl_isExit (decl_node n) +extern "C" bool decl_isExit (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_exit; @@ -26340,7 +26379,7 @@ extern "C" decl_node decl_makeLoop (void) isLoop - returns TRUE if, n, is a loop node. */ -extern "C" unsigned int decl_isLoop (decl_node n) +extern "C" bool decl_isLoop (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_loop; @@ -26373,7 +26412,7 @@ extern "C" decl_node decl_makeComment (const char *a_, unsigned int _a_high) /* make a local copy of each unbounded array. */ memcpy (a, a_, _a_high+1); - c = mcComment_initComment (TRUE); + c = mcComment_initComment (true); s = DynamicStrings_InitString ((const char *) a, _a_high); mcComment_addText (c, DynamicStrings_string (s)); s = DynamicStrings_KillString (s); @@ -26434,7 +26473,7 @@ extern "C" decl_node decl_makeIf (decl_node e, decl_node s) isIf - returns TRUE if, n, is an if node. */ -extern "C" unsigned int decl_isIf (decl_node n) +extern "C" bool decl_isIf (decl_node n) { return n->kind == decl_if; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -26479,7 +26518,7 @@ extern "C" decl_node decl_makeElsif (decl_node i, decl_node e, decl_node s) isElsif - returns TRUE if node, n, is an elsif node. */ -extern "C" unsigned int decl_isElsif (decl_node n) +extern "C" bool decl_isElsif (decl_node n) { return n->kind == decl_elsif; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -26534,7 +26573,7 @@ extern "C" decl_node decl_makeFor (void) isFor - returns TRUE if node, n, is a for node. */ -extern "C" unsigned int decl_isFor (decl_node n) +extern "C" bool decl_isFor (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_for; @@ -26586,7 +26625,7 @@ extern "C" decl_node decl_makeRepeat (void) isRepeat - returns TRUE if node, n, is a repeat node. */ -extern "C" unsigned int decl_isRepeat (decl_node n) +extern "C" bool decl_isRepeat (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_repeat; @@ -26653,7 +26692,7 @@ extern "C" decl_node decl_makeCase (void) isCase - returns TRUE if node, n, is a case statement. */ -extern "C" unsigned int decl_isCase (decl_node n) +extern "C" bool decl_isCase (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_case; @@ -26730,7 +26769,7 @@ extern "C" decl_node decl_makeCaseLabelList (decl_node l, decl_node s) isCaseLabelList - returns TRUE if, n, is a caselabellist. */ -extern "C" unsigned int decl_isCaseLabelList (decl_node n) +extern "C" bool decl_isCaseLabelList (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_caselabellist; @@ -26759,7 +26798,7 @@ extern "C" decl_node decl_makeCaseList (void) isCaseList - returns TRUE if, n, is a case list. */ -extern "C" unsigned int decl_isCaseList (decl_node n) +extern "C" bool decl_isCaseList (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_caselist; @@ -26803,7 +26842,7 @@ extern "C" decl_node decl_makeRange (decl_node lo, decl_node hi) isRange - returns TRUE if node, n, is a range. */ -extern "C" unsigned int decl_isRange (decl_node n) +extern "C" bool decl_isRange (decl_node n) { mcDebug_assert (n != NULL); return n->kind == decl_range; @@ -26816,7 +26855,7 @@ extern "C" unsigned int decl_isRange (decl_node n) setNoReturn - sets noreturn field inside procedure. */ -extern "C" void decl_setNoReturn (decl_node n, unsigned int value) +extern "C" void decl_setNoReturn (decl_node n, bool value) { mcDebug_assert (n != NULL); mcDebug_assert (decl_isProcedure (n)); @@ -26825,7 +26864,7 @@ extern "C" void decl_setNoReturn (decl_node n, unsigned int value) mcMetaError_metaError1 ((const char *) "{%1DMad} definition module and implementation module have different <* noreturn *> attributes", 93, (const unsigned char *) &n, (sizeof (n)-1)); } n->procedureF.noreturn = value; - n->procedureF.noreturnused = TRUE; + n->procedureF.noreturnused = true; } diff --git a/gcc/m2/mc-boot/Gdecl.h b/gcc/m2/mc-boot/Gdecl.h index 3f602fb..222a053 100644 --- a/gcc/m2/mc-boot/Gdecl.h +++ b/gcc/m2/mc-boot/Gdecl.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -53,7 +54,7 @@ extern "C" { typedef struct decl_isNodeF_p decl_isNodeF; -typedef unsigned int (*decl_isNodeF_t) (decl_node); +typedef bool (*decl_isNodeF_t) (decl_node); struct decl_isNodeF_p { decl_isNodeF_t proc; }; @@ -82,25 +83,25 @@ EXTERN unsigned int decl_getFirstUsed (decl_node n); isDef - return TRUE if node, n, is a definition module. */ -EXTERN unsigned int decl_isDef (decl_node n); +EXTERN bool decl_isDef (decl_node n); /* isImp - return TRUE if node, n, is an implementation module. */ -EXTERN unsigned int decl_isImp (decl_node n); +EXTERN bool decl_isImp (decl_node n); /* isImpOrModule - returns TRUE if, n, is a program module or implementation module. */ -EXTERN unsigned int decl_isImpOrModule (decl_node n); +EXTERN bool decl_isImpOrModule (decl_node n); /* isVisited - returns TRUE if the node was visited. */ -EXTERN unsigned int decl_isVisited (decl_node n); +EXTERN bool decl_isVisited (decl_node n); /* unsetVisited - unset the visited flag on a def/imp/module node. @@ -124,7 +125,7 @@ EXTERN void decl_setEnumsComplete (decl_node n); getEnumsComplete - gets the field from the def or imp or module, n. */ -EXTERN unsigned int decl_getEnumsComplete (decl_node n); +EXTERN bool decl_getEnumsComplete (decl_node n); /* resetEnumPos - resets the index into the saved list of enums inside @@ -143,7 +144,7 @@ EXTERN decl_node decl_getNextEnum (void); isModule - return TRUE if node, n, is a program module. */ -EXTERN unsigned int decl_isModule (decl_node n); +EXTERN bool decl_isModule (decl_node n); /* isMainModule - return TRUE if node, n, is the main module specified @@ -151,7 +152,7 @@ EXTERN unsigned int decl_isModule (decl_node n); implementation or program module. */ -EXTERN unsigned int decl_isMainModule (decl_node n); +EXTERN bool decl_isMainModule (decl_node n); /* setMainModule - sets node, n, as the main module to be compiled. @@ -199,13 +200,13 @@ EXTERN decl_node decl_lookupInScope (decl_node scope, nameKey_Name n); isConst - returns TRUE if node, n, is a const. */ -EXTERN unsigned int decl_isConst (decl_node n); +EXTERN bool decl_isConst (decl_node n); /* isType - returns TRUE if node, n, is a type. */ -EXTERN unsigned int decl_isType (decl_node n); +EXTERN bool decl_isType (decl_node n); /* putType - places, exp, as the type alias to des. @@ -237,32 +238,32 @@ EXTERN void decl_putTypeHidden (decl_node des); isTypeHidden - returns TRUE if type, n, is hidden. */ -EXTERN unsigned int decl_isTypeHidden (decl_node n); +EXTERN bool decl_isTypeHidden (decl_node n); /* hasHidden - returns TRUE if module, n, has a hidden type. */ -EXTERN unsigned int decl_hasHidden (decl_node n); +EXTERN bool decl_hasHidden (decl_node n); /* isVar - returns TRUE if node, n, is a type. */ -EXTERN unsigned int decl_isVar (decl_node n); +EXTERN bool decl_isVar (decl_node n); /* isTemporary - returns TRUE if node, n, is a variable and temporary. */ -EXTERN unsigned int decl_isTemporary (decl_node n); +EXTERN bool decl_isTemporary (decl_node n); /* isExported - returns TRUE if symbol, n, is exported from the definition module. */ -EXTERN unsigned int decl_isExported (decl_node n); +EXTERN bool decl_isExported (decl_node n); /* getDeclScope - returns the node representing the @@ -281,55 +282,55 @@ EXTERN decl_node decl_getScope (decl_node n); isLiteral - returns TRUE if, n, is a literal. */ -EXTERN unsigned int decl_isLiteral (decl_node n); +EXTERN bool decl_isLiteral (decl_node n); /* isConstSet - returns TRUE if, n, is a constant set. */ -EXTERN unsigned int decl_isConstSet (decl_node n); +EXTERN bool decl_isConstSet (decl_node n); /* isEnumerationField - returns TRUE if, n, is an enumeration field. */ -EXTERN unsigned int decl_isEnumerationField (decl_node n); +EXTERN bool decl_isEnumerationField (decl_node n); /* isEnumeration - returns TRUE if node, n, is an enumeration type. */ -EXTERN unsigned int decl_isEnumeration (decl_node n); +EXTERN bool decl_isEnumeration (decl_node n); /* isUnbounded - returns TRUE if, n, is an unbounded array. */ -EXTERN unsigned int decl_isUnbounded (decl_node n); +EXTERN bool decl_isUnbounded (decl_node n); /* isParameter - returns TRUE if, n, is a parameter. */ -EXTERN unsigned int decl_isParameter (decl_node n); +EXTERN bool decl_isParameter (decl_node n); /* isVarParam - returns TRUE if, n, is a var parameter. */ -EXTERN unsigned int decl_isVarParam (decl_node n); +EXTERN bool decl_isVarParam (decl_node n); /* isParam - returns TRUE if, n, is a non var parameter. */ -EXTERN unsigned int decl_isParam (decl_node n); +EXTERN bool decl_isParam (decl_node n); /* isNonVarParam - is an alias to isParam. */ -EXTERN unsigned int decl_isNonVarParam (decl_node n); +EXTERN bool decl_isNonVarParam (decl_node n); /* addOptParameter - returns an optarg which has been created and added to @@ -343,79 +344,79 @@ EXTERN decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl_nod isOptarg - returns TRUE if, n, is an optarg. */ -EXTERN unsigned int decl_isOptarg (decl_node n); +EXTERN bool decl_isOptarg (decl_node n); /* isRecord - returns TRUE if, n, is a record. */ -EXTERN unsigned int decl_isRecord (decl_node n); +EXTERN bool decl_isRecord (decl_node n); /* isRecordField - returns TRUE if, n, is a record field. */ -EXTERN unsigned int decl_isRecordField (decl_node n); +EXTERN bool decl_isRecordField (decl_node n); /* isVarientField - returns TRUE if, n, is a varient field. */ -EXTERN unsigned int decl_isVarientField (decl_node n); +EXTERN bool decl_isVarientField (decl_node n); /* isArray - returns TRUE if, n, is an array. */ -EXTERN unsigned int decl_isArray (decl_node n); +EXTERN bool decl_isArray (decl_node n); /* isProcType - returns TRUE if, n, is a procedure type. */ -EXTERN unsigned int decl_isProcType (decl_node n); +EXTERN bool decl_isProcType (decl_node n); /* isPointer - returns TRUE if, n, is a pointer. */ -EXTERN unsigned int decl_isPointer (decl_node n); +EXTERN bool decl_isPointer (decl_node n); /* isProcedure - returns TRUE if, n, is a procedure. */ -EXTERN unsigned int decl_isProcedure (decl_node n); +EXTERN bool decl_isProcedure (decl_node n); /* isVarient - returns TRUE if, n, is a varient record. */ -EXTERN unsigned int decl_isVarient (decl_node n); +EXTERN bool decl_isVarient (decl_node n); /* isSet - returns TRUE if, n, is a set type. */ -EXTERN unsigned int decl_isSet (decl_node n); +EXTERN bool decl_isSet (decl_node n); /* isSubrange - returns TRUE if, n, is a subrange type. */ -EXTERN unsigned int decl_isSubrange (decl_node n); +EXTERN bool decl_isSubrange (decl_node n); /* isZtype - returns TRUE if, n, is the Z type. */ -EXTERN unsigned int decl_isZtype (decl_node n); +EXTERN bool decl_isZtype (decl_node n); /* isRtype - returns TRUE if, n, is the R type. */ -EXTERN unsigned int decl_isRtype (decl_node n); +EXTERN bool decl_isRtype (decl_node n); /* makeConst - create, initialise and return a const node. @@ -577,7 +578,7 @@ EXTERN decl_node decl_lookupSym (nameKey_Name n); module, m, scope. */ -EXTERN void decl_addImportedModule (decl_node m, decl_node i, unsigned int scoped); +EXTERN void decl_addImportedModule (decl_node m, decl_node i, bool scoped); /* setSource - sets the source filename for module, n, to s. @@ -674,14 +675,14 @@ EXTERN void decl_putOptReturn (decl_node proc); Where the parameters are declared as l: type. */ -EXTERN decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused); +EXTERN decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, bool isused); /* makeNonVarParameter - returns a non var parameter node with namelist and type. Where the parameters are declared as l: type. */ -EXTERN decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused); +EXTERN decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, bool isused); /* paramEnter - reset the parameter count. @@ -705,21 +706,21 @@ EXTERN decl_node decl_makeIdentList (void); putIdent - places ident, i, into identlist, n. */ -EXTERN unsigned int decl_putIdent (decl_node n, nameKey_Name i); +EXTERN bool decl_putIdent (decl_node n, nameKey_Name i); /* addVarParameters - adds the identlist, i, of, type, to be VAR parameters in procedure, n. */ -EXTERN void decl_addVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused); +EXTERN void decl_addVarParameters (decl_node n, decl_node i, decl_node type, bool isused); /* addNonVarParameters - adds the identlist, i, of, type, to be parameters in procedure, n. */ -EXTERN void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused); +EXTERN void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, bool isused); /* makeVarargs - returns a varargs node. @@ -731,7 +732,7 @@ EXTERN decl_node decl_makeVarargs (void); isVarargs - returns TRUE if, n, is a varargs node. */ -EXTERN unsigned int decl_isVarargs (decl_node n); +EXTERN bool decl_isVarargs (decl_node n); /* addParameter - adds a parameter, param, to procedure or proctype, proc. @@ -771,7 +772,7 @@ EXTERN decl_node decl_makePointerRef (decl_node ptr, decl_node field); isPointerRef - returns TRUE if, n, is a pointerref node. */ -EXTERN unsigned int decl_isPointerRef (decl_node n); +EXTERN bool decl_isPointerRef (decl_node n); /* makeDeRef - dereferences the pointer defined by, n. @@ -827,7 +828,7 @@ EXTERN decl_node decl_makeSetValue (void); isSetValue - returns TRUE if, n, is a setvalue node. */ -EXTERN unsigned int decl_isSetValue (decl_node n); +EXTERN bool decl_isSetValue (decl_node n); /* putSetValue - assigns the type, t, to the set value, n. The @@ -861,7 +862,7 @@ EXTERN decl_node decl_makeExpList (void); isExpList - returns TRUE if, n, is an explist node. */ -EXTERN unsigned int decl_isExpList (decl_node n); +EXTERN bool decl_isExpList (decl_node n); /* putExpList - places, expression, e, within the explist, n. @@ -916,7 +917,7 @@ EXTERN decl_node decl_makeStatementSequence (void); isStatementSequence - returns TRUE if node, n, is a statement sequence. */ -EXTERN unsigned int decl_isStatementSequence (decl_node n); +EXTERN bool decl_isStatementSequence (decl_node n); /* addStatement - adds node, n, as a statement to statememt sequence, s. @@ -964,7 +965,7 @@ EXTERN decl_node decl_makeReturn (void); isReturn - returns TRUE if node, n, is a return. */ -EXTERN unsigned int decl_isReturn (decl_node n); +EXTERN bool decl_isReturn (decl_node n); /* putReturn - assigns node, e, as the expression on the return node. @@ -989,7 +990,7 @@ EXTERN void decl_putWhile (decl_node n, decl_node e, decl_node s); isWhile - returns TRUE if node, n, is a while. */ -EXTERN unsigned int decl_isWhile (decl_node n); +EXTERN bool decl_isWhile (decl_node n); /* addWhileDoComment - adds body and after comments to while node, w. @@ -1036,7 +1037,7 @@ EXTERN decl_node decl_makeExit (decl_node l, unsigned int n); isExit - returns TRUE if node, n, is an exit. */ -EXTERN unsigned int decl_isExit (decl_node n); +EXTERN bool decl_isExit (decl_node n); /* makeLoop - creates and returns a loop node. @@ -1048,7 +1049,7 @@ EXTERN decl_node decl_makeLoop (void); isLoop - returns TRUE if, n, is a loop node. */ -EXTERN unsigned int decl_isLoop (decl_node n); +EXTERN bool decl_isLoop (decl_node n); /* putLoop - places statement sequence, s, into loop, l. @@ -1080,7 +1081,7 @@ EXTERN decl_node decl_makeIf (decl_node e, decl_node s); isIf - returns TRUE if, n, is an if node. */ -EXTERN unsigned int decl_isIf (decl_node n); +EXTERN bool decl_isIf (decl_node n); /* makeElsif - creates and returns an elsif node. @@ -1094,7 +1095,7 @@ EXTERN decl_node decl_makeElsif (decl_node i, decl_node e, decl_node s); isElsif - returns TRUE if node, n, is an elsif node. */ -EXTERN unsigned int decl_isElsif (decl_node n); +EXTERN bool decl_isElsif (decl_node n); /* putElse - the else is grafted onto the if/elsif node, i, @@ -1113,7 +1114,7 @@ EXTERN decl_node decl_makeFor (void); isFor - returns TRUE if node, n, is a for node. */ -EXTERN unsigned int decl_isFor (decl_node n); +EXTERN bool decl_isFor (decl_node n); /* putFor - assigns the fields of the for node with @@ -1136,7 +1137,7 @@ EXTERN decl_node decl_makeRepeat (void); isRepeat - returns TRUE if node, n, is a repeat node. */ -EXTERN unsigned int decl_isRepeat (decl_node n); +EXTERN bool decl_isRepeat (decl_node n); /* putRepeat - places statements, s, and expression, e, into @@ -1167,7 +1168,7 @@ EXTERN decl_node decl_makeCase (void); isCase - returns TRUE if node, n, is a case statement. */ -EXTERN unsigned int decl_isCase (decl_node n); +EXTERN bool decl_isCase (decl_node n); /* putCaseExpression - places expression, e, into case statement, n. @@ -1201,7 +1202,7 @@ EXTERN decl_node decl_makeCaseLabelList (decl_node l, decl_node s); isCaseLabelList - returns TRUE if, n, is a caselabellist. */ -EXTERN unsigned int decl_isCaseLabelList (decl_node n); +EXTERN bool decl_isCaseLabelList (decl_node n); /* makeCaseList - creates and returns a case statement node. @@ -1213,7 +1214,7 @@ EXTERN decl_node decl_makeCaseList (void); isCaseList - returns TRUE if, n, is a case list. */ -EXTERN unsigned int decl_isCaseList (decl_node n); +EXTERN bool decl_isCaseList (decl_node n); /* putCaseRange - places the case range lo..hi into caselist, n. @@ -1231,13 +1232,13 @@ EXTERN decl_node decl_makeRange (decl_node lo, decl_node hi); isRange - returns TRUE if node, n, is a range. */ -EXTERN unsigned int decl_isRange (decl_node n); +EXTERN bool decl_isRange (decl_node n); /* setNoReturn - sets noreturn field inside procedure. */ -EXTERN void decl_setNoReturn (decl_node n, unsigned int value); +EXTERN void decl_setNoReturn (decl_node n, bool value); /* dupExpr - duplicate the expression nodes, it does not duplicate diff --git a/gcc/m2/mc-boot/Gdtoa.h b/gcc/m2/mc-boot/Gdtoa.h index aaab69b..67a3c56 100644 --- a/gcc/m2/mc-boot/Gdtoa.h +++ b/gcc/m2/mc-boot/Gdtoa.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -56,7 +57,7 @@ typedef enum {dtoa_maxsignificant, dtoa_decimaldigits} dtoa_Mode; error to TRUE if the number is too large. */ -EXTERN double dtoa_strtod (void * s, unsigned int *error); +EXTERN double dtoa_strtod (void * s, bool *error); /* dtoa - converts a REAL, d, into a string. The address of the @@ -67,7 +68,7 @@ EXTERN double dtoa_strtod (void * s, unsigned int *error); sign does the string have a sign? */ -EXTERN void * dtoa_dtoa (double d, dtoa_Mode mode, int ndigits, int *decpt, unsigned int *sign); +EXTERN void * dtoa_dtoa (double d, dtoa_Mode mode, int ndigits, int *decpt, bool *sign); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Gerrno.h b/gcc/m2/mc-boot/Gerrno.h index 916027c..ae23c3e 100644 --- a/gcc/m2/mc-boot/Gerrno.h +++ b/gcc/m2/mc-boot/Gerrno.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Gkeyc.cc b/gcc/m2/mc-boot/Gkeyc.cc index e089ac9..9174716 100644 --- a/gcc/m2/mc-boot/Gkeyc.cc +++ b/gcc/m2/mc-boot/Gkeyc.cc @@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -71,42 +72,42 @@ static keyc_scope stack; static keyc_scope freeList; static symbolKey_symbolTree keywords; static symbolKey_symbolTree macros; -static unsigned int initializedCP; -static unsigned int initializedGCC; -static unsigned int seenIntMin; -static unsigned int seenUIntMin; -static unsigned int seenLongMin; -static unsigned int seenULongMin; -static unsigned int seenCharMin; -static unsigned int seenUCharMin; -static unsigned int seenIntMax; -static unsigned int seenUIntMax; -static unsigned int seenLongMax; -static unsigned int seenULongMax; -static unsigned int seenCharMax; -static unsigned int seenUCharMax; -static unsigned int seenLabs; -static unsigned int seenAbs; -static unsigned int seenFabs; -static unsigned int seenFabsl; -static unsigned int seenSize_t; -static unsigned int seenSSize_t; -static unsigned int seenUnistd; -static unsigned int seenSysTypes; -static unsigned int seenThrow; -static unsigned int seenFree; -static unsigned int seenMalloc; -static unsigned int seenStorage; -static unsigned int seenProc; -static unsigned int seenTrue; -static unsigned int seenFalse; -static unsigned int seenNull; -static unsigned int seenMemcpy; -static unsigned int seenException; -static unsigned int seenComplex; -static unsigned int seenM2RTS; -static unsigned int seenStrlen; -static unsigned int seenCtype; +static bool initializedCP; +static bool initializedGCC; +static bool seenIntMin; +static bool seenUIntMin; +static bool seenLongMin; +static bool seenULongMin; +static bool seenCharMin; +static bool seenUCharMin; +static bool seenIntMax; +static bool seenUIntMax; +static bool seenLongMax; +static bool seenULongMax; +static bool seenCharMax; +static bool seenUCharMax; +static bool seenLabs; +static bool seenAbs; +static bool seenFabs; +static bool seenFabsl; +static bool seenSize_t; +static bool seenSSize_t; +static bool seenUnistd; +static bool seenSysTypes; +static bool seenThrow; +static bool seenFree; +static bool seenMalloc; +static bool seenStorage; +static bool seenProc; +static bool seenTrue; +static bool seenFalse; +static bool seenNull; +static bool seenMemcpy; +static bool seenException; +static bool seenComplex; +static bool seenM2RTS; +static bool seenStrlen; +static bool seenCtype; /* useUnistd - need to use unistd.h call using open/close/read/write require this header. @@ -342,7 +343,7 @@ extern "C" void keyc_leaveScope (decl_node n); is ignored). */ -extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes); +extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, bool scopes); /* cnamen - attempts to declare a symbol with name, n, in the @@ -354,7 +355,7 @@ extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes is ignored). */ -extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, unsigned int scopes); +extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, bool scopes); /* cp - include C++ keywords and standard declarations to avoid. @@ -472,6 +473,12 @@ static void checkSysTypes (mcPretty_pretty p); static void fixNullPointerConst (mcPretty_pretty p); /* + genBool - +*/ + +static void genBool (mcPretty_pretty p); + +/* new - */ @@ -482,28 +489,28 @@ static keyc_scope new_ (decl_node n); to its end. */ -static unsigned int mangle1 (nameKey_Name n, DynamicStrings_String *m, unsigned int scopes); +static bool mangle1 (nameKey_Name n, DynamicStrings_String *m, bool scopes); /* mangle2 - returns TRUE if name is unique if we prepend _ to, n. */ -static unsigned int mangle2 (nameKey_Name n, DynamicStrings_String *m, unsigned int scopes); +static bool mangle2 (nameKey_Name n, DynamicStrings_String *m, bool scopes); /* mangleN - keep adding '_' to the end of n until it no longer clashes. */ -static unsigned int mangleN (nameKey_Name n, DynamicStrings_String *m, unsigned int scopes); +static bool mangleN (nameKey_Name n, DynamicStrings_String *m, bool scopes); /* clash - returns TRUE if there is a clash with name, n, in the current scope or C keywords or C macros. */ -static unsigned int clash (nameKey_Name n, unsigned int scopes); +static bool clash (nameKey_Name n, bool scopes); /* initCP - add the extra keywords and standard definitions used by C++. @@ -547,7 +554,7 @@ static void checkGccConfigSystem (mcPretty_pretty p) { if (! initializedGCC) { - initializedGCC = TRUE; + initializedGCC = true; mcPretty_print (p, (const char *) "#include \"config.h\"\\n", 21); mcPretty_print (p, (const char *) "#include \"system.h\"\\n", 21); } @@ -837,6 +844,19 @@ static void fixNullPointerConst (mcPretty_pretty p) /* + genBool - +*/ + +static void genBool (mcPretty_pretty p) +{ + if (mcOptions_useBool ()) + { + mcPretty_print (p, (const char *) "#include <stdbool.h>\\n", 22); + } +} + + +/* new - */ @@ -864,7 +884,7 @@ static keyc_scope new_ (decl_node n) to its end. */ -static unsigned int mangle1 (nameKey_Name n, DynamicStrings_String *m, unsigned int scopes) +static bool mangle1 (nameKey_Name n, DynamicStrings_String *m, bool scopes) { (*m) = DynamicStrings_KillString ((*m)); (*m) = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)); @@ -880,7 +900,7 @@ static unsigned int mangle1 (nameKey_Name n, DynamicStrings_String *m, unsigned to, n. */ -static unsigned int mangle2 (nameKey_Name n, DynamicStrings_String *m, unsigned int scopes) +static bool mangle2 (nameKey_Name n, DynamicStrings_String *m, bool scopes) { (*m) = DynamicStrings_KillString ((*m)); (*m) = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)); @@ -896,7 +916,7 @@ static unsigned int mangle2 (nameKey_Name n, DynamicStrings_String *m, unsigned no longer clashes. */ -static unsigned int mangleN (nameKey_Name n, DynamicStrings_String *m, unsigned int scopes) +static bool mangleN (nameKey_Name n, DynamicStrings_String *m, bool scopes) { (*m) = DynamicStrings_KillString ((*m)); (*m) = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)); @@ -905,7 +925,7 @@ static unsigned int mangleN (nameKey_Name n, DynamicStrings_String *m, unsigned (*m) = DynamicStrings_ConCatChar ((*m), '_'); if (! (clash (nameKey_makekey (DynamicStrings_string ((*m))), scopes))) { - return TRUE; + return true; } } ReturnException ("../../gcc-read-write/gcc/m2/mc/keyc.def", 20, 1); @@ -918,11 +938,11 @@ static unsigned int mangleN (nameKey_Name n, DynamicStrings_String *m, unsigned in the current scope or C keywords or C macros. */ -static unsigned int clash (nameKey_Name n, unsigned int scopes) +static bool clash (nameKey_Name n, bool scopes) { if (((symbolKey_getSymKey (macros, n)) != NULL) || ((symbolKey_getSymKey (keywords, n)) != NULL)) { - return TRUE; + return true; } return scopes && ((symbolKey_getSymKey (stack->symbols, n)) != NULL); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1051,42 +1071,42 @@ static void initKeywords (void) static void init (void) { - seenUnistd = FALSE; - seenThrow = FALSE; - seenFree = FALSE; - seenMalloc = FALSE; - seenStorage = FALSE; - seenProc = FALSE; - seenTrue = FALSE; - seenFalse = FALSE; - seenNull = FALSE; - seenMemcpy = FALSE; - seenIntMin = FALSE; - seenUIntMin = FALSE; - seenLongMin = FALSE; - seenULongMin = FALSE; - seenCharMin = FALSE; - seenUCharMin = FALSE; - seenIntMax = FALSE; - seenUIntMax = FALSE; - seenLongMax = FALSE; - seenULongMax = FALSE; - seenCharMax = FALSE; - seenUCharMax = FALSE; - seenLabs = FALSE; - seenAbs = FALSE; - seenFabs = FALSE; - seenFabsl = FALSE; - seenException = FALSE; - seenComplex = FALSE; - seenM2RTS = FALSE; - seenStrlen = FALSE; - seenCtype = FALSE; - seenSize_t = FALSE; - seenSSize_t = FALSE; - seenSysTypes = FALSE; - initializedCP = FALSE; - initializedGCC = FALSE; + seenUnistd = false; + seenThrow = false; + seenFree = false; + seenMalloc = false; + seenStorage = false; + seenProc = false; + seenTrue = false; + seenFalse = false; + seenNull = false; + seenMemcpy = false; + seenIntMin = false; + seenUIntMin = false; + seenLongMin = false; + seenULongMin = false; + seenCharMin = false; + seenUCharMin = false; + seenIntMax = false; + seenUIntMax = false; + seenLongMax = false; + seenULongMax = false; + seenCharMax = false; + seenUCharMax = false; + seenLabs = false; + seenAbs = false; + seenFabs = false; + seenFabsl = false; + seenException = false; + seenComplex = false; + seenM2RTS = false; + seenStrlen = false; + seenCtype = false; + seenSize_t = false; + seenSSize_t = false; + seenSysTypes = false; + initializedCP = false; + initializedGCC = false; stack = NULL; freeList = NULL; initKeywords (); @@ -1100,7 +1120,7 @@ static void init (void) extern "C" void keyc_useUnistd (void) { - seenUnistd = TRUE; + seenUnistd = true; } @@ -1110,7 +1130,7 @@ extern "C" void keyc_useUnistd (void) extern "C" void keyc_useThrow (void) { - seenThrow = TRUE; + seenThrow = true; } @@ -1120,7 +1140,7 @@ extern "C" void keyc_useThrow (void) extern "C" void keyc_useStorage (void) { - seenStorage = TRUE; + seenStorage = true; } @@ -1130,7 +1150,7 @@ extern "C" void keyc_useStorage (void) extern "C" void keyc_useFree (void) { - seenFree = TRUE; + seenFree = true; } @@ -1140,7 +1160,7 @@ extern "C" void keyc_useFree (void) extern "C" void keyc_useMalloc (void) { - seenMalloc = TRUE; + seenMalloc = true; } @@ -1150,7 +1170,7 @@ extern "C" void keyc_useMalloc (void) extern "C" void keyc_useProc (void) { - seenProc = TRUE; + seenProc = true; } @@ -1160,7 +1180,7 @@ extern "C" void keyc_useProc (void) extern "C" void keyc_useTrue (void) { - seenTrue = TRUE; + seenTrue = true; } @@ -1170,7 +1190,7 @@ extern "C" void keyc_useTrue (void) extern "C" void keyc_useFalse (void) { - seenFalse = TRUE; + seenFalse = true; } @@ -1180,7 +1200,7 @@ extern "C" void keyc_useFalse (void) extern "C" void keyc_useNull (void) { - seenNull = TRUE; + seenNull = true; } @@ -1190,7 +1210,7 @@ extern "C" void keyc_useNull (void) extern "C" void keyc_useMemcpy (void) { - seenMemcpy = TRUE; + seenMemcpy = true; } @@ -1200,7 +1220,7 @@ extern "C" void keyc_useMemcpy (void) extern "C" void keyc_useIntMin (void) { - seenIntMin = TRUE; + seenIntMin = true; } @@ -1210,7 +1230,7 @@ extern "C" void keyc_useIntMin (void) extern "C" void keyc_useUIntMin (void) { - seenUIntMin = TRUE; + seenUIntMin = true; } @@ -1220,7 +1240,7 @@ extern "C" void keyc_useUIntMin (void) extern "C" void keyc_useLongMin (void) { - seenLongMin = TRUE; + seenLongMin = true; } @@ -1230,7 +1250,7 @@ extern "C" void keyc_useLongMin (void) extern "C" void keyc_useULongMin (void) { - seenULongMin = TRUE; + seenULongMin = true; } @@ -1240,7 +1260,7 @@ extern "C" void keyc_useULongMin (void) extern "C" void keyc_useCharMin (void) { - seenCharMin = TRUE; + seenCharMin = true; } @@ -1250,7 +1270,7 @@ extern "C" void keyc_useCharMin (void) extern "C" void keyc_useUCharMin (void) { - seenUCharMin = TRUE; + seenUCharMin = true; } @@ -1260,7 +1280,7 @@ extern "C" void keyc_useUCharMin (void) extern "C" void keyc_useIntMax (void) { - seenIntMax = TRUE; + seenIntMax = true; } @@ -1270,7 +1290,7 @@ extern "C" void keyc_useIntMax (void) extern "C" void keyc_useUIntMax (void) { - seenUIntMax = TRUE; + seenUIntMax = true; } @@ -1280,7 +1300,7 @@ extern "C" void keyc_useUIntMax (void) extern "C" void keyc_useLongMax (void) { - seenLongMax = TRUE; + seenLongMax = true; } @@ -1290,7 +1310,7 @@ extern "C" void keyc_useLongMax (void) extern "C" void keyc_useULongMax (void) { - seenULongMax = TRUE; + seenULongMax = true; } @@ -1300,7 +1320,7 @@ extern "C" void keyc_useULongMax (void) extern "C" void keyc_useCharMax (void) { - seenCharMax = TRUE; + seenCharMax = true; } @@ -1310,7 +1330,7 @@ extern "C" void keyc_useCharMax (void) extern "C" void keyc_useUCharMax (void) { - seenUCharMax = TRUE; + seenUCharMax = true; } @@ -1320,7 +1340,7 @@ extern "C" void keyc_useUCharMax (void) extern "C" void keyc_useSize_t (void) { - seenSize_t = TRUE; + seenSize_t = true; } @@ -1330,8 +1350,8 @@ extern "C" void keyc_useSize_t (void) extern "C" void keyc_useSSize_t (void) { - seenSSize_t = TRUE; - seenSysTypes = TRUE; + seenSSize_t = true; + seenSysTypes = true; } @@ -1341,7 +1361,7 @@ extern "C" void keyc_useSSize_t (void) extern "C" void keyc_useLabs (void) { - seenLabs = TRUE; + seenLabs = true; } @@ -1351,7 +1371,7 @@ extern "C" void keyc_useLabs (void) extern "C" void keyc_useAbs (void) { - seenAbs = TRUE; + seenAbs = true; } @@ -1361,7 +1381,7 @@ extern "C" void keyc_useAbs (void) extern "C" void keyc_useFabs (void) { - seenFabs = TRUE; + seenFabs = true; } @@ -1371,7 +1391,7 @@ extern "C" void keyc_useFabs (void) extern "C" void keyc_useFabsl (void) { - seenFabsl = TRUE; + seenFabsl = true; } @@ -1381,7 +1401,7 @@ extern "C" void keyc_useFabsl (void) extern "C" void keyc_useException (void) { - seenException = TRUE; + seenException = true; } @@ -1391,7 +1411,7 @@ extern "C" void keyc_useException (void) extern "C" void keyc_useComplex (void) { - seenComplex = TRUE; + seenComplex = true; } @@ -1401,7 +1421,7 @@ extern "C" void keyc_useComplex (void) extern "C" void keyc_useM2RTS (void) { - seenM2RTS = TRUE; + seenM2RTS = true; } @@ -1411,7 +1431,7 @@ extern "C" void keyc_useM2RTS (void) extern "C" void keyc_useStrlen (void) { - seenStrlen = TRUE; + seenStrlen = true; } @@ -1421,7 +1441,7 @@ extern "C" void keyc_useStrlen (void) extern "C" void keyc_useCtype (void) { - seenCtype = TRUE; + seenCtype = true; } @@ -1432,6 +1452,7 @@ extern "C" void keyc_useCtype (void) extern "C" void keyc_genDefs (mcPretty_pretty p) { + genBool (p); checkFreeMalloc (p); checkProc (p); checkTrue (p); @@ -1513,7 +1534,7 @@ extern "C" void keyc_leaveScope (decl_node n) is ignored). */ -extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes) +extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, bool scopes) { DynamicStrings_String m; @@ -1559,7 +1580,7 @@ extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes is ignored). */ -extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, unsigned int scopes) +extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, bool scopes) { DynamicStrings_String m; @@ -1604,7 +1625,7 @@ extern "C" void keyc_cp (void) { if (! initializedCP) { - initializedCP = TRUE; + initializedCP = true; initCP (); } } diff --git a/gcc/m2/mc-boot/Gkeyc.h b/gcc/m2/mc-boot/Gkeyc.h index ca751f2..b27f091 100644 --- a/gcc/m2/mc-boot/Gkeyc.h +++ b/gcc/m2/mc-boot/Gkeyc.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -281,7 +282,7 @@ EXTERN void keyc_leaveScope (decl_node n); is ignored). */ -EXTERN DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes); +EXTERN DynamicStrings_String keyc_cname (nameKey_Name n, bool scopes); /* cnamen - attempts to declare a symbol with name, n, in the @@ -293,7 +294,7 @@ EXTERN DynamicStrings_String keyc_cname (nameKey_Name n, unsigned int scopes); is ignored). */ -EXTERN nameKey_Name keyc_cnamen (nameKey_Name n, unsigned int scopes); +EXTERN nameKey_Name keyc_cnamen (nameKey_Name n, bool scopes); /* cp - include C++ keywords and standard declarations to avoid. diff --git a/gcc/m2/mc-boot/Gldtoa.h b/gcc/m2/mc-boot/Gldtoa.h index 94f5389..a03fce9 100644 --- a/gcc/m2/mc-boot/Gldtoa.h +++ b/gcc/m2/mc-boot/Gldtoa.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -56,7 +57,7 @@ typedef enum {ldtoa_maxsignificant, ldtoa_decimaldigits} ldtoa_Mode; error to TRUE if the number is too large or badly formed. */ -EXTERN long double ldtoa_strtold (void * s, unsigned int *error); +EXTERN long double ldtoa_strtold (void * s, bool *error); /* ldtoa - converts a LONGREAL, d, into a string. The address of the @@ -67,7 +68,7 @@ EXTERN long double ldtoa_strtold (void * s, unsigned int *error); sign does the string have a sign? */ -EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, unsigned int *sign); +EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, bool *sign); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Glibc.h b/gcc/m2/mc-boot/Glibc.h index 8c6cfd8..24cf2ae 100644 --- a/gcc/m2/mc-boot/Glibc.h +++ b/gcc/m2/mc-boot/Glibc.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Glibm.h b/gcc/m2/mc-boot/Glibm.h index 26bdace..a7262e8 100644 --- a/gcc/m2/mc-boot/Glibm.h +++ b/gcc/m2/mc-boot/Glibm.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Glists.cc b/gcc/m2/mc-boot/Glists.cc index 63bced7..e78e6fc 100644 --- a/gcc/m2/mc-boot/Glists.cc +++ b/gcc/m2/mc-boot/Glists.cc @@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -121,7 +122,7 @@ extern "C" void lists_removeItemFromList (lists_list l, void * c); isItemInList - returns true if a ADDRESS, c, was found in list, l. */ -extern "C" unsigned int lists_isItemInList (lists_list l, void * c); +extern "C" bool lists_isItemInList (lists_list l, void * c); /* foreachItemInListDo - calls procedure, P, foreach item in list, l. @@ -329,11 +330,11 @@ extern "C" void lists_removeItemFromList (lists_list l, void * c) { lists_list p; unsigned int i; - unsigned int found; + bool found; if (l != NULL) { - found = FALSE; + found = false; p = NULL; do { i = 1; @@ -343,7 +344,7 @@ extern "C" void lists_removeItemFromList (lists_list l, void * c) } if ((i <= l->noOfelements) && (l->elements.array[i-1] == c)) { - found = TRUE; + found = true; } else { @@ -363,7 +364,7 @@ extern "C" void lists_removeItemFromList (lists_list l, void * c) isItemInList - returns true if a ADDRESS, c, was found in list, l. */ -extern "C" unsigned int lists_isItemInList (lists_list l, void * c) +extern "C" bool lists_isItemInList (lists_list l, void * c) { unsigned int i; @@ -373,7 +374,7 @@ extern "C" unsigned int lists_isItemInList (lists_list l, void * c) { if (l->elements.array[i-1] == c) { - return TRUE; + return true; } else { @@ -382,7 +383,7 @@ extern "C" unsigned int lists_isItemInList (lists_list l, void * c) } l = l->next; } while (! (l == NULL)); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/Glists.h b/gcc/m2/mc-boot/Glists.h index a1c0849..f98fd37 100644 --- a/gcc/m2/mc-boot/Glists.h +++ b/gcc/m2/mc-boot/Glists.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -106,7 +107,7 @@ EXTERN void lists_removeItemFromList (lists_list l, void * c); isItemInList - returns true if a ADDRESS, c, was found in list, l. */ -EXTERN unsigned int lists_isItemInList (lists_list l, void * c); +EXTERN bool lists_isItemInList (lists_list l, void * c); /* foreachItemInListDo - calls procedure, P, foreach item in list, l. diff --git a/gcc/m2/mc-boot/GmcComment.cc b/gcc/m2/mc-boot/GmcComment.cc index 2e60c7a..472944a 100644 --- a/gcc/m2/mc-boot/GmcComment.cc +++ b/gcc/m2/mc-boot/GmcComment.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -62,7 +63,7 @@ struct mcComment__T1_r { mcComment_commentType type; DynamicStrings_String content; nameKey_Name procName; - unsigned int used; + bool used; }; @@ -73,7 +74,7 @@ struct mcComment__T1_r { spaces on this line. */ -extern "C" mcComment_commentDesc mcComment_initComment (unsigned int onlySpaces); +extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces); /* addText - cs is a C string (null terminated) which contains comment text. @@ -124,19 +125,19 @@ extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_ isProcedureComment - returns TRUE if, cd, is a procedure comment. */ -extern "C" unsigned int mcComment_isProcedureComment (mcComment_commentDesc cd); +extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd); /* isBodyComment - returns TRUE if, cd, is a body comment. */ -extern "C" unsigned int mcComment_isBodyComment (mcComment_commentDesc cd); +extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd); /* isAfterComment - returns TRUE if, cd, is an after comment. */ -extern "C" unsigned int mcComment_isAfterComment (mcComment_commentDesc cd); +extern "C" bool mcComment_isAfterComment (mcComment_commentDesc cd); /* Min - returns the lower of, a, and, b. @@ -155,7 +156,7 @@ static DynamicStrings_String RemoveNewlines (DynamicStrings_String s); in the comment. */ -static unsigned int seenProcedure (mcComment_commentDesc cd, nameKey_Name procName); +static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName); /* dumpComment - @@ -211,13 +212,13 @@ static DynamicStrings_String RemoveNewlines (DynamicStrings_String s) in the comment. */ -static unsigned int seenProcedure (mcComment_commentDesc cd, nameKey_Name procName) +static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName) { DynamicStrings_String s; void * a; unsigned int i; unsigned int h; - unsigned int res; + bool res; a = nameKey_keyToCharStar (procName); s = RemoveNewlines (cd->content); @@ -279,7 +280,7 @@ static void dumpComment (mcComment_commentDesc cd) spaces on this line. */ -extern "C" mcComment_commentDesc mcComment_initComment (unsigned int onlySpaces) +extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces) { mcComment_commentDesc cd; @@ -295,7 +296,7 @@ extern "C" mcComment_commentDesc mcComment_initComment (unsigned int onlySpaces) } cd->content = DynamicStrings_InitString ((const char *) "", 0); cd->procName = nameKey_NulName; - cd->used = FALSE; + cd->used = false; return cd; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -381,7 +382,7 @@ extern "C" DynamicStrings_String mcComment_getProcedureComment (mcComment_commen { if ((cd->type == mcComment_procedureHeading) && ! cd->used) { - cd->used = TRUE; + cd->used = true; return cd->content; } return static_cast<DynamicStrings_String> (NULL); @@ -398,7 +399,7 @@ extern "C" DynamicStrings_String mcComment_getAfterStatementComment (mcComment_c { if ((cd->type == mcComment_afterStatement) && ! cd->used) { - cd->used = TRUE; + cd->used = true; return cd->content; } return static_cast<DynamicStrings_String> (NULL); @@ -415,7 +416,7 @@ extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_ { if ((cd->type == mcComment_inBody) && ! cd->used) { - cd->used = TRUE; + cd->used = true; return cd->content; } return static_cast<DynamicStrings_String> (NULL); @@ -428,7 +429,7 @@ extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_ isProcedureComment - returns TRUE if, cd, is a procedure comment. */ -extern "C" unsigned int mcComment_isProcedureComment (mcComment_commentDesc cd) +extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd) { return (cd != NULL) && (cd->type == mcComment_procedureHeading); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -440,7 +441,7 @@ extern "C" unsigned int mcComment_isProcedureComment (mcComment_commentDesc cd) isBodyComment - returns TRUE if, cd, is a body comment. */ -extern "C" unsigned int mcComment_isBodyComment (mcComment_commentDesc cd) +extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd) { return (cd != NULL) && (cd->type == mcComment_inBody); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -452,7 +453,7 @@ extern "C" unsigned int mcComment_isBodyComment (mcComment_commentDesc cd) isAfterComment - returns TRUE if, cd, is an after comment. */ -extern "C" unsigned int mcComment_isAfterComment (mcComment_commentDesc cd) +extern "C" bool mcComment_isAfterComment (mcComment_commentDesc cd) { return (cd != NULL) && (cd->type == mcComment_afterStatement); /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/GmcComment.h b/gcc/m2/mc-boot/GmcComment.h index 53018ab..5dbf2d8 100644 --- a/gcc/m2/mc-boot/GmcComment.h +++ b/gcc/m2/mc-boot/GmcComment.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -60,7 +61,7 @@ extern "C" { If onlySpaces is FALSE then an after statement comment is created. */ -EXTERN mcComment_commentDesc mcComment_initComment (unsigned int onlySpaces); +EXTERN mcComment_commentDesc mcComment_initComment (bool onlySpaces); /* addText - cs is a C string (null terminated) which contains comment text. @@ -110,19 +111,19 @@ EXTERN DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_comm isProcedureComment - returns TRUE if, cd, is a procedure comment. */ -EXTERN unsigned int mcComment_isProcedureComment (mcComment_commentDesc cd); +EXTERN bool mcComment_isProcedureComment (mcComment_commentDesc cd); /* isBodyComment - returns TRUE if, cd, is a body comment. */ -EXTERN unsigned int mcComment_isBodyComment (mcComment_commentDesc cd); +EXTERN bool mcComment_isBodyComment (mcComment_commentDesc cd); /* isAfterComment - returns TRUE if, cd, is an after comment. */ -EXTERN unsigned int mcComment_isAfterComment (mcComment_commentDesc cd); +EXTERN bool mcComment_isAfterComment (mcComment_commentDesc cd); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GmcComp.cc b/gcc/m2/mc-boot/GmcComp.cc index 8a79413..ae0bf9f 100644 --- a/gcc/m2/mc-boot/GmcComp.cc +++ b/gcc/m2/mc-boot/GmcComp.cc @@ -18,6 +18,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -65,15 +66,15 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ # include "GDynamicStrings.h" # include "GmcOptions.h" -# define Debugging FALSE +# define Debugging false typedef struct mcComp_parserFunction_p mcComp_parserFunction; typedef struct mcComp_openFunction_p mcComp_openFunction; -typedef unsigned int (*mcComp_parserFunction_t) (void); +typedef bool (*mcComp_parserFunction_t) (void); struct mcComp_parserFunction_p { mcComp_parserFunction_t proc; }; -typedef unsigned int (*mcComp_openFunction_t) (decl_node, unsigned int); +typedef bool (*mcComp_openFunction_t) (decl_node, bool); struct mcComp_openFunction_p { mcComp_openFunction_t proc; }; static unsigned int currentPass; @@ -149,7 +150,7 @@ static void p5 (decl_node n); doOpen - */ -static unsigned int doOpen (decl_node n, DynamicStrings_String symName, DynamicStrings_String fileName, unsigned int exitOnFailure); +static bool doOpen (decl_node n, DynamicStrings_String symName, DynamicStrings_String fileName, bool exitOnFailure); /* openDef - try and open the definition module source file. @@ -157,7 +158,7 @@ static unsigned int doOpen (decl_node n, DynamicStrings_String symName, DynamicS exitOnFailure. */ -static unsigned int openDef (decl_node n, unsigned int exitOnFailure); +static bool openDef (decl_node n, bool exitOnFailure); /* openMod - try and open the implementation/program module source file. @@ -165,7 +166,7 @@ static unsigned int openDef (decl_node n, unsigned int exitOnFailure); exitOnFailure. */ -static unsigned int openMod (decl_node n, unsigned int exitOnFailure); +static bool openMod (decl_node n, bool exitOnFailure); /* pass - @@ -177,7 +178,7 @@ static void pass (unsigned int no, decl_node n, mcComp_parserFunction f, decl_is doPass - */ -static void doPass (unsigned int parseDefs, unsigned int parseMain, unsigned int no, symbolKey_performOperation p, const char *desc_, unsigned int _desc_high); +static void doPass (bool parseDefs, bool parseMain, unsigned int no, symbolKey_performOperation p, const char *desc_, unsigned int _desc_high); /* setToPassNo - @@ -201,22 +202,22 @@ static void doCompile (DynamicStrings_String s) decl_node n; n = initParser (s); - doPass (TRUE, TRUE, 1, (symbolKey_performOperation) {(symbolKey_performOperation_t) p1}, (const char *) "lexical analysis, modules, root decls and C preprocessor", 56); - doPass (TRUE, TRUE, 2, (symbolKey_performOperation) {(symbolKey_performOperation_t) p2}, (const char *) "[all modules] type equivalence and enumeration types", 52); - doPass (TRUE, TRUE, 3, (symbolKey_performOperation) {(symbolKey_performOperation_t) p3}, (const char *) "[all modules] import lists, types, variables and procedure declarations", 71); - doPass (TRUE, TRUE, 4, (symbolKey_performOperation) {(symbolKey_performOperation_t) p4}, (const char *) "[all modules] constant expressions", 34); + doPass (true, true, 1, (symbolKey_performOperation) {(symbolKey_performOperation_t) p1}, (const char *) "lexical analysis, modules, root decls and C preprocessor", 56); + doPass (true, true, 2, (symbolKey_performOperation) {(symbolKey_performOperation_t) p2}, (const char *) "[all modules] type equivalence and enumeration types", 52); + doPass (true, true, 3, (symbolKey_performOperation) {(symbolKey_performOperation_t) p3}, (const char *) "[all modules] import lists, types, variables and procedure declarations", 71); + doPass (true, true, 4, (symbolKey_performOperation) {(symbolKey_performOperation_t) p4}, (const char *) "[all modules] constant expressions", 34); if (! (decl_isDef (n))) { /* avoid gcc warning by using compound statement even if not strictly necessary. */ if (decl_isImp (n)) { mcQuiet_qprintf0 ((const char *) "Parse implementation module\\n", 29); - doPass (FALSE, TRUE, 5, (symbolKey_performOperation) {(symbolKey_performOperation_t) p5}, (const char *) "[implementation module] build code tree for all procedures and module initializations", 85); + doPass (false, true, 5, (symbolKey_performOperation) {(symbolKey_performOperation_t) p5}, (const char *) "[implementation module] build code tree for all procedures and module initializations", 85); } else { mcQuiet_qprintf0 ((const char *) "Parse program module\\n", 22); - doPass (FALSE, TRUE, 5, (symbolKey_performOperation) {(symbolKey_performOperation_t) p5}, (const char *) "[program module] build code tree for all procedures and module initializations", 78); + doPass (false, true, 5, (symbolKey_performOperation) {(symbolKey_performOperation_t) p5}, (const char *) "[program module] build code tree for all procedures and module initializations", 78); } } mcQuiet_qprintf0 ((const char *) "walk tree converting it to C/C++\\n", 34); @@ -444,7 +445,7 @@ static void p5 (decl_node n) doOpen - */ -static unsigned int doOpen (decl_node n, DynamicStrings_String symName, DynamicStrings_String fileName, unsigned int exitOnFailure) +static bool doOpen (decl_node n, DynamicStrings_String symName, DynamicStrings_String fileName, bool exitOnFailure) { DynamicStrings_String postProcessed; @@ -454,14 +455,14 @@ static unsigned int doOpen (decl_node n, DynamicStrings_String symName, DynamicS decl_setCurrentModule (n); if (mcLexBuf_openSource (postProcessed)) { - return TRUE; + return true; } mcPrintf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &fileName, (sizeof (fileName)-1)); if (exitOnFailure) { libc_exit (1); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -473,7 +474,7 @@ static unsigned int doOpen (decl_node n, DynamicStrings_String symName, DynamicS exitOnFailure. */ -static unsigned int openDef (decl_node n, unsigned int exitOnFailure) +static bool openDef (decl_node n, bool exitOnFailure) { nameKey_Name sourceName; DynamicStrings_String symName; @@ -509,7 +510,7 @@ static unsigned int openDef (decl_node n, unsigned int exitOnFailure) exitOnFailure. */ -static unsigned int openMod (decl_node n, unsigned int exitOnFailure) +static bool openMod (decl_node n, bool exitOnFailure) { nameKey_Name sourceName; DynamicStrings_String symName; @@ -555,7 +556,7 @@ static void pass (unsigned int no, decl_node n, mcComp_parserFunction f, decl_is if (((*isnode.proc) (n)) && (! (decl_isVisited (n)))) { decl_setVisited (n); - if ((*open.proc) (n, TRUE)) + if ((*open.proc) (n, true)) { if (! ((*f.proc) ())) { @@ -573,7 +574,7 @@ static void pass (unsigned int no, decl_node n, mcComp_parserFunction f, decl_is doPass - */ -static void doPass (unsigned int parseDefs, unsigned int parseMain, unsigned int no, symbolKey_performOperation p, const char *desc_, unsigned int _desc_high) +static void doPass (bool parseDefs, bool parseMain, unsigned int no, symbolKey_performOperation p, const char *desc_, unsigned int _desc_high) { DynamicStrings_String descs; char desc[_desc_high+1]; diff --git a/gcc/m2/mc-boot/GmcComp.h b/gcc/m2/mc-boot/GmcComp.h index c658280..6c78616 100644 --- a/gcc/m2/mc-boot/GmcComp.h +++ b/gcc/m2/mc-boot/GmcComp.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcDebug.cc b/gcc/m2/mc-boot/GmcDebug.cc index db45ae8..0d134b6 100644 --- a/gcc/m2/mc-boot/GmcDebug.cc +++ b/gcc/m2/mc-boot/GmcDebug.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -36,7 +37,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ and the execution is terminated. */ -extern "C" void mcDebug_assert (unsigned int q); +extern "C" void mcDebug_assert (bool q); /* writeDebug - only writes a string if internal debugging is on. @@ -50,7 +51,7 @@ extern "C" void mcDebug_writeDebug (const char *a_, unsigned int _a_high); and the execution is terminated. */ -extern "C" void mcDebug_assert (unsigned int q) +extern "C" void mcDebug_assert (bool q) { if (! q) { diff --git a/gcc/m2/mc-boot/GmcDebug.h b/gcc/m2/mc-boot/GmcDebug.h index dd30d65..0a488f5 100644 --- a/gcc/m2/mc-boot/GmcDebug.h +++ b/gcc/m2/mc-boot/GmcDebug.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -48,7 +49,7 @@ extern "C" { and the execution is terminated. */ -EXTERN void mcDebug_assert (unsigned int q); +EXTERN void mcDebug_assert (bool q); /* writeDebug - only writes a string if the debugging mode is on. diff --git a/gcc/m2/mc-boot/GmcError.cc b/gcc/m2/mc-boot/GmcError.cc index cf96ceb..e86d18b 100644 --- a/gcc/m2/mc-boot/GmcError.cc +++ b/gcc/m2/mc-boot/GmcError.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -57,9 +58,9 @@ along with GNU Modula-2; see the file COPYING3. If not see # include "GmcLexBuf.h" # include "GmcPrintf.h" -# define Debugging TRUE -# define DebugTrace FALSE -# define Xcode TRUE +# define Debugging true +# define DebugTrace false +# define Xcode true typedef struct mcError__T2_r mcError__T2; typedef mcError__T2 *mcError_error; @@ -68,13 +69,13 @@ struct mcError__T2_r { mcError_error parent; mcError_error child; mcError_error next; - unsigned int fatal; + bool fatal; DynamicStrings_String s; unsigned int token; }; static mcError_error head; -static unsigned int inInternal; +static bool inInternal; /* internalError - displays an internal error message together with the compiler source @@ -228,7 +229,7 @@ extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high); */ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b_, unsigned int _b_high); -static unsigned int translateNameToCharStar (char *a, unsigned int _a_high, unsigned int n); +static bool translateNameToCharStar (char *a, unsigned int _a_high, unsigned int n); /* outString - writes the contents of String to stdout. @@ -281,7 +282,7 @@ static void checkIncludes (unsigned int token, unsigned int depth); flushAll - flushes all errors in list, e. */ -static unsigned int flushAll (mcError_error e, unsigned int FatalStatus); +static bool flushAll (mcError_error e, bool FatalStatus); /* @@ -305,7 +306,7 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b } } -static unsigned int translateNameToCharStar (char *a, unsigned int _a_high, unsigned int n) +static bool translateNameToCharStar (char *a, unsigned int _a_high, unsigned int n) { unsigned int argno; unsigned int i; @@ -326,18 +327,18 @@ static unsigned int translateNameToCharStar (char *a, unsigned int _a_high, unsi if ((a[i+1] == 'a') && (argno == n)) { a[i+1] = 's'; - return TRUE; + return true; } argno += 1; if (argno > n) { /* all done */ - return FALSE; + return false; } } i += 1; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -355,8 +356,8 @@ static void outString (DynamicStrings_String file, unsigned int line, unsigned i DynamicStrings_String leader; outString__T1 p; outString__T1 q; - unsigned int space; - unsigned int newline; + bool space; + bool newline; col += 1; if (Xcode) @@ -368,8 +369,8 @@ static void outString (DynamicStrings_String file, unsigned int line, unsigned i leader = FormatStrings_Sprintf3 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%s:%d:%d:", 9)), (const unsigned char *) &file, (sizeof (file)-1), (const unsigned char *) &line, (sizeof (line)-1), (const unsigned char *) &col, (sizeof (col)-1)); } p = static_cast<outString__T1> (DynamicStrings_string (s)); - newline = TRUE; - space = FALSE; + newline = true; + space = false; while ((p != NULL) && ((*p) != ASCII_nul)) { if (newline) @@ -600,7 +601,7 @@ static DynamicStrings_String doFormat3 (const char *a_, unsigned int _a_high, co static void init (void) { head = NULL; - inInternal = FALSE; + inInternal = false; } @@ -655,12 +656,12 @@ static void checkIncludes (unsigned int token, unsigned int depth) flushAll - flushes all errors in list, e. */ -static unsigned int flushAll (mcError_error e, unsigned int FatalStatus) +static bool flushAll (mcError_error e, bool FatalStatus) { mcError_error f; - unsigned int written; + bool written; - written = FALSE; + written = false; if (e != NULL) { do { @@ -679,7 +680,7 @@ static unsigned int flushAll (mcError_error e, unsigned int FatalStatus) if ((e->child != NULL) && (flushAll (e->child, FatalStatus))) {} /* empty. */ e->s = static_cast<DynamicStrings_String> (NULL); - written = TRUE; + written = true; } f = e; e = e->next; @@ -715,7 +716,7 @@ extern "C" void mcError_internalError (const char *a_, unsigned int _a_high, con M2RTS_ExitOnHalt (1); if (! inInternal) { - inInternal = TRUE; + inInternal = true; mcError_flushErrors (); outString (mcLexBuf_findFileNameFromToken (mcLexBuf_getTokenNo (), 0), mcLexBuf_tokenToLineNo (mcLexBuf_getTokenNo (), 0), mcLexBuf_tokenToColumnNo (mcLexBuf_getTokenNo (), 0), DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "*** fatal error ***", 19))); } @@ -828,7 +829,7 @@ extern "C" mcError_error mcError_newError (unsigned int atTokenNo) e->next = NULL; e->parent = NULL; e->child = NULL; - e->fatal = TRUE; + e->fatal = true; if ((head == NULL) || (head->token > atTokenNo)) { e->next = head; @@ -860,7 +861,7 @@ extern "C" mcError_error mcError_newWarning (unsigned int atTokenNo) mcError_error e; e = mcError_newError (atTokenNo); - e->fatal = FALSE; + e->fatal = false; return e; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -1136,7 +1137,7 @@ extern "C" void mcError_flushErrors (void) mcPrintf_printf0 ((const char *) "\\nFlushing all errors\\n", 23); mcPrintf_printf0 ((const char *) "===================\\n", 21); } - if (flushAll (head, TRUE)) + if (flushAll (head, true)) { M2RTS_ExitOnHalt (1); M2RTS_HALT (-1); @@ -1155,7 +1156,7 @@ extern "C" void mcError_flushErrors (void) extern "C" void mcError_flushWarnings (void) { - if (flushAll (head, FALSE)) + if (flushAll (head, false)) {} /* empty. */ } @@ -1176,10 +1177,10 @@ extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high) { mcError_writeFormat0 ((const char *) a, _a_high); } - if (! (flushAll (head, TRUE))) + if (! (flushAll (head, true))) { mcError_writeFormat0 ((const char *) "unidentified error", 18); - if (flushAll (head, TRUE)) + if (flushAll (head, true)) {} /* empty. */ } M2RTS_ExitOnHalt (1); diff --git a/gcc/m2/mc-boot/GmcError.h b/gcc/m2/mc-boot/GmcError.h index 2afe6fd..d4e6d7f9 100644 --- a/gcc/m2/mc-boot/GmcError.h +++ b/gcc/m2/mc-boot/GmcError.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcFileName.cc b/gcc/m2/mc-boot/GmcFileName.cc index 3413d89..c2c2394 100644 --- a/gcc/m2/mc-boot/GmcFileName.cc +++ b/gcc/m2/mc-boot/GmcFileName.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcFileName.h b/gcc/m2/mc-boot/GmcFileName.h index a1a8cbb..c3c9526 100644 --- a/gcc/m2/mc-boot/GmcFileName.h +++ b/gcc/m2/mc-boot/GmcFileName.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcLexBuf.cc b/gcc/m2/mc-boot/GmcLexBuf.cc index d310e87..263bf75 100644 --- a/gcc/m2/mc-boot/GmcLexBuf.cc +++ b/gcc/m2/mc-boot/GmcLexBuf.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -64,7 +65,7 @@ unsigned int mcLexBuf_currentcolumn; void * mcLexBuf_currentstring; mcReserved_toktype mcLexBuf_currenttoken; # define MaxBucketSize 100 -# define Debugging FALSE +# define Debugging false typedef struct mcLexBuf_tokenDesc_r mcLexBuf_tokenDesc; typedef struct mcLexBuf_listDesc_r mcLexBuf_listDesc; @@ -114,8 +115,8 @@ static mcComment_commentDesc procedureComment; static mcComment_commentDesc bodyComment; static mcComment_commentDesc afterComment; static mcLexBuf_sourceList currentSource; -static unsigned int useBufferedTokens; -static unsigned int currentUsed; +static bool useBufferedTokens; +static bool currentUsed; static mcLexBuf_listDesc listOfTokens; static unsigned int nextTokNo; @@ -147,7 +148,7 @@ extern "C" mcComment_commentDesc mcLexBuf_getAfterComment (void); The success of the operation is returned. */ -extern "C" unsigned int mcLexBuf_openSource (DynamicStrings_String s); +extern "C" bool mcLexBuf_openSource (DynamicStrings_String s); /* closeSource - closes the current open file. @@ -411,7 +412,7 @@ static void addTokToList (mcReserved_toktype t, nameKey_Name n, int i, mcComment isLastTokenEof - returns TRUE if the last token was an eoftok */ -static unsigned int isLastTokenEof (void); +static bool isLastTokenEof (void); /* @@ -556,20 +557,20 @@ static void peepAfterComment (void) unsigned int nextline; unsigned int curline; mcLexBuf_tokenBucket b; - unsigned int finished; + bool finished; oldTokNo = nextTokNo; cno = mcLexBuf_getTokenNo (); curline = mcLexBuf_tokenToLineNo (cno, 0); nextline = curline; peep = 0; - finished = FALSE; + finished = false; do { t = cno+peep; b = peeptokenBucket (&t); if ((b == NULL) || (mcLexBuf_currenttoken == mcReserved_eoftok)) { - finished = TRUE; + finished = true; } else { @@ -580,7 +581,7 @@ static void peepAfterComment (void) { case mcReserved_eoftok: case mcReserved_endtok: - finished = TRUE; + finished = true; break; case mcReserved_commenttok: @@ -597,7 +598,7 @@ static void peepAfterComment (void) } else { - finished = TRUE; + finished = true; } } peep += 1; @@ -617,7 +618,7 @@ static void init (void) currentSource = NULL; listOfTokens.head = NULL; listOfTokens.tail = NULL; - useBufferedTokens = FALSE; + useBufferedTokens = false; procedureComment = static_cast<mcComment_commentDesc> (NULL); bodyComment = static_cast<mcComment_commentDesc> (NULL); afterComment = static_cast<mcComment_commentDesc> (NULL); @@ -1272,7 +1273,7 @@ static void addTokToList (mcReserved_toktype t, nameKey_Name n, int i, mcComment isLastTokenEof - returns TRUE if the last token was an eoftok */ -static unsigned int isLastTokenEof (void) +static bool isLastTokenEof (void) { unsigned int t; mcLexBuf_tokenBucket b; @@ -1284,7 +1285,7 @@ static unsigned int isLastTokenEof (void) b = listOfTokens.head; if (b == listOfTokens.tail) { - return FALSE; + return false; } while (b->next != listOfTokens.tail) { @@ -1298,7 +1299,7 @@ static unsigned int isLastTokenEof (void) mcDebug_assert (b->len > 0); /* len should always be >0 */ return b->buf.array[b->len-1].token == mcReserved_eoftok; /* len should always be >0 */ } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -1359,12 +1360,12 @@ extern "C" mcComment_commentDesc mcLexBuf_getAfterComment (void) The success of the operation is returned. */ -extern "C" unsigned int mcLexBuf_openSource (DynamicStrings_String s) +extern "C" bool mcLexBuf_openSource (DynamicStrings_String s) { if (useBufferedTokens) { mcLexBuf_getToken (); - return TRUE; + return true; } else { @@ -1373,11 +1374,11 @@ extern "C" unsigned int mcLexBuf_openSource (DynamicStrings_String s) mcLexBuf_setFile (DynamicStrings_string (s)); syncOpenWithBuffer (); mcLexBuf_getToken (); - return TRUE; + return true; } else { - return FALSE; + return false; } } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1419,7 +1420,7 @@ extern "C" void mcLexBuf_reInitialize (void) t = t->next; Storage_DEALLOCATE ((void **) &s, sizeof (mcLexBuf__T2)); } while (! (t == NULL)); - currentUsed = FALSE; + currentUsed = false; killList (); } init (); @@ -1434,7 +1435,7 @@ extern "C" void mcLexBuf_reInitialize (void) extern "C" void mcLexBuf_resetForNewPass (void) { nextTokNo = 0; - useBufferedTokens = TRUE; + useBufferedTokens = true; } @@ -1728,7 +1729,7 @@ extern "C" void mcLexBuf_addTok (mcReserved_toktype t) if (! ((t == mcReserved_eoftok) && (isLastTokenEof ()))) { addTokToList (t, nameKey_NulName, 0, static_cast<mcComment_commentDesc> (NULL), mcflex_getLineNo (), mcflex_getColumnNo (), currentSource); - currentUsed = TRUE; + currentUsed = true; } } @@ -1745,7 +1746,7 @@ extern "C" void mcLexBuf_addTokCharStar (mcReserved_toktype t, void * s) stop (); } addTokToList (t, nameKey_makekey (s), 0, static_cast<mcComment_commentDesc> (NULL), mcflex_getLineNo (), mcflex_getColumnNo (), currentSource); - currentUsed = TRUE; + currentUsed = true; } @@ -1764,7 +1765,7 @@ extern "C" void mcLexBuf_addTokInteger (mcReserved_toktype t, int i) s = FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%d", 2)), (const unsigned char *) &i, (sizeof (i)-1)); addTokToList (t, nameKey_makekey (DynamicStrings_string (s)), i, static_cast<mcComment_commentDesc> (NULL), l, c, currentSource); s = DynamicStrings_KillString (s); - currentUsed = TRUE; + currentUsed = true; } @@ -1775,7 +1776,7 @@ extern "C" void mcLexBuf_addTokInteger (mcReserved_toktype t, int i) extern "C" void mcLexBuf_addTokComment (mcReserved_toktype t, mcComment_commentDesc com) { addTokToList (t, nameKey_NulName, 0, com, mcflex_getLineNo (), mcflex_getColumnNo (), currentSource); - currentUsed = TRUE; + currentUsed = true; } @@ -1786,7 +1787,7 @@ extern "C" void mcLexBuf_addTokComment (mcReserved_toktype t, mcComment_commentD extern "C" void mcLexBuf_setFile (void * filename) { killList (); - currentUsed = FALSE; + currentUsed = false; currentSource = newList (); addTo (newElement (filename)); } diff --git a/gcc/m2/mc-boot/GmcLexBuf.h b/gcc/m2/mc-boot/GmcLexBuf.h index 1d611e3..49cc21d 100644 --- a/gcc/m2/mc-boot/GmcLexBuf.h +++ b/gcc/m2/mc-boot/GmcLexBuf.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -79,7 +80,7 @@ EXTERN mcComment_commentDesc mcLexBuf_getAfterComment (void); The success of the operation is returned. */ -EXTERN unsigned int mcLexBuf_openSource (DynamicStrings_String s); +EXTERN bool mcLexBuf_openSource (DynamicStrings_String s); /* closeSource - closes the current open file. diff --git a/gcc/m2/mc-boot/GmcMetaError.cc b/gcc/m2/mc-boot/GmcMetaError.cc index 4d40685..32f6efa 100644 --- a/gcc/m2/mc-boot/GmcMetaError.cc +++ b/gcc/m2/mc-boot/GmcMetaError.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -212,25 +213,25 @@ static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b isWhite - returns TRUE if, ch, is a space. */ -static unsigned int isWhite (char ch); +static bool isWhite (char ch); /* then := [ ':' ebnf ] =: */ -static void then (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, DynamicStrings_String o, unsigned int positive); +static void then (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, DynamicStrings_String o, bool positive); /* doNumber - */ -static DynamicStrings_String doNumber (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes); +static DynamicStrings_String doNumber (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes); /* doCount - */ -static DynamicStrings_String doCount (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes); +static DynamicStrings_String doCount (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes); /* doCount - @@ -242,7 +243,7 @@ static DynamicStrings_String doAscii (unsigned int bol, varargs_vararg sym, Dyna doCount - */ -static DynamicStrings_String doName (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes); +static DynamicStrings_String doName (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes); /* doCount - @@ -312,19 +313,19 @@ static DynamicStrings_String symDesc (decl_node n, DynamicStrings_String o); doDesc - */ -static DynamicStrings_String doDesc (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes); +static DynamicStrings_String doDesc (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes); /* addQuoted - if, o, is not empty then add it to, r. */ -static DynamicStrings_String addQuoted (DynamicStrings_String r, DynamicStrings_String o, unsigned int quotes); +static DynamicStrings_String addQuoted (DynamicStrings_String r, DynamicStrings_String o, bool quotes); /* op := {'a'|'q'|'t'|'d'|'k'|'n'|'s'|'D'|'I'|'U'|'E'|'W'} then =: */ -static void op (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, unsigned int bol, unsigned int positive); +static void op (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, unsigned int bol, bool positive); /* percenttoken := '%' ( @@ -340,7 +341,7 @@ static void op (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_Strin } =: */ -static void percenttoken (mcError_error *e, mcMetaError_errorType t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, unsigned int positive); +static void percenttoken (mcError_error *e, mcMetaError_errorType t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, bool positive); /* percent := '%' anych % copy anych % @@ -432,7 +433,7 @@ static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b isWhite - returns TRUE if, ch, is a space. */ -static unsigned int isWhite (char ch) +static bool isWhite (char ch) { return ch == ' '; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -444,7 +445,7 @@ static unsigned int isWhite (char ch) then := [ ':' ebnf ] =: */ -static void then (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, DynamicStrings_String o, unsigned int positive) +static void then (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, DynamicStrings_String o, bool positive) { if ((DynamicStrings_char (s, (*i))) == ':') { @@ -462,7 +463,7 @@ static void then (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_Str doNumber - */ -static DynamicStrings_String doNumber (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes) +static DynamicStrings_String doNumber (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes) { unsigned int c; @@ -472,7 +473,7 @@ static DynamicStrings_String doNumber (unsigned int bol, varargs_vararg sym, Dyn } else { - (*quotes) = FALSE; + (*quotes) = false; varargs_next (sym, bol); varargs_arg (sym, (unsigned char *) &c, (sizeof (c)-1)); return DynamicStrings_ConCat (o, StringConvert_ctos (c, 0, ' ')); @@ -486,7 +487,7 @@ static DynamicStrings_String doNumber (unsigned int bol, varargs_vararg sym, Dyn doCount - */ -static DynamicStrings_String doCount (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes) +static DynamicStrings_String doCount (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes) { unsigned int c; @@ -496,7 +497,7 @@ static DynamicStrings_String doCount (unsigned int bol, varargs_vararg sym, Dyna } else { - (*quotes) = FALSE; + (*quotes) = false; varargs_next (sym, bol); varargs_arg (sym, (unsigned char *) &c, (sizeof (c)-1)); o = DynamicStrings_ConCat (o, StringConvert_ctos (c, 0, ' ')); @@ -560,7 +561,7 @@ static DynamicStrings_String doAscii (unsigned int bol, varargs_vararg sym, Dyna doCount - */ -static DynamicStrings_String doName (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes) +static DynamicStrings_String doName (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes) { decl_node n; @@ -574,13 +575,13 @@ static DynamicStrings_String doName (unsigned int bol, varargs_vararg sym, Dynam { if (decl_isZtype (n)) { - (*quotes) = FALSE; + (*quotes) = false; return DynamicStrings_ConCat (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "the ZType", 9))); } else if (decl_isRtype (n)) { /* avoid dangling else. */ - (*quotes) = FALSE; + (*quotes) = false; return DynamicStrings_ConCat (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "the RType", 9))); } else if ((decl_getSymName (n)) != nameKey_NulName) @@ -988,7 +989,7 @@ static DynamicStrings_String symDesc (decl_node n, DynamicStrings_String o) doDesc - */ -static DynamicStrings_String doDesc (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, unsigned int *quotes) +static DynamicStrings_String doDesc (unsigned int bol, varargs_vararg sym, DynamicStrings_String o, bool *quotes) { decl_node n; @@ -999,7 +1000,7 @@ static DynamicStrings_String doDesc (unsigned int bol, varargs_vararg sym, Dynam o = symDesc (n, o); if ((DynamicStrings_Length (o)) > 0) { - (*quotes) = FALSE; + (*quotes) = false; } } return o; @@ -1012,7 +1013,7 @@ static DynamicStrings_String doDesc (unsigned int bol, varargs_vararg sym, Dynam addQuoted - if, o, is not empty then add it to, r. */ -static DynamicStrings_String addQuoted (DynamicStrings_String r, DynamicStrings_String o, unsigned int quotes) +static DynamicStrings_String addQuoted (DynamicStrings_String r, DynamicStrings_String o, bool quotes) { if ((DynamicStrings_Length (o)) > 0) { @@ -1040,15 +1041,15 @@ static DynamicStrings_String addQuoted (DynamicStrings_String r, DynamicStrings_ op := {'a'|'q'|'t'|'d'|'k'|'n'|'s'|'D'|'I'|'U'|'E'|'W'} then =: */ -static void op (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, unsigned int bol, unsigned int positive) +static void op (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, unsigned int bol, bool positive) { DynamicStrings_String o; varargs_vararg c; - unsigned int quotes; + bool quotes; c = varargs_copy (sym); o = DynamicStrings_InitString ((const char *) "", 0); - quotes = TRUE; + quotes = true; while (((*i) < l) && ((DynamicStrings_char (s, (*i))) != '}')) { switch (DynamicStrings_char (s, (*i))) @@ -1144,7 +1145,7 @@ static void op (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_Strin } =: */ -static void percenttoken (mcError_error *e, mcMetaError_errorType t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, unsigned int positive) +static void percenttoken (mcError_error *e, mcMetaError_errorType t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l, bool positive) { if ((DynamicStrings_char (s, (*i))) == '%') { @@ -1209,15 +1210,15 @@ static void percent (DynamicStrings_String *r, DynamicStrings_String s, varargs_ static void lbra (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_String *r, DynamicStrings_String s, varargs_vararg sym, int *i, int l) { - unsigned int positive; + bool positive; if ((DynamicStrings_char (s, (*i))) == '{') { - positive = TRUE; + positive = true; (*i) += 1; if ((DynamicStrings_char (s, (*i))) == '!') { - positive = FALSE; + positive = false; (*i) += 1; } if ((DynamicStrings_char (s, (*i))) != '%') diff --git a/gcc/m2/mc-boot/GmcMetaError.h b/gcc/m2/mc-boot/GmcMetaError.h index 9496f5e..d4b118c 100644 --- a/gcc/m2/mc-boot/GmcMetaError.h +++ b/gcc/m2/mc-boot/GmcMetaError.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcOptions.cc b/gcc/m2/mc-boot/GmcOptions.cc index 5d4e31b..9b2dc424 100644 --- a/gcc/m2/mc-boot/GmcOptions.cc +++ b/gcc/m2/mc-boot/GmcOptions.cc @@ -18,6 +18,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -50,26 +51,27 @@ Boston, MA 02110-1301, USA. */ # include "GFIO.h" # include "GSFIO.h" -static unsigned int langC; -static unsigned int langCPP; -static unsigned int langM2; -static unsigned int gplHeader; -static unsigned int glplHeader; -static unsigned int summary; -static unsigned int contributed; -static unsigned int scaffoldMain; -static unsigned int scaffoldDynamic; -static unsigned int caseRuntime; -static unsigned int arrayRuntime; -static unsigned int returnRuntime; -static unsigned int suppressNoReturn; -static unsigned int gccConfigSystem; -static unsigned int ignoreFQ; -static unsigned int debugTopological; -static unsigned int extendedOpaque; -static unsigned int internalDebugging; -static unsigned int verbose; -static unsigned int quiet; +static bool langC; +static bool langCPP; +static bool langM2; +static bool gplHeader; +static bool glplHeader; +static bool summary; +static bool contributed; +static bool scaffoldMain; +static bool scaffoldDynamic; +static bool caseRuntime; +static bool arrayRuntime; +static bool returnRuntime; +static bool suppressNoReturn; +static bool useBoolType; +static bool gccConfigSystem; +static bool ignoreFQ; +static bool debugTopological; +static bool extendedOpaque; +static bool internalDebugging; +static bool verbose; +static bool quiet; static DynamicStrings_String projectContents; static DynamicStrings_String summaryContents; static DynamicStrings_String contributedContents; @@ -90,19 +92,19 @@ extern "C" DynamicStrings_String mcOptions_handleOptions (void); getQuiet - return the value of quiet. */ -extern "C" unsigned int mcOptions_getQuiet (void); +extern "C" bool mcOptions_getQuiet (void); /* getVerbose - return the value of verbose. */ -extern "C" unsigned int mcOptions_getVerbose (void); +extern "C" bool mcOptions_getVerbose (void); /* getInternalDebugging - return the value of internalDebugging. */ -extern "C" unsigned int mcOptions_getInternalDebugging (void); +extern "C" bool mcOptions_getInternalDebugging (void); /* getCppCommandLine - returns the Cpp command line and all arguments. @@ -120,20 +122,20 @@ extern "C" DynamicStrings_String mcOptions_getOutputFile (void); getExtendedOpaque - return the extendedOpaque value. */ -extern "C" unsigned int mcOptions_getExtendedOpaque (void); +extern "C" bool mcOptions_getExtendedOpaque (void); /* setDebugTopological - sets the flag debugTopological to value. */ -extern "C" void mcOptions_setDebugTopological (unsigned int value); +extern "C" void mcOptions_setDebugTopological (bool value); /* getDebugTopological - returns the flag value of the command line option --debug-top. */ -extern "C" unsigned int mcOptions_getDebugTopological (void); +extern "C" bool mcOptions_getDebugTopological (void); /* getHPrefix - saves the H file prefix. @@ -145,25 +147,25 @@ extern "C" DynamicStrings_String mcOptions_getHPrefix (void); getIgnoreFQ - returns the ignorefq flag. */ -extern "C" unsigned int mcOptions_getIgnoreFQ (void); +extern "C" bool mcOptions_getIgnoreFQ (void); /* getGccConfigSystem - return the value of the gccConfigSystem flag. */ -extern "C" unsigned int mcOptions_getGccConfigSystem (void); +extern "C" bool mcOptions_getGccConfigSystem (void); /* getScaffoldDynamic - return true if the --scaffold-dynamic option was present. */ -extern "C" unsigned int mcOptions_getScaffoldDynamic (void); +extern "C" bool mcOptions_getScaffoldDynamic (void); /* getScaffoldMain - return true if the --scaffold-main option was present. */ -extern "C" unsigned int mcOptions_getScaffoldMain (void); +extern "C" bool mcOptions_getScaffoldMain (void); /* writeGPLheader - writes out the GPL or the LGPL as a comment. @@ -175,13 +177,19 @@ extern "C" void mcOptions_writeGPLheader (FIO_File f); setSuppressNoReturn - set suppressNoReturn to value. */ -extern "C" void mcOptions_setSuppressNoReturn (unsigned int value); +extern "C" void mcOptions_setSuppressNoReturn (bool value); /* getSuppressNoReturn - return the suppressNoReturn value. */ -extern "C" unsigned int mcOptions_getSuppressNoReturn (void); +extern "C" bool mcOptions_getSuppressNoReturn (void); + +/* + useBool - should mc use the bool type instead of int. +*/ + +extern "C" bool mcOptions_useBool (void); /* getYear - return the year. @@ -193,7 +201,7 @@ static unsigned int getYear (void); displayVersion - displays the version of the compiler. */ -static void displayVersion (unsigned int mustExit); +static void displayVersion (bool mustExit); /* displayHelp - display the mc help summary. @@ -253,19 +261,19 @@ static void setOutputFile (DynamicStrings_String output); setQuiet - sets the quiet flag to, value. */ -static void setQuiet (unsigned int value); +static void setQuiet (bool value); /* setVerbose - sets the verbose flag to, value. */ -static void setVerbose (unsigned int value); +static void setVerbose (bool value); /* setExtendedOpaque - set extendedOpaque to value. */ -static void setExtendedOpaque (unsigned int value); +static void setExtendedOpaque (bool value); /* setSearchPath - set the search path for the module sources. @@ -277,7 +285,7 @@ static void setSearchPath (DynamicStrings_String arg); setInternalDebugging - turn on/off internal debugging. */ -static void setInternalDebugging (unsigned int value); +static void setInternalDebugging (bool value); /* setHPrefix - saves the H file prefix. @@ -289,14 +297,14 @@ static void setHPrefix (DynamicStrings_String s); setIgnoreFQ - sets the ignorefq flag. */ -static void setIgnoreFQ (unsigned int value); +static void setIgnoreFQ (bool value); /* optionIs - returns TRUE if the first len (right) characters match left. */ -static unsigned int optionIs (const char *left_, unsigned int _left_high, DynamicStrings_String right); +static bool optionIs (const char *left_, unsigned int _left_high, DynamicStrings_String right); /* setLang - set the appropriate output language. @@ -332,7 +340,7 @@ static unsigned int getYear (void) displayVersion - displays the version of the compiler. */ -static void displayVersion (unsigned int mustExit) +static void displayVersion (bool mustExit) { unsigned int year; @@ -600,7 +608,7 @@ static void setOutputFile (DynamicStrings_String output) setQuiet - sets the quiet flag to, value. */ -static void setQuiet (unsigned int value) +static void setQuiet (bool value) { quiet = value; } @@ -610,7 +618,7 @@ static void setQuiet (unsigned int value) setVerbose - sets the verbose flag to, value. */ -static void setVerbose (unsigned int value) +static void setVerbose (bool value) { verbose = value; } @@ -620,7 +628,7 @@ static void setVerbose (unsigned int value) setExtendedOpaque - set extendedOpaque to value. */ -static void setExtendedOpaque (unsigned int value) +static void setExtendedOpaque (bool value) { extendedOpaque = value; } @@ -640,7 +648,7 @@ static void setSearchPath (DynamicStrings_String arg) setInternalDebugging - turn on/off internal debugging. */ -static void setInternalDebugging (unsigned int value) +static void setInternalDebugging (bool value) { internalDebugging = value; } @@ -660,7 +668,7 @@ static void setHPrefix (DynamicStrings_String s) setIgnoreFQ - sets the ignorefq flag. */ -static void setIgnoreFQ (unsigned int value) +static void setIgnoreFQ (bool value) { ignoreFQ = value; } @@ -671,7 +679,7 @@ static void setIgnoreFQ (unsigned int value) match left. */ -static unsigned int optionIs (const char *left_, unsigned int _left_high, DynamicStrings_String right) +static bool optionIs (const char *left_, unsigned int _left_high, DynamicStrings_String right) { DynamicStrings_String s; char left[_left_high+1]; @@ -692,7 +700,7 @@ static unsigned int optionIs (const char *left_, unsigned int _left_high, Dynami else { /* avoid dangling else. */ - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -709,19 +717,19 @@ static void setLang (DynamicStrings_String arg) if (optionIs ((const char *) "c++", 3, arg)) { decl_setLangCP (); - langCPP = TRUE; + langCPP = true; } else if (optionIs ((const char *) "c", 1, arg)) { /* avoid dangling else. */ decl_setLangC (); - langC = TRUE; + langC = true; } else if (optionIs ((const char *) "m2", 2, arg)) { /* avoid dangling else. */ decl_setLangM2 (); - langM2 = TRUE; + langM2 = true; } else { @@ -739,17 +747,17 @@ static void handleOption (DynamicStrings_String arg) { if ((optionIs ((const char *) "--quiet", 7, arg)) || (optionIs ((const char *) "-q", 2, arg))) { - setQuiet (TRUE); + setQuiet (true); } else if ((optionIs ((const char *) "--verbose", 9, arg)) || (optionIs ((const char *) "-v", 2, arg))) { /* avoid dangling else. */ - setVerbose (TRUE); + setVerbose (true); } else if (optionIs ((const char *) "--version", 9, arg)) { /* avoid dangling else. */ - displayVersion (TRUE); + displayVersion (true); } else if (optionIs ((const char *) "--olang=", 8, arg)) { @@ -779,12 +787,12 @@ static void handleOption (DynamicStrings_String arg) else if (optionIs ((const char *) "--extended-opaque", 17, arg)) { /* avoid dangling else. */ - setExtendedOpaque (TRUE); + setExtendedOpaque (true); } else if (optionIs ((const char *) "--debug-top", 11, arg)) { /* avoid dangling else. */ - mcOptions_setDebugTopological (TRUE); + mcOptions_setDebugTopological (true); } else if (optionIs ((const char *) "--h-file-prefix=", 16, arg)) { @@ -794,28 +802,28 @@ static void handleOption (DynamicStrings_String arg) else if (optionIs ((const char *) "--ignore-fq", 11, arg)) { /* avoid dangling else. */ - setIgnoreFQ (TRUE); + setIgnoreFQ (true); } else if (optionIs ((const char *) "--gpl-header", 12, arg)) { /* avoid dangling else. */ - gplHeader = TRUE; + gplHeader = true; } else if (optionIs ((const char *) "--glpl-header", 13, arg)) { /* avoid dangling else. */ - glplHeader = TRUE; + glplHeader = true; } else if (optionIs ((const char *) "--summary=\"", 11, arg)) { /* avoid dangling else. */ - summary = TRUE; + summary = true; summaryContents = DynamicStrings_Slice (arg, 11, -1); } else if (optionIs ((const char *) "--contributed=\"", 15, arg)) { /* avoid dangling else. */ - contributed = TRUE; + contributed = true; contributedContents = DynamicStrings_Slice (arg, 13, -1); } else if (optionIs ((const char *) "--project=\"", 11, arg)) @@ -826,22 +834,22 @@ static void handleOption (DynamicStrings_String arg) else if (optionIs ((const char *) "--gcc-config-system", 19, arg)) { /* avoid dangling else. */ - gccConfigSystem = TRUE; + gccConfigSystem = true; } else if (optionIs ((const char *) "--scaffold-main", 15, arg)) { /* avoid dangling else. */ - scaffoldMain = TRUE; + scaffoldMain = true; } else if (optionIs ((const char *) "--scaffold-dynamic", 18, arg)) { /* avoid dangling else. */ - scaffoldDynamic = TRUE; + scaffoldDynamic = true; } else if (optionIs ((const char *) "--suppress-noreturn", 19, arg)) { /* avoid dangling else. */ - suppressNoReturn = TRUE; + suppressNoReturn = true; } } @@ -872,7 +880,7 @@ extern "C" DynamicStrings_String mcOptions_handleOptions (void) if (! summary) { summaryContents = DynamicStrings_ConCatChar (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "automatically created by mc from ", 33), arg), '.'); - summary = FALSE; + summary = false; } return arg; } @@ -889,7 +897,7 @@ extern "C" DynamicStrings_String mcOptions_handleOptions (void) getQuiet - return the value of quiet. */ -extern "C" unsigned int mcOptions_getQuiet (void) +extern "C" bool mcOptions_getQuiet (void) { return quiet; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -901,7 +909,7 @@ extern "C" unsigned int mcOptions_getQuiet (void) getVerbose - return the value of verbose. */ -extern "C" unsigned int mcOptions_getVerbose (void) +extern "C" bool mcOptions_getVerbose (void) { return verbose; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -913,7 +921,7 @@ extern "C" unsigned int mcOptions_getVerbose (void) getInternalDebugging - return the value of internalDebugging. */ -extern "C" unsigned int mcOptions_getInternalDebugging (void) +extern "C" bool mcOptions_getInternalDebugging (void) { return internalDebugging; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -964,7 +972,7 @@ extern "C" DynamicStrings_String mcOptions_getOutputFile (void) getExtendedOpaque - return the extendedOpaque value. */ -extern "C" unsigned int mcOptions_getExtendedOpaque (void) +extern "C" bool mcOptions_getExtendedOpaque (void) { return extendedOpaque; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -976,7 +984,7 @@ extern "C" unsigned int mcOptions_getExtendedOpaque (void) setDebugTopological - sets the flag debugTopological to value. */ -extern "C" void mcOptions_setDebugTopological (unsigned int value) +extern "C" void mcOptions_setDebugTopological (bool value) { debugTopological = value; } @@ -987,7 +995,7 @@ extern "C" void mcOptions_setDebugTopological (unsigned int value) line option --debug-top. */ -extern "C" unsigned int mcOptions_getDebugTopological (void) +extern "C" bool mcOptions_getDebugTopological (void) { return debugTopological; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1011,7 +1019,7 @@ extern "C" DynamicStrings_String mcOptions_getHPrefix (void) getIgnoreFQ - returns the ignorefq flag. */ -extern "C" unsigned int mcOptions_getIgnoreFQ (void) +extern "C" bool mcOptions_getIgnoreFQ (void) { return ignoreFQ; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1023,7 +1031,7 @@ extern "C" unsigned int mcOptions_getIgnoreFQ (void) getGccConfigSystem - return the value of the gccConfigSystem flag. */ -extern "C" unsigned int mcOptions_getGccConfigSystem (void) +extern "C" bool mcOptions_getGccConfigSystem (void) { return gccConfigSystem; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1035,7 +1043,7 @@ extern "C" unsigned int mcOptions_getGccConfigSystem (void) getScaffoldDynamic - return true if the --scaffold-dynamic option was present. */ -extern "C" unsigned int mcOptions_getScaffoldDynamic (void) +extern "C" bool mcOptions_getScaffoldDynamic (void) { return scaffoldDynamic; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1047,7 +1055,7 @@ extern "C" unsigned int mcOptions_getScaffoldDynamic (void) getScaffoldMain - return true if the --scaffold-main option was present. */ -extern "C" unsigned int mcOptions_getScaffoldMain (void) +extern "C" bool mcOptions_getScaffoldMain (void) { return scaffoldMain; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1069,7 +1077,7 @@ extern "C" void mcOptions_writeGPLheader (FIO_File f) setSuppressNoReturn - set suppressNoReturn to value. */ -extern "C" void mcOptions_setSuppressNoReturn (unsigned int value) +extern "C" void mcOptions_setSuppressNoReturn (bool value) { suppressNoReturn = value; } @@ -1079,35 +1087,48 @@ extern "C" void mcOptions_setSuppressNoReturn (unsigned int value) getSuppressNoReturn - return the suppressNoReturn value. */ -extern "C" unsigned int mcOptions_getSuppressNoReturn (void) +extern "C" bool mcOptions_getSuppressNoReturn (void) { return suppressNoReturn; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } + +/* + useBool - should mc use the bool type instead of int. +*/ + +extern "C" bool mcOptions_useBool (void) +{ + return useBoolType; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { - langC = TRUE; - langCPP = FALSE; - langM2 = FALSE; - gplHeader = FALSE; - glplHeader = FALSE; - summary = FALSE; - contributed = FALSE; - caseRuntime = FALSE; - arrayRuntime = FALSE; - returnRuntime = FALSE; - internalDebugging = FALSE; - quiet = FALSE; - verbose = FALSE; - extendedOpaque = FALSE; - debugTopological = FALSE; - ignoreFQ = FALSE; - gccConfigSystem = FALSE; - scaffoldMain = FALSE; - scaffoldDynamic = FALSE; - suppressNoReturn = FALSE; + langC = true; + langCPP = false; + langM2 = false; + gplHeader = false; + glplHeader = false; + summary = false; + contributed = false; + caseRuntime = false; + arrayRuntime = false; + returnRuntime = false; + internalDebugging = false; + quiet = false; + verbose = false; + extendedOpaque = false; + debugTopological = false; + ignoreFQ = false; + gccConfigSystem = false; + scaffoldMain = false; + scaffoldDynamic = false; + suppressNoReturn = false; + useBoolType = true; hPrefix = DynamicStrings_InitString ((const char *) "", 0); cppArgs = DynamicStrings_InitString ((const char *) "", 0); cppProgram = DynamicStrings_InitString ((const char *) "", 0); diff --git a/gcc/m2/mc-boot/GmcOptions.h b/gcc/m2/mc-boot/GmcOptions.h index de2bc07..ba22857 100644 --- a/gcc/m2/mc-boot/GmcOptions.h +++ b/gcc/m2/mc-boot/GmcOptions.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -57,19 +58,19 @@ EXTERN DynamicStrings_String mcOptions_handleOptions (void); getQuiet - return the value of quiet. */ -EXTERN unsigned int mcOptions_getQuiet (void); +EXTERN bool mcOptions_getQuiet (void); /* getVerbose - return the value of verbose. */ -EXTERN unsigned int mcOptions_getVerbose (void); +EXTERN bool mcOptions_getVerbose (void); /* getInternalDebugging - return the value of internalDebugging. */ -EXTERN unsigned int mcOptions_getInternalDebugging (void); +EXTERN bool mcOptions_getInternalDebugging (void); EXTERN DynamicStrings_String mcOptions_getCppCommandLine (void); /* @@ -82,20 +83,20 @@ EXTERN DynamicStrings_String mcOptions_getOutputFile (void); getExtendedOpaque - return the extendedOpaque value. */ -EXTERN unsigned int mcOptions_getExtendedOpaque (void); +EXTERN bool mcOptions_getExtendedOpaque (void); /* setDebugTopological - sets the flag debugTopological to value. */ -EXTERN void mcOptions_setDebugTopological (unsigned int value); +EXTERN void mcOptions_setDebugTopological (bool value); /* getDebugTopological - returns the flag value of the command line option --debug-top. */ -EXTERN unsigned int mcOptions_getDebugTopological (void); +EXTERN bool mcOptions_getDebugTopological (void); /* getHPrefix - saves the H file prefix. @@ -107,25 +108,25 @@ EXTERN DynamicStrings_String mcOptions_getHPrefix (void); getIgnoreFQ - returns the ignorefq flag. */ -EXTERN unsigned int mcOptions_getIgnoreFQ (void); +EXTERN bool mcOptions_getIgnoreFQ (void); /* getGccConfigSystem - return the value of the gccConfigSystem flag. */ -EXTERN unsigned int mcOptions_getGccConfigSystem (void); +EXTERN bool mcOptions_getGccConfigSystem (void); /* getScaffoldDynamic - return true if the --scaffold-dynamic option was present. */ -EXTERN unsigned int mcOptions_getScaffoldDynamic (void); +EXTERN bool mcOptions_getScaffoldDynamic (void); /* getScaffoldMain - return true if the --scaffold-main option was present. */ -EXTERN unsigned int mcOptions_getScaffoldMain (void); +EXTERN bool mcOptions_getScaffoldMain (void); /* writeGPLheader - writes out the GPL or the GLPL as a comment. @@ -137,13 +138,19 @@ EXTERN void mcOptions_writeGPLheader (FIO_File f); setSuppressNoReturn - set suppressNoReturn to value. */ -EXTERN void mcOptions_setSuppressNoReturn (unsigned int value); +EXTERN void mcOptions_setSuppressNoReturn (bool value); /* getSuppressNoReturn - return the suppressNoReturn value. */ -EXTERN unsigned int mcOptions_getSuppressNoReturn (void); +EXTERN bool mcOptions_getSuppressNoReturn (void); + +/* + useBool - should mc use the bool type instead of int. +*/ + +EXTERN bool mcOptions_useBool (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GmcPreprocess.cc b/gcc/m2/mc-boot/GmcPreprocess.cc index 91a5093..74add0c 100644 --- a/gcc/m2/mc-boot/GmcPreprocess.cc +++ b/gcc/m2/mc-boot/GmcPreprocess.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcPreprocess.h b/gcc/m2/mc-boot/GmcPreprocess.h index 22983f1..03f35dd 100644 --- a/gcc/m2/mc-boot/GmcPreprocess.h +++ b/gcc/m2/mc-boot/GmcPreprocess.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcPretty.cc b/gcc/m2/mc-boot/GmcPretty.cc index 1184514..cd48032 100644 --- a/gcc/m2/mc-boot/GmcPretty.cc +++ b/gcc/m2/mc-boot/GmcPretty.cc @@ -18,6 +18,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -60,8 +61,8 @@ struct mcPretty_writeLnProc_p { mcPretty_writeLnProc_t proc; }; struct mcPretty__T1_r { mcPretty_writeProc write_; mcPretty_writeLnProc writeln; - unsigned int needsSpace; - unsigned int needsIndent; + bool needsSpace; + bool needsIndent; unsigned int seekPos; unsigned int curLine; unsigned int curPos; @@ -179,7 +180,7 @@ static void flushSpace (mcPretty_pretty p) if (p->needsSpace) { (*p->write_.proc) (' '); - p->needsSpace = FALSE; + p->needsSpace = false; p->curPos += 1; p->seekPos += 1; } @@ -203,7 +204,7 @@ static void flushIndent (mcPretty_pretty p) p->curPos += 1; p->seekPos += 1; } - p->needsIndent = FALSE; + p->needsIndent = false; } } @@ -219,8 +220,8 @@ extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_w Storage_ALLOCATE ((void **) &p, sizeof (mcPretty__T1)); p->write_ = w; p->writeln = l; - p->needsSpace = FALSE; - p->needsIndent = FALSE; + p->needsSpace = false; + p->needsIndent = false; p->curPos = 0; p->curLine = 0; p->seekPos = 0; @@ -368,7 +369,7 @@ extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s) /* setneedSpace - sets needSpace flag to TRUE. */ - s->needsSpace = TRUE; + s->needsSpace = true; } @@ -378,7 +379,7 @@ extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s) extern "C" void mcPretty_noSpace (mcPretty_pretty s) { - s->needsSpace = FALSE; + s->needsSpace = false; } @@ -416,8 +417,8 @@ extern "C" void mcPretty_prints (mcPretty_pretty p, DynamicStrings_String s) { if ((((i+2) <= l) && ((DynamicStrings_char (s, static_cast<int> (i))) == '\\')) && ((DynamicStrings_char (s, static_cast<int> (i+1))) == 'n')) { - p->needsIndent = TRUE; - p->needsSpace = FALSE; + p->needsIndent = true; + p->needsSpace = false; p->curPos = 0; (*p->writeln.proc) (); p->seekPos += 1; diff --git a/gcc/m2/mc-boot/GmcPretty.h b/gcc/m2/mc-boot/GmcPretty.h index 14819d9..019de3c 100644 --- a/gcc/m2/mc-boot/GmcPretty.h +++ b/gcc/m2/mc-boot/GmcPretty.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcPrintf.cc b/gcc/m2/mc-boot/GmcPrintf.cc index a8660a5..3fd4117 100644 --- a/gcc/m2/mc-boot/GmcPrintf.cc +++ b/gcc/m2/mc-boot/GmcPrintf.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -121,7 +122,7 @@ extern "C" void mcPrintf_fprintf4 (FIO_File file, const char *a_, unsigned int _ isDigit - returns TRUE if, ch, is a character 0..9 */ -static unsigned int isDigit (char ch); +static bool isDigit (char ch); /* cast - casts a := b @@ -135,14 +136,14 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b into a String and %a is replaced by %s. */ -static unsigned int TranslateNameToCharStar (char *a, unsigned int _a_high, unsigned int n); +static bool TranslateNameToCharStar (char *a, unsigned int _a_high, unsigned int n); /* isDigit - returns TRUE if, ch, is a character 0..9 */ -static unsigned int isDigit (char ch) +static bool isDigit (char ch) { return (ch >= '0') && (ch <= '9'); /* static analysis guarentees a RETURN statement will be used before here. */ @@ -183,7 +184,7 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b into a String and %a is replaced by %s. */ -static unsigned int TranslateNameToCharStar (char *a, unsigned int _a_high, unsigned int n) +static bool TranslateNameToCharStar (char *a, unsigned int _a_high, unsigned int n) { unsigned int argno; unsigned int i; @@ -199,18 +200,18 @@ static unsigned int TranslateNameToCharStar (char *a, unsigned int _a_high, unsi if ((a[i+1] == 'a') && (argno == n)) { a[i+1] = 's'; - return TRUE; + return true; } argno += 1; if (argno > n) { /* all done */ - return FALSE; + return false; } } i += 1; } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcPrintf.h b/gcc/m2/mc-boot/GmcPrintf.h index 43ee813..7e8bb1f 100644 --- a/gcc/m2/mc-boot/GmcPrintf.h +++ b/gcc/m2/mc-boot/GmcPrintf.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcQuiet.cc b/gcc/m2/mc-boot/GmcQuiet.cc index bcf1026..ccff3b6 100644 --- a/gcc/m2/mc-boot/GmcQuiet.cc +++ b/gcc/m2/mc-boot/GmcQuiet.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcQuiet.h b/gcc/m2/mc-boot/GmcQuiet.h index 32a5dda..5c83257 100644 --- a/gcc/m2/mc-boot/GmcQuiet.h +++ b/gcc/m2/mc-boot/GmcQuiet.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcReserved.cc b/gcc/m2/mc-boot/GmcReserved.cc index 60b8796..9e3519b 100644 --- a/gcc/m2/mc-boot/GmcReserved.cc +++ b/gcc/m2/mc-boot/GmcReserved.cc @@ -18,6 +18,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcReserved.h b/gcc/m2/mc-boot/GmcReserved.h index 88652ae..eade5d1 100644 --- a/gcc/m2/mc-boot/GmcReserved.h +++ b/gcc/m2/mc-boot/GmcReserved.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcSearch.cc b/gcc/m2/mc-boot/GmcSearch.cc index a4541fa..add9b82 100644 --- a/gcc/m2/mc-boot/GmcSearch.cc +++ b/gcc/m2/mc-boot/GmcSearch.cc @@ -17,6 +17,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -82,7 +83,7 @@ extern "C" void mcSearch_prependSearchPath (DynamicStrings_String path); The string, FileName, is not altered. */ -extern "C" unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, DynamicStrings_String *fullPath); +extern "C" bool mcSearch_findSourceFile (DynamicStrings_String FileName, DynamicStrings_String *fullPath); /* findSourceDefFile - attempts to find the definition module for @@ -91,7 +92,7 @@ extern "C" unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, then FALSE is returned and fullPath is set to NIL. */ -extern "C" unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); +extern "C" bool mcSearch_findSourceDefFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); /* findSourceModFile - attempts to find the implementation module for @@ -100,7 +101,7 @@ extern "C" unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, then FALSE is returned and fullPath is set to NIL. */ -extern "C" unsigned int mcSearch_findSourceModFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); +extern "C" bool mcSearch_findSourceModFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); /* setDefExtension - sets the default extension for definition modules to, ext. @@ -165,7 +166,7 @@ static void doDSdbEnter (void) static void doDSdbExit (DynamicStrings_String s) { - s = DynamicStrings_PopAllocationExemption (TRUE, s); + s = DynamicStrings_PopAllocationExemption (true, s); } @@ -256,7 +257,7 @@ extern "C" void mcSearch_prependSearchPath (DynamicStrings_String path) The string, FileName, is not altered. */ -extern "C" unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, DynamicStrings_String *fullPath) +extern "C" bool mcSearch_findSourceFile (DynamicStrings_String FileName, DynamicStrings_String *fullPath) { DynamicStrings_String completeSearchPath; int start; @@ -299,7 +300,7 @@ extern "C" unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, { (*fullPath) = newpath; completeSearchPath = DynamicStrings_KillString (completeSearchPath); - return TRUE; + return true; } newpath = DynamicStrings_KillString (newpath); if (end != 0) @@ -311,7 +312,7 @@ extern "C" unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, (*fullPath) = static_cast<DynamicStrings_String> (NULL); newpath = DynamicStrings_KillString (newpath); completeSearchPath = DynamicStrings_KillString (completeSearchPath); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -324,7 +325,7 @@ extern "C" unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, then FALSE is returned and fullPath is set to NIL. */ -extern "C" unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, DynamicStrings_String *fullPath) +extern "C" bool mcSearch_findSourceDefFile (DynamicStrings_String stem, DynamicStrings_String *fullPath) { DynamicStrings_String f; @@ -333,7 +334,7 @@ extern "C" unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, f = mcFileName_calculateFileName (stem, Def); if (mcSearch_findSourceFile (f, fullPath)) { - return TRUE; + return true; } f = DynamicStrings_KillString (f); } @@ -352,7 +353,7 @@ extern "C" unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, then FALSE is returned and fullPath is set to NIL. */ -extern "C" unsigned int mcSearch_findSourceModFile (DynamicStrings_String stem, DynamicStrings_String *fullPath) +extern "C" bool mcSearch_findSourceModFile (DynamicStrings_String stem, DynamicStrings_String *fullPath) { DynamicStrings_String f; @@ -361,7 +362,7 @@ extern "C" unsigned int mcSearch_findSourceModFile (DynamicStrings_String stem, f = mcFileName_calculateFileName (stem, Mod); if (mcSearch_findSourceFile (f, fullPath)) { - return TRUE; + return true; } f = DynamicStrings_KillString (f); } diff --git a/gcc/m2/mc-boot/GmcSearch.h b/gcc/m2/mc-boot/GmcSearch.h index f3bf4c1..2223b3f 100644 --- a/gcc/m2/mc-boot/GmcSearch.h +++ b/gcc/m2/mc-boot/GmcSearch.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -76,7 +77,7 @@ EXTERN void mcSearch_prependSearchPath (DynamicStrings_String path); FindSourceFile sets FullPath to a new string if successful. */ -EXTERN unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, DynamicStrings_String *fullPath); +EXTERN bool mcSearch_findSourceFile (DynamicStrings_String FileName, DynamicStrings_String *fullPath); /* findSourceDefFile - attempts to find the definition module for @@ -85,7 +86,7 @@ EXTERN unsigned int mcSearch_findSourceFile (DynamicStrings_String FileName, Dyn then FALSE is returned and FullPath is set to NIL. */ -EXTERN unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); +EXTERN bool mcSearch_findSourceDefFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); /* findSourceModFile - attempts to find the implementation module for @@ -94,7 +95,7 @@ EXTERN unsigned int mcSearch_findSourceDefFile (DynamicStrings_String stem, Dyna then FALSE is returned and FullPath is set to NIL. */ -EXTERN unsigned int mcSearch_findSourceModFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); +EXTERN bool mcSearch_findSourceModFile (DynamicStrings_String stem, DynamicStrings_String *fullPath); /* setDefExtension - sets the default extension for definition modules to, ext. diff --git a/gcc/m2/mc-boot/GmcStack.cc b/gcc/m2/mc-boot/GmcStack.cc index 95d31a5..b08e918 100644 --- a/gcc/m2/mc-boot/GmcStack.cc +++ b/gcc/m2/mc-boot/GmcStack.cc @@ -18,6 +18,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcStack.h b/gcc/m2/mc-boot/GmcStack.h index b752dad..0a3d015 100644 --- a/gcc/m2/mc-boot/GmcStack.h +++ b/gcc/m2/mc-boot/GmcStack.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/GmcStream.cc b/gcc/m2/mc-boot/GmcStream.cc index e4ce052..553cbf5 100644 --- a/gcc/m2/mc-boot/GmcStream.cc +++ b/gcc/m2/mc-boot/GmcStream.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -61,7 +62,7 @@ typedef FIO_File *mcStream_ptrToFile; static alists_alist listOfFiles; static Indexing_Index frag; static FIO_File destFile; -static unsigned int seenDest; +static bool seenDest; /* openFrag - create and open fragment, id, and return the file. @@ -217,7 +218,7 @@ extern "C" FIO_File mcStream_openFrag (unsigned int id) extern "C" void mcStream_setDest (FIO_File f) { - seenDest = TRUE; + seenDest = true; destFile = f; } @@ -257,7 +258,7 @@ extern "C" void mcStream_removeFiles (void) extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { listOfFiles = alists_initList (); - seenDest = FALSE; + seenDest = false; frag = Indexing_InitIndex (1); } diff --git a/gcc/m2/mc-boot/GmcStream.h b/gcc/m2/mc-boot/GmcStream.h index 8a6a58c..0213ff7 100644 --- a/gcc/m2/mc-boot/GmcStream.h +++ b/gcc/m2/mc-boot/GmcStream.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Gmcflex.h b/gcc/m2/mc-boot/Gmcflex.h index a3fcc05..918948f 100644 --- a/gcc/m2/mc-boot/Gmcflex.h +++ b/gcc/m2/mc-boot/Gmcflex.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -49,7 +50,7 @@ extern "C" { */ EXTERN void mcflex_closeSource (void); -EXTERN unsigned int mcflex_openSource (void * s); +EXTERN bool mcflex_openSource (void * s); /* getToken - returns the ADDRESS of the next token. diff --git a/gcc/m2/mc-boot/Gmcp1.cc b/gcc/m2/mc-boot/Gmcp1.cc index 97bedb2..4a146db 100644 --- a/gcc/m2/mc-boot/Gmcp1.cc +++ b/gcc/m2/mc-boot/Gmcp1.cc @@ -22,6 +22,7 @@ see <https://www.gnu.org/licenses/>. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -53,8 +54,8 @@ see <https://www.gnu.org/licenses/>. */ # include "GmcLexBuf.h" # include "Gdecl.h" -# define Pass1 TRUE -# define Debugging FALSE +# define Pass1 true +# define Debugging false typedef unsigned int mcp1_stop0; typedef unsigned int mcp1_SetOfStop0; @@ -67,7 +68,7 @@ typedef unsigned int mcp1_stop2; typedef unsigned int mcp1_SetOfStop2; -static unsigned int WasNoError; +static bool WasNoError; static nameKey_Name curident; static decl_node curproc; static decl_node curmodule; @@ -77,7 +78,7 @@ static decl_node curmodule; in future passes. */ -extern "C" unsigned int mcp1_CompilationUnit (void); +extern "C" bool mcp1_CompilationUnit (void); static void ErrorString (DynamicStrings_String s); static void ErrorArray (const char *a_, unsigned int _a_high); @@ -128,13 +129,13 @@ static void MissingToken (mcReserved_toktype t); CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2); +static bool CheckAndInsert (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2); /* InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2); +static bool InStopSet (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2); /* PeepToken - peep token checks to see whether the stopset is satisfied by currenttoken @@ -181,7 +182,7 @@ static void Real (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOf current module import list. */ -static void registerImport (nameKey_Name ident, unsigned int scoped); +static void registerImport (nameKey_Name ident, bool scoped); /* FileUnit := DefinitionModule | @@ -1954,7 +1955,7 @@ static void TrashList (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_ static void ErrorString (DynamicStrings_String s) { mcError_errorStringAt (s, mcLexBuf_getTokenNo ()); - WasNoError = FALSE; + WasNoError = false; } static void ErrorArray (const char *a_, unsigned int _a_high) @@ -2950,17 +2951,17 @@ static void MissingToken (mcReserved_toktype t) CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2) +static bool CheckAndInsert (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { WarnMissingToken (t); mcLexBuf_insertTokenAndRewind (t); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -2971,15 +2972,15 @@ static unsigned int CheckAndInsert (mcReserved_toktype t, mcp1_SetOfStop0 stopse InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2) +static bool InStopSet (mcReserved_toktype t, mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -3092,7 +3093,7 @@ static void Real (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOf current module import list. */ -static void registerImport (nameKey_Name ident, unsigned int scoped) +static void registerImport (nameKey_Name ident, bool scoped) { decl_node n; @@ -6801,7 +6802,7 @@ static void FromImport (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1 { Expect (mcReserved_fromtok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); Ident (stopset0, stopset1|(mcp1_SetOfStop1) ((1 << (mcReserved_importtok-mcReserved_arraytok))), stopset2); - registerImport (curident, FALSE); + registerImport (curident, false); Expect (mcReserved_importtok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); IdentList (stopset0|(mcp1_SetOfStop0) ((1 << (mcReserved_semicolontok-mcReserved_eoftok))), stopset1, stopset2); Expect (mcReserved_semicolontok, stopset0, stopset1, stopset2); @@ -6823,12 +6824,12 @@ static void FromImport (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1 static void ImportModuleList (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2) { Ident (stopset0|(mcp1_SetOfStop0) ((1 << (mcReserved_commatok-mcReserved_eoftok))), stopset1, stopset2); - registerImport (curident, TRUE); + registerImport (curident, true); while (mcLexBuf_currenttoken == mcReserved_commatok) { Expect (mcReserved_commatok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); Ident (stopset0|(mcp1_SetOfStop0) ((1 << (mcReserved_commatok-mcReserved_eoftok))), stopset1, stopset2); - registerImport (curident, TRUE); + registerImport (curident, true); } /* while */ } @@ -6907,16 +6908,16 @@ static void Import (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_Set static void DefinitionModule (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_SetOfStop2 stopset2) { - unsigned int c; + bool c; - c = FALSE; + c = false; Expect (mcReserved_definitiontok, stopset0, stopset1|(mcp1_SetOfStop1) ((1 << (mcReserved_moduletok-mcReserved_arraytok))), stopset2); Expect (mcReserved_moduletok, stopset0, stopset1|(mcp1_SetOfStop1) ((1 << (mcReserved_fortok-mcReserved_arraytok))), stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); if (mcLexBuf_currenttoken == mcReserved_fortok) { Expect (mcReserved_fortok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_stringtok-mcReserved_recordtok)))); string (stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); - c = TRUE; + c = true; } Ident (stopset0|(mcp1_SetOfStop0) ((1 << (mcReserved_semicolontok-mcReserved_eoftok))), stopset1, stopset2); Expect (mcReserved_semicolontok, stopset0, stopset1|(mcp1_SetOfStop1) ((1 << (mcReserved_importtok-mcReserved_arraytok)) | (1 << (mcReserved_fromtok-mcReserved_arraytok)) | (1 << (mcReserved_exporttok-mcReserved_arraytok)) | (1 << (mcReserved_endtok-mcReserved_arraytok)) | (1 << (mcReserved_proceduretok-mcReserved_arraytok)) | (1 << (mcReserved_consttok-mcReserved_arraytok))), stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_vartok-mcReserved_recordtok)) | (1 << (mcReserved_typetok-mcReserved_recordtok)))); @@ -7247,9 +7248,9 @@ static void TrashList (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1, mcp1_ in future passes. */ -extern "C" unsigned int mcp1_CompilationUnit (void) +extern "C" bool mcp1_CompilationUnit (void) { - WasNoError = TRUE; + WasNoError = true; FileUnit ((mcp1_SetOfStop0) ((1 << (mcReserved_eoftok-mcReserved_eoftok))), (mcp1_SetOfStop1) 0, (mcp1_SetOfStop2) 0); return WasNoError; /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/Gmcp1.h b/gcc/m2/mc-boot/Gmcp1.h index bd4270a..78ae0aa 100644 --- a/gcc/m2/mc-boot/Gmcp1.h +++ b/gcc/m2/mc-boot/Gmcp1.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -48,7 +49,7 @@ extern "C" { in future passes. */ -EXTERN unsigned int mcp1_CompilationUnit (void); +EXTERN bool mcp1_CompilationUnit (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Gmcp2.cc b/gcc/m2/mc-boot/Gmcp2.cc index 85fd193..4fbdd7f 100644 --- a/gcc/m2/mc-boot/Gmcp2.cc +++ b/gcc/m2/mc-boot/Gmcp2.cc @@ -22,6 +22,7 @@ see <https://www.gnu.org/licenses/>. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -52,8 +53,8 @@ see <https://www.gnu.org/licenses/>. */ # include "GmcLexBuf.h" # include "Gdecl.h" -# define Pass1 FALSE -# define Debugging FALSE +# define Pass1 false +# define Debugging false typedef unsigned int mcp2_stop0; typedef unsigned int mcp2_SetOfStop0; @@ -66,7 +67,7 @@ typedef unsigned int mcp2_stop2; typedef unsigned int mcp2_SetOfStop2; -static unsigned int WasNoError; +static bool WasNoError; static nameKey_Name curident; static decl_node typeDes; static decl_node typeExp; @@ -78,7 +79,7 @@ static decl_node curmodule; in future passes. */ -extern "C" unsigned int mcp2_CompilationUnit (void); +extern "C" bool mcp2_CompilationUnit (void); static void ErrorString (DynamicStrings_String s); static void ErrorArray (const char *a_, unsigned int _a_high); @@ -129,13 +130,13 @@ static void MissingToken (mcReserved_toktype t); CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2); +static bool CheckAndInsert (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2); /* InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2); +static bool InStopSet (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2); /* PeepToken - peep token checks to see whether the stopset is satisfied by currenttoken @@ -182,7 +183,7 @@ static void Real (mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOf current module import list. */ -static void registerImport (nameKey_Name ident, unsigned int scoped); +static void registerImport (nameKey_Name ident, bool scoped); /* FileUnit := DefinitionModule | @@ -2070,7 +2071,7 @@ static void TrashList (mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_ static void ErrorString (DynamicStrings_String s) { mcError_errorStringAt (s, mcLexBuf_getTokenNo ()); - WasNoError = FALSE; + WasNoError = false; } static void ErrorArray (const char *a_, unsigned int _a_high) @@ -3066,17 +3067,17 @@ static void MissingToken (mcReserved_toktype t) CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2) +static bool CheckAndInsert (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { WarnMissingToken (t); mcLexBuf_insertTokenAndRewind (t); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -3087,15 +3088,15 @@ static unsigned int CheckAndInsert (mcReserved_toktype t, mcp2_SetOfStop0 stopse InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2) +static bool InStopSet (mcReserved_toktype t, mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -3205,7 +3206,7 @@ static void Real (mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_SetOf current module import list. */ -static void registerImport (nameKey_Name ident, unsigned int scoped) +static void registerImport (nameKey_Name ident, bool scoped) { decl_node n; @@ -7619,9 +7620,9 @@ static void TrashList (mcp2_SetOfStop0 stopset0, mcp2_SetOfStop1 stopset1, mcp2_ in future passes. */ -extern "C" unsigned int mcp2_CompilationUnit (void) +extern "C" bool mcp2_CompilationUnit (void) { - WasNoError = TRUE; + WasNoError = true; FileUnit ((mcp2_SetOfStop0) ((1 << (mcReserved_eoftok-mcReserved_eoftok))), (mcp2_SetOfStop1) 0, (mcp2_SetOfStop2) 0); return WasNoError; /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/Gmcp2.h b/gcc/m2/mc-boot/Gmcp2.h index bb121f1..be3b955 100644 --- a/gcc/m2/mc-boot/Gmcp2.h +++ b/gcc/m2/mc-boot/Gmcp2.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -48,7 +49,7 @@ extern "C" { in future passes. */ -EXTERN unsigned int mcp2_CompilationUnit (void); +EXTERN bool mcp2_CompilationUnit (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Gmcp3.cc b/gcc/m2/mc-boot/Gmcp3.cc index 4ff8d80..37e6def 100644 --- a/gcc/m2/mc-boot/Gmcp3.cc +++ b/gcc/m2/mc-boot/Gmcp3.cc @@ -22,6 +22,7 @@ see <https://www.gnu.org/licenses/>. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -54,8 +55,8 @@ see <https://www.gnu.org/licenses/>. */ # include "GmcLexBuf.h" # include "Gdecl.h" -# define Pass1 FALSE -# define Debugging FALSE +# define Pass1 false +# define Debugging false typedef unsigned int mcp3_stop0; typedef unsigned int mcp3_SetOfStop0; @@ -68,8 +69,8 @@ typedef unsigned int mcp3_stop2; typedef unsigned int mcp3_SetOfStop2; -static unsigned int WasNoError; -static unsigned int curisused; +static bool WasNoError; +static bool curisused; static nameKey_Name curstring; static nameKey_Name curident; static decl_node curproc; @@ -84,7 +85,7 @@ static mcStack_stack stk; in future passes. */ -extern "C" unsigned int mcp3_CompilationUnit (void); +extern "C" bool mcp3_CompilationUnit (void); /* push - @@ -120,7 +121,7 @@ static unsigned int depth (void); checkDuplicate - */ -static void checkDuplicate (unsigned int b); +static void checkDuplicate (bool b); /* checkDuplicate - @@ -214,13 +215,13 @@ static void MissingToken (mcReserved_toktype t); CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2); +static bool CheckAndInsert (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2); /* InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2); +static bool InStopSet (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2); /* PeepToken - peep token checks to see whether the stopset is satisfied by currenttoken @@ -2288,7 +2289,7 @@ static unsigned int depth (void) checkDuplicate - */ -static void checkDuplicate (unsigned int b) +static void checkDuplicate (bool b) { } @@ -2300,7 +2301,7 @@ static void checkDuplicate (unsigned int b) static void ErrorString (DynamicStrings_String s) { mcError_errorStringAt (s, mcLexBuf_getTokenNo ()); - WasNoError = FALSE; + WasNoError = false; } @@ -3399,17 +3400,17 @@ static void MissingToken (mcReserved_toktype t) CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2) +static bool CheckAndInsert (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { WarnMissingToken (t); mcLexBuf_insertTokenAndRewind (t); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -3420,15 +3421,15 @@ static unsigned int CheckAndInsert (mcReserved_toktype t, mcp3_SetOfStop0 stopse InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2) +static bool InStopSet (mcReserved_toktype t, mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -5287,13 +5288,13 @@ static void ProcedureParameter (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopse /* avoid dangling else. */ Expect (mcReserved_vartok, stopset0, stopset1|(mcp3_SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(mcp3_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); FormalType (stopset0, stopset1, stopset2); - n = push (decl_makeVarParameter (static_cast<decl_node> (NULL), pop (), curproc, TRUE)); + n = push (decl_makeVarParameter (static_cast<decl_node> (NULL), pop (), curproc, true)); } else if ((mcLexBuf_currenttoken == mcReserved_arraytok) || (mcLexBuf_currenttoken == mcReserved_identtok)) { /* avoid dangling else. */ FormalType (stopset0, stopset1, stopset2); - n = push (decl_makeNonVarParameter (static_cast<decl_node> (NULL), pop (), curproc, TRUE)); + n = push (decl_makeNonVarParameter (static_cast<decl_node> (NULL), pop (), curproc, true)); } else { @@ -6691,7 +6692,7 @@ static void AttributeNoReturn (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset } else { - decl_setNoReturn (curproc, FALSE); + decl_setNoReturn (curproc, false); } } /* end of optional [ | ] expression */ @@ -6710,7 +6711,7 @@ static void NoReturn (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_S { Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(mcp3_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); Ident (stopset0|(mcp3_SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2); - decl_setNoReturn (curproc, TRUE); + decl_setNoReturn (curproc, true); checkReturnAttribute (); Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2); } @@ -6745,7 +6746,7 @@ static void Unused (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_Set { Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(mcp3_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok)))); Ident (stopset0|(mcp3_SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2); - curisused = FALSE; + curisused = false; checkParameterAttribute (); Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2); } @@ -6898,7 +6899,7 @@ static void VarFPSection (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mc FormalType (stopset0|(mcp3_SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2); t = pop (); l = pop (); - curisused = TRUE; + curisused = true; if (mcLexBuf_currenttoken == mcReserved_ldirectivetok) { AttributeUnused (stopset0, stopset1, stopset2); @@ -6935,7 +6936,7 @@ static void NonVarFPSection (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, FormalType (stopset0|(mcp3_SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2); t = pop (); l = pop (); - curisused = TRUE; + curisused = true; if (mcLexBuf_currenttoken == mcReserved_ldirectivetok) { AttributeUnused (stopset0, stopset1, stopset2); @@ -7834,10 +7835,10 @@ static void TrashList (mcp3_SetOfStop0 stopset0, mcp3_SetOfStop1 stopset1, mcp3_ in future passes. */ -extern "C" unsigned int mcp3_CompilationUnit (void) +extern "C" bool mcp3_CompilationUnit (void) { stk = mcStack_init (); - WasNoError = TRUE; + WasNoError = true; FileUnit ((mcp3_SetOfStop0) ((1 << (mcReserved_eoftok-mcReserved_eoftok))), (mcp3_SetOfStop1) 0, (mcp3_SetOfStop2) 0); mcStack_kill (&stk); return WasNoError; diff --git a/gcc/m2/mc-boot/Gmcp3.h b/gcc/m2/mc-boot/Gmcp3.h index 3f7fe0c..3802d37 100644 --- a/gcc/m2/mc-boot/Gmcp3.h +++ b/gcc/m2/mc-boot/Gmcp3.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -48,7 +49,7 @@ extern "C" { in future passes. */ -EXTERN unsigned int mcp3_CompilationUnit (void); +EXTERN bool mcp3_CompilationUnit (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Gmcp4.cc b/gcc/m2/mc-boot/Gmcp4.cc index 5eab5ae..acf74cc 100644 --- a/gcc/m2/mc-boot/Gmcp4.cc +++ b/gcc/m2/mc-boot/Gmcp4.cc @@ -22,6 +22,7 @@ see <https://www.gnu.org/licenses/>. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -54,8 +55,8 @@ see <https://www.gnu.org/licenses/>. */ # include "GmcLexBuf.h" # include "Gdecl.h" -# define Pass1 FALSE -# define Debugging FALSE +# define Pass1 false +# define Debugging false typedef unsigned int mcp4_stop0; typedef unsigned int mcp4_SetOfStop0; @@ -68,7 +69,7 @@ typedef unsigned int mcp4_stop2; typedef unsigned int mcp4_SetOfStop2; -static unsigned int WasNoError; +static bool WasNoError; static nameKey_Name curstring; static nameKey_Name curident; static decl_node curproc; @@ -82,7 +83,7 @@ static mcStack_stack stk; in future passes. */ -extern "C" unsigned int mcp4_CompilationUnit (void); +extern "C" bool mcp4_CompilationUnit (void); /* push - @@ -118,7 +119,7 @@ static unsigned int depth (void); checkDuplicate - */ -static void checkDuplicate (unsigned int b); +static void checkDuplicate (bool b); /* checkDuplicate - @@ -200,13 +201,13 @@ static void MissingToken (mcReserved_toktype t); CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2); +static bool CheckAndInsert (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2); /* InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2); +static bool InStopSet (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2); /* PeepToken - peep token checks to see whether the stopset is satisfied by currenttoken @@ -2222,7 +2223,7 @@ static unsigned int depth (void) checkDuplicate - */ -static void checkDuplicate (unsigned int b) +static void checkDuplicate (bool b) { } @@ -2234,7 +2235,7 @@ static void checkDuplicate (unsigned int b) static void ErrorString (DynamicStrings_String s) { mcError_errorStringAt (s, mcLexBuf_getTokenNo ()); - WasNoError = FALSE; + WasNoError = false; } @@ -3307,17 +3308,17 @@ static void MissingToken (mcReserved_toktype t) CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2) +static bool CheckAndInsert (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { WarnMissingToken (t); mcLexBuf_insertTokenAndRewind (t); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -3328,15 +3329,15 @@ static unsigned int CheckAndInsert (mcReserved_toktype t, mcp4_SetOfStop0 stopse InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2) +static bool InStopSet (mcReserved_toktype t, mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -7697,10 +7698,10 @@ static void TrashList (mcp4_SetOfStop0 stopset0, mcp4_SetOfStop1 stopset1, mcp4_ in future passes. */ -extern "C" unsigned int mcp4_CompilationUnit (void) +extern "C" bool mcp4_CompilationUnit (void) { stk = mcStack_init (); - WasNoError = TRUE; + WasNoError = true; FileUnit ((mcp4_SetOfStop0) ((1 << (mcReserved_eoftok-mcReserved_eoftok))), (mcp4_SetOfStop1) 0, (mcp4_SetOfStop2) 0); mcStack_kill (&stk); return WasNoError; diff --git a/gcc/m2/mc-boot/Gmcp4.h b/gcc/m2/mc-boot/Gmcp4.h index 250eac2..659f80c 100644 --- a/gcc/m2/mc-boot/Gmcp4.h +++ b/gcc/m2/mc-boot/Gmcp4.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -48,7 +49,7 @@ extern "C" { in future passes. */ -EXTERN unsigned int mcp4_CompilationUnit (void); +EXTERN bool mcp4_CompilationUnit (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Gmcp5.cc b/gcc/m2/mc-boot/Gmcp5.cc index 9af8aac..225063c 100644 --- a/gcc/m2/mc-boot/Gmcp5.cc +++ b/gcc/m2/mc-boot/Gmcp5.cc @@ -22,6 +22,7 @@ see <https://www.gnu.org/licenses/>. */ #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -55,8 +56,8 @@ see <https://www.gnu.org/licenses/>. */ # include "GmcLexBuf.h" # include "Gdecl.h" -# define Pass1 FALSE -# define Debugging FALSE +# define Pass1 false +# define Debugging false typedef unsigned int mcp5_stop0; typedef unsigned int mcp5_SetOfStop0; @@ -69,7 +70,7 @@ typedef unsigned int mcp5_stop2; typedef unsigned int mcp5_SetOfStop2; -static unsigned int WasNoError; +static bool WasNoError; static nameKey_Name curstring; static nameKey_Name curident; static decl_node curproc; @@ -89,7 +90,7 @@ static mcStack_stack stk; in future passes. */ -extern "C" unsigned int mcp5_CompilationUnit (void); +extern "C" bool mcp5_CompilationUnit (void); /* followNode - @@ -131,13 +132,13 @@ static unsigned int depth (void); checkDuplicate - */ -static void checkDuplicate (unsigned int b); +static void checkDuplicate (bool b); /* isQualident - returns TRUE if, n, is a qualident. */ -static unsigned int isQualident (decl_node n); +static bool isQualident (decl_node n); /* startWith - @@ -277,13 +278,13 @@ static void MissingToken (mcReserved_toktype t); CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2); +static bool CheckAndInsert (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2); /* InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2); +static bool InStopSet (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2); /* PeepToken - peep token checks to see whether the stopset is satisfied by currenttoken @@ -2557,7 +2558,7 @@ static unsigned int depth (void) checkDuplicate - */ -static void checkDuplicate (unsigned int b) +static void checkDuplicate (bool b) { } @@ -2566,20 +2567,20 @@ static void checkDuplicate (unsigned int b) isQualident - returns TRUE if, n, is a qualident. */ -static unsigned int isQualident (decl_node n) +static bool isQualident (decl_node n) { decl_node type; if (decl_isDef (n)) { - return TRUE; + return true; } else { type = decl_skipType (decl_getType (n)); return (type != NULL) && (decl_isRecord (type)); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -2719,7 +2720,7 @@ static decl_node peepLoop (void) static void ErrorString (DynamicStrings_String s) { mcError_errorStringAt (s, mcLexBuf_getTokenNo ()); - WasNoError = FALSE; + WasNoError = false; } @@ -3793,17 +3794,17 @@ static void MissingToken (mcReserved_toktype t) CheckAndInsert - */ -static unsigned int CheckAndInsert (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2) +static bool CheckAndInsert (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { WarnMissingToken (t); mcLexBuf_insertTokenAndRewind (t); - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -3814,15 +3815,15 @@ static unsigned int CheckAndInsert (mcReserved_toktype t, mcp5_SetOfStop0 stopse InStopSet */ -static unsigned int InStopSet (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2) +static bool InStopSet (mcReserved_toktype t, mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_SetOfStop2 stopset2) { if (((( ((unsigned int) (t)) < 32) && ((((1 << (t-mcReserved_eoftok)) & (stopset0)) != 0))) || ((( ((unsigned int) (t)) >= 32) && ( ((unsigned int) (t)) < 64)) && ((((1 << (t-mcReserved_arraytok)) & (stopset1)) != 0)))) || (( ((unsigned int) (t)) >= 64) && ((((1 << (t-mcReserved_recordtok)) & (stopset2)) != 0)))) { - return TRUE; + return true; } else { - return FALSE; + return false; } /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); @@ -8549,14 +8550,14 @@ static void TrashList (mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, mcp5_ in future passes. */ -extern "C" unsigned int mcp5_CompilationUnit (void) +extern "C" bool mcp5_CompilationUnit (void) { stk = mcStack_init (); withStk = mcStack_init (); stmtStk = mcStack_init (); loopStk = mcStack_init (); loopNo = 0; - WasNoError = TRUE; + WasNoError = true; FileUnit ((mcp5_SetOfStop0) ((1 << (mcReserved_eoftok-mcReserved_eoftok))), (mcp5_SetOfStop1) 0, (mcp5_SetOfStop2) 0); mcStack_kill (&stk); mcStack_kill (&withStk); diff --git a/gcc/m2/mc-boot/Gmcp5.h b/gcc/m2/mc-boot/Gmcp5.h index e5080c1..a4d6e7d 100644 --- a/gcc/m2/mc-boot/Gmcp5.h +++ b/gcc/m2/mc-boot/Gmcp5.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -48,7 +49,7 @@ extern "C" { in future passes. */ -EXTERN unsigned int mcp5_CompilationUnit (void); +EXTERN bool mcp5_CompilationUnit (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GnameKey.cc b/gcc/m2/mc-boot/GnameKey.cc index b00a598..e59dfa5 100644 --- a/gcc/m2/mc-boot/GnameKey.cc +++ b/gcc/m2/mc-boot/GnameKey.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -115,7 +116,7 @@ extern "C" unsigned int nameKey_lengthKey (nameKey_Name key); converting, a, into a String, for speed. */ -extern "C" unsigned int nameKey_isKey (const char *a_, unsigned int _a_high); +extern "C" bool nameKey_isKey (const char *a_, unsigned int _a_high); /* keyToCharStar - returns the C char * string equivalent for, key. @@ -129,7 +130,7 @@ extern "C" void nameKey_writeKey (nameKey_Name key); This function deliberately inlines CAP for speed. */ -extern "C" unsigned int nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2); +extern "C" bool nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2); /* keyToCharStar - returns the C char * string equivalent for, key. @@ -432,7 +433,7 @@ extern "C" unsigned int nameKey_lengthKey (nameKey_Name key) converting, a, into a String, for speed. */ -extern "C" unsigned int nameKey_isKey (const char *a_, unsigned int _a_high) +extern "C" bool nameKey_isKey (const char *a_, unsigned int _a_high) { nameKey_nameNode child; nameKey_ptrToChar p; @@ -472,7 +473,7 @@ extern "C" unsigned int nameKey_isKey (const char *a_, unsigned int _a_high) /* avoid gcc warning by using compound statement even if not strictly necessary. */ if ((*p) == ASCII_nul) { - return TRUE; + return true; } else { @@ -485,7 +486,7 @@ extern "C" unsigned int nameKey_isKey (const char *a_, unsigned int _a_high) } } while (! (child == NULL)); } - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -514,7 +515,7 @@ extern "C" void nameKey_writeKey (nameKey_Name key) This function deliberately inlines CAP for speed. */ -extern "C" unsigned int nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2) +extern "C" bool nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2) { nameKey_ptrToChar pi; nameKey_ptrToChar pj; @@ -523,7 +524,7 @@ extern "C" unsigned int nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_ if (key1 == key2) { - return TRUE; + return true; } else { @@ -543,7 +544,7 @@ extern "C" unsigned int nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_ else { /* difference found */ - return FALSE; + return false; } } return c1 == c2; diff --git a/gcc/m2/mc-boot/GnameKey.h b/gcc/m2/mc-boot/GnameKey.h index a2ed40c..6b7998b 100644 --- a/gcc/m2/mc-boot/GnameKey.h +++ b/gcc/m2/mc-boot/GnameKey.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -83,7 +84,7 @@ EXTERN unsigned int nameKey_lengthKey (nameKey_Name key); isKey - returns TRUE if string, a, is currently a key. */ -EXTERN unsigned int nameKey_isKey (const char *a_, unsigned int _a_high); +EXTERN bool nameKey_isKey (const char *a_, unsigned int _a_high); /* writeKey - Display the symbol represented by Key. @@ -96,7 +97,7 @@ EXTERN void nameKey_writeKey (nameKey_Name key); the same. It is case insensitive. */ -EXTERN unsigned int nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2); +EXTERN bool nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2); /* keyToCharStar - returns the C char * string equivalent for, key. diff --git a/gcc/m2/mc-boot/GsymbolKey.cc b/gcc/m2/mc-boot/GsymbolKey.cc index 8c16a63..2920951 100644 --- a/gcc/m2/mc-boot/GsymbolKey.cc +++ b/gcc/m2/mc-boot/GsymbolKey.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -55,7 +56,7 @@ typedef struct symbolKey__T1_r symbolKey__T1; typedef symbolKey__T1 *symbolKey_symbolTree; -typedef unsigned int (*symbolKey_isSymbol_t) (void *); +typedef bool (*symbolKey_isSymbol_t) (void *); struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; }; typedef void (*symbolKey_performOperation_t) (void *); @@ -86,7 +87,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name); isEmptyTree - returns true if symbolTree, t, is empty. */ -extern "C" unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t); +extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t); /* doesTreeContainAny - returns true if symbolTree, t, contains any @@ -96,7 +97,7 @@ extern "C" unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t); left, hence we need two procedures. */ -extern "C" unsigned int symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p); +extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p); /* foreachNodeDo - for each node in symbolTree, t, a procedure, p, @@ -120,7 +121,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym therefore we must skip over it. */ -static unsigned int searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p); +static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p); /* searchAndDo - searches all the nodes in symbolTree, t, and @@ -170,11 +171,11 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym therefore we must skip over it. */ -static unsigned int searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p) +static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p) { if (t == NULL) { - return FALSE; + return false; } else { @@ -361,7 +362,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name) isEmptyTree - returns true if symbolTree, t, is empty. */ -extern "C" unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t) +extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t) { return t->left == NULL; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -377,7 +378,7 @@ extern "C" unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t) left, hence we need two procedures. */ -extern "C" unsigned int symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p) +extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p) { return searchForAny (t->left, p); /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/mc-boot/GsymbolKey.h b/gcc/m2/mc-boot/GsymbolKey.h index 8dc4b63..ab9b1af 100644 --- a/gcc/m2/mc-boot/GsymbolKey.h +++ b/gcc/m2/mc-boot/GsymbolKey.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -58,7 +59,7 @@ typedef struct symbolKey_isSymbol_p symbolKey_isSymbol; typedef struct symbolKey_performOperation_p symbolKey_performOperation; -typedef unsigned int (*symbolKey_isSymbol_t) (void *); +typedef bool (*symbolKey_isSymbol_t) (void *); struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; }; typedef void (*symbolKey_performOperation_t) (void *); @@ -102,7 +103,7 @@ EXTERN void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name); isEmptyTree - returns true if symbolTree, t, is empty. */ -EXTERN unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t); +EXTERN bool symbolKey_isEmptyTree (symbolKey_symbolTree t); /* doesTreeContainAny - returns true if symbolTree, t, contains any @@ -110,7 +111,7 @@ EXTERN unsigned int symbolKey_isEmptyTree (symbolKey_symbolTree t); p, is called with a symbol as its parameter. */ -EXTERN unsigned int symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p); +EXTERN bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p); /* foreachNodeDo - for each node in symbolTree, t, a procedure, p, diff --git a/gcc/m2/mc-boot/Gtermios.h b/gcc/m2/mc-boot/Gtermios.h index 5610db0..6d9a40d 100644 --- a/gcc/m2/mc-boot/Gtermios.h +++ b/gcc/m2/mc-boot/Gtermios.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -177,28 +178,28 @@ EXTERN int termios_tcflowoffo (int fd); if, t, supports, f. */ -EXTERN unsigned int termios_GetFlag (termios_TERMIOS t, termios_Flag f, unsigned int *b); +EXTERN bool termios_GetFlag (termios_TERMIOS t, termios_Flag f, bool *b); /* SetFlag - sets a flag value in, t, to, b, and returns TRUE if this flag value is supported. */ -EXTERN unsigned int termios_SetFlag (termios_TERMIOS t, termios_Flag f, unsigned int b); +EXTERN bool termios_SetFlag (termios_TERMIOS t, termios_Flag f, bool b); /* GetChar - sets a CHAR, ch, value from, t, and returns TRUE if this value is supported. */ -EXTERN unsigned int termios_GetChar (termios_TERMIOS t, termios_ControlChar c, char *ch); +EXTERN bool termios_GetChar (termios_TERMIOS t, termios_ControlChar c, char *ch); /* SetChar - sets a CHAR value in, t, and returns TRUE if, c, is supported. */ -EXTERN unsigned int termios_SetChar (termios_TERMIOS t, termios_ControlChar c, char ch); +EXTERN bool termios_SetChar (termios_TERMIOS t, termios_ControlChar c, char ch); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/Gtop.cc b/gcc/m2/mc-boot/Gtop.cc index 20c9613..6ddd363 100644 --- a/gcc/m2/mc-boot/Gtop.cc +++ b/gcc/m2/mc-boot/Gtop.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Gvarargs.cc b/gcc/m2/mc-boot/Gvarargs.cc index faf7f77..a032ffa 100644 --- a/gcc/m2/mc-boot/Gvarargs.cc +++ b/gcc/m2/mc-boot/Gvarargs.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Gvarargs.h b/gcc/m2/mc-boot/Gvarargs.h index 8af7e15..23c1bfe 100644 --- a/gcc/m2/mc-boot/Gvarargs.h +++ b/gcc/m2/mc-boot/Gvarargs.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc-boot/Gwlists.cc b/gcc/m2/mc-boot/Gwlists.cc index c8daafd..08269df 100644 --- a/gcc/m2/mc-boot/Gwlists.cc +++ b/gcc/m2/mc-boot/Gwlists.cc @@ -22,6 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "config.h" #include "system.h" +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -130,7 +131,7 @@ extern "C" void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsign isItemInList - returns true if a WORD, c, was found in wlist, l. */ -extern "C" unsigned int wlists_isItemInList (wlists_wlist l, unsigned int c); +extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c); /* foreachItemInListDo - calls procedure, P, foreach item in wlist, l. @@ -338,11 +339,11 @@ extern "C" void wlists_removeItemFromList (wlists_wlist l, unsigned int c) { wlists_wlist p; unsigned int i; - unsigned int found; + bool found; if (l != NULL) { - found = FALSE; + found = false; p = NULL; do { i = 1; @@ -352,7 +353,7 @@ extern "C" void wlists_removeItemFromList (wlists_wlist l, unsigned int c) } if ((i <= l->noOfElements) && (l->elements.array[i-1] == c)) { - found = TRUE; + found = true; } else { @@ -395,7 +396,7 @@ extern "C" void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsign isItemInList - returns true if a WORD, c, was found in wlist, l. */ -extern "C" unsigned int wlists_isItemInList (wlists_wlist l, unsigned int c) +extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c) { unsigned int i; @@ -405,7 +406,7 @@ extern "C" unsigned int wlists_isItemInList (wlists_wlist l, unsigned int c) { if (l->elements.array[i-1] == c) { - return TRUE; + return true; } else { @@ -414,7 +415,7 @@ extern "C" unsigned int wlists_isItemInList (wlists_wlist l, unsigned int c) } l = l->next; } while (! (l == NULL)); - return FALSE; + return false; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/Gwlists.h b/gcc/m2/mc-boot/Gwlists.h index 0a3199a..afb6949 100644 --- a/gcc/m2/mc-boot/Gwlists.h +++ b/gcc/m2/mc-boot/Gwlists.h @@ -29,6 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); @@ -118,7 +119,7 @@ EXTERN void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsigned i isItemInList - returns true if a WORD, c, was found in wlist, l. */ -EXTERN unsigned int wlists_isItemInList (wlists_wlist l, unsigned int c); +EXTERN bool wlists_isItemInList (wlists_wlist l, unsigned int c); /* foreachItemInListDo - calls procedure, P, foreach item in wlist, l. diff --git a/gcc/m2/mc-boot/Gwrapc.h b/gcc/m2/mc-boot/Gwrapc.h index 2e34838..27a716f 100644 --- a/gcc/m2/mc-boot/Gwrapc.h +++ b/gcc/m2/mc-boot/Gwrapc.h @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # ifdef __cplusplus extern "C" { # endif +#include <stdbool.h> # if !defined (PROC_D) # define PROC_D typedef void (*PROC_t) (void); diff --git a/gcc/m2/mc/decl.mod b/gcc/m2/mc/decl.mod index ab93fe0..856c717 100644 --- a/gcc/m2/mc/decl.mod +++ b/gcc/m2/mc/decl.mod @@ -33,7 +33,8 @@ FROM StringConvert IMPORT CardinalToString, ostoc ; FROM mcOptions IMPORT getOutputFile, getDebugTopological, getHPrefix, getIgnoreFQ, getExtendedOpaque, writeGPLheader, getGccConfigSystem, - getScaffoldDynamic, getScaffoldMain, getSuppressNoReturn ; + getScaffoldDynamic, getScaffoldMain, getSuppressNoReturn, + useBool ; FROM FormatStrings IMPORT Sprintf0, Sprintf1, Sprintf2, Sprintf3 ; FROM libc IMPORT printf, memset ; @@ -6306,7 +6307,12 @@ END outNull ; PROCEDURE outTrue (p: pretty) ; BEGIN keyc.useTrue ; - outText (p, 'TRUE') + IF useBool () AND (lang = ansiCP) + THEN + outText (p, 'true') + ELSE + outText (p, 'TRUE') + END END outTrue ; @@ -6317,7 +6323,12 @@ END outTrue ; PROCEDURE outFalse (p: pretty) ; BEGIN keyc.useFalse ; - outText (p, 'FALSE') + IF useBool () AND (lang = ansiCP) + THEN + outText (p, 'false') + ELSE + outText (p, 'FALSE') + END END outFalse ; @@ -7835,6 +7846,21 @@ END isBase ; (* + doBoolC - +*) + +PROCEDURE doBoolC (p: pretty) ; +BEGIN + IF useBool () + THEN + outText (p, 'bool') + ELSE + outText (p, 'unsigned int') + END +END doBoolC ; + + +(* doBaseC - *) @@ -7856,7 +7882,7 @@ BEGIN longreal : outText (p, 'long double') | shortreal : outText (p, 'float') | bitset : outText (p, 'unsigned int') | - boolean : outText (p, 'unsigned int') | + boolean : doBoolC (p) | proc : outText (p, 'PROC') END ; diff --git a/gcc/m2/mc/keyc.mod b/gcc/m2/mc/keyc.mod index a57103b..bf6d961 100644 --- a/gcc/m2/mc/keyc.mod +++ b/gcc/m2/mc/keyc.mod @@ -26,7 +26,7 @@ FROM DynamicStrings IMPORT InitString, KillString, ConCat, ConCatChar, Mark, string, InitStringCharStar ; FROM symbolKey IMPORT symbolTree, getSymKey, putSymKey, initTree, killTree ; FROM nameKey IMPORT makeKey, makekey, keyToCharStar ; -FROM mcOptions IMPORT getHPrefix, getGccConfigSystem ; +FROM mcOptions IMPORT getHPrefix, getGccConfigSystem, useBool ; TYPE @@ -735,12 +735,26 @@ END fixNullPointerConst ; (* + genBool - +*) + +PROCEDURE genBool (p: pretty) ; +BEGIN + IF useBool () + THEN + print (p, '#include <stdbool.h>\n') ; + END +END genBool ; + + +(* genDefs - generate definitions or includes for all macros and prototypes used. *) PROCEDURE genDefs (p: pretty) ; BEGIN + genBool (p) ; checkFreeMalloc (p) ; checkProc (p) ; checkTrue (p) ; diff --git a/gcc/m2/mc/mcOptions.def b/gcc/m2/mc/mcOptions.def index a0284f4..a814f83 100644 --- a/gcc/m2/mc/mcOptions.def +++ b/gcc/m2/mc/mcOptions.def @@ -148,4 +148,11 @@ PROCEDURE setSuppressNoReturn (value: BOOLEAN) ; PROCEDURE getSuppressNoReturn () : BOOLEAN ; +(* + useBool - should mc use the bool type instead of int. +*) + +PROCEDURE useBool () : BOOLEAN ; + + END mcOptions. diff --git a/gcc/m2/mc/mcOptions.mod b/gcc/m2/mc/mcOptions.mod index d2837fb..9c439ed 100644 --- a/gcc/m2/mc/mcOptions.mod +++ b/gcc/m2/mc/mcOptions.mod @@ -47,6 +47,7 @@ VAR arrayRuntime, returnRuntime, suppressNoReturn, + useBoolType, gccConfigSystem, ignoreFQ, debugTopological, @@ -583,6 +584,16 @@ END getScaffoldMain ; (* + useBool - should mc use the bool type instead of int. +*) + +PROCEDURE useBool () : BOOLEAN ; +BEGIN + RETURN useBoolType +END useBool ; + + +(* optionIs - returns TRUE if the first len (right) characters match left. *) @@ -759,6 +770,7 @@ BEGIN scaffoldMain := FALSE ; scaffoldDynamic := FALSE ; suppressNoReturn := FALSE ; + useBoolType := TRUE ; hPrefix := InitString ('') ; cppArgs := InitString ('') ; cppProgram := InitString ('') ; diff --git a/gcc/testsuite/gm2/pimlib/run/pass/limittests.mod b/gcc/testsuite/gm2/pimlib/run/pass/limittests.mod index 92b7889..12303ea 100644 --- a/gcc/testsuite/gm2/pimlib/run/pass/limittests.mod +++ b/gcc/testsuite/gm2/pimlib/run/pass/limittests.mod @@ -44,7 +44,7 @@ VAR BEGIN r := 0 ; a := 1.0 / 0.0 ; - IF NOT isfinite (a) + IF isfinite (a) = 0 THEN printf ("detected infinite number\n") ELSE @@ -52,7 +52,7 @@ BEGIN r := 1 END ; a := 1.0 / 1.0 ; - IF isfinite (a) + IF isfinite (a) = 1 THEN printf ("detected finite number\n") ELSE @@ -64,5 +64,4 @@ BEGIN printf ("all tests passed\n") END ; exit (r) - END limittests. |