[m-rev.] for review: Add C# build rules

Tyson Dowd trd at cs.mu.OZ.AU
Fri Jul 20 02:06:41 AEST 2001


On 19-Jul-2001, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> Hi,
> 
> 
> ===================================================================
> 
> 
> Estimated hours taken: 2
> Branches: main
> 
> Add rules to build C# files automatically.
> 
> compiler/globals.m:
>     Add the function foreign_lang_ext which returns the extension to
>     place on files for the particular foreign language.

This is going to conflict with my change to do much the same thing, but
ce la via.

> 
> compiler/modules.m:
>     Output the variable REFS-foreign_code_module.  This variable holds
>     the command line argument the C# compiler uses to determine which
>     assemblies to resolve symbols against.

You should describe what the variable contains before you describe what
it is used for.

REFS is not the greatest name.  CSHARP_ASSEMBLY_REFS would be nicer.

>     Use the foreign_lang_ext function to determine the extension
>     correctly.
> 
> scripts/Mmake.rules:
>     Add a rule to build dlls from C# files.
> 
> Index: compiler/globals.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
> retrieving revision 1.44
> diff -u -r1.44 globals.m
> --- compiler/globals.m	18 Jul 2001 10:20:50 -0000	1.44
> +++ compiler/globals.m	19 Jul 2001 11:02:53 -0000
> @@ -61,6 +61,9 @@
>  	% for use in machine-readable name mangling.
>  :- func simple_foreign_language_string(foreign_language) = string.
>  
> +	% The extension for files of this foreign language.
> +:- func foreign_lang_ext(foreign_language) = string.
> +
>  %-----------------------------------------------------------------------------%
>  
>  	% Access predicates for the `globals' structure.
> @@ -215,6 +218,11 @@
>  simple_foreign_language_string(managed_cplusplus) = "cpp". % XXX mcpp is better
>  simple_foreign_language_string(csharp) = "csharp".
>  simple_foreign_language_string(il) = "il".
> +
> +foreign_lang_ext(c) = "c".
> +foreign_lang_ext(managed_cplusplus) = "cpp". % XXX mcpp is better
> +foreign_lang_ext(csharp) = "cs".
> +foreign_lang_ext(il) = "il".

The XXX shouldn't be in the added code as I don't think mcpp is the
right extension for managed C++ files.

>  
>  convert_gc_method("none", none).
>  convert_gc_method("conservative", conservative).
> Index: compiler/modules.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
> retrieving revision 1.178
> diff -u -r1.178 modules.m
> --- compiler/modules.m	18 Jul 2001 12:08:43 -0000	1.178
> +++ compiler/modules.m	19 Jul 2001 11:02:59 -0000
> @@ -2058,9 +2058,12 @@
>  		->
>  			globals__io_lookup_foreign_language_option(
>  					backend_foreign_language, ForeignLang),
> -			{ ForeignExt = simple_foreign_language_string(
> +			{ ForeignExt = "." ++ foreign_lang_ext(ForeignLang) },
> +			{ ForeignStr = simple_foreign_language_string(
>  					ForeignLang) },
> -			{ ForeignCodeExt = "__" ++ ForeignExt ++ "_code." },
> +			{ ForeignCodeExt = "__" ++ ForeignStr ++ "_code" },
> +			module_name_to_file_name(ModuleName, "", no,
> +					Name),
>  			module_name_to_file_name(ModuleName,
>  					ForeignCodeExt ++ ForeignExt,
>  					no, ForeignFileName),

I prefer returning the strings with the "." already prepended, but don't
worry about it as my change does this and I will have to fix it as part
of the conflict.

Otherwise this seems fine, thanks Pete.
--------------------------------------------------------------------------
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