[m-dev.] for review: register type_ctor_infos

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Oct 11 14:17:20 AEDT 2000


On 10-Oct-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Apart from that, this change looks fine.  But if you make changes to
> address the comments above, I'd like to see a relative diff.

Here it is.

Zoltan.

--- compiler/rtti_out.m
+++ compiler/rtti_out.m
@@ -693 +693 @@
-		{ Data = base_typeclass_info(ClassId, InstanceString,
+		{ Data = base_typeclass_info(_ClassId, _InstanceString,
@@ -705,0 +706 @@
+		[]
--- runtime/mercury_dlist.h
+++ runtime/mercury_dlist.h
@@ -50,3 +50,3 @@
-		p = (l? MR_dlist_next(l): NULL);			\
-		p != l && p != NULL;					\
-		p = MR_dlist_next(p)					\
+		(p) = ((l)? MR_dlist_next((l)): NULL);			\
+		(p) != (l) && (p) != NULL;				\
+		(p) = MR_dlist_next((p))				\
@@ -56,4 +56,4 @@
-		p1 = (l1? MR_dlist_next(l1): NULL),			\
-			p2 = (l2? MR_dlist_next(l2): NULL);		\
-		p1 != l1 && p1 != NULL && p2 != l2 && p2 != NULL;	\
-		p1 = MR_dlist_next(p1), p2 = MR_dlist_next(p2)		\
+		(p1) = ((l1)? MR_dlist_next((l1)): NULL),		\
+			(p2) = ((l2)? MR_dlist_next((l2)): NULL);	\
+		(p1) != (l1) && (p1) != NULL && (p2) != (l2) && (p2) != NULL;\
+		(p1) = MR_dlist_next((p1)), (p2) = MR_dlist_next((p2))	\
@@ -63,4 +63,4 @@
-		p = (l? MR_dlist_next(l): NULL),			\
-			np = (p? MR_dlist_next(p): NULL);		\
-		p != l && p != NULL;					\
-		p = np, np = (p? MR_dlist_next(p): NULL)		\
+		(p) = ((l)? MR_dlist_next((l)): NULL),			\
+			(np) = ((p)? MR_dlist_next((p)): NULL);		\
+		(p) != (l) && (p) != NULL;				\
+		(p) = (np), (np) = ((p)? MR_dlist_next((p)): NULL)	\
@@ -69 +69 @@
-	(p == l || p == NULL)
+	((p) == (l) || (p) == NULL)
--- mercury_type_tables.c
+++ mercury_type_tables.c
@@ -26,3 +26,4 @@
-#define	names_match(tc1, name, module_name)				\
-	( streq(tc1->type_ctor_name, name)				\
-	&& streq(tc1->type_ctor_module_name, module_name))
+#define	names_match(tc1, module_name, type_name, arity)			\
+	( streq(tc1->type_ctor_name, type_name)				\
+	&& streq(tc1->type_ctor_module_name, module_name)		\
+	&& tc1->arity == arity)
@@ -32 +33,2 @@
-	&& streq(tc1->type_ctor_module_name, tc2->type_ctor_module_name))
+	&& streq(tc1->type_ctor_module_name, tc2->type_ctor_module_name)\
+	&& tc1->arity == tc2->arity )
@@ -63 +65,2 @@
-MR_lookup_type_ctor_info(const char *module_name, const char *name)
+MR_lookup_type_ctor_info(const char *module_name, const char *type_name,
+	int arity)
@@ -69 +72 @@
-	slot = MR_string_hash_lookup_or_add(&MR_type_ctor_table, name);
+	slot = MR_string_hash_lookup_or_add(&MR_type_ctor_table, type_name);
@@ -75 +78,3 @@
-		if (names_match(cur_type_ctor_info, name, module_name)) {
+		if (names_match(cur_type_ctor_info, module_name, type_name,
+			arity))
+		{
--- mercury_type_tables.h
+++ mercury_type_tables.h
@@ -17,0 +18,9 @@
+/*
+** Register the given type_ctor_info in the type table, so that it can be found
+** by later calls to MR_lookup_type_ctor_info.
+**
+** The mercury_<module>_init_type_tables function generated automatically
+** by the Mercury compiler for every module should call this function to
+** register the type_ctor_infos of all the types defined in that module.
+*/
+
@@ -19,0 +29,7 @@
+
+/*
+** Find out if there is a type named type_name defined in module module_name
+** with the given arity. If there is, return its type_ctor_info; if not, return
+** NULL.
+*/
+
@@ -21 +37 @@
-				const char *name);
+				const char *type_name, int arity);
--- runtime/mercury_wrapper.c
+++ runtime/mercury_wrapper.c
@@ -439 +438,0 @@
-		MR_close_prof_decl_file();
@@ -451 +449,0 @@
-		MR_close_prof_decl_file();
--------------------------------------------------------------------------
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