fix overflow in atom_to_term error (UN #206)

This commit is contained in:
Vitor Santos Costa 2010-12-30 23:00:10 -06:00
parent 5367381154
commit 8161cf64b7

View File

@ -668,10 +668,14 @@ sub_atom(At, Bef, Size, After, SubAt) :-
atom_to_term(Atom, Term, Bindings) :- atom_to_term(Atom, Term, Bindings) :-
atom_codes(Atom, Chars), atom_codes(Atom, Chars),
charsio:open_mem_read_stream(Chars, Stream), charsio:open_mem_read_stream(Chars, Stream),
read_term(Stream, T, [variable_names(Bindings)]), catch(read_term(Stream, T, [variable_names(Bindings)]),Error,'$handle_atom_to_term_error'(Stream, Error)),
close(Stream), close(Stream),
T = Term. T = Term.
'$handle_atom_to_term_error'(Stream, Error) :-
close(Stream),
throw(Error).
term_to_atom(Term,Atom) :- term_to_atom(Term,Atom) :-
nonvar(Atom), !, nonvar(Atom), !,
atom_codes(Atom,S), atom_codes(Atom,S),