exo stuff
This commit is contained in:
parent
e14703b990
commit
6cd778f70b
@ -3668,8 +3668,9 @@ Yap_absmi(int inp)
|
|||||||
SREG++;
|
SREG++;
|
||||||
|
|
||||||
BEGP(pt0);
|
BEGP(pt0);
|
||||||
if (IsVarTerm(d0))
|
deref_head(d0, gatom_exo_unk);
|
||||||
goto gatom_exo_var;
|
/* argument is nonvar */
|
||||||
|
gatom_exo_nonvar:
|
||||||
if (d0 == d1) {
|
if (d0 == d1) {
|
||||||
PREG = NEXTOP(PREG, x);
|
PREG = NEXTOP(PREG, x);
|
||||||
GONext();
|
GONext();
|
||||||
@ -3678,7 +3679,7 @@ Yap_absmi(int inp)
|
|||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
|
|
||||||
gatom_exo_var:
|
deref_body(d0, pt0, gatom_exo_unk, gatom_exo_nonvar);
|
||||||
/* argument is a variable */
|
/* argument is a variable */
|
||||||
pt0 = (CELL *)d0;
|
pt0 = (CELL *)d0;
|
||||||
PREG = NEXTOP(PREG, x);
|
PREG = NEXTOP(PREG, x);
|
||||||
|
@ -264,8 +264,8 @@ LookupWideAtom(wchar_t *atom)
|
|||||||
wae->NextOfPE = NIL;
|
wae->NextOfPE = NIL;
|
||||||
wae->KindOfPE = WideAtomProperty;
|
wae->KindOfPE = WideAtomProperty;
|
||||||
wae->SizeOfAtom = sz;
|
wae->SizeOfAtom = sz;
|
||||||
if (ae->StrOfAE != (char *)atom)
|
if (ae->WStrOfAE != atom)
|
||||||
wcscpy((wchar_t *)(ae->StrOfAE), atom);
|
wcscpy(ae->WStrOfAE, atom);
|
||||||
NOfAtoms++;
|
NOfAtoms++;
|
||||||
ae->NextOfAE = a;
|
ae->NextOfAE = a;
|
||||||
WideHashChain[hash].Entry = na;
|
WideHashChain[hash].Entry = na;
|
||||||
|
96
C/exo.c
96
C/exo.c
@ -36,21 +36,25 @@
|
|||||||
|
|
||||||
#define MAX_ARITY 256
|
#define MAX_ARITY 256
|
||||||
|
|
||||||
|
|
||||||
/* Simple hash function */
|
/* Simple hash function */
|
||||||
static UInt
|
static UInt
|
||||||
HASH(UInt j, CELL *cl, struct index_t *it)
|
HASH(UInt hash0, UInt j, CELL *cl, struct index_t *it)
|
||||||
{
|
{
|
||||||
return ((cl[j] >> 3) + (3*j*it->nels)/2) % (it->nels*2);
|
Term t = cl[j];
|
||||||
|
if (IsIntTerm(t))
|
||||||
|
return (IntOfTerm(t) *257 + hash0 ) % (it->nels*2);
|
||||||
|
return ((t >> 3) *257 + hash0 ) % (it->nels*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search for matching elements */
|
/* search for matching elements */
|
||||||
static int
|
static int
|
||||||
MATCH(CELL *clp, CELL *kvp, UInt j, UInt bnds[], struct index_t *it)
|
MATCH(CELL *clp, CELL *kvp, UInt j, struct index_t *it)
|
||||||
{
|
{
|
||||||
if ((kvp - it->cls)%it->arity != j)
|
if ((kvp - it->cls)%it->arity != j)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
do {
|
do {
|
||||||
if ( bnds[j] && *clp != *kvp)
|
if ( LOCAL_ibnds[j] && *clp != *kvp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
clp--;
|
clp--;
|
||||||
kvp--;
|
kvp--;
|
||||||
@ -78,7 +82,7 @@ ADD_TO_TRY_CHAIN(CELL *kvp, CELL *cl, struct index_t *it)
|
|||||||
static UInt
|
static UInt
|
||||||
NEXT(UInt hash, struct index_t *it, UInt j)
|
NEXT(UInt hash, struct index_t *it, UInt j)
|
||||||
{
|
{
|
||||||
return (hash+3) % (it->nels*2);
|
return (hash+hash/3+j*257+1) % (it->nels*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the critical routine, it builds the hash table *
|
/* This is the critical routine, it builds the hash table *
|
||||||
@ -99,19 +103,20 @@ NEXT(UInt hash, struct index_t *it, UInt j)
|
|||||||
* else
|
* else
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
INSERT(CELL *cl, struct index_t *it, UInt arity, UInt base, UInt bnds[])
|
INSERT(CELL *cl, struct index_t *it, UInt arity, UInt base, UInt hash0)
|
||||||
{
|
{
|
||||||
UInt j = base;
|
UInt j = base;
|
||||||
CELL *kvp;
|
CELL *kvp;
|
||||||
UInt hash;
|
UInt hash;
|
||||||
|
|
||||||
/* skip over argument */
|
/* skip over argument */
|
||||||
while (!bnds[j]) {
|
while (!LOCAL_ibnds[j]) {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
/* j is the firs bound element */
|
/* j is the firs bound element */
|
||||||
/* check if we match */
|
/* check if we match */
|
||||||
hash = HASH(j, cl, it);
|
hash = hash0 = HASH(hash0, j, cl, it);
|
||||||
|
// printf("h=%ld j=%ld %lx\n", hash, j, cl[j]);
|
||||||
next:
|
next:
|
||||||
/* loop to insert element */
|
/* loop to insert element */
|
||||||
kvp = it->key[hash];
|
kvp = it->key[hash];
|
||||||
@ -119,56 +124,53 @@ INSERT(CELL *cl, struct index_t *it, UInt arity, UInt base, UInt bnds[])
|
|||||||
/* simple case, new entry */
|
/* simple case, new entry */
|
||||||
it->key[hash] = cl+j;
|
it->key[hash] = cl+j;
|
||||||
return;
|
return;
|
||||||
} else if (MATCH(cl+j, kvp, j, bnds, it)) {
|
} else if (MATCH(cl+j, kvp, j, it)) {
|
||||||
/* collision */
|
/* collision */
|
||||||
UInt k;
|
UInt k;
|
||||||
CELL *target;
|
CELL *target;
|
||||||
|
|
||||||
for (k =j+1, target = kvp+1; k < arity; k++,target++ ) {
|
for (k =j+1, target = kvp+1; k < arity; k++,target++ ) {
|
||||||
if (bnds[k]) {
|
if (LOCAL_ibnds[k]) {
|
||||||
if (*target != cl[k]) {
|
if (*target != cl[k]) {
|
||||||
/* found a new forking point */
|
/* found a new forking point */
|
||||||
INSERT(cl, it, arity, k, bnds);
|
INSERT(cl, it, arity, k, hash0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
it->ncols++;
|
||||||
ADD_TO_TRY_CHAIN(kvp, cl, it);
|
ADD_TO_TRY_CHAIN(kvp, cl, it);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
hash = NEXT(hash, it, j);
|
hash = NEXT(hash, it, j);
|
||||||
|
// printf("N=%ld\n", hash);
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static yamop *
|
static yamop *
|
||||||
LOOKUP(struct index_t *it, UInt arity, UInt bnds[])
|
LOOKUP(struct index_t *it, UInt arity, UInt j)
|
||||||
{
|
{
|
||||||
UInt j = 0;
|
|
||||||
CELL *kvp;
|
CELL *kvp;
|
||||||
UInt hash;
|
UInt hash, hash0 = 0;
|
||||||
|
|
||||||
/* skip over argument */
|
|
||||||
while (!bnds[j]) {
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
/* j is the firs bound element */
|
/* j is the firs bound element */
|
||||||
/* check if we match */
|
/* check if we match */
|
||||||
hash:
|
hash:
|
||||||
hash = HASH(j, XREGS+1, it);
|
hash = hash0 = HASH(hash0, j, XREGS+1, it);
|
||||||
next:
|
next:
|
||||||
/* loop to insert element */
|
/* loop to insert element */
|
||||||
kvp = it->key[hash];
|
kvp = it->key[hash];
|
||||||
if (kvp == NULL) {
|
if (kvp == NULL) {
|
||||||
/* simple case, no element */
|
/* simple case, no element */
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
} else if (MATCH(XREGS+(j+1), kvp, j, bnds, it)) {
|
} else if (MATCH(XREGS+(j+1), kvp, j, it)) {
|
||||||
/* found element */
|
/* found element */
|
||||||
UInt k;
|
UInt k;
|
||||||
CELL *target;
|
CELL *target;
|
||||||
|
|
||||||
for (k =j+1, target = kvp+1; k < arity; k++ ) {
|
for (k =j+1, target = kvp+1; k < arity; k++ ) {
|
||||||
if (bnds[k]) {
|
if (LOCAL_ibnds[k]) {
|
||||||
if (*target != XREGS[k+1]) {
|
if (*target != XREGS[k+1]) {
|
||||||
j = k;
|
j = k;
|
||||||
goto hash;
|
goto hash;
|
||||||
@ -177,7 +179,7 @@ LOOKUP(struct index_t *it, UInt arity, UInt bnds[])
|
|||||||
target++;
|
target++;
|
||||||
}
|
}
|
||||||
S = target-arity;
|
S = target-arity;
|
||||||
if (it->links[(S-it->cls)/arity])
|
if (!it->is_key && it->links[(S-it->cls)/arity])
|
||||||
return it->code;
|
return it->code;
|
||||||
else
|
else
|
||||||
return NEXTOP(NEXTOP(it->code,lp),lp);
|
return NEXTOP(NEXTOP(it->code,lp),lp);
|
||||||
@ -189,14 +191,14 @@ LOOKUP(struct index_t *it, UInt arity, UInt bnds[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_hash(UInt bmap, UInt bnds[], struct index_t *it)
|
fill_hash(UInt bmap, struct index_t *it)
|
||||||
{
|
{
|
||||||
UInt i;
|
UInt i;
|
||||||
UInt arity = it->arity;
|
UInt arity = it->arity;
|
||||||
CELL *cl = it->cls;
|
CELL *cl = it->cls;
|
||||||
|
|
||||||
for (i=0; i < it->nels; i++) {
|
for (i=0; i < it->nels; i++) {
|
||||||
INSERT(cl, it, arity, 0, bnds);
|
INSERT(cl, it, arity, 0, 0);
|
||||||
cl += arity;
|
cl += arity;
|
||||||
}
|
}
|
||||||
for (i=0; i < it->nels*2; i++) {
|
for (i=0; i < it->nels*2; i++) {
|
||||||
@ -213,7 +215,7 @@ fill_hash(UInt bmap, UInt bnds[], struct index_t *it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct index_t *
|
static struct index_t *
|
||||||
add_index(struct index_t **ip, UInt bmap, UInt bndsf[], PredEntry *ap, UInt count)
|
add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
|
||||||
{
|
{
|
||||||
UInt ncls = ap->cs.p_code.NOfClauses, j;
|
UInt ncls = ap->cs.p_code.NOfClauses, j;
|
||||||
CELL *base = NULL;
|
CELL *base = NULL;
|
||||||
@ -221,16 +223,6 @@ add_index(struct index_t **ip, UInt bmap, UInt bndsf[], PredEntry *ap, UInt coun
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
yamop *ptr;
|
yamop *ptr;
|
||||||
|
|
||||||
if (count) {
|
|
||||||
if (!(base = (CELL *)Yap_AllocCodeSpace(3*sizeof(CELL)*ncls))) {
|
|
||||||
CACHE_REGS
|
|
||||||
save_machine_regs();
|
|
||||||
LOCAL_Error_Size = 3*ncls*sizeof(CELL);
|
|
||||||
LOCAL_ErrorMessage = "not enough space to index";
|
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sz = (CELL)NEXTOP(NEXTOP((yamop*)NULL,lp),lp)+ap->ArityOfPE*(CELL)NEXTOP((yamop *)NULL,x) +(CELL)NEXTOP(NEXTOP((yamop *)NULL,p),l);
|
sz = (CELL)NEXTOP(NEXTOP((yamop*)NULL,lp),lp)+ap->ArityOfPE*(CELL)NEXTOP((yamop *)NULL,x) +(CELL)NEXTOP(NEXTOP((yamop *)NULL,p),l);
|
||||||
if (!(i = (struct index_t *)Yap_AllocCodeSpace(sizeof(struct index_t)+sz))) {
|
if (!(i = (struct index_t *)Yap_AllocCodeSpace(sizeof(struct index_t)+sz))) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
@ -240,8 +232,17 @@ add_index(struct index_t **ip, UInt bmap, UInt bndsf[], PredEntry *ap, UInt coun
|
|||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (count)
|
if (count) {
|
||||||
|
if (!(base = (CELL *)Yap_AllocCodeSpace(3*sizeof(CELL)*ncls))) {
|
||||||
|
CACHE_REGS
|
||||||
|
save_machine_regs();
|
||||||
|
LOCAL_Error_Size = 3*ncls*sizeof(CELL);
|
||||||
|
LOCAL_ErrorMessage = "not enough space to index";
|
||||||
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
bzero(base, 3*sizeof(CELL)*ncls);
|
bzero(base, 3*sizeof(CELL)*ncls);
|
||||||
|
}
|
||||||
i->next = *ip;
|
i->next = *ip;
|
||||||
i->prev = NULL;
|
i->prev = NULL;
|
||||||
i->nels = ncls;
|
i->nels = ncls;
|
||||||
@ -252,10 +253,17 @@ add_index(struct index_t **ip, UInt bmap, UInt bndsf[], PredEntry *ap, UInt coun
|
|||||||
i->hsize = 2*ncls;
|
i->hsize = 2*ncls;
|
||||||
i->key = (CELL **)base;
|
i->key = (CELL **)base;
|
||||||
i->links = (CELL *)(base+2*ncls);
|
i->links = (CELL *)(base+2*ncls);
|
||||||
|
i->hsize = 2*ncls;
|
||||||
|
i->ncols = 0;
|
||||||
i->cls = (CELL *)((ADDR)ap->cs.p_code.FirstClause+2*sizeof(struct index_t *));
|
i->cls = (CELL *)((ADDR)ap->cs.p_code.FirstClause+2*sizeof(struct index_t *));
|
||||||
*ip = i;
|
*ip = i;
|
||||||
if (count) {
|
if (count) {
|
||||||
fill_hash(bmap, bndsf, i);
|
fill_hash(bmap, i);
|
||||||
|
if (!i->ncols) {
|
||||||
|
i->is_key = TRUE;
|
||||||
|
if (base != realloc(base, 2*sizeof(CELL)*ncls))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ptr = (yamop *)(i+1);
|
ptr = (yamop *)(i+1);
|
||||||
i->code = ptr;
|
i->code = ptr;
|
||||||
@ -294,19 +302,19 @@ yamop *
|
|||||||
Yap_ExoLookup(PredEntry *ap)
|
Yap_ExoLookup(PredEntry *ap)
|
||||||
{
|
{
|
||||||
UInt arity = ap->ArityOfPE;
|
UInt arity = ap->ArityOfPE;
|
||||||
UInt bmap = 0L, bit = 1, count = 0, j;
|
UInt bmap = 0L, bit = 1, count = 0, j, j0 = 0;
|
||||||
struct index_t **ip = (struct index_t **)(ap->cs.p_code.FirstClause);
|
struct index_t **ip = (struct index_t **)(ap->cs.p_code.FirstClause);
|
||||||
struct index_t *i = *ip;
|
struct index_t *i = *ip;
|
||||||
UInt bnds[MAX_ARITY];
|
|
||||||
|
|
||||||
for (j=0; j< arity; j++, bit<<=1) {
|
for (j=0; j< arity; j++, bit<<=1) {
|
||||||
Term t = Deref(XREGS[j+1]);
|
Term t = Deref(XREGS[j+1]);
|
||||||
if (!IsVarTerm(t)) {
|
if (!IsVarTerm(t)) {
|
||||||
bmap += bit;
|
bmap += bit;
|
||||||
bnds[j] = TRUE;
|
LOCAL_ibnds[j] = TRUE;
|
||||||
|
if (!count) j0= j;
|
||||||
count++;
|
count++;
|
||||||
} else {
|
} else {
|
||||||
bnds[j] = FALSE;
|
LOCAL_ibnds[j] = FALSE;
|
||||||
}
|
}
|
||||||
XREGS[j+1] = t;
|
XREGS[j+1] = t;
|
||||||
}
|
}
|
||||||
@ -325,10 +333,10 @@ Yap_ExoLookup(PredEntry *ap)
|
|||||||
i = i->next;
|
i = i->next;
|
||||||
}
|
}
|
||||||
if (!i) {
|
if (!i) {
|
||||||
i = add_index(ip, bmap, bnds, ap, count);
|
i = add_index(ip, bmap, ap, count);
|
||||||
}
|
}
|
||||||
if (count)
|
if (count)
|
||||||
return LOOKUP(i, arity, bnds);
|
return LOOKUP(i, arity, j0);
|
||||||
else
|
else
|
||||||
return i->code;
|
return i->code;
|
||||||
}
|
}
|
||||||
@ -391,7 +399,7 @@ p_exodb_get_space( USES_REGS1 )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
required = ncls*sizeof(CELL)+sizeof(MegaClause)+2*sizeof(struct index_t *);
|
required = ncls*arity*sizeof(CELL)+sizeof(MegaClause)+2*sizeof(struct index_t *);
|
||||||
while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) {
|
while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) {
|
||||||
if (!Yap_growheap(FALSE, required, NULL)) {
|
if (!Yap_growheap(FALSE, required, NULL)) {
|
||||||
/* just fail, the system will keep on going */
|
/* just fail, the system will keep on going */
|
||||||
|
2
C/grow.c
2
C/grow.c
@ -1318,7 +1318,7 @@ init_new_table(AtomHashEntry *ntb, UInt nsize)
|
|||||||
{
|
{
|
||||||
UInt i;
|
UInt i;
|
||||||
|
|
||||||
for (i = 0; i < nsize; ++i) {
|
for (i = 0; i < nsize; i++) {
|
||||||
INIT_RWLOCK(ntb[i].AERWLock);
|
INIT_RWLOCK(ntb[i].AERWLock);
|
||||||
ntb[i].Entry = NIL;
|
ntb[i].Entry = NIL;
|
||||||
}
|
}
|
||||||
|
@ -806,6 +806,7 @@ IsPredProperty (int flags)
|
|||||||
/* There are several flags for code and data base entries */
|
/* There are several flags for code and data base entries */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
ExoMask = 0x1000000, /* is exo code */
|
||||||
FuncSwitchMask = 0x800000, /* is a switch of functors */
|
FuncSwitchMask = 0x800000, /* is a switch of functors */
|
||||||
HasDBTMask = 0x400000, /* includes a pointer to a DBTerm */
|
HasDBTMask = 0x400000, /* includes a pointer to a DBTerm */
|
||||||
MegaMask = 0x200000, /* mega clause */
|
MegaMask = 0x200000, /* mega clause */
|
||||||
|
@ -430,3 +430,6 @@
|
|||||||
#define LOCAL_FunctorVar LOCAL->FunctorVar_
|
#define LOCAL_FunctorVar LOCAL->FunctorVar_
|
||||||
#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_
|
#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_
|
||||||
|
|
||||||
|
#define LOCAL_ibnds LOCAL->ibnds_
|
||||||
|
#define REMOTE_ibnds(wid) REMOTE(wid)->ibnds_
|
||||||
|
|
||||||
|
@ -241,4 +241,6 @@ typedef struct worker_local {
|
|||||||
FILE* FPreds_;
|
FILE* FPreds_;
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
Functor FunctorVar_;
|
Functor FunctorVar_;
|
||||||
|
|
||||||
|
UInt ibnds_[256];
|
||||||
} w_local;
|
} w_local;
|
||||||
|
@ -241,4 +241,6 @@ static void InitWorker(int wid) {
|
|||||||
REMOTE_FPreds(wid) = NULL;
|
REMOTE_FPreds(wid) = NULL;
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
REMOTE_FunctorVar(wid) = FunctorVar;
|
REMOTE_FunctorVar(wid) = FunctorVar;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -241,4 +241,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
|
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -271,4 +271,7 @@ FILE* FPreds =NULL
|
|||||||
|
|
||||||
Functor FunctorVar =FunctorVar
|
Functor FunctorVar =FunctorVar
|
||||||
|
|
||||||
|
// exo indexing
|
||||||
|
UInt ibnds[256] void
|
||||||
|
|
||||||
END_WORKER_LOCAL
|
END_WORKER_LOCAL
|
||||||
|
@ -52,7 +52,7 @@ do_dbload(F0, M0, G) :-
|
|||||||
|
|
||||||
check_dbload_stream(R, M0) :-
|
check_dbload_stream(R, M0) :-
|
||||||
repeat,
|
repeat,
|
||||||
read(R,T),
|
catch(read(R,T), _, fail),
|
||||||
( T = end_of_file -> !;
|
( T = end_of_file -> !;
|
||||||
dbload_count(T, M0),
|
dbload_count(T, M0),
|
||||||
fail
|
fail
|
||||||
@ -79,7 +79,7 @@ get_module(T,M,T,M).
|
|||||||
|
|
||||||
|
|
||||||
load_facts :-
|
load_facts :-
|
||||||
yap_flag(exo_compilation, on), !.
|
!, % yap_flag(exo_compilation, on), !.
|
||||||
load_exofacts.
|
load_exofacts.
|
||||||
load_facts :-
|
load_facts :-
|
||||||
retract(dbloading(Na,Arity,M,T,NaAr,_)),
|
retract(dbloading(Na,Arity,M,T,NaAr,_)),
|
||||||
@ -98,7 +98,7 @@ load_facts.
|
|||||||
|
|
||||||
dbload_add_facts(R, M) :-
|
dbload_add_facts(R, M) :-
|
||||||
repeat,
|
repeat,
|
||||||
read(R,T),
|
catch(read(R,T), _, fail),
|
||||||
( T = end_of_file -> !;
|
( T = end_of_file -> !;
|
||||||
dbload_add_fact(T, M),
|
dbload_add_fact(T, M),
|
||||||
fail
|
fail
|
||||||
@ -120,17 +120,17 @@ load_exofacts :-
|
|||||||
assertz(dbloading(Na,Arity,M,T,NaAr,Handle)),
|
assertz(dbloading(Na,Arity,M,T,NaAr,Handle)),
|
||||||
nb_setval(NaAr,0),
|
nb_setval(NaAr,0),
|
||||||
fail.
|
fail.
|
||||||
load_rxofacts :-
|
load_exofacts :-
|
||||||
dbprocess(F, M),
|
dbprocess(F, M),
|
||||||
open(F, read, R),
|
open(F, read, R),
|
||||||
exodb_add_facts(R, M),
|
exodb_add_facts(R, M),
|
||||||
close(R),
|
close(R),
|
||||||
fail.
|
fail.
|
||||||
load_facts.
|
load_exofacts.
|
||||||
|
|
||||||
exodb_add_facts(R, M) :-
|
exodb_add_facts(R, M) :-
|
||||||
repeat,
|
repeat,
|
||||||
read(R,T),
|
catch(read(R,T), _, fail),
|
||||||
( T = end_of_file -> !;
|
( T = end_of_file -> !;
|
||||||
exodb_add_fact(T, M),
|
exodb_add_fact(T, M),
|
||||||
fail
|
fail
|
||||||
|
Reference in New Issue
Block a user