fix current_stream/3.
This commit is contained in:
parent
7458d8ee74
commit
d6773df815
@ -4664,7 +4664,10 @@ will not have a leading dot.
|
|||||||
Defines the relation: The stream @var{S} is opened on the file @var{F}
|
Defines the relation: The stream @var{S} is opened on the file @var{F}
|
||||||
in mode @var{M}. It might be used to obtain all open streams (by
|
in mode @var{M}. It might be used to obtain all open streams (by
|
||||||
backtracking) or to access the stream for a file @var{F} in mode
|
backtracking) or to access the stream for a file @var{F} in mode
|
||||||
@var{M}, or to find properties for a stream @var{S}.
|
@var{M}, or to find properties for a stream @var{S}. Notice that some
|
||||||
|
streams might not be associated to a file: in this case YAP tries to
|
||||||
|
return the file number. If that is not available, YAP unifies @var{F}
|
||||||
|
with @var(S}.
|
||||||
|
|
||||||
@item is_stream(@var{S})
|
@item is_stream(@var{S})
|
||||||
@findex is_stream/1
|
@findex is_stream/1
|
||||||
|
22
pl/yio.yap
22
pl/yio.yap
@ -98,6 +98,16 @@ socket(Domain, Type, Protocol, Sock) :-
|
|||||||
),
|
),
|
||||||
yap_sockets:ip_socket(Domain, Type, Protocol, Sock).
|
yap_sockets:ip_socket(Domain, Type, Protocol, Sock).
|
||||||
|
|
||||||
|
socket_connect(Sock, Host, Read) :-
|
||||||
|
(
|
||||||
|
'$undefined'(ip_socket(_,_),yap_sockets)
|
||||||
|
->
|
||||||
|
load_files(library(sockets), [silent(true),if(not_loaded)])
|
||||||
|
;
|
||||||
|
true
|
||||||
|
),
|
||||||
|
yap_sockets:ip_socket(Domain, Type, Protocol, Sock).
|
||||||
|
|
||||||
open_pipe_streams(Read, Write) :-
|
open_pipe_streams(Read, Write) :-
|
||||||
(
|
(
|
||||||
'$undefined'(pipe(_,_),unix)
|
'$undefined'(pipe(_,_),unix)
|
||||||
@ -263,6 +273,7 @@ current_line_number(Stream,N) :-
|
|||||||
|
|
||||||
stream_position(Stream, Position) :-
|
stream_position(Stream, Position) :-
|
||||||
stream_property(Stream, position(Position)).
|
stream_property(Stream, position(Position)).
|
||||||
|
|
||||||
stream_position(Stream, Position, NewPosition) :-
|
stream_position(Stream, Position, NewPosition) :-
|
||||||
stream_property(Stream, position(Position)),
|
stream_property(Stream, position(Position)),
|
||||||
set_stream_position(Stream, NewPosition).
|
set_stream_position(Stream, NewPosition).
|
||||||
@ -292,8 +303,15 @@ current_char_conversion(X,Y) :-
|
|||||||
'$fetch_char_conversion'(List,X,Y).
|
'$fetch_char_conversion'(List,X,Y).
|
||||||
|
|
||||||
|
|
||||||
current_stream(File, Opts, Stream) :-
|
current_stream(File, Mode, Stream) :-
|
||||||
'$current_stream'(File, Opts, Stream).
|
stream_property(Stream, mode(Mode)),
|
||||||
|
'$stream_name'(Stream, File).
|
||||||
|
|
||||||
|
'$stream_name'(Stream, File) :-
|
||||||
|
stream_property(Stream, file_name(File)), !.
|
||||||
|
'$stream_name'(Stream, file_no(File)) :-
|
||||||
|
stream_property(Stream, file_no(File)), !.
|
||||||
|
'$stream_name'(Stream, Stream).
|
||||||
|
|
||||||
'$extend_file_search_path'(P) :-
|
'$extend_file_search_path'(P) :-
|
||||||
atom_codes(P,S),
|
atom_codes(P,S),
|
||||||
|
Reference in New Issue
Block a user