[m-dev.] for review: add MR_ to Word, Integer, String, etc...

Tyson Dowd trd at cs.mu.OZ.AU
Wed Aug 2 17:51:03 AEST 2000


On 01-Aug-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 
> Yes, there should be a comment in runtime/mercury_bootstrap.h
> about that, just like there currently is for the list_* macros.

There have been lots of changes to mercury_bootstrap.h and 
mercury.h as a result of comments. 

Here are the latest diffs for those files (they are small enough that
realtive diffs are probably not that useful).

Index: runtime/mercury_bootstrap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
retrieving revision 1.14
diff -u -r1.14 mercury_bootstrap.h
--- runtime/mercury_bootstrap.h	2000/05/08 13:48:44	1.14
+++ runtime/mercury_bootstrap.h	2000/08/02 05:26:05
@@ -23,8 +23,32 @@
 
 #define MR_TypeCtorInfo_struct  MR_TypeCtorInfo_Struct
 
+
 #ifndef MR_NO_BACKWARDS_COMPAT
 
+/* 
+** For a long time the Mercury C types were defined as Char, Float,
+** Integer, Word, etc.  There will doubtless be lots of C code in
+** libraries that relies upon these names.  
+**
+** People may have written code that relies upon these names, so  
+** if you remove these names you need to give warning (unlike some of
+** the other changes in this file).
+*/
+
+typedef MR_Word 		Word;
+typedef MR_Code 		Code;
+typedef MR_Char 		Char;
+typedef MR_Float 		Float;
+typedef MR_Float64 		Float64;
+typedef MR_Integer 		Integer;
+typedef MR_Unsigned 		Unsigned;
+typedef MR_UnsignedChar 	UnsignedChar;
+typedef MR_String 		String;
+typedef MR_ConstString 		ConstString;
+typedef MR_Bool 		Bool;
+
+
 #define	COMPARE_EQUAL		MR_COMPARE_EQUAL
 #define	COMPARE_LESS		MR_COMPARE_LESS
 #define	COMPARE_GREATER		MR_COMPARE_GREATER
@@ -74,7 +98,7 @@
 #define	decr_sp(n)		MR_decr_sp(n)
 
 #define	push(w)		(					\
-				*MR_sp = (Word) (w),		\
+				*MR_sp = (MR_Word) (w),		\
 				debugpush(*MR_sp, MR_sp),	\
 				MR_sp = MR_sp + 1,		\
 				detstack_overflow_check(),	\



Index: runtime/mercury.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.h,v
retrieving revision 1.14
diff -u -r1.14 mercury.h
--- runtime/mercury.h	2000/07/20 10:39:36	1.14
+++ runtime/mercury.h	2000/08/01 07:15:53
@@ -20,7 +20,7 @@
 
 #include "mercury_conf.h"
 #include "mercury_types.h" 
-#include "mercury_float.h"	/* for the `Float' type */
+#include "mercury_float.h"	/* for the `MR_Float' type */
 #include "mercury_tags.h"
 #include "mercury_grade.h"
 #include "mercury_thread.h"	/* for the MR_*_GLOBAL_LOCK() macros */
@@ -62,30 +62,26 @@
 */
 
 /*
-** The following types are used to represent the Mercury builtin types.
-** See mercury_types.h and mercury_float.h.
+** The types uses to represent the Mercury builtin types,
+** MR_Char, MR_Float, MR_Integer, MR_String, and MR_ConstString,
+** are defined in mercury_types.h and mercury_float.h.
 */
-typedef Char	MR_Char;
-typedef Float	MR_Float;
-typedef Integer	MR_Integer;
-typedef String	MR_String;
-typedef ConstString MR_ConstString;
 
 /*
-** The MR_Box type is used for representing polymorphic types.
+** The MR_Word type, which is used for representing user-defined
+** types when we're using the low-level data representation,
+** is defined in runtime/mercury_types.h.
 */
-typedef void 	*MR_Box;
 
 /*
-** The MR_ClosurePtr type is used for representing higher-order types.
+** The MR_Box type, which is used for representing polymorphic 
+** types, is defined in runtime/mercury_types.h.
 */
-typedef const MR_Closure *MR_ClosurePtr;
 
 /*
-** With the low-level data representation, the MR_Word type
-** is used for representing user-defined types.
+** The MR_ClosurePtr type is used for representing higher-order types.
 */
-typedef Word	MR_Word;
+typedef const MR_Closure *MR_ClosurePtr;
 
 /*
 ** Define some names for types that differ depending
@@ -130,7 +126,7 @@
 */
 typedef struct MR_TypeCtorInfo_Struct	MR_TypeCtorInfo_Struct;
 typedef MR_DuExistLocn			MR_DuExistLocnArray[];
-typedef ConstString			MR_ConstStringArray[];
+typedef MR_ConstString			MR_ConstStringArray[];
 typedef MR_PseudoTypeInfo		MR_PseudoTypeInfoArray[];
 typedef const MR_EnumFunctorDesc *	MR_EnumFunctorDescPtrArray[];
 typedef const MR_DuFunctorDesc *	MR_DuFunctorDescPtrArray[];
@@ -251,7 +247,7 @@
 ** that passes one of these, then we need to generate a reference to
 ** a dummy variable.  We use this variable for that purpose.
 */
-extern	Word	mercury__private_builtin__dummy_var;
+extern	MR_Word	mercury__private_builtin__dummy_var;
 
 /*---------------------------------------------------------------------------*/
 /*

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list