From f0d217dd920bd2a3b11c2d97599aa38f4ff66f16 Mon Sep 17 00:00:00 2001 From: ubu32 Date: Mon, 14 Feb 2011 14:19:30 -0800 Subject: [PATCH] ifix small stuff. --- C/iopreds.c | 44 -------------------------------------------- pl/boot.yap | 4 ++++ pl/consult.yap | 2 +- 3 files changed, 5 insertions(+), 45 deletions(-) diff --git a/C/iopreds.c b/C/iopreds.c index 5bca52b78..93d76ba0a 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -2688,17 +2688,6 @@ Yap_StreamToFileNo(Term t) } } -static Int -p_stream(void) -{ - Term in = Deref(ARG1); - if (IsVarTerm(in)) - return(FALSE); - if (IsApplTerm(in)) - return(FunctorOfTerm(in) == FunctorStream); - return(FALSE); -} - static Int p_same_file(void) { char *f1 = RepAtom(AtomOfTerm(Deref(ARG1)))->StrOfAE; @@ -2787,36 +2776,6 @@ p_get_default_encoding(void) return Yap_unify(ARG1, out); } -static Int -p_toupper(void) -{ - Int out = IntegerOfTerm(Deref(ARG1)), uout; - if (out < 0) { - Yap_Error(REPRESENTATION_ERROR_CHARACTER_CODE, ARG1, "toupper"); - return FALSE; - } - if (out < 128) - uout = toupper(out); - else - uout = towupper(out); - return Yap_unify(ARG2, MkIntegerTerm(uout)); -} - -static Int -p_tolower(void) -{ - Int out = IntegerOfTerm(Deref(ARG1)), uout; - if (out < 0) { - Yap_Error(REPRESENTATION_ERROR_CHARACTER_CODE, ARG1, "tolower"); - return FALSE; - } - if (out < 128) - uout = tolower(out); - else - uout = towlower(out); - return Yap_unify(ARG2, MkIntegerTerm(uout)); -} - static Int p_encoding (void) { /* '$encoding'(Stream,N) */ @@ -2886,7 +2845,6 @@ Yap_InitIOPreds(void) Yap_InitCPred ("$all_char_conversions", 1, p_all_char_conversions, SyncPredFlag|HiddenPredFlag); Yap_InitCPred ("$force_char_conversion", 0, p_force_char_conversion, SyncPredFlag|HiddenPredFlag); Yap_InitCPred ("$disable_char_conversion", 0, p_disable_char_conversion, SyncPredFlag|HiddenPredFlag); - Yap_InitCPred ("$stream", 1, p_stream, SafePredFlag|TestPredFlag); Yap_InitCPred ("$get_default_encoding", 1, p_get_default_encoding, SafePredFlag|TestPredFlag); Yap_InitCPred ("$encoding", 2, p_encoding, SafePredFlag|SyncPredFlag), #if HAVE_SELECT @@ -2895,8 +2853,6 @@ Yap_InitIOPreds(void) Yap_InitCPred ("$same_file", 2, p_same_file, SafePredFlag|SyncPredFlag|HiddenPredFlag); Yap_InitCPred ("$float_format", 1, p_float_format, SafePredFlag|SyncPredFlag|HiddenPredFlag); Yap_InitCPred ("$has_readline", 0, p_has_readline, SafePredFlag|HiddenPredFlag); - Yap_InitCPred ("$toupper", 2, p_toupper, SafePredFlag|HiddenPredFlag); - Yap_InitCPred ("$tolower", 2, p_tolower, SafePredFlag|HiddenPredFlag); Yap_InitReadUtil (); InitPlIO (); diff --git a/pl/boot.yap b/pl/boot.yap index 34f324955..4274e193a 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -1559,3 +1559,7 @@ format(Command, Args) :- swi_format(Command, Args). format(Stream, Command, Args) :- swi_format(Stream, Command, Args). + +is_stream(Stream) :- + swi_is_stream(Stream). + diff --git a/pl/consult.yap b/pl/consult.yap index 9e0a2c6e5..f7203600e 100755 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -128,7 +128,7 @@ load_files(Files,Opts) :- '$process_lf_opt'(consult(reconsult),_,_,_,_,_,_,_,_,_,_,reconsult,_,_). '$process_lf_opt'(consult(consult),_,_,_,_,_,_,_,_,_,_,consult,_,_). '$process_lf_opt'(stream(Stream),_,_,_,_,_,_,Stream,_,_,_,_,Files,Call) :- -/* ( '$stream'(Stream) -> true ; '$do_error'(domain_error(stream,Stream),Call) ), */ +/* ( is_stream(Stream) -> true ; '$do_error'(domain_error(stream,Stream),Call) ), */ ( atom(Files) -> true ; '$do_error'(type_error(atom,Files),Call) ). '$check_use_module'(use_module(_),use_module(_)) :- !.