use newly available library predicate read_n_chars/3
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
:- use_module(library(freeze)).
|
:- use_module(library(freeze)).
|
||||||
:- use_module(library(iso_ext), [setup_call_cleanup/3, partial_string/1, partial_string/3]).
|
:- use_module(library(iso_ext), [setup_call_cleanup/3, partial_string/1, partial_string/3]).
|
||||||
:- use_module(library(lists), [member/2, maplist/2]).
|
:- use_module(library(lists), [member/2, maplist/2]).
|
||||||
|
:- use_module(library(charsio), [read_n_chars/3]).
|
||||||
|
|
||||||
:- meta_predicate(phrase_from_file(2, ?)).
|
:- meta_predicate(phrase_from_file(2, ?)).
|
||||||
:- meta_predicate(phrase_from_file(2, ?, ?)).
|
:- meta_predicate(phrase_from_file(2, ?, ?)).
|
||||||
@@ -42,7 +43,7 @@ reader_step(Stream, Pos, Xs0) :-
|
|||||||
set_stream_position(Stream, Pos),
|
set_stream_position(Stream, Pos),
|
||||||
( at_end_of_stream(Stream)
|
( at_end_of_stream(Stream)
|
||||||
-> Xs0 = []
|
-> Xs0 = []
|
||||||
; '$get_n_chars'(Stream, 4096, Cs),
|
; read_n_chars(Stream, 4096, Cs),
|
||||||
partial_string(Cs, Xs0, Xs),
|
partial_string(Cs, Xs0, Xs),
|
||||||
stream_to_lazy_list(Stream, Xs)
|
stream_to_lazy_list(Stream, Xs)
|
||||||
).
|
).
|
||||||
|
|||||||
Reference in New Issue
Block a user