[m-rev.] diff: treat foreign types as equivalent to c_pointer

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 15 13:01:24 AEST 2002


On 14-May-2002, Peter Ross <peter.ross at miscrit.be> wrote:
> +++ compiler/type_ctor_info.m	13 May 2002 09:41:46 -0000
> @@ -254,13 +254,17 @@
>  		TypeTables = [],
>  		NumPtags = -1
>  	;
> +			% We treat foreign_types as equivalent to the
> +			% type builtin__c_pointer.
>  		TypeBody = foreign_type(_, _),
> +		Ctxt = term__context("builtin.m", 1),
> +		Type = functor(term__atom(":"), [
> +				functor(term__atom("builtin"), [], Ctxt),
> +				functor(term__atom("c_pointer"), [], Ctxt)],
> +				Ctxt),

You should not hard-code the name "builtin".
Instead, you should use `mercury_public_builtin_module'.
Also, it would be simpler if you use `construct_type':

	mercury_public_builtin_module(Builtin),
	construct_type(qualified(Builtin, "c_pointer") - 0, [], Type)

> +++ compiler/unify_proc.m	13 May 2002 09:41:47 -0000
> @@ -871,40 +882,52 @@
...
> +		{ Ctxt = term__context("builtin.m", 1) },
> +		{ CPointerType = functor(term__atom(":"), [
> +				functor(term__atom("builtin"), [], Ctxt),
> +				functor(term__atom("c_pointer"), [], Ctxt)],
> +				Ctxt) },
> +		generate_compare_clauses_eqv_type(CPointerType,
> +				Res, H1, H2, Context, Clauses)

Likewise here.

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