MODIFIED: library(charsio): read_n_chars/3 is now called get_n_chars/3

This is because "read" is associated with general Prolog terms.
This commit is contained in:
Markus Triska
2022-01-17 20:36:51 +01:00
parent 20b6816562
commit 23adfef281
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
:- module(charsio, [char_type/2, :- module(charsio, [char_type/2,
chars_utf8bytes/2, chars_utf8bytes/2,
get_single_char/1, get_single_char/1,
read_n_chars/3, get_n_chars/3,
read_line_to_chars/3, read_line_to_chars/3,
read_from_chars/2, read_from_chars/2,
write_term_to_chars/3, write_term_to_chars/3,
@@ -205,7 +205,7 @@ read_line_to_chars(Stream, Cs0, Cs) :-
characters read. characters read.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
read_n_chars(Stream, N, Cs) :- get_n_chars(Stream, N, Cs) :-
can_be(integer, N), can_be(integer, N),
( var(N) -> ( var(N) ->
read_to_eof(Stream, Cs), read_to_eof(Stream, Cs),

View File

@@ -21,7 +21,7 @@
:- use_module(library(freeze)). :- use_module(library(freeze)).
:- use_module(library(iso_ext), [setup_call_cleanup/3, partial_string/3]). :- use_module(library(iso_ext), [setup_call_cleanup/3, 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]). :- use_module(library(charsio), [get_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, ?, ?)).
@@ -62,7 +62,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 = []
; read_n_chars(Stream, 4096, Cs), ; get_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)
). ).