From 48cd3bd6752531c909fb7efc8b82744f7501d8f4 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sat, 26 Mar 2011 15:18:56 +0000 Subject: [PATCH] use SWI flags. --- C/iopreds.c | 12 ------------ C/sysbits.c | 3 +-- packages/PLStream/pl-file.c | 1 + packages/PLStream/pl-rl.c | 6 ------ packages/PLStream/pl-yap.c | 10 ++++++++-- packages/R | 2 +- packages/http | 2 +- packages/plunit | 2 +- pl/boot.yap | 2 ++ pl/flags.yap | 6 +++--- 10 files changed, 18 insertions(+), 28 deletions(-) diff --git a/C/iopreds.c b/C/iopreds.c index 9e26b2ef7..a04ef602b 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -215,17 +215,6 @@ Yap_DebugErrorPutc(int c) -static Int -p_has_readline( USES_REGS1 ) -{ -#if HAVE_LIBREADLINE && HAVE_READLINE_READLINE_H - return TRUE; -#else - return FALSE; -#endif -} - - int Yap_GetCharForSIGINT(void) { @@ -1163,6 +1152,5 @@ Yap_InitIOPreds(void) // Yap_InitCPred ("stream_select", 3, p_stream_select, SafePredFlag|SyncPredFlag); #endif Yap_InitCPred ("$float_format", 1, p_float_format, SafePredFlag|SyncPredFlag|HiddenPredFlag); - Yap_InitCPred ("$has_readline", 0, p_has_readline, SafePredFlag|HiddenPredFlag); } diff --git a/C/sysbits.c b/C/sysbits.c index b8c29b44f..a4fd16c8b 100755 --- a/C/sysbits.c +++ b/C/sysbits.c @@ -1557,8 +1557,6 @@ InteractSIGINT(int ch) { switch (ch) { case 'a': /* abort computation */ - if (Yap_PrologMode &= InReadlineMode) { - } if (Yap_PrologMode & (GCMode|ConsoleGetcMode|GrowStackMode|GrowHeapMode)) { Yap_PrologMode |= AbortMode; } else { @@ -1566,6 +1564,7 @@ InteractSIGINT(int ch) { /* in case someone mangles the P register */ } Yap_PrologMode &= ~AsyncIntMode; + siglongjmp(Yap_RestartEnv,1); return -1; case 'b': /* continue */ diff --git a/packages/PLStream/pl-file.c b/packages/PLStream/pl-file.c index 6b9af5e7b..3418647f3 100755 --- a/packages/PLStream/pl-file.c +++ b/packages/PLStream/pl-file.c @@ -4714,6 +4714,7 @@ static const PL_extension foreigns[] = { META|NDET), FRG("$raw_read", 1, pl_raw_read, 0), FRG("$raw_read", 2, pl_raw_read2, 0), + FRG("$has_readline", 1, pl_has_readline, 0), /* DO NOT ADD ENTRIES BELOW THIS ONE */ LFRG((char *)NULL, 0, NULL, 0) }; diff --git a/packages/PLStream/pl-rl.c b/packages/PLStream/pl-rl.c index 67e76a627..c278acc93 100755 --- a/packages/PLStream/pl-rl.c +++ b/packages/PLStream/pl-rl.c @@ -514,12 +514,6 @@ Sread_readline(void *handle, char *buf, size_t size) PL_clock_wait_ticks(clock() - oldclock); #endif -#if __YAP_PROLOG__ - /* handle abort */ - if (Yap_REGS.P_ == FAILCODE) { - return 0; - } -#endif return rval; } diff --git a/packages/PLStream/pl-yap.c b/packages/PLStream/pl-yap.c index c5f040b45..c2e3432b8 100755 --- a/packages/PLStream/pl-yap.c +++ b/packages/PLStream/pl-yap.c @@ -1023,14 +1023,20 @@ Yap_fetch_module_for_format(term_t args, YAP_Term *modp) { return YAP_InitSlot(nt); } +word +pl_readline(term_t flag) +{ + +} + +#if THREADS + #define COUNT_MUTEX_INITIALIZER(name) \ { PTHREAD_MUTEX_INITIALIZER, \ name, \ 0L \ } -#if THREADS - static int recursive_attr(pthread_mutexattr_t **ap) { static int done; diff --git a/packages/R b/packages/R index 66edc33d2..b0fde37bf 160000 --- a/packages/R +++ b/packages/R @@ -1 +1 @@ -Subproject commit 66edc33d2d03b356751a7059dc36e3328183fa40 +Subproject commit b0fde37bf3338926ed4f1fd06bbbaa78fb389569 diff --git a/packages/http b/packages/http index 4ec3a70be..dd614178a 160000 --- a/packages/http +++ b/packages/http @@ -1 +1 @@ -Subproject commit 4ec3a70be358ac793753d39022e099f722d280a4 +Subproject commit dd614178a5e334aa7f40d157d849514e99a9f48b diff --git a/packages/plunit b/packages/plunit index 52469bccc..dcdc7f129 160000 --- a/packages/plunit +++ b/packages/plunit @@ -1 +1 @@ -Subproject commit 52469bccc1cc81d06e47a3a781128689f4658542 +Subproject commit dcdc7f12929bf921ee49f85983c7cd9a9171a32e diff --git a/pl/boot.yap b/pl/boot.yap index 750fee373..3edbfe202 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -145,7 +145,9 @@ true :- true. /* main execution loop */ '$read_vars'(user_input, Goal, Mod, Pos, Bindings) :- + writeln(c:Raw), get_value('$readline',true), !, + writeln(d:Raw), read_history(h, '!h', [trace, end_of_file], ' ?- ', Goal, Bindings), diff --git a/pl/flags.yap b/pl/flags.yap index 0194c32f2..cbaf5bb50 100644 --- a/pl/flags.yap +++ b/pl/flags.yap @@ -207,12 +207,12 @@ yap_flag(home,X) :- yap_flag(readline,X) :- var(X), !, - get_value('$readline',X). + ( '$has_readline'(X) ). yap_flag(readline,X) :- ( X = true ; X = false ), !, - set_value('$readline',X). + '$has_readline'(X). yap_flag(readline,X) :- - '$do_error'(domain_error(flag_value,readline+X),yap_flag(bounded,X)). + '$do_error'(domain_error(flag_value,readline+X),yap_flag(readline,X)). % tabling mode yap_flag(tabling_mode,Options) :-