set_input
This commit is contained in:
parent
a851c56e3d
commit
7fa58bca40
46
C/iopreds.c
46
C/iopreds.c
@ -104,8 +104,6 @@ STATIC_PROTO (int PlUnGetc, (int));
|
||||
STATIC_PROTO (Term MkStream, (int));
|
||||
STATIC_PROTO (int CheckStream, (Term, int, char *));
|
||||
STATIC_PROTO (Int p_close, (void));
|
||||
STATIC_PROTO (Int p_set_input, (void));
|
||||
STATIC_PROTO (Int p_set_output, (void));
|
||||
STATIC_PROTO (Int p_current_input, (void));
|
||||
STATIC_PROTO (Int p_current_output, (void));
|
||||
STATIC_PROTO (Int p_write, (void));
|
||||
@ -1815,28 +1813,6 @@ p_peek (void)
|
||||
return(Yap_unify_constant(ARG2,MkIntTerm(ch)));
|
||||
}
|
||||
|
||||
static Int
|
||||
p_set_input (void)
|
||||
{ /* '$set_input'(+Stream,-ErrorMessage) */
|
||||
Int sno = CheckStream (ARG1, Input_Stream_f, "set_input/1");
|
||||
if (sno < 0)
|
||||
return (FALSE);
|
||||
Yap_c_input_stream = sno;
|
||||
UNLOCK(Stream[sno].streamlock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_set_output (void)
|
||||
{ /* '$set_output'(+Stream,-ErrorMessage) */
|
||||
Int sno = CheckStream (ARG1, Output_Stream_f, "set_output/1");
|
||||
if (sno < 0)
|
||||
return FALSE;
|
||||
Yap_c_output_stream = sno;
|
||||
UNLOCK(Stream[sno].streamlock);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static Int
|
||||
p_has_bom (void)
|
||||
{ /* '$set_output'(+Stream,-ErrorMessage) */
|
||||
@ -2669,26 +2645,6 @@ p_set_stream_position (void)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static Int
|
||||
p_get (void)
|
||||
{ /* '$get'(Stream,-N) */
|
||||
int sno = CheckStream (ARG1, Input_Stream_f, "get/2");
|
||||
int ch;
|
||||
Int status;
|
||||
|
||||
if (sno < 0)
|
||||
return FALSE;
|
||||
status = Stream[sno].status;
|
||||
if (status & Binary_Stream_f) {
|
||||
UNLOCK(Stream[sno].streamlock);
|
||||
Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "get/2");
|
||||
return FALSE;
|
||||
}
|
||||
UNLOCK(Stream[sno].streamlock);
|
||||
while ((ch = Stream[sno].stream_wgetc(sno)) <= 32 && ch >= 0);
|
||||
return (Yap_unify_constant (ARG2, MkIntegerTerm (ch)));
|
||||
}
|
||||
|
||||
static Term
|
||||
read_line(int sno)
|
||||
{
|
||||
@ -4273,8 +4229,6 @@ Yap_InitIOPreds(void)
|
||||
Yap_InitCPred ("$get_read_error_handler", 1, p_get_read_error_handler, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$read", 6, p_read, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
|
||||
Yap_InitCPred ("$read", 7, p_read2, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
|
||||
Yap_InitCPred ("$set_input", 1, p_set_input, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$set_output", 1, p_set_output, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
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);
|
||||
|
11
pl/boot.yap
11
pl/boot.yap
@ -92,8 +92,8 @@ true :- true.
|
||||
% '$startup_saved_state',
|
||||
'$startup_reconsult',
|
||||
'$startup_goals',
|
||||
'$set_input'(user_input),
|
||||
'$set_output'(user_output),
|
||||
set_input(user_input),
|
||||
set_output(user_output),
|
||||
'$init_or_threads',
|
||||
'$run_at_thread_start'.
|
||||
|
||||
@ -1058,7 +1058,8 @@ break :-
|
||||
set_value('$live','$true'),
|
||||
b_setval('$spy_glist',GList),
|
||||
nb_setval('$spy_gn',SPY_GN),
|
||||
'$set_input'(InpStream), '$set_output'(OutStream),
|
||||
set_input(InpStream),
|
||||
set_output(OutStream),
|
||||
'$debug_on'(Debug),
|
||||
nb_setval('$debug_jump',Jump),
|
||||
nb_setval('$debug_run',Run),
|
||||
@ -1438,6 +1439,10 @@ flush_output(Stream) :-
|
||||
ttyflush :-
|
||||
swi_ttyflush.
|
||||
|
||||
set_input(Stream) :-
|
||||
swi_set_input(Stream).
|
||||
set_output(Stream) :-
|
||||
swi_set_output(Stream).
|
||||
|
||||
get(C) :-
|
||||
swi_get(C).
|
||||
|
Reference in New Issue
Block a user