[bp-users]Looking for documentation a list of prolog flags for B-Prolog; ]Dataloss with term2atom;]at_end_of_stream/1 not detecting end of file.

probp probp@probp.com
Mon, 26 Nov 2001 00:19:10 -0800


Hi, let me answer your questions in one email.

First, regarding "term2atom/2" and related built-ins, these built-ins were
introduced to facilitate data conversion between C and B-Prolog. In Version
6.0, they was provided as B-Prolog's built-ins as well. The built-ins do not
insert quotation marks as needed and thus "term2atom(T,A), parse_atom(A,T1)"
may give syntax error or may return a term T1 that is different from T (an
atom may turn into a variable because of lack of quotation marks). We will
improve the built-ins so that the system can insert quotation marks
automatically if needed and hope to have the improvements incorporated in
Version 6.1. For the time being, you have to implement your version of
term2atom by yourself. The implementation should not be difficult.

Second regarding Prolog flags, the built-in
"current_prolog_flag(Flag,Value)" returns the current value set to a give
flag. It cannot be used to reveal all the flags. In V 6.0, there are six
flags (see page 19 in the manual).

Third, regarding at_end_of_stream/1, it seems that there is a bug. When a
stream is closed, its status (end of file) is not updated accordingly. You
can test end-of-file by testing the last value that is read in. For the
built-in "get_code", -1 means end-of-file, and for "read", the atom
"end_of_file" means end-of-file.

Please feel free to let us know when you have any questions.

Best regards,
Neng-Fa Zhou
> bp-users mailing list
> bp-users@lists.probp.com
> http://lists.probp.com/mailman/listinfo/bp-users
>



and parser

> term2atom('A'(X),Atom).
>
> returns:
> Atom = 'A(_40182090)'
>
> It should instead return :
> Atom = '\'A\'(_40182090)'
>
> another example:
>
> term2atom(on('BlueCone1',redBlock1),Atom).
>
> returns:
> Atom = 'on(BlueCone1,redBlock1)'
>
> It should instead return :
> Atom = 'on(\'BlueCone1\',redBlock1)'
>
> It would be nice if one could always safely do:
>
> term2atom(Term,Atom),parse_atom(Atom,Term,_).
>
> and have it succeed.
>
> also term2string/2 has the same issue:
>
> term2string(on('BlueCone1',redBlock1),String),atom_codes(A,String).
>
> A = on(BlueCone1,redBlock1)
> String =
>
[111,110,40,66,108,117,101,67,111,110,101,49,44,114,101,100,66,108,111,99,10
> 7,49,41].
>
>
> I must be missing global flag to tell it I need my atoms quoted?
>
> Hi
>
> I am trying to find in documentation a list of prolog flags
>
> I can't gleen them from current_prolog_flag/2 since it it gives
> deterministic exit:
>
> | ?- current_prolog_flag(X,Y),write(X=Y),nl,fail.
> unknown=error
> no
> | ?-
>
>
> Thank you,
>
> Douglas
>
> _______________________________________________
> bp-users mailing list
> bp-users@lists.probp.com
> http://lists.probp.com/mailman/listinfo/bp-users
>

----------------------------------------------------
Sign Up for NetZero Platinum Today
Only $9.95 per month!
http://my.netzero.net/s/signup?r=platinum&refcd=PT97