fix atom_term builtin not to require previous loading of charsio.

This commit is contained in:
Vitor Santos Costa
2011-01-20 11:51:46 -06:00
parent d593f99c13
commit d52d05a626
2 changed files with 17 additions and 13 deletions

View File

@@ -684,6 +684,23 @@ term_to_atom(Term,Atom) :-
charsio:write_to_chars(Term,S),
atom_codes(Atom,S).
%
% hack this here.
%
charsio:write_to_chars(Term, L0, OUT) :-
charsio:open_mem_write_stream(Stream),
prolog:write(Stream, Term),
charsio:peek_mem_write_stream(Stream, L0, O),
prolog:close(Stream),
O = OUT.
charsio:read_from_chars(Chars, Term) :-
charsio:open_mem_read_stream(Chars, Stream),
prolog:read(Stream, T),
prolog:close(Stream),
T = Term.
simple(V) :- var(V), !.
simple(A) :- atom(A), !.
simple(N) :- number(N).