[m-rev.] for review: more namespace cleanliness changes

Simon Taylor stayl at cs.mu.OZ.AU
Sat Feb 16 02:05:00 AEDT 2002


The full diff (/home/earth/stayl/MR_diff) for this change
is a bit large to post, and is mostly trivial.

Simon.



Estimated hours taken: 4
Branches: main

Add MR_ prefixes to the remaining non-prefixed symbols.

runtime/mercury_std.h:
	Add MR_ prefixes to bool, TRUE, FALSE, max, min,
	streq, strdiff, strtest, strntest, strneq, strndiff,
	strntest, NO_RETURN.

	Delete a commented out definition of `reg'.

runtime/mercury_tags.h:
	Add an MR_ prefix to TAGBITS.

configure.in:
runtime/mercury_goto.h:
runtime/machdeps/i386_regs.h/mercury_goto.h:
	Add an MR_ prefix to PIC.

runtime/mercury_conf_param.h:
	Allow non-prefixed PIC and HIGHTAGS to be defined on
	the command line. 

runtime/mercury_bootstrap.h:
	Add backwards compatibility definitions.

RESERVED_MACRO_NAMES:
	Remove the renamed macros.

*/*.c:
*/*.h:
*/*.m:
	Add MR_ prefixes.

compiler/export.m:
compiler/ml_code_gen.m:
	Use MR_bool rather than MR_Bool (I think MR_Bool is
	meant to be for references to the Mercury type
	bool__bool).

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.298
diff -u -u -r1.298 configure.in
--- configure.in	14 Feb 2002 19:00:14 -0000	1.298
+++ configure.in	15 Feb 2002 05:46:18 -0000
@@ -2372,7 +2372,7 @@
 EXE_RPATH_SEP=" -Wl,-rpath,"
 SHLIB_RPATH_OPT="-Wl,-rpath,"
 SHLIB_RPATH_SEP=" -Wl,-rpath,"
-CFLAGS_FOR_PIC="-fpic -DPIC"
+CFLAGS_FOR_PIC="-fpic -DMR_PIC"
 EXT_FOR_PIC_OBJECTS=pic_o
 EXT_FOR_SHARED_LIB=$LIB_SUFFIX
 USE_DLLS=no
@@ -2447,7 +2447,7 @@
 		EXE_RPATH_SEP=" -R"
 		SHLIB_RPATH_OPT="-R"
 		SHLIB_RPATH_SEP=" -R"
-		CFLAGS_FOR_PIC="-fpic -DPIC"	# used only for libgc.{a,so}
+		CFLAGS_FOR_PIC="-fpic -DMR_PIC"	# used only for libgc.{a,so}
 		EXT_FOR_PIC_OBJECTS=o
 		#
 		# Note that despite the above definition of CFLAGS_FOR_PIC,
@@ -2471,7 +2471,7 @@
 		# passes `-z text' to the linker, which causes it to
 		# report an error if any runtime fixups would be needed.
 		#
-		# If you *do* use `-fpic', you must also use `-DPIC'.
+		# If you *do* use `-fpic', you must also use `-DMR_PIC'.
 		#
 		# See runtime/mercury_goto.h for the code that handles PIC
 		# on SPARCs.
Index: runtime/mercury_std.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_std.h,v
retrieving revision 1.19
diff -u -u -r1.19 mercury_std.h
--- runtime/mercury_std.h	27 Dec 2001 13:17:12 -0000	1.19
+++ runtime/mercury_std.h	15 Feb 2002 05:49:39 -0000
@@ -6,7 +6,7 @@
 
 /*
 ** std.h - "standard" [sic] definitions for C:
-**	bool, TRUE, FALSE, min(), max(), streq(), etc.
+**	MR_bool, MR_TRUE, MR_FALSE, MR_min(), MR_max(), MR_streq(), etc.
 */
 
 #ifndef MERCURY_STD_H
@@ -27,33 +27,10 @@
   #include "safe-ctype.h"
 #endif
 
-#if 0
-#ifndef	reg
-#define	reg		register
-#endif
-#endif
-
-#ifdef IN_GCC
-  /*
-  ** We need to make sure that we pick up GCC's definition of bool, 
-  ** to ensure that we don't define `bool' below.  Otherwise we get
-  ** conflicts because some declarations use the <stdbool.h> definition
-  ** of bool (an enum), and some use our definition (a #define for char)
-  */
-  #include "config.h"
-  #include "system.h"
-#endif
+#define	MR_bool		char
 
-#ifndef	bool
-#define	bool		char
-#endif
-
-#ifndef max
-#define	max(a, b)	((a) > (b) ? (a) : (b))
-#endif
-#ifndef min
-#define	min(a, b)	((a) < (b) ? (a) : (b))
-#endif
+#define	MR_max(a, b)	((a) > (b) ? (a) : (b))
+#define	MR_min(a, b)	((a) < (b) ? (a) : (b))
 
 /*
 ** The ANSI C isalnum(), etc. macros require that the argument be cast to
@@ -70,21 +47,17 @@
 #define	MR_isspace(c)		isspace((unsigned char) (c))
 #define	MR_isalnumunder(c)	(isalnum((unsigned char) (c)) || c == '_')
 
-#define streq(s1, s2)		(strcmp(s1, s2) == 0)
-#define strdiff(s1, s2)		(strcmp(s1, s2) != 0)
-#define strtest(s1, s2)		(strcmp(s1, s2))
-#define strneq(s1, s2, n)	(strncmp(s1, s2, n) == 0)
-#define strndiff(s1, s2, n)	(strncmp(s1, s2, n) != 0)
-#define strntest(s1, s2, n)	(strncmp(s1, s2, n))
+#define MR_streq(s1, s2)	(strcmp(s1, s2) == 0)
+#define MR_strdiff(s1, s2)	(strcmp(s1, s2) != 0)
+#define MR_strtest(s1, s2)	(strcmp(s1, s2))
+#define MR_strneq(s1, s2, n)	(strncmp(s1, s2, n) == 0)
+#define MR_strndiff(s1, s2, n)	(strncmp(s1, s2, n) != 0)
+#define MR_strntest(s1, s2, n)	(strncmp(s1, s2, n))
 
-#define	ungetchar(c)		ungetc(c, stdin)
+#define	MR_ungetchar(c)		ungetc(c, stdin)
 
-#ifndef	TRUE
-#define	TRUE		1
-#endif
-#ifndef	FALSE
-#define	FALSE		0
-#endif
+#define	MR_TRUE		1
+#define	MR_FALSE	0
 
 /*
 ** For speed, turn assertions off,
@@ -204,9 +177,9 @@
 /* A macro for declaring functions that never return */
 
 #if __GNUC__
-  #define NO_RETURN __attribute__((noreturn))
+  #define MR_NO_RETURN __attribute__((noreturn))
 #else
-  #define NO_RETURN
+  #define MR_NO_RETURN
 #endif
 
 /*---------------------------------------------------------------------------*/
Index: runtime/mercury_tags.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tags.h,v
retrieving revision 1.15
diff -u -u -r1.15 mercury_tags.h
--- runtime/mercury_tags.h	13 Feb 2002 09:56:42 -0000	1.15
+++ runtime/mercury_tags.h	15 Feb 2002 05:49:39 -0000
@@ -20,40 +20,43 @@
 
 #define	MR_WORDBITS	(CHAR_BIT * sizeof(MR_Word))
 
-/* TAGBITS specifies the number of bits in each word that we can use for tags */
-#ifndef TAGBITS
-  #ifdef HIGHTAGS
-    #error "HIGHTAGS defined but TAGBITS undefined"
+/*
+** MR_TAGBITS specifies the number of bits in each word
+** that we can use for tags.
+*/
+#ifndef MR_TAGBITS
+  #ifdef MR_HIGHTAGS
+    #error "MR_HIGHTAGS defined but MR_TAGBITS undefined"
   #else
-    #define TAGBITS	MR_LOW_TAG_BITS
+    #define MR_TAGBITS	MR_LOW_TAG_BITS
   #endif
 #endif
 
-#if TAGBITS > 0 && defined(HIGHTAGS) && defined(MR_CONSERVATIVE_GC)
+#if MR_TAGBITS > 0 && defined(MR_HIGHTAGS) && defined(MR_CONSERVATIVE_GC)
   #error "Conservative GC does not work with high tag bits"
 #endif
 
-#ifdef	HIGHTAGS
+#ifdef	MR_HIGHTAGS
 
-#define	MR_mktag(t)	((MR_Word)(t) << (WORDBITS - TAGBITS))
-#define	MR_unmktag(w)	((MR_Word)(w) >> (WORDBITS - TAGBITS))
-#define	MR_tag(w)	((w) & ~(~(MR_Word)0 >> TAGBITS))
+#define	MR_mktag(t)	((MR_Word)(t) << (MR_WORDBITS - MR_TAGBITS))
+#define	MR_unmktag(w)	((MR_Word)(w) >> (MR_WORDBITS - MR_TAGBITS))
+#define	MR_tag(w)	((w) & ~(~(MR_Word)0 >> MR_TAGBITS))
 #define	MR_mkbody(i)	(i)
 #define	MR_unmkbody(w)	(w)
-#define	MR_body(w, t)	((w) & (~(MR_Word)0 >> TAGBITS))
-#define	MR_strip_tag(w)	((w) & (~(MR_Word)0 >> TAGBITS))
+#define	MR_body(w, t)	((w) & (~(MR_Word)0 >> MR_TAGBITS))
+#define	MR_strip_tag(w)	((w) & (~(MR_Word)0 >> MR_TAGBITS))
 
-#else /* ! HIGHTAGS */
+#else /* ! MR_HIGHTAGS */
 
 #define	MR_mktag(t)	(t)
 #define	MR_unmktag(w)	(w)
-#define	MR_tag(w)	((w) & ((1 << TAGBITS) - 1))
-#define	MR_mkbody(i)	((i) << TAGBITS)
-#define	MR_unmkbody(w)	((MR_Word) (w) >> TAGBITS)
+#define	MR_tag(w)	((w) & ((1 << MR_TAGBITS) - 1))
+#define	MR_mkbody(i)	((i) << MR_TAGBITS)
+#define	MR_unmkbody(w)	((MR_Word) (w) >> MR_TAGBITS)
 #define	MR_body(w, t)	((MR_Word) (w) - (t))
-#define	MR_strip_tag(w)	((w) & (~(MR_Word)0 << TAGBITS))
+#define	MR_strip_tag(w)	((w) & (~(MR_Word)0 << MR_TAGBITS))
 
-#endif /* ! HIGHTAGS */
+#endif /* ! MR_HIGHTAGS */
 
 /*
 ** the result of MR_mkword() is cast to (MR_Word *), not to (MR_Word)
@@ -95,7 +98,7 @@
   #define MR_FIRST_UNRESERVED_RAW_TAG  0
 #endif
 
-#if TAGBITS == 0 && \
+#if MR_TAGBITS == 0 && \
 	(MR_NUM_RESERVED_ADDRESSES > 0 || MR_NUM_RESERVED_OBJECTS > 0)
   /*
   ** In this case, we represent the empty list as a reserved address,
@@ -118,18 +121,18 @@
 
 #define	MR_UNIV_TAG		MR_mktag(MR_RAW_UNIV_TAG)
 
-#if TAGBITS > 0 || (TAGBITS == 0 && \
+#if MR_TAGBITS > 0 || (MR_TAGBITS == 0 && \
 	(MR_NUM_RESERVED_ADDRESS > 0 || MR_NUM_RESERVED_OBJECTS > 0))
   /*
   ** Cons cells are represented using two words.
   */
-  #if TAGBITS == 0 && MR_NUM_RESERVED_ADDRESSES > 0
+  #if MR_TAGBITS == 0 && MR_NUM_RESERVED_ADDRESSES > 0
     /*
     ** We represent empty lists as null pointers.
     */
     #define MR_list_empty()		((MR_Word) NULL)
     #define MR_list_is_empty(list)	((list) == MR_list_empty())
-  #elif TAGBITS == 0 && MR_NUM_RESERVED_OBJECTS > 0
+  #elif MR_TAGBITS == 0 && MR_NUM_RESERVED_OBJECTS > 0
     /*
     ** We represent empty lists as the address of a reserved object,
     ** which will be generated by the compiler in the code for library/list.m.
@@ -161,7 +164,7 @@
 
 #else
   /*
-  ** TAGBITS == 0 && 
+  ** MR_TAGBITS == 0 && 
   ** MR_NUM_RESERVED_ADDRESS == 0 &&
   ** MR_NUM_RESERVED_OBJECTS == 0
   **
Index: runtime/mercury_goto.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.32
diff -u -u -r1.32 mercury_goto.h
--- runtime/mercury_goto.h	13 Feb 2002 09:56:40 -0000	1.32
+++ runtime/mercury_goto.h	15 Feb 2002 05:49:39 -0000
@@ -193,11 +193,11 @@
   ** set up the correct value of the GOT register (ebx).
   */
 
-  #if (defined(__pic__) || defined(__PIC__)) && !defined(PIC)
-    #define PIC 1
+  #if (defined(__pic__) || defined(__PIC__)) && !defined(MR_PIC)
+    #define MR_PIC 1
   #endif
 
-  #if PIC
+  #if MR_PIC
 
     /*
     ** At each entry point, where we may have been jump to from
@@ -262,7 +262,7 @@
   	goto MR_skip(label);
     #endif
 
-  #endif /* PIC */
+  #endif /* MR_PIC */
 
   /* For Linux-ELF shared libraries, we need to declare that the type of labels
   ** is @function (i.e. code, not data), otherwise the dynamic linker seems
@@ -281,11 +281,11 @@
   ** set up the correct value of the GOT register (l7).
   */
 
-  #if (defined(__pic__) || defined(__PIC__)) && !defined(PIC)
-    #define PIC 1
+  #if (defined(__pic__) || defined(__PIC__)) && !defined(MR_PIC)
+    #define MR_PIC 1
   #endif
 
-  #if PIC
+  #if MR_PIC
 
     /*
     ** At each entry point, where we may have been jump to from
@@ -324,7 +324,7 @@
   	goto MR_skip(label);
     #endif
 
-  #endif /* PIC */
+  #endif /* MR_PIC */
 
   /*
   ** For Solaris 5.5.1, we need to declare that the type of labels is
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.52
diff -u -u -r1.52 mercury_conf_param.h
--- runtime/mercury_conf_param.h	11 Feb 2002 12:11:43 -0000	1.52
+++ runtime/mercury_conf_param.h	15 Feb 2002 06:02:57 -0000
@@ -55,6 +55,7 @@
 ** MR_SPLIT_C_FILES
 ** MR_INLINE_ALLOC
 ** MR_PIC_REG
+** MR_HIGHTAGS
 **	See the documentation for
 **		--high-level-code
 **		--high-level-data
@@ -70,9 +71,15 @@
 **		--reserve-tag
 **		--use-minimal-model
 **		--split-c-files
+**		--inline-alloc
 **		--pic-reg
+**		--tags
 **	(respectively) in the mmc help message or the Mercury User's Guide.
 **
+** MR_PIC
+**	The generated object code must be position independent.
+**	See runtime/mercury_goto.h.
+**
 ** MR_USE_SINGLE_PREC_FLOAT:
 **	Use C's `float' rather than C's `double' for the
 **	Mercury floating point type (`MR_Float').
@@ -155,6 +162,19 @@
 #ifdef PIC_REG
   #define MR_PIC_REG 1
   #undef PIC_REG
+#endif
+/*
+** XXX mercury_goto.h checks the value of MR_PIC, not whether
+** it is defined, so this won't work if -DPIC=0 is passed
+** on the command line. mmake/mercury_compile don't do that.
+*/
+#ifdef PIC
+  #define MR_PIC 1
+  #undef PIC
+#endif
+#ifdef HIGHTAGS
+  #define MR_HIGHTAGS 1
+  #undef HIGHTAGS
 #endif
 
 /*
Index: runtime/mercury_bootstrap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
retrieving revision 1.23
diff -u -u -r1.23 mercury_bootstrap.h
--- runtime/mercury_bootstrap.h	11 Jan 2002 04:43:31 -0000	1.23
+++ runtime/mercury_bootstrap.h	15 Feb 2002 05:49:39 -0000
@@ -16,8 +16,7 @@
 #define	MERCURY_BOOTSTRAP_H
 
 /*
-** This stuff is enabled by default,
-** but you can disable it by defining MR_NO_BACKWARDS_COMPAT.
+** This stuff is required for bootstrapping, and can't be disabled yet.
 */
 
 /*
@@ -28,6 +27,38 @@
 #define MR_TypeCtorInfo_struct  MR_TypeCtorInfo_Struct
 #define MR_NewTypeCtorInfo_struct  MR_TypeCtorInfo_Struct
 
+/*
+** bool, TRUE and FALSE appear in the generated code.
+** Once the installed compilers no longer generate these, they should
+** be moved into the `#ifndef MR_NO_BACKWARDS_COMPAT' section.
+*/
+#ifdef IN_GCC
+  /*
+  ** We need to make sure that we pick up GCC's definition of bool, 
+  ** to ensure that we don't define `bool' below.  Otherwise we get
+  ** conflicts because some declarations use the <stdbool.h> definition
+  ** of bool (an enum), and some use our definition (a #define for char)
+  */
+  #include "config.h"
+  #include "system.h"
+#endif
+
+#ifndef bool
+#define bool			MR_bool
+#endif
+
+#ifndef TRUE
+#define TRUE			MR_TRUE
+#endif
+#ifndef FALSE
+#define FALSE			MR_FALSE
+#endif
+
+/*
+** This stuff is enabled by default,
+** but you can disable it by defining MR_NO_BACKWARDS_COMPAT.
+*/
+
 #ifndef MR_NO_BACKWARDS_COMPAT
 
 /* 
@@ -68,6 +99,25 @@
 #define	list_empty()		MR_list_empty()
 #define	list_cons(h, t)		MR_list_cons((h), (t))
 
+/* Stuff from mercury_std.h */
+#define streq(s1, s2)		MR_streq(s1, s2)
+#define strdiff(s1, s2)		MR_strdiff(s1, s2)
+#define strtest(s1, s2)		MR_strtest(s1, s2)
+#define strneq(s1, s2, n)	MR_strneq(s1, s2, n)
+#define strndiff(s1, s2, n)	MR_strndiff(s1, s2, n)
+#define strntest(s1, s2, n)	MR_strntest(s1, s2, n)
+
+#ifndef max
+#define max(a, b)		MR_max(a, b)
+#endif
+#ifndef min
+#define min(a, b)		MR_min(a, b)
+#endif
+
+#ifndef NO_RETURN
+#define NO_RETURN		MR_NO_RETURN
+#endif
+
 #endif	/* !MR_NO_BACKWARDS_COMPAT */
 
 /*---------------------------------------------------------------------------*/
@@ -382,6 +432,7 @@
 
 /* stuff from mercury_tags.h */
 
+#define	TAGBITS			MR_TAGBITS
 #define	WORDBITS		MR_WORDBITS
 
 #define	mktag(t)		MR_mktag(t)
Index: runtime/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/RESERVED_MACRO_NAMES,v
retrieving revision 1.10
diff -u -u -r1.10 RESERVED_MACRO_NAMES
--- runtime/RESERVED_MACRO_NAMES	13 Feb 2002 09:56:37 -0000	1.10
+++ runtime/RESERVED_MACRO_NAMES	15 Feb 2002 06:13:25 -0000
@@ -24,32 +24,10 @@
 # and defined by mercury_types.h.
 SUCCESS_INDICATOR
 #-----------------------------------------------------------------------------#
-# These are defined by mercury_std.h
-# XXX we should probably add MR_ prefixes to all of these,
-# especially the str* ones, which violate the ANSI/ISO C standard.
-bool
-TRUE
-FALSE
-strdiff
-streq
-strndiff
-strneq
-strntest
-strtest
-ungetchar
-max
-min
-reg
-NO_RETURN
-#-----------------------------------------------------------------------------#
-# These are configuration parameters that are defined
-# by mercury_conf.h and/or mercury_conf_param.h and/or
-# on the command-line or by scripts/mgnuc.
-# XXX we ought to add MR_ prefixes to all of these.
-# XXX TAG_BITS is defined in mercury_tags.h
+# pid_t is only defined in mercury_conf.h if it is not present
+# in the system headers. I don't think there is a nice way to
+# prefix this without requiring a later version of autoconf (e.g. 2.52).
 pid_t
-PIC
-TAG_BITS
 #-----------------------------------------------------------------------------#
 # These are defined by mercury.h
 # Normally macros should start with capital letters,
Index: runtime/machdeps/i386_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/i386_regs.h,v
retrieving revision 1.20
diff -u -u -r1.20 i386_regs.h
--- runtime/machdeps/i386_regs.h	13 Feb 2002 09:56:45 -0000	1.20
+++ runtime/machdeps/i386_regs.h	13 Feb 2002 12:46:37 -0000
@@ -41,14 +41,14 @@
 /*
 ** Are we using PIC?
 */
-#if (defined(__PIC__) || defined(__pic__)) && !defined(PIC)
-  #define PIC 1
+#if (defined(__PIC__) || defined(__pic__)) && !defined(MR_PIC)
+  #define MR_PIC 1
 #endif
 
 /*
 ** Should we keep the GOT register (ebx) free for PIC code?
 */
-#if PIC && !defined(MR_PIC_REG)
+#if MR_PIC && !defined(MR_PIC_REG)
   #define MR_PIC_REG 1
 #endif
 
Index: compiler/export.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/export.m,v
retrieving revision 1.50
diff -u -u -r1.50 export.m
--- compiler/export.m	6 Nov 2001 15:20:40 -0000	1.50
+++ compiler/export.m	15 Feb 2002 06:32:21 -0000
@@ -118,7 +118,7 @@
 	% MR_declare_entry(<label of called proc>); /* or MR_declare_static */
 	%
 	% #if SEMIDET
-	%   bool
+	%   MR_bool
 	% #elif FUNCTION
 	%   MR_Word
 	% #else
@@ -135,7 +135,7 @@
 	%	MR_Word retval;
 	% #endif
 	% #if MR_THREAD_SAFE
-	% 	MR_Bool must_finalize_engine;
+	% 	MR_bool must_finalize_engine;
 	% #endif 
 	% #if MR_DEEP_PROFILING
 	%	MR_CallSiteDynamic *saved_call_site_addr
@@ -174,7 +174,8 @@
 	%		/* by the C function call MR_call_engine().       */
 	%	MR_save_transient_registers();
 	%
-	%	(void) MR_call_engine(MR_ENTRY(<label of called proc>), FALSE);
+	%	(void) MR_call_engine(MR_ENTRY(<label of called proc>),
+	%			MR_FALSE);
 	%
 	%		/* restore the registers which may have been      */
 	%		/* clobbered by the return from the C function    */
@@ -187,7 +188,7 @@
 	% #if SEMIDET
 	%	if (!MR_r1) {
 	%		MR_restore_regs_from_mem(c_regs);
-	%		return FALSE;
+	%		return MR_FALSE;
 	%	}
 	% #elif FUNCTION
 	%	<copy return value register into retval>
@@ -200,7 +201,7 @@
 	% #endif 
 	%	MR_restore_regs_from_mem(c_regs);
 	% #if SEMIDET
-	%	return TRUE;
+	%	return MR_TRUE;
 	% #elif FUNCTION
 	%	return retval;
 	% #endif
@@ -236,7 +237,7 @@
 				"\tMR_Word c_regs[MR_NUM_REAL_REGS];\n",
 				"#endif\n",
 				"#if MR_THREAD_SAFE\n",
-				"\tMR_Bool must_finalize_engine;\n", 
+				"\tMR_bool must_finalize_engine;\n", 
 				"#endif\n",
 		"#if MR_DEEP_PROFILING\n",
 		"\tMR_CallSiteDynList **saved_cur_callback;\n",
@@ -257,7 +258,7 @@
 				InputArgs,
 				"\tMR_save_transient_registers();\n",
 				"\t(void) MR_call_engine(MR_ENTRY(",
-					ProcLabelString, "), FALSE);\n",
+					ProcLabelString, "), MR_FALSE);\n",
 				"\tMR_restore_transient_registers();\n",
 		"#if MR_DEEP_PROFILING\n",
 		"\tMR_current_call_site_dynamic = saved_cur_csd;\n",
@@ -356,15 +357,15 @@
 		% which means that for Mercury functions the Mercury return
 		% value becomes the last argument, and the C return value
 		% is a bool that is used to indicate success or failure.
-		C_RetType = "bool",
+		C_RetType = "MR_bool",
 		MaybeDeclareRetval = "",
 		string__append_list([
 			"\tif (!MR_r1) {\n",
 			"\t\tMR_restore_regs_from_mem(c_regs);\n",
-			"\treturn FALSE;\n",
+			"\treturn MR_FALSE;\n",
 			"\t}\n"
 				], MaybeFail),
-		MaybeSucceed = "\treturn TRUE;\n",
+		MaybeSucceed = "\treturn MR_TRUE;\n",
 		ArgInfoTypes2 = ArgInfoTypes0
 	; CodeModel = model_non,
 		% we should probably check this earlier, e.g. in make_hlds.m,
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.108
diff -u -u -r1.108 ml_code_gen.m
--- compiler/ml_code_gen.m	1 Feb 2002 22:09:07 -0000	1.108
+++ compiler/ml_code_gen.m	13 Feb 2002 14:32:26 -0000
@@ -48,7 +48,7 @@
 % CODE GENERATION SUMMARY
 %-----------------------------------------------------------------------------%
 %
-% In each procedure, we declare a local variable `bool succeeded'.
+% In each procedure, we declare a local variable `MR_bool succeeded'.
 % This is used to hold the success status of semidet sub-goals.
 % Note that the comments below show local declarations for the
 % `succeeded' variable in all the places where they would be
@@ -62,8 +62,8 @@
 %		On success, fall through.
 %		(May clobber `succeeded'.)
 %	model_semi goal:
-%		On success, set `succeeded' to TRUE and fall through.
-%		On failure, set `succeeded' to FALSE and fall through.
+%		On success, set `succeeded' to MR_TRUE and fall through.
+%		On failure, set `succeeded' to MR_FALSE and fall through.
 %	multi/nondet goal:
 %		On success, call the current success continuation.
 %		On failure, fall through.
@@ -78,7 +78,7 @@
 %	model_semi goal:
 %		<succeeded = Goal>
 %			This means execute Goal, and set `succeeded' to
-%			TRUE if the goal succeeds and FALSE if it fails.
+%			MR_TRUE if the goal succeeds and MR_FALSE if it fails.
 %	model_non goal:
 %		<Goal && CONT()>
 %			This means execute Goal, calling the success
@@ -126,7 +126,7 @@
 %		<succeeded = Goal>
 %	===>
 %		<do Goal>
-%		succeeded = TRUE;
+%		succeeded = MR_TRUE;
 
 %	det goal in nondet context:
 %		<Goal && SUCCEED()>
@@ -137,7 +137,7 @@
 %	semi goal in nondet context:
 %		<Goal && SUCCEED()>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %	
 %		<succeeded = Goal>
 %		if (succeeded) SUCCEED();
@@ -190,9 +190,9 @@
 %		}
 %		MR_TRY_COMMIT(ref, {
 %			<Goal && success()>
-%			succeeded = FALSE;
+%			succeeded = MR_FALSE;
 %		}, {
-%			succeeded = TRUE;
+%			succeeded = MR_TRUE;
 %		})
 
 %	model_non in semi context: (using catch/throw)
@@ -203,9 +203,9 @@
 %		}
 %		try {
 %			<Goal && success()>
-%			succeeded = FALSE;
+%			succeeded = MR_FALSE;
 %		} catch (COMMIT) {
-%			succeeded = TRUE;
+%			succeeded = MR_TRUE;
 %		}
 
 %	The above is using C++ syntax. Here COMMIT is an exception type,
@@ -222,10 +222,10 @@
 %			longjmp(ref, 1);
 %		}
 %		if (setjmp(ref)) {
-%			succeeded = TRUE;
+%			succeeded = MR_TRUE;
 %		} else {
 %			<Goal && success()>
-%			succeeded = FALSE;
+%			succeeded = MR_FALSE;
 %		}
 
 %	model_non in semi context: (using GNU C nested functions,
@@ -239,10 +239,10 @@
 %			goto commit;
 %		}
 %		<Goal && success()>
-%		succeeded = FALSE;
+%		succeeded = MR_FALSE;
 %		goto commit_done;
 %	commit:
-%		succeeded = TRUE;
+%		succeeded = MR_TRUE;
 %	commit_done:
 %		;
 
@@ -308,7 +308,7 @@
 %	model_semi goal:
 %		<succeeded = true>
 %	===>
-%		succceeded = TRUE;
+%		succceeded = MR_TRUE;
 
 %	model_non goal
 %		<true && CONT()>
@@ -356,7 +356,7 @@
 %	model_semi Goal in model_non conj:
 %		<Goal && Goals>
 % 	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %
 %		<succeeded = Goal>;
 %		if (succeeded) {
@@ -482,7 +482,7 @@
 %	model_semi goal:
 %		<succeeded = fail>
 %	===>
-%		succeeded = FALSE;
+%		succeeded = MR_FALSE;
 
 %	model_non goal:
 %		<fail && CONT()>
@@ -505,7 +505,7 @@
 %	model_semi Goal:
 %		<do (Goal ; Goals)>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %	
 %		<succeeded = Goal>;
 %		if (!succeeded) {
@@ -517,16 +517,16 @@
 %	model_det Goal:
 %		<succeeded = (Goal ; Goals)>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %
 %		<do Goal>
-%		succeeded = TRUE
+%		succeeded = MR_TRUE
 %		/* <Goals> will never be reached */
 
 %	model_semi Goal:
 %		<succeeded = (Goal ; Goals)>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %
 %		<succeeded = Goal>;
 %		if (!succeeded) {
@@ -545,7 +545,7 @@
 %	model_semi Goal:
 %		<(Goal ; Goals) && SUCCEED()>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %	
 %		<succeeded = Goal>
 %		if (succeeded) SUCCEED();
@@ -571,7 +571,7 @@
 %	model_semi Cond:
 %		<(Cond -> Then ; Else)>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %	
 %		<succeeded = Cond>
 %		if (succeeded) {
@@ -590,14 +590,14 @@
 %	model_non Cond:
 %		<(Cond -> Then ; Else)>
 %	===>
-%		bool cond_<N>;
+%		MR_bool cond_<N>;
 %
 %		void then_func() {
-%			cond_<N> = TRUE;
+%			cond_<N> = MR_TRUE;
 %			<Then>
 %		}
 %
-%		cond_<N> = FALSE;
+%		cond_<N> = MR_FALSE;
 %		<Cond && then_func()>
 %		if (!cond_<N>) {
 %			<Else>
@@ -615,16 +615,16 @@
 % model_det negation
 %		<not(Goal)>
 %	===>
-%		bool succeeded;
+%		MR_bool succeeded;
 %		<succeeded = Goal>
 %		/* now ignore the value of succeeded,
-%		   which we know will be FALSE */
+%		   which we know will be MR_FALSE */
 
 % model_semi negation, model_det Goal:
 %		<succeeded = not(Goal)>
 %	===>
 %		<do Goal>
-%		succeeded = FALSE;
+%		succeeded = MR_FALSE;
 
 % model_semi negation, model_semi Goal:
 %		<succeeded = not(Goal)>
@@ -1550,7 +1550,7 @@
 	%	<succeeded = Goal>
 	% ===>
 	%	<do Goal>
-	%	succeeded = TRUE
+	%	succeeded = MR_TRUE
 	%
 	ml_gen_set_success(const(true), Context, SetSuccessTrue),
 	{ MLDS_Statements = list__append(MLDS_Statements0, [SetSuccessTrue]) }.
@@ -1573,7 +1573,7 @@
 	% semi goal in nondet context:
 	%	<Goal && SUCCEED()>
 	% ===>
-	%	bool succeeded;
+	%	MR_bool succeeded;
 	%
 	%	<succeeded = Goal>
 	%	if (succeeded) SUCCEED()
@@ -1612,7 +1612,7 @@
 		%	model_non in semi context: (using try_commit/do_commit)
 		%		<succeeded = Goal>
 		% 	===>
-		%		bool succeeded;
+		%		MR_bool succeeded;
 		%	#ifdef NONDET_COPY_OUT
 		%		<local var decls>
 		%	#endif
@@ -1633,12 +1633,12 @@
 		%
 		%		MR_TRY_COMMIT(ref, {
 		%			<Goal && success()>
-		%			succeeded = FALSE;
+		%			succeeded = MR_FALSE;
 		%		}, {
 		%	#ifdef NONDET_COPY_OUT
 		%			<copy local vars to output args>
 		%	#endif
-		%			succeeded = TRUE;
+		%			succeeded = MR_TRUE;
 		%		})
 		%	#ifdef PUT_COMMIT_IN_OWN_FUNC
 		%	    }
@@ -2119,13 +2119,13 @@
 	%		struct {
 	%			<user's local_vars decls>
 	%		} MR_locals;
-	%		MR_Bool MR_done = FALSE;
-	%		MR_Bool MR_succeeded = FALSE;
+	%		MR_bool MR_done = MR_FALSE;
+	%		MR_bool MR_succeeded = MR_FALSE;
 	%
-	%		#define FAIL		(MR_done = TRUE)
-	%		#define SUCCEED		(MR_succeeded = TRUE)
-	%		#define SUCCEED_LAST	(MR_succeeded = TRUE, \
-	%					 MR_done = TRUE)
+	%		#define FAIL		(MR_done = MR_TRUE)
+	%		#define SUCCEED		(MR_succeeded = MR_TRUE)
+	%		#define SUCCEED_LAST	(MR_succeeded = MR_TRUE, \
+	%					 MR_done = MR_TRUE)
 	%		#define LOCALS		(&MR_locals)
 	%
 	%		<assign input args>
@@ -2188,9 +2188,9 @@
 	% and LOCALS macros
 	%
 	{ string__append_list([
-"	#define FAIL		(MR_done = TRUE)\n",
-"	#define SUCCEED		(MR_succeeded = TRUE)\n",
-"	#define SUCCEED_LAST	(MR_succeeded = TRUE, MR_done = TRUE)\n",
+"	#define FAIL		(MR_done = MR_TRUE)\n",
+"	#define SUCCEED		(MR_succeeded = MR_TRUE)\n",
+"	#define SUCCEED_LAST	(MR_succeeded = MR_TRUE, MR_done = MR_TRUE)\n",
 "	#define LOCALS		(&MR_locals)\n"
 		], HashDefines) },
 	{ string__append_list([
@@ -2234,9 +2234,9 @@
 			user_target_code(LocalVarsDecls, LocalVarsContext, []),
 			raw_target_code("\n", []),
 			raw_target_code("\t} MR_locals;\n", []),
-			raw_target_code("\tMR_Bool MR_succeeded = FALSE;\n",
+			raw_target_code("\tMR_bool MR_succeeded = MR_FALSE;\n",
 				[]),
-			raw_target_code("\tMR_Bool MR_done = FALSE;\n", []),
+			raw_target_code("\tMR_bool MR_done = MR_FALSE;\n", []),
 			raw_target_code("\n", []),
 			raw_target_code(HashDefines, []),
 			raw_target_code("\n", [])],
@@ -2563,7 +2563,7 @@
 	% 	<declaration of locals needed for boxing/unboxing>
 	%	{
 	% 		<declaration of one local variable for each arg>
-	%		MR_Bool SUCCESS_INDICATOR;
+	%		MR_bool SUCCESS_INDICATOR;
 	%
 	%		<assign input args>
 	%		<obtain global lock>
@@ -2661,7 +2661,7 @@
 			[raw_target_code("{\n", [])],
 			HashDefine,
 			ArgDeclsList,
-			[raw_target_code("\tMR_Bool SUCCESS_INDICATOR;\n", []),
+			[raw_target_code("\tMR_bool SUCCESS_INDICATOR;\n", []),
 			raw_target_code("\n", [])],
 			AssignInputsList,
 			[raw_target_code(ObtainLock, []),
@@ -3041,7 +3041,7 @@
 		%	model_semi cond:
 		%		<(Cond -> Then ; Else)>
 		%	===>
-		%		bool succeeded;
+		%		MR_bool succeeded;
 		%	
 		%		<succeeded = Cond>
 		%		if (succeeded) {
@@ -3074,14 +3074,14 @@
 		%	model_non cond:
 		%		<(Cond -> Then ; Else)>
 		%	===>
-		%		bool cond_<N>;
+		%		MR_bool cond_<N>;
 		%
 		%		void then_func() {
-		%			cond_<N> = TRUE;
+		%			cond_<N> = MR_TRUE;
 		%			<Then>
 		%		}
 		%
-		%		cond_<N> = FALSE;
+		%		cond_<N> = MR_FALSE;
 		%		<Cond && then_func()>
 		%		if (!cond_<N>) {
 		%			<Else>
@@ -3156,10 +3156,10 @@
 		%		<not(Goal)>
 		%	===>
 		%	{
-		%		bool succeeded;
+		%		MR_bool succeeded;
 		%		<succeeded = Goal>
 		%		/* now ignore the value of succeeded,
-		%		   which we know will be FALSE */
+		%		   which we know will be MR_FALSE */
 		%	}
 		{ CodeModel = model_det },
 		ml_gen_goal(model_semi, Cond, MLDS_Decls, MLDS_Statements)
@@ -3168,7 +3168,7 @@
 		%		<succeeded = not(Goal)>
 		%	===>
 		%		<do Goal>
-		%		succeeded = FALSE;
+		%		succeeded = MR_FALSE;
 		{ CodeModel = model_semi, CondCodeModel = model_det },
 		ml_gen_goal(model_det, Cond, CondDecls, CondStatements),
 		ml_gen_set_success(const(false), Context, SetSuccessFalse),
@@ -3297,7 +3297,7 @@
 		%		<Goal ; Goals>
 		%	===>
 		%	{
-		%		bool succeeded;
+		%		MR_bool succeeded;
 		%	
 		%		<succeeded = Goal>;
 		%		if (!succeeded) {
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list