This library provides some commonly used reading predicates. As these predicates have proven to be time-critical in some applications we moved them to C. For compatibility as well as to reduce system dependency, we link the foreign code at runtime and fallback to the Prolog implementation if the shared object cannot be found.
read_header_data(Stream, Header) :- read_line_to_codes(Stream, Header, Tail), read_header_data(Header, Stream, Tail). read_header_data("\r\n", _, _) :- !. read_header_data("\n", _, _) :- !. read_header_data("", _, _) :- !. read_header_data(_, Stream, Tail) :- read_line_to_codes(Stream, Tail, NewTail), read_header_data(Tail, Stream, NewTail).
end_of_file
if the end of the file is
reached.
\
Tail.
\
Tail forms a difference
list.
Note that the output options of read_term/3,
such as
variable_names
or subterm_positions
will cause
read_file_to_terms/3
to fail if Spec contains multiple terms because the values
for the different terms will not unify.