diff: some cleaning up.

Tyson Richard DOWD trd at hydra.cs.mu.oz.au
Wed Jun 4 16:03:21 AEST 1997


I'll commit this as 3 different changes.

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

Estimated hours taken: 0.5

Various bits of cleaning up.

library/io.m:
library/prolog.m:
library/std_util.m:
library/term.m:
tests/hard_coded/expand.m:
	Rename `expand' as `deconstruct'.
	Remove some Term_To_Type predicates (they were all just calls
	to fatal_error anyway).

library/std_util.m:
	Make error messages more standard in layout, make sure they
	refer to ML_expand rather than just expand.

library/std_util.m:
library/mercury_builtin.m:
	Remove some Term_To_Type predicates (they were all just calls
	to fatal_error anyway).

Index: library/io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/io.m,v
retrieving revision 1.122
diff -u -r1.122 io.m
--- io.m	1997/05/26 23:06:10	1.122
+++ io.m	1997/06/04 01:42:40
@@ -1314,7 +1314,7 @@
 :- mode io__write_ordinary_term(in, in, di, uo) is det.
 
 io__write_ordinary_term(Term, Priority) -->
-	{ expand(Term, Functor, _Arity, Args) },
+	{ deconstruct(Term, Functor, _Arity, Args) },
 	io__get_op_table(OpTable),
 	(
 		{ Functor = "." },
@@ -1437,13 +1437,13 @@
 
 io__write_list_tail(Term) -->
 	( 
-		{ expand(Term, ".", _Arity, [ListHead, ListTail]) }
+		{ deconstruct(Term, ".", _Arity, [ListHead, ListTail]) }
 	->
 		io__write_string(", "),
 		io__write_univ(ListHead),
 		io__write_list_tail(ListTail)
 	;
-		{ expand(Term, "[]", _Arity, []) }
+		{ deconstruct(Term, "[]", _Arity, []) }
 	->
 		[]
 	;
Index: library/mercury_builtin.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/mercury_builtin.m,v
retrieving revision 1.74
diff -u -r1.74 mercury_builtin.m
--- mercury_builtin.m	1997/05/20 01:52:48	1.74
+++ mercury_builtin.m	1997/06/04 01:41:37
@@ -772,15 +772,11 @@
 Define_extern_entry(mercury____Unify___mercury_builtin__c_pointer_0_0);
 Define_extern_entry(mercury____Index___mercury_builtin__c_pointer_0_0);
 Define_extern_entry(mercury____Compare___mercury_builtin__c_pointer_0_0);
-Define_extern_entry(mercury____Term_To_Type___mercury_builtin__c_pointer_0_0);
-Define_extern_entry(mercury____Type_To_Term___mercury_builtin__c_pointer_0_0);
 
 BEGIN_MODULE(unify_c_pointer_module)
 	init_entry(mercury____Unify___mercury_builtin__c_pointer_0_0);
 	init_entry(mercury____Index___mercury_builtin__c_pointer_0_0);
 	init_entry(mercury____Compare___mercury_builtin__c_pointer_0_0);
-	init_entry(mercury____Term_To_Type___mercury_builtin__c_pointer_0_0);
-	init_entry(mercury____Type_To_Term___mercury_builtin__c_pointer_0_0);
 
 BEGIN_CODE
 Define_entry(mercury____Unify___mercury_builtin__c_pointer_0_0);
@@ -803,12 +799,6 @@
 			  compare_input1 < compare_input2 ? COMPARE_LESS :
 			  COMPARE_GREATER);
 	proceed();
-
-Define_entry(mercury____Term_To_Type___mercury_builtin__c_pointer_0_0);
-	fatal_error(""cannot convert term to type `c_pointer'"");
-
-Define_entry(mercury____Type_To_Term___mercury_builtin__c_pointer_0_0);
-	fatal_error(""cannot convert type `c_pointer' to term"");
 
 END_MODULE
 
Index: library/prolog.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/prolog.m,v
retrieving revision 1.2
diff -u -r1.2 prolog.m
--- prolog.m	1997/05/21 02:16:19	1.2
+++ prolog.m	1997/06/04 01:43:27
@@ -116,7 +116,7 @@
 % we use a module qualifier here to avoid
 % overriding the builtin Prolog version
 'prolog__=..'(Term, Functor - Args) :-
-	expand(Term, Functor, _Arity, Args).
+	deconstruct(Term, Functor, _Arity, Args).
 
 % we use a module qualifier here to avoid
 % overriding the builtin Prolog version
Index: library/std_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/std_util.m,v
retrieving revision 1.92
diff -u -r1.92 std_util.m
--- std_util.m	1997/05/27 03:57:39	1.92
+++ std_util.m	1997/06/04 01:41:13
@@ -333,11 +333,11 @@
 
 %-----------------------------------------------------------------------------%
 
-	% functor, argument and expand take any type (including univ),
+	% functor, argument and deconstruct take any type (including univ),
 	% and return representation information for that type.
 	%
 	% The string representation of the functor that `functor' and 
-	% `expand' return is:
+	% `deconstruct' return is:
 	% 	- for user defined types, the functor that is given
 	% 	  in the type defintion. For lists, this
 	% 	  means the functors ./2 and []/0 are used, even if
@@ -383,14 +383,14 @@
 	%
 :- func det_argument(T::in, int::in) = (univ::out) is det.
 
-	% expand(Data, Functor, Arity, Arguments) 
+	% deconstruct(Data, Functor, Arity, Arguments) 
 	% 
 	% Given a data item (Data), binds Functor to a string
 	% representation of the functor, Arity to the arity of this data
 	% item, and Arguments to a list of arguments of the functor.
 	% The arguments in the list are each of type univ.
 	%
-:- pred expand(T::in, string::out, int::out, list(univ)::out) is det.
+:- pred deconstruct(T::in, string::out, int::out, list(univ)::out) is det.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -962,28 +962,20 @@
 Define_extern_entry(mercury____Index___std_util__univ_0_0);
 Define_extern_entry(mercury____Compare___std_util__univ_0_0);
 Declare_label(mercury____Compare___std_util__univ_0_0_i1);
-Define_extern_entry(mercury____Term_To_Type___std_util__univ_0_0);
-Define_extern_entry(mercury____Type_To_Term___std_util__univ_0_0);
 
 Define_extern_entry(mercury____Unify___std_util__type_info_0_0);
 Define_extern_entry(mercury____Index___std_util__type_info_0_0);
 Define_extern_entry(mercury____Compare___std_util__type_info_0_0);
-Define_extern_entry(mercury____Term_To_Type___std_util__type_info_0_0);
-Define_extern_entry(mercury____Type_To_Term___std_util__type_info_0_0);
 
 BEGIN_MODULE(unify_univ_module)
 	init_entry(mercury____Unify___std_util__univ_0_0);
 	init_entry(mercury____Index___std_util__univ_0_0);
 	init_entry(mercury____Compare___std_util__univ_0_0);
 	init_label(mercury____Compare___std_util__univ_0_0_i1);
-	init_entry(mercury____Term_To_Type___std_util__univ_0_0);
-	init_entry(mercury____Type_To_Term___std_util__univ_0_0);
 
 	init_entry(mercury____Unify___std_util__type_info_0_0);
 	init_entry(mercury____Index___std_util__type_info_0_0);
 	init_entry(mercury____Compare___std_util__type_info_0_0);
-	init_entry(mercury____Term_To_Type___std_util__type_info_0_0);
-	init_entry(mercury____Type_To_Term___std_util__type_info_0_0);
 BEGIN_CODE
 Define_entry(mercury____Unify___std_util__univ_0_0);
 {
@@ -1091,15 +1083,6 @@
 	proceed();
 #endif
 
-Define_entry(mercury____Term_To_Type___std_util__univ_0_0);
-	/* don't know what to put here. */
-	fatal_error(""cannot convert univ type to term"");
-
-Define_entry(mercury____Type_To_Term___std_util__univ_0_0);
-	/* don't know what to put here. */
-	fatal_error(""cannot convert type univ to term"");
-
-
 Define_entry(mercury____Unify___std_util__type_info_0_0);
 {
 	/*
@@ -1136,14 +1119,6 @@
 	proceed();
 }
 
-Define_entry(mercury____Term_To_Type___std_util__type_info_0_0);
-	/* don't know what to put here. */
-	fatal_error(""cannot convert term to type type_info"");
-
-Define_entry(mercury____Type_To_Term___std_util__type_info_0_0);
-	/* don't know what to put here. */
-	fatal_error(""cannot convert type type_info to term"");
-
 END_MODULE
 
 /* Ensure that the initialization code for the above module gets run. */
@@ -1899,7 +1874,7 @@
 	#include <stdio.h>
 
 	/* 
-	 * Code for functor, arg and expand
+	 * Code for functor, arg and deconstruct
 	 * 
 	 * This relies on some C primitives that take a type_info
 	 * and a data_word, and get a functor, arity, argument vector,
@@ -2072,7 +2047,7 @@
 	default:
 		/* If this happens, the layout data is corrupt */
 
-		fatal_error(""Found unused tag value in expand"");
+		fatal_error(""ML_expand: found unused tag value"");
 	}
 }
 
@@ -2189,11 +2164,11 @@
 	switch ((int) entry_value) {
 	
 	case TYPELAYOUT_UNASSIGNED_VALUE:
-		fatal_error(""Attempt to use an UNASSIGNED tag in expand."");
+		fatal_error(""ML_expand: attempt to use an UNASSIGNED tag"");
 		break;
 
 	case TYPELAYOUT_UNUSED_VALUE:
-		fatal_error(""Attempt to use an UNUSED tag in expand."");
+		fatal_error(""ML_expand: attempt to use an UNUSED tag"");
 		break;
 
 	case TYPELAYOUT_STRING_VALUE:
@@ -2303,7 +2278,7 @@
 		
 		
 	default:
-		fatal_error(""Invalid tag value in expand"");
+		fatal_error(""ML_expand: invalid tag value"");
 		break;
 	}
 }
@@ -2359,7 +2334,7 @@
 	}
 
 	if (TYPEINFO_IS_VARIABLE(arg_pseudo_type_info)) {
-		fatal_error(""unbound type variable"");
+		fatal_error(""ML_create_type_info: unbound type variable"");
 	}
 
 	base_type_info = arg_pseudo_type_info[0];
@@ -2377,7 +2352,8 @@
 		if (TYPEINFO_IS_VARIABLE(arg_pseudo_type_info[i])) {
 			type_info[i] = term_type_info[arg_pseudo_type_info[i]];
 			if (TYPEINFO_IS_VARIABLE(type_info[i])) {
-				fatal_error(""unbound type variable"");
+				fatal_error(""ML_create_type_info: ""
+					""unbound type variable"");
 			}
 
 		} else {
@@ -2391,7 +2367,7 @@
 
 %-----------------------------------------------------------------------------%
 
-	% Code for functor, arg and expand.
+	% Code for functor, arg and deconstruct.
 
 :- pragma c_code(functor(Type::in, Functor::out, Arity::out),
 		will_not_call_mercury, " 
@@ -2468,8 +2444,8 @@
 		error("det_argument : argument out of range")
 	).
 
-:- pragma c_code(expand(Type::in, Functor::out, Arity::out, Arguments::out),
-		will_not_call_mercury, " 
+:- pragma c_code(deconstruct(Type::in, Functor::out, Arity::out, 
+		Arguments::out), will_not_call_mercury, " 
 {
 	ML_Expand_Info info;
 	Word arg_pseudo_type_info;
Index: library/term.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/term.m,v
retrieving revision 1.70
diff -u -r1.70 term.m
--- term.m	1997/05/22 20:56:45	1.70
+++ term.m	1997/06/04 01:43:58
@@ -340,7 +340,7 @@
 			error("term__type_to_term: unknown type")
 		)
 	;
-		expand(Univ, FunctorString, _FunctorArity, FunctorArgs),
+		deconstruct(Univ, FunctorString, _FunctorArity, FunctorArgs),
 		term__type_list_to_term_list(FunctorArgs, TermArgs),
 		Term = term__functor(term__atom(FunctorString), TermArgs,
 			Context)
Index: tests/hard_coded/expand.m
===================================================================
RCS file: /home/staff/zs/imp/tests/hard_coded/expand.m,v
retrieving revision 1.4
diff -u -r1.4 expand.m
--- expand.m	1997/05/17 18:52:26	1.4
+++ expand.m	1997/06/04 01:44:24
@@ -95,7 +95,7 @@
 	).
 
 test_expand(T) -->
-	{ expand(T, Functor, Arity, Arguments) },
+	{ deconstruct(T, Functor, Arity, Arguments) },
 	{ string__format("expand: functor %s arity %d arguments ", [s(Functor),
 		i(Arity)], Str) },
 	io__write_string(Str),


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't eveyone's cup of
     trd at cs.mu.oz.au        #  fur.
http://www.cs.mu.oz.au/~trd #



More information about the developers mailing list