use SWI flags.

This commit is contained in:
Vitor Santos Costa 2011-03-26 15:18:56 +00:00
parent 0bd0936683
commit 48cd3bd675
10 changed files with 18 additions and 28 deletions

View File

@ -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 int
Yap_GetCharForSIGINT(void) Yap_GetCharForSIGINT(void)
{ {
@ -1163,6 +1152,5 @@ Yap_InitIOPreds(void)
// Yap_InitCPred ("stream_select", 3, p_stream_select, SafePredFlag|SyncPredFlag); // Yap_InitCPred ("stream_select", 3, p_stream_select, SafePredFlag|SyncPredFlag);
#endif #endif
Yap_InitCPred ("$float_format", 1, p_float_format, SafePredFlag|SyncPredFlag|HiddenPredFlag); Yap_InitCPred ("$float_format", 1, p_float_format, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$has_readline", 0, p_has_readline, SafePredFlag|HiddenPredFlag);
} }

View File

@ -1557,8 +1557,6 @@ InteractSIGINT(int ch) {
switch (ch) { switch (ch) {
case 'a': case 'a':
/* abort computation */ /* abort computation */
if (Yap_PrologMode &= InReadlineMode) {
}
if (Yap_PrologMode & (GCMode|ConsoleGetcMode|GrowStackMode|GrowHeapMode)) { if (Yap_PrologMode & (GCMode|ConsoleGetcMode|GrowStackMode|GrowHeapMode)) {
Yap_PrologMode |= AbortMode; Yap_PrologMode |= AbortMode;
} else { } else {
@ -1566,6 +1564,7 @@ InteractSIGINT(int ch) {
/* in case someone mangles the P register */ /* in case someone mangles the P register */
} }
Yap_PrologMode &= ~AsyncIntMode; Yap_PrologMode &= ~AsyncIntMode;
siglongjmp(Yap_RestartEnv,1);
return -1; return -1;
case 'b': case 'b':
/* continue */ /* continue */

View File

@ -4714,6 +4714,7 @@ static const PL_extension foreigns[] = {
META|NDET), META|NDET),
FRG("$raw_read", 1, pl_raw_read, 0), FRG("$raw_read", 1, pl_raw_read, 0),
FRG("$raw_read", 2, pl_raw_read2, 0), FRG("$raw_read", 2, pl_raw_read2, 0),
FRG("$has_readline", 1, pl_has_readline, 0),
/* DO NOT ADD ENTRIES BELOW THIS ONE */ /* DO NOT ADD ENTRIES BELOW THIS ONE */
LFRG((char *)NULL, 0, NULL, 0) LFRG((char *)NULL, 0, NULL, 0)
}; };

View File

@ -514,12 +514,6 @@ Sread_readline(void *handle, char *buf, size_t size)
PL_clock_wait_ticks(clock() - oldclock); PL_clock_wait_ticks(clock() - oldclock);
#endif #endif
#if __YAP_PROLOG__
/* handle abort */
if (Yap_REGS.P_ == FAILCODE) {
return 0;
}
#endif
return rval; return rval;
} }

View File

@ -1023,14 +1023,20 @@ Yap_fetch_module_for_format(term_t args, YAP_Term *modp) {
return YAP_InitSlot(nt); return YAP_InitSlot(nt);
} }
word
pl_readline(term_t flag)
{
}
#if THREADS
#define COUNT_MUTEX_INITIALIZER(name) \ #define COUNT_MUTEX_INITIALIZER(name) \
{ PTHREAD_MUTEX_INITIALIZER, \ { PTHREAD_MUTEX_INITIALIZER, \
name, \ name, \
0L \ 0L \
} }
#if THREADS
static int static int
recursive_attr(pthread_mutexattr_t **ap) recursive_attr(pthread_mutexattr_t **ap)
{ static int done; { static int done;

@ -1 +1 @@
Subproject commit 66edc33d2d03b356751a7059dc36e3328183fa40 Subproject commit b0fde37bf3338926ed4f1fd06bbbaa78fb389569

@ -1 +1 @@
Subproject commit 4ec3a70be358ac793753d39022e099f722d280a4 Subproject commit dd614178a5e334aa7f40d157d849514e99a9f48b

@ -1 +1 @@
Subproject commit 52469bccc1cc81d06e47a3a781128689f4658542 Subproject commit dcdc7f12929bf921ee49f85983c7cd9a9171a32e

View File

@ -145,7 +145,9 @@ true :- true.
/* main execution loop */ /* main execution loop */
'$read_vars'(user_input, Goal, Mod, Pos, Bindings) :- '$read_vars'(user_input, Goal, Mod, Pos, Bindings) :-
writeln(c:Raw),
get_value('$readline',true), !, get_value('$readline',true), !,
writeln(d:Raw),
read_history(h, '!h', read_history(h, '!h',
[trace, end_of_file], [trace, end_of_file],
' ?- ', Goal, Bindings), ' ?- ', Goal, Bindings),

View File

@ -207,12 +207,12 @@ yap_flag(home,X) :-
yap_flag(readline,X) :- yap_flag(readline,X) :-
var(X), !, var(X), !,
get_value('$readline',X). ( '$has_readline'(X) ).
yap_flag(readline,X) :- yap_flag(readline,X) :-
( X = true ; X = false ), !, ( X = true ; X = false ), !,
set_value('$readline',X). '$has_readline'(X).
yap_flag(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 % tabling mode
yap_flag(tabling_mode,Options) :- yap_flag(tabling_mode,Options) :-