diff: fix mdemangle for functors.

Tyson Richard DOWD trd at hydra.cs.mu.oz.au
Thu Jun 5 12:47:17 AEST 1997


Hi,

Here's another change.

===================================================================

Estimated hours taken: 0.3

util/mdemangle.c:
	Fix mdemangle to handle `base_type_functors'.

tests/misc_tests/mdemangle_test.inp:
	Add a test case for `base_type_functors'.

Index: util/mdemangle.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/util/mdemangle.c,v
retrieving revision 1.17
diff -u -r1.17 mdemangle.c
--- mdemangle.c	1997/05/14 11:48:58	1.17
+++ mdemangle.c	1997/06/05 02:37:29
@@ -97,6 +97,7 @@
 	static const char mercury_data[] = "mercury_data_";
 	static const char base_type_layout[] = "base_type_layout_";
 	static const char base_type_info[] = "base_type_info_";
+	static const char base_type_functors[] = "base_type_functors_";
 	static const char common[] = "common";
 
 	char *start = name;
@@ -111,7 +112,7 @@
 	bool higher_order = FALSE; /* has this proc been specialized */
 	int internal = -1;
 	enum { ORDINARY, UNIFY, COMPARE, INDEX } category;
-	enum { COMMON, INFO, LAYOUT } data_category;
+	enum { COMMON, INFO, LAYOUT, FUNCTORS } data_category;
 
 	/*
 	** skip any leading underscore inserted by the C compiler
@@ -339,6 +340,11 @@
 		if (!cut_trailing_underscore_integer(start, &end, &arity)) {
 			goto wrong_format;
 		}
+	} else if (strip_prefix(&start, base_type_functors)) {
+		data_category = FUNCTORS;
+		if (!cut_trailing_underscore_integer(start, &end, &arity)) {
+			goto wrong_format;
+		}
 	} else if (strip_prefix(&start, common)) {
 		data_category = COMMON;
 		if (!cut_trailing_underscore_integer(start, &end, &arity)) {
@@ -367,6 +373,15 @@
 				start, arity);
 		} else {
 			printf("<type layout for type '%s:%s'/%d>",
+				type_module, start, arity);
+		}
+		break;
+	case FUNCTORS:
+		if (*type_module == '\0') {
+			printf("<type functors for type '%s'/%d>",
+				start, arity);
+		} else {
+			printf("<type functors for type '%s:%s'/%d>",
 				type_module, start, arity);
 		}
 		break;
Index: tests/misc_tests/mdemangle_test.inp
===================================================================
RCS file: /home/staff/zs/imp/tests/misc_tests/mdemangle_test.inp,v
retrieving revision 1.4
diff -u -r1.4 mdemangle_test.inp
--- mdemangle_test.inp	1997/05/14 11:49:34	1.4
+++ mdemangle_test.inp	1997/06/05 02:32:35
@@ -14,6 +14,10 @@
 mercury_data_mercury_builtin__base_type_layout_term__context_0
 <type layout for type 'mercury_builtin:term__context'/0>
 
+	a base type functors
+mercury_data_eliza__base_type_functors_message_0
+<type functors for type 'eliza:message'/0>
+
 	an unqualified base type info
 mercury_data___base_type_info_int_0
 <base type_info for type 'int'/0>




More information about the developers mailing list