[m-dev.] diff: update NEWS file for MLDS trailing, etc.

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Dec 15 14:13:09 AEDT 2000


On 15-Dec-2000, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> >    It also does not support the following implemention-specific
> >    features that the old back-end supports:
> > -	- trailing
> >  	- fact tables
> >    	- the Mercury debugger (mdb)
> >    	- the Morphine trace analysis system
> 
> You should add extras/dynamic_linking to that list.

That one is almost easier to fix than to document ;-)

Estimated hours taken: 0.25

extras/dynamic_linking/name_mangle.m:
browser/name_mangle.m:
	Add support for the MLDS->C back-end.

Workspace: /home/pgrad/fjh/ws/hg
Index: extras/dynamic_linking/name_mangle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/dynamic_linking/name_mangle.m,v
retrieving revision 1.1
diff -u -d -r1.1 name_mangle.m
--- extras/dynamic_linking/name_mangle.m	1998/12/06 06:15:17	1.1
+++ extras/dynamic_linking/name_mangle.m	2000/12/15 03:09:51
@@ -62,7 +62,15 @@
 
 %-----------------------------------------------------------------------------%
 
-proc_name_mangle(MercuryProc) = LabelName :-
+proc_name_mangle(MercuryProc) =
+	( high_level_code ->
+		mlds_proc_name_mangle(MercuryProc)
+	;
+		llds_proc_name_mangle(MercuryProc)
+	).
+		
+:- func llds_proc_name_mangle(mercury_proc) = string.
+llds_proc_name_mangle(MercuryProc) = LabelName :-
 	MercuryProc = mercury_proc(PredOrFunc, Module, Name0, Arity, ModeNum),
 	sym_name_mangle(Module, ModuleName),
 	(
@@ -103,6 +111,40 @@
 		LabelName = LabelName4
 	).
 
+:- func mlds_proc_name_mangle(mercury_proc) = string.
+mlds_proc_name_mangle(MercuryProc) = LabelName :-
+	MercuryProc = mercury_proc(PredOrFunc, Module, Name0, Arity, ModeNum),
+	sym_name_mangle(Module, ModuleName),
+	(
+		PredOrFunc = predicate,
+		Name0 = "main",
+		Arity = 2
+		% The conditions above define which labels are printed without
+		% module qualification.
+	->
+		LabelName0 = Name0
+	;
+		qualify_name(ModuleName, Name0, LabelName0)
+	),
+	name_mangle(LabelName0, LabelName1),
+	(
+		PredOrFunc = predicate,
+		PredOrFuncString = "p"
+	;
+		PredOrFunc = function,
+		PredOrFuncString = "f"
+	),
+	( PredOrFunc = function ->
+		OrigArity is Arity - 1
+	;
+		OrigArity = Arity
+	),
+	string__int_to_string(OrigArity, ArityString),
+	string__int_to_string(ModeNum, ModeNumString),
+	string__append_list([LabelName1, "_", ArityString, "_",
+		PredOrFuncString, "_", ModeNumString],
+		LabelName).
+
 :- pred sym_name_mangle(sym_name, string).
 :- mode sym_name_mangle(in, out) is det.
 
@@ -220,5 +262,13 @@
 #endif
 ").
 
+:- pred high_level_code is semidet.
+:- pragma c_code(high_level_code, [will_not_call_mercury, thread_safe], "
+#ifdef MR_HIGHLEVEL_CODE
+	SUCCESS_INDICATOR = TRUE;
+#else
+	SUCCESS_INDICATOR = FALSE;
+#endif
+").
 
 %-----------------------------------------------------------------------------%
[the diff for browser/name_mangle.m is identical]

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list