Re: number_codes breaks if handling unmatched-doublequote error

Daniel Diaz <[email protected]> Wed, 18 Nov 2009 11:07:18 +0100
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Thank you Jasper for your detailed report (very precise).
Il is fixed and will be available in the next version (coming soon as a 
beta).

Daniel

Jasper Taylor a écrit :
> Hi Daniel and everyone.
> I am using gprolog 1.3.2 on Linux and I have this problem. In certain 
> circumstances, number_codes is raising an exception when it should 
> succeed. This only happens if:
> * number_codes has a string matching a valid number as the 2nd arg and 
> a variable as the first
> * number_codes is called in the exception handling clause of 'catch'
> * the exception clause is executing because the goal of 'catch' 
> contained a read_term which caused a parse error
> * the parse error was due to an unmatched double quote.
>
> This example produces the bug. It looks like the read_term is 
> producing two errors, one of which hangs around and causes an 
> exception in number_codes. The string of codes converts to sin("foo).
>
>
> catch(read_from_codes([115,105,110,40,34,102,111,111,41,47], Term),
>      Bug,
>      number_codes(G, [51,49])).
>
> note that if you replace number_codes with name, the example executes 
> and catches the exception correctly, but G gets set to the atom '31' 
> rather than the number 31, which I guess is because the implementation 
> of name calls number_codes internally, and calls atom_codes when that 
> raises an exception.
> Hope you enjoy this challenge!
>    --Jasper
>
>
>
> _______________________________________________
> Bug-prolog mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/bug-prolog
>


-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.