Merge pull request #1070 from triska/open_stream

ENHANCED: open/4 to allow opening a stream by specifying stream(S).
This commit is contained in:
Mark Thom
2021-11-07 09:39:41 -05:00
committed by GitHub
3 changed files with 24 additions and 1 deletions

View File

@@ -1466,7 +1466,11 @@ open(SourceSink, Mode, Stream, StreamOptions) :-
throw(error(uninstantiation_error(Stream), open/4)) % 8.11.5.3f)
;
parse_stream_options(StreamOptions, [Alias, EOFAction, Reposition, Type], open/4),
'$open'(SourceSink, Mode, Stream, Alias, EOFAction, Reposition, Type)
( SourceSink = stream(S0) ->
'$set_stream_options'(S0, Alias, EOFAction, Reposition, Type),
Stream = S0
; '$open'(SourceSink, Mode, Stream, Alias, EOFAction, Reposition, Type)
)
).