summaryrefslogtreecommitdiff
path: root/stdlib.pl
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib.pl')
-rw-r--r--stdlib.pl23
1 files changed, 23 insertions, 0 deletions
diff --git a/stdlib.pl b/stdlib.pl
index d093eed..c6b395f 100644
--- a/stdlib.pl
+++ b/stdlib.pl
@@ -110,6 +110,29 @@ open(SourceSink, Mode, Stream) :-
close(StreamOrAlias) :-
close(StreamOrAlias, []).
+flush_output :-
+ current_output(S),
+ flush_output(S).
+
+stream_property(S, P) :-
+ stream_properties(Props),
+ member(prop(S,P), Props).
+
+at_end_of_stream :-
+ current_input(S),
+ stream_property(S, end_of_stream(E)),
+ !,
+ (E = at ; E = past).
+
+at_end_of_stream(S_or_a) :-
+ ( atom(S_or_a)
+ -> stream_property(S, alias(S_or_a))
+ ; S = S_or_a
+ ),
+ stream_property(S, end_of_stream(E)),
+ !,
+ (E = at; E = past).
+
% Standard exceptions
instantiation_error :-