allow finer control over indexing sub-terms.
improve flag code a bit.
This commit is contained in:
parent
2def937080
commit
39f392be9c
@ -2545,12 +2545,13 @@ do_compound_index(ClauseDef *min0, ClauseDef* max0, Term* sreg, struct intermedi
|
||||
/* base case, just commit to the current code */
|
||||
return emit_single_switch_case(min0, cint, first, clleft, fail_l);
|
||||
}
|
||||
if (yap_flags[INDEXING_MODE_FLAG] == INDEX_MODE_SINGLE && ap->PredFlags & LogUpdatePredFlag) {
|
||||
if ((yap_flags[INDEXING_MODE_FLAG] == INDEX_MODE_SINGLE && ap->PredFlags & LogUpdatePredFlag) ||
|
||||
(yap_flags[INDEXING_TERM_DEPTH_FLAG] && cint->term_depth - cint->last_index_new_depth > yap_flags[INDEXING_TERM_DEPTH_FLAG])) {
|
||||
*newlabp =
|
||||
do_var_clauses(min0, max0, FALSE, cint, first, clleft, fail_l, ap->ArityOfPE+1);
|
||||
return ret_lab;
|
||||
return ret_lab;
|
||||
}
|
||||
if (sreg == NULL || cint->term_depth > 20) {
|
||||
if (sreg == NULL) {
|
||||
return suspend_indexing(min0, max0, ap, cint);
|
||||
}
|
||||
cint->term_depth++;
|
||||
|
3
C/init.c
3
C/init.c
@ -915,6 +915,7 @@ InitFlags(void)
|
||||
yap_flags[INDEXING_MODE_FLAG] = INDEX_MODE_MULTI;
|
||||
yap_flags[TABLING_MODE_FLAG] = 0;
|
||||
yap_flags[QUIET_MODE_FLAG] = FALSE;
|
||||
yap_flags[INDEXING_TERM_DEPTH_FLAG] = 0L;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1316,7 +1317,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
||||
Yap_InitTime();
|
||||
/* InitAbsmi must be done before InitCodes */
|
||||
/* This must be done before initialising predicates */
|
||||
for (i = 0; i <= LAST_FLAG; i++) {
|
||||
for (i = 0; i <= NUMBER_OF_YAP_FLAGS; i++) {
|
||||
yap_flags[i] = 0;
|
||||
}
|
||||
#ifdef MPW
|
||||
|
5
H/Yap.h
5
H/Yap.h
@ -453,8 +453,9 @@ typedef enum
|
||||
TABLING_MODE_FLAG = 20,
|
||||
VARS_CAN_HAVE_QUOTE_FLAG = 21,
|
||||
QUIET_MODE_FLAG = 22,
|
||||
INDEXING_TERM_DEPTH_FLAG = 23,
|
||||
/* let this be the last one */
|
||||
LAST_FLAG = 23
|
||||
NUMBER_OF_YAP_FLAGS = 24
|
||||
} yap_flags;
|
||||
|
||||
#define STRING_AS_CHARS 0
|
||||
@ -501,8 +502,6 @@ typedef enum
|
||||
YAP_FAIL_SIGNAL = 0x100000 /* P = FAILCODE */
|
||||
} yap_signals;
|
||||
|
||||
#define NUMBER_OF_YAP_FLAGS LAST_FLAG
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GPROF_NO_EVENT,
|
||||
|
@ -8078,8 +8078,13 @@ for which YAP was compiled and Operating System information.
|
||||
|
||||
@item index
|
||||
@findex index (yap_flag/2 option)
|
||||
@* If @code{on} allow indexing (default), if @code{off} disable it, if
|
||||
@code{single} allow on first argument only.
|
||||
|
||||
@item index_sub_term_search_depth
|
||||
@findex index (yap_flag/2 option)
|
||||
@*
|
||||
If @code{on} allow indexing (default), if @code{off} disable it.
|
||||
Maximum bound on searching sub-terms for indexing, if @code{0} (default) no bound.
|
||||
|
||||
@item informational_messages
|
||||
@findex informational_messages (yap_flag/2 option)
|
||||
|
13
pl/flags.yap
13
pl/flags.yap
@ -236,6 +236,18 @@ yap_flag(index,X) :-
|
||||
yap_flag(index,X) :-
|
||||
'$do_error'(domain_error(flag_value,index+X),yap_flag(index,X)).
|
||||
|
||||
% do or do not indexation
|
||||
yap_flag(index_sub_term_search_depth,X) :- var(X),
|
||||
'$access_yap_flags'(23, X), !.
|
||||
yap_flag(index_sub_term_search_depth,X,X) :-
|
||||
integer(X), X > 0,
|
||||
'$set_yap_flags'(23,X1).
|
||||
yap_flag(index_sub_term_search_depth,X,X) :-
|
||||
\+ integer(X),
|
||||
'$do_error'(type_error(integer,X),yap_flag(index_sub_term_search_depth,X)).
|
||||
yap_flag(index_sub_term_search_depth,X,X) :-
|
||||
'$do_error'(domain_error(out_of_range,index_sub_term_search_depth+X),yap_flag(index_sub_term_search_depth,X)).
|
||||
|
||||
yap_flag(home,X) :-
|
||||
'$yap_home'(X).
|
||||
|
||||
@ -869,6 +881,7 @@ yap_flag(dialect,yap).
|
||||
'$yap_system_flag'(home ).
|
||||
'$yap_system_flag'(host_type ).
|
||||
'$yap_system_flag'(index).
|
||||
'$yap_system_flag'(index_sub_term_search_depth).
|
||||
'$yap_system_flag'(tabling_mode).
|
||||
'$yap_system_flag'(informational_messages).
|
||||
'$yap_system_flag'(integer_rounding_function).
|
||||
|
Reference in New Issue
Block a user