[m-rev.] diff: fix the release branch

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Mar 16 09:30:41 AEDT 2005


Estimated hours taken: 1
Branches: release

Merge some of the recent changes to the mdbcomp library
from the main branch onto the release branch.  The reason
for doing this is that one of the recent changes to solver
types that was committed on the release branch used features
of mdbcomp that were only found on the main branch.

In preference to doing anything else I've updated mdbcomp
(and the relevant compiler modules).  Hopefully this should
make adding things to both branches a bit easier in the future.

mdbcomp/prim_data.m:
	Merge in changes from the main branch.

compiler/rl_out.pp:
compiler/*.m:
	Update as necessary.

Julien.

Index: compiler/bytecode.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode.m,v
retrieving revision 1.57
diff -u -r1.57 bytecode.m
--- compiler/bytecode.m	19 Jan 2005 03:10:28 -0000	1.57
+++ compiler/bytecode.m	15 Mar 2005 22:21:07 -0000
@@ -684,7 +684,7 @@
 :- pred output_module_id(byte_module_id::in, io::di, io::uo) is det.

 output_module_id(ModuleId) -->
-	{ prog_out__sym_name_to_string(ModuleId, ModuleIdString) },
+	{ mdbcomp__prim_data__sym_name_to_string(ModuleId, ModuleIdString) },
 	output_string(ModuleIdString).

 :- pred debug_module_id(byte_module_id::in, io::di, io::uo) is det.
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.62
diff -u -r1.62 check_typeclass.m
--- compiler/check_typeclass.m	21 Jan 2005 06:20:35 -0000	1.62
+++ compiler/check_typeclass.m	15 Mar 2005 22:21:07 -0000
@@ -323,7 +323,8 @@
 		% Construct an appropriate error message.
 		%
 		ClassId = class_id(ClassName, ClassArity),
-		prog_out__sym_name_to_string(ClassName, ClassNameString),
+		mdbcomp__prim_data__sym_name_to_string(ClassName,
+			ClassNameString),
 		string__int_to_string(ClassArity, ClassArityString),
 		string__append_list([
 			"In instance declaration for `",
@@ -525,8 +526,10 @@
 		OrderedInstanceMethods = OrderedInstanceMethods0,
 		InstanceDefn = InstanceDefn0,
 		ClassId = class_id(ClassName, _ClassArity),
-		prog_out__sym_name_to_string(MethodName, MethodNameString),
-		prog_out__sym_name_to_string(ClassName, ClassNameString),
+		mdbcomp__prim_data__sym_name_to_string(MethodName,
+			MethodNameString),
+		mdbcomp__prim_data__sym_name_to_string(ClassName,
+			ClassNameString),
 		pred_or_func_to_string(PredOrFunc, PredOrFuncString),
 		string__int_to_string(Arity, ArityString),
 		InstanceTypesString = mercury_type_list_to_string(
@@ -562,8 +565,10 @@
 		OrderedInstanceMethods = OrderedInstanceMethods0,
 		InstanceDefn = InstanceDefn0,
 		ClassId = class_id(ClassName, _ClassArity),
-		prog_out__sym_name_to_string(MethodName, MethodNameString),
-		prog_out__sym_name_to_string(ClassName, ClassNameString),
+		mdbcomp__prim_data__sym_name_to_string(MethodName,
+			MethodNameString),
+		mdbcomp__prim_data__sym_name_to_string(ClassName,
+			ClassNameString),
 		pred_or_func_to_string(PredOrFunc, PredOrFuncString),
 		string__int_to_string(Arity, ArityString),
 		InstanceTypesString = mercury_type_list_to_string(
@@ -779,8 +784,10 @@
 make_introduced_pred_name(ClassId, MethodName, Arity,
 		InstanceTypes, PredName) :-
 	ClassId = class_id(ClassName, _ClassArity),
-	prog_out__sym_name_to_string(ClassName, "__", ClassNameString),
-	prog_out__sym_name_to_string(MethodName, "__", MethodNameString),
+	mdbcomp__prim_data__sym_name_to_string(ClassName, "__",
+		ClassNameString),
+	mdbcomp__prim_data__sym_name_to_string(MethodName, "__",
+		MethodNameString),
 		% Perhaps we should include the arity in this mangled
 		% string?
 	string__int_to_string(Arity, ArityString),
@@ -852,7 +859,8 @@
 	;
 		UnprovenConstraints = [_ | _],
 		ClassId = class_id(ClassName, _ClassArity),
-		prog_out__sym_name_to_string(ClassName, ClassNameString),
+		mdbcomp__prim_data__sym_name_to_string(ClassName,
+			ClassNameString),
 		InstanceTypesString = mercury_type_list_to_string(
 			InstanceVarSet2, InstanceTypes),
 		constraint_list_to_string(ClassVarSet, UnprovenConstraints,
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.134
diff -u -r1.134 code_gen.m
--- compiler/code_gen.m	21 Jan 2005 06:20:36 -0000	1.134
+++ compiler/code_gen.m	15 Mar 2005 22:21:07 -0000
@@ -1392,7 +1392,8 @@
 	module_info_pred_info(ModuleInfo, PredId, PredInfo),
 	ModuleSymName = pred_info_module(PredInfo),

-	prog_out__sym_name_to_string(ModuleSymName, "__", ModuleName),
+	mdbcomp__prim_data__sym_name_to_string(ModuleSymName, "__",
+		ModuleName),

 	code_util__make_local_entry_label(ModuleInfo, PredId,
 		ProcId, no, Entry),
@@ -1461,7 +1462,7 @@
 		FullPredName = PredName
 	),
 	PredOrFuncString = pred_or_func_to_str(PredOrFunc),
-	prog_out__sym_name_to_string(ModuleName, ModuleNameString),
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleNameString),
 	string__int_to_string(Arity, ArityStr),
 	proc_id_to_int(ProcId, ProcNum),
 	string__int_to_string(ProcNum, ProcNumStr),
@@ -1476,7 +1477,7 @@

 code_gen__find_arg_type_ctor_name(TypeCtor, TypeName) :-
 	TypeCtor = TypeCtorSymName - TypeCtorArity,
-	prog_out__sym_name_to_string(TypeCtorSymName, TypeCtorName),
+	mdbcomp__prim_data__sym_name_to_string(TypeCtorSymName, TypeCtorName),
 	string__int_to_string(TypeCtorArity, ArityStr),
 	string__append_list([TypeCtorName, "_", ArityStr], TypeName).

Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.44.2.1
diff -u -r1.44.2.1 deforest.m
--- compiler/deforest.m	7 Feb 2005 15:07:58 -0000	1.44.2.1
+++ compiler/deforest.m	15 Mar 2005 22:21:07 -0000
@@ -453,7 +453,7 @@
 		), Goals0, Constraints, Goals1),
 		Constraints \= []
 	->
-		prog_out__sym_name_to_string(SymName, SymNameString),
+		mdbcomp__prim_data__sym_name_to_string(SymName, SymNameString),
 		pd_debug__message("propagating constraints into call to %s\n",
 			[s(SymNameString)], !IO),

Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.123
diff -u -r1.123 higher_order.m
--- compiler/higher_order.m	21 Jan 2005 06:20:38 -0000	1.123
+++ compiler/higher_order.m	15 Mar 2005 22:21:07 -0000
@@ -2557,7 +2557,7 @@
 maybe_write_request(no, _, _, _, _, _, _, _, _, !IO).
 maybe_write_request(yes, ModuleInfo, Msg, SymName, Arity, ActualArity,
 		MaybeNewName, HOArgs, Context, !IO) :-
-	prog_out__sym_name_to_string(SymName, OldName),
+	mdbcomp__prim_data__sym_name_to_string(SymName, OldName),
 	string__int_to_string(Arity, ArStr),
 	io__write_string("% ", !IO),
 	prog_out__write_context(Context, !IO),
Index: compiler/hlds_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_code_util.m,v
retrieving revision 1.14
diff -u -r1.14 hlds_code_util.m
--- compiler/hlds_code_util.m	21 Jan 2005 03:27:38 -0000	1.14
+++ compiler/hlds_code_util.m	15 Mar 2005 22:21:07 -0000
@@ -137,7 +137,8 @@

 type_to_string(Type, String) :-
 	( sym_name_and_args(Type, TypeName, TypeArgs) ->
-		prog_out__sym_name_to_string(TypeName, "__", TypeNameString),
+		mdbcomp__prim_data__sym_name_to_string(TypeName, "__",
+			TypeNameString),
 		list__length(TypeArgs, TypeArity),
 		string__int_to_string(TypeArity, TypeArityString),
 		string__append_list(
Index: compiler/hlds_error_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_error_util.m,v
retrieving revision 1.7
diff -u -r1.7 hlds_error_util.m
--- compiler/hlds_error_util.m	21 Jan 2005 06:20:38 -0000	1.7
+++ compiler/hlds_error_util.m	15 Mar 2005 22:21:07 -0000
@@ -190,7 +190,8 @@
 module_qualification(ModuleName, ShouldModuleQualify) = ModuleQualification :-
 	(
 		ShouldModuleQualify = should_module_qualify,
-		prog_out__sym_name_to_string(ModuleName, ModuleNameString),
+		mdbcomp__prim_data__sym_name_to_string(ModuleName,
+			ModuleNameString),
 		ModuleQualification = string__append(ModuleNameString, ".")
 	;
 		ShouldModuleQualify = should_not_module_qualify,
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.106.2.1
diff -u -r1.106.2.1 hlds_module.m
--- compiler/hlds_module.m	10 Mar 2005 02:33:53 -0000	1.106.2.1
+++ compiler/hlds_module.m	15 Mar 2005 22:21:07 -0000
@@ -382,12 +382,14 @@

 :- pred module_info_preds(module_info::in, pred_table::out) is det.

+	% Given a pred_id, return the pred_info of the specified pred.
+	%
 :- pred module_info_pred_info(module_info::in, pred_id::in, pred_info::out)
 	is det.

-	% Given a pred_id and a proc_id, get the
-	% pred_info that predicate and the proc_info for that
-	% mode of that predicate.
+	% Given a pred_id and a proc_id, get the pred_info of that predicate
+	% and the proc_info for that mode of that predicate.
+	%
 :- pred module_info_pred_proc_info(module_info::in, pred_id::in, proc_id::in,
 	pred_info::out, proc_info::out) is det.

@@ -398,6 +400,7 @@
 	% (Predicates whose definition contains a type error, etc.
 	% get removed from this list, so that later passes can rely
 	% on the predicates in this list being type-correct, etc.)
+	%
 :- pred module_info_predids(module_info::in, list(pred_id)::out) is det.

 	% Reverse the list of pred_ids.
@@ -405,14 +408,17 @@
 	% for efficiency; once we've done so, we reverse the list
 	% so that progress messages and error messages come out
 	% in the expected order.)
+	%
 :- pred module_info_reverse_predids(module_info::in, module_info::out) is det.

 	% Remove a predicate from the list of pred_ids, to prevent
 	% further processing of this predicate after an error is encountered.
+	%
 :- pred module_info_remove_predid(pred_id::in,
 	module_info::in, module_info::out) is det.

 	% Completely remove a predicate from a module.
+	%
 :- pred module_info_remove_predicate(pred_id::in,
 	module_info::in, module_info::out) is det.

@@ -440,6 +446,7 @@

 	% Please see module_info_ensure_dependency_info for the
 	% constraints on this dependency_info.
+	%
 :- pred module_info_dependency_info(module_info::in, dependency_info::out)
 	is det.

@@ -448,18 +455,18 @@

 	% Please see module_info_ensure_dependency_info for the
 	% constraints on this dependency_info.
+	%
 :- pred module_info_set_dependency_info(dependency_info::in,
 	module_info::in, module_info::out) is det.

 :- pred module_info_clobber_dependency_info(module_info::in, module_info::out)
 	is det.

+	% The module_info stores a counter which is used to number introduced
+	% lambda predicates as __LambdaGoal__1, __LambdaGoal__2, etc.; this
+	% predicate returns the next number and increments the counter.
 :- pred module_info_incr_errors(module_info::in, module_info::out) is det.

-	% The module_info stores a counter which is used to number
-	% introduced lambda predicates as __LambdaGoal__1, __LambdaGoal__2,
-	% etc.; this predicate returns the next number and increments
-	% the counter.
 :- pred module_info_next_lambda_count(int::out,
 	module_info::in, module_info::out) is det.

@@ -473,6 +480,7 @@
 	% 234-trees, it is a no-op, except for the mode and inst tables,
 	% where the cached lists of mode_ids and inst_ids are sorted for
 	% efficient conversion to sets in module_qual.m.)
+	%
 :- pred module_info_optimize(module_info::in, module_info::out) is det.

 %-----------------------------------------------------------------------------%
@@ -2002,7 +2010,7 @@
 		% the type-checker should ensure that this never happens
 		list__length(ArgTypes, Arity),
 		PredOrFuncStr = prog_out__pred_or_func_to_str(PredOrFunc),
-		prog_out__sym_name_to_string(SymName, Name2),
+		mdbcomp__prim_data__sym_name_to_string(SymName, Name2),
 		string__int_to_string(Arity, ArityString),
 		string__append_list(["get_pred_id_and_proc_id: ",
 			"undefined/invalid ", PredOrFuncStr,
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.345.2.2
diff -u -r1.345.2.2 hlds_out.m
--- compiler/hlds_out.m	15 Feb 2005 00:05:48 -0000	1.345.2.2
+++ compiler/hlds_out.m	15 Mar 2005 22:21:07 -0000
@@ -295,7 +295,7 @@
 	io__write_string(hlds_out__cons_id_to_string(ConsId), !IO).

 hlds_out__cons_id_to_string(cons(SymName, Arity)) = String :-
-	prog_out__sym_name_to_string(SymName, SymNameString0),
+	mdbcomp__prim_data__sym_name_to_string(SymName, SymNameString0),
 	( string__contains_char(SymNameString0, '*') ->
 		% We need to protect against the * appearing next to a /
 		Stuff = (pred(Char::in, Str0::in, Str::out) is det :-
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.166.2.1
diff -u -r1.166.2.1 intermod.m
--- compiler/intermod.m	8 Feb 2005 07:39:10 -0000	1.166.2.1
+++ compiler/intermod.m	15 Mar 2005 22:21:07 -0000
@@ -2327,7 +2327,8 @@
 	maybe_write_string(VeryVerbose,
 		"% Reading optimization interface for module", !IO),
 	maybe_write_string(VeryVerbose, " `", !IO),
-	prog_out__sym_name_to_string(ModuleToRead, ModuleToReadString),
+	mdbcomp__prim_data__sym_name_to_string(ModuleToRead,
+		ModuleToReadString),
 	maybe_write_string(VeryVerbose, ModuleToReadString, !IO),
 	maybe_write_string(VeryVerbose, "'...\n", !IO),
 	maybe_flush_output(VeryVerbose, !IO),
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.41
diff -u -r1.41 layout_out.m
--- compiler/layout_out.m	21 Jan 2005 06:20:40 -0000	1.41
+++ compiler/layout_out.m	15 Mar 2005 22:21:07 -0000
@@ -1010,7 +1010,7 @@
 	io__write_string(" = {\n{\n", !IO),
 	output_proc_id(ClosureProcLabel, lambda(FileName, LineNumber), !IO),
 	io__write_string("},\n", !IO),
-	prog_out__sym_name_to_string(ModuleName, ModuleNameStr),
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleNameStr),
 	quote_and_write_string(ModuleNameStr, !IO),
 	io__write_string(",\n", !IO),
 	quote_and_write_string(FileName, !IO),
@@ -1028,9 +1028,9 @@
 		ProcLabel = proc(DefiningModule, PredOrFunc, DeclaringModule,
 			PredName0, Arity, Mode),
 		PredName = origin_name(Origin, PredName0),
-		prog_out__sym_name_to_string(DefiningModule,
+		mdbcomp__prim_data__sym_name_to_string(DefiningModule,
 			DefiningModuleStr),
-		prog_out__sym_name_to_string(DeclaringModule,
+		mdbcomp__prim_data__sym_name_to_string(DeclaringModule,
 			DeclaringModuleStr),
 		output_pred_or_func(PredOrFunc, !IO),
 		io__write_string(",\n", !IO),
@@ -1050,9 +1050,10 @@
 		TypeCtor = qualified(TypeModule, TypeName) - TypeArity,
 		PredName0 = special_pred_name(SpecialPredId, TypeCtor),
 		PredName = origin_name(Origin, PredName0),
-		prog_out__sym_name_to_string(DefiningModule,
+		mdbcomp__prim_data__sym_name_to_string(DefiningModule,
 			DefiningModuleStr),
-		prog_out__sym_name_to_string(TypeModule, TypeModuleStr),
+		mdbcomp__prim_data__sym_name_to_string(TypeModule,
+			TypeModuleStr),
 		quote_and_write_string(TypeName, !IO),
 		io__write_string(",\n", !IO),
 		quote_and_write_string(TypeModuleStr, !IO),
@@ -1184,7 +1185,7 @@
 	io__write_string("\n", !IO),
 	output_layout_name_storage_type_name(ModuleLayoutName, yes, !IO),
 	io__write_string(" = {\n", !IO),
-	prog_out__sym_name_to_string(ModuleName, ModuleNameStr),
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleNameStr),
 	quote_and_write_string(ModuleNameStr, !IO),
 	io__write_string(",\n", !IO),
 	io__write_int(StringTableSize, !IO),
Index: compiler/make.module_target.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make.module_target.m,v
retrieving revision 1.27
diff -u -r1.27 make.module_target.m
--- compiler/make.module_target.m	23 Dec 2004 06:49:16 -0000	1.27
+++ compiler/make.module_target.m	15 Mar 2005 22:21:07 -0000
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2002-2004 The University of Melbourne.
+% Copyright (C) 2002-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -301,7 +301,7 @@
 build_target_2(ModuleName, process_module(ModuleTask), ArgFileName,
 		_Imports, AllOptionArgs, ErrorStream,
 		Succeeded, Info, Info) -->
-	{ prog_out__sym_name_to_string(ModuleName, ".", ModuleArg) },
+	{ mdbcomp__prim_data__sym_name_to_string(ModuleName, ".", ModuleArg) },

 	globals__io_lookup_bool_option(verbose_commands, Verbose),
 	( { Verbose = yes } ->
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.323
diff -u -r1.323 mercury_compile.m
--- compiler/mercury_compile.m	27 Jan 2005 03:38:09 -0000	1.323
+++ compiler/mercury_compile.m	15 Mar 2005 22:21:07 -0000
@@ -865,7 +865,7 @@
 		MaybeTimestamp, Items, Error, !ReadModules, !IO) :-
 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
 	maybe_write_string(Verbose, "% Parsing module `", !IO),
-	prog_out__sym_name_to_string(ModuleName, ModuleNameString),
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleNameString),
 	maybe_write_string(Verbose, ModuleNameString, !IO),
 	maybe_write_string(Verbose, "' and imported interfaces...\n", !IO),
 	(
@@ -1839,8 +1839,8 @@
 				warn_missing_trans_opt_deps,
 				WarnNoTransOptDeps),
 			( WarnNoTransOptDeps = yes ->
-				prog_out__sym_name_to_string(ModuleName,
-					ModuleString),
+				mdbcomp__prim_data__sym_name_to_string(
+					ModuleName, ModuleString),
 				Msg1 = "Warning: cannot read trans-opt " ++
 					"dependencies for module `" ++
 					ModuleString ++ "'.",
@@ -4457,7 +4457,7 @@
 	globals__io_lookup_bool_option(dump_rl, Dump, !IO),
 	( Dump = yes ->
 		module_info_name(ModuleInfo, ModuleName0),
-		prog_out__sym_name_to_string(ModuleName0, ModuleName),
+		mdbcomp__prim_data__sym_name_to_string(ModuleName0, ModuleName),
 		string__append_list([ModuleName, ".rl_dump", StageName],
 			DumpFile),
 		globals__io_lookup_bool_option(verbose, Verbose, !IO),
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.250.2.1
diff -u -r1.250.2.1 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	8 Feb 2005 07:39:12 -0000	1.250.2.1
+++ compiler/mercury_to_mercury.m	15 Mar 2005 22:21:08 -0000
@@ -1464,13 +1464,13 @@
 	add_lambda_eval_method(EvalMethod),
 	add_string(")>").
 mercury_format_cons_id(type_ctor_info_const(Module, Type, Arity), _) -->
-	{ prog_out__sym_name_to_string(Module, ModuleString) },
+	{ mdbcomp__prim_data__sym_name_to_string(Module, ModuleString) },
 	{ string__int_to_string(Arity, ArityString) },
 	add_strings(["<type_ctor_info for ",
 		ModuleString, ".", Type, "/", ArityString, ">"]).
 mercury_format_cons_id(base_typeclass_info_const(Module, Class, InstanceNum,
 		InstanceString), _) -->
-	{ prog_out__sym_name_to_string(Module, ModuleString) },
+	{ mdbcomp__prim_data__sym_name_to_string(Module, ModuleString) },
 	add_string("<base_typeclass_info for "),
 	add_class_id(Class),
 	( { ModuleString \= "some bogus module name" } ->
Index: compiler/ml_elim_nested.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_elim_nested.m,v
retrieving revision 1.67.2.1
diff -u -r1.67.2.1 ml_elim_nested.m
--- compiler/ml_elim_nested.m	31 Jan 2005 06:26:49 -0000	1.67.2.1
+++ compiler/ml_elim_nested.m	15 Mar 2005 22:21:08 -0000
@@ -1392,7 +1392,8 @@

 ml_module_name_string(ModuleName) = ModuleNameString :-
 	Separator = "__",
-	prog_out__sym_name_to_string(ModuleName, Separator, ModuleNameString).
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, Separator,
+		ModuleNameString).

 %-----------------------------------------------------------------------------%

Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.168
diff -u -r1.168 mlds_to_c.m
--- compiler/mlds_to_c.m	21 Jan 2005 03:27:41 -0000	1.168
+++ compiler/mlds_to_c.m	15 Mar 2005 22:21:08 -0000
@@ -528,8 +528,9 @@
 output_init_fn_name(ModuleName, Suffix, !IO) :-
 		% Here we ensure that we only get one "mercury__" at the
 		% start of the function name.
-	prog_out__sym_name_to_string(mlds_module_name_to_sym_name(ModuleName),
-		"__", ModuleNameString0),
+	mdbcomp__prim_data__sym_name_to_string(
+		mlds_module_name_to_sym_name(ModuleName), "__",
+		ModuleNameString0),
 	( string__prefix(ModuleNameString0, "mercury__") ->
 		ModuleNameString = ModuleNameString0
 	;
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.101
diff -u -r1.101 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	19 Jan 2005 03:10:45 -0000	1.101
+++ compiler/mlds_to_gcc.m	15 Mar 2005 22:21:08 -0000
@@ -407,7 +407,7 @@
 init_fn_name(ModuleName, Suffix) = InitFnName :-
 		% Here we ensure that we only get one "mercury__" at the
 		% start of the function name.
-	prog_out__sym_name_to_string(
+	mdbcomp__prim_data__sym_name_to_string(
 			mlds_module_name_to_sym_name(ModuleName), "__",
 			ModuleNameString0),
 	(
@@ -493,7 +493,7 @@
 output_init_fn_name(ModuleName, Suffix) -->
 		% Here we ensure that we only get one "mercury__" at the
 		% start of the function name.
-	{ prog_out__sym_name_to_string(
+	{ mdbcomp__prim_data__sym_name_to_string(
 			mlds_module_name_to_sym_name(ModuleName), "__",
 			ModuleNameString0) },
 	{
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.144
diff -u -r1.144 mlds_to_il.m
--- compiler/mlds_to_il.m	21 Jan 2005 03:27:42 -0000	1.144
+++ compiler/mlds_to_il.m	15 Mar 2005 22:21:08 -0000
@@ -253,7 +253,8 @@
 		transform_mlds(MLDS),

 	ModuleName = mercury_module_name_to_mlds(MercuryModuleName),
-	prog_out__sym_name_to_string(mlds_module_name_to_sym_name(ModuleName),
+	mdbcomp__prim_data__sym_name_to_string(
+			mlds_module_name_to_sym_name(ModuleName),
 			".", AssemblyName),
 	get_il_data_rep(ILDataRep, !IO),
 	globals__io_lookup_bool_option(debug_il_asm, DebugIlAsm, !IO),
@@ -4032,7 +4033,7 @@
 			ForeignImportName = il_assembly_name(ImportName),
 			PackageName = mlds_module_name_to_package_name(
 					ImportName),
-			prog_out__sym_name_to_string(PackageName,
+			mdbcomp__prim_data__sym_name_to_string(PackageName,
 					ForeignPackageStr),
 			( string__prefix(ForeignPackageStr, "System") ->
 				AsmDecls = dotnet_system_assembly_decls(Version)
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.63
diff -u -r1.63 mlds_to_java.m
--- compiler/mlds_to_java.m	21 Jan 2005 03:27:42 -0000	1.63
+++ compiler/mlds_to_java.m	15 Mar 2005 22:21:08 -0000
@@ -385,7 +385,7 @@
 	),
 	SymName = mlds_module_name_to_sym_name(ImportName),
 	JavaSafeSymName = valid_module_name(SymName),
-	prog_out__sym_name_to_string(JavaSafeSymName, ".", File),
+	mdbcomp__prim_data__sym_name_to_string(JavaSafeSymName, ".", File),
 	% XXX Name mangling code should be put here when we start enforcing
 	%     Java's naming conventions.
 	ClassFile = File,
@@ -999,7 +999,7 @@
 output_package_info(unqualified(_), !IO).
 output_package_info(qualified(Module, _), !IO) :-
 	io__write_string("package ", !IO),
-	prog_out__sym_name_to_string(Module, ".", Package),
+	mdbcomp__prim_data__sym_name_to_string(Module, ".", Package),
 	io__write_string(Package, !IO),
 	io__write_string(";\n", !IO).

Index: compiler/mlds_to_managed.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_managed.m,v
retrieving revision 1.15
diff -u -r1.15 mlds_to_managed.m
--- compiler/mlds_to_managed.m	19 Jan 2005 03:10:46 -0000	1.15
+++ compiler/mlds_to_managed.m	15 Mar 2005 22:21:08 -0000
@@ -77,7 +77,7 @@

 output_src_start(ModuleName) -->
 	{ library__version(Version) },
-	{ prog_out__sym_name_to_string(ModuleName, ModuleNameStr) },
+	{ mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleNameStr) },
 	io__write_strings(
 		["//\n// Automatically generated from `",
 		ModuleNameStr,
@@ -212,7 +212,8 @@
 			    )
 			;
 			    SymName = mlds_module_name_to_sym_name(Name),
-			    prog_out__sym_name_to_string(SymName, ".", Str)
+			    mdbcomp__prim_data__sym_name_to_string(SymName,
+			    	".", Str)
 			),
 			Result = [Str]
 		    ;
@@ -227,7 +228,7 @@
 			io__write_string(".dll""\n")
 		), ActualImports),

-	{ prog_out__sym_name_to_string(ModuleName, ModuleNameStr) },
+	{ mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleNameStr) },
 	io__write_strings([
 		"#using """, ModuleNameStr, ".dll""\n",
 		"#include ""mercury_mcpp.h""\n",
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.146
diff -u -r1.146 opt_debug.m
--- compiler/opt_debug.m	19 Jan 2005 03:10:49 -0000	1.146
+++ compiler/opt_debug.m	15 Mar 2005 22:21:08 -0000
@@ -311,7 +311,7 @@
 	string__append_list(["label_entry(", LabelStr, ")"], Str).

 dump_data_addr(data_addr(ModuleName, DataName), Str) :-
-	prog_out__sym_name_to_string(ModuleName, ModuleName_str),
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, ModuleName_str),
 	dump_data_name(DataName, DataName_str),
 	string__append_list(
 		["data_addr(", ModuleName_str, ", ", DataName_str, ")"], Str).
Index: compiler/options_file.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options_file.m,v
retrieving revision 1.25
diff -u -r1.25 options_file.m
--- compiler/options_file.m	19 Jan 2005 03:10:49 -0000	1.25
+++ compiler/options_file.m	15 Mar 2005 22:21:08 -0000
@@ -1037,7 +1037,7 @@
 		OptionsVariableClass = module_specific(ModuleName),
 		options_variable_type_is_target_specific(FlagsVar) = yes
 	->
-		prog_out__sym_name_to_string(ModuleName, ".",
+		mdbcomp__prim_data__sym_name_to_string(ModuleName, ".",
 			ModuleFileNameBase),
 		ModuleVarName = VarName ++ "-" ++ ModuleFileNameBase,
 		lookup_variable_words_report_error(Vars, ModuleVarName,
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.259
diff -u -r1.259 polymorphism.m
--- compiler/polymorphism.m	21 Jan 2005 06:20:44 -0000	1.259
+++ compiler/polymorphism.m	15 Mar 2005 22:21:08 -0000
@@ -1650,7 +1650,7 @@
 polymorphism__foreign_proc_add_typeclass_info(Mode, Impl, TypeVarSet,
 		Constraint, MaybeArgName) :-
 	Constraint = constraint(Name0, Types),
-	prog_out__sym_name_to_string(Name0, "__", Name),
+	mdbcomp__prim_data__sym_name_to_string(Name0, "__", Name),
 	term__vars_list(Types, TypeVars),
 	TypeVarNames =
 		list__map(underscore_and_tvar_name(TypeVarSet), TypeVars),
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.234.2.4
diff -u -r1.234.2.4 prog_io.m
--- compiler/prog_io.m	10 Mar 2005 02:33:57 -0000	1.234.2.4
+++ compiler/prog_io.m	15 Mar 2005 22:21:08 -0000
@@ -327,8 +327,10 @@

 check_module_has_expected_name(FileName, ExpectedName, ActualName, !IO) :-
 	( ActualName \= ExpectedName ->
-		prog_out__sym_name_to_string(ActualName, ActualString),
-		prog_out__sym_name_to_string(ExpectedName, ExpectedString),
+		mdbcomp__prim_data__sym_name_to_string(ActualName,
+			ActualString),
+		mdbcomp__prim_data__sym_name_to_string(ExpectedName,
+			ExpectedString),
 		io__write_strings([
 			"Error: file `", FileName,
 				"' contains the wrong module.\n",
@@ -739,7 +741,7 @@
 			ModuleName = StartModuleName,
 			Messages = []
 		;
-			prog_out__sym_name_to_string(StartModuleName,
+			mdbcomp__prim_data__sym_name_to_string(StartModuleName,
 				StartModuleNameString),
 			string__append_list(["source file `", SourceFileName,
 				"' contains module named `",
Index: compiler/prog_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_out.m,v
retrieving revision 1.54
diff -u -r1.54 prog_out.m
--- compiler/prog_out.m	19 Jan 2005 03:10:53 -0000	1.54
+++ compiler/prog_out.m	15 Mar 2005 22:21:08 -0000
@@ -51,14 +51,7 @@
 	% The output should be a syntactically valid Mercury term.
 :- pred prog_out__write_quoted_sym_name(sym_name::in, io::di, io::uo) is det.

-	% sym_name_to_string(SymName, String):
-	%	convert a symbol name to a string,
-	%	with module qualifiers separated by
-	%	the standard Mercury module qualifier operator.
-:- pred prog_out__sym_name_to_string(sym_name::in, string::out) is det.
-:- func prog_out__sym_name_to_string(sym_name) = string.
-
-	% sym_name_to_string(SymName, String):
+	% sym_name_and_arity_to_string(SymName, String):
 	%	convert a symbol name and arity to a "<Name>/<Arity>" string,
 	%	with module qualifiers separated by
 	%	the standard Mercury module qualifier operator.
@@ -66,13 +59,6 @@
 	string::out) is det.
 :- func prog_out__sym_name_and_arity_to_string(sym_name_and_arity) = string.

-	% sym_name_to_string(SymName, Separator, String):
-	%	convert a symbol name to a string,
-	%	with module qualifiers separated by Separator.
-:- pred prog_out__sym_name_to_string(sym_name::in, string::in, string::out)
-	is det.
-:- func prog_out__sym_name_to_string(sym_name, string) = string.
-
 :- pred prog_out__write_module_spec(module_specifier::in, io::di, io::uo)
 	is det.

@@ -124,6 +110,8 @@
 :- import_module term, varset, term_io.
 :- import_module require, string, std_util, term, term_io, varset, int.

+:- import_module mdbcomp__prim_data.
+
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%

@@ -230,23 +218,8 @@
 	prog_out__write_sym_name(SymName, !IO),
 	io__write_string("'", !IO).

-prog_out__sym_name_to_string(SymName, String) :-
-	prog_out__sym_name_to_string(SymName, ".", String).
-
-prog_out__sym_name_to_string(SymName) = String :-
-	prog_out__sym_name_to_string(SymName, String).
-
-prog_out__sym_name_to_string(SymName, Separator) = String :-
-	prog_out__sym_name_to_string(SymName, Separator, String).
-
-prog_out__sym_name_to_string(unqualified(Name), _Separator, Name).
-prog_out__sym_name_to_string(qualified(ModuleSym, Name), Separator,
-		QualName) :-
-	prog_out__sym_name_to_string(ModuleSym, Separator, ModuleName),
-	string__append_list([ModuleName, Separator, Name], QualName).
-
 prog_out__sym_name_and_arity_to_string(SymName/Arity, String) :-
-	prog_out__sym_name_to_string(SymName, SymNameString),
+	mdbcomp__prim_data__sym_name_to_string(SymName, SymNameString),
 	string__int_to_string(Arity, ArityString),
 	string__append_list([SymNameString, "/", ArityString], String).

Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.30
diff -u -r1.30 prog_rep.m
--- compiler/prog_rep.m	28 Jan 2005 07:11:45 -0000	1.30
+++ compiler/prog_rep.m	15 Mar 2005 22:21:08 -0000
@@ -243,7 +243,7 @@
 		GoalInfo, InstMap0, Info, Rep) :-
 	module_info_pred_info(Info ^ module_info, PredId, PredInfo),
 	ModuleSymName = pred_info_module(PredInfo),
-	prog_out__sym_name_to_string(ModuleSymName, ModuleName),
+	mdbcomp__prim_data__sym_name_to_string(ModuleSymName, ModuleName),
 	PredName = pred_info_name(PredInfo),
 	list__map(term__var_to_int, Args, ArgsRep),
 	(
Index: compiler/rl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl.m,v
retrieving revision 1.32
diff -u -r1.32 rl.m
--- compiler/rl.m	21 Jan 2005 06:20:46 -0000	1.32
+++ compiler/rl.m	15 Mar 2005 22:21:08 -0000
@@ -687,6 +687,7 @@
 :- import_module parse_tree__prog_out.
 :- import_module parse_tree__prog_util.
 :- import_module parse_tree__prog_type.
+:- import_module mdbcomp__prim_data.

 :- import_module bool, int, require, string.

@@ -1090,7 +1091,7 @@
 	ProcLabel = make_user_proc_label(ModuleName, IsImported,
 		PredOrFunc, PredModule, PredName, Arity, ProcId),
 	ProcLabelStr = proc_label_to_c_string(ProcLabel, no),
-	prog_out__sym_name_to_string(PredModule, PredModuleStr),
+	mdbcomp__prim_data__sym_name_to_string(PredModule, PredModuleStr),
 	ProcName = rl_proc_name(Owner, PredModuleStr, ProcLabelStr, 2).

 rl__get_insert_proc_name(ModuleInfo, PredId, ProcName) :-
@@ -1154,7 +1155,7 @@
 	module_info_pred_info(ModuleInfo, PredId, PredInfo),
 	PredName = pred_info_name(PredInfo),
 	PredModule0 = pred_info_module(PredInfo),
-	prog_out__sym_name_to_string(PredModule0, PredModule),
+	mdbcomp__prim_data__sym_name_to_string(PredModule0, PredModule),
 	pred_info_get_aditi_owner(PredInfo, Owner),
 	PredArity = pred_info_orig_arity(PredInfo),
 	string__format("%s__%i", [s(PredName), i(PredArity)], RelName),
@@ -1425,7 +1426,7 @@
 rl__mangle_type_name_2(TypeCtor, Args, MangledTypeName0, MangledTypeName) :-
 	(
 		TypeCtor = qualified(Module0, Name) - Arity,
-		prog_out__sym_name_to_string(Module0, Module),
+		mdbcomp__prim_data__sym_name_to_string(Module0, Module),
 		string__append_list([MangledTypeName0, Module, "__", Name],
 			MangledTypeName1)
 	;
Index: compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.47
diff -u -r1.47 rl_exprn.m
--- compiler/rl_exprn.m	21 Jan 2005 06:20:46 -0000	1.47
+++ compiler/rl_exprn.m	15 Mar 2005 22:21:08 -0000
@@ -156,6 +156,7 @@
 :- import_module parse_tree__prog_type.
 :- import_module transform_hlds__inlining.
 :- import_module backend_libs__name_mangle.
+:- import_module mdbcomp__prim_data.

 :- import_module assoc_list, bool, char, counter, int, map.
 :- import_module require, set, std_util, string, term, varset.
@@ -2182,7 +2183,8 @@
 			{ Code = tree(RvalCode, PopCode) }
 		)
 	;
-		{ prog_out__sym_name_to_string(PredModule0, PredModule) },
+		{ mdbcomp__prim_data__sym_name_to_string(PredModule0,
+			PredModule) },
 		{ Arity = pred_info_orig_arity(PredInfo) },
 		{ string__format("Sorry, not implemented in Aditi: %s.%s/%i",
 			[s(PredModule), s(PredName), i(Arity)], Msg) },
Index: compiler/rl_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_gen.m,v
retrieving revision 1.19
diff -u -r1.19 rl_gen.m
--- compiler/rl_gen.m	21 Jan 2005 06:20:46 -0000	1.19
+++ compiler/rl_gen.m	15 Mar 2005 22:21:08 -0000
@@ -47,6 +47,7 @@
 :- import_module parse_tree__prog_type.
 :- import_module transform_hlds__dependency_graph.
 :- import_module transform_hlds__inlining.
+:- import_module mdbcomp__prim_data.

 :- import_module assoc_list, bool, char, int, list, map, queue.
 :- import_module relation, require, set, std_util, string, term, varset.
@@ -151,7 +152,8 @@
 			EntryPredId, EntryPredInfo) },
 		{ pred_info_get_aditi_owner(EntryPredInfo, Owner) },
 		{ module_info_name(ModuleInfo, ModuleName0) },
-		{ prog_out__sym_name_to_string(ModuleName0, ModuleName) },
+		{ mdbcomp__prim_data__sym_name_to_string(ModuleName0,
+			ModuleName) },
 		{ string__int_to_string(RLProcId, ProcStr) },
 		{ string__append("rl_proc_", ProcStr, Name) },
 		{ list__length(EntryPoints, NumEntries) },
@@ -1523,7 +1525,7 @@
 	rl_info_get_module_info(ModuleInfo),
 	{ module_info_pred_info(ModuleInfo, PredId, PredInfo) },
 	{ Module0 = pred_info_module(PredInfo) },
-	{ prog_out__sym_name_to_string(Module0, Module) },
+	{ mdbcomp__prim_data__sym_name_to_string(Module0, Module) },
 	{ Name = pred_info_name(PredInfo) },
 	{ Arity = pred_info_orig_arity(PredInfo) },
 	rl_info_write_message("Generating call to %s.%s/%i\n",
Index: compiler/rl_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_info.m,v
retrieving revision 1.9
diff -u -r1.9 rl_info.m
--- compiler/rl_info.m	21 Jan 2005 06:20:47 -0000	1.9
+++ compiler/rl_info.m	15 Mar 2005 22:21:08 -0000
@@ -247,6 +247,7 @@
 :- import_module libs__globals.
 :- import_module libs__options.
 :- import_module parse_tree__prog_out.
+:- import_module mdbcomp__prim_data.

 :- import_module int, require.

@@ -500,7 +501,8 @@
 		% Get a (sort of) human readable version of the relation name.
 		{ proc_relation_type_to_str(ProcRelType, ProcRelStr) },
 		{ PredModule0 = pred_info_module(PredInfo) },
-		{ prog_out__sym_name_to_string(PredModule0, PredModule) },
+		{ mdbcomp__prim_data__sym_name_to_string(PredModule0,
+			PredModule) },
 		{ PredName = pred_info_name(PredInfo) },
 		{ Arity = pred_info_orig_arity(PredInfo) },
 		rl_info_get_next_relation_id(RelationId),
Index: compiler/rl_out.pp
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_out.pp,v
retrieving revision 1.26
diff -u -r1.26 rl_out.pp
--- compiler/rl_out.pp	27 Jan 2005 03:38:10 -0000	1.26
+++ compiler/rl_out.pp	15 Mar 2005 22:21:08 -0000
@@ -78,6 +78,7 @@
 :- import_module parse_tree__prog_data.
 :- import_module parse_tree__prog_out.
 :- import_module parse_tree__prog_util.
+:- import_module mdbcomp__prim_data.

 #if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
 :- import_module aditi_backend__rl_exprn.
@@ -147,7 +148,8 @@
 	->
 		{ module_info_pred_info(ModuleInfo, PredId, PredInfo) },
 		{ PredModule0 = pred_info_module(PredInfo) },
-		{ prog_out__sym_name_to_string(PredModule0, PredModule) },
+		{ mdbcomp__prim_data__sym_name_to_string(PredModule0,
+			PredModule) },
 		{ PredName = pred_info_name(PredInfo) },
 		{ PredArity0 = pred_info_orig_arity(PredInfo) },
 		{ string__int_to_string(PredArity0, PredArity) },
@@ -234,7 +236,7 @@
 	globals__io_lookup_string_option(aditi_user, Owner),
 	{ rl_out_info_assign_const(string(Owner), OwnerIndex,
 		RLInfo2, RLInfo3) },
-	{ prog_out__sym_name_to_string(ModuleName0, ModuleName) },
+	{ mdbcomp__prim_data__sym_name_to_string(ModuleName0, ModuleName) },
 	module_name_to_file_name(ModuleName0, ".m", no, SourceFileName),
 	module_name_to_file_name(ModuleName0, ".int", no, IntFileName),
 	{ rl_out_info_assign_const(string(ModuleName), ModuleIndex,
@@ -763,7 +765,7 @@
 	{ string__from_char_list(ProcNameList, ProcNameStr1) },
 	rl_out_info_get_module_info(ModuleInfo),
 	{ module_info_name(ModuleInfo, ModuleName0) },
-	{ prog_out__sym_name_to_string(ModuleName0, ModuleName) },
+	{ mdbcomp__prim_data__sym_name_to_string(ModuleName0, ModuleName) },
 	{ string__format("%s/%s/Memoed__%s__%i",
 		[s(Owner), s(ModuleName), s(ProcNameStr1), i(Counter0)],
 		UniqueName) },
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.54
diff -u -r1.54 rtti.m
--- compiler/rtti.m	21 Jan 2005 06:20:47 -0000	1.54
+++ compiler/rtti.m	15 Mar 2005 22:21:08 -0000
@@ -1279,8 +1279,8 @@
 		% XXX We may wish to check that all arguments are variables.
 	),
 	RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, _CtorArity),
-	prog_out__sym_name_to_string(qualified(ModuleName, TypeName), "__",
-		TypeStr),
+	mdbcomp__prim_data__sym_name_to_string(qualified(ModuleName,
+		TypeName), "__", TypeStr),
 	string__int_to_string(Arity, ArityStr),
 	% XXX This naming scheme is the same as for base_typeclass_infos.
 	% We should think about
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.50
diff -u -r1.50 rtti_out.m
--- compiler/rtti_out.m	19 Jan 2005 03:10:54 -0000	1.50
+++ compiler/rtti_out.m	15 Mar 2005 22:21:08 -0000
@@ -227,7 +227,7 @@
 	list__length(MethodIds, NumMethodIds),
 	output_generic_rtti_data_defn_start(TCIdRttiId, !DeclSet, !IO),
 	io__write_string(" = {\n\t""", !IO),
-	prog_out__sym_name_to_string(ModuleSymName, ModuleName),
+	mdbcomp__prim_data__sym_name_to_string(ModuleSymName, ModuleName),
 	c_util__output_quoted_string(ModuleName, !IO),
 	io__write_string(""",\n\t""", !IO),
 	c_util__output_quoted_string(ClassName, !IO),
@@ -623,7 +623,7 @@
 	io__write_string(",\n\t", !IO),
 	output_static_code_addr(CompareCodeAddr, !IO),
 	io__write_string(",\n\t""", !IO),
-	prog_out__sym_name_to_string(Module, ModuleName),
+	mdbcomp__prim_data__sym_name_to_string(Module, ModuleName),
 	c_util__output_quoted_string(ModuleName, !IO),
 	io__write_string(""",\n\t""", !IO),
 	c_util__output_quoted_string(TypeName, !IO),
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.57
diff -u -r1.57 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m	19 Jan 2005 03:10:54 -0000	1.57
+++ compiler/rtti_to_mlds.m	15 Mar 2005 22:21:09 -0000
@@ -215,7 +215,7 @@
 	TypeCtorData = type_ctor_data(Version, TypeModule, TypeName,
 		TypeArity, UnifyUniv, CompareUniv, Flags, TypeCtorDetails),
 	RttiTypeCtor = rtti_type_ctor(TypeModule, TypeName, TypeArity),
-	prog_out__sym_name_to_string(TypeModule, TypeModuleName),
+	mdbcomp__prim_data__sym_name_to_string(TypeModule, TypeModuleName),
 	NumPtags = type_ctor_details_num_ptags(TypeCtorDetails),
 	NumFunctors = type_ctor_details_num_functors(TypeCtorDetails),
 	FunctorsRttiId = ctor_rtti_id(RttiTypeCtor, type_functors),
@@ -337,7 +337,8 @@
 		MethodIdsInit = gen_init_rtti_id(ModuleName, MethodIdsRttiId)
 	),
 	TCIdRttiId = tc_rtti_id(TCName, type_class_id),
-	prog_out__sym_name_to_string(ModuleSymName, ModuleSymNameStr),
+	mdbcomp__prim_data__sym_name_to_string(ModuleSymName,
+		ModuleSymNameStr),
 	list__length(TVarNames, NumTVars),
 	list__length(MethodIds, NumMethods),
 	TCIdInit = init_struct(mlds__rtti_type(item_type(TCIdRttiId)), [
Index: compiler/source_file_map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/source_file_map.m,v
retrieving revision 1.11
diff -u -r1.11 source_file_map.m
--- compiler/source_file_map.m	19 Jan 2005 03:10:55 -0000	1.11
+++ compiler/source_file_map.m	15 Mar 2005 22:21:09 -0000
@@ -55,7 +55,7 @@
 	).

 default_source_file(ModuleName) = BaseFileName ++ ".m" :-
-	prog_out__sym_name_to_string(ModuleName, ".", BaseFileName).
+	mdbcomp__prim_data__sym_name_to_string(ModuleName, ".", BaseFileName).

 have_source_file_map(HaveMap, !IO) :-
 	get_source_file_map(_, !IO),
Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.47.2.1
diff -u -r1.47.2.1 special_pred.m
--- compiler/special_pred.m	9 Mar 2005 05:05:43 -0000	1.47.2.1
+++ compiler/special_pred.m	15 Mar 2005 22:21:09 -0000
@@ -40,13 +40,6 @@
 :- pred special_pred_interface(special_pred_id::in, (type)::in,
 	list(type)::out, list(mode)::out, determinism::out) is det.

-	% special_pred_name_arity(SpecialPredType, GenericPredName, Arity):
-	%	true iff there is a special predicate of category
-	%	SpecialPredType, called builtin:GenericPredName/Arity.
-:- pred special_pred_name_arity(special_pred_id, string, int).
-:- mode special_pred_name_arity(in, out, out) is det.
-:- mode special_pred_name_arity(out, in, out) is semidet.
-
 :- pred special_pred_mode_num(special_pred_id::in, int::out) is det.

 :- pred special_pred_list(list(special_pred_id)::out) is det.
@@ -120,11 +113,6 @@
 :- import_module bool, require, string.

 special_pred_list([unify, index, compare]).
-
-special_pred_name_arity(unify, "unify", 2).
-special_pred_name_arity(index, "index", 2).
-special_pred_name_arity(compare, "compare", 3).
-special_pred_name_arity(initialise, "initialise", 1).

 	% mode num for special procs is always 0 (the first mode)
 special_pred_mode_num(_, 0).
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.76
diff -u -r1.76 table_gen.m
--- compiler/table_gen.m	21 Jan 2005 06:20:47 -0000	1.76
+++ compiler/table_gen.m	15 Mar 2005 22:21:09 -0000
@@ -2873,7 +2873,8 @@
 	Arity = pred_info_orig_arity(PredInfo),
 	PredOrFunc = pred_info_is_pred_or_func(PredInfo),
 	PredOrFuncStr = pred_or_func_to_str(PredOrFunc),
-	prog_out__sym_name_to_string(qualified(Module, Name), NameStr),
+	mdbcomp__prim_data__sym_name_to_string(qualified(Module, Name),
+		NameStr),
 	string__int_to_string(Arity, ArityStr),
 	string__append_list([Msg, " in ", PredOrFuncStr, " ", NameStr,
 		"/", ArityStr], Message),
Index: compiler/trans_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.25
diff -u -r1.25 trans_opt.m
--- compiler/trans_opt.m	19 Jan 2005 03:10:57 -0000	1.25
+++ compiler/trans_opt.m	15 Mar 2005 22:21:09 -0000
@@ -169,7 +169,7 @@
 	maybe_write_string(VeryVerbose,
 		"% Reading transitive optimization interface for module", !IO),
 	maybe_write_string(VeryVerbose, " `", !IO),
-	prog_out__sym_name_to_string(Import, ImportString),
+	mdbcomp__prim_data__sym_name_to_string(Import, ImportString),
 	maybe_write_string(VeryVerbose, ImportString, !IO),
 	maybe_write_string(VeryVerbose, "'... ", !IO),
 	maybe_flush_output(VeryVerbose, !IO),
Index: compiler/unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.146
diff -u -r1.146 unify_gen.m
--- compiler/unify_gen.m	21 Jan 2005 06:20:49 -0000	1.146
+++ compiler/unify_gen.m	15 Mar 2005 22:21:09 -0000
@@ -63,6 +63,7 @@
 :- import_module parse_tree__prog_data.
 :- import_module parse_tree__prog_out.
 :- import_module parse_tree__prog_type.
+:- import_module mdbcomp__prim_data.

 :- import_module term, bool, string, int, list, map, require, std_util.

@@ -1074,7 +1075,7 @@
 unify_gen__var_type_msg(Type, Msg) :-
 	( type_to_ctor_and_args(Type, TypeCtor, _) ->
 		TypeCtor = TypeSym - TypeArity,
-		prog_out__sym_name_to_string(TypeSym, TypeSymStr),
+		mdbcomp__prim_data__sym_name_to_string(TypeSym, TypeSymStr),
 		string__int_to_string(TypeArity, TypeArityStr),
 		string__append_list([TypeSymStr, "/", TypeArityStr], Msg)
 	;
Index: compiler/unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.85
diff -u -r1.85 unique_modes.m
--- compiler/unique_modes.m	10 Jan 2005 05:23:42 -0000	1.85
+++ compiler/unique_modes.m	15 Mar 2005 22:21:09 -0000
@@ -77,6 +77,7 @@
 :- import_module parse_tree__prog_data.
 :- import_module parse_tree__prog_mode.
 :- import_module parse_tree__prog_out.
+:- import_module mdbcomp__prim_data.

 :- import_module term, varset.
 :- import_module assoc_list, bag, int, list, map.
@@ -476,7 +477,7 @@

 unique_modes__check_goal_2(call(PredId, ProcId0, Args, Builtin, CallContext,
 		PredName), _GoalInfo0, Goal, !ModeInfo, !IO) :-
-	prog_out__sym_name_to_string(PredName, PredNameString),
+	mdbcomp__prim_data__sym_name_to_string(PredName, PredNameString),
 	string__append("call ", PredNameString, CallString),
 	mode_checkpoint(enter, CallString, !ModeInfo, !IO),
 	mode_info_get_call_id(!.ModeInfo, PredId, CallId),
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.100
diff -u -r1.100 unused_args.m
--- compiler/unused_args.m	21 Jan 2005 06:20:49 -0000	1.100
+++ compiler/unused_args.m	15 Mar 2005 22:21:09 -0000
@@ -1018,7 +1018,7 @@
 			type_util__type_ctor_arity(ModuleInfo,
 				TypeCtor, TypeArity),
 			string__int_to_string(TypeArity, TypeAr),
-			prog_out__sym_name_to_string(TypeModule,
+			mdbcomp__prim_data__sym_name_to_string(TypeModule,
 				TypeModuleString0),
 			string__replace_all(TypeModuleString0, ".", "__",
 				TypeModuleString1),
Index: mdbcomp/prim_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/mdbcomp/prim_data.m,v
retrieving revision 1.1
diff -u -r1.1 prim_data.m
--- mdbcomp/prim_data.m	28 Jan 2005 07:11:52 -0000	1.1
+++ mdbcomp/prim_data.m	15 Mar 2005 22:21:11 -0000
@@ -102,6 +102,13 @@
 	;	compare
 	;	initialise.

+	% special_pred_name_arity(SpecialPredType, GenericPredName, Arity):
+	%	true iff there is a special predicate of category
+	%	SpecialPredType, called builtin:GenericPredName/Arity.
+:- pred special_pred_name_arity(special_pred_id, string, int).
+:- mode special_pred_name_arity(in, out, out) is det.
+:- mode special_pred_name_arity(out, in, out) is semidet.
+
 % was in compiler/prog_util.m

 	% string_to_sym_name(String, Separator, SymName):
@@ -111,6 +118,26 @@
 	%
 :- pred string_to_sym_name(string::in, string::in, sym_name::out) is det.

+	% sym_name_to_string(SymName, Separator, String):
+	%	convert a symbol name to a string,
+	%	with module qualifiers separated by Separator.
+:- pred sym_name_to_string(sym_name::in, string::in, string::out)
+	is det.
+:- func sym_name_to_string(sym_name, string) = string.
+
+	% sym_name_to_string(SymName, String):
+	%	convert a symbol name to a string,
+	%	with module qualifiers separated by
+	%	the standard Mercury module qualifier operator.
+:- pred sym_name_to_string(sym_name::in, string::out) is det.
+:- func sym_name_to_string(sym_name) = string.
+
+	% is_submodule(SymName1, SymName2).
+	% True iff SymName1 is a submodule of SymName2.
+	% For example mod1.mod2.mod3 is a submodule of mod1.mod2.
+	%
+:- pred is_submodule(module_name::in, module_name::in) is semidet.
+
 	% insert_module_qualifier(ModuleName, SymName0, SymName):
 	%	prepend the specified ModuleName onto the module
 	%	qualifiers in SymName0, giving SymName.
@@ -121,7 +148,7 @@

 :- implementation.

-:- import_module int, string.
+:- import_module int, string, list.

 % This would be simpler if we had a string__rev_sub_string_search/3 pred.
 % With that, we could search for underscores right-to-left,
@@ -150,3 +177,27 @@
 insert_module_qualifier(ModuleName, qualified(ModuleQual0, PlainName),
 		qualified(ModuleQual, PlainName)) :-
 	insert_module_qualifier(ModuleName, ModuleQual0, ModuleQual).
+
+sym_name_to_string(SymName, String) :-
+	sym_name_to_string(SymName, ".", String).
+
+sym_name_to_string(SymName) = String :-
+	sym_name_to_string(SymName, String).
+
+sym_name_to_string(SymName, Separator) = String :-
+	sym_name_to_string(SymName, Separator, String).
+
+sym_name_to_string(unqualified(Name), _Separator, Name).
+sym_name_to_string(qualified(ModuleSym, Name), Separator,
+		QualName) :-
+	sym_name_to_string(ModuleSym, Separator, ModuleName),
+	string__append_list([ModuleName, Separator, Name], QualName).
+
+is_submodule(SymName, SymName).
+is_submodule(qualified(SymNameA, _), SymNameB) :-
+	is_submodule(SymNameA, SymNameB).
+
+special_pred_name_arity(unify, "unify", 2).
+special_pred_name_arity(index, "index", 2).
+special_pred_name_arity(compare, "compare", 3).
+special_pred_name_arity(initialise, "initialise", 1).

--------------------------------------------------------------------------
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