Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Tiago Gomes 2012-05-23 17:59:26 +01:00
commit cf929b6f13
96 changed files with 24514 additions and 4805 deletions

View File

@ -2937,7 +2937,13 @@ YAP_Init(YAP_init_args *yap_init)
int restore_result;
int do_bootstrap = (yap_init->YapPrologBootFile != NULL);
CELL Trail = 0, Stack = 0, Heap = 0, Atts = 0;
static char boot_file[256];
char boot_file[256];
static int initialised = FALSE;
/* ignore repeated calls to YAP_Init */
if (initialised)
return YAP_BOOT_DONE_BEFOREHAND;
initialised = TRUE;
Yap_InitPageSize(); /* init memory page size, required by later functions */
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
@ -3756,9 +3762,9 @@ YAP_AttsOfVar(Term t)
t = Deref(t);
if (!IsVarTerm(t))
return TermNil;
if (IsAttVar(VarOfTerm(t)))
if(!IsAttVar(VarOfTerm(t)))
return TermNil;
attv = (attvar_record *)VarOfTerm(t);
attv = RepAttVar(VarOfTerm(t));
return attv->Atts;
}

View File

@ -2654,6 +2654,7 @@ p_purge_clauses( USES_REGS1 )
PredEntry *pred;
Term t = Deref(ARG1);
Term mod = Deref(ARG2);
MegaClause *before = DeadMegaClauses;
Yap_PutValue(AtomAbol, MkAtomTerm(AtomNil));
if (IsVarTerm(t))
@ -2677,7 +2678,15 @@ p_purge_clauses( USES_REGS1 )
}
purge_clauses(pred);
UNLOCKPE(34,pred);
return (TRUE);
/* try to use the garbage collector to recover the mega clause,
in case the objs pointing to it are dead themselves */
if (DeadMegaClauses != before) {
if (!Yap_gc(2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
return TRUE;
}
/******************************************************************

View File

@ -1431,9 +1431,11 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
case SYNTAX_ERROR:
{
int i;
Term ti[1];
i = strlen(tmpbuf);
nt[0] = where;
ti[0] = MkAtomTerm(AtomSyntaxError);
nt[0] = Yap_MkApplTerm(FunctorShortSyntaxError, 1, ti);
psize -= i;
fun = FunctorError;
serious = TRUE;
@ -1807,6 +1809,9 @@ E);
LOCAL_Error_Size = 0L;
}
nt[1] = MkPairTerm(MkAtomTerm(Yap_LookupAtom(tmpbuf)), stack_dump);
if (type == SYNTAX_ERROR) {
nt[1] = MkPairTerm(where, nt[1]);
}
}
}
if (serious) {

View File

@ -1066,6 +1066,7 @@ do_goal(Term t, yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
S = CellPtr (RepPredProp (PredPropByFunc (Yap_MkFunctor(AtomCall, 1),0))); /* A1 mishaps */
out = exec_absmi(top PASS_REGS);
Yap_flush();
// if (out) {
// out = Yap_GetFromSlot(sl);
// }
@ -1675,6 +1676,11 @@ Yap_InitYaamRegs(void)
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
Yap_REGS.MYDDAS_GLOBAL_POINTER = NULL;
#endif
#ifdef TABLING
/* ensure that LOCAL_top_dep_fr is always valid */
if (LOCAL_top_dep_fr)
DepFr_cons_cp(LOCAL_top_dep_fr) = NORM_CP(B);
#endif
}
static Int

View File

@ -879,7 +879,7 @@ static Int
p_nb_setarg( USES_REGS1 )
{
Term wheret = Deref(ARG1);
Term dest = Deref(ARG2);
Term dest;
Term to;
UInt arity, pos;
CELL *destp;
@ -893,32 +893,30 @@ p_nb_setarg( USES_REGS1 )
return FALSE;
}
pos = IntegerOfTerm(wheret);
dest = Deref(ARG2);
if (IsVarTerm(dest)) {
Yap_Error(INSTANTIATION_ERROR,dest,"nb_setarg");
return FALSE;
} else if (IsPrimitiveTerm(dest)) {
arity = 0;
destp = NULL;
} else if (IsPairTerm(dest)) {
arity = 2;
destp = RepPair(dest)-1;
} else {
arity = ArityOfFunctor(FunctorOfTerm(dest));
destp = RepAppl(dest);
}
if (pos < 1 || pos > arity)
return FALSE;
to = Deref(ARG3);
to = CopyTermToArena(ARG3, LOCAL_GlobalArena, FALSE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
to = CopyTermToArena(ARG3, LOCAL_GlobalArena, FALSE, TRUE, 3, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
if (to == 0L)
return FALSE;
dest = Deref(ARG2);
if (IsPairTerm(dest)) {
arity = 2;
destp = RepPair(dest)-1;
} else {
arity = ArityOfFunctor(FunctorOfTerm(dest));
destp = RepAppl(dest);
}
destp[pos] = to;
return TRUE;
@ -947,19 +945,21 @@ p_nb_set_shared_arg( USES_REGS1 )
return FALSE;
} else if (IsPrimitiveTerm(dest)) {
arity = 0;
destp = NULL;
} else if (IsPairTerm(dest)) {
arity = 2;
destp = RepPair(dest)-1;
} else {
arity = ArityOfFunctor(FunctorOfTerm(dest));
destp = RepAppl(dest);
}
if (pos < 1 || pos > arity)
return FALSE;
to = CopyTermToArena(ARG3, LOCAL_GlobalArena, TRUE, TRUE, 3, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
if (to == 0L)
return FALSE;
if (IsPairTerm(dest)) {
destp = RepPair(dest)-1;
} else {
destp = RepAppl(dest);
}
destp[pos] = to;
return TRUE;
}

View File

@ -718,6 +718,11 @@ AdjustScannerStacks(TokEntry **tksp, VarEntry **vep USES_REGS)
TokEntry *tktmp;
switch (tks->Tok) {
case Number_tok:
if (IsApplTerm(tks->TokInfo)) {
tks->TokInfo = AdjustAppl(tks->TokInfo PASS_REGS);
}
break;
case Var_tok:
case String_tok:
if (IsOldTrail(tks->TokInfo))

View File

@ -4130,9 +4130,11 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS)
if (ASP - H < gc_margin/sizeof(CELL) ||
effectiveness < 20) {
LeaveGCMode( PASS_REGS1 );
#ifndef YAPOR
if (gc_margin < 2*CalculateStackGap())
gc_margin = 2*CalculateStackGap();
return Yap_growstack(gc_margin);
#endif
}
/*
* debug for(save_total=1; save_total<=N; ++save_total)

View File

@ -654,7 +654,7 @@ Yap_InitAsmPred(char *Name, unsigned long int Arity, int code, CPredicate def,
p_code->opc = Yap_opcode(_allocate);
p_code = NEXTOP(p_code,e);
}
p_code->opc = pe->OpcodeOfPred = Yap_opcode(_call_cpred);
p_code->opc = Yap_opcode(_call_cpred);
p_code->u.Osbpp.bmap = NULL;
p_code->u.Osbpp.s = -Signed(RealEnvSize);
p_code->u.Osbpp.p = p_code->u.Osbpp.p0 = pe;
@ -669,6 +669,7 @@ Yap_InitAsmPred(char *Name, unsigned long int Arity, int code, CPredicate def,
p_code = NEXTOP(p_code,p);
p_code->opc = Yap_opcode(_Ystop);
p_code->u.l.l = cl->ClCode;
pe->OpcodeOfPred = pe->CodeOfPred->opc;
} else {
pe->OpcodeOfPred = Yap_opcode(_undef_p);
pe->CodeOfPred = (yamop *)(&(pe->OpcodeOfPred));

View File

@ -383,8 +383,9 @@ GenerateSyntaxError(Term *tp, TokEntry *tokstart, IOSTREAM *sno USES_REGS)
if (tp) {
Term et[2];
Term t = MkVarTerm();
et[0] = syntax_error(tokstart, sno, &t);
et[1] = MkAtomTerm(Yap_LookupAtom("Syntax error"));
et[1] = MkPairTerm(syntax_error(tokstart, sno, &t), TermNil);
t = MkAtomTerm(AtomSyntaxError);
et[0] = Yap_MkApplTerm(FunctorShortSyntaxError,1,&t);
*tp = Yap_MkApplTerm(FunctorError, 2, et);
}
}

7
C/load_dl.c Normal file → Executable file
View File

@ -34,14 +34,17 @@ Yap_CallFunctionByName(const char *thing_string);
int
Yap_CallFunctionByName(const char *thing_string)
{
void * handle = dlopen(NULL, RTLD_LAZY | RTLD_NOLOAD);
void * handle = dlopen(NULL, RTLD_LAZY
#ifndef __CYGWIN__
| RTLD_NOLOAD
#endif
);
// you could do RTLD_NOW as well. shouldn't matter
if (!handle) {
CACHE_REGS
Yap_Error(SYSTEM_ERROR, ARG1, "Dynamic linking on main module : %s\n", dlerror());
}
prismf * addr = (prismf *)dlsym(handle, thing_string);
fprintf(stderr, "%s is at %p\n", thing_string, addr);
if (addr)
(*addr)();
return TRUE;

2
C/pl-yap.c Normal file → Executable file
View File

@ -887,7 +887,7 @@ warning(const char *fm, ...)
return TRUE;
}
#if defined(HAVE_SELECT) && !defined(__WINDOWS__)
#if defined(HAVE_SELECT) && !defined(__WINDOWS__) && !defined(__CYGWIN__)
#ifdef __WINDOWS__
#include <winsock2.h>

View File

@ -993,6 +993,15 @@ p_read_module_preds( USES_REGS1 )
return TRUE;
}
static void
ReInitCatch(void)
{
Term t = Yap_MkNewApplTerm(PredHandleThrow->FunctorOfPred, PredHandleThrow->ArityOfPE);
YAP_RunGoalOnce(t);
}
static Int
p_read_program( USES_REGS1 )
{
@ -1016,7 +1025,7 @@ p_read_program( USES_REGS1 )
Sclose( stream );
/* back to the top level we go */
Yap_CloseSlots(PASS_REGS1);
ReInitCatch();
Yap_RestartYap( 3 );
return TRUE;
}
@ -1030,6 +1039,7 @@ Yap_Restore(char *s, char *lib_dir)
return -1;
read_module(stream);
Sclose( stream );
ReInitCatch();
return DO_ONLY_CODE;
}

View File

@ -1530,7 +1530,6 @@ p_atom_concat( USES_REGS1 )
{
Term t1;
int wide_mode = FALSE;
UInt sz;
restart:
t1 = Deref(ARG1);
@ -1543,8 +1542,9 @@ p_atom_concat( USES_REGS1 )
if (wide_mode) {
wchar_t *cptr = (wchar_t *)(((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE), *cpt0;
wchar_t *top = (wchar_t *)AuxSp;
char *atom_str;
unsigned char *atom_str;
Atom ahead;
UInt sz;
cpt0 = cptr;
while (IsPairTerm(t1)) {
@ -1560,26 +1560,29 @@ p_atom_concat( USES_REGS1 )
return(FALSE);
}
ahead = AtomOfTerm(thead);
atom_str = RepAtom(ahead)->StrOfAE;
if (IsWideAtom(ahead)) {
/* check for overflows */
sz = wcslen((wchar_t *)atom_str);
sz = wcslen(RepAtom(ahead)->WStrOfAE);
} else {
sz = strlen(atom_str);
atom_str = (unsigned char *)RepAtom(ahead)->StrOfAE;
sz = strlen((char *)atom_str);
}
if (cptr+sz >= top-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
if (cptr+sz > top+1024) {
cptr = (wchar_t *)Yap_ExpandPreAllocCodeSpace(sz+1024,NULL, TRUE);
if (cptr+sz > (wchar_t *)AuxSp+1024) {
/* crash in flames */
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "allocating temp space in atom_concat/2");
return FALSE;
}
top = (wchar_t *)AuxSp;
goto restart;
}
if (IsWideAtom(ahead)) {
memcpy((void *)cptr, (void *)atom_str, sz*sizeof(wchar_t));
memcpy((void *)cptr, RepAtom(ahead)->WStrOfAE, sz*sizeof(wchar_t));
cptr += sz;
} else {
int i;
UInt i;
for (i=0; i < sz; i++) {
*cptr++ = *atom_str++;
}
@ -1607,7 +1610,8 @@ p_atom_concat( USES_REGS1 )
} else {
char *cptr = ((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE, *cpt0;
char *top = (char *)AuxSp;
char *atom_str;
unsigned char *atom_str;
UInt sz;
cpt0 = cptr;
while (IsPairTerm(t1)) {
@ -1627,9 +1631,9 @@ p_atom_concat( USES_REGS1 )
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
goto restart;
}
atom_str = RepAtom(AtomOfTerm(thead))->StrOfAE;
atom_str = (unsigned char *)RepAtom(AtomOfTerm(thead))->StrOfAE;
/* check for overflows */
sz = strlen(atom_str);
sz = strlen((char *)atom_str);
if (cptr+sz >= top-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) {
@ -1725,9 +1729,9 @@ p_atomic_concat( USES_REGS1 )
memcpy((void *)wcptr, (void *)watom_str, sz*sizeof(wchar_t));
wcptr += sz;
} else {
char *atom_str = RepAtom(AtomOfTerm(thead))->StrOfAE;
unsigned char *atom_str = (unsigned char *)RepAtom(AtomOfTerm(thead))->StrOfAE;
/* check for overflows */
UInt sz = strlen(atom_str);
UInt sz = strlen((char *)atom_str);
if (wcptr+sz >= wtop-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) {
@ -1823,7 +1827,7 @@ p_atomic_concat( USES_REGS1 )
return(FALSE);
}
if (IsAtomTerm(thead)) {
char *atom_str;
unsigned char *atom_str;
UInt sz;
if (IsWideAtom(AtomOfTerm(thead))) {
@ -1831,9 +1835,9 @@ p_atomic_concat( USES_REGS1 )
wide_mode = TRUE;
goto restart;
}
atom_str = RepAtom(AtomOfTerm(thead))->StrOfAE;
atom_str = (unsigned char *)RepAtom(AtomOfTerm(thead))->StrOfAE;
/* check for overflows */
sz = strlen(atom_str);
sz = strlen((char *)atom_str);
if (cptr+sz >= top-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) {

3
C/sysbits.c Normal file → Executable file
View File

@ -81,7 +81,8 @@ static char SccsId[] = "%W% %G%";
#include <sys/param.h>
#endif
#endif
#if HAVE_FENV_H
/* CYGWIN seems to include this automatically */
#if HAVE_FENV_H && !defined(__CYGWIN__)
#include <fenv.h>
#endif
#if HAVE_READLINE_READLINE_H

View File

@ -187,10 +187,30 @@ thread_die(int wid, int always_die)
tab_ent = TabEnt_next(tab_ent);
}
FREE_DEPENDENCY_FRAME(LOCAL_top_dep_fr);
#endif /* TABLING */
LOCAL_top_dep_fr = NULL;
#ifdef USE_PAGES_MALLOC
DETACH_PAGES(_pages_void);
DETACH_PAGES(_pages_tab_ent);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
DETACH_PAGES(_pages_sg_ent);
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
DETACH_PAGES(_pages_sg_fr);
DETACH_PAGES(_pages_dep_fr);
DETACH_PAGES(_pages_sg_node);
DETACH_PAGES(_pages_sg_hash);
DETACH_PAGES(_pages_ans_node);
DETACH_PAGES(_pages_ans_hash);
#if defined(THREADS_FULL_SHARING)
DETACH_PAGES(_pages_ans_ref_node);
#endif /* THREADS_FULL_SHARING */
DETACH_PAGES(_pages_gt_node);
DETACH_PAGES(_pages_gt_hash);
#endif /* USE_PAGES_MALLOC */
#ifdef OUTPUT_THREADS_TABLING
fclose(LOCAL_thread_output);
#endif /* OUTPUT_THREADS_TABLING */
#endif /* TABLING */
GLOBAL_NOfThreads--;
if (!always_die) {
/* called by thread itself */
GLOBAL_ThreadsTotalTime += Yap_cputime();
@ -222,6 +242,7 @@ setup_engine(int myworker_id, int init_thread)
Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace());
/* I exist */
GLOBAL_NOfThreadsCreated++;
GLOBAL_NOfThreads++;
DEBUG_TLOCK_ACCESS(2, myworker_id);
pthread_mutex_unlock(&(REMOTE_ThreadHandle(myworker_id).tlock));
#ifdef TABLING

View File

@ -18,11 +18,9 @@
static char SccsId[] = "@(#)utilpreds.c 1.3";
#endif
#include "Yap.h"
#include "clause.h"
#include "absmi.h"
#include "YapHeap.h"
#include "yapio.h"
#include "eval.h"
#include "attvar.h"
#ifdef HAVE_STRING_H
#include "string.h"
@ -1168,8 +1166,16 @@ CELL *CellDifH(CELL *hptr, CELL *hlow)
return (CELL *)((char *)hptr-(char *)hlow);
}
#define AdjustSizeAtom(X) ((char *)(((CELL)(X)+(8-1)) & ~(8-1)))
#define AdjustSizeAtom(X) (((CELL)(X)+(8-1)) & ~(8-1))
static inline
CELL *AdjustSize(CELL *x, char *buf)
{
UInt offset = (char *)x-buf;
return (CELL*)(buf+AdjustSizeAtom(offset));
}
/* export an atom from the symbol table to a buffer */
static inline
Atom export_atom(Atom at, char **hpp, char *buf, size_t len)
{
@ -1177,7 +1183,7 @@ Atom export_atom(Atom at, char **hpp, char *buf, size_t len)
size_t sz;
ptr = *hpp;
ptr = AdjustSizeAtom(ptr);
ptr = (char *)AdjustSize((CELL*)ptr, buf);
p0 = ptr;
if (IsWideAtom(at)) {
@ -1191,7 +1197,7 @@ Atom export_atom(Atom at, char **hpp, char *buf, size_t len)
} else {
*ptr++ = 0;
sz = strlen(RepAtom(at)->StrOfAE);
if (sz +1 >= len)
if (sz + 1 + sizeof(wchar_t) >= len)
return (Atom)NULL;
strcpy(ptr, RepAtom(at)->StrOfAE);
*hpp = ptr+(sz+1);
@ -1200,10 +1206,11 @@ Atom export_atom(Atom at, char **hpp, char *buf, size_t len)
return (Atom)(p0-buf);
}
/* place a buffer: first arity then the atom */
static inline
Functor export_functor(Functor f, char **hpp, char *buf, size_t len)
{
CELL *hptr = (UInt *)AdjustSizeAtom(*hpp);
CELL *hptr = AdjustSize((CELL *)*hpp, buf);
UInt arity = ArityOfFunctor(f);
if (2*sizeof(CELL) >= len)
return NULL;
@ -1211,7 +1218,9 @@ Functor export_functor(Functor f, char **hpp, char *buf, size_t len)
*hpp = (char *)(hptr+1);
if (!export_atom(NameOfFunctor(f), hpp, buf, len))
return NULL;
/* increment so that it cannot be mistaken with a standard functor */
/* increment so that it cannot be mistaken with a functor on the stack,
(increment is used as a tag ........01
*/
return (Functor)(((char *)hptr-buf)+1);
}
@ -1230,9 +1239,10 @@ export_term_to_buffer(Term inpt, char *buf, char *bptr, CELL *t0 , CELL *tf, siz
{
char *td = bptr;
CELL *bf = (CELL *)buf;
if (buf + len < (char *)((CELL *)td + (tf-t0)))
if (buf + len < (char *)((CELL *)td + (tf-t0))) {
return FALSE;
memcpy((void *)td, (void *)t0, (tf-t0)* sizeof(CELL));
}
memcpy((void *)td, (void *)t0, (tf-t0)* sizeof(CELL));
bf[0] = (td-buf);
bf[1] = (tf-t0);
bf[2] = inpt;
@ -1543,6 +1553,7 @@ static Atom
AddAtom(Atom t, char *buf)
{
char *s = buf+(UInt)t;
if (!*s) {
return Yap_LookupAtom(s+1);
} else {
@ -1559,7 +1570,7 @@ FetchFunctor(CELL *pt, char *buf)
UInt arity = *ptr++;
Atom name, at;
// and then an atom
ptr = (CELL *)AdjustSizeAtom((char*)ptr);
ptr = AdjustSize(ptr, buf);
name = (Atom)((char *)ptr-buf);
at = AddAtom(name, buf);
*pt = (CELL)Yap_MkFunctor(at, arity);
@ -1629,7 +1640,7 @@ Yap_ImportTerm(char * buf) {
return MkVarTerm();
if (IsAtomOrIntTerm(tinp)) {
if (IsAtomTerm(tinp)) {
char *pt = AdjustSizeAtom((char *)(bc+3));
char *pt = (char *)AdjustSize(bc+3, buf);
return MkAtomTerm(Yap_LookupAtom(pt));
} else
return tinp;
@ -4191,6 +4202,298 @@ p_subsumes( USES_REGS1 ) /* subsumes terms t1 and t2 */
}
}
static int term_subsumer_complex(register CELL *pt0, register CELL *pt0_end, register
CELL *pt1, CELL *npt USES_REGS)
{
register CELL **to_visit = (CELL **)ASP;
tr_fr_ptr OLDTR = TR;
int out;
CELL *bindings = NULL, *tbindings = NULL;
HB = H;
loop:
while (pt0 < pt0_end) {
register CELL d0, d1;
++ pt0;
++ pt1;
d0 = Derefa(pt0);
d1 = Derefa(pt1);
if (d0 == d1) {
*npt++ = d0;
continue;
} else if (IsVarTerm(d0)) {
CELL *match, *omatch = NULL;
match = VarOfTerm(d0);
if (match >= HB) {
while (match >= HB) {
/* chained to a sequence */
if (Yap_eq(d1, match[1]) ) {
*npt++ = match[2];
break;
}
omatch = match;
match = (CELL *)match[3];
}
/* found a match */
if (match >= HB)
continue;
/* could not find a match, add to end of chain */
RESET_VARIABLE(H); /* key */
H[1] = d1; /* comparison value */
H[2] = (CELL)npt; /* new value */
H[3] = (CELL)match; /* end of chain points back to first cell */
omatch[3] = (CELL)H;
H+=4;
RESET_VARIABLE(npt);
npt++;
continue;
}
if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) {
goto trail_overflow;
}
RESET_VARIABLE(H);
H[1] = d1;
H[2] = (CELL)npt;
H[3] = d0;
Bind(VarOfTerm(d0), (CELL)H);
H+=4;
RESET_VARIABLE(npt);
npt++;
continue;
} else if (IsPairTerm(d0) && IsPairTerm(d1)) {
CELL *match = bindings;
while (match) {
if (match[0] == d0 && match[1] == d1) {
*npt++ = match[2];
break;
}
match = (CELL *)match[3];
}
if (match) {
continue;
}
if (bindings) {
*tbindings = (CELL)H;
} else {
bindings = H;
}
H[0] = d0;
H[1] = d1;
H[2] = AbsPair(H+4);
H[3] = (CELL)NULL;
tbindings = H+3;
H+=4;
*npt++ = AbsPair(H);
#ifdef RATIONAL_TREES
/* now link the two structures so that no one else will */
/* come here */
to_visit -= 5;
to_visit[0] = pt0;
to_visit[1] = pt0_end;
to_visit[2] = pt1;
to_visit[3] = tbindings;
to_visit[4] = npt;
#else
/* store the terms to visit */
if (pt0 < pt0_end) {
to_visit -= 4;
to_visit[0] = pt0;
to_visit[1] = pt0_end;
to_visit[2] = pt1;
to_visit[3] = npt;
}
#endif
pt0 = RepPair(d0) - 1;
pt0_end = RepPair(d0) + 1;
pt1 = RepPair(d1) - 1;
npt = H;
H += 2;
if (H > (CELL *)to_visit -1024)
goto stack_overflow;
continue;
} else if (IsApplTerm(d0) && IsApplTerm(d1)) {
CELL *ap2 = RepAppl(d0);
CELL *ap3 = RepAppl(d1);
Functor f = (Functor)(*ap2);
Functor f2 = (Functor)(*ap3);
if (f == f2) {
CELL *match = bindings;
if (IsExtensionFunctor(f)) {
if (unify_extension(f, d0, ap2, d1)) {
*npt++ = d0;
continue;
}
}
while (match) {
if (match[0] == d0 && match[1] == d1) {
*npt++ = match[2];
break;
}
match = (CELL *)match[3];
}
if (match) {
continue;
}
if (bindings) {
*tbindings = (CELL)H;
} else {
bindings = H;
}
H[0] = d0;
H[1] = d1;
H[2] = AbsAppl(H+4);
H[3] = (CELL)NULL;
tbindings = H+3;
H+=4;
*npt++ = AbsAppl(H);
#ifdef RATIONAL_TREES
/* now link the two structures so that no one else will */
/* come here */
to_visit -= 5;
to_visit[0] = pt0;
to_visit[1] = pt0_end;
to_visit[2] = pt1;
to_visit[3] = tbindings;
to_visit[4] = npt;
#else
/* store the terms to visit */
if (pt0 < pt0_end) {
to_visit -= 4;
to_visit[0] = pt0;
to_visit[1] = pt0_end;
to_visit[2] = pt1;
to_visit[3] = npt;
}
#endif
d0 = ArityOfFunctor(f);
pt0 = ap2;
pt0_end = ap2 + d0;
pt1 = ap3;
npt = H;
*npt++ = (CELL)f;
H += d0;
if (H > (CELL *)to_visit -1024)
goto stack_overflow;
continue;
}
}
RESET_VARIABLE(npt);
npt++;
}
/* Do we still have compound terms to visit */
if (to_visit < (CELL **)ASP) {
#ifdef RATIONAL_TREES
pt0 = to_visit[0];
pt0_end = to_visit[1];
pt1 = to_visit[2];
tbindings = to_visit[3];
npt = to_visit[ 4];
if (!tbindings) {
bindings = NULL;
}
to_visit += 5;
#else
pt0 = to_visit[0];
pt0_end = to_visit[1];
pt1 = to_visit[2];
npt = to_visit[3];
to_visit += 4;
#endif
goto loop;
}
out = 1;
complete:
/* get rid of intermediate variables */
while (TR != OLDTR) {
CELL *pt1 = (CELL *) TrailTerm(--TR);
RESET_VARIABLE(pt1);
}
HBREG = B->cp_h;
return out;
stack_overflow:
out = -1;
goto complete;
trail_overflow:
out = -2;
goto complete;
}
static Int
p_term_subsumer( USES_REGS1 ) /* term_subsumer terms t1 and t2 */
{
int out = 0;
while (out != 1) {
Term t1 = Deref(ARG1);
Term t2 = Deref(ARG2);
CELL *oldH = H;
if (t1 == t2)
return Yap_unify(ARG3,t1);
if (IsPairTerm(t1) && IsPairTerm(t2)) {
Term tf = AbsAppl(H);
H += 2;
HB = H;
if ((out = term_subsumer_complex(RepPair(t1)-1,
RepPair(t1)+1,
RepPair(t2)-1, H-2 PASS_REGS)) > 0) {
HB = B->cp_h;
return Yap_unify(ARG3,tf);
}
} else if (IsApplTerm(t1) && IsApplTerm(t2)) {
Functor f1;
if ((f1 = FunctorOfTerm(t1)) == FunctorOfTerm(t2)) {
if (IsExtensionFunctor(f1)) {
if (unify_extension(f1, t1, RepAppl(t1), t2)) {
return Yap_unify(ARG3,t1);
}
} else {
Term tf = AbsAppl(H);
UInt ar = ArityOfFunctor(f1);
H[0] = (CELL)f1;
H += 1+ar;
HB = H;
if ((out = term_subsumer_complex(RepAppl(t1),
RepAppl(t1)+ArityOfFunctor(f1),
RepAppl(t2), H-ar PASS_REGS)) > 0) {
HB = B->cp_h;
return Yap_unify(ARG3,tf);
}
}
}
}
HB = B->cp_h;
if (out == 0) {
return Yap_unify(ARG3, MkVarTerm());
} else {
H = oldH;
if (out == -1) {
if (!Yap_gcl((ASP-H)*sizeof(CELL), 0, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_subsumer");
return FALSE;
}
} else {
/* Trail overflow */
if (!Yap_growtrail(0, FALSE)) {
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "in term_subsumer");
return FALSE;
}
}
}
}
return FALSE;
}
#ifdef DEBUG
static Int
p_force_trail_expansion( USES_REGS1 )
@ -4370,6 +4673,10 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
goto trail_overflow;
}
}
#if defined(TABLING) || defined(YAPOR_SBA)
TrailVal(TR) = (CELL)ptd0;
#endif
TrailTerm(TR++) = (CELL)ptd0;
}
/* Do we still have compound terms to visit */
@ -4387,6 +4694,7 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
goto loop;
}
prune(B);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
return numbv;
@ -4872,6 +5180,7 @@ void Yap_InitUtilCPreds(void)
Yap_InitCPred("instantiated_term_hash", 4, p_instantiated_term_hash, 0);
Yap_InitCPred("variant", 2, p_variant, 0);
Yap_InitCPred("subsumes", 2, p_subsumes, 0);
Yap_InitCPred("term_subsumer", 3, p_term_subsumer, 0);
Yap_InitCPred("variables_within_term", 3, p_variables_within_term, 0);
Yap_InitCPred("new_variables_in_term", 3, p_new_variables_in_term, 0);
Yap_InitCPred("export_term", 3, p_export_term, 0);

View File

@ -713,7 +713,7 @@ write_var(CELL *t, struct write_globs *wglb, struct rewind_term *rwt)
writeTerm(from_pointer(l, &nrwt, wglb), 999, 1, FALSE, wglb, &nrwt);
l = restore_from_write(&nrwt, wglb);
wrputc(',', wglb->stream);
l += 2;
l ++;
writeTerm(from_pointer(l, &nrwt, wglb), 999, 1, FALSE, wglb, &nrwt);
restore_from_write(&nrwt, wglb);
wrclose_bracket(wglb, TRUE);

View File

@ -103,7 +103,7 @@ inline EXTERN blob_type BlobOfFunctor (Functor f);
inline EXTERN blob_type
BlobOfFunctor (Functor f)
{
return (blob_type) (f);
return (blob_type) ((CELL)f);
}
typedef struct cp_frame {
@ -148,8 +148,8 @@ exts;
#endif
#ifdef YAP_H
#ifdef YAP_H
/* make sure that these data structures are the first thing to be allocated
in the heap when we start the system */
#ifdef THREADS
@ -175,7 +175,9 @@ typedef struct special_functors_struct
special_functors;
#endif
inline EXTERN Float STD_PROTO (CpFloatUnaligned, (CELL *));
#endif /* YAP_H */
inline extern Float CpFloatUnaligned(CELL *ptr);
#if SIZEOF_DOUBLE == SIZEOF_LONG_INT
@ -214,7 +216,7 @@ CpFloatUnaligned(CELL *ptr)
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
inline EXTERN void STD_PROTO (AlignGlobalForDouble, ( USES_REGS1 ));
inline extern void AlignGlobalForDouble( USES_REGS1 );
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR) & 0x4)
@ -272,13 +274,16 @@ FloatOfTerm (Term t)
#endif
#endif
Term STD_PROTO (Yap_MkBlobStringTerm, (const char *, size_t len));
Term STD_PROTO (Yap_MkBlobWideStringTerm, (const wchar_t *, size_t len));
char *STD_PROTO (Yap_BlobStringOfTerm, (Term));
wchar_t *STD_PROTO (Yap_BlobWideStringOfTerm, (Term));
char *STD_PROTO (Yap_BlobStringOfTermAndLength, (Term, size_t *));
#ifndef YAP_H
#include <stddef.h>
#endif
Term Yap_MkBlobStringTerm(const char *, size_t len);
Term Yap_MkBlobWideStringTerm(const wchar_t *, size_t len);
char *Yap_BlobStringOfTerm(Term);
wchar_t *Yap_BlobWideStringOfTerm(Term);
char *Yap_BlobStringOfTermAndLength(Term, size_t *);
#endif /* YAP_NOT_INSTALLED */
inline EXTERN int IsFloatTerm (Term);
@ -294,7 +299,6 @@ IsFloatTerm (Term t)
/* extern Functor FunctorLongInt; */
#ifdef YAP_H
inline EXTERN Term MkLongIntTerm (Int);
inline EXTERN Term
@ -308,7 +312,6 @@ MkLongIntTerm (Int i)
return AbsAppl(H - 3);
}
#endif
inline EXTERN Int LongIntOfTerm (Term t);

70
H/Yap.h Normal file → Executable file
View File

@ -810,6 +810,7 @@ extern struct worker_local Yap_local;
#define REMOTE(wid) (&Yap_local)
#endif
#include <stdio.h>
#define YP_FILE FILE
#include "hglobals.h"
#include "dglobals.h"
@ -817,6 +818,12 @@ extern struct worker_local Yap_local;
#include "dlocals.h"
/*************************************************************************************************
unification support
*************************************************************************************************/
#include "YapCompoundTerm.h"
/*************************************************************************************************
unification routines
*************************************************************************************************/
@ -830,69 +837,6 @@ extern struct worker_local Yap_local;
/*************************************************************************************************
High level macros to access arguments
*************************************************************************************************/
inline EXTERN Term ArgOfTerm (int i, Term t);
inline EXTERN Term
ArgOfTerm (int i, Term t)
{
return (Term) (Derefa (RepAppl (t) + (i)));
}
inline EXTERN Term HeadOfTerm (Term);
inline EXTERN Term
HeadOfTerm (Term t)
{
return (Term) (Derefa (RepPair (t)));
}
inline EXTERN Term TailOfTerm (Term);
inline EXTERN Term
TailOfTerm (Term t)
{
return (Term) (Derefa (RepPair (t) + 1));
}
inline EXTERN Term ArgOfTermCell (int i, Term t);
inline EXTERN Term
ArgOfTermCell (int i, Term t)
{
return (Term) ((CELL) (RepAppl (t) + (i)));
}
inline EXTERN Term HeadOfTermCell (Term);
inline EXTERN Term
HeadOfTermCell (Term t)
{
return (Term) ((CELL) (RepPair (t)));
}
inline EXTERN Term TailOfTermCell (Term);
inline EXTERN Term
TailOfTermCell (Term t)
{
return (Term) ((CELL) (RepPair (t) + 1));
}
/*************************************************************************************************
slots

115
H/YapCompoundTerm.h Normal file
View File

@ -0,0 +1,115 @@
/*************************************************************************
* *
* YAP Prolog %W% %G% *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2012 *
* *
**************************************************************************
* *
* File: YapCompounTerm.h *
* mods: *
* comments: main header file for YAP *
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
*************************************************************************/
/*************************************************************************************************
High level macros to access arguments
*************************************************************************************************/
#ifndef YAPCOMPOUNDTERM_H
#define YAPCOMPOUNDTERM_H 1
EXTERN Int Yap_unify(Term a,Term b);
EXTERN inline Term Deref(Term a);
EXTERN inline Term Deref(Term a)
{
while(IsVarTerm(a)) {
Term *b = (Term *) a;
a = *b;
if(a==((Term) b)) return a;
}
return(a);
}
EXTERN inline Term Derefa(CELL *b);
EXTERN inline Term
Derefa(CELL *b)
{
Term a = *b;
restart:
if (!IsVarTerm(a)) {
return(a);
} else if (a == (CELL)b) {
return(a);
} else {
b = (CELL *)a;
a = *b;
goto restart;
}
}
inline EXTERN Term ArgOfTerm (int i, Term t);
inline EXTERN Term
ArgOfTerm (int i, Term t)
{
return (Term) (Derefa (RepAppl (t) + (i)));
}
inline EXTERN Term HeadOfTerm (Term);
inline EXTERN Term
HeadOfTerm (Term t)
{
return (Term) (Derefa (RepPair (t)));
}
inline EXTERN Term TailOfTerm (Term);
inline EXTERN Term
TailOfTerm (Term t)
{
return (Term) (Derefa (RepPair (t) + 1));
}
inline EXTERN Term ArgOfTermCell (int i, Term t);
inline EXTERN Term
ArgOfTermCell (int i, Term t)
{
return (Term) ((CELL) (RepAppl (t) + (i)));
}
inline EXTERN Term HeadOfTermCell (Term);
inline EXTERN Term
HeadOfTermCell (Term t)
{
return (Term) ((CELL) (RepPair (t)));
}
inline EXTERN Term TailOfTermCell (Term);
inline EXTERN Term
TailOfTermCell (Term t)
{
return (Term) ((CELL) (RepPair (t) + 1));
}
#endif /* YAPCOMPOUNDTERM_H */

View File

@ -184,8 +184,6 @@ IsUnboundVar (Term * t)
#else
#ifdef YAP_H
inline EXTERN Term MkVarTerm__ ( USES_REGS1 );
inline EXTERN Term
@ -194,8 +192,6 @@ MkVarTerm__ ( USES_REGS1 )
return (Term) ((*H = (CELL) H, H++));
}
#endif
inline EXTERN int IsUnboundVar (Term *);
@ -316,8 +312,7 @@ IsIntTerm (Term t)
}
#ifdef YAP_H
EXTERN inline Term STD_PROTO (MkPairTerm__, (Term, Term CACHE_TYPE) );
EXTERN inline Term MkPairTerm__(Term head, Term tail USES_REGS );
EXTERN inline Term
MkPairTerm__ (Term head, Term tail USES_REGS)
@ -330,7 +325,6 @@ MkPairTerm__ (Term head, Term tail USES_REGS)
return (AbsPair (p));
}
#endif
/* Needed to handle numbers:
@ -395,4 +389,6 @@ IntegerOfTerm (Term t)
return (Int) (IsIntTerm (t) ? IntOfTerm (t) : LongIntOfTerm (t));
}
#ifndef YAP_H
#endif

View File

@ -18,6 +18,7 @@
typedef void *Functor;
typedef void *Atom;
#endif
#ifndef EXTERN
@ -134,3 +135,4 @@ typedef unsigned long int YAP_ULONG_LONG;
#define Unsigned(V) ((CELL) (V))
#define Signed(V) ((Int) (V))

View File

@ -498,6 +498,7 @@ void STD_PROTO(Yap_init_optyap_preds,(void));
/* pl-file.c */
struct PL_local_data *Yap_InitThreadIO(int wid);
void Yap_flush(void);
static inline
yamop *

View File

@ -87,35 +87,6 @@ Dereferencing macros
#endif /* UNIQUE_TAG_FOR_PAIRS */
EXTERN Term STD_PROTO(Deref,(Term));
EXTERN Term STD_PROTO(Derefa,(CELL *));
EXTERN inline Term Deref(Term a)
{
while(IsVarTerm(a)) {
Term *b = (Term *) a;
a = *b;
if(a==((Term) b)) return a;
}
return(a);
}
EXTERN inline Term
Derefa(CELL *b)
{
Term a = *b;
restart:
if (!IsVarTerm(a)) {
return(a);
} else if (a == (CELL)b) {
return(a);
} else {
b = (CELL *)a;
a = *b;
goto restart;
}
}
/************************************************************
TRAIL VARIABLE
@ -309,8 +280,6 @@ Unification Routines
*************************************************************/
EXTERN Int STD_PROTO(Yap_unify,(Term,Term));
inline EXTERN void STD_PROTO(reset_trail,(tr_fr_ptr));
inline EXTERN void

3
H/arith2.h Normal file → Executable file
View File

@ -120,6 +120,7 @@ times_int(Int i1, Int i2) {
}
#ifdef USE_GMP
#ifndef __GNUC__X
static int
clrsb(Int i)
@ -147,7 +148,7 @@ clrsb(Int i)
return j;
}
#endif
#endif
inline static Term
do_sll(Int i, Int j) /* j > 0 */

View File

@ -572,17 +572,16 @@ RestoreMegaClause(MegaClause *cl USES_REGS)
* clause for this predicate or not
*/
{
UInt ncls, i;
yamop *ptr;
yamop *ptr, *max, *nextptr;
cl->ClPred = PtoPredAdjust(cl->ClPred);
if (cl->ClNext) {
cl->ClNext = (MegaClause *)AddrAdjust((ADDR)(cl->ClNext));
}
ncls = cl->ClPred->cs.p_code.NOfClauses;
max = (yamop *)((CODEADDR)cl+cl->ClSize);
for (i = 0, ptr = cl->ClCode; i < ncls; i++) {
yamop *nextptr = (yamop *)((char *)ptr + cl->ClItemSize);
for (ptr = cl->ClCode; ptr < max; ) {
nextptr = (yamop *)((char *)ptr + cl->ClItemSize);
restore_opcodes(ptr, nextptr PASS_REGS);
ptr = nextptr;
}

View File

@ -122,8 +122,9 @@ INTERFACE_HEADERS = \
$(srcdir)/H/Tags_32LowTag.h \
$(srcdir)/H/Tags_64bits.h \
$(srcdir)/H/Tags_24bits.h \
$(srcdir)/H/YapTerm.h \
$(srcdir)/H/YapCompoundTerm.h \
$(srcdir)/include/YapRegs.h \
$(srcdir)/H/YapTerm.h \
$(srcdir)/library/dialect/bprolog/fli/bprolog.h \
$(srcdir)/os/SWI-Stream.h
@ -409,7 +410,9 @@ all: parms.h startup.yss @ENABLE_WINCONSOLE@ pl-yap@EXEC_SUFFIX@
Makefile: $(srcdir)/Makefile.in
$(srcdir)/H/Yap.h: config.h YapTermConfig.h $(srcdir)/H/YapTags.h
$(srcdir)/H/Yap.h: config.h YapTermConfig.h \
$(srcdir)/H/YapTags.h \
$(srcdir)/H/YapCompoundTerm.h
config.h: parms.h

View File

@ -19,7 +19,7 @@
#define INIT_LOCK(LOCK_VAR) pthread_mutex_init(&(LOCK_VAR), NULL)
#define DESTROY_LOCK(LOCK_VAR) pthread_mutex_destroy(&(LOCK_VAR))
#define TRY_LOCK(LOCK_PTR) pthread_mutex_trylock(&(LOCK_VAR))
#define TRY_LOCK(LOCK_VAR) pthread_mutex_trylock(&(LOCK_VAR))
#define LOCK(LOCK_VAR) pthread_mutex_lock(&(LOCK_VAR))
#define UNLOCK(LOCK_VAR) pthread_mutex_unlock(&(LOCK_VAR))
static inline int

View File

@ -339,9 +339,12 @@
#error LIMIT_TABLING requires USE_PAGES_MALLOC
#endif
#if defined(YAPOR) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#undef TABLING_EARLY_COMPLETION
#endif
#if defined(YAPOR) || defined(THREADS)
#undef MODE_DIRECTED_TABLING
#undef TABLING_EARLY_COMPLETION
#undef INCOMPLETE_TABLING
#undef LIMIT_TABLING
#undef DETERMINISTIC_TABLING

View File

@ -43,14 +43,22 @@
#ifdef USE_PAGES_MALLOC
#define STRUCTS_PER_PAGE(STR_TYPE) ((Yap_page_size - ADJUST_SIZE(sizeof(struct page_header))) / ADJUST_SIZE(sizeof(STR_TYPE)))
#define INIT_PAGES(PG, STR_TYPE) \
INIT_LOCK(Pg_lock(PG)); \
Pg_pg_alloc(PG) = 0; \
Pg_str_in_use(PG) = 0; \
Pg_str_per_pg(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
Pg_free_pg(PG) = NULL
#define INIT_GLOBAL_PAGE_ENTRY(PG,STR_TYPE) \
INIT_LOCK(PgEnt_lock(PG)); \
PgEnt_pages_in_use(PG) = 0; \
PgEnt_strs_in_use(PG) = 0; \
PgEnt_strs_per_page(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
PgEnt_first(PG) = NULL; \
PgEnt_last(PG) = NULL;
#define INIT_LOCAL_PAGE_ENTRY(PG,STR_TYPE) \
PgEnt_pages_in_use(PG) = 0; \
PgEnt_strs_in_use(PG) = 0; \
PgEnt_strs_per_page(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
PgEnt_first(PG) = NULL; \
PgEnt_last(PG) = NULL;
#else
#define INIT_PAGES(PG, STR_TYPE) Pg_str_in_use(PG) = 0
#define INIT_GLOBAL_PAGE_ENTRY(PG,STR_TYPE) PgEnt_strs_in_use(PG) = 0
#define INIT_LOCAL_PAGE_ENTRY(PG,STR_TYPE) PgEnt_strs_in_use(PG) = 0
#endif /* USE_PAGES_MALLOC */
@ -63,39 +71,37 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
int i;
/* global data related to memory management */
INIT_PAGES(GLOBAL_pages_void, void *);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_alloc, void *);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_void, void *);
#ifdef TABLING
INIT_PAGES(GLOBAL_pages_tab_ent, struct table_entry);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tab_ent, struct table_entry);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
INIT_PAGES(GLOBAL_pages_sg_ent, struct subgoal_entry);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_sg_ent, struct subgoal_entry);
#endif
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
INIT_PAGES(GLOBAL_pages_sg_fr, struct subgoal_frame);
INIT_PAGES(GLOBAL_pages_dep_fr, struct dependency_frame);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_sg_fr, struct subgoal_frame);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_dep_fr, struct dependency_frame);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_sg_node, struct subgoal_trie_node);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_sg_hash, struct subgoal_trie_hash);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_ans_node, struct answer_trie_node);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_ans_hash, struct answer_trie_hash);
#if defined(THREADS_FULL_SHARING)
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_ans_ref_node, struct answer_ref_node);
#endif
#if !defined(THREADS_NO_SHARING)
INIT_PAGES(GLOBAL_pages_sg_node, struct subgoal_trie_node);
INIT_PAGES(GLOBAL_pages_sg_hash, struct subgoal_trie_hash);
#endif
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
INIT_PAGES(GLOBAL_pages_ans_node, struct answer_trie_node);
INIT_PAGES(GLOBAL_pages_ans_hash, struct answer_trie_hash);
#endif
INIT_PAGES(GLOBAL_pages_gt_node, struct global_trie_node);
INIT_PAGES(GLOBAL_pages_gt_hash, struct global_trie_hash);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_gt_node, struct global_trie_node);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_gt_hash, struct global_trie_hash);
#endif /* TABLING */
#ifdef YAPOR
INIT_PAGES(GLOBAL_pages_or_fr, struct or_frame);
INIT_PAGES(GLOBAL_pages_qg_sol_fr, struct query_goal_solution_frame);
INIT_PAGES(GLOBAL_pages_qg_ans_fr, struct query_goal_answer_frame);
#endif /* YAPOR */
#if defined(YAPOR) && defined(TABLING)
INIT_PAGES(GLOBAL_pages_susp_fr, struct suspension_frame);
#endif /* YAPOR && TABLING */
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_or_fr, struct or_frame);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_qg_sol_fr, struct query_goal_solution_frame);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_qg_ans_fr, struct query_goal_answer_frame);
#ifdef TABLING
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_susp_fr, struct suspension_frame);
#endif
#ifdef TABLING_INNER_CUTS
INIT_PAGES(GLOBAL_pages_tg_sol_fr, struct table_subgoal_solution_frame);
INIT_PAGES(GLOBAL_pages_tg_ans_fr, struct table_subgoal_answer_frame);
#endif /* TABLING_INNER_CUTS */
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tg_sol_fr, struct table_subgoal_solution_frame);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tg_ans_fr, struct table_subgoal_answer_frame);
#endif
#endif /* YAPOR */
#ifdef YAPOR
/* global static data */
@ -136,7 +142,7 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
#ifdef TABLING
/* global data related to tabling */
new_global_trie_node(GLOBAL_root_gt, 0, NULL, NULL, NULL);
GLOBAL_root_gt = NULL;
GLOBAL_root_tab_ent = NULL;
#ifdef LIMIT_TABLING
if (max_table_size)
@ -171,30 +177,26 @@ void Yap_init_local_optyap_data(int wid) {
#if defined(TABLING) && (defined(YAPOR) || defined(THREADS))
/* local data related to memory management */
#if defined(YAPOR)
#ifdef YAPOR
REMOTE_next_free_ans_node(wid) = NULL;
#elif defined(THREADS)
INIT_PAGES(REMOTE_pages_void(wid), void *);
INIT_PAGES(REMOTE_pages_sg_fr(wid), struct subgoal_frame);
INIT_PAGES(REMOTE_pages_dep_fr(wid), struct dependency_frame);
#if defined(THREADS_NO_SHARING)
INIT_PAGES(REMOTE_pages_sg_node(wid), struct subgoal_trie_node);
INIT_PAGES(REMOTE_pages_sg_hash(wid), struct subgoal_trie_hash);
#elif defined(THREADS_SUBGOAL_SHARING) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
REMOTE_next_free_sg_node(wid) = NULL;
REMOTE_next_free_sg_hash(wid) = NULL;
#endif
#if defined(THREADS_NO_SHARING) || defined(THREADS_SUBGOAL_SHARING)
INIT_PAGES(REMOTE_pages_ans_node(wid), struct answer_trie_node);
INIT_PAGES(REMOTE_pages_ans_hash(wid), struct answer_trie_hash);
#elif defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
REMOTE_next_free_ans_node(wid) = NULL;
REMOTE_next_free_ans_hash(wid) = NULL;
#elif THREADS
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_void(wid), void *);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_tab_ent(wid), struct table_entry);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_ent(wid), struct subgoal_entry);
#endif
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_fr(wid), struct subgoal_frame);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_dep_fr(wid), struct dependency_frame);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_node(wid), struct subgoal_trie_node);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_hash(wid), struct subgoal_trie_hash);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_ans_node(wid), struct answer_trie_node);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_ans_hash(wid), struct answer_trie_hash);
#if defined(THREADS_FULL_SHARING)
INIT_PAGES(REMOTE_pages_ans_ref_node(wid), struct answer_ref_node);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_ans_ref_node(wid), struct answer_ref_node);
#endif
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_gt_node(wid), struct global_trie_node);
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_gt_hash(wid), struct global_trie_hash);
#endif
#endif /* YAPOR - THREADS */
#endif /* TABLING && (YAPOR || THREADS) */
#ifdef YAPOR
@ -214,6 +216,7 @@ void Yap_init_local_optyap_data(int wid) {
#ifdef TABLING
/* local data related to tabling */
REMOTE_top_sg_fr(wid) = NULL;
REMOTE_top_dep_fr(wid) = NULL;
#ifdef YAPOR
REMOTE_top_dep_fr(wid) = GLOBAL_root_dep_fr;
Set_REMOTE_top_cp_on_stack(wid, (choiceptr) LOCAL_LocalBase); /* ??? */
@ -258,6 +261,8 @@ void Yap_init_root_frames(void) {
#endif /* YAPOR */
#ifdef TABLING
/* root global trie node */
new_global_trie_node(GLOBAL_root_gt, 0, NULL, NULL, NULL);
/* root dependency frame */
#ifdef YAPOR
DepFr_cons_cp(GLOBAL_root_dep_fr) = B; /* with YAPOR, at that point, LOCAL_top_dep_fr shouldn't be the same as GLOBAL_root_dep_fr ? */

View File

@ -40,348 +40,443 @@ extern int Yap_page_size;
#define ADJUST_SIZE_TO_PAGE(SIZE) ((SIZE) - (SIZE) % Yap_page_size + Yap_page_size)
#define PAGE_HEADER(STR) (pg_hd_ptr)((unsigned long int)STR - (unsigned long int)STR % Yap_page_size)
#define STRUCT_NEXT(STR) ((STR)->next)
#define UPDATE_STATS(STAT, VALUE) STAT += VALUE
#ifdef YAPOR
#define LOCK_PAGE_ENTRY(PG_ENT) LOCK(PgEnt_lock(PG_ENT))
#define UNLOCK_PAGE_ENTRY(PG_ENT) UNLOCK(PgEnt_lock(PG_ENT))
#else
#define LOCK_PAGE_ENTRY(PG_ENT)
#define UNLOCK_PAGE_ENTRY(PG_ENT)
#endif
#ifdef USE_SYSTEM_MALLOC
/**************************************************************************************
** USE_SYSTEM_MALLOC **
**************************************************************************************/
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
if ((STR = (STR_TYPE *) malloc(SIZE)) == NULL) \
/*******************************************************************************************
** USE_SYSTEM_MALLOC **
*******************************************************************************************/
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
if ((STR = (STR_TYPE *) malloc(SIZE)) == NULL) \
Yap_Error(FATAL_ERROR, TermNil, "ALLOC_BLOCK: malloc error")
#define FREE_BLOCK(STR) \
#define FREE_BLOCK(STR) \
free(STR)
#else
/**************************************************************************************
** ! USE_SYSTEM_MALLOC **
**************************************************************************************/
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
{ char *block_ptr; \
if ((block_ptr = Yap_AllocCodeSpace(SIZE + sizeof(CELL))) != NULL) \
*block_ptr = 'y'; \
else if ((block_ptr = (char *) malloc(SIZE + sizeof(CELL))) != NULL) \
*block_ptr = 'm'; \
else \
Yap_Error(FATAL_ERROR, TermNil, "ALLOC_BLOCK: malloc error"); \
block_ptr += sizeof(CELL); \
STR = (STR_TYPE *) block_ptr; \
/*******************************************************************************************
** ! USE_SYSTEM_MALLOC **
*******************************************************************************************/
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
{ char *block_ptr; \
if ((block_ptr = Yap_AllocCodeSpace(SIZE + sizeof(CELL))) != NULL) \
*block_ptr = 'y'; \
else if ((block_ptr = (char *) malloc(SIZE + sizeof(CELL))) != NULL) \
*block_ptr = 'm'; \
else \
Yap_Error(FATAL_ERROR, TermNil, "ALLOC_BLOCK: malloc error"); \
block_ptr += sizeof(CELL); \
STR = (STR_TYPE *) block_ptr; \
}
#define FREE_BLOCK(STR) \
{ char *block_ptr = (char *)(STR) - sizeof(CELL); \
if (block_ptr[0] == 'y') \
Yap_FreeCodeSpace(block_ptr); \
else \
free(block_ptr); \
#define FREE_BLOCK(STR) \
{ char *block_ptr = (char *)(STR) - sizeof(CELL); \
if (block_ptr[0] == 'y') \
Yap_FreeCodeSpace(block_ptr); \
else \
free(block_ptr); \
}
#endif /******************************************************************************/
#define INIT_BUCKETS(BUCKET_PTR, NUM_BUCKETS) \
{ int i; void **init_bucket_ptr; \
init_bucket_ptr = (void **) BUCKET_PTR; \
for (i = NUM_BUCKETS; i != 0; i--) \
*init_bucket_ptr++ = NULL; \
#endif /***********************************************************************************/
#define INIT_BUCKETS(BUCKET_PTR, NUM_BUCKETS) \
{ int i; void **init_bucket_ptr; \
init_bucket_ptr = (void **) BUCKET_PTR; \
for (i = NUM_BUCKETS; i != 0; i--) \
*init_bucket_ptr++ = NULL; \
}
#define ALLOC_BUCKETS(BUCKET_PTR, NUM_BUCKETS) \
{ void **alloc_bucket_ptr; \
ALLOC_BLOCK(alloc_bucket_ptr, NUM_BUCKETS * sizeof(void *), void *); \
INIT_BUCKETS(alloc_bucket_ptr, NUM_BUCKETS); \
BUCKET_PTR = (void *) alloc_bucket_ptr; \
#define ALLOC_BUCKETS(BUCKET_PTR, NUM_BUCKETS) \
{ void **alloc_bucket_ptr; \
ALLOC_BLOCK(alloc_bucket_ptr, NUM_BUCKETS * sizeof(void *), void *); \
INIT_BUCKETS(alloc_bucket_ptr, NUM_BUCKETS); \
BUCKET_PTR = (void *) alloc_bucket_ptr; \
}
#define FREE_BUCKETS(BUCKET_PTR) FREE_BLOCK(BUCKET_PTR)
#ifndef USE_PAGES_MALLOC
/**************************************************************************************
** ! USE_PAGES_MALLOC **
**************************************************************************************/
#define ALLOC_STRUCT(STR, STR_TYPE, STR_PAGES, VOID_PAGES) \
LOCK(Pg_lock(STR_PAGES)); \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), 1); \
UNLOCK(Pg_lock(STR_PAGES)); \
/*******************************************************************************************
** ! USE_PAGES_MALLOC **
*******************************************************************************************/
#define GET_FREE_STRUCT(STR, STR_TYPE, PG_ENT, EXTRA_PG_ENT) \
LOCK_PAGE_ENTRY(PG_ENT); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), 1); \
UNLOCK_PAGE_ENTRY(PG_ENT); \
ALLOC_BLOCK(STR, sizeof(STR_TYPE), STR_TYPE)
#define LOCAL_NEXT_ALLOC_STRUCT(STR, LOCAL_STR, STR_TYPE, STR_PAGES, VOID_PAGES) \
ALLOC_STRUCT(STR, STR_TYPE, STR_PAGES, VOID_PAGES)
#define FREE_STRUCT(STR, STR_TYPE, STR_PAGES, VOID_PAGES) \
LOCK(Pg_lock(STR_PAGES)); \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
UNLOCK(Pg_lock(STR_PAGES)); \
#define GET_NEXT_FREE_STRUCT(LOCAL_STR, STR, STR_TYPE, PG_ENT) \
GET_FREE_STRUCT(STR, STR_TYPE, PG_ENT, ___NOT_USED___)
#define PUT_FREE_STRUCT(STR, STR_TYPE, PG_ENT) \
LOCK_PAGE_ENTRY(PG_ENT); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), -1); \
UNLOCK_PAGE_ENTRY(PG_ENT); \
FREE_BLOCK(STR)
#else
/**************************************************************************************
** USE_PAGES_MALLOC && ! LIMIT_TABLING **
**************************************************************************************/
#ifndef LIMIT_TABLING
#define ALLOC_STRUCT_TEST_PAGE if
#define ALLOC_STRUCT_RECOVER_SPACE(PG_HD, STR_PAGES, VOID_PAGES)
/*******************************************************************************************
** USE_PAGES_MALLOC **
*******************************************************************************************/
#define MOVE_PAGES(FROM_PG_ENT, TO_PG_ENT) \
if (PgEnt_first(TO_PG_ENT)) { \
PgHd_next(PgEnt_last(TO_PG_ENT)) = PgEnt_first(FROM_PG_ENT); \
PgHd_previous(PgEnt_first(FROM_PG_ENT)) = PgEnt_last(TO_PG_ENT); \
} else \
PgEnt_first(TO_PG_ENT) = PgEnt_first(FROM_PG_ENT); \
PgEnt_last(TO_PG_ENT) = PgEnt_last(FROM_PG_ENT); \
UPDATE_STATS(PgEnt_pages_in_use(TO_PG_ENT), PgEnt_pages_in_use(FROM_PG_ENT)); \
UPDATE_STATS(PgEnt_strs_in_use(TO_PG_ENT), PgEnt_strs_in_use(FROM_PG_ENT)); \
PgEnt_first(FROM_PG_ENT) = PgEnt_last(FROM_PG_ENT) = NULL; \
PgEnt_pages_in_use(FROM_PG_ENT) = PgEnt_strs_in_use(FROM_PG_ENT) = 0
#define DETACH_PAGES(_PG_ENT) \
if (PgEnt_first(LOCAL##_PG_ENT)) { \
LOCK(PgEnt_lock(GLOBAL##_PG_ENT)); \
MOVE_PAGES(LOCAL##_PG_ENT, GLOBAL##_PG_ENT); \
UNLOCK(PgEnt_lock(GLOBAL##_PG_ENT)); \
}
#define ATTACH_PAGES(_PG_ENT) \
if (PgEnt_first(GLOBAL##_PG_ENT)) { \
MOVE_PAGES(GLOBAL##_PG_ENT, LOCAL##_PG_ENT); \
}
#define GET_PAGE_FIRST_LEVEL(PG_HD) GET_ALLOC_PAGE(PG_HD)
#define GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD) GET_VOID_PAGE(PG_HD)
#define GET_VOID_PAGE_NEXT_LEVEL(PG_HD)
/*******************************************************************************************
#define GET_PAGE_FIRST_LEVEL(PG_HD) GET_VOID_PAGE(PG_HD)
#define GET_VOID_PAGE_NEXT_LEVEL(PG_HD) GET_ALLOC_PAGE(PG_HD)
#define GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD)
*******************************************************************************************/
#define GET_ALLOC_PAGE(PG_HD) \
LOCK(PgEnt_lock(GLOBAL_pages_alloc)); \
if ((PG_HD = PgEnt_first(GLOBAL_pages_alloc)) == NULL) { \
UNLOCK(PgEnt_lock(GLOBAL_pages_alloc)); \
GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD); \
} else { \
PgEnt_first(GLOBAL_pages_alloc) = (pg_hd_ptr)(((void *)PG_HD) + Yap_page_size); \
if (PgEnt_first(GLOBAL_pages_alloc) == PgEnt_last(GLOBAL_pages_alloc)) \
PgEnt_first(GLOBAL_pages_alloc) = NULL; \
UNLOCK(PgEnt_lock(GLOBAL_pages_alloc)); \
}
#define GET_VOID_PAGE(PG_HD) \
LOCK(PgEnt_lock(GLOBAL_pages_void)); \
if ((PG_HD = PgEnt_first(GLOBAL_pages_void)) == NULL) { \
UNLOCK(PgEnt_lock(GLOBAL_pages_void)); \
GET_VOID_PAGE_NEXT_LEVEL(PG_HD); \
} else { \
if ((PgEnt_first(GLOBAL_pages_void) = PgHd_next(PG_HD)) == NULL) \
PgEnt_last(GLOBAL_pages_void) = NULL; \
UNLOCK(PgEnt_lock(GLOBAL_pages_void)); \
}
#define PUT_PAGE(PG_HD, PG_ENT) \
if ((PgHd_next(PG_HD) = PgEnt_first(PG_ENT)) == NULL) \
PgEnt_last(PG_ENT) = PG_HD; \
else \
PgHd_previous(PgHd_next(PG_HD)) = PG_HD; \
PgEnt_first(PG_ENT) = PG_HD; \
UPDATE_STATS(PgEnt_pages_in_use(PG_ENT), 1)
#define PUT_VOID_PAGE(PG_HD, PG_ENT) \
if ((PgHd_next(PG_HD) = PgEnt_first(PG_ENT)) == NULL) \
PgEnt_last(PG_ENT) = PG_HD; \
PgEnt_first(PG_ENT) = PG_HD
#ifdef THREADS
#define GET_FREE_PAGE(PG_HD) \
if ((PG_HD = PgEnt_first(LOCAL_pages_void)) == NULL) { \
GET_PAGE_FIRST_LEVEL(PG_HD); \
} else { \
if ((PgEnt_first(LOCAL_pages_void) = PgHd_next(PG_HD)) == NULL) \
PgEnt_last(LOCAL_pages_void) = NULL; \
}
#define PUT_FREE_PAGE(PG_HD) \
PUT_VOID_PAGE(PG_HD, LOCAL_pages_void)
#else
/**************************************************************************************
** USE_PAGES_MALLOC && LIMIT_TABLING **
**************************************************************************************/
#define ALLOC_STRUCT_TEST_PAGE while
#define ALLOC_STRUCT_RECOVER_SPACE(PG_HD, STR_PAGES, VOID_PAGES) \
if (Pg_free_pg(VOID_PAGES) == NULL && \
GLOBAL_max_pages == Pg_pg_alloc(VOID_PAGES)) { \
sg_fr_ptr sg_fr = GLOBAL_check_sg_fr; \
UNLOCK(Pg_lock(VOID_PAGES)); \
do { \
if (sg_fr) \
sg_fr = SgFr_next(sg_fr); \
else \
sg_fr = GLOBAL_first_sg_fr; \
if (sg_fr == NULL) \
Yap_Error(FATAL_ERROR, TermNil, "no space left (RECOVER_SPACE)"); \
/* see function 'InteractSIGINT' in file 'sysbits.c' */ \
/* Yap_Error(PURE_ABORT, TermNil, ""); */ \
/* restore_absmi_regs(&Yap_standard_regs); */ \
/* siglongjmp (LOCAL_RestartEnv, 1); */ \
if (SgFr_first_answer(sg_fr) && \
SgFr_first_answer(sg_fr) != SgFr_answer_trie(sg_fr)) { \
SgFr_state(sg_fr) = ready; \
free_answer_hash_chain(SgFr_hash_chain(sg_fr)); \
SgFr_hash_chain(sg_fr) = NULL; \
SgFr_first_answer(sg_fr) = NULL; \
SgFr_last_answer(sg_fr) = NULL; \
free_answer_trie(TrNode_child(SgFr_answer_trie(sg_fr)), \
TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST); \
TrNode_child(SgFr_answer_trie(sg_fr)) = NULL; \
} \
} while (Pg_free_pg(VOID_PAGES) == Pg_free_pg(STR_PAGES)); \
GLOBAL_check_sg_fr = sg_fr; \
LOCK(Pg_lock(STR_PAGES)); \
PG_HD = Pg_free_pg(STR_PAGES); \
} else
#define GET_FREE_PAGE(PG_HD) \
GET_PAGE_FIRST_LEVEL(PG_HD)
#define PUT_FREE_PAGE(PG_HD) \
PUT_VOID_PAGE(PG_HD, GLOBAL_pages_void)
#endif
/**************************************************************************************
** USE_PAGES_MALLOC **
**************************************************************************************/
#define ALLOC_VOID_PAGES(PG_HD, VOID_PAGES) \
{ int i, shmid; \
pg_hd_ptr aux_pg_hd; \
if ((shmid = shmget(IPC_PRIVATE, SHMMAX, SHM_R|SHM_W)) == -1) \
Yap_Error(FATAL_ERROR, TermNil, "shmget error (ALLOC_VOID_PAGES)"); \
if ((PG_HD = (pg_hd_ptr) shmat(shmid, NULL, 0)) == (void *) -1) \
Yap_Error(FATAL_ERROR, TermNil, "shmat error (ALLOC_VOID_PAGES)"); \
if (shmctl(shmid, IPC_RMID, 0) != 0) \
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_VOID_PAGES)"); \
aux_pg_hd = (pg_hd_ptr)(((void *)PG_HD) + Yap_page_size); \
Pg_free_pg(VOID_PAGES) = aux_pg_hd; \
for (i = 2; i < SHMMAX / Yap_page_size; i++) { \
PgHd_next(aux_pg_hd) = (pg_hd_ptr)(((void *)aux_pg_hd) + Yap_page_size); \
aux_pg_hd = PgHd_next(aux_pg_hd); \
} \
PgHd_next(aux_pg_hd) = NULL; \
UPDATE_STATS(Pg_pg_alloc(VOID_PAGES), SHMMAX / Yap_page_size); \
UPDATE_STATS(Pg_str_in_use(VOID_PAGES), 1); \
#define INIT_PAGE(PG_HD, STR_TYPE, PG_ENT) \
PgHd_strs_in_use(PG_HD) = 0; \
PgHd_previous(PG_HD) = NULL; \
PgHd_next(PG_HD) = NULL; \
PgHd_first_str(PG_HD) = NULL; \
PgHd_alloc_area(PG_HD) = (void *) (PG_HD + 1); \
PgHd_alloc_area(PG_HD) += sizeof(STR_TYPE) * PgEnt_strs_per_page(PG_ENT)
/*******************************************************************************************
#define OLD_INIT_PAGE(PG_HD, STR_TYPE, PG_ENT) \
{ int i; \
STR_TYPE *aux_str; \
PgHd_strs_in_use(PG_HD) = 0; \
PgHd_previous(PG_HD) = NULL; \
PgHd_next(PG_HD) = NULL; \
PgHd_alloc_area(PG_HD) = NULL; \
PgHd_first_str(PG_HD) = (void *) (PG_HD + 1); \
aux_str = (STR_TYPE *) PgHd_first_str(PG_HD); \
for (i = 1; i < PgEnt_strs_per_page(PG_ENT); i++) { \
STRUCT_NEXT(aux_str) = aux_str + 1; \
aux_str++; \
} \
STRUCT_NEXT(aux_str) = NULL; \
}
*******************************************************************************************/
#define ALLOC_SPACE() \
LOCK(PgEnt_lock(GLOBAL_pages_alloc)); \
if (PgEnt_first(GLOBAL_pages_alloc) == NULL) { \
int shmid; \
void *mem_block; \
if ((shmid = shmget(IPC_PRIVATE, SHMMAX, SHM_R|SHM_W)) == -1) \
Yap_Error(FATAL_ERROR, TermNil, "shmget error (ALLOC_PAGE)"); \
if ((mem_block = shmat(shmid, NULL, 0)) == (void *) -1) \
Yap_Error(FATAL_ERROR, TermNil, "shmat error (ALLOC_PAGE)"); \
if (shmctl(shmid, IPC_RMID, 0) != 0) \
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_PAGE)"); \
PgEnt_first(GLOBAL_pages_alloc) = (pg_hd_ptr)(mem_block + Yap_page_size); \
PgEnt_last(GLOBAL_pages_alloc) = (pg_hd_ptr)(mem_block + SHMMAX); \
UPDATE_STATS(PgEnt_pages_in_use(GLOBAL_pages_alloc), SHMMAX / Yap_page_size); \
} \
UNLOCK(PgEnt_lock(GLOBAL_pages_alloc))
#ifdef LIMIT_TABLING
#define RECOVER_ALLOC_SPACE(PG_ENT, EXTRA_PG_ENT) \
if (GLOBAL_max_pages == PgEnt_pages_in_use(GLOBAL_pages_alloc)) { \
sg_fr_ptr sg_fr = GLOBAL_check_sg_fr; \
do { \
if (sg_fr) \
sg_fr = SgFr_next(sg_fr); \
else \
sg_fr = GLOBAL_first_sg_fr; \
if (sg_fr == NULL) \
Yap_Error(FATAL_ERROR, TermNil, "no space left (RECOVER_SPACE)"); \
/* see function 'InteractSIGINT' in file 'sysbits.c' */ \
/* Yap_Error(PURE_ABORT, TermNil, ""); */ \
/* restore_absmi_regs(&Yap_standard_regs); */ \
/* siglongjmp (LOCAL_RestartEnv, 1); */ \
if (SgFr_first_answer(sg_fr) && \
SgFr_first_answer(sg_fr) != SgFr_answer_trie(sg_fr)) { \
SgFr_state(sg_fr) = ready; \
free_answer_hash_chain(SgFr_hash_chain(sg_fr)); \
SgFr_hash_chain(sg_fr) = NULL; \
SgFr_first_answer(sg_fr) = NULL; \
SgFr_last_answer(sg_fr) = NULL; \
free_answer_trie(TrNode_child(SgFr_answer_trie(sg_fr)), \
TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST); \
TrNode_child(SgFr_answer_trie(sg_fr)) = NULL; \
} \
} while (PgEnt_first(GLOBAL_pages_void) == PgEnt_first(PG_ENT)); \
GLOBAL_check_sg_fr = sg_fr; \
} else { \
ALLOC_SPACE(); \
}
#elif THREADS
#define RECOVER_ALLOC_SPACE(PG_ENT, EXTRA_PG_ENT) \
LOCK(PgEnt_lock(EXTRA_PG_ENT)); \
if (PgEnt_first(EXTRA_PG_ENT)) { \
MOVE_PAGES(EXTRA_PG_ENT, PG_ENT); \
UNLOCK(PgEnt_lock(EXTRA_PG_ENT)); \
} else { \
UNLOCK(PgEnt_lock(EXTRA_PG_ENT)); \
ALLOC_SPACE(); \
}
#else
#define RECOVER_ALLOC_SPACE(PG_ENT, EXTRA_PG_ENT) \
ALLOC_SPACE()
#endif
#define TEST_GET_FREE_PAGE(PG_HD, STR_TYPE, PG_ENT, EXTRA_PG_ENT) \
while (PG_HD == NULL) { \
UNLOCK_PAGE_ENTRY(PG_ENT); \
GET_FREE_PAGE(PG_HD); \
if (PG_HD) { \
INIT_PAGE(PG_HD, STR_TYPE, PG_ENT); \
LOCK_PAGE_ENTRY(PG_ENT); \
PUT_PAGE(PG_HD, PG_ENT); \
} else { \
RECOVER_ALLOC_SPACE(PG_ENT, EXTRA_PG_ENT); \
LOCK_PAGE_ENTRY(PG_ENT); \
PG_HD = PgEnt_first(PG_ENT); \
} \
}
#define INIT_PAGE(PG_HD, STR_TYPE, STR_PAGES) \
{ int i; \
STR_TYPE *aux_str; \
PgHd_str_in_use(PG_HD) = 0; \
PgHd_previous(PG_HD) = NULL; \
PgHd_next(PG_HD) = NULL; \
PgHd_free_str(PG_HD) = (void *) (PG_HD + 1); \
aux_str = (STR_TYPE *) PgHd_free_str(PG_HD); \
for (i = 1; i < Pg_str_per_pg(STR_PAGES); i++) { \
STRUCT_NEXT(aux_str) = aux_str + 1; \
aux_str++; \
} \
STRUCT_NEXT(aux_str) = NULL; \
}
#define ALLOC_STRUCT_TEST_ALLOC_PAGE(PG_HD, STR_TYPE, STR_PAGES, VOID_PAGES) \
ALLOC_STRUCT_TEST_PAGE (PG_HD == NULL) { /* if / while */ \
UNLOCK(Pg_lock(STR_PAGES)); \
LOCK(Pg_lock(VOID_PAGES)); \
/* if (...) { ... */ \
ALLOC_STRUCT_RECOVER_SPACE(PG_HD, STR_PAGES, VOID_PAGES) \
/* } else */ \
{ \
PG_HD = Pg_free_pg(VOID_PAGES); \
if (PG_HD == NULL) { \
ALLOC_VOID_PAGES(PG_HD, VOID_PAGES); \
} else { \
Pg_free_pg(VOID_PAGES) = PgHd_next(PG_HD); \
UPDATE_STATS(Pg_str_in_use(VOID_PAGES), 1); \
} \
UNLOCK(Pg_lock(VOID_PAGES)); \
INIT_PAGE(PG_HD, STR_TYPE, STR_PAGES); \
LOCK(Pg_lock(STR_PAGES)); \
if ((PgHd_next(PG_HD) = Pg_free_pg(STR_PAGES)) != NULL) \
PgHd_previous(PgHd_next(PG_HD)) = PG_HD; \
Pg_free_pg(STR_PAGES) = PG_HD; \
UPDATE_STATS(Pg_pg_alloc(STR_PAGES), 1); \
} \
}
#define ALLOC_STRUCT(STR, STR_TYPE, STR_PAGES, VOID_PAGES) \
{ pg_hd_ptr pg_hd; \
LOCK(Pg_lock(STR_PAGES)); \
pg_hd = Pg_free_pg(STR_PAGES); \
ALLOC_STRUCT_TEST_ALLOC_PAGE(pg_hd, STR_TYPE, STR_PAGES, VOID_PAGES); \
STR = (STR_TYPE *) PgHd_free_str(pg_hd); \
if ((PgHd_free_str(pg_hd) = (void *) STRUCT_NEXT(STR)) == NULL) \
if ((Pg_free_pg(STR_PAGES) = PgHd_next(pg_hd)) != NULL) \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
UPDATE_STATS(PgHd_str_in_use(pg_hd), 1); \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), 1); \
UNLOCK(Pg_lock(STR_PAGES)); \
#define GET_FREE_STRUCT(STR, STR_TYPE, PG_ENT, EXTRA_PG_ENT) \
{ pg_hd_ptr pg_hd; \
LOCK_PAGE_ENTRY(PG_ENT); \
pg_hd = PgEnt_first(PG_ENT); \
TEST_GET_FREE_PAGE(pg_hd, STR_TYPE, PG_ENT, EXTRA_PG_ENT); \
if (PgHd_alloc_area(pg_hd)) { \
STR = ((STR_TYPE *) PgHd_alloc_area(pg_hd)) - 1; \
if (STR == (STR_TYPE *) (pg_hd + 1)) \
PgHd_alloc_area(pg_hd) = NULL; \
else \
PgHd_alloc_area(pg_hd) = (void *) STR; \
} else { \
STR = (STR_TYPE *) PgHd_first_str(pg_hd); \
PgHd_first_str(pg_hd) = (void *) STRUCT_NEXT(STR); \
} \
if (PgHd_alloc_area(pg_hd) == NULL && PgHd_first_str(pg_hd) == NULL) { \
if ((PgEnt_first(PG_ENT) = PgHd_next(pg_hd)) == NULL) \
PgEnt_last(PG_ENT) = NULL; \
else \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
} \
UPDATE_STATS(PgHd_strs_in_use(pg_hd), 1); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), 1); \
UNLOCK_PAGE_ENTRY(PG_ENT); \
}
#define LOCAL_NEXT_ALLOC_STRUCT(STR, LOCAL_STR, STR_TYPE, STR_PAGES, VOID_PAGES) \
STR = LOCAL_STR; \
if (STR == NULL) { \
pg_hd_ptr pg_hd; \
LOCK(Pg_lock(STR_PAGES)); \
pg_hd = Pg_free_pg(STR_PAGES); \
ALLOC_STRUCT_TEST_ALLOC_PAGE(pg_hd, STR_TYPE, STR_PAGES, VOID_PAGES); \
if ((Pg_free_pg(STR_PAGES) = PgHd_next(pg_hd)) != NULL) \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -PgHd_str_in_use(pg_hd)); \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), Pg_str_per_pg(STR_PAGES)); \
UNLOCK(Pg_lock(STR_PAGES)); \
STR = (STR_TYPE *) PgHd_free_str(pg_hd); \
PgHd_free_str(pg_hd) = NULL; \
PgHd_str_in_use(pg_hd) = Pg_str_per_pg(STR_PAGES); \
} \
/*******************************************************************************************
#define OLD_GET_FREE_STRUCT(STR, STR_TYPE, PG_ENT, EXTRA_PG_ENT) \
{ pg_hd_ptr pg_hd; \
LOCK_PAGE_ENTRY(PG_ENT); \
pg_hd = PgEnt_first(PG_ENT); \
TEST_GET_FREE_PAGE(pg_hd, STR_TYPE, PG_ENT, EXTRA_PG_ENT); \
STR = (STR_TYPE *) PgHd_first_str(pg_hd); \
if ((PgHd_first_str(pg_hd) = (void *) STRUCT_NEXT(STR)) == NULL) { \
if ((PgEnt_first(PG_ENT) = PgHd_next(pg_hd)) == NULL) \
PgEnt_last(PG_ENT) = NULL; \
else \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
} \
UPDATE_STATS(PgHd_strs_in_use(pg_hd), 1); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), 1); \
UNLOCK_PAGE_ENTRY(PG_ENT); \
}
*******************************************************************************************/
#define GET_NEXT_FREE_STRUCT(LOCAL_STR, STR, STR_TYPE, PG_ENT) \
STR = LOCAL_STR; \
if (STR == NULL) { \
pg_hd_ptr pg_hd; \
LOCK_PAGE_ENTRY(PG_ENT); \
pg_hd = PgEnt_first(PG_ENT); \
TEST_GET_FREE_PAGE(pg_hd, STR_TYPE, PG_ENT, ___NOT_USED___); \
STR = (STR_TYPE *) PgHd_first_str(pg_hd); \
PgHd_first_str(pg_hd) = NULL; \
PgHd_strs_in_use(pg_hd) = PgEnt_strs_per_page(PG_ENT); \
if ((PgEnt_first(PG_ENT) = PgHd_next(pg_hd)) == NULL) \
PgEnt_last(PG_ENT) = NULL; \
else \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), -PgHd_strs_in_use(pg_hd)); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), PgEnt_strs_per_page(PG_ENT)); \
UNLOCK_PAGE_ENTRY(PG_ENT); \
} \
LOCAL_STR = STRUCT_NEXT(STR)
#define FREE_PAGE(PG_HD, VOID_PAGES) \
LOCK(Pg_lock(VOID_PAGES)); \
PgHd_next(PG_HD) = Pg_free_pg(VOID_PAGES); \
Pg_free_pg(VOID_PAGES) = PG_HD; \
UPDATE_STATS(Pg_str_in_use(VOID_PAGES), -1); \
UNLOCK(Pg_lock(VOID_PAGES))
#define FREE_STRUCT(STR, STR_TYPE, STR_PAGES, VOID_PAGES) \
{ pg_hd_ptr pg_hd; \
pg_hd = PAGE_HEADER(STR); \
LOCK(Pg_lock(STR_PAGES)); \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
if (--PgHd_str_in_use(pg_hd) == 0) { \
UPDATE_STATS(Pg_pg_alloc(STR_PAGES), -1); \
if (PgHd_previous(pg_hd)) { \
if ((PgHd_next(PgHd_previous(pg_hd)) = PgHd_next(pg_hd)) != NULL) \
PgHd_previous(PgHd_next(pg_hd)) = PgHd_previous(pg_hd); \
} else { \
if ((Pg_free_pg(STR_PAGES) = PgHd_next(pg_hd)) != NULL) \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
} \
UNLOCK(Pg_lock(STR_PAGES)); \
FREE_PAGE(pg_hd, VOID_PAGES); \
} else { \
if ((STRUCT_NEXT(STR) = (STR_TYPE *) PgHd_free_str(pg_hd)) == NULL) { \
PgHd_previous(pg_hd) = NULL; \
if ((PgHd_next(pg_hd) = Pg_free_pg(STR_PAGES)) != NULL) \
PgHd_previous(PgHd_next(pg_hd)) = pg_hd; \
Pg_free_pg(STR_PAGES) = pg_hd; \
} \
PgHd_free_str(pg_hd) = (void *) STR; \
UNLOCK(Pg_lock(STR_PAGES)); \
} \
#define PUT_FREE_STRUCT(STR, STR_TYPE, PG_ENT) \
{ pg_hd_ptr pg_hd; \
pg_hd = PAGE_HEADER(STR); \
LOCK_PAGE_ENTRY(PG_ENT); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), -1); \
if (--PgHd_strs_in_use(pg_hd) == 0) { \
UPDATE_STATS(PgEnt_pages_in_use(PG_ENT), -1); \
if (PgHd_previous(pg_hd)) { \
if ((PgHd_next(PgHd_previous(pg_hd)) = PgHd_next(pg_hd)) == NULL) \
PgEnt_last(PG_ENT) = PgHd_previous(pg_hd); \
else \
PgHd_previous(PgHd_next(pg_hd)) = PgHd_previous(pg_hd); \
} else { \
if ((PgEnt_first(PG_ENT) = PgHd_next(pg_hd)) == NULL) \
PgEnt_last(PG_ENT) = NULL; \
else \
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
} \
UNLOCK_PAGE_ENTRY(PG_ENT); \
LOCK_PAGE_ENTRY(GLOBAL_pages_void); \
PUT_FREE_PAGE(pg_hd); \
UNLOCK_PAGE_ENTRY(GLOBAL_pages_void); \
} else { \
STRUCT_NEXT(STR) = (STR_TYPE *) PgHd_first_str(pg_hd); \
if (PgHd_alloc_area(pg_hd) == NULL && PgHd_first_str(pg_hd) == NULL) { \
PgHd_next(pg_hd) = NULL; \
if ((PgHd_previous(pg_hd) = PgEnt_last(PG_ENT)) != NULL) \
PgHd_next(PgHd_previous(pg_hd)) = pg_hd; \
PgEnt_last(PG_ENT) = pg_hd; \
} \
PgHd_first_str(pg_hd) = (void *) STR; \
UNLOCK_PAGE_ENTRY(PG_ENT); \
} \
}
#endif /******************************************************************************/
#endif /***********************************************************************************/
#define ALLOC_TABLE_ENTRY(STR) ALLOC_STRUCT(STR, struct table_entry, GLOBAL_pages_tab_ent, GLOBAL_pages_void)
#define FREE_TABLE_ENTRY(STR) FREE_STRUCT(STR, struct table_entry, GLOBAL_pages_tab_ent, GLOBAL_pages_void)
#define ALLOC_SUBGOAL_ENTRY(STR) ALLOC_STRUCT(STR, struct subgoal_entry, GLOBAL_pages_sg_ent, GLOBAL_pages_void)
#define FREE_SUBGOAL_ENTRY(STR) FREE_STRUCT(STR, struct subgoal_entry, GLOBAL_pages_sg_ent, GLOBAL_pages_void)
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
#define ALLOC_SUBGOAL_FRAME(STR) ALLOC_STRUCT(STR, struct subgoal_frame, GLOBAL_pages_sg_fr, GLOBAL_pages_void)
#define FREE_SUBGOAL_FRAME(STR) FREE_STRUCT(STR, struct subgoal_frame, GLOBAL_pages_sg_fr, GLOBAL_pages_void)
#ifdef THREADS
#define ALLOC_STRUCT(STR, STR_TYPE, _PG_ENT) \
GET_FREE_STRUCT(STR, STR_TYPE, LOCAL##_PG_ENT, GLOBAL##_PG_ENT)
#define FREE_STRUCT(STR, STR_TYPE, _PG_ENT) \
PUT_FREE_STRUCT(STR, STR_TYPE, LOCAL##_PG_ENT)
#else
#define ALLOC_SUBGOAL_FRAME(STR) ALLOC_STRUCT(STR, struct subgoal_frame, LOCAL_pages_sg_fr, LOCAL_pages_void)
#define FREE_SUBGOAL_FRAME(STR) FREE_STRUCT(STR, struct subgoal_frame, LOCAL_pages_sg_fr, LOCAL_pages_void)
#define ALLOC_STRUCT(STR, STR_TYPE, _PG_ENT) \
GET_FREE_STRUCT(STR, STR_TYPE, GLOBAL##_PG_ENT, ___NOT_USED___)
#define FREE_STRUCT(STR, STR_TYPE, _PG_ENT) \
PUT_FREE_STRUCT(STR, STR_TYPE, GLOBAL##_PG_ENT)
#endif
#define ALLOC_NEXT_STRUCT(LOCAL_STR, STR, STR_TYPE, _PG_ENT) \
GET_NEXT_FREE_STRUCT(LOCAL_STR, STR, STR_TYPE, GLOBAL##_PG_ENT)
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
#define ALLOC_DEPENDENCY_FRAME(STR) ALLOC_STRUCT(STR, struct dependency_frame, GLOBAL_pages_dep_fr, GLOBAL_pages_void)
#define FREE_DEPENDENCY_FRAME(STR) FREE_STRUCT(STR, struct dependency_frame, GLOBAL_pages_dep_fr, GLOBAL_pages_void)
#define ALLOC_TABLE_ENTRY(STR) ALLOC_STRUCT(STR, struct table_entry, _pages_tab_ent)
#define FREE_TABLE_ENTRY(STR) FREE_STRUCT(STR, struct table_entry, _pages_tab_ent)
#define ALLOC_SUBGOAL_ENTRY(STR) ALLOC_STRUCT(STR, struct subgoal_entry, _pages_sg_ent)
#define FREE_SUBGOAL_ENTRY(STR) FREE_STRUCT(STR, struct subgoal_entry, _pages_sg_ent)
#define ALLOC_SUBGOAL_FRAME(STR) ALLOC_STRUCT(STR, struct subgoal_frame, _pages_sg_fr)
#define FREE_SUBGOAL_FRAME(STR) FREE_STRUCT(STR, struct subgoal_frame, _pages_sg_fr)
#define ALLOC_DEPENDENCY_FRAME(STR) ALLOC_STRUCT(STR, struct dependency_frame, _pages_dep_fr)
#define FREE_DEPENDENCY_FRAME(STR) FREE_STRUCT(STR, struct dependency_frame, _pages_dep_fr)
#define ALLOC_SUBGOAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct subgoal_trie_node, _pages_sg_node)
#define FREE_SUBGOAL_TRIE_NODE(STR) FREE_STRUCT(STR, struct subgoal_trie_node, _pages_sg_node)
#define ALLOC_SUBGOAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct subgoal_trie_hash, _pages_sg_hash)
#define FREE_SUBGOAL_TRIE_HASH(STR) FREE_STRUCT(STR, struct subgoal_trie_hash, _pages_sg_hash)
#ifdef YAPOR
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_NEXT_STRUCT(LOCAL_next_free_ans_node, STR, struct answer_trie_node, _pages_ans_node)
#else
#define ALLOC_DEPENDENCY_FRAME(STR) ALLOC_STRUCT(STR, struct dependency_frame, LOCAL_pages_dep_fr, LOCAL_pages_void)
#define FREE_DEPENDENCY_FRAME(STR) FREE_STRUCT(STR, struct dependency_frame, LOCAL_pages_dep_fr, LOCAL_pages_void)
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct answer_trie_node, _pages_ans_node)
#endif
#define FREE_ANSWER_TRIE_NODE(STR) FREE_STRUCT(STR, struct answer_trie_node, _pages_ans_node)
#if !defined(THREADS_NO_SHARING)
#if defined(THREADS_SUBGOAL_SHARING) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#define ALLOC_SUBGOAL_TRIE_NODE(STR) LOCAL_NEXT_ALLOC_STRUCT(STR, LOCAL_next_free_sg_node, struct subgoal_trie_node, GLOBAL_pages_sg_node, GLOBAL_pages_void)
#else
#define ALLOC_SUBGOAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct subgoal_trie_node, GLOBAL_pages_sg_node, GLOBAL_pages_void)
#endif
#define FREE_SUBGOAL_TRIE_NODE(STR) FREE_STRUCT(STR, struct subgoal_trie_node, GLOBAL_pages_sg_node, GLOBAL_pages_void)
#else
#define ALLOC_SUBGOAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct subgoal_trie_node, LOCAL_pages_sg_node, LOCAL_pages_void)
#define FREE_SUBGOAL_TRIE_NODE(STR) FREE_STRUCT(STR, struct subgoal_trie_node, LOCAL_pages_sg_node, LOCAL_pages_void)
#endif
#define ALLOC_ANSWER_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct answer_trie_hash, _pages_ans_hash)
#define FREE_ANSWER_TRIE_HASH(STR) FREE_STRUCT(STR, struct answer_trie_hash, _pages_ans_hash)
#if !defined(THREADS_NO_SHARING)
#if defined(THREADS_SUBGOAL_SHARING) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#define ALLOC_SUBGOAL_TRIE_HASH(STR) LOCAL_NEXT_ALLOC_STRUCT(STR, LOCAL_next_free_sg_hash, struct subgoal_trie_hash, GLOBAL_pages_sg_hash, GLOBAL_pages_void)
#else
#define ALLOC_SUBGOAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct subgoal_trie_hash, GLOBAL_pages_sg_hash, GLOBAL_pages_void)
#endif
#define FREE_SUBGOAL_TRIE_HASH(STR) FREE_STRUCT(STR, struct subgoal_trie_hash, GLOBAL_pages_sg_hash, GLOBAL_pages_void)
#else
#define ALLOC_SUBGOAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct subgoal_trie_hash, LOCAL_pages_sg_hash, LOCAL_pages_void)
#define FREE_SUBGOAL_TRIE_HASH(STR) FREE_STRUCT(STR, struct subgoal_trie_hash, LOCAL_pages_sg_hash, LOCAL_pages_void)
#endif
#define ALLOC_ANSWER_REF_NODE(STR) ALLOC_STRUCT(STR, struct answer_ref_node, _pages_ans_ref_node)
#define FREE_ANSWER_REF_NODE(STR) FREE_STRUCT(STR, struct answer_ref_node, _pages_ans_ref_node)
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
#if defined(YAPOR) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#define ALLOC_ANSWER_TRIE_NODE(STR) LOCAL_NEXT_ALLOC_STRUCT(STR, LOCAL_next_free_ans_node, struct answer_trie_node, GLOBAL_pages_ans_node, GLOBAL_pages_void)
#else
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct answer_trie_node, GLOBAL_pages_ans_node, GLOBAL_pages_void)
#endif
#define FREE_ANSWER_TRIE_NODE(STR) FREE_STRUCT(STR, struct answer_trie_node, GLOBAL_pages_ans_node, GLOBAL_pages_void)
#else
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct answer_trie_node, LOCAL_pages_ans_node, LOCAL_pages_void)
#define FREE_ANSWER_TRIE_NODE(STR) FREE_STRUCT(STR, struct answer_trie_node, LOCAL_pages_ans_node, LOCAL_pages_void)
#endif
#define ALLOC_GLOBAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct global_trie_node, _pages_gt_node)
#define FREE_GLOBAL_TRIE_NODE(STR) FREE_STRUCT(STR, struct global_trie_node, _pages_gt_node)
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#define ALLOC_ANSWER_TRIE_HASH(STR) LOCAL_NEXT_ALLOC_STRUCT(STR, LOCAL_next_free_ans_hash, struct answer_trie_hash, GLOBAL_pages_ans_hash, GLOBAL_pages_void)
#else
#define ALLOC_ANSWER_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct answer_trie_hash, GLOBAL_pages_ans_hash, GLOBAL_pages_void)
#endif
#define FREE_ANSWER_TRIE_HASH(STR) FREE_STRUCT(STR, struct answer_trie_hash, GLOBAL_pages_ans_hash, GLOBAL_pages_void)
#else
#define ALLOC_ANSWER_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct answer_trie_hash, LOCAL_pages_ans_hash, LOCAL_pages_void)
#define FREE_ANSWER_TRIE_HASH(STR) FREE_STRUCT(STR, struct answer_trie_hash, LOCAL_pages_ans_hash, LOCAL_pages_void)
#endif
#define ALLOC_GLOBAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct global_trie_hash, _pages_gt_hash)
#define FREE_GLOBAL_TRIE_HASH(STR) FREE_STRUCT(STR, struct global_trie_hash, _pages_gt_hash)
#define ALLOC_ANSWER_REF_NODE(STR) ALLOC_STRUCT(STR, struct answer_ref_node, LOCAL_pages_ans_ref_node, LOCAL_pages_void)
#define FREE_ANSWER_REF_NODE(STR) FREE_STRUCT(STR, struct answer_ref_node, LOCAL_pages_ans_ref_node, LOCAL_pages_void)
#define ALLOC_OR_FRAME(STR) ALLOC_STRUCT(STR, struct or_frame, _pages_or_fr)
#define FREE_OR_FRAME(STR) FREE_STRUCT(STR, struct or_frame, _pages_or_fr)
#define ALLOC_GLOBAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, struct global_trie_node, GLOBAL_pages_gt_node, GLOBAL_pages_void)
#define FREE_GLOBAL_TRIE_NODE(STR) FREE_STRUCT(STR, struct global_trie_node, GLOBAL_pages_gt_node, GLOBAL_pages_void)
#define ALLOC_QG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, struct query_goal_solution_frame, _pages_qg_sol_fr)
#define FREE_QG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, struct query_goal_solution_frame, _pages_qg_sol_fr)
#define ALLOC_GLOBAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, struct global_trie_hash, GLOBAL_pages_gt_hash, GLOBAL_pages_void)
#define FREE_GLOBAL_TRIE_HASH(STR) FREE_STRUCT(STR, struct global_trie_hash, GLOBAL_pages_gt_hash, GLOBAL_pages_void)
#define ALLOC_QG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, struct query_goal_answer_frame, _pages_qg_ans_fr)
#define FREE_QG_ANSWER_FRAME(STR) FREE_STRUCT(STR, struct query_goal_answer_frame, _pages_qg_ans_fr)
#define ALLOC_OR_FRAME(STR) ALLOC_STRUCT(STR, struct or_frame, GLOBAL_pages_or_fr, GLOBAL_pages_void)
#define FREE_OR_FRAME(STR) FREE_STRUCT(STR, struct or_frame, GLOBAL_pages_or_fr, GLOBAL_pages_void)
#define ALLOC_SUSPENSION_FRAME(STR) ALLOC_STRUCT(STR, struct suspension_frame, _pages_susp_fr)
#define FREE_SUSPENSION_FRAME(STR) FREE_BLOCK(SuspFr_global_start(STR)); \
FREE_STRUCT(STR, struct suspension_frame, _pages_susp_fr)
#define ALLOC_QG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, struct query_goal_solution_frame, GLOBAL_pages_qg_sol_fr, GLOBAL_pages_void)
#define FREE_QG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, struct query_goal_solution_frame, GLOBAL_pages_qg_sol_fr, GLOBAL_pages_void)
#define ALLOC_TG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, struct table_subgoal_solution_frame, _pages_tg_sol_fr)
#define FREE_TG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, struct table_subgoal_solution_frame, _pages_tg_sol_fr)
#define ALLOC_QG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, struct query_goal_answer_frame, GLOBAL_pages_qg_ans_fr, GLOBAL_pages_void)
#define FREE_QG_ANSWER_FRAME(STR) FREE_STRUCT(STR, struct query_goal_answer_frame, GLOBAL_pages_qg_ans_fr, GLOBAL_pages_void)
#define ALLOC_SUSPENSION_FRAME(STR) ALLOC_STRUCT(STR, struct suspension_frame, GLOBAL_pages_susp_fr, GLOBAL_pages_void)
#define FREE_SUSPENSION_FRAME(STR) FREE_BLOCK(SuspFr_global_start(STR)); \
FREE_STRUCT(STR, struct suspension_frame, GLOBAL_pages_susp_fr, GLOBAL_pages_void)
#define ALLOC_TG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, struct table_subgoal_solution_frame, GLOBAL_pages_tg_sol_fr, GLOBAL_pages_void)
#define FREE_TG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, struct table_subgoal_solution_frame, GLOBAL_pages_tg_sol_fr, GLOBAL_pages_void)
#define ALLOC_TG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, struct table_subgoal_answer_frame, GLOBAL_pages_tg_ans_fr, GLOBAL_pages_void)
#define FREE_TG_ANSWER_FRAME(STR) FREE_STRUCT(STR, struct table_subgoal_answer_frame, GLOBAL_pages_tg_ans_fr, GLOBAL_pages_void)
#define ALLOC_TG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, struct table_subgoal_answer_frame, _pages_tg_ans_fr)
#define FREE_TG_ANSWER_FRAME(STR) FREE_STRUCT(STR, struct table_subgoal_answer_frame, _pages_tg_ans_fr)

View File

@ -107,87 +107,87 @@ static inline struct page_statistics show_statistics_table_subgoal_answer_frames
struct page_statistics {
#ifdef USE_PAGES_MALLOC
long pages_allocated; /* same as struct pages (opt.structs.h) */
long pages_in_use; /* same as struct pages (opt.structs.h) */
#endif /* USE_PAGES_MALLOC */
long structs_in_use; /* same as struct pages (opt.structs.h) */
long structs_in_use; /* same as struct pages (opt.structs.h) */
long bytes_in_use;
};
#define Pg_bytes_in_use(STATS) STATS.bytes_in_use
#define PgEnt_bytes_in_use(STATS) STATS.bytes_in_use
#ifdef USE_PAGES_MALLOC
#ifdef DEBUG_TABLING
#define CHECK_PAGE_FREE_STRUCTS(STR_TYPE, PAGE) \
{ pg_hd_ptr pg_hd; \
STR_TYPE *aux_ptr; \
long cont = 0; \
pg_hd = Pg_free_pg(PAGE); \
while (pg_hd) { \
aux_ptr = PgHd_free_str(pg_hd); \
while (aux_ptr) { \
cont++; \
aux_ptr = aux_ptr->next; \
} \
pg_hd = PgHd_next(pg_hd); \
} \
TABLING_ERROR_CHECKING(CHECK_PAGE_FREE_STRUCTS, Pg_str_free(PAGE) != cont); \
#define CHECK_PAGE_FREE_STRUCTS(STR_TYPE, PAGE) \
{ pg_hd_ptr pg_hd; \
STR_TYPE *aux_ptr; \
long cont = 0; \
pg_hd = PgEnt_first(PAGE); \
while (pg_hd) { \
aux_ptr = PgHd_first_str(pg_hd); \
while (aux_ptr) { \
cont++; \
aux_ptr = aux_ptr->next; \
} \
pg_hd = PgHd_next(pg_hd); \
} \
TABLING_ERROR_CHECKING(CHECK_PAGE_FREE_STRUCTS, PgEnt_strs_free(PAGE) != cont); \
}
#else
#define CHECK_PAGE_FREE_STRUCTS(STR_TYPE, PAGE)
#endif /* DEBUG_TABLING */
#define INIT_PAGE_STATS(STATS) \
Pg_pg_alloc(STATS) = 0; \
Pg_str_in_use(STATS) = 0
#define INCREMENT_PAGE_STATS(STATS, PAGE) \
Pg_pg_alloc(STATS) += Pg_pg_alloc(PAGE); \
Pg_str_in_use(STATS) += Pg_str_in_use(PAGE)
#define INCREMENT_AUX_STATS(STATS, BYTES, PAGES) \
BYTES += Pg_bytes_in_use(STATS); \
PAGES += Pg_pg_alloc(STATS)
#define SHOW_PAGE_STATS_MSG(STR_NAME) " " STR_NAME " %10ld bytes (%ld pages and %ld structs in use)\n"
#define SHOW_PAGE_STATS_ARGS(STATS, STR_TYPE) Pg_str_in_use(STATS) * sizeof(STR_TYPE), Pg_pg_alloc(STATS), Pg_str_in_use(STATS)
#define INIT_PAGE_STATS(STATS) \
PgEnt_pages_in_use(STATS) = 0; \
PgEnt_strs_in_use(STATS) = 0
#define INCREMENT_PAGE_STATS(STATS, PAGE) \
PgEnt_pages_in_use(STATS) += PgEnt_pages_in_use(PAGE); \
PgEnt_strs_in_use(STATS) += PgEnt_strs_in_use(PAGE)
#define INCREMENT_AUX_STATS(STATS, BYTES, PAGES) \
BYTES += PgEnt_bytes_in_use(STATS); \
PAGES += PgEnt_pages_in_use(STATS)
#define SHOW_PAGE_STATS_MSG(STR_NAME) " " STR_NAME " %10ld bytes (%ld pages and %ld structs in use)\n"
#define SHOW_PAGE_STATS_ARGS(STATS, STR_TYPE) PgEnt_strs_in_use(STATS) * sizeof(STR_TYPE), PgEnt_pages_in_use(STATS), PgEnt_strs_in_use(STATS)
#else /* !USE_PAGES_MALLOC */
#define CHECK_PAGE_FREE_STRUCTS(STR_TYPE, PAGE)
#define INIT_PAGE_STATS(STATS) \
Pg_str_in_use(STATS) = 0
#define INCREMENT_PAGE_STATS(STATS, PAGE) \
Pg_str_in_use(STATS) += Pg_str_in_use(PAGE)
#define INCREMENT_AUX_STATS(STATS, BYTES, PAGES) \
BYTES += Pg_bytes_in_use(STATS)
#define SHOW_PAGE_STATS_MSG(STR_NAME) " " STR_NAME " %10ld bytes (%ld structs in use)\n"
#define SHOW_PAGE_STATS_ARGS(STATS, STR_TYPE) Pg_str_in_use(STATS) * sizeof(STR_TYPE), Pg_str_in_use(STATS)
#define INIT_PAGE_STATS(STATS) \
PgEnt_strs_in_use(STATS) = 0
#define INCREMENT_PAGE_STATS(STATS, PAGE) \
PgEnt_strs_in_use(STATS) += PgEnt_strs_in_use(PAGE)
#define INCREMENT_AUX_STATS(STATS, BYTES, PAGES) \
BYTES += PgEnt_bytes_in_use(STATS)
#define SHOW_PAGE_STATS_MSG(STR_NAME) " " STR_NAME " %10ld bytes (%ld structs in use)\n"
#define SHOW_PAGE_STATS_ARGS(STATS, STR_TYPE) PgEnt_strs_in_use(STATS) * sizeof(STR_TYPE), PgEnt_strs_in_use(STATS)
#endif /* USE_PAGES_MALLOC */
#define GET_GLOBAL_PAGE_STATS(STATS, STR_TYPE, STR_PAGES) \
INIT_PAGE_STATS(STATS); \
CHECK_PAGE_FREE_STRUCTS(STR_TYPE, STR_PAGES); \
INCREMENT_PAGE_STATS(STATS, STR_PAGES); \
Pg_bytes_in_use(STATS) = Pg_str_in_use(STATS) * sizeof(STR_TYPE)
#define GET_REMOTE_PAGE_STATS(STATS, STR_TYPE, STR_PAGES) \
INIT_PAGE_STATS(STATS); \
LOCK(GLOBAL_ThreadHandlesLock); \
{ int wid; \
for (wid = 0; wid < MAX_THREADS; wid++) { \
if (! Yap_local[wid]) \
break; \
if (REMOTE_ThreadHandle(wid).in_use) { \
CHECK_PAGE_FREE_STRUCTS(STR_TYPE, STR_PAGES(wid)); \
INCREMENT_PAGE_STATS(STATS, STR_PAGES(wid)); \
} \
} \
} \
UNLOCK(GLOBAL_ThreadHandlesLock); \
Pg_bytes_in_use(STATS) = Pg_str_in_use(STATS) * sizeof(STR_TYPE)
#define SHOW_GLOBAL_PAGE_STATS(OUT_STREAM, STR_TYPE, STR_PAGES, STR_NAME) \
#ifdef THREADS
#define GET_ALL_PAGE_STATS(STATS, STR_TYPE, _PAGES) \
LOCK(GLOBAL_ThreadHandlesLock); \
CHECK_PAGE_FREE_STRUCTS(STR_TYPE, GLOBAL##_PAGES); \
INCREMENT_PAGE_STATS(STATS, GLOBAL##_PAGES); \
{ int wid; \
for (wid = 0; wid < MAX_THREADS; wid++) { \
if (! Yap_local[wid]) \
break; \
if (REMOTE_ThreadHandle(wid).in_use) { \
CHECK_PAGE_FREE_STRUCTS(STR_TYPE, REMOTE##_PAGES(wid)); \
INCREMENT_PAGE_STATS(STATS, REMOTE##_PAGES(wid)); \
} \
} \
} \
UNLOCK(GLOBAL_ThreadHandlesLock)
#else
#define GET_ALL_PAGE_STATS(STATS, STR_TYPE, _PAGES) \
CHECK_PAGE_FREE_STRUCTS(STR_TYPE, GLOBAL##_PAGES); \
INCREMENT_PAGE_STATS(STATS, GLOBAL##_PAGES)
#endif
#define GET_PAGE_STATS(STATS, STR_TYPE, _PAGES) \
INIT_PAGE_STATS(STATS); \
GET_ALL_PAGE_STATS(STATS, STR_TYPE, _PAGES); \
PgEnt_bytes_in_use(STATS) = PgEnt_strs_in_use(STATS) * sizeof(STR_TYPE)
#define SHOW_PAGE_STATS(OUT_STREAM, STR_TYPE, _PAGES, STR_NAME) \
{ struct page_statistics stats; \
GET_GLOBAL_PAGE_STATS(stats, STR_TYPE, STR_PAGES); \
Sfprintf(OUT_STREAM, SHOW_PAGE_STATS_MSG(STR_NAME), SHOW_PAGE_STATS_ARGS(stats, STR_TYPE)); \
return stats; \
}
#define SHOW_REMOTE_PAGE_STATS(OUT_STREAM, STR_TYPE, STR_PAGES, STR_NAME) \
{ struct page_statistics stats; \
GET_REMOTE_PAGE_STATS(stats, STR_TYPE, STR_PAGES); \
GET_PAGE_STATS(stats, STR_TYPE, _PAGES); \
Sfprintf(OUT_STREAM, SHOW_PAGE_STATS_MSG(STR_NAME), SHOW_PAGE_STATS_ARGS(stats, STR_TYPE)); \
return stats; \
}
@ -643,7 +643,7 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
Sfprintf(out, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
total_bytes, total_pages);
Sfprintf(out, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void));
PgEnt_pages_in_use(GLOBAL_pages_alloc) * Yap_page_size, PgEnt_pages_in_use(GLOBAL_pages_alloc));
#else
Sfprintf(out, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
#endif /* USE_PAGES_MALLOC */
@ -810,7 +810,7 @@ static Int p_show_statistics_or( USES_REGS1 ) {
Sfprintf(out, "Total memory in use (I+II): %10ld bytes (%ld pages in use)\n",
total_bytes, total_pages);
Sfprintf(out, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void));
PgEnt_pages_in_use(GLOBAL_pages_alloc) * Yap_page_size, PgEnt_pages_in_use(GLOBAL_pages_alloc));
#else
Sfprintf(out, "Total memory in use (I+II): %10ld bytes\n", total_bytes);
#endif /* USE_PAGES_MALLOC */
@ -832,6 +832,7 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
#ifdef USE_PAGES_MALLOC
long total_pages = 0;
#endif /* USE_PAGES_MALLOC */
IOSTREAM *out;
Term t = Deref(ARG1);
if (IsVarTerm(t) || !IsAtomTerm(t))
@ -898,7 +899,7 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
Sfprintf(out, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n",
total_bytes, total_pages);
Sfprintf(out, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void));
PgEnt_pages_in_use(GLOBAL_pages_alloc) * Yap_page_size, PgEnt_pages_in_use(GLOBAL_pages_alloc));
#else
Sfprintf(out, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
#endif /* USE_PAGES_MALLOC */
@ -916,129 +917,105 @@ static Int p_get_optyap_statistics( USES_REGS1 ) {
value = IntOfTerm(Deref(ARG1));
#ifdef TABLING
if (value == 0 || value == 1) { /* table_entries */
GET_GLOBAL_PAGE_STATS(stats, struct table_entry, GLOBAL_pages_tab_ent);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct table_entry, _pages_tab_ent);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
if (value == 0 || value == 16) { /* subgoal_entries */
GET_GLOBAL_PAGE_STATS(stats, struct subgoal_entry, GLOBAL_pages_sg_ent);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct subgoal_entry, _pages_sg_ent);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
if (value == 0 || value == 2) { /* subgoal_frames */
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
GET_GLOBAL_PAGE_STATS(stats, struct subgoal_frame, GLOBAL_pages_sg_fr);
#else
GET_REMOTE_PAGE_STATS(stats, struct subgoal_frame, REMOTE_pages_sg_fr);
#endif
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
if (value == 0 || value == 2) { /* subgoal_frames */
GET_PAGE_STATS(stats, struct subgoal_frame, _pages_sg_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 3) { /* dependency_frames */
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
GET_GLOBAL_PAGE_STATS(stats, struct dependency_frame, GLOBAL_pages_dep_fr);
#else
GET_REMOTE_PAGE_STATS(stats, struct dependency_frame, REMOTE_pages_dep_fr);
#endif
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct dependency_frame, _pages_dep_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 6) { /* subgoal_trie_nodes */
#if !defined(THREADS_NO_SHARING)
GET_GLOBAL_PAGE_STATS(stats, struct subgoal_trie_node, GLOBAL_pages_sg_node);
#else
GET_REMOTE_PAGE_STATS(stats, struct subgoal_trie_node, REMOTE_pages_sg_node);
#endif
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct subgoal_trie_node, _pages_sg_node);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 8) { /* subgoal_trie_hashes */
#if !defined(THREADS_NO_SHARING)
GET_GLOBAL_PAGE_STATS(stats, struct subgoal_trie_hash, GLOBAL_pages_sg_hash);
#else
GET_REMOTE_PAGE_STATS(stats, struct subgoal_trie_hash, REMOTE_pages_sg_hash);
#endif
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct subgoal_trie_hash, _pages_sg_hash);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 7) { /* answer_trie_nodes */
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
GET_GLOBAL_PAGE_STATS(stats, struct answer_trie_node, GLOBAL_pages_ans_node);
#else
GET_REMOTE_PAGE_STATS(stats, struct answer_trie_node, REMOTE_pages_ans_node);
#endif
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct answer_trie_node, _pages_ans_node);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 9) { /* answer_trie_hashes */
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
GET_GLOBAL_PAGE_STATS(stats, struct answer_trie_hash, GLOBAL_pages_ans_hash);
#else
GET_REMOTE_PAGE_STATS(stats, struct answer_trie_hash, REMOTE_pages_ans_hash);
#endif
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct answer_trie_hash, _pages_ans_hash);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#if defined(THREADS_FULL_SHARING)
if (value == 0 || value == 17) { /* answer_ref_nodes */
GET_REMOTE_PAGE_STATS(stats, struct answer_ref_node, REMOTE_pages_ans_ref_node);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct answer_ref_node, _pages_ans_ref_node);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#endif /* THREADS_FULL_SHARING */
#endif
if (value == 0 || value == 10) { /* global_trie_nodes */
GET_GLOBAL_PAGE_STATS(stats, struct global_trie_node, GLOBAL_pages_gt_node);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct global_trie_node, _pages_gt_node);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 11) { /* global_trie_hashes */
GET_GLOBAL_PAGE_STATS(stats, struct global_trie_hash, GLOBAL_pages_gt_hash);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct global_trie_hash, _pages_gt_hash);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#endif /* TABLING */
#ifdef YAPOR
if (value == 0 || value == 4) { /* or_frames */
GET_GLOBAL_PAGE_STATS(stats, struct or_frame, GLOBAL_pages_or_fr);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct or_frame, _pages_or_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 12) { /* query_goal_solution_frames */
GET_GLOBAL_PAGE_STATS(stats, struct query_goal_solution_frame, GLOBAL_pages_qg_sol_fr);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct query_goal_solution_frame, _pages_qg_sol_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 13) { /* query_goal_answer_frames */
GET_GLOBAL_PAGE_STATS(stats, struct query_goal_answer_frame, GLOBAL_pages_qg_ans_fr);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct query_goal_answer_frame, _pages_qg_ans_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#endif /* YAPOR */
#if defined(YAPOR) && defined(TABLING)
if (value == 0 || value == 5) { /* suspension_frames */
GET_GLOBAL_PAGE_STATS(stats, struct suspension_frame, GLOBAL_pages_susp_fr);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct suspension_frame, _pages_susp_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#ifdef TABLING_INNER_CUTS
if (value == 0 || value == 14) { /* table_subgoal_solution_frames */
GET_GLOBAL_PAGE_STATS(stats, struct table_subgoal_solution_frame, GLOBAL_pages_tg_sol_fr);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct table_subgoal_solution_frame, _pages_tg_sol_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
if (value == 0 || value == 15) { /* table_subgoal_answer_frames */
GET_GLOBAL_PAGE_STATS(stats, struct table_subgoal_answer_frame, GLOBAL_pages_tg_ans_fr);
bytes += Pg_bytes_in_use(stats);
if (value != 0) structs = Pg_str_in_use(stats);
GET_PAGE_STATS(stats, struct table_subgoal_answer_frame, _pages_tg_ans_fr);
bytes += PgEnt_bytes_in_use(stats);
if (value != 0) structs = PgEnt_strs_in_use(stats);
}
#endif /* TABLING_INNER_CUTS */
#endif /* YAPOR && TABLING */
if (value == 0) { /* total_memory */
#ifdef USE_PAGES_MALLOC
structs = Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size;
structs = PgEnt_pages_in_use(GLOBAL_pages_alloc) * Yap_page_size;
#else
structs = bytes;
#endif /* USE_PAGES_MALLOC */
@ -1082,120 +1059,96 @@ static inline realtime current_time(void) {
#ifdef TABLING
static inline struct page_statistics show_statistics_table_entries(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct table_entry, GLOBAL_pages_tab_ent, "Table entries: ");
SHOW_PAGE_STATS(out, struct table_entry, _pages_tab_ent, "Table entries: ");
}
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
static inline struct page_statistics show_statistics_subgoal_entries(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct subgoal_entry, GLOBAL_pages_sg_ent, "Subgoal entries: ");
SHOW_PAGE_STATS(out, struct subgoal_entry, _pages_sg_ent, "Subgoal entries: ");
}
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
static inline struct page_statistics show_statistics_subgoal_frames(IOSTREAM *out) {
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
SHOW_GLOBAL_PAGE_STATS(out, struct subgoal_frame, GLOBAL_pages_sg_fr, "Subgoal frames: ");
#else
SHOW_REMOTE_PAGE_STATS(out, struct subgoal_frame, REMOTE_pages_sg_fr, "Subgoal frames: ");
#endif
SHOW_PAGE_STATS(out, struct subgoal_frame, _pages_sg_fr, "Subgoal frames: ");
}
static inline struct page_statistics show_statistics_dependency_frames(IOSTREAM *out) {
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
SHOW_GLOBAL_PAGE_STATS(out, struct dependency_frame, GLOBAL_pages_dep_fr, "Dependency frames: ");
#else
SHOW_REMOTE_PAGE_STATS(out, struct dependency_frame, REMOTE_pages_dep_fr, "Dependency frames: ");
#endif
SHOW_PAGE_STATS(out, struct dependency_frame, _pages_dep_fr, "Dependency frames: ");
}
static inline struct page_statistics show_statistics_subgoal_trie_nodes(IOSTREAM *out) {
#if !defined(THREADS_NO_SHARING)
SHOW_GLOBAL_PAGE_STATS(out, struct subgoal_trie_node, GLOBAL_pages_sg_node, "Subgoal trie nodes: ");
#else
SHOW_REMOTE_PAGE_STATS(out, struct subgoal_trie_node, REMOTE_pages_sg_node, "Subgoal trie nodes: ");
#endif
SHOW_PAGE_STATS(out, struct subgoal_trie_node, _pages_sg_node, "Subgoal trie nodes: ");
}
static inline struct page_statistics show_statistics_subgoal_trie_hashes(IOSTREAM *out) {
#if !defined(THREADS_NO_SHARING)
SHOW_GLOBAL_PAGE_STATS(out, struct subgoal_trie_hash, GLOBAL_pages_sg_hash, "Subgoal trie hashes: ");
#else
SHOW_REMOTE_PAGE_STATS(out, struct subgoal_trie_hash, REMOTE_pages_sg_hash, "Subgoal trie hashes: ");
#endif
SHOW_PAGE_STATS(out, struct subgoal_trie_hash, _pages_sg_hash, "Subgoal trie hashes: ");
}
static inline struct page_statistics show_statistics_answer_trie_nodes(IOSTREAM *out) {
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
SHOW_GLOBAL_PAGE_STATS(out, struct answer_trie_node, GLOBAL_pages_ans_node, "Answer trie nodes: ");
#else
SHOW_REMOTE_PAGE_STATS(out, struct answer_trie_node, REMOTE_pages_ans_node, "Answer trie nodes: ");
#endif
SHOW_PAGE_STATS(out, struct answer_trie_node, _pages_ans_node, "Answer trie nodes: ");
}
static inline struct page_statistics show_statistics_answer_trie_hashes(IOSTREAM *out) {
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
SHOW_GLOBAL_PAGE_STATS(out, struct answer_trie_hash, GLOBAL_pages_ans_hash, "Answer trie hashes: ");
#else
SHOW_REMOTE_PAGE_STATS(out, struct answer_trie_hash, REMOTE_pages_ans_hash, "Answer trie hashes: ");
#endif
SHOW_PAGE_STATS(out, struct answer_trie_hash, _pages_ans_hash, "Answer trie hashes: ");
}
#if defined(THREADS_FULL_SHARING)
static inline struct page_statistics show_statistics_answer_ref_nodes(IOSTREAM *out) {
SHOW_REMOTE_PAGE_STATS(out, struct answer_ref_node, REMOTE_pages_ans_ref_node, "Answer ref nodes: ");
SHOW_PAGE_STATS(out, struct answer_ref_node, _pages_ans_ref_node, "Answer ref nodes: ");
}
#endif /* THREADS_FULL_SHARING */
static inline struct page_statistics show_statistics_global_trie_nodes(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct global_trie_node, GLOBAL_pages_gt_node, "Global trie nodes: ");
SHOW_PAGE_STATS(out, struct global_trie_node, _pages_gt_node, "Global trie nodes: ");
}
static inline struct page_statistics show_statistics_global_trie_hashes(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct global_trie_hash, GLOBAL_pages_gt_hash, "Global trie hashes: ");
SHOW_PAGE_STATS(out, struct global_trie_hash, _pages_gt_hash, "Global trie hashes: ");
}
#endif /* TABLING */
#ifdef YAPOR
static inline struct page_statistics show_statistics_or_frames(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct or_frame, GLOBAL_pages_or_fr, "Or-frames: ");
SHOW_PAGE_STATS(out, struct or_frame, _pages_or_fr, "Or-frames: ");
}
static inline struct page_statistics show_statistics_query_goal_solution_frames(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct query_goal_solution_frame, GLOBAL_pages_qg_sol_fr, "Query goal solution frames: ");
SHOW_PAGE_STATS(out, struct query_goal_solution_frame, _pages_qg_sol_fr, "Query goal solution frames: ");
}
static inline struct page_statistics show_statistics_query_goal_answer_frames(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct query_goal_answer_frame, GLOBAL_pages_qg_ans_fr, "Query goal answer frames: ");
SHOW_PAGE_STATS(out, struct query_goal_answer_frame, _pages_qg_ans_fr, "Query goal answer frames: ");
}
#endif /* YAPOR */
#if defined(YAPOR) && defined(TABLING)
static inline struct page_statistics show_statistics_suspension_frames(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct suspension_frame, GLOBAL_pages_susp_fr, "Suspension frames: ");
SHOW_PAGE_STATS(out, struct suspension_frame, _pages_susp_fr, "Suspension frames: ");
}
#ifdef TABLING_INNER_CUTS
static inline struct page_statistics show_statistics_table_subgoal_solution_frames(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct table_subgoal_solution_frame, GLOBAL_pages_tg_sol_fr, "Table subgoal solution frames:");
SHOW_PAGE_STATS(out, struct table_subgoal_solution_frame, _pages_tg_sol_fr, "Table subgoal solution frames:");
}
static inline struct page_statistics show_statistics_table_subgoal_answer_frames(IOSTREAM *out) {
SHOW_GLOBAL_PAGE_STATS(out, struct table_subgoal_answer_frame, GLOBAL_pages_tg_ans_fr, "Table subgoal answer frames: ");
SHOW_PAGE_STATS(out, struct table_subgoal_answer_frame, _pages_tg_ans_fr, "Table subgoal answer frames: ");
}
#endif /* TABLING_INNER_CUTS */
#endif /* YAPOR && TABLING */

View File

@ -20,31 +20,23 @@ typedef unsigned long bitmap;
#ifdef YAPOR_THREADS
/* Threads may not assume addresses are the same at different workers */
static inline choiceptr
offset_to_cptr(Int node)
{
static inline choiceptr offset_to_cptr(Int node) {
CACHE_REGS
return (choiceptr)(LCL0+node);
}
static inline Int
cptr_to_offset(choiceptr node)
{
static inline Int cptr_to_offset(choiceptr node) {
CACHE_REGS
return (Int)((CELL *)node-LCL0);
}
static inline choiceptr
offset_to_cptr_with_null(Int node)
{
static inline choiceptr offset_to_cptr_with_null(Int node) {
CACHE_REGS
if (node == 0L) return NULL;
return (choiceptr)(LCL0+node);
}
static inline Int
cptr_to_offset_with_null(choiceptr node)
{
static inline Int cptr_to_offset_with_null(choiceptr node) {
CACHE_REGS
if (node == NULL) return 0L;
return (Int)((CELL *)node-LCL0);
@ -104,16 +96,18 @@ struct threads_dependency_frame {
#ifdef USE_PAGES_MALLOC
typedef struct page_header {
volatile int structs_in_use;
void *allocated_area;
void *first_free_struct;
struct page_header *previous;
struct page_header *next;
} *pg_hd_ptr;
#endif /* USE_PAGES_MALLOC */
#define PgHd_str_in_use(X) ((X)->structs_in_use)
#define PgHd_free_str(X) ((X)->first_free_struct)
#define PgHd_previous(X) ((X)->previous)
#define PgHd_next(X) ((X)->next)
#define PgHd_strs_in_use(X) ((X)->structs_in_use)
#define PgHd_alloc_area(X) ((X)->allocated_area)
#define PgHd_first_str(X) ((X)->first_free_struct)
#define PgHd_previous(X) ((X)->previous)
#define PgHd_next(X) ((X)->next)
@ -126,31 +120,31 @@ struct global_page_entry {
lockvar lock;
#endif /* YAPOR || THREADS */
#ifdef USE_PAGES_MALLOC
struct page_header *first_free_page;
struct page_header *first_page;
struct page_header *last_page;
int structs_per_page;
volatile long pages_allocated;
volatile long pages_in_use;
#endif /* USE_PAGES_MALLOC */
volatile long structs_in_use;
};
struct local_page_entry {
#if defined(YAPOR) || defined(THREADS)
lockvar lock;
#endif /* YAPOR || THREADS */
#ifdef USE_PAGES_MALLOC
struct page_header *first_free_page;
struct page_header *first_page;
struct page_header *last_page;
int structs_per_page;
volatile long pages_allocated;
long pages_in_use;
#endif /* USE_PAGES_MALLOC */
volatile long structs_in_use;
long structs_in_use;
};
#define Pg_lock(X) ((X).lock)
#define Pg_free_pg(X) ((X).first_free_page)
#define Pg_str_per_pg(X) ((X).structs_per_page)
#define Pg_pg_alloc(X) ((X).pages_allocated)
#define Pg_str_in_use(X) ((X).structs_in_use)
#define Pg_str_free(X) (Pg_pg_alloc(X) * Pg_str_per_pg(X) - Pg_str_in_use(X))
#define PgEnt_lock(X) ((X).lock)
#define PgEnt_first(X) ((X).first_page)
#define PgEnt_last(X) ((X).last_page)
#define PgEnt_strs_per_page(X) ((X).structs_per_page)
#define PgEnt_pages_in_use(X) ((X).pages_in_use)
#define PgEnt_strs_in_use(X) ((X).structs_in_use)
#define PgEnt_strs_free(X) (PgEnt_pg_in_use(X) * PgEnt_str_per_pg(X) - PgEnt_str_in_use(X))
@ -159,39 +153,39 @@ struct local_page_entry {
***************************/
struct global_pages {
struct global_page_entry alloc_pages;
struct global_page_entry void_pages;
#ifdef TABLING
struct global_page_entry table_entry_pages;
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
struct global_page_entry subgoal_entry_pages;
#endif
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
struct global_page_entry subgoal_frame_pages;
struct global_page_entry dependency_frame_pages;
#endif
#if !defined(THREADS_NO_SHARING)
struct global_page_entry subgoal_trie_node_pages;
struct global_page_entry subgoal_trie_hash_pages;
#endif
#if !defined(THREADS_NO_SHARING) && !defined(THREADS_SUBGOAL_SHARING)
struct global_page_entry answer_trie_node_pages;
struct global_page_entry answer_trie_hash_pages;
#if defined(THREADS_FULL_SHARING)
struct global_page_entry answer_ref_node_pages;
#endif
struct global_page_entry global_trie_node_pages;
struct global_page_entry global_trie_hash_pages;
#endif /* TABLING */
#ifdef YAPOR
struct global_page_entry or_frame_pages;
struct global_page_entry query_goal_solution_frame_pages;
struct global_page_entry query_goal_answer_frame_pages;
#endif /* YAPOR */
#if defined(YAPOR) && defined(TABLING)
#ifdef TABLING
struct global_page_entry suspension_frame_pages;
#endif /* YAPOR && TABLING */
#endif
#ifdef TABLING_INNER_CUTS
struct global_page_entry table_subgoal_solution_frame_pages;
struct global_page_entry table_subgoal_answer_frame_pages;
#endif /* TABLING_INNER_CUTS */
#endif
#endif /* YAPOR */
};
@ -202,30 +196,26 @@ struct global_pages {
#if defined(TABLING) && (defined(YAPOR) || defined(THREADS))
struct local_pages {
#if defined(YAPOR)
#ifdef YAPOR
struct answer_trie_node *next_free_answer_trie_node;
#elif defined(THREADS)
#elif THREADS
struct local_page_entry void_pages;
struct local_page_entry table_entry_pages;
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
struct local_page_entry subgoal_entry_pages;
#endif
struct local_page_entry subgoal_frame_pages;
struct local_page_entry dependency_frame_pages;
#if defined(THREADS_NO_SHARING)
struct local_page_entry subgoal_trie_node_pages;
struct local_page_entry subgoal_trie_hash_pages;
#elif defined(THREADS_SUBGOAL_SHARING) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
struct subgoal_trie_node *next_free_subgoal_trie_node;
struct subgoal_trie_hash *next_free_subgoal_trie_hash;
#endif
#if defined(THREADS_NO_SHARING) || defined(THREADS_SUBGOAL_SHARING)
struct local_page_entry answer_trie_node_pages;
struct local_page_entry answer_trie_hash_pages;
#elif defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
struct answer_trie_node *next_free_answer_trie_node;
struct answer_trie_hash *next_free_answer_trie_hash;
#endif
#if defined(THREADS_FULL_SHARING)
struct local_page_entry answer_ref_node_pages;
#endif
#endif /* YAPOR - THREADS */
struct local_page_entry global_trie_node_pages;
struct local_page_entry global_trie_hash_pages;
#endif
};
#endif /* TABLING && (YAPOR || THREADS) */
@ -351,6 +341,7 @@ struct global_optyap_data {
#endif /* TABLING */
};
#define GLOBAL_pages_alloc (GLOBAL_optyap_data.pages.alloc_pages)
#define GLOBAL_pages_void (GLOBAL_optyap_data.pages.void_pages)
#define GLOBAL_pages_tab_ent (GLOBAL_optyap_data.pages.table_entry_pages)
#define GLOBAL_pages_sg_ent (GLOBAL_optyap_data.pages.subgoal_entry_pages)
@ -360,6 +351,7 @@ struct global_optyap_data {
#define GLOBAL_pages_sg_hash (GLOBAL_optyap_data.pages.subgoal_trie_hash_pages)
#define GLOBAL_pages_ans_node (GLOBAL_optyap_data.pages.answer_trie_node_pages)
#define GLOBAL_pages_ans_hash (GLOBAL_optyap_data.pages.answer_trie_hash_pages)
#define GLOBAL_pages_ans_ref_node (GLOBAL_optyap_data.pages.answer_ref_node_pages)
#define GLOBAL_pages_gt_node (GLOBAL_optyap_data.pages.global_trie_node_pages)
#define GLOBAL_pages_gt_hash (GLOBAL_optyap_data.pages.global_trie_hash_pages)
#define GLOBAL_pages_or_fr (GLOBAL_optyap_data.pages.or_frame_pages)
@ -479,6 +471,8 @@ struct local_optyap_data {
};
#define LOCAL_pages_void (LOCAL_optyap_data.pages.void_pages)
#define LOCAL_pages_tab_ent (LOCAL_optyap_data.pages.table_entry_pages)
#define LOCAL_pages_sg_ent (LOCAL_optyap_data.pages.subgoal_entry_pages)
#define LOCAL_pages_sg_fr (LOCAL_optyap_data.pages.subgoal_frame_pages)
#define LOCAL_pages_dep_fr (LOCAL_optyap_data.pages.dependency_frame_pages)
#define LOCAL_pages_sg_node (LOCAL_optyap_data.pages.subgoal_trie_node_pages)
@ -486,10 +480,9 @@ struct local_optyap_data {
#define LOCAL_pages_ans_node (LOCAL_optyap_data.pages.answer_trie_node_pages)
#define LOCAL_pages_ans_hash (LOCAL_optyap_data.pages.answer_trie_hash_pages)
#define LOCAL_pages_ans_ref_node (LOCAL_optyap_data.pages.answer_ref_node_pages)
#define LOCAL_next_free_sg_node (LOCAL_optyap_data.pages.next_free_subgoal_trie_node)
#define LOCAL_next_free_sg_hash (LOCAL_optyap_data.pages.next_free_subgoal_trie_hash)
#define LOCAL_pages_gt_node (LOCAL_optyap_data.pages.global_trie_node_pages)
#define LOCAL_pages_gt_hash (LOCAL_optyap_data.pages.global_trie_hash_pages)
#define LOCAL_next_free_ans_node (LOCAL_optyap_data.pages.next_free_answer_trie_node)
#define LOCAL_next_free_ans_hash (LOCAL_optyap_data.pages.next_free_answer_trie_hash)
#define LOCAL_lock (LOCAL_optyap_data.lock)
#define LOCAL_load (LOCAL_optyap_data.load)
#ifdef YAPOR_THREADS
@ -538,6 +531,8 @@ struct local_optyap_data {
#define LOCAL_ma_hash_table (LOCAL_optyap_data.ma_hash_table)
#define REMOTE_pages_void(wid) (REMOTE(wid)->optyap_data_.pages.void_pages)
#define REMOTE_pages_tab_ent(wid) (REMOTE(wid)->optyap_data_.pages.table_entry_pages)
#define REMOTE_pages_sg_ent(wid) (REMOTE(wid)->optyap_data_.pages.subgoal_entry_pages)
#define REMOTE_pages_sg_fr(wid) (REMOTE(wid)->optyap_data_.pages.subgoal_frame_pages)
#define REMOTE_pages_dep_fr(wid) (REMOTE(wid)->optyap_data_.pages.dependency_frame_pages)
#define REMOTE_pages_sg_node(wid) (REMOTE(wid)->optyap_data_.pages.subgoal_trie_node_pages)
@ -545,10 +540,9 @@ struct local_optyap_data {
#define REMOTE_pages_ans_node(wid) (REMOTE(wid)->optyap_data_.pages.answer_trie_node_pages)
#define REMOTE_pages_ans_hash(wid) (REMOTE(wid)->optyap_data_.pages.answer_trie_hash_pages)
#define REMOTE_pages_ans_ref_node(wid) (REMOTE(wid)->optyap_data_.pages.answer_ref_node_pages)
#define REMOTE_next_free_sg_node(wid) (REMOTE(wid)->optyap_data_.pages.next_free_subgoal_trie_node)
#define REMOTE_next_free_sg_hash(wid) (REMOTE(wid)->optyap_data_.pages.next_free_subgoal_trie_hash)
#define REMOTE_pages_gt_node(wid) (REMOTE(wid)->optyap_data_.pages.global_trie_node_pages)
#define REMOTE_pages_gt_hash(wid) (REMOTE(wid)->optyap_data_.pages.global_trie_hash_pages)
#define REMOTE_next_free_ans_node(wid) (REMOTE(wid)->optyap_data_.pages.next_free_answer_trie_node)
#define REMOTE_next_free_ans_hash(wid) (REMOTE(wid)->optyap_data_.pages.next_free_answer_trie_hash)
#define REMOTE_lock(wid) (REMOTE(wid)->optyap_data_.lock)
#define REMOTE_load(wid) (REMOTE(wid)->optyap_data_.load)
#ifdef YAPOR_THREADS

View File

@ -193,27 +193,27 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
#endif /* DETERMINISTIC_TABLING */
/* tagging nodes */
#define TAG_AS_SUBGOAL_LEAF_NODE(NODE) TrNode_child(NODE) = (sg_node_ptr)((unsigned long int) TrNode_child(NODE) | 0x1)
#define IS_SUBGOAL_LEAF_NODE(NODE) ((unsigned long int) TrNode_child(NODE) & 0x1)
#define TAG_AS_ANSWER_LEAF_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((unsigned long int) TrNode_parent(NODE) | 0x1)
#define IS_ANSWER_LEAF_NODE(NODE) ((unsigned long int) TrNode_parent(NODE) & 0x1)
#define TAG_AS_ANSWER_INVALID_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((unsigned long int) TrNode_parent(NODE) | 0x2)
#define IS_ANSWER_INVALID_NODE(NODE) ((unsigned long int) TrNode_parent(NODE) & 0x2)
#define UNTAG_SUBGOAL_NODE(NODE) ((unsigned long int) (NODE) & ~(0x1))
#define UNTAG_ANSWER_NODE(NODE) ((unsigned long int) (NODE) & ~(0x3))
#define TAG_AS_SUBGOAL_LEAF_NODE(NODE) TrNode_child(NODE) = (sg_node_ptr)((CELL) TrNode_child(NODE) | 0x1)
#define IS_SUBGOAL_LEAF_NODE(NODE) ((CELL) TrNode_child(NODE) & 0x1)
#define TAG_AS_ANSWER_LEAF_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((CELL) TrNode_parent(NODE) | 0x1)
#define IS_ANSWER_LEAF_NODE(NODE) ((CELL) TrNode_parent(NODE) & 0x1)
#define TAG_AS_ANSWER_INVALID_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((CELL) TrNode_parent(NODE) | 0x2)
#define IS_ANSWER_INVALID_NODE(NODE) ((CELL) TrNode_parent(NODE) & 0x2)
#define UNTAG_SUBGOAL_NODE(NODE) ((CELL) (NODE) & ~(0x1))
#define UNTAG_ANSWER_NODE(NODE) ((CELL) (NODE) & ~(0x3))
/* trie hashes */
#define MAX_NODES_PER_TRIE_LEVEL 8
#define MAX_NODES_PER_BUCKET (MAX_NODES_PER_TRIE_LEVEL / 2)
#define BASE_HASH_BUCKETS 64
#define HASH_ENTRY(ENTRY, NUM_BUCKETS) ((((unsigned long int) ENTRY) >> NumberOfLowTagBits) & (NUM_BUCKETS - 1))
#define HASH_ENTRY(ENTRY, NUM_BUCKETS) ((((CELL) ENTRY) >> NumberOfLowTagBits) & (NUM_BUCKETS - 1))
#define SUBGOAL_TRIE_HASH_MARK ((Term) MakeTableVarTerm(MAX_TABLE_VARS))
#define IS_SUBGOAL_TRIE_HASH(NODE) (TrNode_entry(NODE) == SUBGOAL_TRIE_HASH_MARK)
#define ANSWER_TRIE_HASH_MARK 0
#define IS_ANSWER_TRIE_HASH(NODE) (TrNode_instr(NODE) == ANSWER_TRIE_HASH_MARK)
#define GLOBAL_TRIE_HASH_MARK ((Term) MakeTableVarTerm(MAX_TABLE_VARS))
#define IS_GLOBAL_TRIE_HASH(NODE) (TrNode_entry(NODE) == GLOBAL_TRIE_HASH_MARK)
#define HASH_TRIE_LOCK(NODE) GLOBAL_trie_locks((((unsigned long int) (NODE)) >> 5) & (TRIE_LOCK_BUCKETS - 1))
#define HASH_TRIE_LOCK(NODE) GLOBAL_trie_locks((((CELL) (NODE)) >> 5) & (TRIE_LOCK_BUCKETS - 1))
/* auxiliary stack */
#define STACK_PUSH_UP(ITEM, STACK) *--(STACK) = (CELL)(ITEM)
@ -449,9 +449,9 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
/* ... pointing to SgEnt_first_answer(SgFr_sg_ent(SG_FR)) */ \
if (SG_FR) \
DepFr_last_answer(DEP_FR) = (ans_node_ptr) ( \
(unsigned long int) (SgFr_sg_ent((sg_fr_ptr)SG_FR)) + \
(unsigned long int) (&SgEnt_first_answer((sg_ent_ptr)DEP_FR)) - \
(unsigned long int) (&TrNode_child((ans_node_ptr)DEP_FR))); \
(CELL) (SgFr_sg_ent((sg_fr_ptr)SG_FR)) + \
(CELL) (&SgEnt_first_answer((sg_ent_ptr)DEP_FR)) - \
(CELL) (&TrNode_child((ans_node_ptr)DEP_FR))); \
else \
DepFr_last_answer(DEP_FR) = NULL
#else
@ -460,9 +460,9 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
/* ... pointing to SgFr_first_answer(SG_FR) */ \
if (SG_FR) \
DepFr_last_answer(DEP_FR) = (ans_node_ptr) ( \
(unsigned long int) (SG_FR) + \
(unsigned long int) (&SgFr_first_answer((sg_fr_ptr)DEP_FR)) - \
(unsigned long int) (&TrNode_child((ans_node_ptr)DEP_FR))); \
(CELL) (SG_FR) + \
(CELL) (&SgFr_first_answer((sg_fr_ptr)DEP_FR)) - \
(CELL) (&TrNode_child((ans_node_ptr)DEP_FR))); \
else \
DepFr_last_answer(DEP_FR) = NULL
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
@ -744,7 +744,7 @@ static inline sg_node_ptr get_subgoal_trie_for_abolish(tab_ent_ptr tab_ent USES_
sg_node_ptr *sg_node_addr = (sg_node_ptr *) get_thread_bucket((void **) &TabEnt_subgoal_trie(tab_ent));
sg_node_ptr sg_node = *sg_node_addr;
*sg_node_addr = NULL;
if (worker_id == 0)
if (GLOBAL_NOfThreads == 1)
abolish_thread_buckets((void **) &TabEnt_subgoal_trie(tab_ent));
return sg_node;
#else
@ -804,7 +804,7 @@ static inline sg_fr_ptr get_subgoal_frame_for_abolish(sg_node_ptr sg_node USES_R
#if defined(THREADS_SUBGOAL_SHARING)
sg_fr_ptr *sg_fr_addr = (sg_fr_ptr *) get_thread_bucket((void **) UNTAG_SUBGOAL_NODE(TrNode_sg_fr(sg_node)));
sg_fr_ptr sg_fr = *sg_fr_addr;
if (worker_id == 0)
if (GLOBAL_NOfThreads == 1)
abolish_thread_buckets((void **) UNTAG_SUBGOAL_NODE(TrNode_sg_fr(sg_node)));
else
*sg_fr_addr = NULL;
@ -812,7 +812,7 @@ static inline sg_fr_ptr get_subgoal_frame_for_abolish(sg_node_ptr sg_node USES_R
#elif defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
sg_fr_ptr *sg_fr_addr = (sg_fr_ptr *) get_thread_bucket((void **) &SgEnt_sg_fr((sg_ent_ptr) UNTAG_SUBGOAL_NODE(TrNode_sg_fr(sg_node))));
sg_fr_ptr sg_fr = *sg_fr_addr;
if (worker_id == 0)
if (GLOBAL_NOfThreads == 1)
abolish_thread_buckets((void **) &SgEnt_sg_fr((sg_ent_ptr) UNTAG_SUBGOAL_NODE(TrNode_sg_fr(sg_node))));
else
*sg_fr_addr = NULL;

View File

@ -21,28 +21,32 @@
#include "YapHeap.h"
#include "tab.macros.h"
static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr, sg_node_ptr, Term);
static inline sg_node_ptr subgoal_trie_check_insert_gt_entry(tab_ent_ptr, sg_node_ptr, Term);
static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr, ans_node_ptr, Term, int);
static inline ans_node_ptr answer_trie_check_insert_gt_entry(sg_fr_ptr, ans_node_ptr, Term, int);
static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr, Term);
static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr, sg_node_ptr, Term USES_REGS);
static inline sg_node_ptr subgoal_trie_check_insert_gt_entry(tab_ent_ptr, sg_node_ptr, Term USES_REGS);
static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr, ans_node_ptr, Term, int USES_REGS);
static inline ans_node_ptr answer_trie_check_insert_gt_entry(sg_fr_ptr, ans_node_ptr, Term, int USES_REGS);
static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr, Term USES_REGS);
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
static inline gt_node_ptr global_trie_check_insert_gt_entry(gt_node_ptr, Term);
static inline gt_node_ptr global_trie_check_insert_gt_entry(gt_node_ptr, Term USES_REGS);
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr, sg_node_ptr, Term, int *, CELL **);
static inline sg_node_ptr subgoal_search_terms_loop(tab_ent_ptr, sg_node_ptr, Term, int *, CELL **);
static inline ans_node_ptr answer_search_loop(sg_fr_ptr, ans_node_ptr, Term, int *);
static inline ans_node_ptr answer_search_terms_loop(sg_fr_ptr, ans_node_ptr, Term, int *);
static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr, sg_node_ptr, Term, int *, CELL ** USES_REGS);
static inline sg_node_ptr subgoal_search_terms_loop(tab_ent_ptr, sg_node_ptr, Term, int *, CELL ** USES_REGS);
static inline ans_node_ptr answer_search_loop(sg_fr_ptr, ans_node_ptr, Term, int * USES_REGS);
static inline ans_node_ptr answer_search_terms_loop(sg_fr_ptr, ans_node_ptr, Term, int * USES_REGS);
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
static inline gt_node_ptr subgoal_search_global_trie_terms_loop(Term, int *, CELL **, CELL *);
static inline gt_node_ptr answer_search_global_trie_terms_loop(Term, int *, CELL *);
static inline gt_node_ptr subgoal_search_global_trie_terms_loop(Term, int *, CELL **, CELL * USES_REGS);
static inline gt_node_ptr answer_search_global_trie_terms_loop(Term, int *, CELL * USES_REGS);
#else
static inline gt_node_ptr subgoal_search_global_trie_loop(Term, int *, CELL **);
static inline gt_node_ptr answer_search_global_trie_loop(Term, int *);
static inline gt_node_ptr subgoal_search_global_trie_loop(Term, int *, CELL ** USES_REGS);
static inline gt_node_ptr answer_search_global_trie_loop(Term, int * USES_REGS);
#endif /* GLOBAL_TRIE_MODE */
static inline CELL *load_answer_loop(ans_node_ptr);
static inline CELL *load_substitution_loop(gt_node_ptr, int *, CELL *);
static inline CELL *exec_substitution_loop(gt_node_ptr, CELL **, CELL *);
static inline CELL *load_answer_loop(ans_node_ptr USES_REGS);
static inline CELL *load_substitution_loop(gt_node_ptr, int *, CELL * USES_REGS);
static inline CELL *exec_substitution_loop(gt_node_ptr, CELL **, CELL * USES_REGS);
#ifdef MODE_DIRECTED_TABLING
static inline ans_node_ptr answer_search_min_max(sg_fr_ptr, ans_node_ptr, Term, int USES_REGS);
static void invalidate_answer_trie(ans_node_ptr, sg_fr_ptr, int USES_REGS);
#endif /* MODE_DIRECTED_TABLING */
#ifdef YAPOR
#ifdef TABLING_INNER_CUTS
@ -54,15 +58,15 @@ static int update_answer_trie_branch(ans_node_ptr);
static void update_answer_trie_branch(ans_node_ptr, int);
#endif
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
static void free_global_trie_branch(gt_node_ptr, int);
static void free_global_trie_branch(gt_node_ptr, int USES_REGS);
#else
static void free_global_trie_branch(gt_node_ptr);
static void free_global_trie_branch(gt_node_ptr USES_REGS);
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
static void traverse_subgoal_trie(sg_node_ptr, char *, int, int *, int, int);
static void traverse_answer_trie(ans_node_ptr, char *, int, int *, int, int, int);
static void traverse_global_trie(gt_node_ptr, char *, int, int *, int, int);
static void traverse_global_trie_for_term(gt_node_ptr, char *, int *, int *, int *, int);
static inline void traverse_trie_node(Term, char *, int *, int *, int *, int);
static void traverse_subgoal_trie(sg_node_ptr, char *, int, int *, int, int USES_REGS);
static void traverse_answer_trie(ans_node_ptr, char *, int, int *, int, int, int USES_REGS);
static void traverse_global_trie(gt_node_ptr, char *, int, int *, int, int USES_REGS);
static void traverse_global_trie_for_term(gt_node_ptr, char *, int *, int *, int *, int USES_REGS);
static inline void traverse_trie_node(Term, char *, int *, int *, int *, int USES_REGS);
static inline void traverse_update_arity(char *, int *, int *);
@ -123,13 +127,13 @@ static struct trie_statistics{
#endif /*THREADS */
#if defined(THREADS_SUBGOAL_SHARING) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#define IF_ABOLISH_SUBGOAL_TRIE_SHARED_DATA_STRUCTURES if (worker_id == 0)
#define IF_ABOLISH_SUBGOAL_TRIE_SHARED_DATA_STRUCTURES if (GLOBAL_NOfThreads == 1)
#else
#define IF_ABOLISH_SUBGOAL_TRIE_SHARED_DATA_STRUCTURES
#endif /* THREADS_SUBGOAL_SHARING || THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
#define IF_ABOLISH_ANSWER_TRIE_SHARED_DATA_STRUCTURES if (worker_id == 0)
#define IF_ABOLISH_ANSWER_TRIE_SHARED_DATA_STRUCTURES if (GLOBAL_NOfThreads == 1)
#else
#define IF_ABOLISH_ANSWER_TRIE_SHARED_DATA_STRUCTURES
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
@ -151,11 +155,11 @@ static struct trie_statistics{
#define CHECK_DECREMENT_GLOBAL_TRIE_FOR_SUBTERMS_REFERENCE(REF,MODE) \
CHECK_DECREMENT_GLOBAL_TRIE_REFERENCE(REF,MODE)
#define FREE_GLOBAL_TRIE_BRANCH(NODE,MODE) \
free_global_trie_branch(NODE,MODE)
free_global_trie_branch(NODE,MODE PASS_REGS)
#else
#define CHECK_DECREMENT_GLOBAL_TRIE_FOR_SUBTERMS_REFERENCE(REF,MODE)
#define FREE_GLOBAL_TRIE_BRANCH(NODE,MODE) \
free_global_trie_branch(NODE)
free_global_trie_branch(NODE PASS_REGS)
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
@ -218,7 +222,7 @@ static struct trie_statistics{
static inline CELL *exec_substitution_loop(gt_node_ptr current_node, CELL **stack_vars_ptr, CELL *stack_terms) {
static inline CELL *exec_substitution_loop(gt_node_ptr current_node, CELL **stack_vars_ptr, CELL *stack_terms USES_REGS) {
/************************************************************************
===========
| |
@ -256,7 +260,6 @@ static inline CELL *exec_substitution_loop(gt_node_ptr current_node, CELL **stac
LOCAL_TrailTop --> | | <-- stack_terms_base (TRIE_COMPACT_PAIRS)
-----------
************************************************************************/
CACHE_REGS
CELL *stack_vars = *stack_vars_ptr;
CELL *stack_terms_limit = (CELL *) TR;
#ifdef TRIE_COMPACT_PAIRS
@ -270,7 +273,7 @@ static inline CELL *exec_substitution_loop(gt_node_ptr current_node, CELL **stac
if (IsVarTerm(t)) {
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
if (t > VarIndexOfTableTerm(MAX_TABLE_VARS)) {
stack_terms = exec_substitution_loop((gt_node_ptr) t, &stack_vars, stack_terms);
stack_terms = exec_substitution_loop((gt_node_ptr) t, &stack_vars, stack_terms PASS_REGS);
} else
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
{
@ -477,10 +480,10 @@ static void update_answer_trie_branch(ans_node_ptr current_node, int position) {
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
static void free_global_trie_branch(gt_node_ptr current_node, int mode) {
static void free_global_trie_branch(gt_node_ptr current_node, int mode USES_REGS) {
Term t = TrNode_entry(current_node);
#else
static void free_global_trie_branch(gt_node_ptr current_node) {
static void free_global_trie_branch(gt_node_ptr current_node USES_REGS) {
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
gt_node_ptr parent_node, child_node;
@ -578,8 +581,7 @@ static void free_global_trie_branch(gt_node_ptr current_node) {
}
static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_index, int *arity, int mode, int position) {
CACHE_REGS
static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_index, int *arity, int mode, int position USES_REGS) {
int *current_arity = NULL, current_str_index = 0, current_mode = 0;
/* test if hashing */
@ -593,7 +595,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_i
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1));
do {
if (*bucket) {
traverse_subgoal_trie(*bucket, str, str_index, arity, mode, TRAVERSE_POSITION_FIRST);
traverse_subgoal_trie(*bucket, str, str_index, arity, mode, TRAVERSE_POSITION_FIRST PASS_REGS);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
@ -618,7 +620,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_i
/* process current trie node */
TrStat_sg_nodes++;
traverse_trie_node(TrNode_entry(current_node), str, &str_index, arity, &mode, TRAVERSE_TYPE_SUBGOAL);
traverse_trie_node(TrNode_entry(current_node), str, &str_index, arity, &mode, TRAVERSE_TYPE_SUBGOAL PASS_REGS);
/* show answers ... */
if (IS_SUBGOAL_LEAF_NODE(current_node)) {
@ -641,7 +643,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_i
SHOW_TABLE_STRUCTURE(" TRUE\n");
} else {
arity[0] = 0;
traverse_answer_trie(TrNode_child(SgFr_answer_trie(sg_fr)), &str[str_index], 0, arity, 0, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
traverse_answer_trie(TrNode_child(SgFr_answer_trie(sg_fr)), &str[str_index], 0, arity, 0, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST PASS_REGS);
if (SgFr_state(sg_fr) < complete) {
TrStat_sg_incomplete++;
SHOW_TABLE_STRUCTURE(" ---> INCOMPLETE\n");
@ -650,7 +652,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_i
}
} else
/* ... or continue with child node */
traverse_subgoal_trie(TrNode_child(current_node), str, str_index, arity, mode, TRAVERSE_POSITION_FIRST);
traverse_subgoal_trie(TrNode_child(current_node), str, str_index, arity, mode, TRAVERSE_POSITION_FIRST PASS_REGS);
/* restore the initial state and continue with sibling nodes */
if (position == TRAVERSE_POSITION_FIRST) {
str_index = current_str_index;
@ -665,7 +667,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_i
if (arity[arity[0]] == -1)
str[str_index - 1] = '|';
#endif /* TRIE_COMPACT_PAIRS */
traverse_subgoal_trie(current_node, str, str_index, arity, mode, TRAVERSE_POSITION_NEXT);
traverse_subgoal_trie(current_node, str, str_index, arity, mode, TRAVERSE_POSITION_NEXT PASS_REGS);
current_node = TrNode_next(current_node);
}
free(current_arity);
@ -674,8 +676,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str, int str_i
}
static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_index, int *arity, int var_index, int mode, int position) {
CACHE_REGS
static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_index, int *arity, int var_index, int mode, int position USES_REGS) {
int *current_arity = NULL, current_str_index = 0, current_var_index = 0, current_mode = 0;
/* test if hashing */
@ -689,7 +690,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_i
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1));
do {
if (*bucket) {
traverse_answer_trie(*bucket, str, str_index, arity, var_index, mode, TRAVERSE_POSITION_FIRST);
traverse_answer_trie(*bucket, str, str_index, arity, var_index, mode, TRAVERSE_POSITION_FIRST PASS_REGS);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
@ -721,7 +722,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_i
/* process current trie node */
TrStat_ans_nodes++;
traverse_trie_node(TrNode_entry(current_node), str, &str_index, arity, &mode, TRAVERSE_TYPE_ANSWER);
traverse_trie_node(TrNode_entry(current_node), str, &str_index, arity, &mode, TRAVERSE_TYPE_ANSWER PASS_REGS);
/* show answer .... */
if (IS_ANSWER_LEAF_NODE(current_node)) {
@ -738,7 +739,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_i
#endif /* TABLING_INNER_CUTS */
/* ... or continue with child node */
else
traverse_answer_trie(TrNode_child(current_node), str, str_index, arity, var_index, mode, TRAVERSE_POSITION_FIRST);
traverse_answer_trie(TrNode_child(current_node), str, str_index, arity, var_index, mode, TRAVERSE_POSITION_FIRST PASS_REGS);
/* restore the initial state and continue with sibling nodes */
if (position == TRAVERSE_POSITION_FIRST) {
@ -755,7 +756,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_i
if (arity[arity[0]] == -1)
str[str_index - 1] = '|';
#endif /* TRIE_COMPACT_PAIRS */
traverse_answer_trie(current_node, str, str_index, arity, var_index, mode, TRAVERSE_POSITION_NEXT);
traverse_answer_trie(current_node, str, str_index, arity, var_index, mode, TRAVERSE_POSITION_NEXT PASS_REGS);
current_node = TrNode_next(current_node);
}
free(current_arity);
@ -765,8 +766,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str, int str_i
}
static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_index, int *arity, int mode, int position) {
CACHE_REGS
static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_index, int *arity, int mode, int position USES_REGS) {
int *current_arity = NULL, current_str_index = 0, current_mode = 0;
/* test if hashing */
@ -780,7 +780,7 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_in
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1));
do {
if (*bucket) {
traverse_global_trie(*bucket, str, str_index, arity, mode, TRAVERSE_POSITION_FIRST);
traverse_global_trie(*bucket, str, str_index, arity, mode, TRAVERSE_POSITION_FIRST PASS_REGS);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
@ -805,11 +805,11 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_in
/* process current trie node */
TrStat_gt_nodes++;
traverse_trie_node(TrNode_entry(current_node), str, &str_index, arity, &mode, TRAVERSE_TYPE_GT_SUBGOAL);
traverse_trie_node(TrNode_entry(current_node), str, &str_index, arity, &mode, TRAVERSE_TYPE_GT_SUBGOAL PASS_REGS);
/* continue with child node ... */
if (arity[0] != 0 || mode != TRAVERSE_MODE_NORMAL)
traverse_global_trie(TrNode_child(current_node), str, str_index, arity, mode, TRAVERSE_POSITION_FIRST);
traverse_global_trie(TrNode_child(current_node), str, str_index, arity, mode, TRAVERSE_POSITION_FIRST PASS_REGS);
/* ... or show term */
else {
TrStat_gt_terms++;
@ -831,7 +831,7 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_in
if (arity[arity[0]] == -1)
str[str_index - 1] = '|';
#endif /* TRIE_COMPACT_PAIRS */
traverse_global_trie(current_node, str, str_index, arity, mode, TRAVERSE_POSITION_NEXT);
traverse_global_trie(current_node, str, str_index, arity, mode, TRAVERSE_POSITION_NEXT PASS_REGS);
current_node = TrNode_next(current_node);
}
free(current_arity);
@ -841,16 +841,15 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_in
}
static void traverse_global_trie_for_term(gt_node_ptr current_node, char *str, int *str_index, int *arity, int *mode, int type) {
static void traverse_global_trie_for_term(gt_node_ptr current_node, char *str, int *str_index, int *arity, int *mode, int type USES_REGS) {
if (TrNode_parent(current_node) != GLOBAL_root_gt)
traverse_global_trie_for_term(TrNode_parent(current_node), str, str_index, arity, mode, type);
traverse_trie_node(TrNode_entry(current_node), str, str_index, arity, mode, type);
traverse_global_trie_for_term(TrNode_parent(current_node), str, str_index, arity, mode, type PASS_REGS);
traverse_trie_node(TrNode_entry(current_node), str, str_index, arity, mode, type PASS_REGS);
return;
}
static inline void traverse_trie_node(Term t, char *str, int *str_index_ptr, int *arity, int *mode_ptr, int type) {
CACHE_REGS
static inline void traverse_trie_node(Term t, char *str, int *str_index_ptr, int *arity, int *mode_ptr, int type USES_REGS) {
int mode = *mode_ptr;
int str_index = *str_index_ptr;
@ -903,7 +902,7 @@ static inline void traverse_trie_node(Term t, char *str, int *str_index_ptr, int
TrStat_gt_refs++;
/* (type % 2 + 2): TRAVERSE_TYPE_ANSWER --> TRAVERSE_TYPE_GT_ANSWER */
/* (type % 2 + 2): TRAVERSE_TYPE_SUBGOAL --> TRAVERSE_TYPE_GT_SUBGOAL */
traverse_global_trie_for_term((gt_node_ptr) t, str, &str_index, arity, &mode, type % 2 + 2);
traverse_global_trie_for_term((gt_node_ptr) t, str, &str_index, arity, &mode, type % 2 + 2 PASS_REGS);
} else {
if (type == TRAVERSE_TYPE_SUBGOAL || type == TRAVERSE_TYPE_GT_SUBGOAL)
str_index += sprintf(& str[str_index], "VAR%d", VarIndexOfTableTerm(t));
@ -1037,7 +1036,7 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
int old_subs_arity = subs_arity;
for (i = 1; i <= pred_arity; i++) {
int j = MODE_DIRECTED_GET_ARG(mode_directed[i-1]) + 1;
current_sg_node = subgoal_search_loop(tab_ent, current_sg_node, Deref(XREGS[j]), &subs_arity, &stack_vars);
current_sg_node = subgoal_search_loop(tab_ent, current_sg_node, Deref(XREGS[j]), &subs_arity, &stack_vars PASS_REGS);
if (subs_arity != old_subs_arity) {
if (subs_pos && MODE_DIRECTED_GET_MODE(aux_mode_directed[subs_pos-1]) == MODE_DIRECTED_GET_MODE(mode_directed[i-1])) {
/* same mode as before -> use the current entry in the aux_mode_directed[] array */
@ -1054,10 +1053,10 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
#endif /* MODE_DIRECTED_TABLING */
if (IsMode_GlobalTrie(TabEnt_mode(tab_ent))) {
for (i = 1; i <= pred_arity; i++)
current_sg_node = subgoal_search_terms_loop(tab_ent, current_sg_node, Deref(XREGS[i]), &subs_arity, &stack_vars);
current_sg_node = subgoal_search_terms_loop(tab_ent, current_sg_node, Deref(XREGS[i]), &subs_arity, &stack_vars PASS_REGS);
} else {
for (i = 1; i <= pred_arity; i++)
current_sg_node = subgoal_search_loop(tab_ent, current_sg_node, Deref(XREGS[i]), &subs_arity, &stack_vars);
current_sg_node = subgoal_search_loop(tab_ent, current_sg_node, Deref(XREGS[i]), &subs_arity, &stack_vars PASS_REGS);
}
STACK_PUSH_UP(subs_arity, stack_vars);
@ -1068,7 +1067,7 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
RESET_VARIABLE(t);
}
volatile sg_fr_ptr *sg_fr_end = get_insert_subgoal_frame_addr(current_sg_node PASS_REGS);
sg_fr_ptr *sg_fr_end = get_insert_subgoal_frame_addr(current_sg_node PASS_REGS);
#ifndef THREADS
LOCK_SUBGOAL_NODE(current_sg_node);
#endif /* !THREADS */
@ -1084,6 +1083,7 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
#if !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
new_subgoal_frame(sg_fr, preg, mode_directed);
*sg_fr_end = sg_fr;
__sync_synchronize();
TAG_AS_SUBGOAL_LEAF_NODE(current_sg_node);
UNLOCK_SUBGOAL_NODE(current_sg_node);
#else /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
@ -1139,12 +1139,12 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
if (IsMode_GlobalTrie(TabEnt_mode(SgFr_tab_ent(sg_fr)))) {
for (i = subs_arity; i >= 1; i--) {
TABLING_ERROR_CHECKING(answer_search, IsNonVarTerm(subs_ptr[i]));
current_ans_node = answer_search_terms_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_terms_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
}
} else {
for (i = subs_arity; i >= 1; i--) {
TABLING_ERROR_CHECKING(answer_search, IsNonVarTerm(subs_ptr[i]));
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
}
}
@ -1181,7 +1181,7 @@ ans_node_ptr mode_directed_answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
do {
TABLING_ERROR_CHECKING(answer_search, IsNonVarTerm(subs_ptr[i]));
if (mode == MODE_DIRECTED_INDEX || mode == MODE_DIRECTED_ALL) {
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
} else {
LOCK_ANSWER_NODE(current_ans_node);
if (TrNode_child(current_ans_node) == NULL) {
@ -1191,15 +1191,15 @@ ans_node_ptr mode_directed_answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
TrNode_init_lock_field(&virtual_ans_node);
TrNode_parent(&virtual_ans_node) = NULL;
TrNode_child(&virtual_ans_node) = NULL;
current_ans_node = answer_search_loop(sg_fr, &virtual_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_loop(sg_fr, &virtual_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
TrNode_child(parent_ans_node) = TrNode_child(&virtual_ans_node);
#else
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
#endif /* YAPOR */
} else if (mode == MODE_DIRECTED_MIN || mode == MODE_DIRECTED_MAX) {
ans_node_ptr parent_ans_node = current_ans_node;
invalid_ans_node = TrNode_child(parent_ans_node); /* by default, assume a better answer */
current_ans_node = answer_search_min_max(sg_fr, current_ans_node, Deref(subs_ptr[i]), mode);
current_ans_node = answer_search_min_max(sg_fr, current_ans_node, Deref(subs_ptr[i]), mode PASS_REGS);
if (invalid_ans_node == TrNode_child(parent_ans_node)) /* worse or equal answer */
invalid_ans_node = NULL;
} else if (mode == MODE_DIRECTED_FIRST)
@ -1212,12 +1212,12 @@ ans_node_ptr mode_directed_answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
TrNode_init_lock_field(&virtual_ans_node);
TrNode_parent(&virtual_ans_node) = NULL;
TrNode_child(&virtual_ans_node) = NULL;
current_ans_node = answer_search_loop(sg_fr, &virtual_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_loop(sg_fr, &virtual_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
TrNode_child(parent_ans_node) = TrNode_child(&virtual_ans_node);
#else
invalid_ans_node = TrNode_child(current_ans_node);
TrNode_child(current_ans_node) = NULL;
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity);
current_ans_node = answer_search_loop(sg_fr, current_ans_node, Deref(subs_ptr[i]), &vars_arity PASS_REGS);
#endif /* YAPOR */
}
UNLOCK_ANSWER_NODE(current_ans_node);
@ -1230,7 +1230,7 @@ ans_node_ptr mode_directed_answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
j++;
}
if (invalid_ans_node)
invalidate_answer_trie(invalid_ans_node, sg_fr, TRAVERSE_POSITION_FIRST);
invalidate_answer_trie(invalid_ans_node, sg_fr, TRAVERSE_POSITION_FIRST PASS_REGS);
/* reset variables */
stack_vars = (CELL *) TR;
@ -1255,7 +1255,7 @@ void load_answer(ans_node_ptr current_ans_node, CELL *subs_ptr) {
if (subs_arity == 0)
return;
stack_terms = load_answer_loop(current_ans_node);
stack_terms = load_answer_loop(current_ans_node PASS_REGS);
for (i = subs_arity; i >= 1; i--) {
Term t = STACK_POP_DOWN(stack_terms);
@ -1275,7 +1275,7 @@ CELL *exec_substitution(gt_node_ptr current_node, CELL *aux_stack) {
Term t;
++aux_stack; /* skip the heap_arity entry */
stack_terms = exec_substitution_loop(current_node, &aux_stack, (CELL *) LOCAL_TrailTop);
stack_terms = exec_substitution_loop(current_node, &aux_stack, (CELL *) LOCAL_TrailTop PASS_REGS);
*--aux_stack = 0; /* restore the heap_arity entry */
subs_ptr = aux_stack + aux_stack[1] + 2;
@ -1516,16 +1516,33 @@ void free_answer_hash_chain(ans_hash_ptr hash) {
}
/***********************************************************************************************************************
** - main thread (worker_id 0) abolishes its local and all shared data structures. **
** - all other threads only abolish their local data structures. **
** - for the main thread, we assume that all other threads have the table clean (i.e., without local data structures) **
** and that they will be not using the table during the abolish operation. **
***********************************************************************************************************************/
/*****************************************************************************************
** all threads abolish their local data structures, and the main thread also abolishes **
** all shared data structures, if no other thread is running (GLOBAL_NOfThreads == 1). **
*****************************************************************************************/
void abolish_table(tab_ent_ptr tab_ent) {
CACHE_REGS
sg_node_ptr sg_node;
#if defined(THREADS) && defined(USE_PAGES_MALLOC)
if (GLOBAL_NOfThreads == 1) {
ATTACH_PAGES(_pages_tab_ent);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
ATTACH_PAGES(_pages_sg_ent);
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
ATTACH_PAGES(_pages_sg_fr);
ATTACH_PAGES(_pages_dep_fr);
ATTACH_PAGES(_pages_sg_node);
ATTACH_PAGES(_pages_sg_hash);
ATTACH_PAGES(_pages_ans_node);
ATTACH_PAGES(_pages_ans_hash);
#if defined(THREADS_FULL_SHARING)
ATTACH_PAGES(_pages_ans_ref_node);
#endif /* THREADS_FULL_SHARING */
ATTACH_PAGES(_pages_gt_node);
ATTACH_PAGES(_pages_gt_hash);
}
#endif /* THREADS && USE_PAGES_MALLOC */
sg_node = get_subgoal_trie_for_abolish(tab_ent PASS_REGS);
if (sg_node) {
if (TrNode_child(sg_node)) {
@ -1614,7 +1631,7 @@ void show_table(tab_ent_ptr tab_ent, int show_mode, IOSTREAM *out) {
arity[0] = 1;
arity[1] = TabEnt_arity(tab_ent);
int str_index = sprintf(str, " ?- %s(", AtomName(TabEnt_atom(tab_ent)));
traverse_subgoal_trie(TrNode_child(sg_node), str, str_index, arity, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
traverse_subgoal_trie(TrNode_child(sg_node), str, str_index, arity, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST PASS_REGS);
free(str);
free(arity);
} else {
@ -1676,7 +1693,7 @@ void show_global_trie(int show_mode, IOSTREAM *out) {
char *str = (char *) malloc(sizeof(char) * SHOW_TABLE_STR_ARRAY_SIZE);
int *arity = (int *) malloc(sizeof(int) * SHOW_TABLE_ARITY_ARRAY_SIZE);
arity[0] = 0;
traverse_global_trie(TrNode_child(GLOBAL_root_gt), str, 0, arity, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
traverse_global_trie(TrNode_child(GLOBAL_root_gt), str, 0, arity, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST PASS_REGS);
free(str);
free(arity);
} else

View File

@ -40,15 +40,15 @@
#ifdef MODE_GLOBAL_TRIE_LOOP
#define SUBGOAL_CHECK_INSERT_ENTRY(TAB_ENT, NODE, ENTRY) \
NODE = global_trie_check_insert_entry(NODE, ENTRY)
#define ANSWER_CHECK_INSERT_ENTRY(SG_FR, NODE, ENTRY, INSTR) \
NODE = global_trie_check_insert_entry(NODE, ENTRY)
#define SUBGOAL_CHECK_INSERT_ENTRY(TAB_ENT, NODE, ENTRY) \
NODE = global_trie_check_insert_entry(NODE, ENTRY PASS_REGS)
#define ANSWER_CHECK_INSERT_ENTRY(SG_FR, NODE, ENTRY, INSTR) \
NODE = global_trie_check_insert_entry(NODE, ENTRY PASS_REGS)
#else
#define SUBGOAL_CHECK_INSERT_ENTRY(TAB_ENT, NODE, ENTRY) \
NODE = subgoal_trie_check_insert_entry(TAB_ENT, NODE, ENTRY)
#define ANSWER_CHECK_INSERT_ENTRY(SG_FR, NODE, ENTRY, INSTR) \
NODE = answer_trie_check_insert_entry(SG_FR, NODE, ENTRY, INSTR)
#define SUBGOAL_CHECK_INSERT_ENTRY(TAB_ENT, NODE, ENTRY) \
NODE = subgoal_trie_check_insert_entry(TAB_ENT, NODE, ENTRY PASS_REGS)
#define ANSWER_CHECK_INSERT_ENTRY(SG_FR, NODE, ENTRY, INSTR) \
NODE = answer_trie_check_insert_entry(SG_FR, NODE, ENTRY, INSTR PASS_REGS)
#endif /* MODE_GLOBAL_TRIE_LOOP */
@ -60,13 +60,10 @@
#ifdef INCLUDE_SUBGOAL_TRIE_CHECK_INSERT
#ifndef SUBGOAL_TRIE_LOCK_AT_WRITE_LEVEL /* SUBGOAL_TRIE_LOCK_AT_ENTRY_LEVEL || SUBGOAL_TRIE_LOCK_AT_NODE_LEVEL || ! YAPOR */
#ifdef MODE_GLOBAL_TRIE_ENTRY
static inline sg_node_ptr subgoal_trie_check_insert_gt_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t) {
static inline sg_node_ptr subgoal_trie_check_insert_gt_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t USES_REGS) {
#else
static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t) {
static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_ENTRY */
#ifdef THREADS_NO_SHARING
CACHE_REGS
#endif /* THREADS_NO_SHARING */
sg_node_ptr child_node;
LOCK_SUBGOAL_NODE(parent_node);
@ -160,13 +157,10 @@ static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr tab_ent, s
}
#else /* SUBGOAL_TRIE_LOCK_AT_WRITE_LEVEL */
#ifdef MODE_GLOBAL_TRIE_ENTRY
static inline sg_node_ptr subgoal_trie_check_insert_gt_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t) {
static inline sg_node_ptr subgoal_trie_check_insert_gt_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t USES_REGS) {
#else
static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t) {
static inline sg_node_ptr subgoal_trie_check_insert_entry(tab_ent_ptr tab_ent, sg_node_ptr parent_node, Term t USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_ENTRY */
#ifdef THREADS_NO_SHARING
CACHE_REGS
#endif /* THREADS_NO_SHARING */
sg_node_ptr child_node;
sg_hash_ptr hash;
@ -365,13 +359,10 @@ subgoal_trie_hash:
#ifdef INCLUDE_ANSWER_TRIE_CHECK_INSERT
#ifndef ANSWER_TRIE_LOCK_AT_WRITE_LEVEL /* ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL || ANSWER_TRIE_LOCK_AT_NODE_LEVEL || ! YAPOR */
#ifdef MODE_GLOBAL_TRIE_ENTRY
static inline ans_node_ptr answer_trie_check_insert_gt_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr) {
static inline ans_node_ptr answer_trie_check_insert_gt_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr USES_REGS) {
#else
static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr) {
static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_ENTRY */
#if defined(THREADS_NO_SHARING) || defined(THREADS_SUBGOAL_SHARING)
CACHE_REGS
#endif /* THREADS_NO_SHARING || THREADS_SUBGOAL_SHARING */
ans_node_ptr child_node;
TABLING_ERROR_CHECKING(answer_trie_check_insert_(gt)_entry, IS_ANSWER_LEAF_NODE(parent_node));
@ -466,11 +457,10 @@ static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr sg_fr, ans_n
}
#else /* ANSWER_TRIE_LOCK_AT_WRITE_LEVEL */
#ifdef MODE_GLOBAL_TRIE_ENTRY
static inline ans_node_ptr answer_trie_check_insert_gt_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr) {
static inline ans_node_ptr answer_trie_check_insert_gt_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr USES_REGS) {
#else
static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr) {
static inline ans_node_ptr answer_trie_check_insert_entry(sg_fr_ptr sg_fr, ans_node_ptr parent_node, Term t, int instr USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_ENTRY */
CACHE_REGS
ans_node_ptr child_node;
ans_hash_ptr hash;
@ -670,9 +660,9 @@ answer_trie_hash:
#ifdef INCLUDE_GLOBAL_TRIE_CHECK_INSERT
#ifndef GLOBAL_TRIE_LOCK_AT_WRITE_LEVEL /* GLOBAL_TRIE_LOCK_AT_NODE_LEVEL || ! YAPOR */
#ifdef MODE_GLOBAL_TRIE_ENTRY
static inline gt_node_ptr global_trie_check_insert_gt_entry(gt_node_ptr parent_node, Term t) {
static inline gt_node_ptr global_trie_check_insert_gt_entry(gt_node_ptr parent_node, Term t USES_REGS) {
#else
static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr parent_node, Term t) {
static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr parent_node, Term t USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_ENTRY */
gt_node_ptr child_node;
@ -767,11 +757,10 @@ static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr parent_node
}
#else /* GLOBAL_TRIE_LOCK_AT_WRITE_LEVEL */
#ifdef MODE_GLOBAL_TRIE_ENTRY
static inline gt_node_ptr global_trie_check_insert_gt_entry(gt_node_ptr parent_node, Term t) {
static inline gt_node_ptr global_trie_check_insert_gt_entry(gt_node_ptr parent_node, Term t USES_REGS) {
#else
static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr parent_node, Term t) {
static inline gt_node_ptr global_trie_check_insert_entry(gt_node_ptr parent_node, Term t USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_ENTRY */
CACHE_REGS
gt_node_ptr child_node;
gt_hash_ptr hash;
@ -970,15 +959,15 @@ global_trie_hash:
#ifdef INCLUDE_SUBGOAL_SEARCH_LOOP
#ifdef MODE_GLOBAL_TRIE_LOOP
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
static inline gt_node_ptr subgoal_search_global_trie_terms_loop(Term t, int *subs_arity_ptr, CELL **stack_vars_ptr, CELL *stack_terms) {
static inline gt_node_ptr subgoal_search_global_trie_terms_loop(Term t, int *subs_arity_ptr, CELL **stack_vars_ptr, CELL *stack_terms USES_REGS) {
#else
static inline gt_node_ptr subgoal_search_global_trie_loop(Term t, int *subs_arity_ptr, CELL **stack_vars_ptr) {
static inline gt_node_ptr subgoal_search_global_trie_loop(Term t, int *subs_arity_ptr, CELL **stack_vars_ptr USES_REGS) {
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
#else
#ifdef MODE_TERMS_LOOP
static inline sg_node_ptr subgoal_search_terms_loop(tab_ent_ptr tab_ent, sg_node_ptr current_node, Term t, int *subs_arity_ptr, CELL **stack_vars_ptr) {
static inline sg_node_ptr subgoal_search_terms_loop(tab_ent_ptr tab_ent, sg_node_ptr current_node, Term t, int *subs_arity_ptr, CELL **stack_vars_ptr USES_REGS) {
#else
static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr current_node, Term t, int *subs_arity_ptr, CELL **stack_vars_ptr) {
static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr current_node, Term t, int *subs_arity_ptr, CELL **stack_vars_ptr USES_REGS) {
#endif /* MODE_TERMS_LOOP */
#endif /* MODE_GLOBAL_TRIE_LOOP */
/************************************************************************
@ -1020,7 +1009,6 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
LOCAL_TrailTop --> | |
-----------
************************************************************************/
CACHE_REGS
#ifdef MODE_GLOBAL_TRIE_LOOP
gt_node_ptr current_node = GLOBAL_root_gt;
#endif /* MODE_GLOBAL_TRIE_LOOP */
@ -1058,11 +1046,11 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
} else {
gt_node_ptr entry_node;
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms PASS_REGS);
#else
entry_node = subgoal_search_global_trie_loop(t, &subs_arity, &stack_vars);
entry_node = subgoal_search_global_trie_loop(t, &subs_arity, &stack_vars PASS_REGS);
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
current_node = subgoal_trie_check_insert_gt_entry(tab_ent, current_node, (Term) entry_node);
current_node = subgoal_trie_check_insert_gt_entry(tab_ent, current_node, (Term) entry_node PASS_REGS);
#else /* ! MODE_TERMS_LOOP */
} else
#if defined(MODE_GLOBAL_TRIE_LOOP)
@ -1093,8 +1081,8 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
}
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
} else if (current_node != GLOBAL_root_gt) {
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms PASS_REGS);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node PASS_REGS);
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
} else {
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, CompactPairInit);
@ -1110,14 +1098,14 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
}
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
} else if (current_node != GLOBAL_root_gt) {
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms PASS_REGS);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node PASS_REGS);
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
#else /* ! TRIE_COMPACT_PAIRS */
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
if (current_node != GLOBAL_root_gt) {
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms PASS_REGS);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node PASS_REGS);
} else
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
if (IsPairTerm(t)) {
@ -1184,15 +1172,15 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
#ifdef INCLUDE_ANSWER_SEARCH_LOOP
#ifdef MODE_GLOBAL_TRIE_LOOP
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
static inline gt_node_ptr answer_search_global_trie_terms_loop(Term t, int *vars_arity_ptr, CELL *stack_terms) {
static inline gt_node_ptr answer_search_global_trie_terms_loop(Term t, int *vars_arity_ptr, CELL *stack_terms USES_REGS) {
#else
static inline gt_node_ptr answer_search_global_trie_loop(Term t, int *vars_arity_ptr) {
static inline gt_node_ptr answer_search_global_trie_loop(Term t, int *vars_arity_ptr USES_REGS) {
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
#else
#ifdef MODE_TERMS_LOOP
static inline ans_node_ptr answer_search_terms_loop(sg_fr_ptr sg_fr, ans_node_ptr current_node, Term t, int *vars_arity_ptr) {
static inline ans_node_ptr answer_search_terms_loop(sg_fr_ptr sg_fr, ans_node_ptr current_node, Term t, int *vars_arity_ptr USES_REGS) {
#else
static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr current_node, Term t, int *vars_arity_ptr) {
static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr current_node, Term t, int *vars_arity_ptr USES_REGS) {
#endif /* MODE_TERMS_LOOP */
#endif /* MODE_GLOBAL_TRIE_LOOP */
/************************************************************************
@ -1224,7 +1212,6 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
LOCAL_TrailTop --> | |
-----------
************************************************************************/
CACHE_REGS
#ifdef MODE_GLOBAL_TRIE_LOOP
gt_node_ptr current_node = GLOBAL_root_gt;
#endif /* MODE_GLOBAL_TRIE_LOOP */
@ -1274,11 +1261,11 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
} else {
gt_node_ptr entry_node;
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms PASS_REGS);
#else
entry_node = answer_search_global_trie_loop(t, &vars_arity);
entry_node = answer_search_global_trie_loop(t, &vars_arity PASS_REGS);
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
current_node = answer_trie_check_insert_gt_entry(sg_fr, current_node, (Term) entry_node, _trie_retry_gterm + in_pair);
current_node = answer_trie_check_insert_gt_entry(sg_fr, current_node, (Term) entry_node, _trie_retry_gterm + in_pair PASS_REGS);
#else /* ! MODE_TERMS_LOOP */
} else
#if defined(MODE_GLOBAL_TRIE_LOOP)
@ -1310,8 +1297,8 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
}
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
} else if (current_node != GLOBAL_root_gt) {
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms PASS_REGS);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node PASS_REGS);
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
} else {
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, CompactPairInit, _trie_retry_null + in_pair);
@ -1329,14 +1316,14 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
}
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
} else if (current_node != GLOBAL_root_gt) {
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms PASS_REGS);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node PASS_REGS);
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
#else /* ! TRIE_COMPACT_PAIRS */
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
if (current_node != GLOBAL_root_gt) {
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms PASS_REGS);
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node PASS_REGS);
} else
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
if (IsPairTerm(t)) {
@ -1411,11 +1398,10 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
NODE = new_node; \
}
static inline ans_node_ptr answer_search_min_max(sg_fr_ptr sg_fr, ans_node_ptr current_node, Term t, int mode) {
CACHE_REGS
static inline ans_node_ptr answer_search_min_max(sg_fr_ptr sg_fr, ans_node_ptr current_node, Term t, int mode USES_REGS) {
ans_node_ptr child_node;
Term child_term;
Float trie_value, term_value;
Float trie_value = 0, term_value = 0;
/* start by computing the current value on the trie (trie_value) */
child_node = TrNode_child(current_node);
@ -1510,9 +1496,7 @@ static inline ans_node_ptr answer_search_min_max(sg_fr_ptr sg_fr, ans_node_ptr c
TrNode_next(NODE) = SgFr_invalid_chain(SG_FR); \
SgFr_invalid_chain(SG_FR) = NODE
static void invalidate_answer_trie(ans_node_ptr current_node, sg_fr_ptr sg_fr, int position) {
CACHE_REGS
static void invalidate_answer_trie(ans_node_ptr current_node, sg_fr_ptr sg_fr, int position USES_REGS) {
if (IS_ANSWER_TRIE_HASH(current_node)) {
ans_hash_ptr hash;
ans_node_ptr *bucket, *last_bucket;
@ -1526,13 +1510,13 @@ static void invalidate_answer_trie(ans_node_ptr current_node, sg_fr_ptr sg_fr, i
if (IS_ANSWER_LEAF_NODE(current_node)) {
INVALIDATE_ANSWER_TRIE_LEAF_NODE(current_node, sg_fr);
} else {
invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST);
invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST PASS_REGS);
INVALIDATE_ANSWER_TRIE_NODE(current_node, sg_fr);
}
while (next_node) {
current_node = next_node;
next_node = TrNode_next(current_node);
invalidate_answer_trie(current_node, sg_fr, TRAVERSE_POSITION_NEXT);
invalidate_answer_trie(current_node, sg_fr, TRAVERSE_POSITION_NEXT PASS_REGS);
}
}
} while (++bucket != last_bucket);
@ -1550,19 +1534,19 @@ static void invalidate_answer_trie(ans_node_ptr current_node, sg_fr_ptr sg_fr, i
if (IS_ANSWER_LEAF_NODE(current_node)) {
INVALIDATE_ANSWER_TRIE_LEAF_NODE(current_node, sg_fr);
} else {
invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST);
invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST PASS_REGS);
INVALIDATE_ANSWER_TRIE_NODE(current_node, sg_fr);
}
while (next_node) {
current_node = next_node;
next_node = TrNode_next(current_node);
invalidate_answer_trie(current_node, sg_fr, TRAVERSE_POSITION_NEXT);
invalidate_answer_trie(current_node, sg_fr, TRAVERSE_POSITION_NEXT PASS_REGS);
}
} else {
if (IS_ANSWER_LEAF_NODE(current_node)) {
INVALIDATE_ANSWER_TRIE_LEAF_NODE(current_node, sg_fr);
} else {
invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST);
invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST PASS_REGS);
INVALIDATE_ANSWER_TRIE_NODE(current_node, sg_fr);
}
}
@ -1579,9 +1563,9 @@ static void invalidate_answer_trie(ans_node_ptr current_node, sg_fr_ptr sg_fr, i
#ifdef INCLUDE_LOAD_ANSWER_LOOP
#ifdef MODE_GLOBAL_TRIE_LOOP
static inline CELL *load_substitution_loop(gt_node_ptr current_node, int *vars_arity_ptr, CELL *stack_terms) {
static inline CELL *load_substitution_loop(gt_node_ptr current_node, int *vars_arity_ptr, CELL *stack_terms USES_REGS) {
#else
static inline CELL *load_answer_loop(ans_node_ptr current_node) {
static inline CELL *load_answer_loop(ans_node_ptr current_node USES_REGS) {
#endif /* MODE_GLOBAL_TRIE_LOOP */
/************************************************************************
===========
@ -1610,7 +1594,6 @@ static inline CELL *load_answer_loop(ans_node_ptr current_node) {
LOCAL_TrailTop --> | | <-- stack_terms_base (TRIE_COMPACT_PAIRS)
-----------
************************************************************************/
CACHE_REGS
#ifdef MODE_GLOBAL_TRIE_LOOP
int vars_arity = *vars_arity_ptr;
#else
@ -1634,7 +1617,7 @@ static inline CELL *load_answer_loop(ans_node_ptr current_node) {
if (IsVarTerm(t)) {
#if ! defined(MODE_GLOBAL_TRIE_LOOP) || defined(GLOBAL_TRIE_FOR_SUBTERMS)
if (t > VarIndexOfTableTerm(MAX_TABLE_VARS)) {
stack_terms = load_substitution_loop((gt_node_ptr) t, &vars_arity, stack_terms);
stack_terms = load_substitution_loop((gt_node_ptr) t, &vars_arity, stack_terms PASS_REGS);
} else
#endif /* ! MODE_GLOBAL_TRIE_LOOP || GLOBAL_TRIE_FOR_SUBTERMS */
{ int var_index = VarIndexOfTableTerm(t);

View File

@ -1,4 +1,8 @@
#ifndef YAP_CONFIG_H
#define YAP_CONFIG_H
#include "parms.h"
/* are dynamic arrays supported? */
@ -347,5 +351,4 @@
#undef MAX_THREADS
#endif /* YAP_CONFIG_H */

39
configure vendored
View File

@ -4998,6 +4998,45 @@ else
INSTALL_MATLAB=""
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
my_save_cxxflags="$CXXFLAGS"
CXXFLAGS=-std=c++0x
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CXX supports -std-c++0x" >&5
$as_echo_n "checking whether CXX supports -std-c++0x... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
yap_cv_clpbn_bp=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CXXFLAGS="$my_save_cflags"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$yap_cv_clpbn_bp" = no
then
ENABLE_CLPBN_BP="@# "

View File

@ -501,6 +501,18 @@ else
INSTALL_MATLAB=""
fi
AC_LANG_PUSH([C++])
my_save_cxxflags="$CXXFLAGS"
CXXFLAGS=-std=c++0x
AC_MSG_CHECKING([whether CXX supports -std-c++0x])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[yap_cv_clpbn_bp=yes],
[AC_MSG_RESULT([no])]
)
CXXFLAGS="$my_save_cflags"
AC_LANG_POP()
if test "$yap_cv_clpbn_bp" = no
then
ENABLE_CLPBN_BP="@# "

4
console/yap.c Normal file → Executable file
View File

@ -79,8 +79,8 @@
#include <ieeefp.h>
#endif
static void PROTO(do_top_goal,(YAP_Term));
static void PROTO(exec_top_level,(int, YAP_init_args *));
static void do_top_goal(YAP_Term Goal);
static void exec_top_level(int BootMode, YAP_init_args *iap);
#ifdef DEBUG
static int output_msg;

View File

@ -3430,6 +3430,15 @@ Same as @code{variant/2}, succeeds if @var{Term1} and @var{Term2} are variant te
Succeed if @var{Submuser} subsumes @var{Subsuned} but does not bind any
variable in @var{Subsumer}.
@item term_subsumer(?@var{T1}, ?@var{T2}, ?@var{Subsumer})
@findex term_subsumer/2
@syindex term_subsumer/2
@cnindex term_subsumer/2
Succeed if @var{Subsumer} unifies with the least general
generalization over @var{T1} and
@var{T2}.
@item acyclic_term(?@var{Term})
@findex cyclic_term/1
@syindex cyclic_term/1

View File

@ -115,6 +115,7 @@ typedef enum {
#define YAP_BOOT_FROM_SAVED_CODE 1
#define YAP_BOOT_FROM_SAVED_STACKS 2
#define YAP_FULL_BOOT_FROM_PROLOG 4
#define YAP_BOOT_DONE_BEFOREHAND 8
#define YAP_BOOT_ERROR -1
#define YAP_WRITE_QUOTED 1

View File

@ -53,6 +53,25 @@ extern X_API Atom YAP_AtomFromSWIAtom(atom_t at);
extern X_API atom_t YAP_SWIAtomFromAtom(Atom at);
extern int PL_error(const char *pred, int arity, const char *msg, int id, ...);
static int
do_gc(UInt sz)
{
/* always called from user_call_cpred */
CACHE_REGS
UInt arity;
yamop *nextpc;
if (P && PREVOP(P,Osbpp)->opc == Yap_opcode(_call_usercpred)) {
arity = PREVOP(P,Osbpp)->u.Osbpp.p->ArityOfPE;
nextpc = P;
} else {
arity = 0;
nextpc = CP;
}
return Yap_gcl(sz, arity, ENV, nextpc);
}
X_API extern Atom
YAP_AtomFromSWIAtom(atom_t at)
{
@ -768,8 +787,8 @@ X_API int PL_cons_functor(term_t d, functor_t f,...)
return TRUE;
}
arity = ArityOfFunctor(ff);
while (Unsigned(H+arity) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (Unsigned(H)+arity > Unsigned(ASP)-CreepFlag) {
if (!do_gc(arity*sizeof(CELL))) {
return FALSE;
}
}
@ -801,8 +820,8 @@ X_API int PL_cons_functor_v(term_t d, functor_t f, term_t a0)
return TRUE;
}
arity = ArityOfFunctor(ff);
while (Unsigned(H+arity) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -839,7 +858,7 @@ X_API int PL_put_atom_chars(term_t t, const char *s)
{
CACHE_REGS
Atom at;
while (!(at = Yap_LookupAtom((char *)s))) {
if (!(at = Yap_LookupAtom((char *)s))) {
if (!Yap_growheap(FALSE, 0L, NULL)) {
CACHE_REGS
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
@ -897,15 +916,15 @@ X_API int PL_put_functor(term_t t, functor_t f)
Yap_PutInSlot(t,(Term)ff PASS_REGS);
} else {
arity = ArityOfFunctor(ff);
if (Unsigned(H)+arity > Unsigned(ASP)-CreepFlag) {
if (!do_gc(arity*sizeof(CELL))) {
return FALSE;
}
}
if (arity == 2 && ff == FunctorDot)
Yap_PutInSlot(t,YAP_MkNewPairTerm() PASS_REGS);
else
Yap_PutInSlot(t,YAP_MkNewApplTerm((YAP_Functor)ff,arity) PASS_REGS);
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
return FALSE;
}
}
}
return TRUE;
}
@ -947,7 +966,7 @@ X_API int PL_put_list(term_t t)
CACHE_REGS
Yap_PutInSlot(t,YAP_MkNewPairTerm() PASS_REGS);
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -959,7 +978,7 @@ X_API int PL_put_list_chars(term_t t, const char *s)
CACHE_REGS
Yap_PutInSlot(t,YAP_BufferToString((char *)s) PASS_REGS);
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1132,8 +1151,8 @@ X_API int PL_unify_functor(term_t t, functor_t f)
Term tt = Yap_GetFromSlot(t PASS_REGS);
Functor ff = SWIFunctorToFunctor(f);
if (IsVarTerm(tt)) {
while (Unsigned(H)+ArityOfFunctor(ff) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(ArityOfFunctor(ff)*sizeof(CELL), ENV, CP)) {
if (Unsigned(H)+ArityOfFunctor(ff) > Unsigned(ASP)-CreepFlag) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1185,7 +1204,7 @@ X_API int PL_unify_list(term_t tt, term_t h, term_t tail)
CACHE_REGS
Term t;
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1238,7 +1257,7 @@ X_API int PL_unify_list_chars(term_t t, const char *chars)
CACHE_REGS
YAP_Term chterm;
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1253,7 +1272,7 @@ X_API int PL_unify_list_ncodes(term_t t, size_t len, const char *chars)
CACHE_REGS
Term chterm;
if (Unsigned(H) > Unsigned(ASP+len*2)-CreepFlag) {
if (!Yap_gc(len*2*sizeof(CELL), ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1292,7 +1311,7 @@ X_API int PL_unify_string_chars(term_t t, const char *chars)
CACHE_REGS
YAP_Term chterm;
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1304,8 +1323,9 @@ X_API int PL_unify_string_nchars(term_t t, size_t len, const char *chars)
{
CACHE_REGS
YAP_Term chterm;
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
return FALSE;
}
}
@ -1324,9 +1344,7 @@ X_API int PL_unify_wchars(term_t t, int type, size_t len, const pl_wchar_t *char
len = wcslen(chars);
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
return FALSE;
}
if (!do_gc(0)) return FALSE;
}
switch (type) {
case PL_ATOM:
@ -1455,7 +1473,7 @@ X_API int PL_unify_term(term_t l,...)
BACKUP_MACHINE_REGS();
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
if (!do_gc(0)) {
RECOVER_MACHINE_REGS();
return FALSE;
}
@ -2815,9 +2833,14 @@ Yap_read_term(term_t t, IOSTREAM *st, term_t *excep, term_t vs)
{
CACHE_REGS
Term varnames, out, tpos;
Term error;
Term error, *vp;
if (!Yap_readTerm(st, &out, &varnames, &error, &tpos)) {
if (vs) {
vp = & varnames;
} else {
vp = NULL;
}
if (!Yap_readTerm(st, &out, vp, &error, &tpos)) {
if (excep) {
*excep = Yap_InitSlot(error PASS_REGS);
}
@ -2832,7 +2855,8 @@ Yap_read_term(term_t t, IOSTREAM *st, term_t *excep, term_t vs)
if (!Yap_unify(out, Yap_GetFromSlot(t PASS_REGS))) {
return FALSE;
}
if (!Yap_unify(varnames, Yap_GetFromSlot(vs PASS_REGS))) {
if (vp &&
!Yap_unify(varnames, Yap_GetFromSlot(vs PASS_REGS))) {
return FALSE;
}
return TRUE;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
3.7.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
static IntRelType gecode_IntRelType_from_term(YAP_Term);
static BoolOpType gecode_BoolOpType_from_term(YAP_Term);
static IntConLevel gecode_IntConLevel_from_term(YAP_Term);
static TaskType gecode_TaskType_from_term(YAP_Term);
static ExtensionalPropKind gecode_ExtensionalPropKind_from_term(YAP_Term);
static IntVarBranch gecode_IntVarBranch_from_term(YAP_Term);
static IntValBranch gecode_IntValBranch_from_term(YAP_Term);
static IntAssign gecode_IntAssign_from_term(YAP_Term);
static SetRelType gecode_SetRelType_from_term(YAP_Term);
static SetOpType gecode_SetOpType_from_term(YAP_Term);
static SetVarBranch gecode_SetVarBranch_from_term(YAP_Term);
static SetValBranch gecode_SetValBranch_from_term(YAP_Term);
static SetAssign gecode_SetAssign_from_term(YAP_Term);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,698 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
{ YAP_Atom X= YAP_LookupAtom("IRT_EQ");
gecode_IRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_NQ");
gecode_IRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_LQ");
gecode_IRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_LE");
gecode_IRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_GQ");
gecode_IRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_GR");
gecode_IRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_AND");
gecode_BOT_AND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_OR");
gecode_BOT_OR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_IMP");
gecode_BOT_IMP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_EQV");
gecode_BOT_EQV = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_XOR");
gecode_BOT_XOR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_VAL");
gecode_ICL_VAL = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_BND");
gecode_ICL_BND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_DOM");
gecode_ICL_DOM = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_DEF");
gecode_ICL_DEF = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXP");
gecode_TT_FIXP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXS");
gecode_TT_FIXS = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXE");
gecode_TT_FIXE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_DEF");
gecode_EPK_DEF = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_SPEED");
gecode_EPK_SPEED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_MEMORY");
gecode_EPK_MEMORY = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_NONE");
gecode_INT_VAR_NONE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_RND");
gecode_INT_VAR_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_DEGREE_MIN");
gecode_INT_VAR_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_DEGREE_MAX");
gecode_INT_VAR_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_AFC_MIN");
gecode_INT_VAR_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_AFC_MAX");
gecode_INT_VAR_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MIN_MIN");
gecode_INT_VAR_MIN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MIN_MAX");
gecode_INT_VAR_MIN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MAX_MIN");
gecode_INT_VAR_MAX_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MAX_MAX");
gecode_INT_VAR_MAX_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_MIN");
gecode_INT_VAR_SIZE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_MAX");
gecode_INT_VAR_SIZE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_DEGREE_MIN");
gecode_INT_VAR_SIZE_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_DEGREE_MAX");
gecode_INT_VAR_SIZE_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_AFC_MIN");
gecode_INT_VAR_SIZE_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_AFC_MAX");
gecode_INT_VAR_SIZE_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MIN_MIN");
gecode_INT_VAR_REGRET_MIN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MIN_MAX");
gecode_INT_VAR_REGRET_MIN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MAX_MIN");
gecode_INT_VAR_REGRET_MAX_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MAX_MAX");
gecode_INT_VAR_REGRET_MAX_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_MIN");
gecode_INT_VAL_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_MED");
gecode_INT_VAL_MED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_MAX");
gecode_INT_VAL_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_RND");
gecode_INT_VAL_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_SPLIT_MIN");
gecode_INT_VAL_SPLIT_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_SPLIT_MAX");
gecode_INT_VAL_SPLIT_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_RANGE_MIN");
gecode_INT_VAL_RANGE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_RANGE_MAX");
gecode_INT_VAL_RANGE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VALUES_MIN");
gecode_INT_VALUES_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VALUES_MAX");
gecode_INT_VALUES_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_MIN");
gecode_INT_ASSIGN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_MED");
gecode_INT_ASSIGN_MED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_MAX");
gecode_INT_ASSIGN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_RND");
gecode_INT_ASSIGN_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_EQ");
gecode_SRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_NQ");
gecode_SRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_SUB");
gecode_SRT_SUB = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_SUP");
gecode_SRT_SUP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ");
gecode_SRT_DISJ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL");
gecode_SRT_CMPL = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_LQ");
gecode_SRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_LE");
gecode_SRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_GQ");
gecode_SRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_GR");
gecode_SRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_UNION");
gecode_SOT_UNION = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION");
gecode_SOT_DUNION = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_INTER");
gecode_SOT_INTER = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS");
gecode_SOT_MINUS = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_NONE");
gecode_SET_VAR_NONE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_RND");
gecode_SET_VAR_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_DEGREE_MIN");
gecode_SET_VAR_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_DEGREE_MAX");
gecode_SET_VAR_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_AFC_MIN");
gecode_SET_VAR_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_AFC_MAX");
gecode_SET_VAR_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MIN_MIN");
gecode_SET_VAR_MIN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MIN_MAX");
gecode_SET_VAR_MIN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MAX_MIN");
gecode_SET_VAR_MAX_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MAX_MAX");
gecode_SET_VAR_MAX_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_MIN");
gecode_SET_VAR_SIZE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_MAX");
gecode_SET_VAR_SIZE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_DEGREE_MIN");
gecode_SET_VAR_SIZE_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_DEGREE_MAX");
gecode_SET_VAR_SIZE_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_AFC_MIN");
gecode_SET_VAR_SIZE_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_AFC_MAX");
gecode_SET_VAR_SIZE_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MIN_INC");
gecode_SET_VAL_MIN_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MIN_EXC");
gecode_SET_VAL_MIN_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MED_INC");
gecode_SET_VAL_MED_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MED_EXC");
gecode_SET_VAL_MED_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MAX_INC");
gecode_SET_VAL_MAX_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MAX_EXC");
gecode_SET_VAL_MAX_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_RND_INC");
gecode_SET_VAL_RND_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_RND_EXC");
gecode_SET_VAL_RND_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MIN_INC");
gecode_SET_ASSIGN_MIN_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MIN_EXC");
gecode_SET_ASSIGN_MIN_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MED_INC");
gecode_SET_ASSIGN_MED_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MED_EXC");
gecode_SET_ASSIGN_MED_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MAX_INC");
gecode_SET_ASSIGN_MAX_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MAX_EXC");
gecode_SET_ASSIGN_MAX_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_RND_INC");
gecode_SET_ASSIGN_RND_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_RND_EXC");
gecode_SET_ASSIGN_RND_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
YAP_UserCPredicate("gecode_constraint_unary_357", gecode_constraint_unary_357, 6);
YAP_UserCPredicate("gecode_constraint_unary_353", gecode_constraint_unary_353, 6);
YAP_UserCPredicate("gecode_constraint_nvalues_255", gecode_constraint_nvalues_255, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_257", gecode_constraint_nvalues_257, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_251", gecode_constraint_nvalues_251, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_253", gecode_constraint_nvalues_253, 5);
YAP_UserCPredicate("gecode_constraint_max_218", gecode_constraint_max_218, 4);
YAP_UserCPredicate("gecode_constraint_max_217", gecode_constraint_max_217, 4);
YAP_UserCPredicate("gecode_constraint_max_221", gecode_constraint_max_221, 4);
YAP_UserCPredicate("gecode_constraint_dom_139", gecode_constraint_dom_139, 6);
YAP_UserCPredicate("gecode_constraint_dom_149", gecode_constraint_dom_149, 6);
YAP_UserCPredicate("gecode_constraint_convex_51", gecode_constraint_convex_51, 3);
YAP_UserCPredicate("gecode_constraint_nooverlap_242", gecode_constraint_nooverlap_242, 5);
YAP_UserCPredicate("gecode_constraint_assign_4", gecode_constraint_assign_4, 3);
YAP_UserCPredicate("gecode_constraint_assign_3", gecode_constraint_assign_3, 3);
YAP_UserCPredicate("gecode_constraint_assign_5", gecode_constraint_assign_5, 3);
YAP_UserCPredicate("gecode_constraint_assign_7", gecode_constraint_assign_7, 3);
YAP_UserCPredicate("gecode_constraint_assign_6", gecode_constraint_assign_6, 3);
YAP_UserCPredicate("gecode_constraint_assign_8", gecode_constraint_assign_8, 3);
YAP_UserCPredicate("gecode_constraint_element_158", gecode_constraint_element_158, 4);
YAP_UserCPredicate("gecode_constraint_element_162", gecode_constraint_element_162, 4);
YAP_UserCPredicate("gecode_constraint_element_152", gecode_constraint_element_152, 4);
YAP_UserCPredicate("gecode_constraint_element_150", gecode_constraint_element_150, 4);
YAP_UserCPredicate("gecode_constraint_element_157", gecode_constraint_element_157, 4);
YAP_UserCPredicate("gecode_constraint_element_165", gecode_constraint_element_165, 4);
YAP_UserCPredicate("gecode_constraint_element_168", gecode_constraint_element_168, 4);
YAP_UserCPredicate("gecode_constraint_element_174", gecode_constraint_element_174, 4);
YAP_UserCPredicate("gecode_constraint_element_166", gecode_constraint_element_166, 4);
YAP_UserCPredicate("gecode_constraint_sequence_338", gecode_constraint_sequence_338, 2);
YAP_UserCPredicate("gecode_constraint_notMax_248", gecode_constraint_notMax_248, 3);
YAP_UserCPredicate("gecode_constraint_unary_350", gecode_constraint_unary_350, 3);
YAP_UserCPredicate("gecode_constraint_circuit_45", gecode_constraint_circuit_45, 4);
YAP_UserCPredicate("gecode_constraint_circuit_36", gecode_constraint_circuit_36, 4);
YAP_UserCPredicate("gecode_constraint_dom_138", gecode_constraint_dom_138, 5);
YAP_UserCPredicate("gecode_constraint_dom_143", gecode_constraint_dom_143, 5);
YAP_UserCPredicate("gecode_constraint_dom_137", gecode_constraint_dom_137, 5);
YAP_UserCPredicate("gecode_constraint_dom_133", gecode_constraint_dom_133, 5);
YAP_UserCPredicate("gecode_constraint_dom_131", gecode_constraint_dom_131, 5);
YAP_UserCPredicate("gecode_constraint_dom_148", gecode_constraint_dom_148, 5);
YAP_UserCPredicate("gecode_constraint_dom_147", gecode_constraint_dom_147, 5);
YAP_UserCPredicate("gecode_constraint_dom_145", gecode_constraint_dom_145, 5);
YAP_UserCPredicate("gecode_constraint_channel_32", gecode_constraint_channel_32, 4);
YAP_UserCPredicate("gecode_constraint_channel_27", gecode_constraint_channel_27, 4);
YAP_UserCPredicate("gecode_constraint_channel_23", gecode_constraint_channel_23, 4);
YAP_UserCPredicate("gecode_constraint_channel_21", gecode_constraint_channel_21, 4);
YAP_UserCPredicate("gecode_constraint_nooverlap_244", gecode_constraint_nooverlap_244, 8);
YAP_UserCPredicate("gecode_constraint_nooverlap_247", gecode_constraint_nooverlap_247, 8);
YAP_UserCPredicate("gecode_constraint_element_160", gecode_constraint_element_160, 7);
YAP_UserCPredicate("gecode_constraint_element_154", gecode_constraint_element_154, 7);
YAP_UserCPredicate("gecode_constraint_element_156", gecode_constraint_element_156, 7);
YAP_UserCPredicate("gecode_constraint_element_164", gecode_constraint_element_164, 7);
YAP_UserCPredicate("gecode_constraint_element_172", gecode_constraint_element_172, 7);
YAP_UserCPredicate("gecode_constraint_element_170", gecode_constraint_element_170, 7);
YAP_UserCPredicate("gecode_constraint_max_216", gecode_constraint_max_216, 3);
YAP_UserCPredicate("gecode_constraint_max_220", gecode_constraint_max_220, 3);
YAP_UserCPredicate("gecode_constraint_unshare_362", gecode_constraint_unshare_362, 2);
YAP_UserCPredicate("gecode_constraint_unshare_360", gecode_constraint_unshare_360, 2);
YAP_UserCPredicate("gecode_constraint_path_268", gecode_constraint_path_268, 5);
YAP_UserCPredicate("gecode_constraint_path_267", gecode_constraint_path_267, 5);
YAP_UserCPredicate("gecode_constraint_mult_238", gecode_constraint_mult_238, 4);
YAP_UserCPredicate("gecode_constraint_clause_49", gecode_constraint_clause_49, 6);
YAP_UserCPredicate("gecode_constraint_clause_47", gecode_constraint_clause_47, 6);
YAP_UserCPredicate("gecode_constraint_precede_273", gecode_constraint_precede_273, 5);
YAP_UserCPredicate("gecode_constraint_distinct_120", gecode_constraint_distinct_120, 2);
YAP_UserCPredicate("gecode_constraint_member_226", gecode_constraint_member_226, 4);
YAP_UserCPredicate("gecode_constraint_member_229", gecode_constraint_member_229, 4);
YAP_UserCPredicate("gecode_constraint_member_222", gecode_constraint_member_222, 4);
YAP_UserCPredicate("gecode_constraint_member_225", gecode_constraint_member_225, 4);
YAP_UserCPredicate("gecode_constraint_mod_237", gecode_constraint_mod_237, 5);
YAP_UserCPredicate("gecode_constraint_cardinality_18", gecode_constraint_cardinality_18, 3);
YAP_UserCPredicate("gecode_constraint_atmostOne_9", gecode_constraint_atmostOne_9, 3);
YAP_UserCPredicate("gecode_constraint_channelSorted_33", gecode_constraint_channelSorted_33, 3);
YAP_UserCPredicate("gecode_constraint_linear_210", gecode_constraint_linear_210, 4);
YAP_UserCPredicate("gecode_constraint_linear_214", gecode_constraint_linear_214, 4);
YAP_UserCPredicate("gecode_constraint_linear_186", gecode_constraint_linear_186, 4);
YAP_UserCPredicate("gecode_constraint_linear_190", gecode_constraint_linear_190, 4);
YAP_UserCPredicate("gecode_constraint_circuit_42", gecode_constraint_circuit_42, 2);
YAP_UserCPredicate("gecode_constraint_rel_288", gecode_constraint_rel_288, 5);
YAP_UserCPredicate("gecode_constraint_rel_291", gecode_constraint_rel_291, 5);
YAP_UserCPredicate("gecode_constraint_rel_284", gecode_constraint_rel_284, 5);
YAP_UserCPredicate("gecode_constraint_rel_287", gecode_constraint_rel_287, 5);
YAP_UserCPredicate("gecode_constraint_rel_282", gecode_constraint_rel_282, 5);
YAP_UserCPredicate("gecode_constraint_rel_280", gecode_constraint_rel_280, 5);
YAP_UserCPredicate("gecode_constraint_rel_299", gecode_constraint_rel_299, 5);
YAP_UserCPredicate("gecode_constraint_rel_295", gecode_constraint_rel_295, 5);
YAP_UserCPredicate("gecode_constraint_rel_293", gecode_constraint_rel_293, 5);
YAP_UserCPredicate("gecode_constraint_rel_323", gecode_constraint_rel_323, 5);
YAP_UserCPredicate("gecode_constraint_rel_321", gecode_constraint_rel_321, 5);
YAP_UserCPredicate("gecode_constraint_rel_307", gecode_constraint_rel_307, 5);
YAP_UserCPredicate("gecode_constraint_rel_309", gecode_constraint_rel_309, 5);
YAP_UserCPredicate("gecode_constraint_rel_303", gecode_constraint_rel_303, 5);
YAP_UserCPredicate("gecode_constraint_rel_310", gecode_constraint_rel_310, 5);
YAP_UserCPredicate("gecode_constraint_rel_313", gecode_constraint_rel_313, 5);
YAP_UserCPredicate("gecode_constraint_rel_314", gecode_constraint_rel_314, 5);
YAP_UserCPredicate("gecode_constraint_rel_317", gecode_constraint_rel_317, 5);
YAP_UserCPredicate("gecode_constraint_rel_320", gecode_constraint_rel_320, 5);
YAP_UserCPredicate("gecode_constraint_rel_331", gecode_constraint_rel_331, 5);
YAP_UserCPredicate("gecode_constraint_rel_333", gecode_constraint_rel_333, 5);
YAP_UserCPredicate("gecode_constraint_rel_279", gecode_constraint_rel_279, 5);
YAP_UserCPredicate("gecode_constraint_rel_277", gecode_constraint_rel_277, 5);
YAP_UserCPredicate("gecode_constraint_min_232", gecode_constraint_min_232, 4);
YAP_UserCPredicate("gecode_constraint_min_231", gecode_constraint_min_231, 4);
YAP_UserCPredicate("gecode_constraint_min_235", gecode_constraint_min_235, 4);
YAP_UserCPredicate("gecode_constraint_cardinality_19", gecode_constraint_cardinality_19, 4);
YAP_UserCPredicate("gecode_constraint_count_69", gecode_constraint_count_69, 4);
YAP_UserCPredicate("gecode_constraint_count_66", gecode_constraint_count_66, 4);
YAP_UserCPredicate("gecode_constraint_count_60", gecode_constraint_count_60, 4);
YAP_UserCPredicate("gecode_constraint_count_59", gecode_constraint_count_59, 4);
YAP_UserCPredicate("gecode_constraint_count_56", gecode_constraint_count_56, 4);
YAP_UserCPredicate("gecode_constraint_sqrt_346", gecode_constraint_sqrt_346, 3);
YAP_UserCPredicate("gecode_constraint_cumulatives_117", gecode_constraint_cumulatives_117, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_115", gecode_constraint_cumulatives_115, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_113", gecode_constraint_cumulatives_113, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_111", gecode_constraint_cumulatives_111, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_109", gecode_constraint_cumulatives_109, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_107", gecode_constraint_cumulatives_107, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_105", gecode_constraint_cumulatives_105, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_103", gecode_constraint_cumulatives_103, 9);
YAP_UserCPredicate("gecode_constraint_nvalues_254", gecode_constraint_nvalues_254, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_256", gecode_constraint_nvalues_256, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_250", gecode_constraint_nvalues_250, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_252", gecode_constraint_nvalues_252, 4);
YAP_UserCPredicate("gecode_constraint_binpacking_10", gecode_constraint_binpacking_10, 4);
YAP_UserCPredicate("gecode_constraint_linear_201", gecode_constraint_linear_201, 7);
YAP_UserCPredicate("gecode_constraint_linear_205", gecode_constraint_linear_205, 7);
YAP_UserCPredicate("gecode_constraint_linear_193", gecode_constraint_linear_193, 7);
YAP_UserCPredicate("gecode_constraint_linear_197", gecode_constraint_linear_197, 7);
YAP_UserCPredicate("gecode_constraint_abs_2", gecode_constraint_abs_2, 4);
YAP_UserCPredicate("gecode_constraint_convex_50", gecode_constraint_convex_50, 2);
YAP_UserCPredicate("gecode_constraint_div_122", gecode_constraint_div_122, 4);
YAP_UserCPredicate("gecode_constraint_rel_311", gecode_constraint_rel_311, 6);
YAP_UserCPredicate("gecode_constraint_rel_315", gecode_constraint_rel_315, 6);
YAP_UserCPredicate("gecode_constraint_rel_300", gecode_constraint_rel_300, 6);
YAP_UserCPredicate("gecode_constraint_rel_301", gecode_constraint_rel_301, 6);
YAP_UserCPredicate("gecode_constraint_rel_289", gecode_constraint_rel_289, 6);
YAP_UserCPredicate("gecode_constraint_rel_285", gecode_constraint_rel_285, 6);
YAP_UserCPredicate("gecode_constraint_rel_283", gecode_constraint_rel_283, 6);
YAP_UserCPredicate("gecode_constraint_rel_281", gecode_constraint_rel_281, 6);
YAP_UserCPredicate("gecode_constraint_rel_326", gecode_constraint_rel_326, 6);
YAP_UserCPredicate("gecode_constraint_rel_327", gecode_constraint_rel_327, 6);
YAP_UserCPredicate("gecode_constraint_rel_328", gecode_constraint_rel_328, 6);
YAP_UserCPredicate("gecode_constraint_rel_329", gecode_constraint_rel_329, 6);
YAP_UserCPredicate("gecode_constraint_weights_364", gecode_constraint_weights_364, 5);
YAP_UserCPredicate("gecode_constraint_max_219", gecode_constraint_max_219, 5);
YAP_UserCPredicate("gecode_constraint_path_263", gecode_constraint_path_263, 9);
YAP_UserCPredicate("gecode_constraint_unary_358", gecode_constraint_unary_358, 4);
YAP_UserCPredicate("gecode_constraint_unary_354", gecode_constraint_unary_354, 4);
YAP_UserCPredicate("gecode_constraint_unary_348", gecode_constraint_unary_348, 4);
YAP_UserCPredicate("gecode_constraint_unary_351", gecode_constraint_unary_351, 4);
YAP_UserCPredicate("gecode_constraint_sorted_341", gecode_constraint_sorted_341, 5);
YAP_UserCPredicate("gecode_constraint_circuit_40", gecode_constraint_circuit_40, 5);
YAP_UserCPredicate("gecode_constraint_circuit_37", gecode_constraint_circuit_37, 5);
YAP_UserCPredicate("gecode_constraint_circuit_34", gecode_constraint_circuit_34, 5);
YAP_UserCPredicate("gecode_constraint_dom_142", gecode_constraint_dom_142, 4);
YAP_UserCPredicate("gecode_constraint_dom_136", gecode_constraint_dom_136, 4);
YAP_UserCPredicate("gecode_constraint_dom_141", gecode_constraint_dom_141, 4);
YAP_UserCPredicate("gecode_constraint_dom_132", gecode_constraint_dom_132, 4);
YAP_UserCPredicate("gecode_constraint_dom_135", gecode_constraint_dom_135, 4);
YAP_UserCPredicate("gecode_constraint_dom_130", gecode_constraint_dom_130, 4);
YAP_UserCPredicate("gecode_constraint_dom_129", gecode_constraint_dom_129, 4);
YAP_UserCPredicate("gecode_constraint_dom_127", gecode_constraint_dom_127, 4);
YAP_UserCPredicate("gecode_constraint_dom_146", gecode_constraint_dom_146, 4);
YAP_UserCPredicate("gecode_constraint_dom_144", gecode_constraint_dom_144, 4);
YAP_UserCPredicate("gecode_constraint_abs_1", gecode_constraint_abs_1, 3);
YAP_UserCPredicate("gecode_constraint_channel_29", gecode_constraint_channel_29, 5);
YAP_UserCPredicate("gecode_constraint_channel_24", gecode_constraint_channel_24, 5);
YAP_UserCPredicate("gecode_constraint_rel_304", gecode_constraint_rel_304, 3);
YAP_UserCPredicate("gecode_constraint_rel_296", gecode_constraint_rel_296, 3);
YAP_UserCPredicate("gecode_constraint_path_266", gecode_constraint_path_266, 4);
YAP_UserCPredicate("gecode_constraint_branch_14", gecode_constraint_branch_14, 4);
YAP_UserCPredicate("gecode_constraint_branch_13", gecode_constraint_branch_13, 4);
YAP_UserCPredicate("gecode_constraint_branch_15", gecode_constraint_branch_15, 4);
YAP_UserCPredicate("gecode_constraint_mult_239", gecode_constraint_mult_239, 5);
YAP_UserCPredicate("gecode_constraint_circuit_41", gecode_constraint_circuit_41, 6);
YAP_UserCPredicate("gecode_constraint_circuit_38", gecode_constraint_circuit_38, 6);
YAP_UserCPredicate("gecode_constraint_circuit_35", gecode_constraint_circuit_35, 6);
YAP_UserCPredicate("gecode_constraint_clause_48", gecode_constraint_clause_48, 5);
YAP_UserCPredicate("gecode_constraint_clause_46", gecode_constraint_clause_46, 5);
YAP_UserCPredicate("gecode_constraint_precede_275", gecode_constraint_precede_275, 4);
YAP_UserCPredicate("gecode_constraint_precede_272", gecode_constraint_precede_272, 4);
YAP_UserCPredicate("gecode_constraint_precede_271", gecode_constraint_precede_271, 4);
YAP_UserCPredicate("gecode_constraint_channel_30", gecode_constraint_channel_30, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_86", gecode_constraint_cumulative_86, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_89", gecode_constraint_cumulative_89, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_82", gecode_constraint_cumulative_82, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_85", gecode_constraint_cumulative_85, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_79", gecode_constraint_cumulative_79, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_98", gecode_constraint_cumulative_98, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_101", gecode_constraint_cumulative_101, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_94", gecode_constraint_cumulative_94, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_97", gecode_constraint_cumulative_97, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_91", gecode_constraint_cumulative_91, 7);
YAP_UserCPredicate("gecode_constraint_distinct_121", gecode_constraint_distinct_121, 3);
YAP_UserCPredicate("gecode_constraint_distinct_118", gecode_constraint_distinct_118, 3);
YAP_UserCPredicate("gecode_constraint_member_227", gecode_constraint_member_227, 5);
YAP_UserCPredicate("gecode_constraint_member_223", gecode_constraint_member_223, 5);
YAP_UserCPredicate("gecode_constraint_mod_236", gecode_constraint_mod_236, 4);
YAP_UserCPredicate("gecode_constraint_sqr_344", gecode_constraint_sqr_344, 3);
YAP_UserCPredicate("gecode_constraint_sequence_337", gecode_constraint_sequence_337, 7);
YAP_UserCPredicate("gecode_constraint_sequence_335", gecode_constraint_sequence_335, 7);
YAP_UserCPredicate("gecode_constraint_path_264", gecode_constraint_path_264, 7);
YAP_UserCPredicate("gecode_constraint_path_261", gecode_constraint_path_261, 7);
YAP_UserCPredicate("gecode_constraint_path_258", gecode_constraint_path_258, 7);
YAP_UserCPredicate("gecode_constraint_divmod_125", gecode_constraint_divmod_125, 6);
YAP_UserCPredicate("gecode_constraint_sorted_342", gecode_constraint_sorted_342, 3);
YAP_UserCPredicate("gecode_constraint_circuit_44", gecode_constraint_circuit_44, 3);
YAP_UserCPredicate("gecode_constraint_circuit_43", gecode_constraint_circuit_43, 3);
YAP_UserCPredicate("gecode_constraint_channel_31", gecode_constraint_channel_31, 3);
YAP_UserCPredicate("gecode_constraint_channel_28", gecode_constraint_channel_28, 3);
YAP_UserCPredicate("gecode_constraint_channel_26", gecode_constraint_channel_26, 3);
YAP_UserCPredicate("gecode_constraint_channel_22", gecode_constraint_channel_22, 3);
YAP_UserCPredicate("gecode_constraint_channel_25", gecode_constraint_channel_25, 3);
YAP_UserCPredicate("gecode_constraint_channel_20", gecode_constraint_channel_20, 3);
YAP_UserCPredicate("gecode_constraint_count_52", gecode_constraint_count_52, 5);
YAP_UserCPredicate("gecode_constraint_count_54", gecode_constraint_count_54, 5);
YAP_UserCPredicate("gecode_constraint_count_70", gecode_constraint_count_70, 5);
YAP_UserCPredicate("gecode_constraint_count_72", gecode_constraint_count_72, 5);
YAP_UserCPredicate("gecode_constraint_count_62", gecode_constraint_count_62, 5);
YAP_UserCPredicate("gecode_constraint_count_64", gecode_constraint_count_64, 5);
YAP_UserCPredicate("gecode_constraint_count_61", gecode_constraint_count_61, 5);
YAP_UserCPredicate("gecode_constraint_count_57", gecode_constraint_count_57, 5);
YAP_UserCPredicate("gecode_constraint_count_67", gecode_constraint_count_67, 5);
YAP_UserCPredicate("gecode_constraint_count_74", gecode_constraint_count_74, 5);
YAP_UserCPredicate("gecode_constraint_count_76", gecode_constraint_count_76, 5);
YAP_UserCPredicate("gecode_constraint_cumulatives_116", gecode_constraint_cumulatives_116, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_114", gecode_constraint_cumulatives_114, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_112", gecode_constraint_cumulatives_112, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_110", gecode_constraint_cumulatives_110, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_108", gecode_constraint_cumulatives_108, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_106", gecode_constraint_cumulatives_106, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_104", gecode_constraint_cumulatives_104, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_102", gecode_constraint_cumulatives_102, 8);
YAP_UserCPredicate("gecode_constraint_binpacking_11", gecode_constraint_binpacking_11, 5);
YAP_UserCPredicate("gecode_constraint_linear_209", gecode_constraint_linear_209, 6);
YAP_UserCPredicate("gecode_constraint_linear_213", gecode_constraint_linear_213, 6);
YAP_UserCPredicate("gecode_constraint_linear_185", gecode_constraint_linear_185, 6);
YAP_UserCPredicate("gecode_constraint_linear_189", gecode_constraint_linear_189, 6);
YAP_UserCPredicate("gecode_constraint_linear_200", gecode_constraint_linear_200, 6);
YAP_UserCPredicate("gecode_constraint_linear_203", gecode_constraint_linear_203, 6);
YAP_UserCPredicate("gecode_constraint_linear_204", gecode_constraint_linear_204, 6);
YAP_UserCPredicate("gecode_constraint_linear_207", gecode_constraint_linear_207, 6);
YAP_UserCPredicate("gecode_constraint_linear_192", gecode_constraint_linear_192, 6);
YAP_UserCPredicate("gecode_constraint_linear_195", gecode_constraint_linear_195, 6);
YAP_UserCPredicate("gecode_constraint_linear_196", gecode_constraint_linear_196, 6);
YAP_UserCPredicate("gecode_constraint_linear_199", gecode_constraint_linear_199, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_246", gecode_constraint_nooverlap_246, 7);
YAP_UserCPredicate("gecode_constraint_nooverlap_241", gecode_constraint_nooverlap_241, 7);
YAP_UserCPredicate("gecode_constraint_div_123", gecode_constraint_div_123, 5);
YAP_UserCPredicate("gecode_constraint_sqr_345", gecode_constraint_sqr_345, 4);
YAP_UserCPredicate("gecode_constraint_path_265", gecode_constraint_path_265, 8);
YAP_UserCPredicate("gecode_constraint_path_262", gecode_constraint_path_262, 8);
YAP_UserCPredicate("gecode_constraint_path_259", gecode_constraint_path_259, 8);
YAP_UserCPredicate("gecode_constraint_unary_356", gecode_constraint_unary_356, 5);
YAP_UserCPredicate("gecode_constraint_unary_359", gecode_constraint_unary_359, 5);
YAP_UserCPredicate("gecode_constraint_unary_352", gecode_constraint_unary_352, 5);
YAP_UserCPredicate("gecode_constraint_unary_355", gecode_constraint_unary_355, 5);
YAP_UserCPredicate("gecode_constraint_unary_349", gecode_constraint_unary_349, 5);
YAP_UserCPredicate("gecode_constraint_sorted_340", gecode_constraint_sorted_340, 4);
YAP_UserCPredicate("gecode_constraint_sorted_343", gecode_constraint_sorted_343, 4);
YAP_UserCPredicate("gecode_constraint_element_161", gecode_constraint_element_161, 8);
YAP_UserCPredicate("gecode_constraint_element_155", gecode_constraint_element_155, 8);
YAP_UserCPredicate("gecode_constraint_element_173", gecode_constraint_element_173, 8);
YAP_UserCPredicate("gecode_constraint_element_171", gecode_constraint_element_171, 8);
YAP_UserCPredicate("gecode_constraint_element_159", gecode_constraint_element_159, 5);
YAP_UserCPredicate("gecode_constraint_element_163", gecode_constraint_element_163, 5);
YAP_UserCPredicate("gecode_constraint_element_153", gecode_constraint_element_153, 5);
YAP_UserCPredicate("gecode_constraint_element_151", gecode_constraint_element_151, 5);
YAP_UserCPredicate("gecode_constraint_element_182", gecode_constraint_element_182, 5);
YAP_UserCPredicate("gecode_constraint_element_180", gecode_constraint_element_180, 5);
YAP_UserCPredicate("gecode_constraint_element_178", gecode_constraint_element_178, 5);
YAP_UserCPredicate("gecode_constraint_element_176", gecode_constraint_element_176, 5);
YAP_UserCPredicate("gecode_constraint_element_169", gecode_constraint_element_169, 5);
YAP_UserCPredicate("gecode_constraint_element_175", gecode_constraint_element_175, 5);
YAP_UserCPredicate("gecode_constraint_element_167", gecode_constraint_element_167, 5);
YAP_UserCPredicate("gecode_constraint_sequence_339", gecode_constraint_sequence_339, 3);
YAP_UserCPredicate("gecode_constraint_circuit_39", gecode_constraint_circuit_39, 7);
YAP_UserCPredicate("gecode_constraint_precede_274", gecode_constraint_precede_274, 3);
YAP_UserCPredicate("gecode_constraint_precede_270", gecode_constraint_precede_270, 3);
YAP_UserCPredicate("gecode_constraint_cumulative_88", gecode_constraint_cumulative_88, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_84", gecode_constraint_cumulative_84, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_78", gecode_constraint_cumulative_78, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_81", gecode_constraint_cumulative_81, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_100", gecode_constraint_cumulative_100, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_96", gecode_constraint_cumulative_96, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_90", gecode_constraint_cumulative_90, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_93", gecode_constraint_cumulative_93, 6);
YAP_UserCPredicate("gecode_constraint_distinct_119", gecode_constraint_distinct_119, 4);
YAP_UserCPredicate("gecode_constraint_min_230", gecode_constraint_min_230, 3);
YAP_UserCPredicate("gecode_constraint_min_234", gecode_constraint_min_234, 3);
YAP_UserCPredicate("gecode_constraint_sqrt_347", gecode_constraint_sqrt_347, 4);
YAP_UserCPredicate("gecode_constraint_sequence_336", gecode_constraint_sequence_336, 6);
YAP_UserCPredicate("gecode_constraint_sequence_334", gecode_constraint_sequence_334, 6);
YAP_UserCPredicate("gecode_constraint_unshare_363", gecode_constraint_unshare_363, 3);
YAP_UserCPredicate("gecode_constraint_unshare_361", gecode_constraint_unshare_361, 3);
YAP_UserCPredicate("gecode_constraint_path_269", gecode_constraint_path_269, 6);
YAP_UserCPredicate("gecode_constraint_path_260", gecode_constraint_path_260, 6);
YAP_UserCPredicate("gecode_constraint_divmod_124", gecode_constraint_divmod_124, 5);
YAP_UserCPredicate("gecode_constraint_nooverlap_245", gecode_constraint_nooverlap_245, 9);
YAP_UserCPredicate("gecode_constraint_cumulative_80", gecode_constraint_cumulative_80, 5);
YAP_UserCPredicate("gecode_constraint_cumulative_92", gecode_constraint_cumulative_92, 5);
YAP_UserCPredicate("gecode_constraint_member_228", gecode_constraint_member_228, 3);
YAP_UserCPredicate("gecode_constraint_member_224", gecode_constraint_member_224, 3);
YAP_UserCPredicate("gecode_constraint_count_71", gecode_constraint_count_71, 6);
YAP_UserCPredicate("gecode_constraint_count_73", gecode_constraint_count_73, 6);
YAP_UserCPredicate("gecode_constraint_count_75", gecode_constraint_count_75, 6);
YAP_UserCPredicate("gecode_constraint_count_77", gecode_constraint_count_77, 6);
YAP_UserCPredicate("gecode_constraint_count_63", gecode_constraint_count_63, 6);
YAP_UserCPredicate("gecode_constraint_count_65", gecode_constraint_count_65, 6);
YAP_UserCPredicate("gecode_constraint_count_53", gecode_constraint_count_53, 6);
YAP_UserCPredicate("gecode_constraint_count_55", gecode_constraint_count_55, 6);
YAP_UserCPredicate("gecode_constraint_notMin_249", gecode_constraint_notMin_249, 3);
YAP_UserCPredicate("gecode_constraint_cumulative_87", gecode_constraint_cumulative_87, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_83", gecode_constraint_cumulative_83, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_99", gecode_constraint_cumulative_99, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_95", gecode_constraint_cumulative_95, 8);
YAP_UserCPredicate("gecode_constraint_branch_16", gecode_constraint_branch_16, 3);
YAP_UserCPredicate("gecode_constraint_branch_12", gecode_constraint_branch_12, 3);
YAP_UserCPredicate("gecode_constraint_branch_17", gecode_constraint_branch_17, 3);
YAP_UserCPredicate("gecode_constraint_dom_140", gecode_constraint_dom_140, 3);
YAP_UserCPredicate("gecode_constraint_dom_134", gecode_constraint_dom_134, 3);
YAP_UserCPredicate("gecode_constraint_dom_128", gecode_constraint_dom_128, 3);
YAP_UserCPredicate("gecode_constraint_dom_126", gecode_constraint_dom_126, 3);
YAP_UserCPredicate("gecode_constraint_linear_208", gecode_constraint_linear_208, 5);
YAP_UserCPredicate("gecode_constraint_linear_211", gecode_constraint_linear_211, 5);
YAP_UserCPredicate("gecode_constraint_linear_212", gecode_constraint_linear_212, 5);
YAP_UserCPredicate("gecode_constraint_linear_215", gecode_constraint_linear_215, 5);
YAP_UserCPredicate("gecode_constraint_linear_184", gecode_constraint_linear_184, 5);
YAP_UserCPredicate("gecode_constraint_linear_187", gecode_constraint_linear_187, 5);
YAP_UserCPredicate("gecode_constraint_linear_188", gecode_constraint_linear_188, 5);
YAP_UserCPredicate("gecode_constraint_linear_191", gecode_constraint_linear_191, 5);
YAP_UserCPredicate("gecode_constraint_linear_202", gecode_constraint_linear_202, 5);
YAP_UserCPredicate("gecode_constraint_linear_206", gecode_constraint_linear_206, 5);
YAP_UserCPredicate("gecode_constraint_linear_194", gecode_constraint_linear_194, 5);
YAP_UserCPredicate("gecode_constraint_linear_198", gecode_constraint_linear_198, 5);
YAP_UserCPredicate("gecode_constraint_nooverlap_240", gecode_constraint_nooverlap_240, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_243", gecode_constraint_nooverlap_243, 6);
YAP_UserCPredicate("gecode_constraint_element_183", gecode_constraint_element_183, 6);
YAP_UserCPredicate("gecode_constraint_element_181", gecode_constraint_element_181, 6);
YAP_UserCPredicate("gecode_constraint_element_179", gecode_constraint_element_179, 6);
YAP_UserCPredicate("gecode_constraint_element_177", gecode_constraint_element_177, 6);
YAP_UserCPredicate("gecode_constraint_rel_290", gecode_constraint_rel_290, 4);
YAP_UserCPredicate("gecode_constraint_rel_286", gecode_constraint_rel_286, 4);
YAP_UserCPredicate("gecode_constraint_rel_298", gecode_constraint_rel_298, 4);
YAP_UserCPredicate("gecode_constraint_rel_294", gecode_constraint_rel_294, 4);
YAP_UserCPredicate("gecode_constraint_rel_292", gecode_constraint_rel_292, 4);
YAP_UserCPredicate("gecode_constraint_rel_297", gecode_constraint_rel_297, 4);
YAP_UserCPredicate("gecode_constraint_rel_324", gecode_constraint_rel_324, 4);
YAP_UserCPredicate("gecode_constraint_rel_322", gecode_constraint_rel_322, 4);
YAP_UserCPredicate("gecode_constraint_rel_306", gecode_constraint_rel_306, 4);
YAP_UserCPredicate("gecode_constraint_rel_308", gecode_constraint_rel_308, 4);
YAP_UserCPredicate("gecode_constraint_rel_302", gecode_constraint_rel_302, 4);
YAP_UserCPredicate("gecode_constraint_rel_305", gecode_constraint_rel_305, 4);
YAP_UserCPredicate("gecode_constraint_rel_312", gecode_constraint_rel_312, 4);
YAP_UserCPredicate("gecode_constraint_rel_316", gecode_constraint_rel_316, 4);
YAP_UserCPredicate("gecode_constraint_rel_318", gecode_constraint_rel_318, 4);
YAP_UserCPredicate("gecode_constraint_rel_319", gecode_constraint_rel_319, 4);
YAP_UserCPredicate("gecode_constraint_rel_325", gecode_constraint_rel_325, 4);
YAP_UserCPredicate("gecode_constraint_rel_330", gecode_constraint_rel_330, 4);
YAP_UserCPredicate("gecode_constraint_rel_332", gecode_constraint_rel_332, 4);
YAP_UserCPredicate("gecode_constraint_rel_278", gecode_constraint_rel_278, 4);
YAP_UserCPredicate("gecode_constraint_rel_276", gecode_constraint_rel_276, 4);
YAP_UserCPredicate("gecode_constraint_min_233", gecode_constraint_min_233, 5);
YAP_UserCPredicate("gecode_constraint_count_68", gecode_constraint_count_68, 3);
YAP_UserCPredicate("gecode_constraint_count_58", gecode_constraint_count_58, 3);

View File

@ -0,0 +1 @@
3.7.3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
static IntRelType gecode_IntRelType_from_term(YAP_Term);
static BoolOpType gecode_BoolOpType_from_term(YAP_Term);
static IntConLevel gecode_IntConLevel_from_term(YAP_Term);
static TaskType gecode_TaskType_from_term(YAP_Term);
static ExtensionalPropKind gecode_ExtensionalPropKind_from_term(YAP_Term);
static IntVarBranch gecode_IntVarBranch_from_term(YAP_Term);
static IntValBranch gecode_IntValBranch_from_term(YAP_Term);
static IntAssign gecode_IntAssign_from_term(YAP_Term);
static SetRelType gecode_SetRelType_from_term(YAP_Term);
static SetOpType gecode_SetOpType_from_term(YAP_Term);
static SetVarBranch gecode_SetVarBranch_from_term(YAP_Term);
static SetValBranch gecode_SetValBranch_from_term(YAP_Term);
static SetAssign gecode_SetAssign_from_term(YAP_Term);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,698 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
{ YAP_Atom X= YAP_LookupAtom("IRT_EQ");
gecode_IRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_NQ");
gecode_IRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_LQ");
gecode_IRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_LE");
gecode_IRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_GQ");
gecode_IRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_GR");
gecode_IRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_AND");
gecode_BOT_AND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_OR");
gecode_BOT_OR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_IMP");
gecode_BOT_IMP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_EQV");
gecode_BOT_EQV = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_XOR");
gecode_BOT_XOR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_VAL");
gecode_ICL_VAL = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_BND");
gecode_ICL_BND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_DOM");
gecode_ICL_DOM = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_DEF");
gecode_ICL_DEF = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXP");
gecode_TT_FIXP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXS");
gecode_TT_FIXS = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXE");
gecode_TT_FIXE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_DEF");
gecode_EPK_DEF = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_SPEED");
gecode_EPK_SPEED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_MEMORY");
gecode_EPK_MEMORY = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_NONE");
gecode_INT_VAR_NONE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_RND");
gecode_INT_VAR_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_DEGREE_MIN");
gecode_INT_VAR_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_DEGREE_MAX");
gecode_INT_VAR_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_AFC_MIN");
gecode_INT_VAR_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_AFC_MAX");
gecode_INT_VAR_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MIN_MIN");
gecode_INT_VAR_MIN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MIN_MAX");
gecode_INT_VAR_MIN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MAX_MIN");
gecode_INT_VAR_MAX_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_MAX_MAX");
gecode_INT_VAR_MAX_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_MIN");
gecode_INT_VAR_SIZE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_MAX");
gecode_INT_VAR_SIZE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_DEGREE_MIN");
gecode_INT_VAR_SIZE_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_DEGREE_MAX");
gecode_INT_VAR_SIZE_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_AFC_MIN");
gecode_INT_VAR_SIZE_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_SIZE_AFC_MAX");
gecode_INT_VAR_SIZE_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MIN_MIN");
gecode_INT_VAR_REGRET_MIN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MIN_MAX");
gecode_INT_VAR_REGRET_MIN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MAX_MIN");
gecode_INT_VAR_REGRET_MAX_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAR_REGRET_MAX_MAX");
gecode_INT_VAR_REGRET_MAX_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_MIN");
gecode_INT_VAL_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_MED");
gecode_INT_VAL_MED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_MAX");
gecode_INT_VAL_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_RND");
gecode_INT_VAL_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_SPLIT_MIN");
gecode_INT_VAL_SPLIT_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_SPLIT_MAX");
gecode_INT_VAL_SPLIT_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_RANGE_MIN");
gecode_INT_VAL_RANGE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VAL_RANGE_MAX");
gecode_INT_VAL_RANGE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VALUES_MIN");
gecode_INT_VALUES_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_VALUES_MAX");
gecode_INT_VALUES_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_MIN");
gecode_INT_ASSIGN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_MED");
gecode_INT_ASSIGN_MED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_MAX");
gecode_INT_ASSIGN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("INT_ASSIGN_RND");
gecode_INT_ASSIGN_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_EQ");
gecode_SRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_NQ");
gecode_SRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_SUB");
gecode_SRT_SUB = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_SUP");
gecode_SRT_SUP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ");
gecode_SRT_DISJ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL");
gecode_SRT_CMPL = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_LQ");
gecode_SRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_LE");
gecode_SRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_GQ");
gecode_SRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_GR");
gecode_SRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_UNION");
gecode_SOT_UNION = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION");
gecode_SOT_DUNION = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_INTER");
gecode_SOT_INTER = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS");
gecode_SOT_MINUS = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_NONE");
gecode_SET_VAR_NONE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_RND");
gecode_SET_VAR_RND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_DEGREE_MIN");
gecode_SET_VAR_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_DEGREE_MAX");
gecode_SET_VAR_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_AFC_MIN");
gecode_SET_VAR_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_AFC_MAX");
gecode_SET_VAR_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MIN_MIN");
gecode_SET_VAR_MIN_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MIN_MAX");
gecode_SET_VAR_MIN_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MAX_MIN");
gecode_SET_VAR_MAX_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_MAX_MAX");
gecode_SET_VAR_MAX_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_MIN");
gecode_SET_VAR_SIZE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_MAX");
gecode_SET_VAR_SIZE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_DEGREE_MIN");
gecode_SET_VAR_SIZE_DEGREE_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_DEGREE_MAX");
gecode_SET_VAR_SIZE_DEGREE_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_AFC_MIN");
gecode_SET_VAR_SIZE_AFC_MIN = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAR_SIZE_AFC_MAX");
gecode_SET_VAR_SIZE_AFC_MAX = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MIN_INC");
gecode_SET_VAL_MIN_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MIN_EXC");
gecode_SET_VAL_MIN_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MED_INC");
gecode_SET_VAL_MED_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MED_EXC");
gecode_SET_VAL_MED_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MAX_INC");
gecode_SET_VAL_MAX_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_MAX_EXC");
gecode_SET_VAL_MAX_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_RND_INC");
gecode_SET_VAL_RND_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_VAL_RND_EXC");
gecode_SET_VAL_RND_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MIN_INC");
gecode_SET_ASSIGN_MIN_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MIN_EXC");
gecode_SET_ASSIGN_MIN_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MED_INC");
gecode_SET_ASSIGN_MED_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MED_EXC");
gecode_SET_ASSIGN_MED_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MAX_INC");
gecode_SET_ASSIGN_MAX_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_MAX_EXC");
gecode_SET_ASSIGN_MAX_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_RND_INC");
gecode_SET_ASSIGN_RND_INC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SET_ASSIGN_RND_EXC");
gecode_SET_ASSIGN_RND_EXC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
YAP_UserCPredicate("gecode_constraint_unary_357", gecode_constraint_unary_357, 6);
YAP_UserCPredicate("gecode_constraint_unary_353", gecode_constraint_unary_353, 6);
YAP_UserCPredicate("gecode_constraint_nvalues_255", gecode_constraint_nvalues_255, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_257", gecode_constraint_nvalues_257, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_251", gecode_constraint_nvalues_251, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_253", gecode_constraint_nvalues_253, 5);
YAP_UserCPredicate("gecode_constraint_max_218", gecode_constraint_max_218, 4);
YAP_UserCPredicate("gecode_constraint_max_217", gecode_constraint_max_217, 4);
YAP_UserCPredicate("gecode_constraint_max_221", gecode_constraint_max_221, 4);
YAP_UserCPredicate("gecode_constraint_dom_139", gecode_constraint_dom_139, 6);
YAP_UserCPredicate("gecode_constraint_dom_149", gecode_constraint_dom_149, 6);
YAP_UserCPredicate("gecode_constraint_convex_51", gecode_constraint_convex_51, 3);
YAP_UserCPredicate("gecode_constraint_nooverlap_242", gecode_constraint_nooverlap_242, 5);
YAP_UserCPredicate("gecode_constraint_assign_4", gecode_constraint_assign_4, 3);
YAP_UserCPredicate("gecode_constraint_assign_3", gecode_constraint_assign_3, 3);
YAP_UserCPredicate("gecode_constraint_assign_5", gecode_constraint_assign_5, 3);
YAP_UserCPredicate("gecode_constraint_assign_7", gecode_constraint_assign_7, 3);
YAP_UserCPredicate("gecode_constraint_assign_6", gecode_constraint_assign_6, 3);
YAP_UserCPredicate("gecode_constraint_assign_8", gecode_constraint_assign_8, 3);
YAP_UserCPredicate("gecode_constraint_element_158", gecode_constraint_element_158, 4);
YAP_UserCPredicate("gecode_constraint_element_162", gecode_constraint_element_162, 4);
YAP_UserCPredicate("gecode_constraint_element_152", gecode_constraint_element_152, 4);
YAP_UserCPredicate("gecode_constraint_element_150", gecode_constraint_element_150, 4);
YAP_UserCPredicate("gecode_constraint_element_157", gecode_constraint_element_157, 4);
YAP_UserCPredicate("gecode_constraint_element_165", gecode_constraint_element_165, 4);
YAP_UserCPredicate("gecode_constraint_element_168", gecode_constraint_element_168, 4);
YAP_UserCPredicate("gecode_constraint_element_174", gecode_constraint_element_174, 4);
YAP_UserCPredicate("gecode_constraint_element_166", gecode_constraint_element_166, 4);
YAP_UserCPredicate("gecode_constraint_sequence_338", gecode_constraint_sequence_338, 2);
YAP_UserCPredicate("gecode_constraint_notMax_248", gecode_constraint_notMax_248, 3);
YAP_UserCPredicate("gecode_constraint_unary_350", gecode_constraint_unary_350, 3);
YAP_UserCPredicate("gecode_constraint_circuit_45", gecode_constraint_circuit_45, 4);
YAP_UserCPredicate("gecode_constraint_circuit_36", gecode_constraint_circuit_36, 4);
YAP_UserCPredicate("gecode_constraint_dom_138", gecode_constraint_dom_138, 5);
YAP_UserCPredicate("gecode_constraint_dom_143", gecode_constraint_dom_143, 5);
YAP_UserCPredicate("gecode_constraint_dom_137", gecode_constraint_dom_137, 5);
YAP_UserCPredicate("gecode_constraint_dom_133", gecode_constraint_dom_133, 5);
YAP_UserCPredicate("gecode_constraint_dom_131", gecode_constraint_dom_131, 5);
YAP_UserCPredicate("gecode_constraint_dom_148", gecode_constraint_dom_148, 5);
YAP_UserCPredicate("gecode_constraint_dom_147", gecode_constraint_dom_147, 5);
YAP_UserCPredicate("gecode_constraint_dom_145", gecode_constraint_dom_145, 5);
YAP_UserCPredicate("gecode_constraint_channel_32", gecode_constraint_channel_32, 4);
YAP_UserCPredicate("gecode_constraint_channel_27", gecode_constraint_channel_27, 4);
YAP_UserCPredicate("gecode_constraint_channel_23", gecode_constraint_channel_23, 4);
YAP_UserCPredicate("gecode_constraint_channel_21", gecode_constraint_channel_21, 4);
YAP_UserCPredicate("gecode_constraint_nooverlap_244", gecode_constraint_nooverlap_244, 8);
YAP_UserCPredicate("gecode_constraint_nooverlap_247", gecode_constraint_nooverlap_247, 8);
YAP_UserCPredicate("gecode_constraint_element_160", gecode_constraint_element_160, 7);
YAP_UserCPredicate("gecode_constraint_element_154", gecode_constraint_element_154, 7);
YAP_UserCPredicate("gecode_constraint_element_156", gecode_constraint_element_156, 7);
YAP_UserCPredicate("gecode_constraint_element_164", gecode_constraint_element_164, 7);
YAP_UserCPredicate("gecode_constraint_element_172", gecode_constraint_element_172, 7);
YAP_UserCPredicate("gecode_constraint_element_170", gecode_constraint_element_170, 7);
YAP_UserCPredicate("gecode_constraint_max_216", gecode_constraint_max_216, 3);
YAP_UserCPredicate("gecode_constraint_max_220", gecode_constraint_max_220, 3);
YAP_UserCPredicate("gecode_constraint_unshare_362", gecode_constraint_unshare_362, 2);
YAP_UserCPredicate("gecode_constraint_unshare_360", gecode_constraint_unshare_360, 2);
YAP_UserCPredicate("gecode_constraint_path_268", gecode_constraint_path_268, 5);
YAP_UserCPredicate("gecode_constraint_path_267", gecode_constraint_path_267, 5);
YAP_UserCPredicate("gecode_constraint_mult_238", gecode_constraint_mult_238, 4);
YAP_UserCPredicate("gecode_constraint_clause_49", gecode_constraint_clause_49, 6);
YAP_UserCPredicate("gecode_constraint_clause_47", gecode_constraint_clause_47, 6);
YAP_UserCPredicate("gecode_constraint_precede_273", gecode_constraint_precede_273, 5);
YAP_UserCPredicate("gecode_constraint_distinct_120", gecode_constraint_distinct_120, 2);
YAP_UserCPredicate("gecode_constraint_member_226", gecode_constraint_member_226, 4);
YAP_UserCPredicate("gecode_constraint_member_229", gecode_constraint_member_229, 4);
YAP_UserCPredicate("gecode_constraint_member_222", gecode_constraint_member_222, 4);
YAP_UserCPredicate("gecode_constraint_member_225", gecode_constraint_member_225, 4);
YAP_UserCPredicate("gecode_constraint_mod_237", gecode_constraint_mod_237, 5);
YAP_UserCPredicate("gecode_constraint_cardinality_18", gecode_constraint_cardinality_18, 3);
YAP_UserCPredicate("gecode_constraint_atmostOne_9", gecode_constraint_atmostOne_9, 3);
YAP_UserCPredicate("gecode_constraint_channelSorted_33", gecode_constraint_channelSorted_33, 3);
YAP_UserCPredicate("gecode_constraint_linear_210", gecode_constraint_linear_210, 4);
YAP_UserCPredicate("gecode_constraint_linear_214", gecode_constraint_linear_214, 4);
YAP_UserCPredicate("gecode_constraint_linear_186", gecode_constraint_linear_186, 4);
YAP_UserCPredicate("gecode_constraint_linear_190", gecode_constraint_linear_190, 4);
YAP_UserCPredicate("gecode_constraint_circuit_42", gecode_constraint_circuit_42, 2);
YAP_UserCPredicate("gecode_constraint_rel_288", gecode_constraint_rel_288, 5);
YAP_UserCPredicate("gecode_constraint_rel_291", gecode_constraint_rel_291, 5);
YAP_UserCPredicate("gecode_constraint_rel_284", gecode_constraint_rel_284, 5);
YAP_UserCPredicate("gecode_constraint_rel_287", gecode_constraint_rel_287, 5);
YAP_UserCPredicate("gecode_constraint_rel_282", gecode_constraint_rel_282, 5);
YAP_UserCPredicate("gecode_constraint_rel_280", gecode_constraint_rel_280, 5);
YAP_UserCPredicate("gecode_constraint_rel_299", gecode_constraint_rel_299, 5);
YAP_UserCPredicate("gecode_constraint_rel_295", gecode_constraint_rel_295, 5);
YAP_UserCPredicate("gecode_constraint_rel_293", gecode_constraint_rel_293, 5);
YAP_UserCPredicate("gecode_constraint_rel_323", gecode_constraint_rel_323, 5);
YAP_UserCPredicate("gecode_constraint_rel_321", gecode_constraint_rel_321, 5);
YAP_UserCPredicate("gecode_constraint_rel_307", gecode_constraint_rel_307, 5);
YAP_UserCPredicate("gecode_constraint_rel_309", gecode_constraint_rel_309, 5);
YAP_UserCPredicate("gecode_constraint_rel_303", gecode_constraint_rel_303, 5);
YAP_UserCPredicate("gecode_constraint_rel_310", gecode_constraint_rel_310, 5);
YAP_UserCPredicate("gecode_constraint_rel_313", gecode_constraint_rel_313, 5);
YAP_UserCPredicate("gecode_constraint_rel_314", gecode_constraint_rel_314, 5);
YAP_UserCPredicate("gecode_constraint_rel_317", gecode_constraint_rel_317, 5);
YAP_UserCPredicate("gecode_constraint_rel_320", gecode_constraint_rel_320, 5);
YAP_UserCPredicate("gecode_constraint_rel_331", gecode_constraint_rel_331, 5);
YAP_UserCPredicate("gecode_constraint_rel_333", gecode_constraint_rel_333, 5);
YAP_UserCPredicate("gecode_constraint_rel_279", gecode_constraint_rel_279, 5);
YAP_UserCPredicate("gecode_constraint_rel_277", gecode_constraint_rel_277, 5);
YAP_UserCPredicate("gecode_constraint_min_232", gecode_constraint_min_232, 4);
YAP_UserCPredicate("gecode_constraint_min_231", gecode_constraint_min_231, 4);
YAP_UserCPredicate("gecode_constraint_min_235", gecode_constraint_min_235, 4);
YAP_UserCPredicate("gecode_constraint_cardinality_19", gecode_constraint_cardinality_19, 4);
YAP_UserCPredicate("gecode_constraint_count_69", gecode_constraint_count_69, 4);
YAP_UserCPredicate("gecode_constraint_count_66", gecode_constraint_count_66, 4);
YAP_UserCPredicate("gecode_constraint_count_60", gecode_constraint_count_60, 4);
YAP_UserCPredicate("gecode_constraint_count_59", gecode_constraint_count_59, 4);
YAP_UserCPredicate("gecode_constraint_count_56", gecode_constraint_count_56, 4);
YAP_UserCPredicate("gecode_constraint_sqrt_346", gecode_constraint_sqrt_346, 3);
YAP_UserCPredicate("gecode_constraint_cumulatives_117", gecode_constraint_cumulatives_117, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_115", gecode_constraint_cumulatives_115, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_113", gecode_constraint_cumulatives_113, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_111", gecode_constraint_cumulatives_111, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_109", gecode_constraint_cumulatives_109, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_107", gecode_constraint_cumulatives_107, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_105", gecode_constraint_cumulatives_105, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_103", gecode_constraint_cumulatives_103, 9);
YAP_UserCPredicate("gecode_constraint_nvalues_254", gecode_constraint_nvalues_254, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_256", gecode_constraint_nvalues_256, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_250", gecode_constraint_nvalues_250, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_252", gecode_constraint_nvalues_252, 4);
YAP_UserCPredicate("gecode_constraint_binpacking_10", gecode_constraint_binpacking_10, 4);
YAP_UserCPredicate("gecode_constraint_linear_201", gecode_constraint_linear_201, 7);
YAP_UserCPredicate("gecode_constraint_linear_205", gecode_constraint_linear_205, 7);
YAP_UserCPredicate("gecode_constraint_linear_193", gecode_constraint_linear_193, 7);
YAP_UserCPredicate("gecode_constraint_linear_197", gecode_constraint_linear_197, 7);
YAP_UserCPredicate("gecode_constraint_abs_2", gecode_constraint_abs_2, 4);
YAP_UserCPredicate("gecode_constraint_convex_50", gecode_constraint_convex_50, 2);
YAP_UserCPredicate("gecode_constraint_div_122", gecode_constraint_div_122, 4);
YAP_UserCPredicate("gecode_constraint_rel_311", gecode_constraint_rel_311, 6);
YAP_UserCPredicate("gecode_constraint_rel_315", gecode_constraint_rel_315, 6);
YAP_UserCPredicate("gecode_constraint_rel_300", gecode_constraint_rel_300, 6);
YAP_UserCPredicate("gecode_constraint_rel_301", gecode_constraint_rel_301, 6);
YAP_UserCPredicate("gecode_constraint_rel_289", gecode_constraint_rel_289, 6);
YAP_UserCPredicate("gecode_constraint_rel_285", gecode_constraint_rel_285, 6);
YAP_UserCPredicate("gecode_constraint_rel_283", gecode_constraint_rel_283, 6);
YAP_UserCPredicate("gecode_constraint_rel_281", gecode_constraint_rel_281, 6);
YAP_UserCPredicate("gecode_constraint_rel_326", gecode_constraint_rel_326, 6);
YAP_UserCPredicate("gecode_constraint_rel_327", gecode_constraint_rel_327, 6);
YAP_UserCPredicate("gecode_constraint_rel_328", gecode_constraint_rel_328, 6);
YAP_UserCPredicate("gecode_constraint_rel_329", gecode_constraint_rel_329, 6);
YAP_UserCPredicate("gecode_constraint_weights_364", gecode_constraint_weights_364, 5);
YAP_UserCPredicate("gecode_constraint_max_219", gecode_constraint_max_219, 5);
YAP_UserCPredicate("gecode_constraint_path_263", gecode_constraint_path_263, 9);
YAP_UserCPredicate("gecode_constraint_unary_358", gecode_constraint_unary_358, 4);
YAP_UserCPredicate("gecode_constraint_unary_354", gecode_constraint_unary_354, 4);
YAP_UserCPredicate("gecode_constraint_unary_348", gecode_constraint_unary_348, 4);
YAP_UserCPredicate("gecode_constraint_unary_351", gecode_constraint_unary_351, 4);
YAP_UserCPredicate("gecode_constraint_sorted_341", gecode_constraint_sorted_341, 5);
YAP_UserCPredicate("gecode_constraint_circuit_40", gecode_constraint_circuit_40, 5);
YAP_UserCPredicate("gecode_constraint_circuit_37", gecode_constraint_circuit_37, 5);
YAP_UserCPredicate("gecode_constraint_circuit_34", gecode_constraint_circuit_34, 5);
YAP_UserCPredicate("gecode_constraint_dom_142", gecode_constraint_dom_142, 4);
YAP_UserCPredicate("gecode_constraint_dom_136", gecode_constraint_dom_136, 4);
YAP_UserCPredicate("gecode_constraint_dom_141", gecode_constraint_dom_141, 4);
YAP_UserCPredicate("gecode_constraint_dom_132", gecode_constraint_dom_132, 4);
YAP_UserCPredicate("gecode_constraint_dom_135", gecode_constraint_dom_135, 4);
YAP_UserCPredicate("gecode_constraint_dom_130", gecode_constraint_dom_130, 4);
YAP_UserCPredicate("gecode_constraint_dom_129", gecode_constraint_dom_129, 4);
YAP_UserCPredicate("gecode_constraint_dom_127", gecode_constraint_dom_127, 4);
YAP_UserCPredicate("gecode_constraint_dom_146", gecode_constraint_dom_146, 4);
YAP_UserCPredicate("gecode_constraint_dom_144", gecode_constraint_dom_144, 4);
YAP_UserCPredicate("gecode_constraint_abs_1", gecode_constraint_abs_1, 3);
YAP_UserCPredicate("gecode_constraint_channel_29", gecode_constraint_channel_29, 5);
YAP_UserCPredicate("gecode_constraint_channel_24", gecode_constraint_channel_24, 5);
YAP_UserCPredicate("gecode_constraint_rel_304", gecode_constraint_rel_304, 3);
YAP_UserCPredicate("gecode_constraint_rel_296", gecode_constraint_rel_296, 3);
YAP_UserCPredicate("gecode_constraint_path_266", gecode_constraint_path_266, 4);
YAP_UserCPredicate("gecode_constraint_branch_14", gecode_constraint_branch_14, 4);
YAP_UserCPredicate("gecode_constraint_branch_13", gecode_constraint_branch_13, 4);
YAP_UserCPredicate("gecode_constraint_branch_15", gecode_constraint_branch_15, 4);
YAP_UserCPredicate("gecode_constraint_mult_239", gecode_constraint_mult_239, 5);
YAP_UserCPredicate("gecode_constraint_circuit_41", gecode_constraint_circuit_41, 6);
YAP_UserCPredicate("gecode_constraint_circuit_38", gecode_constraint_circuit_38, 6);
YAP_UserCPredicate("gecode_constraint_circuit_35", gecode_constraint_circuit_35, 6);
YAP_UserCPredicate("gecode_constraint_clause_48", gecode_constraint_clause_48, 5);
YAP_UserCPredicate("gecode_constraint_clause_46", gecode_constraint_clause_46, 5);
YAP_UserCPredicate("gecode_constraint_precede_275", gecode_constraint_precede_275, 4);
YAP_UserCPredicate("gecode_constraint_precede_272", gecode_constraint_precede_272, 4);
YAP_UserCPredicate("gecode_constraint_precede_271", gecode_constraint_precede_271, 4);
YAP_UserCPredicate("gecode_constraint_channel_30", gecode_constraint_channel_30, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_86", gecode_constraint_cumulative_86, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_89", gecode_constraint_cumulative_89, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_82", gecode_constraint_cumulative_82, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_85", gecode_constraint_cumulative_85, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_79", gecode_constraint_cumulative_79, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_98", gecode_constraint_cumulative_98, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_101", gecode_constraint_cumulative_101, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_94", gecode_constraint_cumulative_94, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_97", gecode_constraint_cumulative_97, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_91", gecode_constraint_cumulative_91, 7);
YAP_UserCPredicate("gecode_constraint_distinct_121", gecode_constraint_distinct_121, 3);
YAP_UserCPredicate("gecode_constraint_distinct_118", gecode_constraint_distinct_118, 3);
YAP_UserCPredicate("gecode_constraint_member_227", gecode_constraint_member_227, 5);
YAP_UserCPredicate("gecode_constraint_member_223", gecode_constraint_member_223, 5);
YAP_UserCPredicate("gecode_constraint_mod_236", gecode_constraint_mod_236, 4);
YAP_UserCPredicate("gecode_constraint_sqr_344", gecode_constraint_sqr_344, 3);
YAP_UserCPredicate("gecode_constraint_sequence_337", gecode_constraint_sequence_337, 7);
YAP_UserCPredicate("gecode_constraint_sequence_335", gecode_constraint_sequence_335, 7);
YAP_UserCPredicate("gecode_constraint_path_264", gecode_constraint_path_264, 7);
YAP_UserCPredicate("gecode_constraint_path_261", gecode_constraint_path_261, 7);
YAP_UserCPredicate("gecode_constraint_path_258", gecode_constraint_path_258, 7);
YAP_UserCPredicate("gecode_constraint_divmod_125", gecode_constraint_divmod_125, 6);
YAP_UserCPredicate("gecode_constraint_sorted_342", gecode_constraint_sorted_342, 3);
YAP_UserCPredicate("gecode_constraint_circuit_44", gecode_constraint_circuit_44, 3);
YAP_UserCPredicate("gecode_constraint_circuit_43", gecode_constraint_circuit_43, 3);
YAP_UserCPredicate("gecode_constraint_channel_31", gecode_constraint_channel_31, 3);
YAP_UserCPredicate("gecode_constraint_channel_28", gecode_constraint_channel_28, 3);
YAP_UserCPredicate("gecode_constraint_channel_26", gecode_constraint_channel_26, 3);
YAP_UserCPredicate("gecode_constraint_channel_22", gecode_constraint_channel_22, 3);
YAP_UserCPredicate("gecode_constraint_channel_25", gecode_constraint_channel_25, 3);
YAP_UserCPredicate("gecode_constraint_channel_20", gecode_constraint_channel_20, 3);
YAP_UserCPredicate("gecode_constraint_count_52", gecode_constraint_count_52, 5);
YAP_UserCPredicate("gecode_constraint_count_54", gecode_constraint_count_54, 5);
YAP_UserCPredicate("gecode_constraint_count_70", gecode_constraint_count_70, 5);
YAP_UserCPredicate("gecode_constraint_count_72", gecode_constraint_count_72, 5);
YAP_UserCPredicate("gecode_constraint_count_62", gecode_constraint_count_62, 5);
YAP_UserCPredicate("gecode_constraint_count_64", gecode_constraint_count_64, 5);
YAP_UserCPredicate("gecode_constraint_count_61", gecode_constraint_count_61, 5);
YAP_UserCPredicate("gecode_constraint_count_57", gecode_constraint_count_57, 5);
YAP_UserCPredicate("gecode_constraint_count_67", gecode_constraint_count_67, 5);
YAP_UserCPredicate("gecode_constraint_count_74", gecode_constraint_count_74, 5);
YAP_UserCPredicate("gecode_constraint_count_76", gecode_constraint_count_76, 5);
YAP_UserCPredicate("gecode_constraint_cumulatives_116", gecode_constraint_cumulatives_116, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_114", gecode_constraint_cumulatives_114, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_112", gecode_constraint_cumulatives_112, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_110", gecode_constraint_cumulatives_110, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_108", gecode_constraint_cumulatives_108, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_106", gecode_constraint_cumulatives_106, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_104", gecode_constraint_cumulatives_104, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_102", gecode_constraint_cumulatives_102, 8);
YAP_UserCPredicate("gecode_constraint_binpacking_11", gecode_constraint_binpacking_11, 5);
YAP_UserCPredicate("gecode_constraint_linear_209", gecode_constraint_linear_209, 6);
YAP_UserCPredicate("gecode_constraint_linear_213", gecode_constraint_linear_213, 6);
YAP_UserCPredicate("gecode_constraint_linear_185", gecode_constraint_linear_185, 6);
YAP_UserCPredicate("gecode_constraint_linear_189", gecode_constraint_linear_189, 6);
YAP_UserCPredicate("gecode_constraint_linear_200", gecode_constraint_linear_200, 6);
YAP_UserCPredicate("gecode_constraint_linear_203", gecode_constraint_linear_203, 6);
YAP_UserCPredicate("gecode_constraint_linear_204", gecode_constraint_linear_204, 6);
YAP_UserCPredicate("gecode_constraint_linear_207", gecode_constraint_linear_207, 6);
YAP_UserCPredicate("gecode_constraint_linear_192", gecode_constraint_linear_192, 6);
YAP_UserCPredicate("gecode_constraint_linear_195", gecode_constraint_linear_195, 6);
YAP_UserCPredicate("gecode_constraint_linear_196", gecode_constraint_linear_196, 6);
YAP_UserCPredicate("gecode_constraint_linear_199", gecode_constraint_linear_199, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_246", gecode_constraint_nooverlap_246, 7);
YAP_UserCPredicate("gecode_constraint_nooverlap_241", gecode_constraint_nooverlap_241, 7);
YAP_UserCPredicate("gecode_constraint_div_123", gecode_constraint_div_123, 5);
YAP_UserCPredicate("gecode_constraint_sqr_345", gecode_constraint_sqr_345, 4);
YAP_UserCPredicate("gecode_constraint_path_265", gecode_constraint_path_265, 8);
YAP_UserCPredicate("gecode_constraint_path_262", gecode_constraint_path_262, 8);
YAP_UserCPredicate("gecode_constraint_path_259", gecode_constraint_path_259, 8);
YAP_UserCPredicate("gecode_constraint_unary_356", gecode_constraint_unary_356, 5);
YAP_UserCPredicate("gecode_constraint_unary_359", gecode_constraint_unary_359, 5);
YAP_UserCPredicate("gecode_constraint_unary_352", gecode_constraint_unary_352, 5);
YAP_UserCPredicate("gecode_constraint_unary_355", gecode_constraint_unary_355, 5);
YAP_UserCPredicate("gecode_constraint_unary_349", gecode_constraint_unary_349, 5);
YAP_UserCPredicate("gecode_constraint_sorted_340", gecode_constraint_sorted_340, 4);
YAP_UserCPredicate("gecode_constraint_sorted_343", gecode_constraint_sorted_343, 4);
YAP_UserCPredicate("gecode_constraint_element_161", gecode_constraint_element_161, 8);
YAP_UserCPredicate("gecode_constraint_element_155", gecode_constraint_element_155, 8);
YAP_UserCPredicate("gecode_constraint_element_173", gecode_constraint_element_173, 8);
YAP_UserCPredicate("gecode_constraint_element_171", gecode_constraint_element_171, 8);
YAP_UserCPredicate("gecode_constraint_element_159", gecode_constraint_element_159, 5);
YAP_UserCPredicate("gecode_constraint_element_163", gecode_constraint_element_163, 5);
YAP_UserCPredicate("gecode_constraint_element_153", gecode_constraint_element_153, 5);
YAP_UserCPredicate("gecode_constraint_element_151", gecode_constraint_element_151, 5);
YAP_UserCPredicate("gecode_constraint_element_182", gecode_constraint_element_182, 5);
YAP_UserCPredicate("gecode_constraint_element_180", gecode_constraint_element_180, 5);
YAP_UserCPredicate("gecode_constraint_element_178", gecode_constraint_element_178, 5);
YAP_UserCPredicate("gecode_constraint_element_176", gecode_constraint_element_176, 5);
YAP_UserCPredicate("gecode_constraint_element_169", gecode_constraint_element_169, 5);
YAP_UserCPredicate("gecode_constraint_element_175", gecode_constraint_element_175, 5);
YAP_UserCPredicate("gecode_constraint_element_167", gecode_constraint_element_167, 5);
YAP_UserCPredicate("gecode_constraint_sequence_339", gecode_constraint_sequence_339, 3);
YAP_UserCPredicate("gecode_constraint_circuit_39", gecode_constraint_circuit_39, 7);
YAP_UserCPredicate("gecode_constraint_precede_274", gecode_constraint_precede_274, 3);
YAP_UserCPredicate("gecode_constraint_precede_270", gecode_constraint_precede_270, 3);
YAP_UserCPredicate("gecode_constraint_cumulative_88", gecode_constraint_cumulative_88, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_84", gecode_constraint_cumulative_84, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_78", gecode_constraint_cumulative_78, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_81", gecode_constraint_cumulative_81, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_100", gecode_constraint_cumulative_100, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_96", gecode_constraint_cumulative_96, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_90", gecode_constraint_cumulative_90, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_93", gecode_constraint_cumulative_93, 6);
YAP_UserCPredicate("gecode_constraint_distinct_119", gecode_constraint_distinct_119, 4);
YAP_UserCPredicate("gecode_constraint_min_230", gecode_constraint_min_230, 3);
YAP_UserCPredicate("gecode_constraint_min_234", gecode_constraint_min_234, 3);
YAP_UserCPredicate("gecode_constraint_sqrt_347", gecode_constraint_sqrt_347, 4);
YAP_UserCPredicate("gecode_constraint_sequence_336", gecode_constraint_sequence_336, 6);
YAP_UserCPredicate("gecode_constraint_sequence_334", gecode_constraint_sequence_334, 6);
YAP_UserCPredicate("gecode_constraint_unshare_363", gecode_constraint_unshare_363, 3);
YAP_UserCPredicate("gecode_constraint_unshare_361", gecode_constraint_unshare_361, 3);
YAP_UserCPredicate("gecode_constraint_path_269", gecode_constraint_path_269, 6);
YAP_UserCPredicate("gecode_constraint_path_260", gecode_constraint_path_260, 6);
YAP_UserCPredicate("gecode_constraint_divmod_124", gecode_constraint_divmod_124, 5);
YAP_UserCPredicate("gecode_constraint_nooverlap_245", gecode_constraint_nooverlap_245, 9);
YAP_UserCPredicate("gecode_constraint_cumulative_80", gecode_constraint_cumulative_80, 5);
YAP_UserCPredicate("gecode_constraint_cumulative_92", gecode_constraint_cumulative_92, 5);
YAP_UserCPredicate("gecode_constraint_member_228", gecode_constraint_member_228, 3);
YAP_UserCPredicate("gecode_constraint_member_224", gecode_constraint_member_224, 3);
YAP_UserCPredicate("gecode_constraint_count_71", gecode_constraint_count_71, 6);
YAP_UserCPredicate("gecode_constraint_count_73", gecode_constraint_count_73, 6);
YAP_UserCPredicate("gecode_constraint_count_75", gecode_constraint_count_75, 6);
YAP_UserCPredicate("gecode_constraint_count_77", gecode_constraint_count_77, 6);
YAP_UserCPredicate("gecode_constraint_count_63", gecode_constraint_count_63, 6);
YAP_UserCPredicate("gecode_constraint_count_65", gecode_constraint_count_65, 6);
YAP_UserCPredicate("gecode_constraint_count_53", gecode_constraint_count_53, 6);
YAP_UserCPredicate("gecode_constraint_count_55", gecode_constraint_count_55, 6);
YAP_UserCPredicate("gecode_constraint_notMin_249", gecode_constraint_notMin_249, 3);
YAP_UserCPredicate("gecode_constraint_cumulative_87", gecode_constraint_cumulative_87, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_83", gecode_constraint_cumulative_83, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_99", gecode_constraint_cumulative_99, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_95", gecode_constraint_cumulative_95, 8);
YAP_UserCPredicate("gecode_constraint_branch_16", gecode_constraint_branch_16, 3);
YAP_UserCPredicate("gecode_constraint_branch_12", gecode_constraint_branch_12, 3);
YAP_UserCPredicate("gecode_constraint_branch_17", gecode_constraint_branch_17, 3);
YAP_UserCPredicate("gecode_constraint_dom_140", gecode_constraint_dom_140, 3);
YAP_UserCPredicate("gecode_constraint_dom_134", gecode_constraint_dom_134, 3);
YAP_UserCPredicate("gecode_constraint_dom_128", gecode_constraint_dom_128, 3);
YAP_UserCPredicate("gecode_constraint_dom_126", gecode_constraint_dom_126, 3);
YAP_UserCPredicate("gecode_constraint_linear_208", gecode_constraint_linear_208, 5);
YAP_UserCPredicate("gecode_constraint_linear_211", gecode_constraint_linear_211, 5);
YAP_UserCPredicate("gecode_constraint_linear_212", gecode_constraint_linear_212, 5);
YAP_UserCPredicate("gecode_constraint_linear_215", gecode_constraint_linear_215, 5);
YAP_UserCPredicate("gecode_constraint_linear_184", gecode_constraint_linear_184, 5);
YAP_UserCPredicate("gecode_constraint_linear_187", gecode_constraint_linear_187, 5);
YAP_UserCPredicate("gecode_constraint_linear_188", gecode_constraint_linear_188, 5);
YAP_UserCPredicate("gecode_constraint_linear_191", gecode_constraint_linear_191, 5);
YAP_UserCPredicate("gecode_constraint_linear_202", gecode_constraint_linear_202, 5);
YAP_UserCPredicate("gecode_constraint_linear_206", gecode_constraint_linear_206, 5);
YAP_UserCPredicate("gecode_constraint_linear_194", gecode_constraint_linear_194, 5);
YAP_UserCPredicate("gecode_constraint_linear_198", gecode_constraint_linear_198, 5);
YAP_UserCPredicate("gecode_constraint_nooverlap_240", gecode_constraint_nooverlap_240, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_243", gecode_constraint_nooverlap_243, 6);
YAP_UserCPredicate("gecode_constraint_element_183", gecode_constraint_element_183, 6);
YAP_UserCPredicate("gecode_constraint_element_181", gecode_constraint_element_181, 6);
YAP_UserCPredicate("gecode_constraint_element_179", gecode_constraint_element_179, 6);
YAP_UserCPredicate("gecode_constraint_element_177", gecode_constraint_element_177, 6);
YAP_UserCPredicate("gecode_constraint_rel_290", gecode_constraint_rel_290, 4);
YAP_UserCPredicate("gecode_constraint_rel_286", gecode_constraint_rel_286, 4);
YAP_UserCPredicate("gecode_constraint_rel_298", gecode_constraint_rel_298, 4);
YAP_UserCPredicate("gecode_constraint_rel_294", gecode_constraint_rel_294, 4);
YAP_UserCPredicate("gecode_constraint_rel_292", gecode_constraint_rel_292, 4);
YAP_UserCPredicate("gecode_constraint_rel_297", gecode_constraint_rel_297, 4);
YAP_UserCPredicate("gecode_constraint_rel_324", gecode_constraint_rel_324, 4);
YAP_UserCPredicate("gecode_constraint_rel_322", gecode_constraint_rel_322, 4);
YAP_UserCPredicate("gecode_constraint_rel_306", gecode_constraint_rel_306, 4);
YAP_UserCPredicate("gecode_constraint_rel_308", gecode_constraint_rel_308, 4);
YAP_UserCPredicate("gecode_constraint_rel_302", gecode_constraint_rel_302, 4);
YAP_UserCPredicate("gecode_constraint_rel_305", gecode_constraint_rel_305, 4);
YAP_UserCPredicate("gecode_constraint_rel_312", gecode_constraint_rel_312, 4);
YAP_UserCPredicate("gecode_constraint_rel_316", gecode_constraint_rel_316, 4);
YAP_UserCPredicate("gecode_constraint_rel_318", gecode_constraint_rel_318, 4);
YAP_UserCPredicate("gecode_constraint_rel_319", gecode_constraint_rel_319, 4);
YAP_UserCPredicate("gecode_constraint_rel_325", gecode_constraint_rel_325, 4);
YAP_UserCPredicate("gecode_constraint_rel_330", gecode_constraint_rel_330, 4);
YAP_UserCPredicate("gecode_constraint_rel_332", gecode_constraint_rel_332, 4);
YAP_UserCPredicate("gecode_constraint_rel_278", gecode_constraint_rel_278, 4);
YAP_UserCPredicate("gecode_constraint_rel_276", gecode_constraint_rel_276, 4);
YAP_UserCPredicate("gecode_constraint_min_233", gecode_constraint_min_233, 5);
YAP_UserCPredicate("gecode_constraint_count_68", gecode_constraint_count_68, 3);
YAP_UserCPredicate("gecode_constraint_count_58", gecode_constraint_count_58, 3);

File diff suppressed because it is too large Load Diff

12
library/gecode/README Normal file
View File

@ -0,0 +1,12 @@
Development of gecode/yap takes place in:
git@github.com:denys-duchier/yap-6.3.git
which tracks the official yap repository and is also regularly pulled into it.
see:
https://github.com/denys-duchier/yap-6.3
Enquiries/bug reports can be made either on the yap mailing list or to the
author denys.duchier /AT/ univ-orleans.fr.
What litle documentation there is can be found in file DOC.txt.

View File

@ -296,8 +296,9 @@ class Cluster(object):
# discriminating tree based on argument types
class DTree(object):
def __init__(self, i, preds):
def __init__(self, i, preds, cluster):
self.index = i
self.cluster = cluster
if len(preds) == 1 and len(preds[0].argtypes) == i:
self.is_leaf = True
self.pred = preds[0]
@ -313,7 +314,7 @@ class DTree(object):
d = []
dispatch[t.type] = d
d.append(p)
self.subtrees = tuple((t2,DTree(i+1,p2))
self.subtrees = tuple((t2,DTree(i+1,p2,cluster))
for t2,p2 in dispatch.iteritems())
def _generate_body(self, user_vars, lib_vars):
@ -325,7 +326,9 @@ class DTree(object):
def _generate_dispatch(self, i, user_vars, lib_vars):
if i == len(self.subtrees):
return PrologLiteral("throw(gecode_argument_error)")
return PrologLiteral("throw(gecode_argument_error(%s(%s),arg=%d))" \
% (self.cluster.name, ",".join(user_vars),
self.index+1))
typ, dtree = self.subtrees[i]
idx = self.index
X = user_vars[idx]
@ -371,7 +374,7 @@ class YAPConstraintGeneratorBase(PredGenerator):
def _dtreefy(self):
dtrees = {}
for key, cluster in self.clusters.iteritems():
dtree = DTree(0, cluster.preds)
dtree = DTree(0, cluster.preds, cluster)
dtrees[key] = dtree
self.dtrees = dtrees
@ -641,7 +644,11 @@ def gecode_version():
global GECODE_VERSION
if GECODE_VERSION is not None:
return GECODE_VERSION
from distutils.ccompiler import new_compiler, customize_compiler
from distutils.ccompiler import new_compiler
try:
from distutils.ccompiler import customize_compiler
except:
from distutils.sysconfig import customize_compiler
import os
cxx = new_compiler()
customize_compiler(cxx)

View File

@ -1,4 +1,4 @@
GECODEDIR := $(shell g++ -q $(CPPFLAGS) $(CXXFLAGS) -H -E gecodedir.hh 2>&1 >/dev/null | grep gecode/kernel.hh | awk '{print $$2}' | sed 's|/kernel.hh||')
GECODEDIR := $(shell g++ $(CPPFLAGS) $(CXXFLAGS) -H -E gecodedir.hh 2>&1 >/dev/null | grep gecode/kernel.hh | awk '{print $$2}' | sed 's|/kernel.hh||')
GECODECONFIG := $(GECODEDIR)/support/config.hpp
GECODEVERSION := $(shell cat $(GECODECONFIG) | egrep '\<GECODE_VERSION\>' | awk '{print $$3}' | sed 's/"//g')
PROTOTYPES = ../gecode-prototypes-$(GECODEVERSION).hh

View File

@ -0,0 +1,113 @@
# This file was automatically extracted from Gecode source files.
# It is subject to the same Copyright as the source files from which
# it is derived, and is distributed under the same Licensing conditions.
ENUM_CLASSES = []
class ScriptMode(object):
TYPE = 'ScriptMode'
ENUM = ['SM_SOLUTION','SM_TIME','SM_STAT','SM_GIST']
ENUM_CLASSES.append(ScriptMode)
class IntRelType(object):
TYPE = 'IntRelType'
ENUM = ['IRT_EQ','IRT_NQ','IRT_LQ','IRT_LE','IRT_GQ','IRT_GR']
ENUM_CLASSES.append(IntRelType)
class BoolOpType(object):
TYPE = 'BoolOpType'
ENUM = ['BOT_AND','BOT_OR','BOT_IMP','BOT_EQV','BOT_XOR']
ENUM_CLASSES.append(BoolOpType)
class IntConLevel(object):
TYPE = 'IntConLevel'
ENUM = ['ICL_VAL','ICL_BND','ICL_DOM','ICL_DEF']
ENUM_CLASSES.append(IntConLevel)
class TaskType(object):
TYPE = 'TaskType'
ENUM = ['TT_FIXP','TT_FIXS','TT_FIXE']
ENUM_CLASSES.append(TaskType)
class ExtensionalPropKind(object):
TYPE = 'ExtensionalPropKind'
ENUM = ['EPK_DEF','EPK_SPEED','EPK_MEMORY']
ENUM_CLASSES.append(ExtensionalPropKind)
class IntVarBranch(object):
TYPE = 'IntVarBranch'
ENUM = ['INT_VAR_NONE','INT_VAR_RND','INT_VAR_DEGREE_MIN','INT_VAR_DEGREE_MAX','INT_VAR_AFC_MIN','INT_VAR_AFC_MAX','INT_VAR_MIN_MIN','INT_VAR_MIN_MAX','INT_VAR_MAX_MIN','INT_VAR_MAX_MAX','INT_VAR_SIZE_MIN','INT_VAR_SIZE_MAX','INT_VAR_SIZE_DEGREE_MIN','INT_VAR_SIZE_DEGREE_MAX','INT_VAR_SIZE_AFC_MIN','INT_VAR_SIZE_AFC_MAX','INT_VAR_REGRET_MIN_MIN','INT_VAR_REGRET_MIN_MAX','INT_VAR_REGRET_MAX_MIN','INT_VAR_REGRET_MAX_MAX']
ENUM_CLASSES.append(IntVarBranch)
class IntValBranch(object):
TYPE = 'IntValBranch'
ENUM = ['INT_VAL_MIN','INT_VAL_MED','INT_VAL_MAX','INT_VAL_RND','INT_VAL_SPLIT_MIN','INT_VAL_SPLIT_MAX','INT_VAL_RANGE_MIN','INT_VAL_RANGE_MAX','INT_VALUES_MIN','INT_VALUES_MAX']
ENUM_CLASSES.append(IntValBranch)
class IntAssign(object):
TYPE = 'IntAssign'
ENUM = ['INT_ASSIGN_MIN','INT_ASSIGN_MED','INT_ASSIGN_MAX','INT_ASSIGN_RND']
ENUM_CLASSES.append(IntAssign)
class ViewSelStatus(object):
TYPE = 'ViewSelStatus'
ENUM = ['VSS_BEST','VSS_BETTER','VSS_TIE','VSS_WORSE']
ENUM_CLASSES.append(ViewSelStatus)
class ExecStatus(object):
TYPE = 'ExecStatus'
ENUM = ['__ES_SUBSUMED','ES_FAILED','ES_NOFIX','ES_OK','ES_FIX','ES_NOFIX_FORCE','__ES_PARTIAL']
ENUM_CLASSES.append(ExecStatus)
class ActorProperty(object):
TYPE = 'ActorProperty'
ENUM = ['AP_DISPOSE','AP_WEAKLY']
ENUM_CLASSES.append(ActorProperty)
class SpaceStatus(object):
TYPE = 'SpaceStatus'
ENUM = ['SS_FAILED','SS_SOLVED','SS_BRANCH']
ENUM_CLASSES.append(SpaceStatus)
class SetRelType(object):
TYPE = 'SetRelType'
ENUM = ['SRT_EQ','SRT_NQ','SRT_SUB','SRT_SUP','SRT_DISJ','SRT_CMPL','SRT_LQ','SRT_LE','SRT_GQ','SRT_GR']
ENUM_CLASSES.append(SetRelType)
class SetOpType(object):
TYPE = 'SetOpType'
ENUM = ['SOT_UNION','SOT_DUNION','SOT_INTER','SOT_MINUS']
ENUM_CLASSES.append(SetOpType)
class SetVarBranch(object):
TYPE = 'SetVarBranch'
ENUM = ['SET_VAR_NONE','SET_VAR_RND','SET_VAR_DEGREE_MIN','SET_VAR_DEGREE_MAX','SET_VAR_AFC_MIN','SET_VAR_AFC_MAX','SET_VAR_MIN_MIN','SET_VAR_MIN_MAX','SET_VAR_MAX_MIN','SET_VAR_MAX_MAX','SET_VAR_SIZE_MIN','SET_VAR_SIZE_MAX','SET_VAR_SIZE_DEGREE_MIN','SET_VAR_SIZE_DEGREE_MAX','SET_VAR_SIZE_AFC_MIN','SET_VAR_SIZE_AFC_MAX']
ENUM_CLASSES.append(SetVarBranch)
class SetValBranch(object):
TYPE = 'SetValBranch'
ENUM = ['SET_VAL_MIN_INC','SET_VAL_MIN_EXC','SET_VAL_MED_INC','SET_VAL_MED_EXC','SET_VAL_MAX_INC','SET_VAL_MAX_EXC','SET_VAL_RND_INC','SET_VAL_RND_EXC']
ENUM_CLASSES.append(SetValBranch)
class SetAssign(object):
TYPE = 'SetAssign'
ENUM = ['SET_ASSIGN_MIN_INC','SET_ASSIGN_MIN_EXC','SET_ASSIGN_MED_INC','SET_ASSIGN_MED_EXC','SET_ASSIGN_MAX_INC','SET_ASSIGN_MAX_EXC','SET_ASSIGN_RND_INC','SET_ASSIGN_RND_EXC']
ENUM_CLASSES.append(SetAssign)

View File

@ -0,0 +1,113 @@
# This file was automatically extracted from Gecode source files.
# It is subject to the same Copyright as the source files from which
# it is derived, and is distributed under the same Licensing conditions.
ENUM_CLASSES = []
class ScriptMode(object):
TYPE = 'ScriptMode'
ENUM = ['SM_SOLUTION','SM_TIME','SM_STAT','SM_GIST']
ENUM_CLASSES.append(ScriptMode)
class IntRelType(object):
TYPE = 'IntRelType'
ENUM = ['IRT_EQ','IRT_NQ','IRT_LQ','IRT_LE','IRT_GQ','IRT_GR']
ENUM_CLASSES.append(IntRelType)
class BoolOpType(object):
TYPE = 'BoolOpType'
ENUM = ['BOT_AND','BOT_OR','BOT_IMP','BOT_EQV','BOT_XOR']
ENUM_CLASSES.append(BoolOpType)
class IntConLevel(object):
TYPE = 'IntConLevel'
ENUM = ['ICL_VAL','ICL_BND','ICL_DOM','ICL_DEF']
ENUM_CLASSES.append(IntConLevel)
class TaskType(object):
TYPE = 'TaskType'
ENUM = ['TT_FIXP','TT_FIXS','TT_FIXE']
ENUM_CLASSES.append(TaskType)
class ExtensionalPropKind(object):
TYPE = 'ExtensionalPropKind'
ENUM = ['EPK_DEF','EPK_SPEED','EPK_MEMORY']
ENUM_CLASSES.append(ExtensionalPropKind)
class IntVarBranch(object):
TYPE = 'IntVarBranch'
ENUM = ['INT_VAR_NONE','INT_VAR_RND','INT_VAR_DEGREE_MIN','INT_VAR_DEGREE_MAX','INT_VAR_AFC_MIN','INT_VAR_AFC_MAX','INT_VAR_MIN_MIN','INT_VAR_MIN_MAX','INT_VAR_MAX_MIN','INT_VAR_MAX_MAX','INT_VAR_SIZE_MIN','INT_VAR_SIZE_MAX','INT_VAR_SIZE_DEGREE_MIN','INT_VAR_SIZE_DEGREE_MAX','INT_VAR_SIZE_AFC_MIN','INT_VAR_SIZE_AFC_MAX','INT_VAR_REGRET_MIN_MIN','INT_VAR_REGRET_MIN_MAX','INT_VAR_REGRET_MAX_MIN','INT_VAR_REGRET_MAX_MAX']
ENUM_CLASSES.append(IntVarBranch)
class IntValBranch(object):
TYPE = 'IntValBranch'
ENUM = ['INT_VAL_MIN','INT_VAL_MED','INT_VAL_MAX','INT_VAL_RND','INT_VAL_SPLIT_MIN','INT_VAL_SPLIT_MAX','INT_VAL_RANGE_MIN','INT_VAL_RANGE_MAX','INT_VALUES_MIN','INT_VALUES_MAX']
ENUM_CLASSES.append(IntValBranch)
class IntAssign(object):
TYPE = 'IntAssign'
ENUM = ['INT_ASSIGN_MIN','INT_ASSIGN_MED','INT_ASSIGN_MAX','INT_ASSIGN_RND']
ENUM_CLASSES.append(IntAssign)
class ViewSelStatus(object):
TYPE = 'ViewSelStatus'
ENUM = ['VSS_BEST','VSS_BETTER','VSS_TIE','VSS_WORSE']
ENUM_CLASSES.append(ViewSelStatus)
class ExecStatus(object):
TYPE = 'ExecStatus'
ENUM = ['__ES_SUBSUMED','ES_FAILED','ES_NOFIX','ES_OK','ES_FIX','ES_NOFIX_FORCE','__ES_PARTIAL']
ENUM_CLASSES.append(ExecStatus)
class ActorProperty(object):
TYPE = 'ActorProperty'
ENUM = ['AP_DISPOSE','AP_WEAKLY']
ENUM_CLASSES.append(ActorProperty)
class SpaceStatus(object):
TYPE = 'SpaceStatus'
ENUM = ['SS_FAILED','SS_SOLVED','SS_BRANCH']
ENUM_CLASSES.append(SpaceStatus)
class SetRelType(object):
TYPE = 'SetRelType'
ENUM = ['SRT_EQ','SRT_NQ','SRT_SUB','SRT_SUP','SRT_DISJ','SRT_CMPL','SRT_LQ','SRT_LE','SRT_GQ','SRT_GR']
ENUM_CLASSES.append(SetRelType)
class SetOpType(object):
TYPE = 'SetOpType'
ENUM = ['SOT_UNION','SOT_DUNION','SOT_INTER','SOT_MINUS']
ENUM_CLASSES.append(SetOpType)
class SetVarBranch(object):
TYPE = 'SetVarBranch'
ENUM = ['SET_VAR_NONE','SET_VAR_RND','SET_VAR_DEGREE_MIN','SET_VAR_DEGREE_MAX','SET_VAR_AFC_MIN','SET_VAR_AFC_MAX','SET_VAR_MIN_MIN','SET_VAR_MIN_MAX','SET_VAR_MAX_MIN','SET_VAR_MAX_MAX','SET_VAR_SIZE_MIN','SET_VAR_SIZE_MAX','SET_VAR_SIZE_DEGREE_MIN','SET_VAR_SIZE_DEGREE_MAX','SET_VAR_SIZE_AFC_MIN','SET_VAR_SIZE_AFC_MAX']
ENUM_CLASSES.append(SetVarBranch)
class SetValBranch(object):
TYPE = 'SetValBranch'
ENUM = ['SET_VAL_MIN_INC','SET_VAL_MIN_EXC','SET_VAL_MED_INC','SET_VAL_MED_EXC','SET_VAL_MAX_INC','SET_VAL_MAX_EXC','SET_VAL_RND_INC','SET_VAL_RND_EXC']
ENUM_CLASSES.append(SetValBranch)
class SetAssign(object):
TYPE = 'SetAssign'
ENUM = ['SET_ASSIGN_MIN_INC','SET_ASSIGN_MIN_EXC','SET_ASSIGN_MED_INC','SET_ASSIGN_MED_EXC','SET_ASSIGN_MAX_INC','SET_ASSIGN_MAX_EXC','SET_ASSIGN_RND_INC','SET_ASSIGN_RND_EXC']
ENUM_CLASSES.append(SetAssign)

View File

@ -0,0 +1,221 @@
// This file was automatically extracted from Gecode source files.
// It is subject to the same Copyright as the source files from which
// it is derived, and is distributed under the same Licensing conditions.
void abs(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void assign(Home,BoolVar,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,const BoolVarArgs&,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,const IntVarArgs&,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,const SetVarArgs&,SetAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,IntVar,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,SetVar,SetAssign,const ValBranchOptions&=ValBranchOptions::def);
void atmostOne(Home,const SetVarArgs&,unsigned int);
void binpacking(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void branch(Home,BoolVar,IntValBranch,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const BoolVarArgs&,const TieBreakVarBranch<IntVarBranch>&,IntValBranch,const TieBreakVarBranchOptions&=TieBreakVarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const BoolVarArgs&,IntVarBranch,IntValBranch,const VarBranchOptions&=VarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const IntVarArgs&,const TieBreakVarBranch<IntVarBranch>&,IntValBranch,const TieBreakVarBranchOptions&=TieBreakVarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const IntVarArgs&,IntVarBranch,IntValBranch,const VarBranchOptions&=VarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const SetVarArgs&,const TieBreakVarBranch<SetVarBranch>&,SetValBranch,const TieBreakVarBranchOptions&=TieBreakVarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const SetVarArgs&,SetVarBranch,SetValBranch,const VarBranchOptions&=VarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,IntVar,IntValBranch,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,SetVar,SetValBranch,const ValBranchOptions&=ValBranchOptions::def);
void cardinality(Home,SetVar,IntVar);
void cardinality(Home,SetVar,unsigned int,unsigned int);
void channel(Home,BoolVar,IntVar,IntConLevel=ICL_DEF);
void channel(Home,const BoolVarArgs&,IntVar,int=0,IntConLevel=ICL_DEF);
void channel(Home,const BoolVarArgs&,SetVar);
void channel(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void channel(Home,const IntVarArgs&,const SetVarArgs&);
void channel(Home,const IntVarArgs&,int,const IntVarArgs&,int,IntConLevel=ICL_DEF);
void channel(Home,IntVar,BoolVar,IntConLevel=ICL_DEF);
void channelSorted(Home,const IntVarArgs&,SetVar);
void circuit(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,int,const IntVarArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntVarArgs&,IntConLevel=ICL_DEF);
void circuit(Home,int,const IntVarArgs&,IntConLevel=ICL_DEF);
void clause(Home,BoolOpType,const BoolVarArgs&,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void clause(Home,BoolOpType,const BoolVarArgs&,const BoolVarArgs&,int,IntConLevel=ICL_DEF);
void convex(Home,SetVar);
void convex(Home,SetVar,SetVar);
void count(Home,const IntVarArgs&,const IntArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSetArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSetArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,int,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,int,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,IntVar,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,IntVar,IntRelType,IntVar,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void distinct(Home,const IntArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void distinct(Home,const IntVarArgs&,IntConLevel=ICL_DEF);
void div(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void divmod(Home,IntVar,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,const IntSet&,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,int,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,int,int,IntConLevel=ICL_DEF);
void dom(Home,IntVar,const IntSet&,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,IntVar,const IntSet&,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,int,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,int,IntConLevel=ICL_DEF);
void dom(Home,SetVar,SetRelType,const IntSet&);
void dom(Home,SetVar,SetRelType,const IntSet&,BoolVar);
void dom(Home,SetVar,SetRelType,int);
void dom(Home,SetVar,SetRelType,int,BoolVar);
void dom(Home,SetVar,SetRelType,int,int);
void dom(Home,SetVar,SetRelType,int,int,BoolVar);
void element(Home,const BoolVarArgs&,IntVar,BoolVar,IntConLevel=ICL_DEF);
void element(Home,const BoolVarArgs&,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,const BoolVarArgs&,IntVar,int,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void element(Home,const IntSetArgs&,IntVar,int,IntVar,int,SetVar);
void element(Home,const IntSetArgs&,IntVar,SetVar);
void element(Home,const IntVarArgs&,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,const IntVarArgs&,IntVar,int,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void element(Home,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void element(Home,const SetVarArgs&,IntVar,int,IntVar,int,SetVar);
void element(Home,const SetVarArgs&,IntVar,SetVar);
void element(Home,IntSharedArray,IntVar,BoolVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,IntVar,IntConLevel=ICL_DEF);
void element(Home,SetOpType,const IntArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const IntSetArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const IntVarArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const SetVarArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void extensional(Home,const BoolVarArgs&,const TupleSet&,ExtensionalPropKind=EPK_DEF,IntConLevel=ICL_DEF);
void extensional(Home,const BoolVarArgs&,DFA,IntConLevel=ICL_DEF);
void extensional(Home,const IntVarArgs&,const TupleSet&,ExtensionalPropKind=EPK_DEF,IntConLevel=ICL_DEF);
void extensional(Home,const IntVarArgs&,DFA,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void max(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void max(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void max(Home,SetVar,IntVar);
void max(Home,SetVar,IntVar,BoolVar);
void member(Home,const BoolVarArgs&,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const IntVarArgs&,IntVar,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void min(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void min(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void min(Home,SetVar,IntVar);
void min(Home,SetVar,IntVar,BoolVar);
void mod(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void mult(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void notMax(Home,SetVar,IntVar);
void notMin(Home,SetVar,IntVar);
void nvalues(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void nvalues(Home,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void nvalues(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void nvalues(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,const IntVarArgs&,IntVar,IntVar,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,const IntVarArgs&,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntVar,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,int,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void precede(Home,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void precede(Home,const IntVarArgs&,int,int,IntConLevel=ICL_DEF);
void precede(Home,const SetVarArgs&,const IntArgs&);
void precede(Home,const SetVarArgs&,int,int);
void rel(Home,BoolOpType,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolOpType,const BoolVarArgs&,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,BoolOpType,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,BoolOpType,BoolVar,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,const BoolVarArgs&,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const IntSet&,SetOpType,SetVar,SetRelType,const IntSet&);
void rel(Home,const IntSet&,SetOpType,SetVar,SetRelType,SetVar);
void rel(Home,const IntVarArgs&,IntRelType,const IntVarArgs&,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,IntVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,SetVar);
void rel(Home,IntVar,SetRelType,SetVar);
void rel(Home,IntVar,SetRelType,SetVar,BoolVar);
void rel(Home,SetOpType,const IntVarArgs&,const IntSet&,SetVar);
void rel(Home,SetOpType,const IntVarArgs&,SetVar);
void rel(Home,SetOpType,const SetVarArgs&,const IntSet&,SetVar);
void rel(Home,SetOpType,const SetVarArgs&,SetVar);
void rel(Home,SetVar,IntRelType,IntVar);
void rel(Home,SetVar,SetOpType,const IntSet&,SetRelType,const IntSet&);
void rel(Home,SetVar,SetOpType,const IntSet&,SetRelType,SetVar);
void rel(Home,SetVar,SetOpType,SetVar,SetRelType,const IntSet&);
void rel(Home,SetVar,SetOpType,SetVar,SetRelType,SetVar);
void rel(Home,SetVar,SetRelType,IntVar);
void rel(Home,SetVar,SetRelType,IntVar,BoolVar);
void rel(Home,SetVar,SetRelType,SetVar);
void rel(Home,SetVar,SetRelType,SetVar,BoolVar);
void sequence(Home,const BoolVarArgs&,const IntSet&,int,int,int,IntConLevel=ICL_DEF);
void sequence(Home,const IntVarArgs&,const IntSet&,int,int,int,IntConLevel=ICL_DEF);
void sequence(Home,const SetVarArgs&);
void sequence(Home,const SetVarArgs&,SetVar);
void sorted(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void sorted(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void sqr(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void sqrt(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void unshare(Home,BoolVarArgs&,IntConLevel=ICL_DEF);
void unshare(Home,IntVarArgs&,IntConLevel=ICL_DEF);
void weights(Home,IntSharedArray,IntSharedArray,SetVar,IntVar);

View File

@ -0,0 +1,221 @@
// This file was automatically extracted from Gecode source files.
// It is subject to the same Copyright as the source files from which
// it is derived, and is distributed under the same Licensing conditions.
void abs(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void assign(Home,BoolVar,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,const BoolVarArgs&,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,const IntVarArgs&,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,const SetVarArgs&,SetAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,IntVar,IntAssign,const ValBranchOptions&=ValBranchOptions::def);
void assign(Home,SetVar,SetAssign,const ValBranchOptions&=ValBranchOptions::def);
void atmostOne(Home,const SetVarArgs&,unsigned int);
void binpacking(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void branch(Home,BoolVar,IntValBranch,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const BoolVarArgs&,const TieBreakVarBranch<IntVarBranch>&,IntValBranch,const TieBreakVarBranchOptions&=TieBreakVarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const BoolVarArgs&,IntVarBranch,IntValBranch,const VarBranchOptions&=VarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const IntVarArgs&,const TieBreakVarBranch<IntVarBranch>&,IntValBranch,const TieBreakVarBranchOptions&=TieBreakVarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const IntVarArgs&,IntVarBranch,IntValBranch,const VarBranchOptions&=VarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const SetVarArgs&,const TieBreakVarBranch<SetVarBranch>&,SetValBranch,const TieBreakVarBranchOptions&=TieBreakVarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,const SetVarArgs&,SetVarBranch,SetValBranch,const VarBranchOptions&=VarBranchOptions::def,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,IntVar,IntValBranch,const ValBranchOptions&=ValBranchOptions::def);
void branch(Home,SetVar,SetValBranch,const ValBranchOptions&=ValBranchOptions::def);
void cardinality(Home,SetVar,IntVar);
void cardinality(Home,SetVar,unsigned int,unsigned int);
void channel(Home,BoolVar,IntVar,IntConLevel=ICL_DEF);
void channel(Home,const BoolVarArgs&,IntVar,int=0,IntConLevel=ICL_DEF);
void channel(Home,const BoolVarArgs&,SetVar);
void channel(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void channel(Home,const IntVarArgs&,const SetVarArgs&);
void channel(Home,const IntVarArgs&,int,const IntVarArgs&,int,IntConLevel=ICL_DEF);
void channel(Home,IntVar,BoolVar,IntConLevel=ICL_DEF);
void channelSorted(Home,const IntVarArgs&,SetVar);
void circuit(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,int,const IntVarArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntVarArgs&,IntConLevel=ICL_DEF);
void circuit(Home,int,const IntVarArgs&,IntConLevel=ICL_DEF);
void clause(Home,BoolOpType,const BoolVarArgs&,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void clause(Home,BoolOpType,const BoolVarArgs&,const BoolVarArgs&,int,IntConLevel=ICL_DEF);
void convex(Home,SetVar);
void convex(Home,SetVar,SetVar);
void count(Home,const IntVarArgs&,const IntArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSetArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSetArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,int,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,int,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,IntVar,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,IntVar,IntRelType,IntVar,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void distinct(Home,const IntArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void distinct(Home,const IntVarArgs&,IntConLevel=ICL_DEF);
void div(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void divmod(Home,IntVar,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,const IntSet&,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,int,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,int,int,IntConLevel=ICL_DEF);
void dom(Home,IntVar,const IntSet&,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,IntVar,const IntSet&,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,int,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,int,IntConLevel=ICL_DEF);
void dom(Home,SetVar,SetRelType,const IntSet&);
void dom(Home,SetVar,SetRelType,const IntSet&,BoolVar);
void dom(Home,SetVar,SetRelType,int);
void dom(Home,SetVar,SetRelType,int,BoolVar);
void dom(Home,SetVar,SetRelType,int,int);
void dom(Home,SetVar,SetRelType,int,int,BoolVar);
void element(Home,const BoolVarArgs&,IntVar,BoolVar,IntConLevel=ICL_DEF);
void element(Home,const BoolVarArgs&,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,const BoolVarArgs&,IntVar,int,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void element(Home,const IntSetArgs&,IntVar,int,IntVar,int,SetVar);
void element(Home,const IntSetArgs&,IntVar,SetVar);
void element(Home,const IntVarArgs&,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,const IntVarArgs&,IntVar,int,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void element(Home,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void element(Home,const SetVarArgs&,IntVar,int,IntVar,int,SetVar);
void element(Home,const SetVarArgs&,IntVar,SetVar);
void element(Home,IntSharedArray,IntVar,BoolVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,IntVar,IntConLevel=ICL_DEF);
void element(Home,SetOpType,const IntArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const IntSetArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const IntVarArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const SetVarArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void extensional(Home,const BoolVarArgs&,const TupleSet&,ExtensionalPropKind=EPK_DEF,IntConLevel=ICL_DEF);
void extensional(Home,const BoolVarArgs&,DFA,IntConLevel=ICL_DEF);
void extensional(Home,const IntVarArgs&,const TupleSet&,ExtensionalPropKind=EPK_DEF,IntConLevel=ICL_DEF);
void extensional(Home,const IntVarArgs&,DFA,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void max(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void max(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void max(Home,SetVar,IntVar);
void max(Home,SetVar,IntVar,BoolVar);
void member(Home,const BoolVarArgs&,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const IntVarArgs&,IntVar,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void min(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void min(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void min(Home,SetVar,IntVar);
void min(Home,SetVar,IntVar,BoolVar);
void mod(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void mult(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void notMax(Home,SetVar,IntVar);
void notMin(Home,SetVar,IntVar);
void nvalues(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void nvalues(Home,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void nvalues(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void nvalues(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,const IntVarArgs&,IntVar,IntVar,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,const IntVarArgs&,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntVar,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,int,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void precede(Home,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void precede(Home,const IntVarArgs&,int,int,IntConLevel=ICL_DEF);
void precede(Home,const SetVarArgs&,const IntArgs&);
void precede(Home,const SetVarArgs&,int,int);
void rel(Home,BoolOpType,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolOpType,const BoolVarArgs&,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,BoolOpType,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,BoolOpType,BoolVar,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,const BoolVarArgs&,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const IntSet&,SetOpType,SetVar,SetRelType,const IntSet&);
void rel(Home,const IntSet&,SetOpType,SetVar,SetRelType,SetVar);
void rel(Home,const IntVarArgs&,IntRelType,const IntVarArgs&,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,int,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,IntVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,IntVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,SetVar);
void rel(Home,IntVar,SetRelType,SetVar);
void rel(Home,IntVar,SetRelType,SetVar,BoolVar);
void rel(Home,SetOpType,const IntVarArgs&,const IntSet&,SetVar);
void rel(Home,SetOpType,const IntVarArgs&,SetVar);
void rel(Home,SetOpType,const SetVarArgs&,const IntSet&,SetVar);
void rel(Home,SetOpType,const SetVarArgs&,SetVar);
void rel(Home,SetVar,IntRelType,IntVar);
void rel(Home,SetVar,SetOpType,const IntSet&,SetRelType,const IntSet&);
void rel(Home,SetVar,SetOpType,const IntSet&,SetRelType,SetVar);
void rel(Home,SetVar,SetOpType,SetVar,SetRelType,const IntSet&);
void rel(Home,SetVar,SetOpType,SetVar,SetRelType,SetVar);
void rel(Home,SetVar,SetRelType,IntVar);
void rel(Home,SetVar,SetRelType,IntVar,BoolVar);
void rel(Home,SetVar,SetRelType,SetVar);
void rel(Home,SetVar,SetRelType,SetVar,BoolVar);
void sequence(Home,const BoolVarArgs&,const IntSet&,int,int,int,IntConLevel=ICL_DEF);
void sequence(Home,const IntVarArgs&,const IntSet&,int,int,int,IntConLevel=ICL_DEF);
void sequence(Home,const SetVarArgs&);
void sequence(Home,const SetVarArgs&,SetVar);
void sorted(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void sorted(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void sqr(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void sqrt(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void unshare(Home,BoolVarArgs&,IntConLevel=ICL_DEF);
void unshare(Home,IntVarArgs&,IntConLevel=ICL_DEF);
void weights(Home,IntSharedArray,IntSharedArray,SetVar,IntVar);

View File

@ -284,7 +284,7 @@ new_setvar(SVar, Space, X1, X2, X3, X4, X5) :-
assert_integer(X4),
assert_integer(X5),
gecode_new_setvar_4(Idx,Space_,X1_,X2,X3,X4,X5)),
SVar='SetVar'(Idx).
SVar='SetVar'(Idx,-1).
%% 4 arguments
%% (GlbMin,GlbMax,LubMin,LubMax) 4 new_setvar_3
@ -313,7 +313,7 @@ new_setvar(SVar,Space,X1,X2,X3,X4) :-
;
assert_integer(X3),
gecode_new_setvar_3(Idx,Space_,X1,X2,X3,X4))),
SVar='SetVar'(Idx).
SVar='SetVar'(Idx,-1).
%% 3 arguments
%% (Glb,LubMin,LubMax) 3 new_setvar_6
@ -336,7 +336,7 @@ new_setvar(SVar,Space,X1,X2,X3) :-
assert_integer(X2),
assert_is_IntSet(X3,X3_),
gecode_new_setvar_9(Idx,Space_,X1,X2,X3_)),
SVar='SetVar'(Idx).
SVar='SetVar'(Idx,-1).
%% 2 arguments
%% (Glb,Lub) 2 new_setvar_12
@ -346,7 +346,7 @@ new_setvar(SVar,Space,X1,X2) :-
assert_is_IntSet(X1,X1_),
assert_is_IntSet(X2,X2_),
gecode_new_setvar_12(Idx,Space_,X1_,X2_),
SVar='SetVar'(Idx).
SVar='SetVar'(Idx,-1).
minimize(Space,IVar) :-
assert_is_Space(Space,Space_),

View File

@ -387,6 +387,11 @@ static YAP_Term
float_matrix_to_list(int *mat) {
double *data = matrix_double_data(mat, mat[MAT_NDIMS]);
/* prepare for worst case with double taking two cells */
if (YAP_RequiresExtraStack(6*mat[MAT_SIZE])) {
mat = (int *)YAP_BlobOfTerm(YAP_ARG1);
data = matrix_double_data(mat, mat[MAT_NDIMS]);
}
return YAP_FloatsToList(data, mat[MAT_SIZE]);
}
@ -429,6 +434,11 @@ static YAP_Term
long_matrix_to_list(int *mat) {
long int *data = matrix_long_data(mat, mat[MAT_NDIMS]);
/* prepare for worst case with longs evrywhere (3cells + 1) */
if (YAP_RequiresExtraStack(5*mat[MAT_SIZE])) {
mat = (int *)YAP_BlobOfTerm(YAP_ARG1);
data = matrix_long_data(mat, mat[MAT_NDIMS]);
}
return mk_long_list(mat[MAT_SIZE], data);
}
@ -1269,6 +1279,7 @@ matrix_agg_lines(void)
tf = new_int_matrix(dims-1,mat+(MAT_DIMS+1),NULL);
if (tf == YAP_TermNil())
return FALSE;
mat = (int *)YAP_BlobOfTerm(YAP_ARG1);
nmat = (int *)YAP_BlobOfTerm(tf);
data = matrix_long_data(mat, dims);
ndata = matrix_long_data(nmat, dims-1);
@ -1351,6 +1362,7 @@ matrix_agg_cols(void)
tf = new_int_matrix(1,mat+MAT_DIMS,NULL);
if (tf == YAP_TermNil())
return FALSE;
mat = (int *)YAP_BlobOfTerm(YAP_ARG1);
nmat = (int *)YAP_BlobOfTerm(tf);
data = matrix_long_data(mat, dims);
ndata = matrix_long_data(nmat, 1);

View File

@ -18,6 +18,7 @@
:- module(terms, [
term_hash/2,
term_hash/4,
term_subsumer/3,
instantiated_term_hash/4,
variant/2,
unifiable/3,

View File

@ -273,8 +273,10 @@ notImplemented(char *name, int arity)
X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
{
GET_LD
char msgbuf[50];
term_t formal, swi, predterm, msgterm, except;
va_list args;
int rc = TRUE;
formal = PL_new_term_ref();
swi = PL_new_term_ref();
@ -295,6 +297,21 @@ X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
err_instantiation:
PL_unify_atom(formal, ATOM_instantiation_error);
break;
case ERR_UNINSTANTIATION:
{ int argn = va_arg(args, int);
term_t bound = va_arg(args, term_t);
if ( !msg && argn > 0 )
{ Ssprintf(msgbuf, "%d-%s argument",
argn, argn == 1 ? "st" : argn == 2 ? "nd" : "th");
msg = msgbuf;
}
rc = PL_unify_term(formal,
PL_FUNCTOR, FUNCTOR_uninstantiation_error1,
PL_TERM, bound);
break;
}
case ERR_TYPE: /* ERR_INSTANTIATION if var(actual) */
{ atom_t expected = va_arg(args, atom_t);
term_t actual = va_arg(args, term_t);
@ -448,7 +465,6 @@ X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
case ERR_STREAM_OP:
{ atom_t action = va_arg(args, atom_t);
term_t stream = va_arg(args, term_t);
int rc;
rc = PL_unify_term(formal,
PL_FUNCTOR, FUNCTOR_io_error2,
@ -458,7 +474,6 @@ X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
}
case ERR_FORMAT:
{ const char *s = va_arg(args, const char*);
int rc;
rc = PL_unify_term(formal,
PL_FUNCTOR_CHARS, "format", 1,
@ -468,7 +483,6 @@ X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
case ERR_FORMAT_ARG:
{ const char *s = va_arg(args, const char*);
term_t arg = va_arg(args, term_t);
int rc;
rc = PL_unify_term(formal,
PL_FUNCTOR_CHARS, "format_argument_type", 2,
@ -491,19 +505,23 @@ X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
PL_FUNCTOR, FUNCTOR_divide2,
PL_CHARS, pred,
PL_INT, arity);
}
}
if (!rc) {
fatalError("Cannot report error: no memory");
}
if ( msg )
{
PL_put_atom_chars(msgterm, msg);
rc = PL_put_atom_chars(msgterm, msg);
}
PL_unify_term(swi,
rc = PL_unify_term(swi,
PL_FUNCTOR, FUNCTOR_context2,
PL_TERM, predterm,
PL_TERM, msgterm);
PL_unify_term(except,
rc = PL_unify_term(except,
PL_FUNCTOR, FUNCTOR_error2,
PL_TERM, formal,
PL_TERM, swi);
return PL_raise_exception(except);
rc = PL_raise_exception(except);
return rc;
}

View File

@ -4671,6 +4671,11 @@ EndPredDefs
#if __YAP_PROLOG__
void Yap_flush(void)
{
flush_output(0);
}
void *
Yap_GetStreamHandle(Atom at)
{ GET_LD

View File

@ -53,6 +53,10 @@ Va <- P*X1*Y1 + Q*X2*Y2 + ...
:- use_module(library(bdd)).
:- use_module(library(ddnnf)).
:- use_module(library(simpbool)).
:- use_module(library(rbtrees)).
:- use_module(library(bhash)).
@ -63,6 +67,10 @@ Va <- P*X1*Y1 + Q*X2*Y2 + ...
:- attribute order/1.
:- dynamic bdds/1.
%bdds(ddnnf).
bdds(bdd).
check_if_bdd_done(_Var).
bdd([[]],_,_) :- !.
@ -74,7 +82,8 @@ bdd([QueryVars], AllVars, AllDiffs) :-
init_bdd_solver(_, AllVars0, _, bdd(Term, Leaves, Tops)) :-
% check_for_agg_vars(AllVars0, AllVars1),
sort_vars(AllVars0, AllVars, Leaves),
AllVars0 = AllVars1,
sort_vars(AllVars1, AllVars, Leaves),
order_vars(AllVars, 0),
rb_new(Vars0),
rb_new(Pars0),
@ -128,8 +137,8 @@ get_vars_info([_|MoreVs], Vs0, VsF, Ps0, PsF, VarsInfo, Lvs, Outs) :-
get_var_info(V, avg(Domain), Parents, Vs, Vs2, Ps, Ps, Lvs, Outs, DIST) :- !,
length(Domain, DSize),
% run_though_avg(V, DSize, Domain, Parents, Vs, Vs2, Lvs, Outs, DIST).
top_down_with_tabling(V, DSize, Domain, Parents, Vs, Vs2, Lvs, Outs, DIST).
% bup_avg(V, DSize, Domain, Parents, Vs, Vs2, Lvs, Outs, DIST).
% top_down_with_tabling(V, DSize, Domain, Parents, Vs, Vs2, Lvs, Outs, DIST).
bup_avg(V, DSize, Domain, Parents, Vs, Vs2, Lvs, Outs, DIST).
% standard random variable
get_var_info(V, DistId, Parents0, Vs, Vs2, Ps, Ps1, Lvs, Outs, DIST) :-
% clpbn:get_atts(V, [key(K)]), writeln(V:K:DistId:Parents),
@ -271,7 +280,7 @@ avg_tree( _PVars, P, _, Im, IM, _Size, O, H0, H0) :-
b_hash_lookup(k(P,Im,IM), O=_Exp, H0), !.
avg_tree([], _P, _Max, _Im, _IM, _Size, 1, H, H).
avg_tree([Vals|PVars], P, Max, Im, IM, Size, O, H0, HF) :-
b_hash_insert(H0, k(P,Im,IM), O=Simp, HI),
b_hash_insert(H0, k(P,Im,IM), O=Simp*1, HI),
MaxI is Max-(Size-1),
avg_exp(Vals, PVars, 0, P, MaxI, Size, Im, IM, HI, HF, Exp),
simplify_exp(Exp, Simp).
@ -399,7 +408,7 @@ protect_avg(I0, Max0, Protected, Domains, ASize, Reach) :-
% outer loop: generate array of sums at level j= Sum[j0...jMax]
%
expand_sums(_Parents, Max, _, Max, _Size, _Sums, _P, _NewSums, F0, F0) :- !.
expand_sums(Parents, I0, Max0, Max, Size, Sums, Prot, NewSums, [O=SUM|F], F0) :-
expand_sums(Parents, I0, Max0, Max, Size, Sums, Prot, NewSums, [O=SUM*1|F], F0) :-
I is I0+1,
arg(I, Prot, P),
var(P), !,
@ -466,7 +475,7 @@ fetch_domain_for_avg(J0, Border, J, I0, [I0|LVals], RLVals) :-
fetch_domain_for_avg(J1, Border, J, I0, LVals, RLVals).
generate_avg(Size, Size, _J, _Max, [], [], [], F, F).
generate_avg(I0, Size, J0, Max, LSums, [O|OVs], [Ev|Evs], [O=Ev*Disj|F], F0) :-
generate_avg(I0, Size, J0, Max, LSums, [O|OVs], [Ev|Evs], [O=Disj*Ev|F], F0) :-
I is I0+1,
Border is (I*Max)/Size,
fetch_for_avg(J0, Border, J, LSums, MySums, RSums),
@ -732,7 +741,6 @@ run_bdd_solver([[V]], LPs, bdd(Term, _Leaves, Nodes)) :-
build_out_node(Nodes, Node),
findall(Prob, get_prob(Term, Node, V, Prob),TermProbs),
sumlist(TermProbs, Sum),
writeln(TermProbs:Sum),
normalise(TermProbs, Sum, LPs).
build_out_node([_Top], []).
@ -744,7 +752,12 @@ build_out_node2([T,T1|Tops], T*Top) :-
build_out_node2(T1.Tops, Top).
get_prob(Term, _Node, V, SP) :-
bdds(ddnnf), !,
all_cnfs(Term, CNF, IVs, Indics, V, AllParms, AllParmValues),
build_cnf(CNF, IVs, Indics, AllParms, AllParmValues, SP).
get_prob(Term, Node, V, SP) :-
bdds(bdd), !,
bind_all(Term, Node, Bindings, V, AllParms, AllParmValues),
% reverse(AllParms, RAllParms),
term_variables(AllParms, NVs),
@ -754,25 +767,25 @@ get_prob(Term, Node, V, SP) :-
build_bdd(Bindings, NVs, VTheta, Theta, Bdd) :-
bdd_from_list(Bindings, NVs, Bdd),
bdd_size(Bdd, Len),
number_codes(Len,Codes),
atom_codes(Name,Codes),
bdd_print(Bdd, Name),
writeln(length=Len),
% bdd_size(Bdd, Len),
% number_codes(Len,Codes),
% atom_codes(Name,Codes),
% bdd_print(Bdd, Name),
% writeln(length=Len),
VTheta = Theta.
bind_all([], End, End, _V, [], []).
bind_all(info(V, _Tree, Ev, _Values, Formula, ParmVars, Parms).Term, End, BindsF, V0, ParmVars.AllParms, Parms.AllTheta) :-
bind_all([info(V, _Tree, Ev, _Values, Formula, ParmVars, Parms)|Term], End, BindsF, V0, ParmVars.AllParms, Parms.AllTheta) :-
V0 == V, !,
set_to_one_zeros(Ev),
bind_formula(Formula, BindsF, BindsI),
bind_all(Term, End, BindsI, V0, AllParms, AllTheta).
bind_all(info(_V, _Tree, Ev, _Values, Formula, ParmVars, Parms).Term, End, BindsF, V0, ParmVars.AllParms, Parms.AllTheta) :-
bind_all([info(_V, _Tree, Ev, _Values, Formula, ParmVars, Parms)|Term], End, BindsF, V0, ParmVars.AllParms, Parms.AllTheta) :-
set_to_ones(Ev),!,
bind_formula(Formula, BindsF, BindsI),
bind_all(Term, End, BindsI, V0, AllParms, AllTheta).
% evidence: no need to add any stuff.
bind_all(info(_V, _Tree, _Ev, _Values, Formula, ParmVars, Parms).Term, End, BindsF, V0, ParmVars.AllParms, Parms.AllTheta) :-
bind_all([info(_V, _Tree, _Ev, _Values, Formula, ParmVars, Parms)|Term], End, BindsF, V0, ParmVars.AllParms, Parms.AllTheta) :-
bind_formula(Formula, BindsF, BindsI),
bind_all(Term, End, BindsI, V0, AllParms, AllTheta).
@ -800,3 +813,103 @@ normalise(P.TermProbs, Sum, NP.LPs) :-
finalize_bdd_solver(_).
all_cnfs([], [], [], [], _V, [], []).
all_cnfs([info(V, Tree, Ev, Values, Formula, ParmVars, Parms)|Term], BindsF, IVars, Indics, V0, AllParmsF, AllThetaF) :-
%writeln(f:Formula),
V0 == V, !,
set_to_one_zeros(Ev),
all_indicators(Values, BindsF, Binds0),
indicators(Values, [], Ev, IVars, IVarsI, Indics, IndicsI, Binds0, Binds1),
parms( ParmVars, Parms, AllParmsF, AllThetaF, AllParms, AllTheta),
parameters(Formula, Tree, Binds1, BindsI),
all_cnfs(Term, BindsI, IVarsI, IndicsI, V0, AllParms, AllTheta).
all_cnfs([info(_V, Tree, Ev, Values, Formula, ParmVars, Parms)|Term], BindsF, IVars, Indics, V0, AllParmsF, AllThetaF) :-
set_to_ones(Ev),!,
all_indicators(Values, BindsF, Binds0),
indicators(Values, [], Ev, IVars, IVarsI, Indics, IndicsI, Binds0, Binds1),
parms( ParmVars, Parms, AllParmsF, AllThetaF, AllParms, AllTheta),
parameters(Formula, Tree, Binds1, BindsI),
all_cnfs(Term, BindsI, IVarsI, IndicsI, V0, AllParms, AllTheta).
% evidence: no need to add any stuff.
all_cnfs([info(_V, Tree, Ev, Values, Formula, ParmVars, Parms)|Term], BindsF, IVars, Indics, V0, AllParmsF, AllThetaF) :-
all_indicators(Values, BindsF, Binds0),
indicators(Values, [], Ev, IVars, IVarsI, Indics, IndicsI, Binds0, Binds1),
parms( ParmVars, Parms, AllParmsF, AllThetaF, AllParms, AllTheta),
parameters(Formula, Tree, Binds1, BindsI),
all_cnfs(Term, BindsI, IVarsI, IndicsI, V0, AllParms, AllTheta).
all_indicators(Values) -->
{ values_to_disj(Values, Disj) },
[Disj].
values_to_disj([V], V) :- !.
values_to_disj([V|Values], V+Disj) :-
values_to_disj(Values, Disj).
indicators([V|Vars], SeenVs, [E|Ev], [V|IsF], IsI, [E|Inds], Inds0) -->
generate_exclusions(SeenVs, V),
indicators(Vars, [V|SeenVs], Ev, IsF, IsI, Inds, Inds0).
indicators([], _SeenVs, [], IsF, IsF, Inds, Inds) --> [].
parms([], [], AllParms, AllTheta, AllParms, AllTheta).
parms([V|ParmVars], [P|Parms], [V|AllParmsF], [P|AllThetaF], AllParms, AllTheta) :-
parms( ParmVars, Parms, AllParmsF, AllThetaF, AllParms, AllTheta).
parameters([], _) --> [].
% ignore disj, only useful to BDDs
parameters([(T=_)|Formula], Tree) -->
{ Tree == T }, !,
parameters(Formula, Tree).
parameters([(V0=Disj*_I0)|Formula], Tree) -->
conj(Disj, V0),
parameters(Formula, Tree).
% transform V0<- A*B+C*(D+not(E))
% [V0+not(A)+not(B),V0+not(C)+not(D),V0+not(C)+E]
conj(Disj, V0) -->
{ conj2(Disj, [[V0]], LVs) },
to_disjs(LVs).
conj2(A, L0, LF) :- var(A), !,
add(not(A), L0, LF).
conj2((A*B), L0, LF) :-
conj2(A, L0, LI),
conj2(B, LI, LF).
conj2((A+B), L0, LF) :-
conj2(A, L0, L1),
conj2(B, L0, L2),
append(L1, L2, LF).
conj2(not(A), L0, LF) :-
add(A, L0, LF).
add(_, [], []).
add(Head, [H|L], [[Head|H]|NL]) :-
add(Head, L, NL).
to_disjs([]) --> [].
to_disjs([[H|L]|LVs]) -->
mkdisj(L, H),
to_disjs(LVs).
mkdisj([], Disj) --> [Disj].
mkdisj([H|L], Disj) -->
mkdisj(L, (H+Disj)).
%
% add formula for V \== V0 -> V or V0 and not(V) or not(V0)
%
generate_exclusions([], _V) --> [].
generate_exclusions([V0|SeenVs], V) -->
[(not(V0)+not(V))],
generate_exclusions(SeenVs, V).
build_cnf(CNF, IVs, Indics, AllParms, AllParmValues, Val) :-
%(numbervars(CNF,1,_), writeln(cnf_to_ddnnf(CNF, Vars, IVs, [], F)), fail ; true ),
cnf_to_ddnnf(CNF, AllParms, F),
AllParms = AllParmValues,
IVs = Indics,
term_variables(CNF, Extra),
set_to_ones(Extra),
ddnnf_is(F, Val).

View File

@ -244,7 +244,9 @@ get_dist_domain_size(Id, DSize) :-
recorded(clpbn_dist_db, db(Id, _, _, _, _, _, DSize), _).
get_dist_domain(Id, Domain) :-
recorded(clpbn_dist_db, db(Id, _, _, _, Domain, _, _), _).
recorded(clpbn_dist_db, db(Id, _, _, _, Domain, _, _), _), !.
get_dist_domain(avg(Domain), Domain) :-
recorded(clpbn_dist_db, db(Id, _, _, _, Domain, _, _), _), !.
get_dist_key(Id, Key) :-
use_parfactors(on), !,

View File

@ -425,7 +425,7 @@ registration(r65,c22,s20).
registration(r66,c43,s20).
registration(r67,c17,s21).
registration(r68,c34,s21).
%registration(r69,c0,s21).
registration(r69,c0,s21).
registration(r70,c42,s22).
registration(r71,c7,s22).
registration(r72,c46,s22).
@ -515,7 +515,7 @@ registration(r155,c57,s46).
registration(r156,c25,s46).
registration(r157,c46,s46).
registration(r158,c15,s46).
%registration(r159,c0,s47).
registration(r159,c0,s47).
registration(r160,c33,s47).
registration(r161,c30,s47).
registration(r162,c55,s47).
@ -544,7 +544,7 @@ registration(r184,c50,s54).
registration(r185,c43,s54).
registration(r186,c55,s54).
registration(r187,c14,s55).
%registration(r188,c0,s55).
registration(r188,c0,s55).
registration(r189,c31,s55).
registration(r190,c47,s55).
registration(r191,c50,s56).
@ -600,7 +600,7 @@ registration(r240,c20,s71).
registration(r241,c18,s71).
registration(r242,c38,s71).
registration(r243,c37,s72).
%registration(r244,c0,s72).
registration(r244,c0,s72).
registration(r245,c62,s72).
registration(r246,c47,s73).
registration(r247,c53,s73).
@ -619,7 +619,7 @@ registration(r259,c2,s76).
registration(r260,c7,s77).
registration(r261,c3,s77).
registration(r262,c63,s77).
%registration(r263,c0,s78).
registration(r263,c0,s78).
registration(r264,c43,s78).
registration(r265,c57,s78).
registration(r266,c46,s79).
@ -648,7 +648,7 @@ registration(r288,c45,s86).
registration(r289,c17,s86).
registration(r290,c2,s86).
registration(r291,c48,s86).
%registration(r292,c0,s86).
registration(r292,c0,s86).
registration(r293,c40,s87).
registration(r294,c44,s87).
registration(r295,c41,s87).
@ -663,7 +663,7 @@ registration(r303,c50,s90).
registration(r304,c26,s90).
registration(r305,c58,s90).
registration(r306,c45,s90).
%registration(r307,c0,s91).
registration(r307,c0,s91).
registration(r308,c35,s91).
registration(r309,c4,s91).
registration(r310,c4,s92).
@ -677,7 +677,7 @@ registration(r317,c1,s94).
registration(r318,c18,s94).
registration(r319,c35,s94).
registration(r320,c3,s95).
%registration(r321,c0,s95).
registration(r321,c0,s95).
registration(r322,c38,s95).
registration(r323,c1,s96).
registration(r324,c30,s96).
@ -763,7 +763,7 @@ registration(r403,c49,s119).
registration(r404,c61,s119).
registration(r405,c38,s120).
registration(r406,c8,s120).
%registration(r407,c0,s120).
registration(r407,c0,s120).
registration(r408,c60,s121).
registration(r409,c45,s121).
registration(r410,c28,s121).
@ -782,7 +782,7 @@ registration(r422,c29,s125).
registration(r423,c54,s125).
registration(r424,c28,s126).
registration(r425,c22,s126).
%registration(r426,c0,s126).
registration(r426,c0,s126).
registration(r427,c61,s127).
registration(r428,c7,s127).
registration(r429,c28,s127).
@ -1124,7 +1124,7 @@ registration(r764,c10,s227).
registration(r765,c3,s228).
registration(r766,c47,s228).
registration(r767,c54,s228).
%registration(r768,c0,s229).
registration(r768,c0,s229).
registration(r769,c10,s229).
registration(r770,c37,s229).
registration(r771,c62,s230).
@ -1140,7 +1140,7 @@ registration(r780,c51,s233).
registration(r781,c8,s233).
registration(r782,c58,s233).
registration(r783,c14,s234).
%registration(r784,c0,s234).
registration(r784,c0,s234).
registration(r785,c23,s234).
registration(r786,c59,s234).
registration(r787,c5,s235).
@ -1161,7 +1161,7 @@ registration(r801,c45,s239).
registration(r802,c47,s239).
registration(r803,c7,s240).
registration(r804,c4,s240).
%registration(r805,c0,s240).
registration(r805,c0,s240).
registration(r806,c54,s240).
registration(r807,c9,s240).
registration(r808,c11,s241).
@ -1169,7 +1169,7 @@ registration(r809,c29,s241).
registration(r810,c45,s241).
registration(r811,c58,s241).
registration(r812,c48,s242).
%registration(r813,c0,s242).
registration(r813,c0,s242).
registration(r814,c51,s242).
registration(r815,c12,s243).
registration(r816,c24,s243).
@ -1212,6 +1212,6 @@ registration(r852,c7,s254).
registration(r853,c61,s254).
registration(r854,c60,s255).
registration(r855,c48,s255).
%registration(r856,c0,s255).
registration(r856,c0,s255).

View File

@ -30,10 +30,12 @@ BIBTEX=bibtex
PROGRAMS= \
$(srcdir)/problog.yap \
$(srcdir)/problog_lbdd.yap \
$(srcdir)/problog_lfi.yap \
$(srcdir)/dtproblog.yap \
$(srcdir)/aproblog.yap \
$(srcdir)/problog_learning.yap
$(srcdir)/problog_learning.yap\
$(srcdir)/problog_learning_lbdd.yap
PROBLOG_PROGRAMS= \
$(srcdir)/problog/extlists.yap \
@ -56,6 +58,7 @@ PROBLOG_PROGRAMS= \
$(srcdir)/problog/version_control.yap \
$(srcdir)/problog/nestedtries.yap \
$(srcdir)/problog/utils.yap \
$(srcdir)/problog/utils_lbdd.yap \
$(srcdir)/problog/ad_converter.yap \
$(srcdir)/problog/termhandling.yap \
$(srcdir)/problog/completion.yap \

View File

@ -233,6 +233,8 @@
problog_max/3,
problog_kbest_explanations/3,
problog_exact/3,
problog_fl_bdd/2,
problog_kbest_bdd/4,
problog_all_explanations/2,
problog_all_explanations_unsorted/2,
problog_exact_save/5,
@ -625,14 +627,14 @@ term_expansion_intern((Head<--Body), Module, C):-
% converts ?:: prefix to ? :: infix, as handled by other clause
term_expansion_intern((Annotation::Fact), Module, ExpandedClause) :-
Annotation == '?',
term_expansion_intern((? :: Fact :- true), Module, ExpandedClause).
Annotation == ( '?' ),
term_expansion_intern(((?) :: Fact :- true), Module, ExpandedClause).
% handles decision clauses
term_expansion_intern((Annotation :: Head :- Body), Module, problog:ExpandedClause) :-
(
Annotation == '?' ->
Annotation == ('?') ->
% It's a decision with a body
(decision_fact(_,Head) ->
throw(error('New decision unifies with already defined decision!', (Head))) ; true
@ -650,7 +652,7 @@ term_expansion_intern((Annotation :: Head :- Body), Module, problog:ExpandedClau
(problog_control(check,internal_strategy) ->
dtproblog:strategy_log(ID,Head,LProb)
;
LProb = '?'
LProb = ('?')
)
),
assertz(dynamic_probability_fact(ID)),
@ -1029,7 +1031,7 @@ prove_problog_fact(ClauseID,GroundID,Prob) :-
(problog_control(check,find_decisions) ->
signal_decision(ClauseID,GroundID)
;
(Prob = '?' ->
(Prob = ('?') ->
add_to_proof(GroundID,0) % 0 is log(1)!
;
% Checks needed for LeDTProbLog
@ -1053,7 +1055,7 @@ prove_problog_fact_negated(ClauseID,GroundID,Prob) :-
(problog_control(check,find_decisions) ->
signal_decision(ClauseID,GroundID)
;
(Prob = '?' ->
(Prob = ('?') ->
add_to_proof_negated(GroundID,-inf) % 0 is log(1)!
;
% Checks needed for LeDTProbLog
@ -1187,7 +1189,7 @@ get_fact_probability(ID,Prob) :-
get_internal_fact(ID,ProblogTerm,_ProblogName,ProblogArity)
),
arg(ProblogArity,ProblogTerm,Log),
(Log = '?' ->
(Log = ('?') ->
throw(error('Why do you want to know the probability of a decision?')) %fail
; ground(Log) ->
Prob is exp(Log)
@ -1206,7 +1208,7 @@ get_fact_log_probability(ID,Prob) :-
get_internal_fact(ID,ProblogTerm,_ProblogName,ProblogArity)
),
arg(ProblogArity,ProblogTerm,Prob),
Prob \== '?'.
Prob \== ('?').
get_fact_log_probability(ID,Prob) :-
get_fact_probability(ID,Prob1),
Prob is log(Prob1).
@ -2145,6 +2147,7 @@ init_problog_low(Threshold) :-
nb_setval(problog_completed_proofs, Trie_Completed_Proofs),
init_problog(Threshold).
:- include(problog_lbdd).
% generalizing problog_max to return all explanations, sorted by non-increasing probability
problog_all_explanations(Goal,Expl) :-
@ -2427,7 +2430,7 @@ problog_kbest(Goal, K, Prob, Status) :-
problog_kbest_id(Goal, K),
retract(current_kbest(_,ListFound,_NumFound)),
build_prefixtree(ListFound),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
eval_dnf(Trie_Completed_Proofs,Prob,Status),
delete_ptree(Trie_Completed_Proofs).

View File

@ -343,6 +343,12 @@ learning_init_handler(validating, (_,_,_,_,_)).
learning_init_handler(validated, _Value).
learning_init_handler(stored, _Value).
learning_libdd_init_handler(message, '(Q,BDD,Query)').
learning_libdd_init_handler(validating, (_,_,_)).
%learning_init_handler(validate, V_).
learning_libdd_init_handler(validated, _Value).
learning_libdd_init_handler(stored, _Value).
learning_prob_init_handler(message, '(0,1] or uniform(l,h) ').
learning_prob_init_handler(validating, uniform(Low,High)) :-
number(Low),

View File

@ -0,0 +1,235 @@
%%% -*- Mode: Prolog; -*-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Date: 2011-11-28 14:41:26 +0100 (Mon, 28 Nov 2011) $
% $Revision: 6764 $
%
% This file is part of ProbLog
% http://dtai.cs.kuleuven.be/problog
%
% ProbLog was developed at Katholieke Universiteit Leuven
%
% Copyright 2008, 2009, 2010
% Katholieke Universiteit Leuven
%
% Main authors of this file:
% Bernd Gutmann, Vitor Santos Costa
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Artistic License 2.0
%
% Copyright (c) 2000-2006, The Perl Foundation.
%
% Everyone is permitted to copy and distribute verbatim copies of this
% license document, but changing it is not allowed. Preamble
%
% This license establishes the terms under which a given free software
% Package may be copied, modified, distributed, and/or
% redistributed. The intent is that the Copyright Holder maintains some
% artistic control over the development of that Package while still
% keeping the Package available as open source and free software.
%
% You are always permitted to make arrangements wholly outside of this
% license directly with the Copyright Holder of a given Package. If the
% terms of this license do not permit the full use that you propose to
% make of the Package, you should contact the Copyright Holder and seek
% a different licensing arrangement. Definitions
%
% "Copyright Holder" means the individual(s) or organization(s) named in
% the copyright notice for the entire Package.
%
% "Contributor" means any party that has contributed code or other
% material to the Package, in accordance with the Copyright Holder's
% procedures.
%
% "You" and "your" means any person who would like to copy, distribute,
% or modify the Package.
%
% "Package" means the collection of files distributed by the Copyright
% Holder, and derivatives of that collection and/or of those files. A
% given Package may consist of either the Standard Version, or a
% Modified Version.
%
% "Distribute" means providing a copy of the Package or making it
% accessible to anyone else, or in the case of a company or
% organization, to others outside of your company or organization.
%
% "Distributor Fee" means any fee that you charge for Distributing this
% Package or providing support for this Package to another party. It
% does not mean licensing fees.
%
% "Standard Version" refers to the Package if it has not been modified,
% or has been modified only in ways explicitly requested by the
% Copyright Holder.
%
% "Modified Version" means the Package, if it has been changed, and such
% changes were not explicitly requested by the Copyright Holder.
%
% "Original License" means this Artistic License as Distributed with the
% Standard Version of the Package, in its current version or as it may
% be modified by The Perl Foundation in the future.
%
% "Source" form means the source code, documentation source, and
% configuration files for the Package.
%
% "Compiled" form means the compiled bytecode, object code, binary, or
% any other form resulting from mechanical transformation or translation
% of the Source form.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Permission for Use and Modification Without Distribution
%
% (1) You are permitted to use the Standard Version and create and use
% Modified Versions for any purpose without restriction, provided that
% you do not Distribute the Modified Version.
%
% Permissions for Redistribution of the Standard Version
%
% (2) You may Distribute verbatim copies of the Source form of the
% Standard Version of this Package in any medium without restriction,
% either gratis or for a Distributor Fee, provided that you duplicate
% all of the original copyright notices and associated disclaimers. At
% your discretion, such verbatim copies may or may not include a
% Compiled form of the Package.
%
% (3) You may apply any bug fixes, portability changes, and other
% modifications made available from the Copyright Holder. The resulting
% Package will still be considered the Standard Version, and as such
% will be subject to the Original License.
%
% Distribution of Modified Versions of the Package as Source
%
% (4) You may Distribute your Modified Version as Source (either gratis
% or for a Distributor Fee, and with or without a Compiled form of the
% Modified Version) provided that you clearly document how it differs
% from the Standard Version, including, but not limited to, documenting
% any non-standard features, executables, or modules, and provided that
% you do at least ONE of the following:
%
% (a) make the Modified Version available to the Copyright Holder of the
% Standard Version, under the Original License, so that the Copyright
% Holder may include your modifications in the Standard Version. (b)
% ensure that installation of your Modified Version does not prevent the
% user installing or running the Standard Version. In addition, the
% modified Version must bear a name that is different from the name of
% the Standard Version. (c) allow anyone who receives a copy of the
% Modified Version to make the Source form of the Modified Version
% available to others under (i) the Original License or (ii) a license
% that permits the licensee to freely copy, modify and redistribute the
% Modified Version using the same licensing terms that apply to the copy
% that the licensee received, and requires that the Source form of the
% Modified Version, and of any works derived from it, be made freely
% available in that license fees are prohibited but Distributor Fees are
% allowed.
%
% Distribution of Compiled Forms of the Standard Version or
% Modified Versions without the Source
%
% (5) You may Distribute Compiled forms of the Standard Version without
% the Source, provided that you include complete instructions on how to
% get the Source of the Standard Version. Such instructions must be
% valid at the time of your distribution. If these instructions, at any
% time while you are carrying out such distribution, become invalid, you
% must provide new instructions on demand or cease further
% distribution. If you provide valid instructions or cease distribution
% within thirty days after you become aware that the instructions are
% invalid, then you do not forfeit any of your rights under this
% license.
%
% (6) You may Distribute a Modified Version in Compiled form without the
% Source, provided that you comply with Section 4 with respect to the
% Source of the Modified Version.
%
% Aggregating or Linking the Package
%
% (7) You may aggregate the Package (either the Standard Version or
% Modified Version) with other packages and Distribute the resulting
% aggregation provided that you do not charge a licensing fee for the
% Package. Distributor Fees are permitted, and licensing fees for other
% components in the aggregation are permitted. The terms of this license
% apply to the use and Distribution of the Standard or Modified Versions
% as included in the aggregation.
%
% (8) You are permitted to link Modified and Standard Versions with
% other works, to embed the Package in a larger work of your own, or to
% build stand-alone binary or bytecode versions of applications that
% include the Package, and Distribute the result without restriction,
% provided the result does not expose a direct interface to the Package.
%
% Items That are Not Considered Part of a Modified Version
%
% (9) Works (including, but not limited to, modules and scripts) that
% merely extend or make use of the Package, do not, by themselves, cause
% the Package to be a Modified Version. In addition, such works are not
% considered parts of the Package itself, and are not subject to the
% terms of this license.
%
% General Provisions
%
% (10) Any use, modification, and distribution of the Standard or
% Modified Versions is governed by this Artistic License. By using,
% modifying or distributing the Package, you accept this license. Do not
% use, modify, or distribute the Package, if you do not accept this
% license.
%
% (11) If your Modified Version has been derived from a Modified Version
% made by someone other than you, you are nevertheless required to
% ensure that your Modified Version complies with the requirements of
% this license.
%
% (12) This license does not grant you the right to use any trademark,
% service mark, tradename, or logo of the Copyright Holder.
%
% (13) This license includes the non-exclusive, worldwide,
% free-of-charge patent license to make, have made, use, offer to sell,
% sell, import and otherwise transfer the Package with respect to any
% patent claims licensable by the Copyright Holder that are necessarily
% infringed by the Package. If you institute patent litigation
% (including a cross-claim or counterclaim) against any party alleging
% that the Package constitutes direct or contributory patent
% infringement, then this Artistic License to you shall terminate on the
% date that such litigation is filed.
%
% (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT
% HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED
% WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
% PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT
% PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT
% HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT,
% INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
% OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- module(utils_libbdd, [empty_bdd_nbs/0,
create_bdd_nb/3,
create_bdd_input_nb/2,
create_bdd_output_nb/4]).
:- reexport(utils_learning, [
empty_output_directory/0,
create_known_values_file_name/2,
create_factprobs_file_name/2,
create_test_predictions_file_name/2,
create_training_predictions_file_name/2]).
%========================================================================
%=
%=
%========================================================================
empty_bdd_nbs.
%========================================================================
%=
%=
%========================================================================
create_bdd_nb(QueryID,ClusterID,NB_Name) :-
atomic_concat(['query_',QueryID,'_cluster_',ClusterID],NB_Name).

View File

@ -277,14 +277,8 @@ create_known_values_file_name(_,_) :-
%=
%========================================================================
create_bdd_file_name(QueryID,ClusterID,Absolute_File_Name) :-
problog_flag(bdd_directory,Path),
!,
atomic_concat(['query_',QueryID,'_cluster_',ClusterID],File_Name),
concat_path_with_filename(Path,File_Name,Absolute_File_Name).
create_bdd_file_name(_,_,_) :-
throw(error(problog_flag_does_not_exist(bdd_directory))).
create_bdd_nb_name(QueryID,ClusterID,NB_Name) :-
atomic_concat(['query_',QueryID,'_cluster_',ClusterID],NB_Name).
%========================================================================
%=

View File

@ -0,0 +1,101 @@
%%% -*- Mode: Prolog; -*-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ProbLog program describing a probabilistic graph
% (running example from ProbLog presentations)
% $Id: learn_graph.pl 4875 2010-10-05 15:28:35Z theo $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% example for parameter learning with LeProbLog
%
% training and test examples are included at the end of the file
% query ?- do_learning(20).
% will run 20 iterations of learning with default settings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%:- use_module(library(problog)).
:- use_module(library(problog_learning_lbdd)).
%%%%
% background knowledge
%%%%
% definition of acyclic path using list of visited nodes
path(X,Y) :- path(X,Y,[X],_).
path(X,X,A,A).
path(X,Y,A,R) :-
X\==Y,
edge(X,Z),
absent(Z,A),
path(Z,Y,[Z|A],R).
% using directed edges in both directions
edge(X,Y) :- dir_edge(Y,X).
edge(X,Y) :- dir_edge(X,Y).
% checking whether node hasn't been visited before
absent(_,[]).
absent(X,[Y|Z]):-X \= Y, absent(X,Z).
%%%%
% probabilistic facts
% - probability represented by t/1 term means learnable parameter
% - argument of t/1 is real value (used to compare against in evaluation when known), use t(_) if unknown
%%%%
t(0.9)::dir_edge(1,2).
t(0.8)::dir_edge(2,3).
t(0.6)::dir_edge(3,4).
t(0.7)::dir_edge(1,6).
t(0.5)::dir_edge(2,6).
t(0.4)::dir_edge(6,5).
t(0.7)::dir_edge(5,3).
t(0.2)::dir_edge(5,4).
%%%%%%%%%%%%%%
% training examples of form example(ID,Query,DesiredProbability)
%%%%%%%%%%%%%%
example(1,path(1,2),0.94).
example(2,path(1,3),0.81).
example(3,path(1,4),0.54).
example(4,path(1,5),0.70).
example(5,path(1,6),0.87).
example(6,path(2,3),0.85).
example(7,path(2,4),0.57).
example(8,path(2,5),0.72).
example(9,path(2,6),0.86).
example(10,path(3,4),0.66).
example(11,path(3,5),0.80).
example(12,path(3,6),0.75).
example(13,path(4,5),0.57).
example(14,path(4,6),0.51).
example(15,path(5,6),0.69).
% some examples for learning from proofs:
example(16,(dir_edge(2,3),dir_edge(2,6),dir_edge(6,5),dir_edge(5,4)),0.032).
example(17,(dir_edge(1,6),dir_edge(2,6),dir_edge(2,3),dir_edge(3,4)),0.168).
example(18,(dir_edge(5,3),dir_edge(5,4)),0.14).
example(19,(dir_edge(2,6),dir_edge(6,5)),0.2).
example(20,(dir_edge(1,2),dir_edge(2,3),dir_edge(3,4)),0.432).
%%%%%%%%%%%%%%
% test examples of form test_example(ID,Query,DesiredProbability)
% note: ID namespace is shared with training example IDs
%%%%%%%%%%%%%%
test_example(21,path(2,1),0.94).
test_example(22,path(3,1),0.81).
test_example(23,path(4,1),0.54).
test_example(24,path(5,1),0.70).
test_example(25,path(6,1),0.87).
test_example(26,path(3,2),0.85).
test_example(27,path(4,2),0.57).
test_example(28,path(5,2),0.72).
test_example(29,path(6,2),0.86).
test_example(30,path(4,3),0.66).
test_example(31,path(5,3),0.80).
test_example(32,path(6,3),0.75).
test_example(33,path(5,4),0.57).
test_example(34,path(6,4),0.51).
test_example(35,path(6,5),0.69).

View File

@ -0,0 +1,52 @@
%
% ProbLog extension to use an YAP BDD interface module, instead of simplecudd.
%
:- use_module(library(trie_sp)).
:- use_module(library(bdd)).
:- use_module(library(bhash)).
problog_kbest_bdd(Goal, K, Prob, ok) :-
problog_kbest_to_bdd(Goal, K, BDD, MapList),
bind_maplist(MapList, BoundVars),
bdd_to_probability_sum_product(BDD, BoundVars, Prob).
problog_kbest_as_bdd(Goal, K, bdd(Tree, MapList)) :-
problog_kbest_to_bdd(Goal, K, BDD, MapList),
bdd_tree(BDD, bdd(_Dir, Tree, _Vars)),
bdd_close(BDD).
problog_kbest_to_bdd(Goal, K, BDD, MapList) :-
problog_flag(first_threshold,InitT),
init_problog_kbest(InitT),
problog_control(off,up),
problog_kbest_id(Goal, K),
retract(current_kbest(_,ListFound,_NumFound)),
build_prefixtree(ListFound),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
trie_to_bdd(Trie_Completed_Proofs, BDD, MapList),
delete_ptree(Trie_Completed_Proofs).
problog_fl_bdd(Goal, _) :-
init_problog_low(0.0),
problog_control(off, up),
timer_start(sld_time),
problog_call(Goal),
add_solution,
fail.
problog_fl_bdd(_,Prob) :-
timer_stop(sld_time,SLD_Time),
problog_var_set(sld_time, SLD_Time),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
tabled_trie_to_bdd(Trie_Completed_Proofs, BDD, MapList),
bind_maplist(MapList, BoundVars),
bdd_to_probability_sum_product(BDD, BoundVars, Prob),
(problog_flag(retain_tables, true) -> retain_tabling; true),
clear_tabling.
bind_maplist([], []).
bind_maplist([Node-_|MapList], [ProbFact|BoundVars]) :-
get_fact_probability(Node,ProbFact),
bind_maplist(MapList, BoundVars).

View File

@ -207,6 +207,7 @@
:- module(learning,[do_learning/1,
do_learning/2,
set_problog_flag/2,
reset_learning/0
]).
@ -740,7 +741,9 @@ update_query(QueryID,Symbol,What_To_Update) :-
' > "',
Output_Directory,
'values.pl"'],Command),
shell(Command,Error),
%shell('cat /home/vsc/Yap/bins/devel/outputvalues.pl',_),
(

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,8 @@ CWD=$(PWD)
BDD_PROLOG= \
$(srcdir)/bdd.yap \
$(srcdir)/simpbool.yap \
$(srcdir)/ddnnf.yap \
$(srcdir)/trie_sp.yap
OBJS=cudd.o

View File

@ -10,6 +10,7 @@
bdd_size/2,
bdd_print/2,
bdd_to_probability_sum_product/2,
bdd_to_probability_sum_product/3,
bdd_close/1,
mtbdd_close/1]).
@ -17,6 +18,8 @@
:- use_module(library(rbtrees)).
:- use_module(library(simpbool)).
tell_warning :-
print_message(warning,functionality(cudd)).
@ -47,8 +50,8 @@ set_bdd(T, VS, Manager, Cudd) :-
set_bdd_from_list(T0, VS, Manager, Cudd) :-
numbervars(VS,0,_),
% generate_releases(T0, Manager, T),
T0 = T,
generate_releases(T0, Manager, T),
% T0 = T,
% writeln_list(T),
list_to_cudd(T,Manager,_Cudd0,Cudd).
@ -127,7 +130,7 @@ bdd_eval(add(M, X, Vars, _), Val) :-
mtbdd_eval(add(M,X, Vars, _), Val) :-
add_eval(M, X, Vars, Val).
bdd_tree(cudd(M, X, Vars, _), bdd(Dir, Tree, Vars)) :-
bdd_tree(cudd(M, X, Vars, _Vs), bdd(Dir, Tree, Vars)) :-
cudd_to_term(M, X, Vars, Dir, Tree).
bdd_tree(add(M, X, Vars, _), mtbdd(Tree, Vars)) :-
add_to_term(M, X, Vars, Tree).
@ -138,6 +141,9 @@ mtbdd_tree(add(M,X,Vars, _), mtbdd(Dir, Tree, Vars)) :-
bdd_to_probability_sum_product(cudd(M,X,_,Probs), Prob) :-
cudd_to_probability_sum_product(M, X, Probs, Prob).
bdd_to_probability_sum_product(cudd(M,X,_,_Probs), Probs, Prob) :-
cudd_to_probability_sum_product(M, X, Probs, Prob).
bdd_close(cudd(M,_,_Vars, _)) :-
cudd_die(M).
bdd_close(add(M,_,_Vars, _)) :-

249
packages/bdd/ddnnf.yap Normal file
View File

@ -0,0 +1,249 @@
:- module(ddnnf,
[cnf_to_ddnnf/3,
ddnnf/3,
ddnnf_is/2]).
:- use_module(library(lists)).
:- use_module(library(readutil)).
:- use_module(library(lineutils)).
:- use_module(library(terms)).
:- use_module(library(cnf)).
:- use_module(library(simpbool)).
%
% convert a CNF as list with Variables Vars and Existential variables
% in DDNNF, Exs \in LVars into DDNNF with extra existential vars
%
cnf_to_ddnnf(CNF0, PVs, DDNNF) :-
list2cnf(CNF0, CNF, []),
mkddnnf(CNF, PVs, DDNNF).
mkddnnf(CNF, PVs, DDNNF) :-
term_variables(CNF, AllVars),
% (numbervars(CNF,1,_), writeln(CNF), fail ; true),
open(dimacs, write, S),
cnf_to_file(CNF, AllVars, S),
close(S),
% execute c2d at this point, but we're lazy%
% unix(system('c2d -dt_method 3 -in dimacs')),
% unix(system('c2d -visualize -in dimacs')),
unix(system('dsharp -Fnnf dimacs.nnf dimacs')),
open('dimacs.nnf',read,R),
SVars =.. [v|AllVars],
% ones(LVars),
input_ddnnf(R, SVars, PVs, DDNNF),
% writeln(DDNNF),
close(R).
list2cnf([]) --> [].
list2cnf([(O=A)|Impls]) --> !,
{cvt(O,FO,NO),
and2cnf(A,Conj,[]) },
[[FO|Conj]],
disj(A, NO),
list2cnf(Impls).
list2cnf([CNF|Impls]) -->
{ to_format(CNF, Format, []) },
[Format],
list2cnf(Impls).
cvt(O,O,-O) :- var(O), !.
cvt(not(O),-O,O).
neg(O,-O) :- var(O), !.
neg(-O,O).
to_format(A) -->
{ var(A) },
!,
[A].
to_format(A+B) -->
!,
to_format(A),
to_format(B).
to_format(not(A)) -->
!,
[-A].
to_format(A) -->
[A].
and2cnf(A) -->
{ var(A) },
!,
[-A].
and2cnf(A*B) -->
!,
and2cnf(A),
and2cnf(B).
and2cnf(not(A)) -->
!,
[A].
and2cnf(A) -->
!,
[-A].
disj(A, NO) -->
{ var(A) }, !,
[[NO,A]].
disj(A*B, NO) --> !,
disj(A, NO),
disj(B, NO).
disj(A, NO) -->
[[NO,A]].
%
% convert a boolean expression with Variables Vars and Existential variables
% in DDNNF, Exs \in LVars into DDNNF with extra existential vars
%
% ex: (A*B+not(B))*(C=B) into something complicated
%
ddnnf(List, PVs, DDNNF) :-
exps2conj(List, Conj),
cnf(Conj, CNF),
mkddnnf(CNF, PVs, DDNNF).
exps2conj((C1,C2), CC1*CC2) :- !,
exps2conj(C1, CC1),
exps2conj(C2, CC2).
exps2conj((Conj), CConj) :-
cvt_el(Conj, CConj).
cvt_el(V, V) :- var(V), !.
cvt_el(not(X), -X1) :- !,
cvt_el(X, X1).
cvt_el(X+Y, X1+Y1) :- !,
cvt_el(X, X1),
cvt_el(Y, Y1).
cvt_el(X*Y, X1*Y1) :- !,
cvt_el(X, X1),
cvt_el(Y, Y1).
cvt_el(X=Y, X1==Y1) :- !,
cvt_el(X, X1),
cvt_el(Y, Y1).
cvt_el(X, X).
cnf_to_file(List, Vars, S) :-
number_ivars(Vars, 1, M),
length(List, N),
M1 is M-1,
format(S,'p cnf ~d ~d~n',[M1,N]),
output_list(List, S),
fail.
cnf_to_file(_List, _Vars, _S).
number_ivars([], M, M).
number_ivars([I0|IVars], I0, M) :-
I is I0+1,
number_ivars(IVars, I, M).
output_list([], _S).
output_list([CNF|List], S) :-
output_cnf(CNF, S),
output_list(List, S).
output_cnf([], S) :-
format(S, '0~n', []).
output_cnf([-V|CNF], S) :- !,
format(S, '-~d ',[V]),
output_cnf(CNF, S).
output_cnf([V|CNF], S) :-
format(S, '~d ',[V]),
output_cnf(CNF, S).
input_ddnnf(Stream, SVars, PVs, ddnnf(Out, SVars, Result)) :-
read_line_to_codes(Stream, Header),
split(Header, ["nnf",VS,_ES,_NS]),
number_codes(NVs, VS),
functor(TempResults, nnf, NVs),
process_nnf_lines(Stream, SVars, PVs, 1, TempResults, Out, Last),
Last1 is Last-1,
arg(Last1, TempResults, Result).
process_nnf_lines(Stream, SVars, PVs, LineNumber, TempResults, O, LL) :-
read_line_to_codes(Stream, Codes),
( Codes = end_of_file -> O = [], LL = LineNumber ;
% (LineNumber > 1 -> N is LineNumber-1, arg(N,TempResults,P), format("~w ",[P]);true),
% format("~s~n",[Codes]),
arg(LineNumber, TempResults, P),
process_nnf_line(SVars, PVs, TempResults, Exp0, Codes, []),
simplify_line(P=Exp0, Lines, O),
NewLine is LineNumber+1,
process_nnf_lines(Stream, SVars, PVs, NewLine, TempResults, Lines, LL)
).
process_nnf_line(SVars, PVs, _TempResults, Exp) --> "L ",
nnf_leaf(SVars, PVs, Exp).
process_nnf_line(_SVars, _, TempResults, Exp) --> "A ",
nnf_and_node(TempResults, Exp).
process_nnf_line(_SVars, _, TempResults, Exp) --> "O ",
nnf_or_node(TempResults, Exp).
nnf_leaf(SVars, PVs, Prob, Codes, []) :-
number_codes(Number, Codes),
Abs is abs(Number),
arg(Abs, SVars, Node),
(Number < 0 ->
(parameter(Node,PVs) -> Prob = 1-Node ; Prob = 1 )
;
Prob = Node
).
parameter(F,[F1|_Exs]) :- F == F1, !.
parameter(F,[_|Exs]) :-
parameter(F, Exs).
nnf_and_node(TempResults, Product, Codes, []) :-
split(Codes, [_|NumberAsStrings]),
multiply_nodes(NumberAsStrings, TempResults, Product).
multiply_nodes([], _, 1).
multiply_nodes(NumberAsString.NumberAsStrings, TempResults, Product) :-
number_codes(Pos, NumberAsString),
Pos1 is Pos+1,
arg(Pos1, TempResults, P),
Product = Product0*P,
multiply_nodes(NumberAsStrings, TempResults, Product0).
nnf_or_node(TempResults, Sum, Codes, []) :-
split(Codes, [_J,_C|NumberAsStrings]),
add_nodes(NumberAsStrings, TempResults, Sum).
add_nodes([], _, 0).
add_nodes(NumberAsString.NumberAsStrings, TempResults, Product) :-
number_codes(Pos, NumberAsString),
Pos1 is Pos+1,
arg(Pos1, TempResults, P),
Product = Product0+P,
add_nodes(NumberAsStrings, TempResults, Product0).
ones([]).
ones([1|LVars]) :-
ones(LVars).
simplify_line((A=Exp0), List, Final) :-
simplify_exp(Exp0, Exp),
propagate_constants(Exp, A, List, Final).
propagate_constants(Exp, A, Lines, Lines) :- var(Exp), !, A=Exp.
propagate_constants(0, 0, Lines, Lines) :- !.
propagate_constants(1, 1, Lines, Lines) :- !.
propagate_constants(Exp, A, Lines, [(A=Exp)|Lines]).
%
% compute the value of a SP
%
%
ddnnf_is(ddnnf(F, Vs, Out), Out) :-
term_variables(Vs,LVs),
ones(LVs),
%(numbervars(F,1,_),writeln(F),fail;true),
ddnnf_is_acc(F).
%ddnnf_is_acc([H=Exp|_]) :- writeln((H=Exp)),fail.
ddnnf_is_acc([]).
ddnnf_is_acc([H=Exp|Attrs]) :-
H is Exp,
%writeln(Exp:H),
ddnnf_is_acc(Attrs).

54
packages/bdd/simpbool.yap Normal file
View File

@ -0,0 +1,54 @@
%
% simplify a boolean expression of the form A*B+C*D...
%
:- module(simplify_boolean,
[simplify_exp/2]).
%simplify_exp(V,V) :- writeln(V), fail, !.
simplify_exp(V,V) :- var(V), !.
simplify_exp(S1+S2,NS) :- !,
simplify_exp(S1, SS1),
simplify_exp(S2, SS2),
simplify_sum(SS1, SS2, NS).
simplify_exp(S1*S2,NS) :- !,
simplify_exp(S1, SS1),
simplify_exp(S2, SS2),
simplify_prod(SS1, SS2, NS).
simplify_exp(not(S),NS) :- !,
simplify_exp(S, SS),
simplify_not(SS, NS).
simplify_exp(S,S).
simplify_sum(V1, V2, O) :-
( var(V1) ->
( var(V2) ->
( V1 == V2 -> O = V1 ; O = V1+V2 ) ; /* var(V1) , var(V2) */
( V2 == 0 -> O = V1 ; V2 == 1 -> O = 1 ; O = V1+V2 ) /* var(V1) , nonvar(V2) */
) ;
( var(V2) ->
( V1 == 0 -> O = V2 ; V1 == 1 -> O = 1 ; O = V1+V2 ) ; /* nonvar(V1) , var(V2) */
( V2 == 0 -> O = V1 ; V2 == 1 -> O = 1 ; V1 == 0 -> O = V2 ; V1 == 1 -> O = 1; O = V1+V2 ) /* nonvar(V1) , nonvar(V2) */
)
).
simplify_prod(V1, V2, O) :-
( var(V1) ->
( var(V2) ->
( V1 == V2 -> O = V1 ; O = V1*V2 ) ; /* var(V1) , var(V2) */
( V2 == 0 -> O = 0 ; V2 == 1 -> O = V1 ; O = V1*V2 ) /* var(V1) , nonvar(V2) */
) ;
( var(V2) ->
( V1 == 0 -> O = 0 ; V1 == 1 -> O = V2 ; O = V1*V2 ) ; /* nonvar(V1) , var(V2) */
( V2 == 0 -> O = 0 ; V2 == 1 -> O = V1 ; V1 == 0 -> O = 0 ; V1 == 1 -> O = V2; V1 == V2 -> O = V1 ; O = V1*V2 ) /* nonvar(V1) , nonvar(V2) */
)
).
simplify_not(V, not(V)) :- var(V), !.
simplify_not(0, 1) :- !.
simplify_not(1, 0) :- !.
simplify_not(SS, not(SS)).

View File

@ -12,8 +12,7 @@ trie_to_bdd(Trie, BDD, MapList) :-
complex_to_andor(Complex,Map0,Map,Tree),
rb_visit(Map, MapList),
extract_vars(MapList, Vs),
bdd_new(Tree, Vs, BDD),
bdd_tree(BDD, bdd(_, L, _)), length(L,Len), writeln(Len).
bdd_new(Tree, Vs, BDD).
tabled_trie_to_bdd(Trie, BDD, MapList) :-
trie_to_list(Trie, Complex),
@ -21,7 +20,6 @@ tabled_trie_to_bdd(Trie, BDD, MapList) :-
rb_new(Tab0),
Complex = [list(Els)],
tabled_complex_to_andor(Els,Map0,Map,Tab0,_Tab,Tree),
writeln(Complex),
rb_visit(Map, MapList),
extract_vars(MapList, Vs),
bdd_new(Tree, Vs, BDD),
@ -31,6 +29,7 @@ extract_vars([], []).
extract_vars((_-V).MapList, V.Vs) :-
extract_vars(MapList, Vs).
complex_to_andor(empty, Map, Map, 0).
complex_to_andor([list(Els)], Map0, MapF, Tree) :- !,
complex_to_andor(Els, Map0, MapF, Tree).
complex_to_andor([El1,El2|Els], Map0, MapF, or(T1,T2)) :- !,

View File

@ -9,8 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <YapTerm.h>
#include <YapTags.h>
#include <YapRegs.h>
#include <YapTags.h>
typedef void *SYM_REC_PTR;

View File

@ -71,7 +71,7 @@ iff((X==Y),Polarity,B,Acc,Cnf) :- !,
Cnf = [[-BX,BY,-B],[BX,-BY,-B],[-BX,-BY,B],[BX,BY,B] | AccXY]
).
iff((X xor Y),Polarity,B,Acc,Cnf) :- !,
iff((xor(X, Y)),Polarity,B,Acc,Cnf) :- !,
iff(X,*,BX,Acc,AccX),
iff(Y,*,BY,AccX,AccXY),
(

View File

@ -125,12 +125,13 @@ void *RtreeUdiSearch (control_t *control)
/*RTreePrint ((*control)[0].tree);*/
for (i = 0; i < NARGS && (*control)[i].arg != 0 ; i++)
if (YAP_IsAttVar(YAP_A((*control)[i].arg)))
for (i = 0; i < NARGS && (*control)[i].arg != 0 ; i++) {
YAP_Term t = YAP_A((*control)[i].arg);
if (YAP_IsAttVar(t))
{
fprintf(stderr,"i=%ld\n",i);
/*get the constraits rect*/
Constraints = YAP_AttsOfVar(YAP_A((*control)[i].arg));
Constraints = YAP_AttsOfVar(t);
/* Yap_DebugPlWrite(Constraints); */
r = RectOfTerm(YAP_ArgOfTerm(2,Constraints));
@ -155,7 +156,7 @@ void *RtreeUdiSearch (control_t *control)
return Yap_ClauseListCode(c->cl);
}
}
return NULL; /*YAP FALLBACK*/
}

View File

@ -412,7 +412,7 @@ true :- true.
->
'$assertz_dynamic'(L,G,G0,Mod)
;
nb_getval('$assert_all',on)
catch(nb_getval('$assert_all',on),_,fail)
->
functor(H,N,A),
'$dynamic'(N/A,Mod),
@ -1233,7 +1233,7 @@ catch_ball(C, C).
'$exit_system_mode' :-
nb_setval('$system_mode',off),
( nb_getval('$trace',on) -> '$creep' ; true).
( catch(nb_getval('$trace',on),_,fail) -> '$creep' ; true).
%
% just prevent creeping from going on...

View File

@ -230,18 +230,15 @@ use_module(M,F,Is) :-
'$do_lf'(ContextModule, Stream, InfLevel, _, Imports, SkipUnixComments, CompMode, Reconsult, UseModule) :-
'$reset_if'(OldIfLevel),
( nb_getval('$system_mode', OldMode) -> true ; OldMode = off),
( OldMode == off -> '$enter_system_mode' ; true ),
'$into_system_mode'(OldMode),
'$record_loaded'(Stream, ContextModule, Reconsult),
'$current_module'(OldModule,ContextModule),
working_directory(OldD,OldD),
nb_getval('$consulting_file',OldF),
'$set_consulting_file'(Stream),
'$ensure_consulting_file'(OldF, Stream),
H0 is heapused, '$cputime'(T0,_),
'$file_name'(Stream,File),
'$set_current_loop_stream'(OldStream, Stream),
nb_getval('$consulting',Old),
nb_setval('$consulting',false),
'$ensure_consulting'(Old, false),
'$access_yap_flags'(18,GenerateDebug),
'$consult_infolevel'(InfLevel),
'$comp_mode'(OldCompMode, CompMode),
@ -303,6 +300,18 @@ use_module(M,F,Is) :-
Level0 = Level.
'$get_if'(0).
'$into_system_mode'(OldMode) :-
( catch(nb_getval('$system_mode', OldMode),_,fail) -> true ; OldMode = off),
( OldMode == off -> '$enter_system_mode' ; true ).
'$ensure_consulting_file'(OldF, Stream) :-
( catch(nb_getval('$consulting_file',OldF), _, fail) -> true ; OldF = []),
'$set_consulting_file'(Stream).
'$ensure_consulting'(Old, New) :-
( catch(nb_getval('$consulting',Old), _, fail) -> true ; Old = false ),
nb_setval('$consulting', New).
'$bind_module'(_, load_files).
'$bind_module'(Mod, use_module(Mod)).
@ -428,7 +437,7 @@ initialization(G,OPT) :-
'$include'(X, Status) :-
get_value('$lf_verbose',Verbosity),
'$full_filename'(X,Y,include(X)),
nb_getval('$included_file',OY),
( catch( nb_getval('$included_file',OY), _, fail ) -> true ; OY = [] ),
nb_setval('$included_file', Y),
'$current_module'(Mod),
H0 is heapused, '$cputime'(T0,_),
@ -484,7 +493,7 @@ prolog_load_context(_, _) :-
prolog_load_context(directory, DirName) :-
getcwd(DirName).
prolog_load_context(file, FileName) :-
nb_getval('$included_file',IncFileName),
( catch( nb_getval('$included_file',IncFileName), _, fail ) -> true ; IncFileName = [] ),
( IncFileName = [] ->
nb_getval('$consulting_file',FileName),
FileName \= []
@ -1003,7 +1012,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
'$set_yap_flags'(11,0).
'$fetch_comp_status'(assert_all) :-
nb_getval('$assert_all',on), !.
catch(nb_getval('$assert_all',on), _, fail), !.
'$fetch_comp_status'(source) :-
'$access_yap_flags'(11,1).
'$fetch_comp_status'(compact).

View File

@ -255,8 +255,6 @@ print_message(Severity, Term) :-
'$print_system_message'(Term, Severity, Lines)
), !.
print_message(silent, _) :- !.
print_message(_, error(syntax_error(syntax_error(_,between(_,L,_),_,_,_,_,StreamName)),_)) :- !,
format(user_error,'SYNTAX ERROR at ~a, close to ~d~n',[StreamName,L]).
print_message(_, loading(A, F)) :- !,
format(user_error,' % ~a ~a~n',[A,F]).
print_message(_, loaded(A, F, _, Time, Space)) :- !,
@ -284,13 +282,6 @@ print_message(_, Term) :-
current_prolog_flag(verbose, silent), !.
'$print_system_message'(_, banner, _) :-
current_prolog_flag(verbose, silent), !.
'$print_system_message'(Term, Level, Lines) :-
Term = error(syntax_error(syntax_error(_,_,_,_,_,_,_)),_), !,
flush_output(user_output),
flush_output(user_error),
'$messages':prefix(Level, LinePrefix, Stream, _, Lines), !,
% make sure we don't give a PC.
print_message_lines(Stream, LinePrefix, Lines).
'$print_system_message'(Term, Level, Lines) :-
'$messages':prefix(Level, LinePrefix, Stream, Prefix),
'$messages':file_location(Prefix, LinesF, Lines), !,

View File

@ -617,7 +617,7 @@ yap_flag(system_options,X) :-
'$system_options'(readline) :-
'$swi_current_prolog_flag'(readline, true).
'$system_options'(tabling) :-
\+ '$undefined'('$c_table'(_,_), prolog).
\+ '$undefined'('$c_table'(_,_,_), prolog).
'$system_options'(threads) :-
\+ '$no_threads'.
'$system_options'(wam_profiler) :-

View File

@ -283,14 +283,14 @@ system_message(error(resource_error(trail), Where)) -->
[ 'RESOURCE ERROR- not enough trail space' - [Where] ].
system_message(error(signal(SIG,_), _)) -->
[ 'UNEXPECTED SIGNAL: ~a' - [SIG] ].
system_message(error(syntax_error(G,_,Msg,[],_,0,File), _)) -->
system_message(error(syntax_error(_), [syntax_error(G,_,Msg,[],_,0,File)|_])) -->
[ 'SYNTAX ERROR at "~a", goal ~q: ~a' - [File,G,Msg] ].
% SWI like I/O error message.
system_message(error(syntax_error(end_of_clause), stream(Stream, Line, _, _))) -->
system_message(error(syntax_error(end_of_clause), [stream(Stream, Line, _, _)|_])) -->
[ 'SYNTAX ERROR ~a, stream ~w, near line ~d.' - ['Unexpected end of clause',Stream,Line] ].
system_message(error(syntax_error(read(_),_,_,Term,Pos,Start,File), Where)) -->
system_message(error(syntax_error(_), [syntax_error(read(_),_,_,Term,Pos,Start,File)|_])) -->
{ Term = [_|_] },
['~w' - [Where]],
['SYNTAX ERROR' - []],
syntax_error_line(File, Start, Pos),
syntax_error_term(10, Pos, Term),
[ '.' ].

View File

@ -102,7 +102,7 @@ module(N) :-
% redefining a previously-defined file, no problem.
'$add_preexisting_module_on_file'(F, F, Mod, Exports, R) :- !,
erase(R),
( recorded('$import','$import'(Mod,_,_,_,_,_),R), erase(R), fail; true),
( recorded('$import','$impovrt'(Mod,_,_,_,_,_),R), erase(R), fail; true),
recorda('$module','$module'(F,Mod,Exports),_).
'$add_preexisting_module_on_file'(F,F0,Mod,Exports,R) :-
repeat,
@ -115,9 +115,14 @@ module(N) :-
).
'$mod_scan'(C) :-
stream_property(user_input,tty(true)),
stream_property(user_error,tty(true)),
!,
repeat,
get0(C),
'$skipeol'(C),
(C is "y" ; C is "n").
(C is "y" ; C is "n" ; C is "h", halt ; format(user_error, ' Please answer with ''y'', ''n'' or ''h'' ', []), fail), !.
'$mod_scan'(C) :- C is "n".
'$import'([],_,_) :- !.
'$import'([N/K|L],M,T) :-
@ -132,7 +137,6 @@ module(N) :-
'$import'([PS|L],_,_) :-
'$do_error'(domain_error(predicate_spec,PS),import([PS|L])).
% $use_preds(Imports,Publics,Mod,M)
'$use_preds'(Imports,Publics,Mod,M) :- var(Imports), !,
'$import'(Publics,Mod,M).
'$use_preds'(M:L,Publics,Mod,_) :-
@ -142,9 +146,10 @@ module(N) :-
'$use_preds'(P,Publics,Mod,M),
'$use_preds'(Ps,Publics,Mod,M).
'$use_preds'(N/K,Publics,M,Mod) :-
( lists:memberchk(N/K,Publics) -> true ;
print_message(warning,import(N/K,Mod,M,private))
),
( lists:memberchk(N/K,Publics) ->
true ;
print_message(warning,import(N/K,Mod,M,private))
),
'$do_import'(N, K, M, Mod).
'$use_preds'(N//K0,Publics,M,Mod) :-
K is K0+2,
@ -158,8 +163,11 @@ module(N) :-
% ignore imports that we do export
%
'$do_import'(N, K, M, T) :-
recorded('$module','$module'(_F,T,MyExports),_),
lists:member(N/K,MyExports), !.
recorded('$module','$module'(_F, T, MyExports),_),
once(lists:member(N/K, MyExports)),
functor(S, N, K),
% reexport predicates if they are undefined in the current module.
\+ '$undefined'(S, T), !.
'$do_import'(N, K, M, T) :-
functor(G,N,K),
'$follow_import_chain'(M,G,M0,G0),
@ -180,16 +188,16 @@ module(N) :-
'$follow_import_chain'(M,G,M,G).
'$check_import'(M,T,N,K) :-
recorded('$import','$import'(MI,T,_,_,N,K),R),
\+ '$module_produced by'(M,T,N,K), !,
format(user_error,"NAME CLASH: ~w was already imported to module ~w;~n",[MI:N/K,T]),
format(user_error," Do you want to import it from ~w ? [y or n] ",M),
repeat,
get0(C), '$skipeol'(C),
( C is "y" -> erase(R), !;
C is "n" -> !, fail;
format(user_error, ' Please answer with ''y'' or ''n'' ',[]), fail
).
recorded('$import','$import'(MI,T,_,_,N,K),_R),
% dereference MI to M1, in order to find who
% is actually generating
( '$module_produced by'(M1,MI,N,K) -> true ; MI = M1 ),
( '$module_produced by'(M2,M,N,K) -> true ; M = M2 ),
M2 \= M1, !,
format(user_error,'NAME CLASH: ~w was already imported to module ~w;~n',[M1:N/K,M2]),
format(user_error,' Do you want to import it from ~w ? [y, n or h] ',M),
'$mod_scan'(C),
C =:= "y".
'$check_import'(_,_,_,_).
'$module_produced by'(M,M0,N,K) :-

View File

@ -30,7 +30,12 @@ qsave_program(File) :-
'$x_yap_flag'(language, V).
'$x_yap_flag'(X, V) :-
yap_flag(X, V),
X \= language.
X \= language,
X \= timezone,
X \= user_input,
X \= user_output,
X \= user_error,
X \= version.
'$init_state' :-
recorded('$program_state', _, _), !,