This commit is contained in:
ubu32 2011-02-14 12:40:10 -08:00
parent eff5dd3166
commit f13215700b
3 changed files with 25 additions and 119 deletions

View File

@ -3921,8 +3921,6 @@ Yap_InitIOPreds(void)
Yap_InitCPred ("$read", 6, p_read, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
Yap_InitCPred ("$read", 7, p_read2, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
Yap_InitCPred ("$skip", 2, p_skip, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$write", 2, p_write, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$write", 3, p_write2, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$write_with_prio", 3, p_write_prio, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$write_with_prio", 4, p_write2_prio, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("format", 2, p_format, SyncPredFlag);

View File

@ -1510,6 +1510,26 @@ nl :-
swi_nl.
nl(Stream) :-
swi_nl(Stream).
print(T) :-
swi_print(T).
print(Stream, T) :-
swi_print(Stream, T).
write(T) :-
swi_write(T).
write(Stream, T) :-
swi_write(Stream, T).
writeq(T) :-
swi_writeq(T).
writeq(Stream, T) :-
swi_writeq(Stream, T).
write_canonical(T) :-
swi_write_canonical(T).
write_canonical(Stream, T) :-
swi_write_canonical(Stream, T).
write_term(Stream, T) :-
swi_write_term(Stream, T).
write_term(Stream, T, Options) :-
swi_write_term(Stream, T, Options).
tab(C) :-
swi_tab(C).
tab(Stream, C) :-

View File

@ -242,120 +242,12 @@ read_term(Stream, T, Options) :-
flags are defined in yapio.h
*/
write(T) :- '$write'(4, T).
writeln(T) :-
'$write'(4, T),
nl.
write(Stream,T) :-
'$write'(Stream,4,T).
writeq(T) :- '$write'(5,T).
writeq(Stream,T) :-
'$write'(Stream,5,T),
fail.
writeq(_,_).
display(T) :- '$write'(2,T).
display(Stream,T) :-
'$write'(Stream,2,T),
fail.
display(_,_).
write_canonical(T) :- '$write'(3,T).
write_canonical(Stream,T) :-
'$write'(Stream,3,T),
fail.
write_canonical(_,_).
print(T) :- '$write'(12,T), fail.
print(_).
print(Stream,T) :-
'$write'(Stream,12,T),
fail.
print(_,_).
write_term(T,Opts) :-
'$check_io_opts'(Opts, write_term(T,Opts)),
'$process_wt_opts'(Opts, 0, Flag, Priority, Callbacks),
'$write_with_prio'(Flag, Priority, T),
'$process_wt_callbacks'(Callbacks),
fail.
write_term(_,_).
write_term(S, T, Opts) :-
'$check_io_opts'(Opts, write_term(T,Opts)),
'$process_wt_opts'(Opts, 0, Flag, Priority, Callbacks),
'$write_with_prio'(S, Flag, Priority, T),
'$process_wt_callbacks'(Callbacks),
fail.
write_term(_,_,_).
'$process_wt_opts'([], Flag, Flag, 1200, []).
'$process_wt_opts'([quoted(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x01,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([quoted(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x01,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([ignore_ops(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x02,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([ignore_ops(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x02,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([numbervars(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x04,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([numbervars(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x04,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([portrayed(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x08,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([portrayed(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x08,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([portray(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x08,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([portray(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x08,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([cycles(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x20,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([cycles(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x20,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([swi(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 0x40,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([swi(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ \0x40,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([attributes(_)|Opts], Flag0, Flag, Priority, CallBacks) :-
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([priority(Priority)|Opts], Flag0, Flag, Priority, CallBacks) :-
'$process_wt_opts'(Opts, Flag0, Flag, _, CallBacks).
'$process_wt_opts'([max_depth(D)|Opts], Flag0, Flag, Priority, [max_depth(D1,D0,D2)|CallBacks]) :-
write_depth(D1,D0,D2),
D10 is D*10,
write_depth(D,D,D10),
'$process_wt_opts'(Opts, Flag0, Flag, Priority, CallBacks).
'$process_wt_callbacks'([]).
'$process_wt_callbacks'([max_depth(D1,D0,D2)|Cs]) :-
write_depth(D1,D0,D2),
'$process_wt_callbacks'(Cs).
display(T) :-
current_output(Out),
write_term(Out, T, [ignore_ops(true)]).
display(Stream, T) :-
write_term(Term, T, [ignore_ops(true)]).
format(T) :-
format(T, []).
@ -374,10 +266,6 @@ skip(N) :- current_input(S), N1 is N, '$skip'(S,N1).
skip(Stream,N) :- N1 is N, '$skip'(Stream,N1).
'$tab'(N) :- N<1, !.
'$tab'(N) :- put(32), N1 is N-1, '$tab'(N1).
ttyget(N) :- get(user_input,N).
ttyget0(N) :- get0(user_input,N).