[m-rev.] diff: string__to_float in MC++

Tyson Dowd trd at cs.mu.OZ.AU
Wed Sep 5 01:58:41 AEST 2001


On 04-Sep-2001, Yoann Dubreuil <ydu at miscrit.be> wrote:
> I have deleted the commented out C# code, as currently the compiler
> doesn't generate correct code for semidet procedures implemented in
> C#.

For the record:

I think semidet C# works just fine, if you assign to "succeeded" it will
work.

But I don't want to support this mechanism, and I haven't yet written
the code to support SUCCESS_INDICATOR instead (I have about half of it
written).

> 
> 
> -----Original Message-----
> From: owner-mercury-reviews at cs.mu.OZ.AU
> [mailto:owner-mercury-reviews at cs.mu.OZ.AU]On Behalf Of Yoann Dubreuil
> Sent: Tuesday, September 04, 2001 5:05 PM
> To: mercury-reviews at cs.mu.OZ.AU
> Subject: [m-rev.] diff: string__to_float in MC++
> 
> 
> Hi,
> 
> I haven't submitted this for review, because Peter is sitting next
> to me and he says it is alright.
> 
> ===================================================================
> 
> 
> Estimated hours taken: 0.5
> User: ydu
> Branches: main
> 
> library/string.m:
> 	Implementation of string__to_float in MC++
> 
> Index: string.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/string.m,v
> retrieving revision 1.156
> diff -u -r1.156 string.m
> --- string.m	4 Sep 2001 10:57:59 -0000	1.156
> +++ string.m	4 Sep 2001 15:00:15 -0000
> @@ -1670,11 +1670,28 @@
>  }").
> 
>  :- pragma foreign_proc("MC++",
> -	string__to_float(_FloatString::in, _FloatVal::out),
> +	string__to_float(FloatString::in, FloatVal::out),
>  		[will_not_call_mercury, thread_safe], "{
> -	mercury::runtime::Errors::SORRY(""c code for this function"");
> +	SUCCESS_INDICATOR = TRUE;
> +	try {
> +	    FloatVal = System::Convert::ToDouble(FloatString);
> +	} catch (System::InvalidCastException *e) {
> +	     SUCCESS_INDICATOR = FALSE;
> +	}
>  }").
> 
> +
> +/*:- pragma foreign_proc("C#",
> +	string__to_float(_FloatString::in, _FloatVal::out),
> +		[will_not_call_mercury, thread_safe], "{
> +	succeeded = 1;
> +	try {
> +	    _FloatVal = System.Convert.ToDouble(_FloatString);
> +	} catch (System.InvalidCastException e) {
> +	     succeeded = 0;
> +	}
> +}").
> +*/
>  /*-----------------------------------------------------------------------*/
> 
>  /*
> 
> 
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------
> 
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------
--------------------------------------------------------------------------
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