From 0092e6fd45c4c6b6c4fc446d22c8b63eb168465c Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 4 Mar 2004 18:33:34 +0000 Subject: [PATCH] support yap_flag(system_options,... git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1016 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/corout.c | 24 +++++++++++++++++++++++- C/stdpreds.c | 2 -- H/Yapproto.h | 4 +--- docs/yap.tex | 8 ++++++++ pl/directives.yap | 28 ++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 6 deletions(-) diff --git a/C/corout.c b/C/corout.c index 57627c600..3a04863e9 100644 --- a/C/corout.c +++ b/C/corout.c @@ -1220,8 +1220,28 @@ Yap_WakeUp(CELL *pt0) { } #endif +static Int +p_yap_has_rational_trees(void) +{ +#if RATIONAL_TREES + return TRUE; +#else + return FALSE; +#endif +} -void Yap_InitCoroutPreds(void) +static Int +p_yap_has_coroutining(void) +{ +#if COROUTINING + return TRUE; +#else + return FALSE; +#endif +} + +void +Yap_InitCoroutPreds(void) { #ifdef COROUTINING Atom at; @@ -1237,6 +1257,8 @@ void Yap_InitCoroutPreds(void) WakeUpCode = pred; Yap_InitAttVarPreds(); #endif /* COROUTINING */ + Yap_InitCPred("$yap_has_rational_trees", 0, p_yap_has_rational_trees, SafePredFlag); + Yap_InitCPred("$yap_has_coroutining", 0, p_yap_has_coroutining, SafePredFlag); Yap_InitCPred("$read_svar_list", 2, p_read_svar_list, SafePredFlag); Yap_InitCPred("$set_svar_list", 2, p_set_svar_list, SafePredFlag); Yap_InitCPred("$freeze", 2, p_freeze, 0); diff --git a/C/stdpreds.c b/C/stdpreds.c index ff77cd757..fe7ca875f 100644 --- a/C/stdpreds.c +++ b/C/stdpreds.c @@ -2796,9 +2796,7 @@ Yap_InitCPreds(void) #if defined(YAPOR) || defined(TABLING) Yap_init_optyap_preds(); #endif /* YAPOR || TABLING */ -#ifdef THREADS Yap_InitThreadPreds(); -#endif /* ANALYST */ { void (*(*(p))) (void) = E_Modules; while (*p) diff --git a/H/Yapproto.h b/H/Yapproto.h index 3f191ca4e..b07f919c0 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -10,7 +10,7 @@ * File: Yap.proto * * mods: * * comments: Function declarations for YAP * -* version: $Id: Yapproto.h,v 1.49 2004-03-02 16:44:58 vsc Exp $ * +* version: $Id: Yapproto.h,v 1.50 2004-03-04 18:33:33 vsc Exp $ * *************************************************************************/ /* prototype file for Yap */ @@ -284,9 +284,7 @@ int STD_PROTO(Yap_ProcessSIGINT,(void)); double STD_PROTO(Yap_random, (void)); /* threads.c */ -#ifdef THREADS void STD_PROTO(Yap_InitThreadPreds,(void)); -#endif /* ANALYST */ /* tracer.c */ #ifdef LOW_LEVEL_TRACER diff --git a/docs/yap.tex b/docs/yap.tex index 5821342ee..b6f3dcc52 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -6460,6 +6460,14 @@ Report the syntax error and generate an error. Just fail @end table +@item system_options +@findex system_options (yap_flag/2 option) +@* This read only flag tells which options were used to compile +Yap. Currently it informs whether the system supports +@code{coroutining}, @code{depth_limit}, the @code{low_level_tracer}, +@code{or-parallelism}, @code{rational_trees}, @code{tabling}, +@code{threads}, or the @code{wam_profiler}. + @item to_chars_mode @findex to_chars_modes (yap_flag/2 option) @* Define whether YAP should follow @code{quintus}-like diff --git a/pl/directives.yap b/pl/directives.yap index 0d2566295..0d3200284 100644 --- a/pl/directives.yap +++ b/pl/directives.yap @@ -404,6 +404,33 @@ yap_flag(single_var_warnings,X) :- yap_flag(single_var_warnings,X) :- '$do_error'(domain_error(flag_value,single_var_warnings+X),yap_flag(single_var_warnings,X)). +yap_flag(single_var_warnings,X) :- + var(X), !, + ('$syntax_check_mode'(on,_), '$syntax_check_single_var'(on,_) -> + X = on + ; + X = off + ). +yap_flag(system_options,X) :- + '$system_options'(X). + +'$system_options'(coroutining) :- + '$yap_has_coroutining'. +'$system_options'(depth_limit) :- + \+ '$undefined'(get_depth_limit(_), prolog). +'$system_options'(low_level_tracer) :- + \+ '$undefined'(start_low_level_trace, prolog). +'$system_options'(or_parallelism) :- + \+ '$undefined'('$yapor_on', prolog). +'$system_options'(rational_trees) :- + '$yap_has_rational_trees'. +'$system_options'(tabling) :- + \+ '$undefined'('$do_table'(_,_), prolog). +'$system_options'(threads) :- + \+ '$no_threads'. +'$system_options'(wam_profiler) :- + \+ '$undefined'(reset_op_counters, prolog). + yap_flag(unknown,X) :- var(X), !, unknown(X,_). @@ -565,6 +592,7 @@ yap_flag(host_type,X) :- V = strict_iso ; V = stack_dump_on_error ; V = syntax_errors ; + V = system_options ; V = to_chars_mode ; V = toplevel_hook ; V = toplevel_print_options ;