[m-rev.] for review: naming magling, step 1

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Jan 4 19:18:17 AEDT 2002


For review by Fergus.

Zoltan.

The first step towards centralizing name construction and mangling issues
in the browser directory.

This change does not update either util/mdemangle.c or profiler/demangle.m,
even though it should. Both those files should be replaced by code that simply
calls code in the browser directory (in the modules now added and in modules to
be added later) to perform their job. In both cases, replacing them piecemeal
is extra work of little value, so I intend to replace them only when all the
issues related to names and mangling has been centralized in the browser
directory.

browser/names.m:
	A new module for holding information about the structure of names.

browser/mangle.m:
	A new module for handling name mangling, i.e. the conversion of names
	to and from a form acceptable inside C identifiers.

	It implements a new scheme for name manging, which (unlike the previous
	scheme) does not obscure a whole name just because one part contains
	characters that cannot occur in identifiers.

browser/dl.m:
browser/name_mangle.m:
	Make these modules stand on their own, not as submodules of module mdb.
	They are needed in other places as well.

browser/name_mangle.m:
	Delete declarations and code that are now redundant, being provided
	in names.m and mangle.m.

browser/mdb.m:
	Use import_module instead of include_module to refer to the dl and
	name_mangle modules.

compiler/prog_data.m:
	Delete the definitions moved to browser/names.m

compiler/llds_out.m:
	Delete the definitions moved to browser/mangle.m

browser/*.m:
compiler/*.m:
extras/dynamic_linking/*.m:
	Lots of adjusted imports to conform to the changes above.
	In some cases, remove explicit module qualifiers that now refer
	to the wrong module.

extras/dynamic_linking/Mmakefile:
	Delete the code for stripping the mdb__ prefix from the code copied
	over from the browser directory. Copy over names.m and mangle.m
	as well as name_mangle.m, since they are now also required.

runtime/mercury_tags.h:
	Update the mangling of a hand-declared object.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
Index: browser/collect_lib.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/collect_lib.m,v
retrieving revision 1.7
diff -u -b -r1.7 collect_lib.m
--- browser/collect_lib.m	2001/07/05 08:05:31	1.7
+++ browser/collect_lib.m	2002/01/03 15:03:13
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -62,7 +62,7 @@
 %------------------------------------------------------------------------------%
 :- implementation.
 :- import_module int, list, std_util, io, char.
-:- import_module mdb__dl.
+:- import_module dl.
 
 dummy_pred_to_avoid_warning_about_nothing_exported.
 
Index: browser/debugger_interface.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/debugger_interface.m,v
retrieving revision 1.19
diff -u -b -r1.19 debugger_interface.m
--- browser/debugger_interface.m	2001/06/22 15:20:22	1.19
+++ browser/debugger_interface.m	2002/01/03 12:37:21
@@ -32,14 +32,13 @@
 :- implementation.
 :- import_module io, require.
 :- import_module list, bool, std_util.
+:- import_module names.
 :- import_module mdb__interactive_query, mdb__util.
 
 dummy_pred_to_avoid_warning_about_nothing_exported.
 
 % The stuff defined below is also defined in modules prog_data, hlds_data.
 
-:- type arity == int.
-
 :- type determinism == int. 
 	% encoded as specified in ../runtime/mercury_stack_layout.h
 	% and ../compiler/stack_layout.m.
@@ -70,6 +69,7 @@
 % The debugger_request type is used for request sent
 % from the debugger process to the Mercury program being debugged.
 % This type would need to be extended to handle spypoints, etc.
+
 :- type debugger_request
 	--->	hello_reply		% yes, I'm here
 
@@ -174,6 +174,7 @@
 
 % The debugger_response type is used for response sent
 % to the debugger process from the Mercury program being debugged.
+
 :- type debugger_response
 	% sending hello
 	--->	hello	% are you there?
Index: browser/dl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/dl.m,v
retrieving revision 1.13
diff -u -b -r1.13 dl.m
--- browser/dl.m	2001/07/06 14:39:28	1.13
+++ browser/dl.m	2002/01/03 15:01:28
@@ -14,10 +14,13 @@
 % see the documentation for those procedures (i.e. `man dlopen').
 
 %-----------------------------------------------------------------------------%
-:- module mdb__dl.
+
+:- module dl.
+
 :- interface.
+
+:- import_module name_mangle.
 :- import_module io.
-:- import_module mdb__name_mangle.
 
 :- type (mode) ---> lazy ; now.		% RTLD_LAZY or RTLD_NOW
 :- type scope ---> local ; global.	% RTLD_GLOBAL or not.
Index: browser/interactive_query.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/interactive_query.m,v
retrieving revision 1.11
diff -u -b -r1.11 interactive_query.m
--- browser/interactive_query.m	2001/09/25 09:36:49	1.11
+++ browser/interactive_query.m	2002/01/03 15:03:40
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -33,9 +33,9 @@
 :- type options == string.
 
 :- implementation.
-:- import_module std_util, bool, string, term, varset, term_io, parser.
-:- import_module mdb__dl, mdb__name_mangle.
 :- import_module mdb__util.
+:- import_module dl, name_mangle.
+:- import_module std_util, bool, string, term, varset, term_io, parser.
 
 :- pragma export(query(in, in, in, in, in, di, uo), "ML_query").
 
Index: browser/mangle.m
===================================================================
RCS file: mangle.m
diff -N mangle.m
--- /dev/null	Fri Dec  1 02:25:58 2000
+++ mangle.m	Thu Jan  3 23:26:33 2002
@@ -0,0 +1,331 @@
+%-----------------------------------------------------------------------------%
+% Copyright (C) 2002 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.
+%-----------------------------------------------------------------------------%
+
+% This module translates Mercury names (predicate names, type names, etc)
+% into a form acceptable as C identifiers, and back again.
+
+% Main authors: fjh, zs.
+
+%-----------------------------------------------------------------------------%
+
+:- module mangle.
+
+:- interface.
+
+:- import_module names.
+
+	% Convert an arbitrary Mercury name into something that can form
+	% part of a C identifier.  This predicate is necessary because
+	% quoted names such as 'name with embedded spaces' are valid
+	% predicate names in Mercury.
+
+:- pred name_mangle(string::in, string::out) is det.
+
+	% Mangle a possibly module-qualified Mercury symbol name
+	% into a C identifier.
+
+:- pred sym_name_mangle(sym_name::in, string::out) is det.
+
+	% Undo the effects of name_mangle.
+
+:- pred name_demangle(string::in, string::out) is det.
+
+	% Produces a string of the form Module__Name.
+
+:- pred qualify_name(string::in, string::in, string::out) is det.
+
+	% Produces a string of the form Module__Name, unless Module__
+	% is already a prefix of Name.
+
+:- pred maybe_qualify_name(string::in, string::in, string::out) is det.
+
+:- implementation.
+
+:- import_module char, string, int, list, require.
+
+%
+% Warning: any changes to the name mangling algorithm here will also
+% require changes to extras/dynamic_linking/name_mangle.m,
+% profiler/demangle.m and util/mdemangle.c.
+%
+
+sym_name_mangle(unqualified(Name), MangledName) :-
+	name_mangle(Name, MangledName).
+sym_name_mangle(qualified(ModuleName, PlainName), MangledName) :-
+	sym_name_mangle(ModuleName, MangledModuleName),
+	name_mangle(PlainName, MangledPlainName),
+	qualify_name(MangledModuleName, MangledPlainName, MangledName).
+
+	% The two arms of the if-then-else compute the same string. However,
+	% in the common case when the condition succeeds, we compute the answer
+	% much more quickly and without allocating any memory. Efficiency is
+	% important because a single compilation can mangle many thousands of
+	% names.
+
+name_mangle(Name, MangledName) :-
+	string__length(Name, NameLen),
+	( name_needs_no_mangling(Name, 0, NameLen) ->
+		MangledName = Name
+	;
+		string__to_char_list(Name, NameChars),
+		MangledNameChars = convert_to_valid_c_identifier(NameChars),
+		string__from_char_list(MangledNameChars, MangledName)
+	).
+
+	% Name demangling is not really performance critical in any of its
+	% applications.
+
+name_demangle(MangledName, Name) :-
+	string__to_char_list(MangledName, MangledNameChars),
+	NameChars = convert_from_valid_c_identifier(MangledNameChars),
+	string__from_char_list(NameChars, Name).
+
+	% name_needs_no_mangling* form a state machine with these states:
+	%
+	% name_needs_no_mangling:	initial state: not after "_" or "_f"
+	% name_needs_no_mangling_1:	after "_"
+	% name_needs_no_mangling_2:	after "_f"
+	%
+	% In all states, we fail if the current character is not alphanumeric
+	% or underscore. In state name_needs_no_mangling_2, we also fail if
+	% the current character is an underscore.
+
+:- pred name_needs_no_mangling(string::in, int::in, int::in) is semidet.
+
+name_needs_no_mangling(Name, Cur, Len) :-
+	( Cur >= Len ->
+		true
+	;
+		Next = Cur + 1,
+		string__unsafe_index(Name, Cur, CurChar),
+		char__is_alnum_or_underscore(CurChar),
+		( CurChar = '_' ->
+			name_needs_no_mangling_1(Name, Next, Len)
+		;
+			name_needs_no_mangling(Name, Next, Len)
+		)
+	).
+
+:- pred name_needs_no_mangling_1(string::in, int::in, int::in) is semidet.
+
+name_needs_no_mangling_1(Name, Cur, Len) :-
+	( Cur >= Len ->
+		true
+	;
+		Next = Cur + 1,
+		string__unsafe_index(Name, Cur, CurChar),
+		char__is_alnum_or_underscore(CurChar),
+		( CurChar = 'f' ->
+			name_needs_no_mangling_2(Name, Next, Len)
+		; CurChar = '_' ->
+			name_needs_no_mangling_1(Name, Next, Len)
+		;
+			name_needs_no_mangling(Name, Next, Len)
+		)
+	).
+
+:- pred name_needs_no_mangling_2(string::in, int::in, int::in) is semidet.
+
+name_needs_no_mangling_2(Name, Cur, Len) :-
+	( Cur >= Len ->
+		true
+	;
+		Next = Cur + 1,
+		string__unsafe_index(Name, Cur, CurChar),
+		char__is_alnum(CurChar),	% no _or_underscore
+		name_needs_no_mangling(Name, Next, Len)
+	).
+
+	% Compute a version of the argument string that is acceptable *inside*
+	% identifiers in C and in other languages, i.e. it consists entirely
+	% of alphanumeric characters and underscores. Note that we do not
+	% ensure that the first character is not a digit, so we do not ensure
+	% that the returned string is acceptable *as* an identifier.
+	%
+	% Whenever possible, we try to replace sequences of non-identifier
+	% characters with a meaningful string, e.g. replacing "+" with as
+	% "_f_plus_". If a non-identifier character is not part of a string
+	% for which we know such a meaningful alias, we replace it with
+	% "_f_N_", where N is the characters integer value.
+	%
+	% To ensure that this transformation is uniquely invertible, none of
+	% the meaningful aliases start with a digit, and we replace all natural
+	% occurrences of "_f_" in the initial string with "_f__".
+
+:- func convert_to_valid_c_identifier(list(char)) = list(char).
+
+convert_to_valid_c_identifier([]) = [].
+convert_to_valid_c_identifier([Char1 | Chars1]) = MangledChars :-
+	( Char1 = '_', Chars1 = ['f' | Chars2], Chars2 = ['_' | Chars3] ->
+		MangledChars = ['_', 'f', '_', '_' |
+			convert_to_valid_c_identifier(Chars3)]
+	; char__is_alnum_or_underscore(Char1) ->
+		MangledChars = [Char1 | convert_to_valid_c_identifier(Chars1)]
+	; string_conversion_table([Char1 | Chars1], RestChars, ReplChars) ->
+		MangledChars = list__append(['_', 'f', '_' | ReplChars],
+			convert_to_valid_c_identifier(RestChars))
+	; char_conversion_table(Char1, [], ReplChars) ->
+		MangledChars = list__append(['_', 'f', '_' | ReplChars],
+			convert_to_valid_c_identifier(Chars1))
+	;
+		char__to_int(Char1, Code1),
+		string__int_to_string(Code1, CodeStr1),
+		string__to_char_list(CodeStr1, CodeChars1),
+		ReplChars = list__append(['_', 'f', '_' | CodeChars1], ['_']),
+		MangledChars = list__append(ReplChars,
+			convert_to_valid_c_identifier(Chars1))
+	).
+
+:- func convert_from_valid_c_identifier(list(char)) = list(char).
+
+convert_from_valid_c_identifier([]) = [].
+convert_from_valid_c_identifier([Char1 | Chars1]) = DeMangledChars :-
+	( Char1 = '_', Chars1 = ['f', '_'  | Chars3] ->
+		(
+			Chars3 = ['_' | Chars4]
+		->
+			DeMangledChars = ['_', 'f', '_' |
+				convert_from_valid_c_identifier(Chars4)]
+		;
+			rev_string_conversion_table(ReplChars, RestChars,
+				Chars3)
+		->
+			DeMangledChars = list__append(ReplChars,
+				convert_from_valid_c_identifier(RestChars))
+		;
+			char_conversion_table(ReplChar, RestChars, Chars3)
+		->
+			DeMangledChars = [ReplChar |
+				convert_from_valid_c_identifier(RestChars)]
+		;
+			list__takewhile(char__is_digit, Chars3, Digits,
+				RestChars1),
+			RestChars1 = ['_' | RestChars],
+			string__from_char_list(Digits, DigitStr),
+			string__to_int(DigitStr, Code),
+			char__to_int(CodeChar, Code)
+		->
+			DeMangledChars = [CodeChar |
+				convert_from_valid_c_identifier(RestChars)]
+		;
+			error("convert_from_valid_c_identifier: non-mangled name")
+		)
+	;
+		DeMangledChars = [Char1 |
+			convert_from_valid_c_identifier(Chars1)]
+	).
+
+	% A table used to convert Mercury name fragments into C identifier
+	% fragments.  Feel free to add any new translations you want.
+	% The C identifier fragments will have "_f_" put in front of them;
+	% they must supply the final "_".
+
+:- pred string_conversion_table(list(char), list(char), list(char)).
+:- mode string_conversion_table(in, out, out) is semidet.
+
+string_conversion_table(['{', '}' | Rest], Rest,
+	['t', 'u', 'p', 'l', 'e', '_']).
+string_conversion_table(['[', '|', ']' | Rest], Rest,
+	['c', 'o', 'n', 's', '_']).
+string_conversion_table(['[', ']' | Rest], Rest,
+	['n', 'i', 'l', '_']).
+string_conversion_table(['\\', '=' | Rest], Rest,
+	['n', 'o', 't', '_', 'e', 'q', 'u', 'a', 'l', '_']).
+string_conversion_table(['>', '=' | Rest], Rest,
+	['g', 'r', 'e', 'a', 't', 'e', 'r', '_', 'o', 'r',
+		'_', 'e', 'q', 'u', 'a', 'l', '_']).
+string_conversion_table(['=', '<' | Rest], Rest,
+	['l', 'e', 's', 's', '_', 'o', 'r',
+		'_', 'e', 'q', 'u', 'a', 'l', '_']).
+
+:- pred rev_string_conversion_table(list(char), list(char), list(char)).
+:- mode rev_string_conversion_table(out, out, in) is semidet.
+
+rev_string_conversion_table(['{', '}' ], Rest,
+	['t', 'u', 'p', 'l', 'e', '_' | Rest]).
+rev_string_conversion_table(['[', '|', ']' ], Rest,
+	['c', 'o', 'n', 's', '_' | Rest]).
+rev_string_conversion_table(['[', ']' ], Rest,
+	['n', 'i', 'l', '_' | Rest]).
+rev_string_conversion_table(['\\', '=' ], Rest,
+	['n', 'o', 't', '_', 'e', 'q', 'u', 'a', 'l', '_' | Rest]).
+rev_string_conversion_table(['>', '=' ], Rest,
+	['g', 'r', 'e', 'a', 't', 'e', 'r', '_', 'o', 'r',
+	'_', 'e', 'q', 'u', 'a', 'l', '_' | Rest]).
+rev_string_conversion_table(['=', '<' ], Rest,
+	['l', 'e', 's', 's', '_', 'o', 'r',
+	'_', 'e', 'q', 'u', 'a', 'l', '_' | Rest]).
+
+:- pred char_conversion_table(char, list(char), list(char)).
+:- mode char_conversion_table(in, in, out) is semidet.
+:- mode char_conversion_table(out, out, in) is semidet.
+
+char_conversion_table('=', Rest,
+	['e', 'q', 'u', 'a', 'l', '_' | Rest]).
+char_conversion_table('<', Rest,
+	['l', 'e', 's', 's', '_', 't', 'h', 'a', 'n', '_' | Rest]).
+char_conversion_table('>', Rest,
+	['g', 'r', 'e', 'a', 't', 'e', 'r', '_',
+	't', 'h', 'a', 'n', '_' | Rest]).
+char_conversion_table('-', Rest,
+	['m', 'i', 'n', 'u', 's', '_' | Rest]).
+char_conversion_table('+', Rest,
+	['p', 'l', 'u', 's', '_' | Rest]).
+char_conversion_table('*', Rest,
+	['t', 'i', 'm', 'e', 's', '_' | Rest]).
+char_conversion_table('/', Rest,
+	['s', 'l', 'a', 's', 'h', '_' | Rest]).
+char_conversion_table(',', Rest,
+	['c', 'o', 'm', 'm', 'a', '_' | Rest]).
+char_conversion_table(':', Rest,
+	['c', 'o', 'l', 'o', 'n', '_' | Rest]).
+char_conversion_table(';', Rest,
+	['s', 'e', 'm', 'i', 'c', 'o', 'l', 'o', 'n', '_' | Rest]).
+char_conversion_table('!', Rest,
+	['e', 'x', 'c', 'l', '_' | Rest]).
+char_conversion_table('?', Rest,
+	['q', 'u', 'e', 's', 't', 'i', 'o', 'n', '_' | Rest]).
+char_conversion_table('(', Rest,
+	['l', 'p', 'a', 'r', 'e', 'n', '_' | Rest]).
+char_conversion_table(')', Rest,
+	['r', 'p', 'a', 'r', 'e', 'n', '_' | Rest]).
+char_conversion_table('[', Rest,
+	['l', 'b', 'r', 'a', 'c', 'k', 'e', 't', '_' | Rest]).
+char_conversion_table(']', Rest,
+	['r', 'b', 'r', 'a', 'c', 'k', 'e', 't', '_' | Rest]).
+char_conversion_table('@', Rest,
+	['a', 't', '_' | Rest]).
+char_conversion_table('#', Rest,
+	['h', 'a', 's', 'h', '_' | Rest]).
+char_conversion_table('%', Rest,
+	['p', 'e', 'r', 'c', 'e', 'n', 't', '_' | Rest]).
+char_conversion_table('^', Rest,
+	['u', 'p', '_' | Rest]).
+char_conversion_table('&', Rest,
+	['a', 'm', 'p', 'e', 'r', 's', 'a', 'n', 'd', '_' | Rest]).
+char_conversion_table('~', Rest,
+	['t', 'i', 'l', 'd', 'e', '_' | Rest]).
+char_conversion_table('''', Rest,
+	['f', 'o', 'r', 'w', 'q', 'u', 'o', 't', 'e', '_' | Rest]).
+char_conversion_table('`', Rest,
+	['b', 'a', 'c', 'k', 'q', 'u', 'o', 't', 'e', '_' | Rest]).
+char_conversion_table('"', Rest,
+	['d', 'o', 'u', 'b', 'l', 'e', 'q', 'u', 'o', 't', 'e', '_' | Rest]).
+
+%-----------------------------------------------------------------------------%
+
+qualify_name(Module0, Name0, Name) :-
+	string__append_list([Module0, "__", Name0], Name).
+
+maybe_qualify_name(Module0, Name0, Name) :-
+	string__append(Module0, "__", UnderscoresModule),
+	( string__append(UnderscoresModule, _, Name0) ->
+		Name = Name0
+	;
+		string__append(UnderscoresModule, Name0, Name)
+	).
+
+%-----------------------------------------------------------------------------%
Index: browser/mdb.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/mdb.m,v
retrieving revision 1.5
diff -u -b -r1.5 mdb.m
--- browser/mdb.m	2001/02/23 04:14:41	1.5
+++ browser/mdb.m	2002/01/03 15:01:50
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1998-2001 The University of Melbourne.
+% Copyright (C) 1998-2002 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -10,14 +10,16 @@
 
 :- pred mdb__version(string::out) is det.
 
-	% These interface modules are used directly by the test programs
-	% or the libmer_trace library.
+	% These interface modules are used directly by the compiler, the
+	% profilers, the test programs or the libmer_trace library.
 :- include_module browser_info, browse, help.
 :- include_module interactive_query.
 :- include_module debugger_interface, collect_lib.
 :- include_module declarative_debugger, declarative_execution.
 :- include_module program_representation.
 
+:- import_module names, mangle.
+
 :- implementation.
 
 :- include_module frame, parse, util, sized_pretty.
@@ -25,7 +27,7 @@
 
 	% XXX these modules are more generally useful, but the
 	% dynamic linking library is not yet installed anywhere.
-:- include_module dl, name_mangle.
+:- import_module dl, name_mangle.
 
 % See library/library.m for why we implement this predicate this way.
 
Index: browser/name_mangle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/name_mangle.m,v
retrieving revision 1.4
diff -u -b -r1.4 name_mangle.m
--- browser/name_mangle.m	2001/01/11 05:59:31	1.4
+++ browser/name_mangle.m	2002/01/03 15:04:06
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2000 The University of Melbourne.
+% Copyright (C) 1998-2000,2002 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -20,9 +20,12 @@
 % it can be easily changed if the representation of `mercury_proc' changes.
 
 %-----------------------------------------------------------------------------%
-:- module mdb__name_mangle.
+
+:- module name_mangle.
 :- interface.
 
+:- import_module names.
+
 	% Given a mercury_proc specifying the module name,
 	% predicate or function indicator, predicate name, arity,
 	% and mode number of a Mercury procedure,
@@ -38,24 +41,15 @@
 	--->	predicate
 	;	function.
 
-:- type module_name == sym_name.
-
-:- type sym_name
-	--->	qualified(sym_name, string)
-	;	unqualified(string).
-
 :- type pred_name == string.
 
-:- type arity == int.		% note that for functions that arity here
-				% does *not* include the function result
-				% e.g. int:'*' has arity 2, not 3.
-
 :- type mode_num == int.	% mode numbers start from zero
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
 :- implementation.
+:- import_module mangle.
 :- import_module string, char, int, list.
 
 % XXX most of the code below is very similar to the code in
@@ -138,114 +132,6 @@
 	string__append_list([LabelName1, "_", ArityString, "_",
 		PredOrFuncString, "_", ModeNumString],
 		LabelName).
-
-:- pred sym_name_mangle(sym_name, string).
-:- mode sym_name_mangle(in, out) is det.
-
-sym_name_mangle(unqualified(Name), MangledName) :-
-	name_mangle(Name, MangledName).
-sym_name_mangle(qualified(ModuleName, PlainName), MangledName) :-
-	sym_name_mangle(ModuleName, MangledModuleName),
-	name_mangle(PlainName, MangledPlainName),
-	qualify_name(MangledModuleName, MangledPlainName,
-			MangledName).
-	
-	% Convert a Mercury predicate name into something that can form
-	% part of a C identifier.  This predicate is necessary because
-	% quoted names such as 'name with embedded spaces' are valid
-	% predicate names in Mercury.
-
-:- pred name_mangle(string, string).
-:- mode name_mangle(in, out) is det.
-
-name_mangle(Name, MangledName) :-
-	(
-		string__is_alnum_or_underscore(Name)
-	->
-		% any names that start with `f_' are changed so that
-		% they start with `f__', so that we can use names starting
-		% with `f_' (followed by anything except an underscore)
-		% without fear of name collisions
-		(
-			string__append("f_", Suffix, Name)
-		->
-			string__append("f__", Suffix, MangledName)
-		;
-			MangledName = Name
-		)
-	;
-		convert_to_valid_c_identifier(Name, MangledName)
-	).
-
-:- pred convert_to_valid_c_identifier(string, string).
-:- mode convert_to_valid_c_identifier(in, out) is det.
-
-convert_to_valid_c_identifier(String, Name) :-	
-	(
-		name_conversion_table(String, Name0)
-	->
-		Name = Name0
-	;
-		convert_to_valid_c_identifier_2(String, Name0),
-		string__append("f", Name0, Name)
-	).
-
-:- pred qualify_name(string, string, string).
-:- mode qualify_name(in, in, out) is det.
-
-qualify_name(Module0, Name0, Name) :-
-	string__append_list([Module0, "__", Name0], Name).
-
-	% A table used to convert Mercury functors into
-	% C identifiers.  Feel free to add any new translations you want.
-	% The C identifiers should start with "f_",
-	% to avoid introducing name clashes.
-	% If the functor name is not found in the table, then
-	% we use a fall-back method which produces ugly names.
-
-:- pred name_conversion_table(string, string).
-:- mode name_conversion_table(in, out) is semidet.
-
-name_conversion_table("\\=", "f_not_equal").
-name_conversion_table(">=", "f_greater_or_equal").
-name_conversion_table("=<", "f_less_or_equal").
-name_conversion_table("=", "f_equal").
-name_conversion_table("<", "f_less_than").
-name_conversion_table(">", "f_greater_than").
-name_conversion_table("-", "f_minus").
-name_conversion_table("+", "f_plus").
-name_conversion_table("*", "f_times").
-name_conversion_table("/", "f_slash").
-name_conversion_table(",", "f_comma").
-name_conversion_table(";", "f_semicolon").
-name_conversion_table("!", "f_cut").
-
-	% This is the fall-back method.
-	% Given a string, produce a C identifier
-	% for that string by concatenating the decimal
-	% expansions of the character codes in the string,
-	% separated by underlines.
-	% The C identifier will start with "f_"; this predicate
-	% constructs everything except the initial "f".
-	%
-	% For example, given the input "\n\t" we return "_10_8".
-
-:- pred convert_to_valid_c_identifier_2(string, string).
-:- mode convert_to_valid_c_identifier_2(in, out) is det.
-
-convert_to_valid_c_identifier_2(String, Name) :-	
-	(
-		string__first_char(String, Char, Rest)
-	->
-		char__to_int(Char, Code),
-		string__int_to_string(Code, CodeString),
-		string__append("_", CodeString, ThisCharString),
-		convert_to_valid_c_identifier_2(Rest, Name0),
-		string__append(ThisCharString, Name0, Name)
-	;
-		% String is the empty string
-		Name = String
-	).
 
 :- pred use_asm_labels is semidet.
 :- pragma c_code(use_asm_labels, [will_not_call_mercury, thread_safe], "
Index: browser/names.m
===================================================================
RCS file: names.m
diff -N names.m
--- /dev/null	Fri Dec  1 02:25:58 2000
+++ names.m	Fri Jan  4 18:34:54 2002
@@ -0,0 +1,30 @@
+%-----------------------------------------------------------------------------%
+% Copyright (C) 2002 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.
+%-----------------------------------------------------------------------------%
+
+% This module holds the specification of symbol names.
+
+% Main authors: fjh, zs.
+
+%-----------------------------------------------------------------------------%
+
+:- module names.
+
+:- interface.
+
+:- type sym_name_specifier 
+	--->	name(sym_name)
+	;	name_arity(sym_name, arity).
+
+:- type sym_name 	
+	--->	unqualified(string)
+	;	qualified(module_specifier, string).
+
+:- type sym_name_and_arity
+	--->	sym_name / arity.
+
+:- type module_specifier ==	sym_name.
+:- type module_name 	== 	sym_name.
+:- type arity		==	int.
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.18
diff -u -b -r1.18 accumulator.m
--- compiler/accumulator.m	2000/10/13 13:55:13	1.18
+++ compiler/accumulator.m	2002/01/04 07:51:41
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2000 The University of Melbourne.
+% Copyright (C) 1999-2000,2002 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.
 %-----------------------------------------------------------------------------%
@@ -145,6 +145,7 @@
 :- import_module inst_match, instmap, mode_util, options.
 :- import_module prog_data, prog_util, quantification.
 
+:- import_module names.
 :- import_module assoc_list, bool, int, list, map, multi_map.
 :- import_module require, set, std_util, string, term, varset.
 
Index: compiler/assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.14
diff -u -b -r1.14 assertion.m
--- compiler/assertion.m	2001/07/20 14:13:19	1.14
+++ compiler/assertion.m	2002/01/04 07:52:23
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -133,6 +133,7 @@
 
 :- import_module globals, goal_util, hlds_out.
 :- import_module options, prog_out, prog_util, type_util.
+:- import_module names.
 :- import_module assoc_list, bool, list, map, require, set, std_util.
 
 :- type subst == map(prog_var, prog_var).
Index: compiler/base_typeclass_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/base_typeclass_info.m,v
retrieving revision 1.20
diff -u -b -r1.20 base_typeclass_info.m
--- compiler/base_typeclass_info.m	2000/11/01 05:11:49	1.20
+++ compiler/base_typeclass_info.m	2002/01/04 07:52:43
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2000 The University of Melbourne.
+% Copyright (C) 1996-2000,2002 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.
 %---------------------------------------------------------------------------%
@@ -35,9 +35,10 @@
 
 :- import_module prog_io, prog_out.
 :- import_module hlds_data, hlds_pred, hlds_out.
-:- import_module code_util, globals, options, term.
+:- import_module code_util, type_util, globals, options.
+:- import_module names.
 :- import_module bool, string, map, std_util, require, assoc_list.
-:- import_module type_util, int.
+:- import_module int, term.
 
 %---------------------------------------------------------------------------%
 
Index: compiler/builtin_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/builtin_ops.m,v
retrieving revision 1.10
diff -u -b -r1.10 builtin_ops.m
--- compiler/builtin_ops.m	2001/11/03 17:34:55	1.10
+++ compiler/builtin_ops.m	2002/01/03 12:54:30
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -16,9 +16,9 @@
 
 :- module builtin_ops.
 :- interface.
-:- import_module prog_data, hlds_pred.
+:- import_module hlds_pred.
+:- import_module names.
 :- import_module list.
-
 
 :- type unary_op
 	--->	mktag
Index: compiler/bytecode.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode.m,v
retrieving revision 1.48
diff -u -b -r1.48 bytecode.m
--- compiler/bytecode.m	2001/07/08 16:40:04	1.48
+++ compiler/bytecode.m	2002/01/04 07:53:00
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %---------------------------------------------------------------------------%
@@ -15,6 +15,7 @@
 :- interface.
 
 :- import_module hlds_data, prog_data, tree, builtin_ops.
+:- import_module names.
 :- import_module char, list, std_util, io.
 
 :- type byte_tree	==	tree(list(byte_code)).
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.65
diff -u -b -r1.65 bytecode_gen.m
--- compiler/bytecode_gen.m	2001/10/31 16:58:06	1.65
+++ compiler/bytecode_gen.m	2002/01/04 07:53:12
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %---------------------------------------------------------------------------%
@@ -46,6 +46,7 @@
 :- import_module globals, tree.
 :- import_module prog_out.
 
+:- import_module names.
 :- import_module bool, int, string, list, assoc_list, set, map, varset.
 :- import_module std_util, require, term.
 
Index: compiler/c_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/c_util.m,v
retrieving revision 1.9
diff -u -b -r1.9 c_util.m
--- compiler/c_util.m	2001/03/13 12:40:07	1.9
+++ compiler/c_util.m	2002/01/02 16:41:57
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -166,7 +166,7 @@
 			% string literals can be no longer then 2048
 			% chars.  However if you output the string in
 			% chunks, eg "part a" "part b" it will accept a
-			% string longer then 2048 chars, go figure!
+			% string longer than 2048 chars, go figure!
 		( { Cur \= 0, Cur mod 512 = 0 } ->
 			io__write_string("\" \"")
 		;
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.45
diff -u -b -r1.45 check_typeclass.m
--- compiler/check_typeclass.m	2001/09/19 01:12:31	1.45
+++ compiler/check_typeclass.m	2002/01/04 07:53:23
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %---------------------------------------------------------------------------%
@@ -66,6 +66,7 @@
 :- import_module mercury_to_mercury, error_util.
 :- import_module globals, options. 
 
+:- import_module names.
 :- import_module int, string.
 :- import_module list, assoc_list, map, set, term, varset.
 :- import_module std_util, require. 
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.133
diff -u -b -r1.133 code_util.m
--- compiler/code_util.m	2001/10/31 16:58:07	1.133
+++ compiler/code_util.m	2002/01/03 12:42:28
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -20,6 +20,7 @@
 :- import_module prog_data, hlds_module, hlds_pred, hlds_goal, hlds_data.
 :- import_module rtti, llds.
 
+:- import_module names.
 :- import_module bool, list, std_util.
 
 	% Create a code address which holds the address of the specified
Index: compiler/common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/common.m,v
retrieving revision 1.60
diff -u -b -r1.60 common.m
--- compiler/common.m	2001/12/06 10:16:39	1.60
+++ compiler/common.m	2002/01/04 07:53:30
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1995-2001 The University of Melbourne.
+% Copyright (C) 1995-2002 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.
 %---------------------------------------------------------------------------%
@@ -82,8 +82,9 @@
 
 :- import_module quantification, mode_util, type_util, prog_util.
 :- import_module det_util, det_report, globals, options, inst_match, instmap.
-:- import_module hlds_data, hlds_module, (inst), pd_cost, term.
-:- import_module bool, map, set, eqvclass, require, std_util, string.
+:- import_module hlds_data, hlds_module, (inst), pd_cost.
+:- import_module names.
+:- import_module bool, map, set, eqvclass, require, std_util, string, term.
 
 :- type structure
 	--->	structure(prog_var, type, cons_id, list(prog_var)).
Index: compiler/const_prop.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/const_prop.m,v
retrieving revision 1.13
diff -u -b -r1.13 const_prop.m
--- compiler/const_prop.m	2001/11/03 17:34:55	1.13
+++ compiler/const_prop.m	2002/01/03 13:01:52
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %---------------------------------------------------------------------------%
@@ -35,8 +35,9 @@
 :- import_module hlds_goal, hlds_data, instmap, inst_match.
 :- import_module globals, options, passes_aux, prog_data, mode_util, type_util.
 :- import_module code_util, quantification, modes.
-:- import_module bool, list, int, float, map, require.
-:- import_module (inst), hlds_out, std_util.
+:- import_module (inst), hlds_out.
+:- import_module names.
+:- import_module bool, list, int, float, map, require, std_util.
 
 %------------------------------------------------------------------------------%
 
Index: compiler/context.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/context.m,v
retrieving revision 1.4
diff -u -b -r1.4 context.m
--- compiler/context.m	2001/05/02 17:34:32	1.4
+++ compiler/context.m	2002/01/03 12:55:52
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2000 University of Melbourne.
+% Copyright (C) 1998-2000,2002 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.
 %-----------------------------------------------------------------------------%
@@ -49,6 +49,7 @@
 
 :- import_module hlds_data, hlds_module, (inst), instmap.
 :- import_module goal_util.
+:- import_module names.
 :- import_module assoc_list, bool, map, require, set, std_util, term, varset.
 
 context__process_disjuncts(OldPredProcId, Inputs, Outputs,
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.66
diff -u -b -r1.66 dead_proc_elim.m
--- compiler/dead_proc_elim.m	2001/07/20 14:13:21	1.66
+++ compiler/dead_proc_elim.m	2002/01/03 12:59:45
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -18,7 +18,8 @@
 
 :- interface.
 
-:- import_module prog_data, hlds_module, hlds_pred.
+:- import_module hlds_module, hlds_pred.
+:- import_module names.
 :- import_module map, std_util, io.
 
 :- pred dead_proc_elim(module_info, module_info, io__state, io__state).
@@ -52,6 +53,7 @@
 
 :- import_module hlds_goal, hlds_data, prog_util, llds.
 :- import_module passes_aux, globals, options, code_util.
+:- import_module prog_data.
 
 :- import_module int, string, list, set, queue, bool, require.
 
Index: compiler/deep_profiling.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deep_profiling.m,v
retrieving revision 1.5
diff -u -b -r1.5 deep_profiling.m
--- compiler/deep_profiling.m	2001/07/18 07:52:23	1.5
+++ compiler/deep_profiling.m	2002/01/04 07:53:41
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 The University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -30,6 +30,7 @@
 :- import_module code_model, code_util, prog_util, type_util, mode_util.
 :- import_module quantification, dependency_graph, rtti, trace.
 :- import_module options, globals.
+:- import_module names.
 :- import_module bool, int, list, assoc_list, map, require, set.
 :- import_module std_util, string, term, varset, counter.
 
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.24
diff -u -b -r1.24 deforest.m
--- compiler/deforest.m	2001/08/11 14:09:37	1.24
+++ compiler/deforest.m	2002/01/03 13:04:36
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -51,6 +51,7 @@
 :- import_module modes, mode_info, unique_modes, options, hlds_out.
 :- import_module prog_out, quantification, det_report.
 
+:- import_module names.
 :- import_module assoc_list, bool, getopt, int, list, map, require.
 :- import_module set, std_util, string, term, varset.
 
Index: compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.54
diff -u -b -r1.54 dependency_graph.m
--- compiler/dependency_graph.m	2001/05/31 05:59:32	1.54
+++ compiler/dependency_graph.m	2002/01/04 07:53:50
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1995-2001 The University of Melbourne.
+% Copyright (C) 1995-2002 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.
 %-----------------------------------------------------------------------------%
@@ -107,6 +107,7 @@
 % the LLDS labels used for dependency_graph__write_prof_dependency_graph.
 :- import_module llds, llds_out.
 
+:- import_module names.
 :- import_module term, varset.
 :- import_module int, bool, term, require, string.
 :- import_module map, multi_map, set, std_util.
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.26
diff -u -b -r1.26 equiv_type.m
--- compiler/equiv_type.m	2001/06/27 05:04:03	1.26
+++ compiler/equiv_type.m	2002/01/03 12:57:01
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -11,8 +11,9 @@
 
 :- module equiv_type.
 :- interface.
-:- import_module bool, list, io, std_util.
 :- import_module recompilation, prog_data.
+:- import_module names.
+:- import_module bool, list, io, std_util.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/error_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/error_util.m,v
retrieving revision 1.15
diff -u -b -r1.15 error_util.m
--- compiler/error_util.m	2001/07/30 03:55:49	1.15
+++ compiler/error_util.m	2002/01/04 07:53:55
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -17,6 +17,7 @@
 :- interface.
 
 :- import_module hlds_module, hlds_pred, prog_data.
+:- import_module names.
 :- import_module assoc_list, char, io, list, std_util.
 
 	% Given a context, a starting indentation level and a list of words,
Index: compiler/export.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/export.m,v
retrieving revision 1.50
diff -u -b -r1.50 export.m
--- compiler/export.m	2001/11/06 15:20:40	1.50
+++ compiler/export.m	2002/01/03 13:04:14
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -19,6 +19,7 @@
 :- interface.
 
 :- import_module prog_data, hlds_module, foreign.
+:- import_module names.
 :- import_module io.
 
 	% From the module_info, get a list of foreign_export_decls,
@@ -69,7 +70,7 @@
 :- import_module modules.
 :- import_module hlds_pred, type_util.
 :- import_module code_model.
-:- import_module code_gen, code_util, llds_out.
+:- import_module code_gen, code_util, llds_out, mangle.
 :- import_module globals, options.
 
 :- import_module term, varset.
@@ -568,7 +569,7 @@
 			SourceFileName,
 			"' by the\n** Mercury compiler, version ", Version,
 			".\n** Do not edit.\n*/\n"]),
-		{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
+		{ sym_name_mangle(ModuleName, MangledModuleName) },
 		{ string__to_upper(MangledModuleName, UppercaseModuleName) },
 		{ string__append(UppercaseModuleName, "_H", GuardMacroName) },
 		io__write_strings([
Index: compiler/fact_table.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/fact_table.m,v
retrieving revision 1.40
diff -u -b -r1.40 fact_table.m
--- compiler/fact_table.m	2001/10/24 13:34:10	1.40
+++ compiler/fact_table.m	2002/01/03 12:46:02
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -49,8 +49,9 @@
 
 :- interface.
 
-:- import_module io, list.
 :- import_module prog_data, hlds_pred, hlds_module.
+:- import_module names.
+:- import_module io, list.
 
 	% compile the fact table into a separate .c file.
 	% fact_table_compile_facts(PredName, Arity, FileName, PredInfo0, 
@@ -98,7 +99,7 @@
 % LLDS back-end modules
 :- import_module arg_info, llds, llds_out, code_util, export, foreign.
 % Modules shared between different back-ends.
-:- import_module passes_aux, code_model.
+:- import_module mangle, passes_aux, code_model.
 % Misc
 :- import_module globals, options.
 
@@ -2437,7 +2438,7 @@
 :- pred make_fact_table_identifier(sym_name::in, string::out) is det.
 
 make_fact_table_identifier(SymName, Identifier) :-
-	llds_out__sym_name_mangle(SymName, Identifier).
+	sym_name_mangle(SymName, Identifier).
 
 %---------------------------------------------------------------------------%
 
Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.9
diff -u -b -r1.9 foreign.m
--- compiler/foreign.m	2001/11/06 15:20:41	1.9
+++ compiler/foreign.m	2002/01/03 12:41:15
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2000-2001 The University of Melbourne.
+% Copyright (C) 2000-2002 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.
 %-----------------------------------------------------------------------------%
@@ -21,6 +21,7 @@
 :- import_module prog_data, globals.
 :- import_module hlds_module, hlds_pred.
 
+:- import_module names.
 :- import_module bool, list, string, term.
 
 :- type foreign_decl_info ==	list(foreign_decl_code).	
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.71
diff -u -b -r1.71 goal_util.m
--- compiler/goal_util.m	2001/11/26 09:30:56	1.71
+++ compiler/goal_util.m	2002/01/04 07:54:05
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1995-2001 The University of Melbourne.
+% Copyright (C) 1995-2002 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.
 %-----------------------------------------------------------------------------%
@@ -16,6 +16,7 @@
 
 :- import_module hlds_data, hlds_goal, hlds_module, hlds_pred.
 :- import_module (inst), instmap, prog_data.
+:- import_module names.
 :- import_module assoc_list, bool, list, set, map, term, std_util.
 
 % The predicates rename_var* take a structure and a mapping from var -> var
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.91
diff -u -b -r1.91 higher_order.m
--- compiler/higher_order.m	2001/07/31 14:29:29	1.91
+++ compiler/higher_order.m	2002/01/04 07:54:13
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -41,6 +41,7 @@
 :- import_module mercury_to_mercury, inlining, polymorphism, prog_util.
 :- import_module special_pred, unify_proc, passes_aux.
 
+:- import_module names.
 :- import_module assoc_list, bool, char, int, list, map, require, set.
 :- import_module std_util, string, varset, term.
 
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.62
diff -u -b -r1.62 hlds_data.m
--- compiler/hlds_data.m	2001/12/06 09:27:34	1.62
+++ compiler/hlds_data.m	2002/01/04 07:54:32
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -14,6 +14,7 @@
 :- interface.
 
 :- import_module hlds_pred, prog_data, (inst), rtti.
+:- import_module names.
 :- import_module bool, list, map, std_util, term.
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.90
diff -u -b -r1.90 hlds_goal.m
--- compiler/hlds_goal.m	2001/07/24 01:35:30	1.90
+++ compiler/hlds_goal.m	2002/01/03 12:49:12
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -14,6 +14,7 @@
 
 :- import_module hlds_data, hlds_pred, prog_data, (inst), instmap.
 :- import_module llds.	% XXX needed for `lval'
+:- import_module names.
 :- import_module bool, char, list, set, map, std_util.
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.69
diff -u -b -r1.69 hlds_module.m
--- compiler/hlds_module.m	2001/11/06 15:20:41	1.69
+++ compiler/hlds_module.m	2002/01/04 07:54:35
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -24,6 +24,7 @@
 :- import_module prog_data, module_qual, recompilation.
 :- import_module hlds_pred, hlds_data, unify_proc, special_pred.
 :- import_module globals, foreign.
+:- import_module names.
 :- import_module relation, map, std_util, list, set, multi_map, counter.
 
 :- implementation.
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.271
diff -u -b -r1.271 hlds_out.m
--- compiler/hlds_out.m	2001/10/31 14:02:54	1.271
+++ compiler/hlds_out.m	2002/01/04 07:54:38
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -37,6 +37,7 @@
 % HLDS modules
 :- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, instmap.
 
+:- import_module names.
 :- import_module io, bool, list, term.
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.101
diff -u -b -r1.101 hlds_pred.m
--- compiler/hlds_pred.m	2001/08/24 15:44:47	1.101
+++ compiler/hlds_pred.m	2002/01/03 12:51:47
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -18,6 +18,7 @@
 :- import_module mode_errors.
 :- import_module globals.
 
+:- import_module names.
 :- import_module bool, list, set, map, std_util, term, varset.
 
 :- implementation.
Index: compiler/inst.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inst.m,v
retrieving revision 1.7
diff -u -b -r1.7 inst.m
--- compiler/inst.m	2000/10/13 13:55:28	1.7
+++ compiler/inst.m	2002/01/03 12:40:31
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997, 1999-2000 The University of Melbourne.
+% Copyright (C) 1997,1999-2000,2002 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.
 %-----------------------------------------------------------------------------%
@@ -23,6 +23,7 @@
 %     `abstract_cons_id' and use that here instead of `cons_id'.
 
 :- import_module prog_data, hlds_data.
+:- import_module names.
 :- import_module list, map.
 
 %-----------------------------------------------------------------------------%
Index: compiler/inst_match.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inst_match.m,v
retrieving revision 1.48
diff -u -b -r1.48 inst_match.m
--- compiler/inst_match.m	2001/10/12 05:23:41	1.48
+++ compiler/inst_match.m	2002/01/04 07:54:49
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1995-1998, 2000-2001 The University of Melbourne.
+% Copyright (C) 1995-1998, 2000-2002 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.
 %-----------------------------------------------------------------------------%
@@ -266,6 +266,7 @@
 
 :- implementation.
 :- import_module hlds_data, mode_util, prog_data, inst_util, type_util.
+:- import_module names.
 :- import_module list, set, map, term, std_util, require, bool.
 
 inst_matches_initial(InstA, InstB, Type, ModuleInfo) :-
Index: compiler/inst_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inst_util.m,v
retrieving revision 1.18
diff -u -b -r1.18 inst_util.m
--- compiler/inst_util.m	2001/10/12 05:23:42	1.18
+++ compiler/inst_util.m	2002/01/03 13:06:26
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -42,6 +42,7 @@
 :- interface.
 
 :- import_module hlds_module, hlds_data, prog_data, (inst).
+:- import_module names.
 :- import_module list, std_util.
 
 :- pred abstractly_unify_inst(is_live, inst, inst, unify_is_real, module_info,
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.109
diff -u -b -r1.109 intermod.m
--- compiler/intermod.m	2001/11/06 15:20:44	1.109
+++ compiler/intermod.m	2002/01/03 13:24:48
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -83,14 +83,15 @@
 
 :- implementation.
 
-:- import_module assoc_list, dir, getopt, int, list, map, multi_map, require.
-:- import_module set, std_util, string, term, varset.
-
 :- import_module code_util, globals, goal_util, term, varset.
 :- import_module hlds_data, hlds_goal, hlds_pred, hlds_out, inlining, llds.
 :- import_module mercury_to_mercury, mode_util, modules.
 :- import_module options, passes_aux, prog_data, prog_io, prog_out, prog_util.
 :- import_module special_pred, typecheck, type_util, instmap, (inst), foreign.
+
+:- import_module names.
+:- import_module assoc_list, dir, getopt, int, list, map, multi_map, require.
+:- import_module set, std_util, string, term, varset.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout.m,v
retrieving revision 1.3
diff -u -b -r1.3 layout.m
--- compiler/layout.m	2001/07/03 08:16:05	1.3
+++ compiler/layout.m	2002/01/03 12:41:31
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 The University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -33,6 +33,7 @@
 :- interface.
 
 :- import_module prog_data, trace_params, llds, rtti, hlds_goal.
+:- import_module names.
 :- import_module bool, std_util, list, assoc_list.
 
 :- type layout_data
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.5
diff -u -b -r1.5 layout_out.m
--- compiler/layout_out.m	2001/07/03 08:16:05	1.5
+++ compiler/layout_out.m	2002/01/03 13:09:30
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 The University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -77,8 +77,9 @@
 
 :- implementation.
 
-:- import_module prog_data, prog_out, hlds_pred, trace_params, c_util.
+:- import_module prog_data, prog_out, hlds_pred, trace_params, c_util, mangle.
 :- import_module rtti, trace, code_util.
+:- import_module names.
 :- import_module int, char, string, require, std_util, list.
 
 output_layout_data_defn(label_layout_data(Label, ProcLayoutAddr,
@@ -200,43 +201,43 @@
 output_layout_name(file_layout(ModuleName, FileNum)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_file_layout__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr),
 	io__write_string("_"),
 	io__write_int(FileNum).
 output_layout_name(file_layout_line_number_vector(ModuleName, FileNum)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_file_lines__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr),
 	io__write_string("_"),
 	io__write_int(FileNum).
 output_layout_name(file_layout_label_layout_vector(ModuleName, FileNum)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_file_label_layouts__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr),
 	io__write_string("_"),
 	io__write_int(FileNum).
 output_layout_name(module_layout_string_table(ModuleName)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_module_strings__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr).
 output_layout_name(module_layout_file_vector(ModuleName)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_module_files__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr).
 output_layout_name(module_layout_proc_vector(ModuleName)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_module_procs__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr).
 output_layout_name(module_layout(ModuleName)) -->
 	io__write_string(mercury_data_prefix),
 	io__write_string("_module_layout__"),
-	{ llds_out__sym_name_mangle(ModuleName, ModuleNameStr) },
+	{ sym_name_mangle(ModuleName, ModuleNameStr) },
 	io__write_string(ModuleNameStr).
 output_layout_name(proc_static(RttiProcLabel)) -->
 	io__write_string(mercury_data_prefix),
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.280
diff -u -b -r1.280 llds.m
--- compiler/llds.m	2001/11/06 15:20:46	1.280
+++ compiler/llds.m	2002/01/03 12:41:37
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1993-2001 The University of Melbourne.
+% Copyright (C) 1993-2002 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.
 %-----------------------------------------------------------------------------%
@@ -21,6 +21,7 @@
 :- import_module foreign, code_model, rtti, layout, builtin_ops.
 :- import_module tree.
 
+:- import_module names.
 :- import_module bool, assoc_list, list, map, set, std_util, counter, term.
 
 %-----------------------------------------------------------------------------%
Index: compiler/llds_common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_common.m,v
retrieving revision 1.39
diff -u -b -r1.39 llds_common.m
--- compiler/llds_common.m	2001/07/03 08:16:05	1.39
+++ compiler/llds_common.m	2002/01/03 12:46:36
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -21,7 +21,7 @@
 :- interface.
 
 :- import_module llds.
-:- import_module prog_data. % for module_name
+:- import_module names.
 :- import_module list.
 
 :- pred llds_common(list(c_procedure)::in, list(comp_gen_c_data)::in,
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.183
diff -u -b -r1.183 llds_out.m
--- compiler/llds_out.m	2001/12/31 04:26:36	1.183
+++ compiler/llds_out.m	2002/01/03 13:12:01
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -17,8 +17,9 @@
 
 :- interface.
 
-:- import_module llds, builtin_ops, prog_data, hlds_data, rl_file.
+:- import_module llds, builtin_ops, hlds_data, rl_file.
 :- import_module globals.
+:- import_module names.
 :- import_module bool, std_util, list, map, io.
 
 	% Given a 'c_file' structure, output the LLDS code inside it
@@ -159,22 +160,6 @@
 :- pred llds_out__get_label(label, bool, string).
 :- mode llds_out__get_label(in, in, out) is det.
 
-	% Mangle an arbitrary name into a C identifier
-
-:- pred llds_out__name_mangle(string, string).
-:- mode llds_out__name_mangle(in, out) is det.
-
-	% Mangle a possibly module-qualified Mercury symbol name
-	% into a C identifier.
-
-:- pred llds_out__sym_name_mangle(sym_name, string).
-:- mode llds_out__sym_name_mangle(in, out) is det.
-
-	% Produces a string of the form Module__Name.
-
-:- pred llds_out__qualify_name(string, string, string).
-:- mode llds_out__qualify_name(in, in, out) is det.
-
 	% Convert a string into a form suitable for outputting as a C string,
 	% by converting special characters into backslashes escapes.
 :- pred llds_out__quote_c_string(string, string).
@@ -257,9 +242,9 @@
 :- implementation.
 
 :- import_module rtti, rtti_out, layout, layout_out, options, trace_params.
-:- import_module exprn_aux, prog_util, prog_out, hlds_pred.
+:- import_module exprn_aux, prog_data, prog_util, prog_out, hlds_pred.
 :- import_module export, mercury_to_mercury, modules, passes_aux.
-:- import_module c_util, foreign.
+:- import_module mangle, c_util, foreign.
 
 :- import_module int, char, string, std_util.
 :- import_module set, bintree_set, assoc_list, require.
@@ -839,12 +824,12 @@
 	io__write_string(InitName).
 
 llds_out__make_init_name(ModuleName, InitName) :-
-	llds_out__sym_name_mangle(ModuleName, MangledModuleName),
+	sym_name_mangle(ModuleName, MangledModuleName),
 	string__append_list(["mercury__", MangledModuleName, "__"],
 		InitName).
 
 llds_out__make_rl_data_name(ModuleName, RLDataConstName) :-
-	llds_out__sym_name_mangle(ModuleName, MangledModuleName),
+	sym_name_mangle(ModuleName, MangledModuleName),
 	string__append("mercury__aditi_rl_data__", MangledModuleName,
 		RLDataConstName).
 
@@ -853,7 +838,7 @@
 
 output_bunch_name(ModuleName, InitStatus, Number) -->
 	io__write_string("mercury__"),
-	{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
+	{ sym_name_mangle(ModuleName, MangledModuleName) },
 	io__write_string(MangledModuleName),
 	io__write_string("_"),
 	io__write_string(InitStatus),
@@ -3407,7 +3392,7 @@
 output_data_addr(ModuleName, VarName) -->
 	(
 		{ VarName = common(N) },
-		{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
+		{ sym_name_mangle(ModuleName, MangledModuleName) },
 		io__write_string(mercury_data_prefix),
 		io__write_string(MangledModuleName),
 		io__write_string("__common_"),
@@ -3575,18 +3560,18 @@
 	string__int_to_string(ModeInt, ModeNumString),
 
 	% mangle all the relevent names
-	llds_out__sym_name_mangle(Module, MangledModule),
-	llds_out__sym_name_mangle(TypeModule, MangledTypeModule),
-	llds_out__name_mangle(TypeName, MangledTypeName),
+	sym_name_mangle(Module, MangledModule),
+	sym_name_mangle(TypeModule, MangledTypeModule),
+	name_mangle(TypeName, MangledTypeName),
 
 	% Module-qualify the type name.
 	% To handle locally produced unification preds for imported types,
 	% we need to qualify it with both the module name of the
 	% type, and also (if it is different) the module name of the
 	% current module.
-	llds_out__qualify_name(MangledTypeModule, MangledTypeName,
+	qualify_name(MangledTypeModule, MangledTypeName,
 		QualifiedMangledTypeName),
-	llds_out__maybe_qualify_name(MangledModule, QualifiedMangledTypeName,
+	maybe_qualify_name(MangledModule, QualifiedMangledTypeName,
 		FullyQualifiedMangledTypeName),
 
 	% join it all together
@@ -3609,8 +3594,8 @@
 %
 get_label_name(DefiningModule, PredOrFunc, DeclaringModule,
 		Name0, Arity, AddPrefix, LabelName) :-
-	llds_out__sym_name_mangle(DeclaringModule, DeclaringModuleName),
-	llds_out__sym_name_mangle(DefiningModule, DefiningModuleName),
+	sym_name_mangle(DeclaringModule, DeclaringModuleName),
+	sym_name_mangle(DefiningModule, DefiningModuleName),
 	(
 		(
 			mercury_private_builtin_module(DeclaringModule)
@@ -3629,7 +3614,7 @@
 	->
 		LabelName0 = Name0
 	;
-		llds_out__qualify_name(DeclaringModuleName, Name0,
+		qualify_name(DeclaringModuleName, Name0,
 			LabelName0)
 	),
 	(
@@ -3643,7 +3628,7 @@
 	;
 		LabelName1 = LabelName0
 	),
-	llds_out__name_mangle(LabelName1, LabelName2),
+	name_mangle(LabelName1, LabelName2),
 	(
 		PredOrFunc = function,
 		string__append("fn__", LabelName2, LabelName3)
@@ -4255,135 +4240,11 @@
 
 %-----------------------------------------------------------------------------%
 
-%
-% Warning: any changes to the name mangling algorithm here will also
-% require changes to extras/dynamic_linking/name_mangle.m,
-% profiler/demangle.m and util/mdemangle.c.
-%
-
-llds_out__sym_name_mangle(unqualified(Name), MangledName) :-
-	llds_out__name_mangle(Name, MangledName).
-llds_out__sym_name_mangle(qualified(ModuleName, PlainName), MangledName) :-
-	llds_out__sym_name_mangle(ModuleName, MangledModuleName),
-	llds_out__name_mangle(PlainName, MangledPlainName),
-	llds_out__qualify_name(MangledModuleName, MangledPlainName,
-			MangledName).
-
-	% Convert a Mercury predicate name into something that can form
-	% part of a C identifier.  This predicate is necessary because
-	% quoted names such as 'name with embedded spaces' are valid
-	% predicate names in Mercury.
-
-llds_out__name_mangle(Name, MangledName) :-
-	(
-		string__is_alnum_or_underscore(Name)
-	->
-		% any names that start with `f_' are changed so that
-		% they start with `f__', so that we can use names starting
-		% with `f_' (followed by anything except an underscore)
-		% without fear of name collisions
-		(
-			string__append("f_", Suffix, Name)
-		->
-			string__append("f__", Suffix, MangledName)
-		;
-			MangledName = Name
-		)
-	;
-		llds_out__convert_to_valid_c_identifier(Name, MangledName)
-	).
-
-:- pred llds_out__convert_to_valid_c_identifier(string, string).
-:- mode llds_out__convert_to_valid_c_identifier(in, out) is det.
-
-llds_out__convert_to_valid_c_identifier(String, Name) :-
-	(
-		llds_out__name_conversion_table(String, Name0)
-	->
-		Name = Name0
-	;
-		llds_out__convert_to_valid_c_identifier_2(String, Name0),
-		string__append("f", Name0, Name)
-	).
-
-llds_out__qualify_name(Module0, Name0, Name) :-
-	string__append_list([Module0, "__", Name0], Name).
-
-	% Produces a string of the form Module__Name, unless Module__
-	% is already a prefix of Name.
-
-:- pred llds_out__maybe_qualify_name(string, string, string).
-:- mode llds_out__maybe_qualify_name(in, in, out) is det.
-
-llds_out__maybe_qualify_name(Module0, Name0, Name) :-
-	string__append(Module0, "__", UnderscoresModule),
-	( string__append(UnderscoresModule, _, Name0) ->
-		Name = Name0
-	;
-		string__append(UnderscoresModule, Name0, Name)
-	).
-
-	% A table used to convert Mercury functors into
-	% C identifiers.  Feel free to add any new translations you want.
-	% The C identifiers should start with "f_",
-	% to avoid introducing name clashes.
-	% If the functor name is not found in the table, then
-	% we use a fall-back method which produces ugly names.
-
-:- pred llds_out__name_conversion_table(string, string).
-:- mode llds_out__name_conversion_table(in, out) is semidet.
-
-llds_out__name_conversion_table("\\=", "f_not_equal").
-llds_out__name_conversion_table(">=", "f_greater_or_equal").
-llds_out__name_conversion_table("=<", "f_less_or_equal").
-llds_out__name_conversion_table("=", "f_equal").
-llds_out__name_conversion_table("<", "f_less_than").
-llds_out__name_conversion_table(">", "f_greater_than").
-llds_out__name_conversion_table("-", "f_minus").
-llds_out__name_conversion_table("+", "f_plus").
-llds_out__name_conversion_table("*", "f_times").
-llds_out__name_conversion_table("/", "f_slash").
-llds_out__name_conversion_table(",", "f_comma").
-llds_out__name_conversion_table(";", "f_semicolon").
-llds_out__name_conversion_table("!", "f_cut").
-llds_out__name_conversion_table("{}", "f_tuple").
-llds_out__name_conversion_table("[|]", "f_cons").
-llds_out__name_conversion_table("[]", "f_nil").
-
-	% This is the fall-back method.
-	% Given a string, produce a C identifier
-	% for that string by concatenating the decimal
-	% expansions of the character codes in the string,
-	% separated by undellines.
-	% The C identifier will start with "f_"; this predicate
-	% constructs everything except the initial "f".
-	%
-	% For example, given the input "\n\t" we return "_10_8".
-
-:- pred llds_out__convert_to_valid_c_identifier_2(string, string).
-:- mode llds_out__convert_to_valid_c_identifier_2(in, out) is det.
-
-llds_out__convert_to_valid_c_identifier_2(String, Name) :-
-	(
-		string__first_char(String, Char, Rest)
-	->
-		char__to_int(Char, Code),
-		string__int_to_string(Code, CodeString),
-		string__append("_", CodeString, ThisCharString),
-		llds_out__convert_to_valid_c_identifier_2(Rest, Name0),
-		string__append(ThisCharString, Name0, Name)
-	;
-		% String is the empty string
-		Name = String
-	).
-
-%-----------------------------------------------------------------------------%
-
 llds_out__make_base_typeclass_info_name(class_id(ClassSym, ClassArity),
 		TypeNames, Str) :-
-	llds_out__sym_name_mangle(ClassSym, MangledClassString),
+	sym_name_mangle(ClassSym, MangledClassString),
 	string__int_to_string(ClassArity, ArityString),
-	llds_out__name_mangle(TypeNames, MangledTypeNames),
+	name_mangle(TypeNames, MangledTypeNames),
 	string__append_list(["base_typeclass_info_", MangledClassString,
 		"__arity", ArityString, "__", MangledTypeNames], Str).
 
Index: compiler/magic.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic.m,v
retrieving revision 1.27
diff -u -b -r1.27 magic.m
--- compiler/magic.m	2001/04/07 14:04:45	1.27
+++ compiler/magic.m	2002/01/03 13:24:48
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2001 University of Melbourne.
+% Copyright (C) 1998-2002 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.
 %-----------------------------------------------------------------------------%
@@ -177,6 +177,7 @@
 :- import_module globals, options, hlds_out, prog_out, goal_util, type_util.
 :- import_module polymorphism, quantification, saved_vars, dead_proc_elim.
 
+:- import_module names.
 :- import_module int, list, map, require, set, std_util, string, term, varset.
 :- import_module assoc_list, bool, simplify.
 
Index: compiler/magic_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic_util.m,v
retrieving revision 1.15
diff -u -b -r1.15 magic_util.m
--- compiler/magic_util.m	2001/10/24 13:34:19	1.15
+++ compiler/magic_util.m	2002/01/04 07:54:56
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2001 University of Melbourne.
+% Copyright (C) 1998-2002 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.
 %-----------------------------------------------------------------------------%
@@ -15,6 +15,7 @@
 :- interface.
 
 :- import_module hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module names.
 :- import_module bool, io, list, map, set, std_util.
 
 	% Check that the argument types and modes are legal for
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.393
diff -u -b -r1.393 make_hlds.m
--- compiler/make_hlds.m	2002/01/03 14:50:46	1.393
+++ compiler/make_hlds.m	2002/01/04 05:00:28
@@ -25,6 +25,7 @@
 :- import_module prog_data, hlds_data, hlds_module, hlds_pred.
 :- import_module equiv_type, module_qual, special_pred.
 
+:- import_module names.
 :- import_module io, std_util, list, bool.
 
 % parse_tree_to_hlds(ParseTree, MQInfo, EqvMap, HLDS, QualInfo,
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.228
diff -u -b -r1.228 mercury_compile.m
--- compiler/mercury_compile.m	2001/12/07 07:53:39	1.228
+++ compiler/mercury_compile.m	2002/01/03 13:15:20
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -77,6 +77,9 @@
 :- import_module recompilation, recompilation_usage, recompilation_check.
 :- import_module timestamp.
 
+	% browser modules
+:- import_module names, mangle.
+
 	% library modules
 :- import_module int, list, map, set, std_util, dir, require, string, bool.
 :- import_module library, getopt, set_bbbtree, term, varset, assoc_list.
@@ -3105,7 +3108,7 @@
 	{ C_InterfaceInfo = foreign_interface_info(ModuleSymName,
 		C_HeaderCode0, C_Includes, C_BodyCode0,
 		_C_ExportDecls, C_ExportDefns) },
-	{ llds_out__sym_name_mangle(ModuleSymName, MangledModuleName) },
+	{ sym_name_mangle(ModuleSymName, MangledModuleName) },
 	{ string__append(MangledModuleName, "_module", ModuleName) },
 	globals__io_lookup_int_option(procs_per_c_function, ProcsPerFunc),
 	{ get_c_body_code(C_BodyCode0, C_BodyCode) },
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.199
diff -u -b -r1.199 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	2001/12/12 00:30:07	1.199
+++ compiler/mercury_to_mercury.m	2002/01/03 12:44:41
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -45,6 +45,7 @@
 :- import_module prog_data, (inst).
 :- import_module hlds_goal, hlds_data.
 
+:- import_module names.
 :- import_module bool, std_util, list, io, varset, term.
 
 :- type needs_brackets
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.105
diff -u -b -r1.105 ml_code_gen.m
--- compiler/ml_code_gen.m	2001/11/06 15:20:59	1.105
+++ compiler/ml_code_gen.m	2002/01/03 13:15:42
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -784,6 +784,7 @@
 :- import_module passes_aux, modules.
 :- import_module globals, options.
 
+:- import_module names.
 :- import_module assoc_list, bool, string, list, map.
 :- import_module int, set, term, require, std_util.
 
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.48
diff -u -b -r1.48 ml_code_util.m
--- compiler/ml_code_util.m	2001/11/08 11:47:57	1.48
+++ compiler/ml_code_util.m	2002/01/03 13:06:39
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -21,6 +21,7 @@
 :- import_module mlds.
 :- import_module globals.
 
+:- import_module names.
 :- import_module bool, int, list, map, std_util.
 
 %-----------------------------------------------------------------------------%
Index: compiler/ml_type_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_type_gen.m,v
retrieving revision 1.19
diff -u -b -r1.19 ml_type_gen.m
--- compiler/ml_type_gen.m	2001/11/04 14:30:35	1.19
+++ compiler/ml_type_gen.m	2002/01/03 12:47:49
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -26,6 +26,7 @@
 :- module ml_type_gen.
 :- interface.
 :- import_module prog_data, hlds_module, hlds_data, mlds.
+:- import_module names.
 :- import_module io.
 
 	% Generate MLDS definitions for all the types in the HLDS.
Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.48
diff -u -b -r1.48 ml_unify_gen.m
--- compiler/ml_unify_gen.m	2001/11/08 11:47:58	1.48
+++ compiler/ml_unify_gen.m	2002/01/03 13:16:51
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -92,6 +92,7 @@
 :- import_module code_util. % XXX needed for `code_util__cons_id_to_tag'.
 :- import_module globals, options.
 
+:- import_module names.
 :- import_module bool, int, string, list, map, require, std_util, term, varset.
 :- import_module assoc_list.
 
Index: compiler/mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.77
diff -u -b -r1.77 mlds.m
--- compiler/mlds.m	2001/11/08 11:47:59	1.77
+++ compiler/mlds.m	2002/01/03 13:12:32
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -291,11 +291,12 @@
 :- import_module prog_data, builtin_ops, rtti, code_model.
 :- import_module foreign, type_util.
 
+:- import_module names.
 :- import_module bool, list, assoc_list, std_util, map.
 
 %-----------------------------------------------------------------------------%
 
-:- type mercury_module_name == prog_data__module_name.
+:- type mercury_module_name == module_name.
 
 %
 % The type `mlds' is the actual MLDS.
@@ -1610,8 +1611,8 @@
 % :- type mlds_module_name == prog_data__module_name.
 :- type mlds_module_name
 	---> name(
-		package_name	:: prog_data__module_name,
-		module_name	:: prog_data__module_name
+		package_name	:: module_name,
+		module_name	:: module_name
 	).
 
 mercury_module_and_package_name_to_mlds(MLDS_Package, MercuryModule)
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.111
diff -u -b -r1.111 mlds_to_c.m
--- compiler/mlds_to_c.m	2001/12/31 04:26:39	1.111
+++ compiler/mlds_to_c.m	2002/01/03 13:12:50
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -49,8 +49,8 @@
 :- implementation.
 
 :- import_module ml_util.
-:- import_module llds_out.	% XXX needed for llds_out__name_mangle,
-				% llds_out__sym_name_mangle,
+:- import_module mangle.	% needed for name_mangle, sym_name_mangle.
+:- import_module llds_out.	% XXX needed for
 				% llds_out__make_base_typeclass_info_name,
 				% output_c_file_intro_and_grade.
 :- import_module rtti.		% for rtti__addr_to_string.
@@ -64,6 +64,7 @@
 :- import_module builtin_ops, c_util, modules.
 :- import_module prog_data, prog_out, type_util, error_util, code_model.
 
+:- import_module names.
 :- import_module bool, int, string, library, list, map.
 :- import_module assoc_list, term, std_util, require.
 
@@ -261,7 +262,7 @@
 	io__nl,
 	mlds_indent(Indent),
 	io__write_string("#ifndef MR_HEADER_GUARD_"),
-	{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
+	{ sym_name_mangle(ModuleName, MangledModuleName) },
 	io__write_string(MangledModuleName),
 	io__nl,
 	mlds_indent(Indent),
@@ -1445,7 +1446,7 @@
 
 mlds_output_fully_qualified(qual(ModuleName, Name), OutputFunc) -->
 	{ SymName = mlds_module_name_to_sym_name(ModuleName) },
-	{ llds_out__sym_name_mangle(SymName, MangledModuleName) },
+	{ sym_name_mangle(SymName, MangledModuleName) },
 	io__write_string(MangledModuleName),
 	io__write_string("__"),
 	OutputFunc(Name).
@@ -1454,7 +1455,7 @@
 :- mode mlds_output_module_name(in, di, uo) is det.
 
 mlds_output_module_name(ModuleName) -->
-	{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
+	{ sym_name_mangle(ModuleName, MangledModuleName) },
 	io__write_string(MangledModuleName).
 
 :- pred mlds_output_name(mlds__entity_name, io__state, io__state).
@@ -1464,7 +1465,7 @@
 %     if they are not needed.
 
 mlds_output_name(type(Name, Arity)) -->
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__format("%s_%d", [s(MangledName), i(Arity)]).
 mlds_output_name(data(DataName)) -->
 	mlds_output_data_name(DataName).
@@ -1488,7 +1489,7 @@
 	( { PredOrFunc = predicate, Suffix = "p" }
 	; { PredOrFunc = function, Suffix = "f" }
 	),
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)]),
 	( { MaybeDefiningModule = yes(DefiningModule) } ->
 		io__write_string("_in__"),
@@ -1498,8 +1499,8 @@
 	).
 mlds_output_pred_label(special_pred(PredName, MaybeTypeModule,
 		TypeName, TypeArity)) -->
-	{ llds_out__name_mangle(PredName, MangledPredName) },
-	{ llds_out__name_mangle(TypeName, MangledTypeName) },
+	{ name_mangle(PredName, MangledPredName) },
+	{ name_mangle(TypeName, MangledTypeName) },
 	io__write_string(MangledPredName),
 	io__write_string("__"),
 	( { MaybeTypeModule = yes(TypeModule) } ->
@@ -2738,7 +2739,7 @@
 :- mode mlds_output_mangled_name(in, di, uo) is det.
 
 mlds_output_mangled_name(Name) -->
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__write_string(MangledName).
 
 :- pred mlds_output_bracketed_lval(mlds__lval, io__state, io__state).
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.55
diff -u -b -r1.55 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	2001/11/06 15:21:03	1.55
+++ compiler/mlds_to_gcc.m	2002/01/03 14:08:20
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 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.
 %-----------------------------------------------------------------------------%
@@ -147,8 +147,7 @@
 
 :- import_module ml_util.
 :- import_module mlds_to_c.	% to handle C foreign_code
-:- import_module llds_out.	% XXX needed for llds_out__name_mangle,
-				% llds_out__sym_name_mangle,
+:- import_module llds_out.	% XXX needed for
 				% llds_out__make_base_typeclass_info_name,
 :- import_module rtti.		% for rtti__addr_to_string.
 :- import_module ml_code_util.	% for ml_gen_public_field_decl_flags, which is
@@ -159,6 +158,7 @@
 :- import_module prog_data, prog_out, prog_util, type_util, error_util.
 :- import_module pseudo_type_info, code_model.
 
+:- import_module names, mangle.
 :- import_module bool, int, string, library, list, map.
 :- import_module assoc_list, term, std_util, require.
 
@@ -1144,7 +1144,7 @@
 		{ GCC_VarName = ml_var_name_to_string(VarName) },
 		gcc__build_static_var_decl(GCC_VarName, GCC_Type, GCC_InitExpr,
 			GCC_Defn),
-		{ llds_out__name_mangle(GCC_VarName, MangledVarName) },
+		{ name_mangle(GCC_VarName, MangledVarName) },
 		gcc__set_var_decl_asm_name(GCC_Defn, MangledVarName),
 		add_var_decl_flags(Flags, GCC_Defn),
 		gcc__finish_static_var_decl(GCC_Defn)
@@ -1592,7 +1592,7 @@
 	( PredOrFunc = predicate, Suffix = "p"
 	; PredOrFunc = function, Suffix = "f"
 	),
-	llds_out__name_mangle(Name, MangledName),
+	name_mangle(Name, MangledName),
 	string__format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)],
 		LabelName0),
 	( MaybeDefiningModule = yes(DefiningModule) ->
@@ -1603,8 +1603,8 @@
 	).
 get_pred_label_name(special_pred(PredName, MaybeTypeModule,
 		TypeName, TypeArity), LabelName) :-
-	llds_out__name_mangle(PredName, MangledPredName),
-	llds_out__name_mangle(TypeName, MangledTypeName),
+	name_mangle(PredName, MangledPredName),
+	name_mangle(TypeName, MangledTypeName),
 	TypeNameString = string__format("%s_%d",
 		[s(MangledTypeName), i(TypeArity)]),
 	( MaybeTypeModule = yes(TypeModule) ->
@@ -1617,7 +1617,7 @@
 
 :- func get_module_name(module_name) = string.
 get_module_name(ModuleName) = MangledModuleName :-
-	llds_out__sym_name_mangle(ModuleName, MangledModuleName).
+	sym_name_mangle(ModuleName, MangledModuleName).
 
 :- pred build_param_types(mlds__arg_types::in, global_info::in,
 		list(gcc__type)::out, gcc__param_types::out,
@@ -2249,7 +2249,7 @@
 :- func build_name(mlds__entity_name) = string.
 
 build_name(type(Name, Arity)) = TypeName :-
-	llds_out__name_mangle(Name, MangledName),
+	name_mangle(Name, MangledName),
 	TypeName = string__format("%s_%d", [s(MangledName), i(Arity)]).
 build_name(data(DataName)) = build_data_name(DataName).
 build_name(EntityName) = AsmFuncName :-
@@ -2260,7 +2260,7 @@
 :- func build_data_name(mlds__data_name) = string.
 
 build_data_name(var(Name)) = MangledName :-
-	llds_out__name_mangle(ml_var_name_to_string(Name), MangledName).
+	name_mangle(ml_var_name_to_string(Name), MangledName).
 build_data_name(common(Num)) =
 	string__format("common_%d", [i(Num)]).
 build_data_name(rtti(RttiTypeId0, RttiName0)) = RttiAddrName :-
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.92
diff -u -b -r1.92 mlds_to_il.m
--- compiler/mlds_to_il.m	2001/11/21 03:49:29	1.92
+++ compiler/mlds_to_il.m	2002/01/03 13:13:08
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2000-2001 The University of Melbourne.
+% Copyright (C) 2000-2002 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.
 %-----------------------------------------------------------------------------%
@@ -137,7 +137,7 @@
 
 :- import_module globals, options, passes_aux.
 :- import_module builtin_ops, c_util, modules, tree.
-:- import_module prog_data, prog_out, prog_util, llds_out.
+:- import_module prog_data, prog_out, prog_util, mangle, llds_out.
 :- import_module rtti, type_util, code_model, foreign.
 
 :- import_module ilasm, il_peephole.
@@ -146,6 +146,7 @@
 :- import_module foreign.
 :- use_module llds. /* for user_foreign_code */
 
+:- import_module names.
 :- import_module bool, int, map, string, set, list, assoc_list, term.
 :- import_module library, require, counter.
 
@@ -3085,7 +3086,7 @@
 			s(MaybeModuleStr), s(Name),
 			i(Arity), s(PredOrFuncStr), s(MaybeProcIdInt),
 			s(MaybeSeqNumStr)], UnMangledId),
-		llds_out__name_mangle(UnMangledId, Id).
+		name_mangle(UnMangledId, Id).
 
 predlabel_to_id(special_pred(PredName, MaybeModuleName, TypeName, Arity),
 			ProcId, MaybeSeqNum, Id) :-
@@ -3104,7 +3105,7 @@
 		string__format("special_%s%s_%s_%d_%d%s", 
 			[s(MaybeModuleStr), s(PredName), s(TypeName), i(Arity),
 				i(ProcIdInt), s(MaybeSeqNumStr)], UnMangledId),
-		llds_out__name_mangle(UnMangledId, Id).
+		name_mangle(UnMangledId, Id).
 
 
 	% If an mlds__var is not an argument or a local, what is it?
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.16
diff -u -b -r1.16 mlds_to_java.m
--- compiler/mlds_to_java.m	2001/10/25 08:35:39	1.16
+++ compiler/mlds_to_java.m	2002/01/04 07:55:09
@@ -1,5 +1,5 @@
 %----------------------------------------------------------------------------%
-% Copyright (C) 2000-2001 The University of Melbourne.
+% Copyright (C) 2000-2002 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.
 %-----------------------------------------------------------------------------%
@@ -51,8 +51,8 @@
 :- import_module java_util. 
 :- import_module c_util.	% XXX needed for c_util__output_quoted_string
 				% c_util_output_quoted_multi_string
-:- import_module llds_out.	% XXX needed for llds_out__name_mangle,
-				% llds_out__sym_name_mangle,
+:- import_module mangle.	% needed for name_mangle, sym_name_mangle.
+:- import_module llds_out.	% XXX needed for
 				% llds_out__make_base_typeclass_info_name,
 :- import_module rtti.		% for rtti__addr_to_string.
 :- import_module rtti_to_mlds.	% for mlds_rtti_type_name.
@@ -66,6 +66,7 @@
 :- import_module builtin_ops.
 :- import_module prog_data, prog_out, type_util, error_util.
 
+:- import_module names.
 :- import_module bool, int, string, library, list.
 :- import_module assoc_list, term, std_util, require.
 
@@ -229,10 +230,10 @@
 :- mode mangle_mlds_sym_name_for_java(in, out) is det.
 
 mangle_mlds_sym_name_for_java(unqualified(Name), MangledName) :-
-	llds_out__name_mangle(Name, MangledName).
+	name_mangle(Name, MangledName).
 mangle_mlds_sym_name_for_java(qualified(ModuleName, PlainName), MangledName) :-
 	mangle_mlds_sym_name_for_java(ModuleName, MangledModuleName),
-	llds_out__name_mangle(PlainName, MangledPlainName),
+	name_mangle(PlainName, MangledPlainName),
 	java_qualify_mangled_name(MangledModuleName, MangledPlainName, 
 		MangledName).
 
@@ -1102,14 +1103,14 @@
 :- mode output_module_name(in, di, uo) is det.
 
 output_module_name(ModuleName) -->
-	{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
+	{ sym_name_mangle(ModuleName, MangledModuleName) },
 	io__write_string(MangledModuleName).
 
 :- pred output_class_name(mlds__entity_name, io__state, io__state).
 :- mode output_class_name(in, di, uo) is det.
 
 output_class_name(type(Name, Arity)) -->
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__format("%s_%d", [s(MangledName), i(Arity)]).
 
 output_class_name(data(_)) --> []. 
@@ -1120,7 +1121,7 @@
 :- mode output_name(in, di, uo) is det.
 
 output_name(type(Name, Arity)) -->
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__format("%s_%d", [s(MangledName), i(Arity)]).
 output_name(data(DataName)) -->
 	output_data_name(DataName).
@@ -1144,7 +1145,7 @@
 	( { PredOrFunc = predicate, Suffix = "p" }
 	; { PredOrFunc = function, Suffix = "f" }
 	),
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)]),
 	( { MaybeDefiningModule = yes(DefiningModule) } ->
 		io__write_string("_in__"),
@@ -1155,8 +1156,8 @@
 
 output_pred_label(special_pred(PredName, MaybeTypeModule,
 		TypeName, TypeArity)) -->
-	{ llds_out__name_mangle(PredName, MangledPredName) },
-	{ llds_out__name_mangle(TypeName, MangledTypeName) },
+	{ name_mangle(PredName, MangledPredName) },
+	{ name_mangle(TypeName, MangledTypeName) },
 	io__write_string(MangledPredName),
 	io__write_string("__"),
 	( { MaybeTypeModule = yes(TypeModule) } ->
@@ -1800,7 +1801,7 @@
 		io__write_char('.'),
 		{ QualifiedCtorId = qual(_ModuleName, CtorDefn) },
 		{ CtorDefn = ctor_id(CtorName, CtorArity) },
-		{ llds_out__name_mangle(CtorName, MangledCtorName) },
+		{ name_mangle(CtorName, MangledCtorName) },
 		io__format("%s_%d", [s(MangledCtorName), i(CtorArity)])
 	;
 		{ unexpected(this_file, 
@@ -1941,7 +1942,7 @@
 		_FieldType, _PtrType)) -->
 	( 
 		{ FieldName = qual(_, UnqualFieldName) }, 
-	 	{ llds_out__name_mangle(UnqualFieldName, MangledFieldName) },
+	 	{ name_mangle(UnqualFieldName, MangledFieldName) },
 	  	{ MangledFieldName = "data_tag" } 
 	->
 		%
@@ -1976,7 +1977,7 @@
 :- mode output_mangled_name(in, di, uo) is det.
 
 output_mangled_name(Name) -->
-	{ llds_out__name_mangle(Name, MangledName) },
+	{ name_mangle(Name, MangledName) },
 	io__write_string(MangledName).
 
 :- pred mlds_output_bracketed_lval(mlds__lval, io__state, io__state).
Index: compiler/mode_errors.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_errors.m,v
retrieving revision 1.71
diff -u -b -r1.71 mode_errors.m
--- compiler/mode_errors.m	2001/05/16 04:50:49	1.71
+++ compiler/mode_errors.m	2002/01/03 12:41:56
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -20,6 +20,7 @@
 :- import_module hlds_data, hlds_pred, hlds_module, hlds_goal.
 :- import_module prog_data, mode_info, (inst).
 
+:- import_module names.
 :- import_module bool, set, assoc_list, list, io.
 
 %-----------------------------------------------------------------------------%
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.139
diff -u -b -r1.139 mode_util.m
--- compiler/mode_util.m	2001/11/08 05:56:01	1.139
+++ compiler/mode_util.m	2002/01/03 12:52:10
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -16,6 +16,7 @@
 
 :- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, prog_data.
 :- import_module (inst), instmap.
+:- import_module names.
 :- import_module bool, list.
 
 	% mode_get_insts returns the initial instantiatedness and
Index: compiler/modecheck_call.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modecheck_call.m,v
retrieving revision 1.39
diff -u -b -r1.39 modecheck_call.m
--- compiler/modecheck_call.m	2001/10/12 05:23:45	1.39
+++ compiler/modecheck_call.m	2002/01/04 07:55:20
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -73,6 +73,7 @@
 :- import_module mode_info, mode_debug, modes, mode_util, mode_errors.
 :- import_module clause_to_proc, inst_match.
 :- import_module det_report, unify_proc.
+:- import_module names.
 :- import_module int, map, bool, set, require, term, varset.
 
 modecheck_higher_order_call(PredOrFunc, PredVar, Args0, Modes, Det,
Index: compiler/modecheck_unify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.47
diff -u -b -r1.47 modecheck_unify.m
--- compiler/modecheck_unify.m	2001/07/31 18:37:18	1.47
+++ compiler/modecheck_unify.m	2002/01/04 07:55:28
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -47,6 +47,7 @@
 :- import_module typecheck, modecheck_call, (inst), quantification, make_hlds.
 :- import_module polymorphism.
 
+:- import_module names.
 :- import_module bool, list, map, std_util, int, set, require.
 :- import_module string, assoc_list.
 :- import_module term, varset.
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.254
diff -u -b -r1.254 modes.m
--- compiler/modes.m	2001/07/20 14:14:05	1.254
+++ compiler/modes.m	2002/01/03 13:13:42
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -330,6 +330,7 @@
 :- import_module modecheck_unify, modecheck_call, inst_util, purity.
 :- import_module prog_out, term, varset.
 
+:- import_module names.
 :- import_module list, map, string, require, std_util.
 :- import_module assoc_list.
 
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.71
diff -u -b -r1.71 module_qual.m
--- compiler/module_qual.m	2001/12/12 00:30:09	1.71
+++ compiler/module_qual.m	2002/01/03 12:52:36
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -20,6 +20,7 @@
 :- interface.
 
 :- import_module prog_data, recompilation.
+:- import_module names.
 :- import_module bool, list, std_util, io.
 
 	% module_qualify_items(Items0, Items, ModuleName, ReportUndefErrors,
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.210
diff -u -b -r1.210 modules.m
--- compiler/modules.m	2001/12/12 00:30:10	1.210
+++ compiler/modules.m	2002/01/03 12:42:40
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -40,6 +40,7 @@
 :- interface.
 
 :- import_module foreign, prog_data, prog_io, globals, timestamp.
+:- import_module names.
 :- import_module std_util, bool, list, map, set, io.
 
 %-----------------------------------------------------------------------------%
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.117
diff -u -b -r1.117 opt_debug.m
--- compiler/opt_debug.m	2001/10/24 07:43:12	1.117
+++ compiler/opt_debug.m	2002/01/03 01:44:48
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -121,7 +121,7 @@
 
 :- import_module prog_out.
 :- import_module hlds_pred.
-:- import_module llds_out, code_util, opt_util.
+:- import_module mangle, llds_out, code_util, opt_util.
 :- import_module globals, options.
 
 :- import_module int, set, map, string.
@@ -357,8 +357,8 @@
 				ProcLabelStr, ")"], Str).
 
 opt_debug__dump_rtti_type_id(rtti_type_id(ModuleName, TypeName, Arity), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleName_str),
-	llds_out__name_mangle(TypeName, TypeName_str),
+	sym_name_mangle(ModuleName, ModuleName_str),
+	name_mangle(TypeName, TypeName_str),
 	string__int_to_string(Arity, Arity_str),
 	string__append_list(["rtti_type_id(", ModuleName_str, ", ",
 		TypeName_str, Arity_str, ")"], Str).
@@ -438,36 +438,36 @@
 	string__append_list(["closure_proc_id(", ProcLabelStr, ", ",
 		SeqNoStr, ")"], Str).
 opt_debug__dump_layout_name(file_layout(ModuleName, FileNum), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__int_to_string(FileNum, FileNumStr),
 	string__append_list(["file_layout(", ModuleNameStr, ", ",
 		FileNumStr, ")"], Str).
 opt_debug__dump_layout_name(file_layout_line_number_vector(ModuleName,
 		FileNum), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__int_to_string(FileNum, FileNumStr),
 	string__append_list(["file_layout_line_number_vector(", ModuleNameStr,
 		", ", FileNumStr, ")"], Str).
 opt_debug__dump_layout_name(file_layout_label_layout_vector(ModuleName,
 		FileNum), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__int_to_string(FileNum, FileNumStr),
 	string__append_list(["file_layout_label_layout_vector(", ModuleNameStr,
 		", ", FileNumStr, ")"], Str).
 opt_debug__dump_layout_name(module_layout_string_table(ModuleName), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__append_list(["module_layout_string_table(", ModuleNameStr,
 		")"], Str).
 opt_debug__dump_layout_name(module_layout_file_vector(ModuleName), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__append_list(["module_layout_file_vector(", ModuleNameStr, ")"],
 		Str).
 opt_debug__dump_layout_name(module_layout_proc_vector(ModuleName), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__append_list(["module_layout_proc_vector(", ModuleNameStr, ")"],
 		Str).
 opt_debug__dump_layout_name(module_layout(ModuleName), Str) :-
-	llds_out__sym_name_mangle(ModuleName, ModuleNameStr),
+	sym_name_mangle(ModuleName, ModuleNameStr),
 	string__append_list(["module_layout(", ModuleNameStr, ")"], Str).
 opt_debug__dump_layout_name(proc_static(RttiProcLabel), Str) :-
 	ProcLabel = code_util__make_proc_label_from_rtti(RttiProcLabel),
@@ -572,10 +572,10 @@
 	( Module = PredModule ->
 		ExtraModule = ""
 	;
-		llds_out__sym_name_mangle(PredModule, PredModuleName),
+		sym_name_mangle(PredModule, PredModuleName),
 		string__append(PredModuleName, "_", ExtraModule)
 	),
-	llds_out__sym_name_mangle(Module, ModuleName),
+	sym_name_mangle(Module, ModuleName),
 	string__int_to_string(Arity, A_str),
 	proc_id_to_int(ProcId, Mode),
 	string__int_to_string(Mode, M_str),
@@ -583,9 +583,9 @@
 		"_", A_str, "_", M_str], Str).
 opt_debug__dump_proclabel(special_proc(Module, Pred, TypeModule,
 		Type, Arity, ProcId), Str) :-
-	llds_out__sym_name_mangle(Module, ModuleName),
-	llds_out__sym_name_mangle(TypeModule, TypeModuleName),
-	llds_out__qualify_name(TypeModuleName, Type, TypeName),
+	sym_name_mangle(Module, ModuleName),
+	sym_name_mangle(TypeModule, TypeModuleName),
+	qualify_name(TypeModuleName, Type, TypeName),
 	string__int_to_string(Arity, A_str),
 	proc_id_to_int(ProcId, Mode),
 	string__int_to_string(Mode, M_str),
Index: compiler/optimize.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/optimize.m,v
retrieving revision 1.28
diff -u -b -r1.28 optimize.m
--- compiler/optimize.m	2001/05/31 05:59:50	1.28
+++ compiler/optimize.m	2002/01/04 07:55:45
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -30,8 +30,9 @@
 :- import_module jumpopt, labelopt, dupelim, peephole.
 :- import_module frameopt, delay_slot, use_local_vars, options.
 :- import_module globals, passes_aux, opt_util, opt_debug.
-:- import_module wrap_blocks, hlds_pred, llds_out, continuation_info.
+:- import_module wrap_blocks, hlds_pred, continuation_info.
 
+:- import_module mangle.
 :- import_module bool, int, string.
 :- import_module map, bimap, set, std_util, require, counter.
 
@@ -82,7 +83,7 @@
 	globals__io_lookup_bool_option(debug_opt, DebugOpt),
 	(
 		{ DebugOpt = yes },
-		{ llds_out__name_mangle(Name, MangledName) },
+		{ name_mangle(Name, MangledName) },
 		{ PredProcId = proc(PredId, ProcId) },
 		{ pred_id_to_int(PredId, PredIdInt) },
 		{ proc_id_to_int(ProcId, ProcIdInt) },
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.217
diff -u -b -r1.217 polymorphism.m
--- compiler/polymorphism.m	2001/08/06 06:20:29	1.217
+++ compiler/polymorphism.m	2002/01/03 12:57:28
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1995-2001 The University of Melbourne.
+% Copyright (C) 1995-2002 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.
 %-----------------------------------------------------------------------------%
@@ -192,6 +192,7 @@
 :- import_module hlds_goal, hlds_module, hlds_pred.
 :- import_module prog_data, special_pred.
 
+:- import_module names.
 :- import_module io, list, term, map.
 
 % Run the polymorphism pass over the whole HLDS.
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.34
diff -u -b -r1.34 post_typecheck.m
--- compiler/post_typecheck.m	2001/10/02 13:53:56	1.34
+++ compiler/post_typecheck.m	2002/01/03 12:48:23
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -34,6 +34,7 @@
 :- module post_typecheck.
 :- interface.
 :- import_module hlds_data, hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module names.
 :- import_module list, io, bool, std_util.
 
 	% check_type_bindings(PredId, PredInfo, ModuleInfo, ReportErrors):
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.47
diff -u -b -r1.47 pragma_c_gen.m
--- compiler/pragma_c_gen.m	2001/10/24 13:34:35	1.47
+++ compiler/pragma_c_gen.m	2002/01/03 12:45:28
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %---------------------------------------------------------------------------%
@@ -26,6 +26,7 @@
 :- import_module code_model.
 :- import_module llds, code_info.
 
+:- import_module names.
 :- import_module list, std_util.
 
 :- pred pragma_c_gen__generate_pragma_c_code(code_model::in,
@@ -41,7 +42,7 @@
 
 :- implementation.
 
-:- import_module hlds_module, hlds_pred, llds_out, trace, tree.
+:- import_module hlds_module, hlds_pred, mangle, llds_out, trace, tree.
 :- import_module code_util, foreign.
 :- import_module options, globals.
 
@@ -1282,8 +1283,8 @@
 %---------------------------------------------------------------------------%
 
 pragma_c_gen__struct_name(ModuleName, PredName, Arity, ProcId, StructName) :-
-	llds_out__sym_name_mangle(ModuleName, MangledModuleName),
-	llds_out__name_mangle(PredName, MangledPredName),
+	sym_name_mangle(ModuleName, MangledModuleName),
+	name_mangle(PredName, MangledPredName),
 	proc_id_to_int(ProcId, ProcNum),
 	string__int_to_string(Arity, ArityStr),
 	string__int_to_string(ProcNum, ProcNumStr),
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.73
diff -u -b -r1.73 prog_data.m
--- compiler/prog_data.m	2001/12/12 00:30:13	1.73
+++ compiler/prog_data.m	2002/01/04 07:56:03
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -24,6 +24,7 @@
 
 :- import_module (inst), options.
 :- import_module recompilation.
+:- import_module names.
 :- import_module bool, list, assoc_list, map, set, varset, term, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -978,18 +979,6 @@
 	; 	postfix 
 	; 	binary_prefix 
 	; 	binary_postfix.
-:- type sym_name_specifier 
-	--->	name(sym_name)
-	;	name_arity(sym_name, arity).
-:- type sym_name 	
-	--->	unqualified(string)
-	;	qualified(module_specifier, string).
-:- type sym_name_and_arity
-	--->	sym_name / arity.
-
-:- type module_specifier ==	sym_name.
-:- type module_name 	== 	sym_name.
-:- type arity		==	int.
 
 	% Describes whether an item can be used without an 
 	% explicit module qualifier.
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.197
diff -u -b -r1.197 prog_io.m
--- compiler/prog_io.m	2001/07/16 08:21:04	1.197
+++ compiler/prog_io.m	2002/01/03 12:43:00
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1993-2001 The University of Melbourne.
+% Copyright (C) 1993-2002 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.
 %-----------------------------------------------------------------------------%
@@ -56,6 +56,7 @@
 :- interface.
 
 :- import_module prog_data, prog_io_util, timestamp.
+:- import_module names.
 :- import_module bool, varset, term, list, io, std_util. 
 
 %-----------------------------------------------------------------------------%
Index: compiler/prog_io_dcg.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_dcg.m,v
retrieving revision 1.18
diff -u -b -r1.18 prog_io_dcg.m
--- compiler/prog_io_dcg.m	2001/09/25 09:36:54	1.18
+++ compiler/prog_io_dcg.m	2002/01/03 13:10:23
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -15,6 +15,7 @@
 :- interface.
 
 :- import_module prog_data, prog_io_util.
+:- import_module names.
 :- import_module varset, term.
 
 :- pred parse_dcg_clause(module_name, varset, term, term,
Index: compiler/prog_io_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_goal.m,v
retrieving revision 1.20
diff -u -b -r1.20 prog_io_goal.m
--- compiler/prog_io_goal.m	2001/09/25 09:36:54	1.20
+++ compiler/prog_io_goal.m	2002/01/03 13:16:13
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -96,6 +96,7 @@
 :- implementation.
 
 :- import_module mode_util, purity, prog_io, prog_io_util, term_util.
+:- import_module names.
 :- import_module term.
 :- import_module int, map, string, std_util.
 
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.39
diff -u -b -r1.39 prog_io_pragma.m
--- compiler/prog_io_pragma.m	2001/12/12 00:30:13	1.39
+++ compiler/prog_io_pragma.m	2002/01/03 12:48:03
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -14,6 +14,7 @@
 :- interface.
 
 :- import_module prog_data, prog_io_util.
+:- import_module names.
 :- import_module list, varset, term.
 
 	% parse the pragma declaration. 
Index: compiler/prog_io_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_typeclass.m,v
retrieving revision 1.21
diff -u -b -r1.21 prog_io_typeclass.m
--- compiler/prog_io_typeclass.m	2001/09/25 09:36:54	1.21
+++ compiler/prog_io_typeclass.m	2002/01/03 12:48:17
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -15,6 +15,7 @@
 :- interface.
 
 :- import_module prog_data, prog_io_util.
+:- import_module names.
 :- import_module list, varset, term.
 
 	% parse a typeclass declaration. 
Index: compiler/prog_io_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_util.m,v
retrieving revision 1.21
diff -u -b -r1.21 prog_io_util.m
--- compiler/prog_io_util.m	2001/09/25 09:36:55	1.21
+++ compiler/prog_io_util.m	2002/01/03 12:43:47
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -26,6 +26,7 @@
 :- interface.
 
 :- import_module prog_data, (inst).
+:- import_module names.
 :- import_module list, map, std_util, term, io.
 
 :- type maybe2(T1, T2)	--->	error(string, term)
Index: compiler/prog_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_out.m,v
retrieving revision 1.44
diff -u -b -r1.44 prog_out.m
--- compiler/prog_out.m	2000/01/13 06:16:59	1.44
+++ compiler/prog_out.m	2002/01/03 12:43:59
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1993-2000 The University of Melbourne.
+% Copyright (C) 1993-2000,2002 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.
 %-----------------------------------------------------------------------------%
@@ -19,6 +19,7 @@
 
 :- interface.
 :- import_module prog_data.
+:- import_module names.
 :- import_module list, io.
 
 :- pred prog_out__write_messages(message_list, io__state, io__state).
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.8
diff -u -b -r1.8 prog_rep.m
--- compiler/prog_rep.m	2001/05/31 05:59:52	1.8
+++ compiler/prog_rep.m	2002/01/03 13:17:25
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 2000-2001 University of Melbourne.
+% Copyright (C) 2000-2002 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.
 %---------------------------------------------------------------------------%
@@ -27,6 +27,7 @@
 :- implementation.
 
 :- import_module hlds_data, prog_data.
+:- import_module names.
 :- import_module string, list, set, std_util, require, term.
 
 :- type prog_rep__info
Index: compiler/prog_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_util.m,v
retrieving revision 1.55
diff -u -b -r1.55 prog_util.m
--- compiler/prog_util.m	2001/08/10 08:29:29	1.55
+++ compiler/prog_util.m	2002/01/03 12:40:52
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -14,6 +14,7 @@
 :- interface.
 
 :- import_module prog_data, term.
+:- import_module names.
 :- import_module std_util, list.
 
 %-----------------------------------------------------------------------------%
@@ -455,7 +456,7 @@
 			SubstElem = Var - Type,
 			varset__lookup_name(VarSet, Var, VarName),
 			TypeString = mercury_type_to_string(VarSet, Type),
-			string__append_list([VarName, " = ", TypeString],
+			string__append_list([VarName, "=", TypeString],
 				SubstStr)
 		)),
 		list_to_string(SubstToString, TypeSubst, PredIdStr)
Index: compiler/pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pseudo_type_info.m,v
retrieving revision 1.5
diff -u -b -r1.5 pseudo_type_info.m
--- compiler/pseudo_type_info.m	2000/12/21 06:10:23	1.5
+++ compiler/pseudo_type_info.m	2002/01/03 12:57:59
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2000 The University of Melbourne.
+% Copyright (C) 1996-2000,2002 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.
 %---------------------------------------------------------------------------%
@@ -17,6 +17,7 @@
 :- module pseudo_type_info.
 :- interface.
 :- import_module prog_data, rtti.
+:- import_module names.
 :- import_module list.
 
 	% pseudo_type_info__construct_pseudo_type_info(Type,
Index: compiler/recompilation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation.m,v
retrieving revision 1.2
diff -u -b -r1.2 recompilation.m
--- compiler/recompilation.m	2001/07/11 15:44:21	1.2
+++ compiler/recompilation.m	2002/01/03 12:42:06
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -25,6 +25,7 @@
 :- interface.
 
 :- import_module prog_data, timestamp.
+:- import_module names.
 :- import_module io, map, set, std_util, term.
 
 	% Identify a particular version of a program item.
Index: compiler/recompilation_check.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_check.m,v
retrieving revision 1.6
diff -u -b -r1.6 recompilation_check.m
--- compiler/recompilation_check.m	2001/11/04 14:42:55	1.6
+++ compiler/recompilation_check.m	2002/01/03 13:21:40
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 The University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -12,7 +12,8 @@
 
 :- interface.
 
-:- import_module modules, prog_io, prog_data.
+:- import_module modules, prog_io.
+:- import_module names.
 :- import_module list, io.
 
 :- type modules_to_recompile
@@ -54,7 +55,7 @@
 :- implementation.
 
 :- import_module recompilation, recompilation_usage, recompilation_version.
-:- import_module timestamp.
+:- import_module prog_data, timestamp.
 :- import_module prog_io_util, prog_util, prog_out, error_util.
 :- import_module globals, options.
 :- import_module hlds_pred.	% for field_access_function_name,
Index: compiler/recompilation_usage.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_usage.m,v
retrieving revision 1.3
diff -u -b -r1.3 recompilation_usage.m
--- compiler/recompilation_usage.m	2001/10/24 13:34:37	1.3
+++ compiler/recompilation_usage.m	2002/01/03 12:47:03
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -13,6 +13,7 @@
 :- interface.
 
 :- import_module hlds_module, hlds_pred, modules, recompilation, prog_data.
+:- import_module names.
 :- import_module assoc_list, io, list, map, set, std_util.
 
 	%
Index: compiler/recompilation_version.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_version.m,v
retrieving revision 1.10
diff -u -b -r1.10 recompilation_version.m
--- compiler/recompilation_version.m	2001/12/12 00:30:14	1.10
+++ compiler/recompilation_version.m	2002/01/03 13:36:13
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 The University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -35,6 +35,7 @@
 
 :- import_module mercury_to_mercury, mode_util, prog_io, prog_util, type_util.
 :- import_module hlds_out, (inst).
+:- import_module names.
 :- import_module assoc_list, bool, list, map, require, string, varset.
 
 recompilation_version__compute_version_numbers(SourceFileTime, Items,
Index: compiler/rl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl.m,v
retrieving revision 1.17
diff -u -b -r1.17 rl.m
--- compiler/rl.m	2001/06/27 05:04:29	1.17
+++ compiler/rl.m	2002/01/03 12:44:17
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2001 University of Melbourne.
+% Copyright (C) 1998-2002 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.
 %-----------------------------------------------------------------------------%
@@ -19,6 +19,7 @@
 
 :- import_module hlds_data, hlds_goal, hlds_module, hlds_pred.
 :- import_module instmap, prog_data.
+:- import_module names.
 :- import_module assoc_list, list, std_util, map, set.
 
 %-----------------------------------------------------------------------------%
Index: compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.21
diff -u -b -r1.21 rl_exprn.m
--- compiler/rl_exprn.m	2001/05/31 05:59:52	1.21
+++ compiler/rl_exprn.m	2002/01/03 13:32:47
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2001 University of Melbourne.
+% Copyright (C) 1998-2002 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.
 %-----------------------------------------------------------------------------%
@@ -129,6 +129,7 @@
 :- import_module rl_out, inlining, hlds_goal, prog_util, error_util.
 :- import_module builtin_ops.
 
+:- import_module names.
 :- import_module assoc_list, bool, char, int, map.
 :- import_module require, set, std_util, string, term, varset.
 
Index: compiler/rl_key.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_key.m,v
retrieving revision 1.8
diff -u -b -r1.8 rl_key.m
--- compiler/rl_key.m	2000/10/06 10:18:33	1.8
+++ compiler/rl_key.m	2002/01/03 13:17:59
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998-2000 University of Melbourne.
+% Copyright (C) 1998-2000,2002 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.
 %-----------------------------------------------------------------------------%
@@ -52,6 +52,7 @@
 :- implementation.
 
 :- import_module hlds_data, hlds_pred, prog_util, type_util.
+:- import_module names.
 :- import_module assoc_list, bool, int, require, set, std_util.
 
 rl_key__extract_indexing(no_inputs, _, _, _, []). 
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.14
diff -u -b -r1.14 rtti.m
--- compiler/rtti.m	2001/10/24 07:43:12	1.14
+++ compiler/rtti.m	2002/01/03 12:42:17
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2000-2001 The University of Melbourne.
+% Copyright (C) 2000-2002 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.
 %-----------------------------------------------------------------------------%
@@ -28,6 +28,7 @@
 :- import_module hlds_module, hlds_pred, hlds_data.
 :- import_module pseudo_type_info, code_model.
 
+:- import_module names.
 :- import_module bool, list, std_util.
 
 	% For a given du type and a primary tag value, this says where,
@@ -492,7 +493,7 @@
 :- implementation.
 
 :- import_module code_util.	% for code_util__compiler_generated
-:- import_module llds_out.	% for name_mangle and sym_name_mangle
+:- import_module mangle.	% for name_mangle and sym_name_mangle
 :- import_module hlds_data, type_util, mode_util.
 
 :- import_module string, require.
@@ -708,9 +709,9 @@
 		RttiName = base_typeclass_info(_ModuleName, ClassId,
 			InstanceStr),
 		ClassId = class_id(ClassSym, ClassArity),
-		llds_out__sym_name_mangle(ClassSym, MangledClassString),
+		sym_name_mangle(ClassSym, MangledClassString),
 		string__int_to_string(ClassArity, ArityString),
-		llds_out__name_mangle(InstanceStr, MangledTypeNames),
+		name_mangle(InstanceStr, MangledTypeNames),
 		string__append_list(["base_typeclass_info_",
 			MangledClassString, "__arity", ArityString, "__",
 			MangledTypeNames], Str)
@@ -725,8 +726,8 @@
 
 rtti__mangle_rtti_type_id(RttiTypeId, ModuleName, TypeName, A_str) :-
 	RttiTypeId = rtti_type_id(ModuleName0, TypeName0, TypeArity),
-	llds_out__sym_name_mangle(ModuleName0, ModuleName),
-	llds_out__name_mangle(TypeName0, TypeName),
+	sym_name_mangle(ModuleName0, ModuleName),
+	name_mangle(TypeName0, TypeName),
 	string__int_to_string(TypeArity, A_str).
 
 :- pred rtti__pseudo_type_info_to_string(pseudo_type_info::in, string::out)
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.23
diff -u -b -r1.23 rtti_out.m
--- compiler/rtti_out.m	2001/12/31 04:26:40	1.23
+++ compiler/rtti_out.m	2002/01/03 13:18:36
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2000-2001 The University of Melbourne.
+% Copyright (C) 2000-2002 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.
 %-----------------------------------------------------------------------------%
@@ -23,8 +23,9 @@
 
 :- interface.
 
-:- import_module prog_data, hlds_data.
+:- import_module hlds_data.
 :- import_module rtti, llds_out.
+:- import_module names.
 :- import_module bool, io.
 
 	% output a C expression holding the address of the C name of
@@ -89,7 +90,7 @@
 
 :- import_module pseudo_type_info, code_util, llds, prog_out, c_util.
 :- import_module error_util.
-:- import_module options, globals.
+:- import_module mangle, options, globals.
 :- import_module int, string, list, require, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -791,7 +792,7 @@
 		output_rtti_addr(RttiTypeId, type_ctor_info),
 		io__write_string(",\n\t\t"),
 		{ RttiTypeId = rtti_type_id(ModuleName, TypeName, Arity) },
-		{ llds_out__sym_name_mangle(ModuleName, ModuleNameString) },
+		{ sym_name_mangle(ModuleName, ModuleNameString) },
 		{ string__append(ModuleNameString, "__", UnderscoresModule) },
 		( 
 			{ string__append(UnderscoresModule, _, TypeName) } 
@@ -800,7 +801,7 @@
 		;
 			io__write_string(UnderscoresModule)
 		),
-		{ llds_out__name_mangle(TypeName, MangledTypeName) },
+		{ name_mangle(TypeName, MangledTypeName) },
 		io__write_string(MangledTypeName),
 		io__write_string("_"),
 		io__write_int(Arity),
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.22
diff -u -b -r1.22 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m	2001/12/31 04:26:41	1.22
+++ compiler/rtti_to_mlds.m	2002/01/04 07:56:14
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2001 The University of Melbourne.
+% Copyright (C) 2001-2002 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.
 %-----------------------------------------------------------------------------%
@@ -33,6 +33,7 @@
 :- import_module foreign, prog_data, hlds_data.
 :- import_module pseudo_type_info, prog_util, prog_out, type_util.
 :- import_module ml_code_util, ml_unify_gen.
+:- import_module names.
 :- import_module bool, list, std_util, string, term, require.
 
 rtti_data_list_to_mlds(ModuleInfo, RttiDatas) =
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.98
diff -u -b -r1.98 simplify.m
--- compiler/simplify.m	2001/09/13 23:18:14	1.98
+++ compiler/simplify.m	2002/01/03 13:19:27
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -79,6 +79,7 @@
 :- import_module code_util, quantification, modes, purity, pd_cost.
 :- import_module prog_util, unify_proc, special_pred, polymorphism.
 
+:- import_module names.
 :- import_module set, require, std_util, int, term.
 
 %-----------------------------------------------------------------------------%
Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.26
diff -u -b -r1.26 special_pred.m
--- compiler/special_pred.m	2000/10/13 13:55:57	1.26
+++ compiler/special_pred.m	2002/01/04 07:56:27
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1995-2000 The University of Melbourne.
+% Copyright (C) 1995-2000,2002 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.
 %-----------------------------------------------------------------------------%
@@ -91,6 +91,7 @@
 :- implementation.
 
 :- import_module globals, options, type_util, mode_util, prog_util.
+:- import_module names.
 :- import_module bool.
 
 special_pred_list([unify, index, compare]).
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.60
diff -u -b -r1.60 stack_layout.m
--- compiler/stack_layout.m	2001/01/29 06:47:20	1.60
+++ compiler/stack_layout.m	2002/01/03 13:34:11
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %---------------------------------------------------------------------------%
@@ -29,7 +29,8 @@
 
 :- interface.
 
-:- import_module prog_data, continuation_info, hlds_module, llds.
+:- import_module continuation_info, hlds_module, llds.
+:- import_module names.
 :- import_module std_util, list, map, counter.
 
 :- pred stack_layout__generate_llds(module_info::in, module_info::out,
@@ -46,7 +47,7 @@
 
 :- import_module globals, options, llds_out, trace_params, trace.
 :- import_module hlds_data, hlds_goal, hlds_pred.
-:- import_module prog_util, prog_out, instmap.
+:- import_module prog_data, prog_util, prog_out, instmap.
 :- import_module prog_rep, static_term, layout_out.
 :- import_module rtti, layout, ll_pseudo_type_info, (inst), code_util.
 :- import_module assoc_list, bool, string, int, require.
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.25
diff -u -b -r1.25 stratify.m
--- compiler/stratify.m	2001/04/07 14:04:59	1.25
+++ compiler/stratify.m	2002/01/04 07:56:32
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -50,6 +50,7 @@
 :- import_module hlds_module, type_util, mode_util, prog_data, passes_aux.
 :- import_module prog_out, globals, options.
 
+:- import_module names.
 :- import_module assoc_list, map, list, set, bool, std_util, relation, require.
 :- import_module string.
 
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.30
diff -u -b -r1.30 table_gen.m
--- compiler/table_gen.m	2001/11/26 09:30:58	1.30
+++ compiler/table_gen.m	2002/01/03 13:22:37
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -240,6 +240,7 @@
 :- import_module code_util, quantification, modes, purity, prog_util.
 :- import_module code_model.
 
+:- import_module names.
 :- import_module term, varset.
 :- import_module bool, list, set, map, require, std_util, int.
 :- import_module assoc_list, string, llds.
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.15
diff -u -b -r1.15 term_util.m
--- compiler/term_util.m	2001/10/24 13:34:37	1.15
+++ compiler/term_util.m	2002/01/03 13:35:40
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -210,6 +210,7 @@
 :- import_module inst_match, prog_out, mode_util, type_util.
 :- import_module globals, options.
 
+:- import_module names.
 :- import_module assoc_list, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/termination.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/termination.m,v
retrieving revision 1.23
diff -u -b -r1.23 termination.m
--- compiler/termination.m	2001/03/05 10:31:05	1.23
+++ compiler/termination.m	2002/01/03 13:07:12
@@ -1,5 +1,5 @@
 %----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %----------------------------------------------------------------------------%
@@ -47,8 +47,9 @@
 
 :- interface.
 
-:- import_module io, bool, std_util, list.
 :- import_module prog_data, hlds_module, hlds_pred, term_util.
+:- import_module names.
+:- import_module io, bool, std_util, list.
 
 	% Perform termination analysis on the module.
 
Index: compiler/trans_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.16
diff -u -b -r1.16 trans_opt.m
--- compiler/trans_opt.m	2001/07/16 08:21:05	1.16
+++ compiler/trans_opt.m	2002/01/03 13:23:25
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997-2001 The University of Melbourne.
+% Copyright (C) 1997-2002 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.
 %-----------------------------------------------------------------------------%
@@ -51,8 +51,9 @@
 
 :- interface.
 
+:- import_module hlds_module, modules.
+:- import_module names.
 :- import_module io, bool, list.
-:- import_module hlds_module, modules, prog_data.
 
 :- pred trans_opt__write_optfile(module_info, io__state, io__state).
 :- mode trans_opt__write_optfile(in, di, uo) is det.
@@ -71,7 +72,7 @@
 :- implementation.
 
 :- import_module intermod, hlds_pred, mercury_to_mercury.
-:- import_module prog_io, globals, code_util.
+:- import_module prog_data, prog_io, globals, code_util.
 :- import_module passes_aux, prog_out, options, termination.
 
 :- import_module set, string, list, map, varset, term, std_util.
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.18
diff -u -b -r1.18 type_ctor_info.m
--- compiler/type_ctor_info.m	2001/12/31 04:26:41	1.18
+++ compiler/type_ctor_info.m	2002/01/03 13:23:49
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %---------------------------------------------------------------------------%
@@ -52,6 +52,7 @@
 :- import_module code_util, special_pred, type_util, globals, options.
 :- import_module builtin_ops, error_util.
 
+:- import_module names.
 :- import_module bool, string, int, map, std_util, assoc_list, require.
 :- import_module term.
 
Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.102
diff -u -b -r1.102 type_util.m
--- compiler/type_util.m	2001/11/21 03:53:59	1.102
+++ compiler/type_util.m	2002/01/03 12:42:50
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1994-2001 The University of Melbourne.
+% Copyright (C) 1994-2002 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.
 %-----------------------------------------------------------------------------%
@@ -19,6 +19,7 @@
 :- interface.
 
 :- import_module hlds_module, hlds_pred, hlds_data, prog_data, globals.
+:- import_module names.
 :- import_module term.
 :- import_module std_util, list, map.
 
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.308
diff -u -b -r1.308 typecheck.m
--- compiler/typecheck.m	2001/09/25 09:36:55	1.308
+++ compiler/typecheck.m	2002/01/03 12:45:01
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1993-2001 The University of Melbourne.
+% Copyright (C) 1993-2002 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.
 %-----------------------------------------------------------------------------%
@@ -103,6 +103,7 @@
 :- interface.
 
 :- import_module hlds_module, hlds_pred, hlds_data, prog_data.
+:- import_module names.
 :- import_module bool, io, list, map.
 
 	% typecheck(Module0, Module, FoundError,
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.98
diff -u -b -r1.98 unify_proc.m
--- compiler/unify_proc.m	2002/01/04 07:50:07	1.98
+++ compiler/unify_proc.m	2002/01/04 07:56:41
@@ -70,8 +70,8 @@
 % proc_id.  (This is used by unique_modes.m.)
 
 :- pred unify_proc__request_proc(pred_id::in, list(mode)::in, inst_varset::in,
-maybe(list(is_live))::in, maybe(determinism)::in, prog_context::in,
-module_info::in, proc_id::out, module_info::out) is det.
+	maybe(list(is_live))::in, maybe(determinism)::in, prog_context::in,
+	module_info::in, proc_id::out, module_info::out) is det.
 
 % unify_proc__add_lazily_generated_unify_pred(TypeId,
 	%	UnifyPredId_for_Type, ModuleInfo0, ModuleInfo).
@@ -137,6 +137,7 @@
 :- import_module switch_detection, cse_detection, det_analysis, unique_modes.
 :- import_module recompilation.
 
+:- import_module names.
 :- import_module tree, map, set, queue, int, string, require, assoc_list.
 
 	% We keep track of all the complicated unification procs we need
Index: compiler/unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.72
diff -u -b -r1.72 unique_modes.m
--- compiler/unique_modes.m	2001/04/07 14:05:02	1.72
+++ compiler/unique_modes.m	2002/01/03 13:24:48
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -61,6 +61,7 @@
 :- import_module mode_util, prog_out, hlds_out, mercury_to_mercury, passes_aux.
 :- import_module modes, prog_data, mode_errors, llds, unify_proc.
 :- import_module (inst), instmap, inst_match, inst_util.
+:- import_module names.
 :- import_module term, varset.
 :- import_module assoc_list, bag, int, list, map.
 :- import_module require, set, std_util, string.
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.73
diff -u -b -r1.73 unused_args.m
--- compiler/unused_args.m	2001/04/07 14:05:03	1.73
+++ compiler/unused_args.m	2002/01/03 13:20:40
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1996-2001 The University of Melbourne.
+% Copyright (C) 1996-2002 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.
 %-----------------------------------------------------------------------------%
@@ -57,6 +57,7 @@
 :- import_module options, prog_data, prog_out, quantification, special_pred.
 :- import_module passes_aux, inst_match, modules, polymorphism, goal_util.
 
+:- import_module names.
 :- import_module assoc_list, bool, char, int, list, map, require.
 :- import_module set, std_util, string.
 
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
Index: extras/dynamic_linking/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/dynamic_linking/Mmakefile,v
retrieving revision 1.6
diff -u -b -r1.6 Mmakefile
--- extras/dynamic_linking/Mmakefile	2001/01/11 06:23:06	1.6
+++ extras/dynamic_linking/Mmakefile	2002/01/03 15:06:02
@@ -62,9 +62,15 @@
 	fi)
 
 name_mangle.m: $(BROWSER_DIR)/name_mangle.m
-	sed 's/mdb__//g' $< > $@
+	cp $< $@
 
+names.m: $(BROWSER_DIR)/names.m
+	cp $< $@
+
+mangle.m: $(BROWSER_DIR)/mangle.m
+	cp $< $@
+
 dl.m: $(BROWSER_DIR)/dl.m
-	sed 's/mdb__//g' $< > $@
+	cp $< $@
 
 #-----------------------------------------------------------------------------#
Index: extras/dynamic_linking/dl_test.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/dynamic_linking/dl_test.m,v
retrieving revision 1.4
diff -u -b -r1.4 dl_test.m
--- extras/dynamic_linking/dl_test.m	2001/01/11 05:05:29	1.4
+++ extras/dynamic_linking/dl_test.m	2002/01/03 15:06:50
@@ -12,7 +12,7 @@
 :- pred main(state::di, state::uo) is det.
 
 :- implementation.
-:- import_module dl, name_mangle, string, list.
+:- import_module names, dl, name_mangle, string, list.
 
 main -->
 	%
Index: extras/dynamic_linking/dl_test2.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/dynamic_linking/dl_test2.m,v
retrieving revision 1.1
diff -u -b -r1.1 dl_test2.m
--- extras/dynamic_linking/dl_test2.m	2001/01/11 05:05:29	1.1
+++ extras/dynamic_linking/dl_test2.m	2002/01/03 15:08:42
@@ -14,7 +14,7 @@
 :- pred main(state::di, state::uo) is det.
 
 :- implementation.
-:- import_module dl, name_mangle, string, list.
+:- import_module names, dl, name_mangle, string, list.
 
 main -->
 	%
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_tags.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tags.h,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_tags.h
--- runtime/mercury_tags.h	2001/10/25 12:41:19	1.14
+++ runtime/mercury_tags.h	2002/01/03 11:35:52
@@ -137,9 +137,9 @@
     ** is the mangled form of the name `obj_[]_0'.)
     */
     extern const struct mercury__list__list_1_s
-    	mercury__list__list_1__f_111_98_106_95_91_93_95_48;
+    	mercury__list__list_1__obj__f_lbracket__f_rbracket__0;
     #define MR_list_empty()
-	((MR_Word) (& mercury__list__list_1__f_111_98_106_95_91_93_95_48))
+	((MR_Word) (& mercury__list__list_1__obj__f_lbracket__f_rbracket__0))
     #define MR_list_is_empty(list)	((list) == MR_list_empty())
   #else
     /*
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
--------------------------------------------------------------------------
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