[m-rev.] for review: multiple foreign language support
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jul 23 18:52:05 AEST 2001
On 19-Jul-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> @@ -98,37 +118,39 @@
> % to do this later.
>
> % C is always preferred over any other language.
> +prefer_foreign_language(_Globals, c, Lang1, Lang2) =
> + ( Lang2 = c, not Lang1 = c ->
> + yes
> ;
> + no
> ).
The comment here is a bit misleading.
I suggest rephrasing it as "When compiling to C, ..."
(and likewise for the other clauses for this predicate).
> diff -u compiler/globals.m compiler/globals.m
...
> @@ -258,6 +242,16 @@
> globals__get_trace_level(Globals, Globals ^ trace_level).
> globals__get_trace_suppress(Globals, Globals ^ trace_suppress_items).
>
> +globals__get_backend_foreign_languages(Globals, ForeignLangs) :-
> + globals__lookup_accumulating_option(Globals, backend_foreign_languages,
> + LangStrs),
> + ForeignLangs = list__map(func(String) = ForeignLang :-
> + (convert_foreign_language(String, ForeignLang0) ->
s/(/( /
> +++ compiler/make_hlds.m
> @@ -5296,12 +5296,12 @@
> LangClauses = [ForeignLang - ClauseNumber | Rest],
> ForeignLang = foreign_language(OldLang),
> ( Rest = [] ->
> - Compare = foreign__compare_foreign_language(Globals,
> + Compare = foreign__prefer_foreign_language(Globals,
> Target, OldLang, NewLang),
> (
> % This language is preferred to the old
> % language, so we should replace it
> - Compare = (<) ->
> + Compare = yes ->
> UpdateClauses =
> (pred(NewCl::in, Cs::out) is det :-
> list__replace_nth_det(ClauseList,
I suggest s/Compare/PreferNewLang/g
> diff -u compiler/options.m compiler/options.m
> --- compiler/options.m
> +++ compiler/options.m
> @@ -200,12 +200,6 @@
> ; unboxed_no_tag_types
> ; sync_term_size % in words
> ; type_layout
> - % Foreign language interface options
> - % The foreign language that the user has
> - % selected for use in this module
> - % (defaults to the value of backend
> - % foreign target).
> - ; use_foreign_language
You need to remove that from doc/user_guide.texi too,
if you haven't already done so.
> @@ -2236,6 +2199,58 @@
> )
> ).
>
> + % Generate the following dependency. This dependency is
> + % needed because module__cpp_code.dll might refer to
> + % high level data in any of the mercury modules it
> + % imports plus itself.
> + %
> + % For example, for MC++ we generate:
> + %
> + % <module>__cpp_code.dll : <module>.dll <imports>.dll
> + %
> + %
> + % Generate the following sequence of rules which state
> + % how to generate the module__cpp_code.dll.
> + %
> + % For example, for MC++ we generate:
> + %
> + % <module>__cpp_code.dll : <module>__cpp_code.cpp
Why is that rule needed?
Doesn't that follow automatically from the pattern rule in scripts/Mmake.rules?
> + % <module>__cpp_code.cpp : <module>.il
It would be helpful to have a comment explaining that rule.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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