
readutil.pl -- Read utilitiesThis 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_line_to_codes(+Stream, -Line:codes) is det
read_line_to_codes(+Stream, -Line, ?Tail) is det
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).
read_line_to_string(+Stream, -String) is detend_of_file
if the end of the file is reached.
read_stream_to_codes(+Stream, -Codes) is det
read_stream_to_codes(+Stream, -Codes, ?Tail) is det
read_file_to_codes(+Spec, -Codes, +Options) is det
read_file_to_string(+Spec, -String, +Options) is det
read_file_to_terms(+Spec, -Terms, +Options) is det
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.
The following predicates are exported, but not or incorrectly documented.
read_stream_to_codes(Arg1, Arg2, Arg3)