Merge branch 'master' of https://github.com/vscosta/yap-6.3
Conflicts: C/c_interface.c C/exec.c
This commit is contained in:
commit
1e379e7635
@ -1,2 +1,20 @@
|
||||
ENABLE_VARS="jit|no|WITH_JIT clpbn|yes|WITH_CLPBN cplint|yes|WITH_CPLINT horus|yes|WITH_HORUS docs|no|WITH_DOCS problog|yes|WITH_PROBLOG"
|
||||
WITH_VARS="swig|yes|WITH_SWIG gecode|yes|WITH_GECODE R|yes|WITH_REAL cudd|yes|WITH_BDD python|yes|WITH_PYTHON "
|
||||
ENABLE_VARS="clpbn|yes|WITH_CLPBN \
|
||||
cplint|yes|WITH_CPLINT \
|
||||
horus|yes|WITH_HORUS \
|
||||
clpr|yes|WITH_CLPR \
|
||||
problog|yes|WITH_PROBLOG \
|
||||
jit|no|WITH_JIT \
|
||||
chr|no|WITH_CHR \
|
||||
threads|no|WITH_THREADS"
|
||||
WITH_VARS="swig|yes|WITH_SWIG \
|
||||
mpi|yes|WITH_MPI \
|
||||
gecode|yes|WITH_GECODE \
|
||||
docs|yes|WITH_DOCS \
|
||||
r|yes|WITH_REAL \
|
||||
cudd|yes|WITH_CUDD \
|
||||
xml2|yes|WITH_XML2 \
|
||||
raptor|yes|WITH_RAPTOR \
|
||||
python|yes|WITH_PYTHON \
|
||||
openssl|yes|WITH_OPENSSL\
|
||||
readline|yes|WITH_READLINE \
|
||||
gmp|yes|WITH_GMP "
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -203,3 +203,5 @@ packages/python/yap_kernel/x/__init__.py
|
||||
packages/python/yap_kernel/x/__main__.py
|
||||
|
||||
*.gch
|
||||
mxe
|
||||
build
|
||||
|
@ -902,7 +902,8 @@ static void undef_goal(USES_REGS1) {
|
||||
PP = pe;
|
||||
}
|
||||
#endif
|
||||
if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag)) {
|
||||
if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ||
|
||||
pe == UndefCode) {
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
UNLOCKPE(19, PP);
|
||||
PP = NULL;
|
||||
|
@ -8160,12 +8160,7 @@
|
||||
saveregs();
|
||||
d0 = p_plus(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
Yap_PreProcessedError(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
setregs();
|
||||
FAIL();
|
||||
}
|
||||
|
||||
}
|
||||
XREG(PREG->y_u.xxx.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxx);
|
||||
|
180
C/adtdefs.c
180
C/adtdefs.c
@ -51,28 +51,20 @@ uint64_t HashFunction(const unsigned char *CHP) {
|
||||
*/
|
||||
}
|
||||
|
||||
uint64_t WideHashFunction(wchar_t *CHP) {
|
||||
UInt hash = 5381;
|
||||
|
||||
UInt c;
|
||||
|
||||
while ((c = *CHP++) != '\0') {
|
||||
hash = hash * 33 ^ c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
/* this routine must be run at least having a read lock on ae */
|
||||
static Prop
|
||||
GetFunctorProp(AtomEntry *ae,
|
||||
arity_t arity) { /* look property list of atom a for kind */
|
||||
FunctorEntry *pp;
|
||||
|
||||
pp = RepFunctorProp(ae->PropsOfAE);
|
||||
while (!EndOfPAEntr(pp) &&
|
||||
(!IsFunctorProperty(pp->KindOfPE) || pp->ArityOfFE != arity))
|
||||
pp = RepFunctorProp(pp->NextOfPE);
|
||||
return (AbsFunctorProp(pp));
|
||||
PropEntry *p = ae->PropsOfAE;
|
||||
while (p != NIL) {
|
||||
if (p->KindOfPE == FunctorProperty &&
|
||||
RepFunctorProp(p)->ArityOfFE == arity) {
|
||||
return p;
|
||||
}
|
||||
p = p->NextOfPE;
|
||||
}
|
||||
return NIL;
|
||||
}
|
||||
|
||||
/* vsc: We must guarantee that IsVarTerm(functor) returns true! */
|
||||
@ -153,19 +145,6 @@ static inline Atom SearchAtom(const unsigned char *p, Atom a) {
|
||||
return (NIL);
|
||||
}
|
||||
|
||||
static inline Atom SearchWideAtom(const wchar_t *p, Atom a) {
|
||||
AtomEntry *ae;
|
||||
|
||||
/* search atom in chain */
|
||||
while (a != NIL) {
|
||||
ae = RepAtom(a);
|
||||
if (wcscmp((wchar_t *)ae->StrOfAE, p) == 0) {
|
||||
return a;
|
||||
}
|
||||
a = ae->NextOfAE;
|
||||
}
|
||||
return (NIL);
|
||||
}
|
||||
|
||||
static Atom
|
||||
LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
||||
@ -180,7 +159,6 @@ LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
||||
|
||||
hash = HashFunction(p);
|
||||
hash = hash % sz;
|
||||
|
||||
/* we'll start by holding a read lock in order to avoid contention */
|
||||
READ_LOCK(HashChain[hash].AERWLock);
|
||||
a = HashChain[hash].Entry;
|
||||
@ -224,145 +202,10 @@ LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
||||
if (NOfAtoms > 2 * AtomHashTableSize) {
|
||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||
}
|
||||
|
||||
return na;
|
||||
}
|
||||
|
||||
static Atom
|
||||
LookupWideAtom(const wchar_t *atom) { /* lookup atom in atom table */
|
||||
CELL hash;
|
||||
wchar_t *p;
|
||||
Atom a, na;
|
||||
AtomEntry *ae;
|
||||
UInt sz;
|
||||
WideAtomEntry *wae;
|
||||
|
||||
/* compute hash */
|
||||
p = (wchar_t *)atom;
|
||||
hash = WideHashFunction(p) % WideAtomHashTableSize;
|
||||
/* we'll start by holding a read lock in order to avoid contention */
|
||||
READ_LOCK(WideHashChain[hash].AERWLock);
|
||||
a = WideHashChain[hash].Entry;
|
||||
/* search atom in chain */
|
||||
na = SearchWideAtom(atom, a);
|
||||
if (na != NIL) {
|
||||
READ_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
return (na);
|
||||
}
|
||||
READ_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
/* we need a write lock */
|
||||
WRITE_LOCK(WideHashChain[hash].AERWLock);
|
||||
/* concurrent version of Yap, need to take care */
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (a != WideHashChain[hash].Entry) {
|
||||
a = WideHashChain[hash].Entry;
|
||||
na = SearchWideAtom(atom, a);
|
||||
if (na != NIL) {
|
||||
WRITE_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
return na;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* add new atom to start of chain */
|
||||
sz = wcslen(atom);
|
||||
ae = (AtomEntry *)Yap_AllocAtomSpace((size_t)(((AtomEntry *)NULL) + 1) +
|
||||
sizeof(wchar_t) * (sz + 1));
|
||||
if (ae == NULL) {
|
||||
WRITE_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
return NIL;
|
||||
}
|
||||
wae = (WideAtomEntry *)Yap_AllocAtomSpace(sizeof(WideAtomEntry));
|
||||
if (wae == NULL) {
|
||||
WRITE_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
return NIL;
|
||||
}
|
||||
na = AbsAtom(ae);
|
||||
ae->PropsOfAE = AbsWideAtomProp(wae);
|
||||
wae->NextOfPE = NIL;
|
||||
wae->KindOfPE = WideAtomProperty;
|
||||
wae->SizeOfAtom = sz;
|
||||
if (ae->WStrOfAE != atom)
|
||||
wcscpy(ae->WStrOfAE, atom);
|
||||
NOfAtoms++;
|
||||
ae->NextOfAE = a;
|
||||
WideHashChain[hash].Entry = na;
|
||||
INIT_RWLOCK(ae->ARWLock);
|
||||
WRITE_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
|
||||
if (NOfWideAtoms > 2 * WideAtomHashTableSize) {
|
||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||
}
|
||||
return na;
|
||||
}
|
||||
|
||||
Atom Yap_LookupMaybeWideAtom(
|
||||
const wchar_t *atom) { /* lookup atom in atom table */
|
||||
wchar_t *p = (wchar_t *)atom, c;
|
||||
size_t len = 0;
|
||||
unsigned char *ptr, *ptr0;
|
||||
Atom at;
|
||||
|
||||
while ((c = *p++)) {
|
||||
if (c > 255)
|
||||
return LookupWideAtom(atom);
|
||||
len++;
|
||||
}
|
||||
/* not really a wide atom */
|
||||
p = (wchar_t *)atom;
|
||||
ptr0 = ptr = Yap_AllocCodeSpace(len + 1);
|
||||
if (!ptr)
|
||||
return NIL;
|
||||
while ((*ptr++ = *p++))
|
||||
;
|
||||
at = LookupAtom(ptr0);
|
||||
Yap_FreeCodeSpace(ptr0);
|
||||
return at;
|
||||
}
|
||||
|
||||
Atom Yap_LookupMaybeWideAtomWithLength(
|
||||
const wchar_t *atom, size_t len0) { /* lookup atom in atom table */
|
||||
Atom at;
|
||||
int wide = FALSE;
|
||||
size_t i = 0;
|
||||
|
||||
while (i < len0) {
|
||||
// primary support for atoms with null chars
|
||||
wchar_t c = atom[i];
|
||||
if (c >= 255) {
|
||||
wide = true;
|
||||
break;
|
||||
}
|
||||
if (c == '\0') {
|
||||
wide = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (wide) {
|
||||
wchar_t *ptr0;
|
||||
|
||||
ptr0 = (wchar_t *)Yap_AllocCodeSpace(sizeof(wchar_t) * (len0 + 2));
|
||||
if (!ptr0)
|
||||
return NIL;
|
||||
memcpy(ptr0, atom, (len0 + 1) * sizeof(wchar_t));
|
||||
ptr0[len0] = '\0';
|
||||
at = LookupWideAtom(ptr0);
|
||||
Yap_FreeCodeSpace((char *)ptr0);
|
||||
return at;
|
||||
} else {
|
||||
unsigned char *ptr0;
|
||||
|
||||
ptr0 = Yap_AllocCodeSpace((len0 + 2));
|
||||
if (!ptr0)
|
||||
return NIL;
|
||||
for (i = 0; i < len0; i++)
|
||||
ptr0[i] = atom[i];
|
||||
ptr0[len0] = '\0';
|
||||
at = LookupAtom(ptr0);
|
||||
Yap_FreeCodeSpace(ptr0);
|
||||
return at;
|
||||
}
|
||||
}
|
||||
|
||||
Atom Yap_LookupAtomWithLength(const char *atom,
|
||||
size_t len0) { /* lookup atom in atom table */
|
||||
Atom at;
|
||||
@ -388,9 +231,6 @@ Atom Yap_ULookupAtom(
|
||||
return LookupAtom(atom);
|
||||
}
|
||||
|
||||
Atom Yap_LookupWideAtom(const wchar_t *atom) { /* lookup atom in atom table */
|
||||
return LookupWideAtom(atom);
|
||||
}
|
||||
|
||||
Atom Yap_FullLookupAtom(const char *atom) { /* lookup atom in atom table */
|
||||
Atom t;
|
||||
|
10
C/agc.c
10
C/agc.c
@ -427,11 +427,6 @@ clean_atom_list(AtomHashEntry *HashPtr)
|
||||
Yap_FreeCodeSpace((char *)b);
|
||||
GLOBAL_agc_collected += sizeof(YAP_BlobPropEntry);
|
||||
GLOBAL_agc_collected += sizeof(AtomEntry)+sizeof(size_t)+at->rep.blob->length;
|
||||
} else if (IsWideAtom(atm)) {
|
||||
#ifdef DEBUG_RESTORE3
|
||||
fprintf(stderr, "Purged %p:%S\n", at, at->WStrOfAE);
|
||||
#endif
|
||||
GLOBAL_agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE);
|
||||
} else {
|
||||
#ifdef DEBUG_RESTORE3
|
||||
fprintf(stderr, "Purged %p:%s patm=%p %p\n", at, at->StrOfAE, patm, at->NextOfAE);
|
||||
@ -459,11 +454,6 @@ clean_atoms(void)
|
||||
clean_atom_list(HashPtr);
|
||||
HashPtr++;
|
||||
}
|
||||
HashPtr = WideHashChain;
|
||||
for (i = 0; i < WideAtomHashTableSize; ++i) {
|
||||
clean_atom_list(HashPtr);
|
||||
HashPtr++;
|
||||
}
|
||||
clean_atom_list(&INVISIBLECHAIN);
|
||||
{
|
||||
AtomHashEntry list;
|
||||
|
@ -90,7 +90,7 @@ void *my_realloc(void *ptr, size_t sz) {
|
||||
|
||||
p = realloc(ptr, sz);
|
||||
if (Yap_do_low_level_trace)
|
||||
fprintf(stderr, "+ %p -> %p : %lu\n", ptr, p, sz);
|
||||
// fprintf(stderr, "+ %p -> %p : %lu\n", ptr, p, sz);
|
||||
// Yap_DebugPuts(stderr,"gof\n");
|
||||
if (sz > 500 && write_malloc++ > 0)
|
||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p", write_malloc,
|
||||
@ -671,7 +671,7 @@ static char *AllocHeap(size_t size) {
|
||||
LOCK(FreeBlocksLock);
|
||||
if ((b = GetBlock(size))) {
|
||||
if (b->b_size >= size + 24 + 1) {
|
||||
n = (BlockHeader *)(((YAP_SEG_SIZE *)b) + size + 1);
|
||||
n = (BlockHeader *)(((YAP_SEG_SIZE *)b) + size + 1)v;
|
||||
n->b_size = b->b_size - size - 1;
|
||||
b->b_size = size;
|
||||
AddToFreeList(n);
|
||||
|
55
C/arith1.c
55
C/arith1.c
@ -326,7 +326,7 @@ msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */
|
||||
Int out = 0;
|
||||
|
||||
if (inp < 0) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp),
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp),
|
||||
"msb/1 received %d", inp);
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
||||
Int out = 0;
|
||||
|
||||
if (inp < 0) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp),
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp),
|
||||
"msb/1 received %d", inp);
|
||||
}
|
||||
if (inp==0)
|
||||
@ -387,7 +387,7 @@ popcount(Int inp USES_REGS) /* calculate the least significant bit for an intege
|
||||
Int c = 0, j = 0, m = ((CELL)1);
|
||||
|
||||
if (inp < 0) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp),
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp),
|
||||
"popcount/1 received %d", inp);
|
||||
}
|
||||
if (inp==0)
|
||||
@ -434,7 +434,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
case long_int_e:
|
||||
RINT(~IntegerOfTerm(t));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "\\(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "\\(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_unot_big(t);
|
||||
@ -450,7 +450,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
if (dbl >= 0) {
|
||||
RFLOAT(log(dbl));
|
||||
} else {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t, "log(%f)", dbl);
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "log(%f)", dbl);
|
||||
}
|
||||
}
|
||||
case op_log10:
|
||||
@ -459,7 +459,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
if (dbl >= 0) {
|
||||
RFLOAT(log10(dbl));
|
||||
} else {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t, "log10(%f)", dbl);
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "log10(%f)", dbl);
|
||||
}
|
||||
}
|
||||
case op_sqrt:
|
||||
@ -468,7 +468,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = sqrt(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "sqrt(%f)", dbl);
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "sqrt(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -517,7 +517,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = asin(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "asin(%f)", dbl);
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "asin(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -530,7 +530,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = acos(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "acos(%f)", dbl);
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "acos(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -543,7 +543,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = atan(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atan(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atan(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -556,7 +556,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = asinh(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "asinh(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "asinh(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -569,7 +569,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = acosh(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "acosh(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "acosh(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -582,7 +582,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
out = atanh(dbl);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(out)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atanh(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atanh(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
RFLOAT(out);
|
||||
@ -645,12 +645,12 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISINF
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
(%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
@ -674,12 +674,12 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISINF
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
(%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
@ -704,12 +704,12 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISINF
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
(%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
@ -734,12 +734,12 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISINF
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer (%f)",dbl);
|
||||
Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer (%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
if (dbl < 0.0)
|
||||
@ -804,7 +804,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
case long_int_e:
|
||||
RINT(msb(IntegerOfTerm(t) PASS_REGS));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "msb(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "msb(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_msb(t);
|
||||
@ -817,7 +817,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
case long_int_e:
|
||||
RINT(lsb(IntegerOfTerm(t) PASS_REGS));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "lsb(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "lsb(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_lsb(t);
|
||||
@ -830,7 +830,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
case long_int_e:
|
||||
RINT(popcount(IntegerOfTerm(t) PASS_REGS));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_popcount(t);
|
||||
@ -842,7 +842,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
switch (ETypeOfTerm(t)) {
|
||||
case long_int_e:
|
||||
if (isoLanguageFlag()) { /* iso */
|
||||
return Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_fractional_part(%f)", IntegerOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_fractional_part(%f)", IntegerOfTerm(t));
|
||||
} else {
|
||||
RFLOAT(0.0);
|
||||
}
|
||||
@ -863,7 +863,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
case op_fintp:
|
||||
switch (ETypeOfTerm(t)) {
|
||||
case long_int_e:
|
||||
return Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_integer_part(%f)", IntegerOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_integer_part(%f)", IntegerOfTerm(t));
|
||||
case double_e:
|
||||
RFLOAT(rint(FloatOfTerm(t)));
|
||||
break;
|
||||
@ -901,7 +901,7 @@ eval1(Int fi, Term t USES_REGS) {
|
||||
case long_int_e:
|
||||
RINT(Yap_random()*IntegerOfTerm(t));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "random(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "random(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_mul_float_big(Yap_random(), t);
|
||||
@ -1075,4 +1075,3 @@ Yap_ReInitUnaryExps(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
54
C/arith2.c
54
C/arith2.c
@ -150,7 +150,7 @@ p_mod(Term t1, Term t2 USES_REGS) {
|
||||
Int mod;
|
||||
|
||||
if (i2 == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " mod 0", i1);
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " mod 0", i1);
|
||||
if (i1 == Int_MIN && i2 == -1) {
|
||||
return MkIntTerm(0);
|
||||
}
|
||||
@ -160,7 +160,7 @@ p_mod(Term t1, Term t2 USES_REGS) {
|
||||
RINT(mod);
|
||||
}
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "mod/2");
|
||||
case (CELL)big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_mod_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -170,7 +170,7 @@ p_mod(Term t1, Term t2 USES_REGS) {
|
||||
break;
|
||||
}
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "mod/2");
|
||||
case (CELL)big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -180,14 +180,14 @@ p_mod(Term t1, Term t2 USES_REGS) {
|
||||
Int i2 = IntegerOfTerm(t2);
|
||||
|
||||
if (i2 == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... mod 0");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... mod 0");
|
||||
return Yap_gmp_mod_big_int(t1, i2);
|
||||
}
|
||||
case (CELL)big_int_e:
|
||||
/* two bignums */
|
||||
return Yap_gmp_mod_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "mod/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -210,12 +210,12 @@ p_div2(Term t1, Term t2 USES_REGS) {
|
||||
Int res, mod;
|
||||
|
||||
if (i2 == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " div 0", i1);
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " div 0", i1);
|
||||
if (i1 == Int_MIN && i2 == -1) {
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_add_ints(Int_MAX, 1);
|
||||
#else
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, t1,
|
||||
Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, t1,
|
||||
"// /2 with %d and %d", i1, i2);
|
||||
#endif
|
||||
}
|
||||
@ -226,7 +226,7 @@ p_div2(Term t1, Term t2 USES_REGS) {
|
||||
RINT(res);
|
||||
}
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "div/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "div/2");
|
||||
case (CELL)big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_div_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -236,7 +236,7 @@ p_div2(Term t1, Term t2 USES_REGS) {
|
||||
break;
|
||||
}
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "div/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "div/2");
|
||||
case (CELL)big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -246,14 +246,14 @@ p_div2(Term t1, Term t2 USES_REGS) {
|
||||
Int i2 = IntegerOfTerm(t2);
|
||||
|
||||
if (i2 == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... div 0");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... div 0");
|
||||
return Yap_gmp_div2_big_int(t1, i2);
|
||||
}
|
||||
case (CELL)big_int_e:
|
||||
/* two bignums */
|
||||
return Yap_gmp_div2_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "div/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "div/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -275,14 +275,14 @@ p_rem(Term t1, Term t2 USES_REGS) {
|
||||
Int i2 = IntegerOfTerm(t2);
|
||||
|
||||
if (i2 == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " rem 0", i1);
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " rem 0", i1);
|
||||
if (i1 == Int_MIN && i2 == -1) {
|
||||
return MkIntTerm(0);
|
||||
}
|
||||
RINT(i1%i2);
|
||||
}
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rem/2");
|
||||
case (CELL)big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_rem_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -292,19 +292,19 @@ p_rem(Term t1, Term t2 USES_REGS) {
|
||||
}
|
||||
break;
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "rem/2");
|
||||
case (CELL)big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
if (IntegerOfTerm(t2) == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... rem 0");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... rem 0");
|
||||
return Yap_gmp_rem_big_int(t1, IntegerOfTerm(t2));
|
||||
case (CELL)big_int_e:
|
||||
/* two bignums */
|
||||
return Yap_gmp_rem_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rem/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -320,7 +320,7 @@ p_rdiv(Term t1, Term t2 USES_REGS) {
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case (CELL)double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rdiv/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rdiv/2");
|
||||
case (CELL)long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case (CELL)long_int_e:
|
||||
@ -330,7 +330,7 @@ p_rdiv(Term t1, Term t2 USES_REGS) {
|
||||
Int i2 = IntegerOfTerm(t2);
|
||||
|
||||
if (i2 == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " rdiv 0", i1);
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is " Int_FORMAT " rdiv 0", i1);
|
||||
return Yap_gmq_rdiv_int_int(i1, i2);
|
||||
}
|
||||
case (CELL)big_int_e:
|
||||
@ -344,13 +344,13 @@ p_rdiv(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
if (IntegerOfTerm(t2) == 0)
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... rdiv 0");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "X is ... rdiv 0");
|
||||
/* I know the term is much larger, so: */
|
||||
return Yap_gmq_rdiv_big_int(t1, IntegerOfTerm(t2));
|
||||
case (CELL)big_int_e:
|
||||
return Yap_gmq_rdiv_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rdiv/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rdiv/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -449,7 +449,7 @@ p_xor(Term t1, Term t2 USES_REGS)
|
||||
/* two integers */
|
||||
RINT(IntegerOfTerm(t1) ^ IntegerOfTerm(t2));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "#/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "#/2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_xor_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -459,7 +459,7 @@ p_xor(Term t1, Term t2 USES_REGS)
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "#/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "#/2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -468,7 +468,7 @@ p_xor(Term t1, Term t2 USES_REGS)
|
||||
case big_int_e:
|
||||
return Yap_gmp_xor_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "#/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "#/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -690,7 +690,7 @@ p_exp(Term t1, Term t2 USES_REGS)
|
||||
Int pow;
|
||||
|
||||
if (i2 < 0) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2,
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2,
|
||||
"%d ^ %d", i1, i2);
|
||||
}
|
||||
pow = ipow(i1,i2);
|
||||
@ -836,7 +836,7 @@ p_gcd(Term t1, Term t2 USES_REGS)
|
||||
RINT(gcd(i1,i2 PASS_REGS));
|
||||
}
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_gcd_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -846,7 +846,7 @@ p_gcd(Term t1, Term t2 USES_REGS)
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "gcd/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "gcd/2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -855,7 +855,7 @@ p_gcd(Term t1, Term t2 USES_REGS)
|
||||
case big_int_e:
|
||||
return Yap_gmp_gcd_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
|
1212
C/atomic.c
1212
C/atomic.c
File diff suppressed because it is too large
Load Diff
@ -28,10 +28,11 @@ static char SccsId[] = "%W% %G%";
|
||||
#define NULL (void *)0
|
||||
#endif
|
||||
|
||||
/** @{ */
|
||||
/** @file attvars.c
|
||||
@{ */
|
||||
|
||||
/** @defgroup AttributeVariables_Builtins Implementation of Attribute
|
||||
Declarations
|
||||
/**
|
||||
* @defgroup AttributeVariables_Builtins Implementation of Attribute Declarations
|
||||
@ingroup AttributeVariables
|
||||
*/
|
||||
|
||||
|
@ -212,16 +212,9 @@ bool YAP_get_blob(Term t, void **blob, size_t *len, blob_type_t **type) {
|
||||
void *YAP_blob_data(Atom x, size_t *len, blob_type_t **type) {
|
||||
|
||||
if (!IsBlob(x)) {
|
||||
if (IsWideAtom(x)) {
|
||||
if (len)
|
||||
*len = wcslen(x->WStrOfAE);
|
||||
if (type)
|
||||
|
||||
*type = &unregistered_blob_atom;
|
||||
return x->WStrOfAE;
|
||||
}
|
||||
if (len)
|
||||
*len = strlen((char *)x->StrOfAE);
|
||||
*len = strlen_utf8(x->UStrOfAE);
|
||||
if (type)
|
||||
*type = &unregistered_blob_atom;
|
||||
return x->StrOfAE;
|
||||
|
@ -398,7 +398,16 @@ X_API Term YAP_MkAtomTerm(Atom n) {
|
||||
|
||||
X_API Atom YAP_AtomOfTerm(Term t) { return (AtomOfTerm(t)); }
|
||||
|
||||
X_API bool YAP_IsWideAtom(Atom a) { return IsWideAtom(a); }
|
||||
X_API bool YAP_IsWideAtom(Atom a) {
|
||||
const unsigned char *s = RepAtom(a)->UStrOfAE;
|
||||
int32_t v;
|
||||
while (*s) {
|
||||
size_t n = get_utf8(s, 1, &v);
|
||||
if (n > 1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
X_API const char *YAP_AtomName(Atom a) {
|
||||
const char *o;
|
||||
@ -407,7 +416,20 @@ X_API const char *YAP_AtomName(Atom a) {
|
||||
return (o);
|
||||
}
|
||||
|
||||
X_API const wchar_t *YAP_WideAtomName(Atom a) { return RepAtom(a)->WStrOfAE; }
|
||||
X_API const wchar_t *YAP_WideAtomName(Atom a) {
|
||||
int32_t v;
|
||||
const unsigned char *s = RepAtom(a)->UStrOfAE;
|
||||
size_t n = strlen_utf8(s);
|
||||
wchar_t *dest = Malloc((n + 1) * sizeof(wchar_t)), *o = dest;
|
||||
while (*s) {
|
||||
size_t n = get_utf8(s, 1, &v);
|
||||
if (n == 0)
|
||||
return NULL;
|
||||
*o++ = v;
|
||||
}
|
||||
o[0] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
X_API Atom YAP_LookupAtom(const char *c) {
|
||||
CACHE_REGS
|
||||
@ -432,7 +454,7 @@ X_API Atom YAP_LookupWideAtom(const wchar_t *c) {
|
||||
Atom a;
|
||||
|
||||
while (TRUE) {
|
||||
a = Yap_LookupWideAtom((wchar_t *)c);
|
||||
a = Yap_NWCharsToAtom(c, -1 USES_REGS);
|
||||
if (a == NIL || Yap_get_signal(YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "YAP failed to grow heap: %s",
|
||||
@ -467,15 +489,9 @@ X_API size_t YAP_AtomNameLength(Atom at) {
|
||||
if (IsBlob(at)) {
|
||||
return RepAtom(at)->rep.blob->length;
|
||||
}
|
||||
if (IsWideAtom(at)) {
|
||||
wchar_t *c = RepAtom(at)->WStrOfAE;
|
||||
|
||||
return wcslen(c);
|
||||
} else {
|
||||
unsigned char *c = RepAtom(at)->UStrOfAE;
|
||||
|
||||
return strlen((char *)c);
|
||||
}
|
||||
return strlen_utf8(c);
|
||||
}
|
||||
|
||||
X_API Term YAP_MkVarTerm(void) {
|
||||
@ -1169,10 +1185,10 @@ Int YAP_ExecuteOnCut(PredEntry *pe, CPredicate exec_code,
|
||||
Yap_CloseSlots(CurSlot);
|
||||
PP = NULL;
|
||||
// B = LCL0-(CELL*)oB;
|
||||
if (false && Yap_RaiseException()) {
|
||||
if (!val && Yap_RaiseException()) {
|
||||
return false;
|
||||
} else { /* TRUE */
|
||||
return true;
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1355,12 +1371,17 @@ X_API Term YAP_NWideBufferToString(const wchar_t *s, size_t len) {
|
||||
/* copy a string to a buffer */
|
||||
X_API Term YAP_ReadBuffer(const char *s, Term *tp) {
|
||||
CACHE_REGS
|
||||
Term t;
|
||||
Term tv, t;
|
||||
BACKUP_H();
|
||||
|
||||
if (*tp)
|
||||
tv = *tp;
|
||||
else
|
||||
tv = 0;
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
while (!(t = Yap_StringToTerm(s, strlen(s) + 1, &LOCAL_encoding,
|
||||
GLOBAL_MaxPriority, tp))) {
|
||||
const unsigned char *us = (const unsigned char *)s;
|
||||
while (!(t = Yap_BufferToTermWithPrioBindings(
|
||||
us, strlen(s) + 1, TermNil, GLOBAL_MaxPriority, tv))) {
|
||||
if (LOCAL_ErrorMessage) {
|
||||
if (!strcmp(LOCAL_ErrorMessage, "Stack Overflow")) {
|
||||
if (!Yap_dogc(0, NULL PASS_REGS)) {
|
||||
@ -2088,7 +2109,7 @@ X_API void YAP_Write(Term t, FILE *f, int flags) {
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
X_API Term YAP_CopyTerm(Term t) {
|
||||
X_API YAP_Term YAP_CopyTerm(Term t) {
|
||||
Term tn;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
@ -2096,7 +2117,7 @@ X_API Term YAP_CopyTerm(Term t) {
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
|
||||
return tn;
|
||||
return (tn);
|
||||
}
|
||||
|
||||
X_API char *YAP_WriteBuffer(Term t, char *buf, size_t sze, int flags) {
|
||||
@ -3191,10 +3212,10 @@ size_t YAP_UTF8_TextLength(Term t) {
|
||||
Term hd = HeadOfTerm(t);
|
||||
if (IsAtomTerm(hd)) {
|
||||
Atom at = AtomOfTerm(hd);
|
||||
if (IsWideAtom(at))
|
||||
c = RepAtom(at)->WStrOfAE[0];
|
||||
else
|
||||
c = RepAtom(at)->StrOfAE[0];
|
||||
unsigned char *s = RepAtom(at)->UStrOfAE;
|
||||
int32_t ch;
|
||||
get_utf8(s, 1, &ch);
|
||||
c = ch;
|
||||
} else if (IsIntegerTerm(hd)) {
|
||||
c = IntegerOfTerm(hd);
|
||||
} else {
|
||||
@ -3205,20 +3226,7 @@ size_t YAP_UTF8_TextLength(Term t) {
|
||||
}
|
||||
} else if (IsAtomTerm(t)) {
|
||||
Atom at = AtomOfTerm(t);
|
||||
if (IsWideAtom(at)) {
|
||||
const wchar_t *s = RepAtom(at)->WStrOfAE;
|
||||
int c;
|
||||
while ((c = *s++)) {
|
||||
sz += utf8proc_encode_char(c, dst);
|
||||
}
|
||||
} else {
|
||||
const unsigned char *s = (const unsigned char *)RepAtom(at)->StrOfAE;
|
||||
int c;
|
||||
|
||||
while ((c = *s++)) {
|
||||
sz += utf8proc_encode_char(c, dst);
|
||||
}
|
||||
}
|
||||
sz = strlen(RepAtom(at)->StrOfAE);
|
||||
} else if (IsStringTerm(t)) {
|
||||
sz = strlen(StringOfTerm(t));
|
||||
}
|
||||
|
15
C/cdmgr.c
15
C/cdmgr.c
@ -1447,14 +1447,10 @@ static int not_was_reconsulted(PredEntry *p, Term t, int mode) {
|
||||
|
||||
static void addcl_permission_error(AtomEntry *ap, Int Arity, int in_use) {
|
||||
CACHE_REGS
|
||||
Term t, ti[2];
|
||||
|
||||
ti[0] = MkAtomTerm(AbsAtom(ap));
|
||||
ti[1] = MkIntegerTerm(Arity);
|
||||
t = Yap_MkApplTerm(FunctorSlash, 2, ti);
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
LOCAL_Error_Term = t;
|
||||
LOCAL_Error_TYPE = PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE;
|
||||
LOCAL_ErrorMessage = Malloc( 256 );
|
||||
|
||||
if (in_use) {
|
||||
if (Arity == 0)
|
||||
sprintf(LOCAL_ErrorMessage, "static predicate %s is in use", ap->StrOfAE);
|
||||
@ -2028,9 +2024,7 @@ static Int p_compile(USES_REGS1) { /* '$compile'(+C,+Flags,+C0,-Ref) */
|
||||
YAPLeaveCriticalSection();
|
||||
}
|
||||
if (LOCAL_ErrorMessage) {
|
||||
if (!LOCAL_Error_Term)
|
||||
LOCAL_Error_Term = TermNil;
|
||||
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_Error(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
||||
YAPLeaveCriticalSection();
|
||||
return false;
|
||||
}
|
||||
@ -3590,7 +3584,8 @@ static Int p_predicate_erased_statistics(USES_REGS1) {
|
||||
Term tpred = ArgOfTerm(2, Deref(ARG1));
|
||||
Term tmod = ArgOfTerm(1, Deref(ARG1));
|
||||
|
||||
if (EndOfPAEntr(pe = Yap_get_pred(tpred, tmod, "predicate_erased_statistics")))
|
||||
if (EndOfPAEntr(pe =
|
||||
Yap_get_pred(tpred, tmod, "predicate_erased_statistics")))
|
||||
return FALSE;
|
||||
while (cl) {
|
||||
if (cl->ClPred == pe) {
|
||||
|
263
C/cmppreds.c
263
C/cmppreds.c
@ -18,8 +18,6 @@
|
||||
|
||||
/// @file cmppreds.c
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@defgroup Comparing_Terms Comparing Terms
|
||||
@ingroup builtins
|
||||
@ -52,20 +50,21 @@ left-to-right order.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
|
||||
#include "Yap.h"
|
||||
#include "Yatom.h"
|
||||
#include "YapHeap.h"
|
||||
#include "Yatom.h"
|
||||
#include "eval.h"
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <wchar.h>
|
||||
|
||||
#include "YapError.h"
|
||||
|
||||
static Int compare(Term, Term);
|
||||
static Int p_compare(USES_REGS1);
|
||||
static Int p_acomp(USES_REGS1);
|
||||
@ -83,43 +82,12 @@ static Int a_gen_ge(Term,Term);
|
||||
|
||||
#define rfloat(X) (X > 0.0 ? 1 : (X == 0.0 ? 0 : -1))
|
||||
|
||||
static int
|
||||
cmp_atoms(Atom a1, Atom a2)
|
||||
{
|
||||
if (IsWideAtom(a1)) {
|
||||
if (IsWideAtom(a2)) {
|
||||
return wcscmp((wchar_t *)RepAtom(a1)->StrOfAE,(wchar_t *)RepAtom(a2)->StrOfAE);
|
||||
} else {
|
||||
/* The standard does not seem to have nothing on this */
|
||||
unsigned char *s1 = (unsigned char *)RepAtom(a1)->StrOfAE;
|
||||
wchar_t *s2 = (wchar_t *)RepAtom(a2)->StrOfAE;
|
||||
|
||||
while (*s1 == *s2) {
|
||||
if (!*s1) return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return *s1-*s2;
|
||||
}
|
||||
} else if (IsWideAtom(a2)) {
|
||||
/* The standard does not seem to have nothing on this */
|
||||
wchar_t *s1 = (wchar_t *)RepAtom(a1)->StrOfAE;
|
||||
unsigned char *s2 = (unsigned char *)RepAtom(a2)->StrOfAE;
|
||||
|
||||
while (*s1 == *s2) {
|
||||
if (!*s1) return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return *s1-*s2;
|
||||
} else {
|
||||
return strcmp((char *)RepAtom(a1)->StrOfAE,(char *)RepAtom(a2)->StrOfAE);
|
||||
}
|
||||
static int cmp_atoms(Atom a1, Atom a2) {
|
||||
return strcmp(RepAtom(a1)->StrOfAE, RepAtom(a2)->StrOfAE);
|
||||
}
|
||||
|
||||
static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
CELL *pt1)
|
||||
{
|
||||
static Int compare_complex(register CELL *pt0, register CELL *pt0_end,
|
||||
register CELL *pt1) {
|
||||
CACHE_REGS
|
||||
register CELL **to_visit = (CELL **)HR;
|
||||
register Int out = 0;
|
||||
@ -134,9 +102,9 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
if (IsVarTerm(d0)) {
|
||||
if (IsVarTerm(d1)) {
|
||||
out = Signed(d0) - Signed(d1);
|
||||
if (out) goto done;
|
||||
}
|
||||
else {
|
||||
if (out)
|
||||
goto done;
|
||||
} else {
|
||||
out = -1;
|
||||
goto done;
|
||||
}
|
||||
@ -144,17 +112,18 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
out = 1;
|
||||
goto done;
|
||||
} else {
|
||||
if (d0 == d1) continue;
|
||||
if (d0 == d1)
|
||||
continue;
|
||||
else if (IsAtomTerm(d0)) {
|
||||
if (IsAtomTerm(d1))
|
||||
out = cmp_atoms(AtomOfTerm(d0), AtomOfTerm(d1));
|
||||
else if (IsPrimitiveTerm(d1))
|
||||
out = 1;
|
||||
else out = -1;
|
||||
else
|
||||
out = -1;
|
||||
/* I know out must be != 0 */
|
||||
goto done;
|
||||
}
|
||||
else if (IsIntTerm(d0)) {
|
||||
} else if (IsIntTerm(d0)) {
|
||||
if (IsIntTerm(d1))
|
||||
out = IntOfTerm(d0) - IntOfTerm(d1);
|
||||
else if (IsFloatTerm(d1)) {
|
||||
@ -167,7 +136,8 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
#endif
|
||||
} else if (IsRefTerm(d1))
|
||||
out = 1;
|
||||
else out = -1;
|
||||
else
|
||||
out = -1;
|
||||
if (out != 0)
|
||||
goto done;
|
||||
} else if (IsFloatTerm(d0)) {
|
||||
@ -231,7 +201,8 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
out = Yap_gmp_tcmp_big_big(d0, d1);
|
||||
} else if (IsRefTerm(d1))
|
||||
out = 1;
|
||||
else out = -1;
|
||||
else
|
||||
out = -1;
|
||||
if (out != 0)
|
||||
goto done;
|
||||
}
|
||||
@ -244,7 +215,8 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
out = 1;
|
||||
else if (!(out = 2 - ArityOfFunctor(f)))
|
||||
out = strcmp(".", (char *)RepAtom(NameOfFunctor(f))->StrOfAE);
|
||||
} else out = 1;
|
||||
} else
|
||||
out = 1;
|
||||
goto done;
|
||||
}
|
||||
#ifdef RATIONAL_TREES
|
||||
@ -267,12 +239,11 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
pt0_end = RepPair(d0) + 1;
|
||||
pt1 = RepPair(d1) - 1;
|
||||
continue;
|
||||
}
|
||||
else if (IsRefTerm(d0)) {
|
||||
} else if (IsRefTerm(d0)) {
|
||||
if (IsRefTerm(d1))
|
||||
out = Unsigned(RefOfTerm(d1)) -
|
||||
Unsigned(RefOfTerm(d0));
|
||||
else out = -1;
|
||||
out = Unsigned(RefOfTerm(d1)) - Unsigned(RefOfTerm(d0));
|
||||
else
|
||||
out = -1;
|
||||
goto done;
|
||||
} else if (IsApplTerm(d0)) {
|
||||
register Functor f;
|
||||
@ -324,7 +295,6 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/* Do we still have compound terms to visit */
|
||||
@ -358,8 +328,7 @@ static Int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||
return (out);
|
||||
}
|
||||
|
||||
inline static Int
|
||||
compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
inline static Int compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
{
|
||||
|
||||
if (t1 == t2)
|
||||
@ -410,18 +379,18 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
if (IsExtensionFunctor(f))
|
||||
return 1;
|
||||
else {
|
||||
int out;
|
||||
if (!(out = 2-ArityOfFunctor(f)))
|
||||
out = strcmp(".",(char *)RepAtom(NameOfFunctor(f))->StrOfAE);
|
||||
return(out);
|
||||
if (f != FunctorDot)
|
||||
return strcmp(".", RepAtom(NameOfFunctor(f))->StrOfAE);
|
||||
else {
|
||||
return compare_complex(RepPair(t1) - 1, RepPair(t1) + 1, RepAppl(t2));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IsPairTerm(t2)) {
|
||||
return(compare_complex(RepPair(t1)-1,
|
||||
RepPair(t1)+1,
|
||||
RepPair(t2)-1));
|
||||
}
|
||||
else return 1;
|
||||
return (
|
||||
compare_complex(RepPair(t1) - 1, RepPair(t1) + 1, RepPair(t2) - 1));
|
||||
} else
|
||||
return 1;
|
||||
} else {
|
||||
/* compound term */
|
||||
Functor fun1 = FunctorOfTerm(t1);
|
||||
@ -429,16 +398,14 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
if (IsExtensionFunctor(fun1)) {
|
||||
/* float, long, big, dbref */
|
||||
switch ((CELL)fun1) {
|
||||
case double_e:
|
||||
{
|
||||
case double_e: {
|
||||
if (IsFloatTerm(t2))
|
||||
return (rfloat(FloatOfTerm(t1) - FloatOfTerm(t2)));
|
||||
if (IsRefTerm(t2))
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
case long_int_e:
|
||||
{
|
||||
case long_int_e: {
|
||||
if (IsIntTerm(t2))
|
||||
return LongIntOfTerm(t1) - IntOfTerm(t2);
|
||||
if (IsFloatTerm(t2)) {
|
||||
@ -456,8 +423,7 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
return -1;
|
||||
}
|
||||
#ifdef USE_GMP
|
||||
case big_int_e:
|
||||
{
|
||||
case big_int_e: {
|
||||
if (IsIntTerm(t2))
|
||||
return Yap_gmp_tcmp_big_int(t1, IntOfTerm(t2));
|
||||
if (IsFloatTerm(t2)) {
|
||||
@ -473,8 +439,7 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
case string_e:
|
||||
{
|
||||
case string_e: {
|
||||
if (IsApplTerm(t2)) {
|
||||
Functor fun2 = FunctorOfTerm(t2);
|
||||
switch ((CELL)fun2) {
|
||||
@ -497,8 +462,7 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
}
|
||||
case db_ref_e:
|
||||
if (IsRefTerm(t2))
|
||||
return Unsigned(RefOfTerm(t2)) -
|
||||
Unsigned(RefOfTerm(t1));
|
||||
return Unsigned(RefOfTerm(t2)) - Unsigned(RefOfTerm(t1));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -526,15 +490,13 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
if (r)
|
||||
return r;
|
||||
else
|
||||
return(compare_complex(RepAppl(t1),
|
||||
RepAppl(t1)+ArityOfFunctor(fun1),
|
||||
return (compare_complex(RepAppl(t1), RepAppl(t1) + ArityOfFunctor(fun1),
|
||||
RepAppl(t2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Int Yap_compare_terms(Term d0, Term d1)
|
||||
{
|
||||
Int Yap_compare_terms(Term d0, Term d1) {
|
||||
return compare(Deref(d0), Deref(d1));
|
||||
}
|
||||
|
||||
@ -552,9 +514,7 @@ the following values:
|
||||
`>` if _Y_ precedes _X_ in the defined order;
|
||||
|
||||
*/
|
||||
Int
|
||||
p_compare( USES_REGS1 )
|
||||
{ /* compare(?Op,?T1,?T2) */
|
||||
Int p_compare(USES_REGS1) { /* compare(?Op,?T1,?T2) */
|
||||
Int r = compare(Deref(ARG2), Deref(ARG3));
|
||||
Atom p;
|
||||
Term t = Deref(ARG1);
|
||||
@ -569,9 +529,7 @@ p_compare( USES_REGS1 )
|
||||
Atom a = AtomOfTerm(t);
|
||||
if (a == p)
|
||||
return true;
|
||||
if (a != AtomLT &&
|
||||
a != AtomGT &&
|
||||
a != AtomEq)
|
||||
if (a != AtomLT && a != AtomGT && a != AtomEq)
|
||||
Yap_Error(DOMAIN_ERROR_ORDER, ARG1, NULL);
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_ATOM, ARG1, NULL);
|
||||
@ -582,22 +540,13 @@ p_compare( USES_REGS1 )
|
||||
return Yap_unify_constant(ARG1, MkAtomTerm(p));
|
||||
}
|
||||
|
||||
|
||||
/** @pred _X_ \== _Y_ is iso
|
||||
|
||||
Terms _X_ and _Y_ are not strictly identical.
|
||||
*/
|
||||
static Int
|
||||
a_noteq(Term t1, Term t2)
|
||||
{
|
||||
return (compare(t1, t2) != 0);
|
||||
}
|
||||
static Int a_noteq(Term t1, Term t2) { return (compare(t1, t2) != 0); }
|
||||
|
||||
static Int
|
||||
a_gen_lt(Term t1, Term t2)
|
||||
{
|
||||
return (compare(t1, t2) < 0);
|
||||
}
|
||||
static Int a_gen_lt(Term t1, Term t2) { return (compare(t1, t2) < 0); }
|
||||
|
||||
/** @pred _X_ @=< _Y_ is iso
|
||||
|
||||
@ -605,33 +554,20 @@ a_gen_lt(Term t1, Term t2)
|
||||
Term _X_ does not follow term _Y_ in the standard order.
|
||||
|
||||
*/
|
||||
static Int
|
||||
a_gen_le(Term t1, Term t2)
|
||||
{
|
||||
return (compare(t1, t2) <= 0);
|
||||
}
|
||||
static Int a_gen_le(Term t1, Term t2) { return (compare(t1, t2) <= 0); }
|
||||
|
||||
/** @pred _X_ @> _Y_ is iso
|
||||
|
||||
|
||||
Term _X_ does not follow term _Y_ in the standard order
|
||||
*/
|
||||
static Int
|
||||
a_gen_gt(Term t1, Term t2)
|
||||
{
|
||||
return compare(t1, t2) > 0;
|
||||
}
|
||||
static Int a_gen_gt(Term t1, Term t2) { return compare(t1, t2) > 0; }
|
||||
|
||||
/** @pred _X_ @>= _Y_ is iso
|
||||
|
||||
Term _X_ does not precede term _Y_ in the standard order.
|
||||
*/
|
||||
static Int
|
||||
a_gen_ge(Term t1, Term t2)
|
||||
{
|
||||
return compare(t1, t2) >= 0;
|
||||
}
|
||||
|
||||
static Int a_gen_ge(Term t1, Term t2) { return compare(t1, t2) >= 0; }
|
||||
|
||||
/**
|
||||
@}
|
||||
@ -642,19 +578,14 @@ a_gen_ge(Term t1, Term t2)
|
||||
@defgroup arithmetic_cmps Arithmetic Comparison Predicates
|
||||
@ingroup arithmetic
|
||||
|
||||
Comparison of Numeric Expressions. Both arguments must be valid ground expressions at time of call.
|
||||
Comparison of Numeric Expressions. Both arguments must be valid ground
|
||||
expressions at time of call.
|
||||
|
||||
@{
|
||||
*/
|
||||
inline static Int
|
||||
int_cmp(Int dif)
|
||||
{
|
||||
return dif;
|
||||
}
|
||||
inline static Int int_cmp(Int dif) { return dif; }
|
||||
|
||||
inline static Int
|
||||
flt_cmp(Float dif)
|
||||
{
|
||||
inline static Int flt_cmp(Float dif) {
|
||||
if (dif < 0.0)
|
||||
return -1;
|
||||
if (dif > 0.0)
|
||||
@ -662,20 +593,14 @@ flt_cmp(Float dif)
|
||||
return dif = 0.0;
|
||||
}
|
||||
|
||||
|
||||
static inline Int
|
||||
a_cmp(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
LOCAL_ArithError = FALSE;
|
||||
static Int a_cmp(Term t1, Term t2 USES_REGS) {
|
||||
if (IsVarTerm(t1)) {
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_Error(INSTANTIATION_ERROR, t1, "=:=/2");
|
||||
return FALSE;
|
||||
Yap_ArithError(INSTANTIATION_ERROR, t1,
|
||||
"while doing arithmetic comparison");
|
||||
}
|
||||
if (IsVarTerm(t2)) {
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_Error(INSTANTIATION_ERROR, t2, "=:=/2");
|
||||
return FALSE;
|
||||
Yap_ArithError(INSTANTIATION_ERROR, t2,
|
||||
"while doing arithmetic comparison");
|
||||
}
|
||||
if (IsFloatTerm(t1) && IsFloatTerm(t2)) {
|
||||
return flt_cmp(FloatOfTerm(t1) - FloatOfTerm(t2));
|
||||
@ -698,10 +623,8 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Float f2 = FloatOfTerm(t2);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(f2)) {
|
||||
LOCAL_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
LOCAL_Error_Term = t2;
|
||||
LOCAL_ErrorMessage = "trying to evaluate nan";
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t2,
|
||||
"trying to evaluate nan");
|
||||
}
|
||||
#endif
|
||||
return flt_cmp(i1 - f2);
|
||||
@ -716,10 +639,8 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Float f1 = FloatOfTerm(t1);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(f1)) {
|
||||
LOCAL_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
LOCAL_Error_Term = t1;
|
||||
LOCAL_ErrorMessage = "trying to evaluate nan";
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t1,
|
||||
"trying to evaluate nan");
|
||||
}
|
||||
#endif
|
||||
t2 = Yap_Eval(t2);
|
||||
@ -735,10 +656,8 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Float f2 = FloatOfTerm(t2);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(f2)) {
|
||||
LOCAL_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
LOCAL_Error_Term = t2;
|
||||
LOCAL_ErrorMessage = "trying to evaluate nan";
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t2,
|
||||
"trying to evaluate nan");
|
||||
}
|
||||
#endif
|
||||
return flt_cmp(f1 - f2);
|
||||
@ -760,10 +679,8 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Float f2 = FloatOfTerm(t2);
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(f2)) {
|
||||
LOCAL_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
LOCAL_Error_Term = t2;
|
||||
LOCAL_ErrorMessage = "trying to evaluate nan";
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t2,
|
||||
"trying to evaluate nan");
|
||||
}
|
||||
#endif
|
||||
return Yap_gmp_cmp_big_float(t1, f2);
|
||||
@ -779,23 +696,17 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
}
|
||||
}
|
||||
|
||||
Int
|
||||
Yap_acmp(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
Int Yap_acmp(Term t1, Term t2 USES_REGS) {
|
||||
Int out = a_cmp(t1, t2 PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_acomp( USES_REGS1 )
|
||||
{ /* $a_compare(?R,+X,+Y) */
|
||||
static Int p_acomp(USES_REGS1) { /* $a_compare(?R,+X,+Y) */
|
||||
Term t1 = Deref(ARG1);
|
||||
Term t2 = Deref(ARG2);
|
||||
Int out;
|
||||
|
||||
out = a_cmp(t1, t2 PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -806,9 +717,7 @@ p_acomp( USES_REGS1 )
|
||||
The value of the expression _X_ is equal to the value of expression _Y_.
|
||||
*/
|
||||
/// @memberof =:=/2
|
||||
static Int
|
||||
a_eq(Term t1, Term t2)
|
||||
{
|
||||
static Int a_eq(Term t1, Term t2) {
|
||||
CACHE_REGS
|
||||
/* A =:= B */
|
||||
Int out;
|
||||
@ -838,24 +747,20 @@ a_eq(Term t1, Term t2)
|
||||
}
|
||||
}
|
||||
out = a_cmp(t1, t2 PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out == 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@pred +_X_ =\\= _Y_ is iso
|
||||
Difference of arithmetic expressions
|
||||
|
||||
The value of the expression _X_ is different from the value of expression _Y_.
|
||||
The value of the expression _X_ is different from the value of expression
|
||||
_Y_.
|
||||
*/
|
||||
/// @memberof =\\=/2
|
||||
static Int
|
||||
a_dif(Term t1, Term t2)
|
||||
{
|
||||
static Int a_dif(Term t1, Term t2) {
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1), Deref(t2) PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out != 0;
|
||||
}
|
||||
|
||||
@ -866,12 +771,9 @@ a_dif(Term t1, Term t2)
|
||||
The value of the expression _X_ is less than or equal to the value
|
||||
of expression _Y_.
|
||||
*/
|
||||
static Int
|
||||
a_gt(Term t1, Term t2)
|
||||
{ /* A > B */
|
||||
static Int a_gt(Term t1, Term t2) { /* A > B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1), Deref(t2) PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out > 0;
|
||||
}
|
||||
|
||||
@ -882,12 +784,9 @@ a_gt(Term t1, Term t2)
|
||||
The value of the expression _X_ is greater than or equal to the
|
||||
value of expression _Y_.
|
||||
*/
|
||||
static Int
|
||||
a_ge(Term t1, Term t2)
|
||||
{ /* A >= B */
|
||||
static Int a_ge(Term t1, Term t2) { /* A >= B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1), Deref(t2) PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out >= 0;
|
||||
}
|
||||
|
||||
@ -899,12 +798,9 @@ a_ge(Term t1, Term t2)
|
||||
_Y_.
|
||||
*/
|
||||
/// @memberof </2
|
||||
static Int
|
||||
a_lt(Term t1, Term t2)
|
||||
{ /* A < B */
|
||||
static Int a_lt(Term t1, Term t2) { /* A < B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1), Deref(t2) PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out < 0;
|
||||
}
|
||||
|
||||
@ -918,12 +814,9 @@ a_lt(Term t1, Term t2)
|
||||
of expression _Y_.
|
||||
*/
|
||||
/// @memberof =</2
|
||||
static Int
|
||||
a_le(Term t1, Term t2)
|
||||
{ /* A <= B */
|
||||
static Int a_le(Term t1, Term t2) { /* A <= B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1), Deref(t2) PASS_REGS);
|
||||
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
|
||||
return out <= 0;
|
||||
}
|
||||
|
||||
@ -931,9 +824,7 @@ a_le(Term t1, Term t2)
|
||||
@}
|
||||
*/
|
||||
|
||||
void
|
||||
Yap_InitCmpPreds(void)
|
||||
{
|
||||
void Yap_InitCmpPreds(void) {
|
||||
Yap_InitCmpPred("=:=", 2, a_eq, SafePredFlag | BinaryPredFlag);
|
||||
Yap_InitCmpPred("=\\=", 2, a_dif, SafePredFlag | BinaryPredFlag);
|
||||
Yap_InitCmpPred(">", 2, a_gt, SafePredFlag | BinaryPredFlag);
|
||||
|
863
C/compiler.c
863
C/compiler.c
File diff suppressed because it is too large
Load Diff
12
C/dbase.c
12
C/dbase.c
@ -336,19 +336,18 @@ static int recover_from_record_error(int nargs) {
|
||||
goto recover_record;
|
||||
case RESOURCE_ERROR_HEAP:
|
||||
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
|
||||
Yap_Error(RESOURCE_ERROR_HEAP, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
goto recover_record;
|
||||
case RESOURCE_ERROR_AUXILIARY_STACK:
|
||||
if (!Yap_ExpandPreAllocCodeSpace(LOCAL_Error_Size, NULL, TRUE)) {
|
||||
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, LOCAL_Error_Term,
|
||||
LOCAL_ErrorMessage);
|
||||
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, TermNil, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
goto recover_record;
|
||||
default:
|
||||
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_Error(LOCAL_Error_TYPE, TermNil, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
recover_record:
|
||||
@ -1121,7 +1120,6 @@ static void sf_include(SFKeep *sfp, struct db_globs *dbg) SFKeep *sfp;
|
||||
j += 2;
|
||||
} else {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_DBTERM;
|
||||
LOCAL_Error_Term = d0;
|
||||
LOCAL_ErrorMessage = "wrong term in SF";
|
||||
return (NULL);
|
||||
}
|
||||
@ -1242,7 +1240,6 @@ static DBRef generate_dberror_msg(int errnumb, UInt sz, char *msg) {
|
||||
CACHE_REGS
|
||||
LOCAL_Error_Size = sz;
|
||||
LOCAL_Error_TYPE = errnumb;
|
||||
LOCAL_Error_Term = TermNil;
|
||||
LOCAL_ErrorMessage = msg;
|
||||
return NULL;
|
||||
}
|
||||
@ -2611,7 +2608,6 @@ static int resize_int_keys(UInt new_size) {
|
||||
if (new == NULL) {
|
||||
YAPLeaveCriticalSection();
|
||||
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
|
||||
LOCAL_Error_Term = TermNil;
|
||||
LOCAL_ErrorMessage = "could not allocate space";
|
||||
return FALSE;
|
||||
}
|
||||
@ -2693,7 +2689,6 @@ static PredEntry *new_lu_int_key(Int key) {
|
||||
if (INT_LU_KEYS == NULL) {
|
||||
CACHE_REGS
|
||||
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
|
||||
LOCAL_Error_Term = TermNil;
|
||||
LOCAL_ErrorMessage = "could not allocate space";
|
||||
return NULL;
|
||||
}
|
||||
@ -2825,7 +2820,6 @@ static DBProp FetchIntDBPropFromKey(Int key, int flag, int new,
|
||||
if (INT_KEYS == NULL) {
|
||||
CACHE_REGS
|
||||
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
|
||||
LOCAL_Error_Term = TermNil;
|
||||
LOCAL_ErrorMessage = "could not allocate space";
|
||||
return NULL;
|
||||
}
|
||||
|
88
C/errors.c
88
C/errors.c
@ -74,16 +74,17 @@ bool Yap_Warning(const char *s, ...) {
|
||||
return rc;
|
||||
}
|
||||
void Yap_InitError(yap_error_number e, Term t, const char *msg) {
|
||||
if (LOCAL_ActiveError.status) {
|
||||
if (LOCAL_ActiveError->status) {
|
||||
Yap_exit(1);
|
||||
}
|
||||
LOCAL_ActiveError.errorNo = e;
|
||||
LOCAL_ActiveError.errorFile = NULL;
|
||||
LOCAL_ActiveError.errorFunction = NULL;
|
||||
LOCAL_ActiveError.errorLine = 0;
|
||||
LOCAL_ActiveError->errorNo = e;
|
||||
LOCAL_ActiveError->errorFile = NULL;
|
||||
LOCAL_ActiveError->errorFunction = NULL;
|
||||
LOCAL_ActiveError->errorLine = 0;
|
||||
if (msg) {
|
||||
LOCAL_Error_Size = strlen(msg);
|
||||
strcpy(LOCAL_ActiveError.errorComment, msg);
|
||||
LOCAL_ActiveError->errorMsg = malloc(LOCAL_Error_Size + 1);
|
||||
strcpy(LOCAL_ActiveError->errorMsg, msg);
|
||||
} else {
|
||||
LOCAL_Error_Size = 0;
|
||||
}
|
||||
@ -158,7 +159,7 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno,
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
Yap_Error__(file, function, lineno, err, LOCAL_Error_Term, serr);
|
||||
Yap_Error__(file, function, lineno, err, TermNil, serr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -196,7 +197,7 @@ int Yap_SWIHandleError(const char *s, ...) {
|
||||
return FALSE;
|
||||
}
|
||||
default:
|
||||
Yap_Error(err, LOCAL_Error_Term, serr);
|
||||
Yap_Error(err, TermNil, serr);
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
@ -292,11 +293,44 @@ static char tmpbuf[YAP_BUF_SIZE];
|
||||
return mkerrorct(B, ts);
|
||||
|
||||
#define END_ERRORS() \
|
||||
} return TermNil; \
|
||||
} \
|
||||
return TermNil; \
|
||||
}
|
||||
|
||||
#include "YapErrors.h"
|
||||
|
||||
void Yap_pushErrorContext(yap_error_descriptor_t *new_error) {
|
||||
new_error->top_error = LOCAL_ActiveError;
|
||||
LOCAL_ActiveError = new_error;
|
||||
}
|
||||
|
||||
yap_error_descriptor_t *Yap_popErrorContext(void) {
|
||||
yap_error_descriptor_t *new_error = LOCAL_ActiveError;
|
||||
LOCAL_ActiveError = LOCAL_ActiveError->top_error;
|
||||
return new_error;
|
||||
}
|
||||
|
||||
void Yap_ThrowError__(const char *file, const char *function, int lineno,
|
||||
yap_error_number type, Term where, ...) {
|
||||
va_list ap;
|
||||
char tmpbuf[MAXPATHLEN];
|
||||
|
||||
va_start(ap, where);
|
||||
char *format = va_arg(ap, char *);
|
||||
if (format != NULL) {
|
||||
#if HAVE_VSNPRINTF
|
||||
(void)vsnprintf(tmpbuf, MAXPATHLEN - 1, format, ap);
|
||||
#else
|
||||
(void)vsprintf(tnpbuf, format, ap);
|
||||
#endif
|
||||
// fprintf(stderr, "warning: ");
|
||||
Yap_Error__(file, function, lineno, type, where, tmpbuf);
|
||||
} else {
|
||||
Yap_Error__(file, function, lineno, type, where);
|
||||
}
|
||||
siglongjmp(LOCAL_RestartEnv, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Yap_Error
|
||||
* This function handles errors in the C code. Check errors.yap for the
|
||||
@ -343,17 +377,17 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
|
||||
/* disallow recursive error handling */
|
||||
if (LOCAL_PrologMode & InErrorMode) {
|
||||
fprintf(stderr, "%% ERROR WITHIN ERROR %d: %s\n", LOCAL_CurrentError,
|
||||
tmpbuf);
|
||||
fprintf(stderr, "%% ERROR WITHIN ERROR %d: %s\n", LOCAL_Error_TYPE, tmpbuf);
|
||||
Yap_RestartYap(1);
|
||||
}
|
||||
LOCAL_ActiveError.errorNo = type;
|
||||
LOCAL_ActiveError.errorAsText = Yap_LookupAtom(Yap_errorName( type ));
|
||||
LOCAL_ActiveError.errorClass = Yap_errorClass( type);
|
||||
LOCAL_ActiveError.classAsText = Yap_LookupAtom(Yap_errorClassName( LOCAL_ActiveError.errorClass ));
|
||||
LOCAL_ActiveError.errorLine = lineno;
|
||||
LOCAL_ActiveError.errorFunction = function;
|
||||
LOCAL_ActiveError.errorFile = file;
|
||||
LOCAL_ActiveError->errorNo = type;
|
||||
LOCAL_ActiveError->errorAsText = Yap_LookupAtom(Yap_errorName(type));
|
||||
LOCAL_ActiveError->errorClass = Yap_errorClass(type);
|
||||
LOCAL_ActiveError->classAsText =
|
||||
Yap_LookupAtom(Yap_errorClassName(LOCAL_ActiveError->errorClass));
|
||||
LOCAL_ActiveError->errorLine = lineno;
|
||||
LOCAL_ActiveError->errorFunction = function;
|
||||
LOCAL_ActiveError->errorFile = file;
|
||||
Yap_find_prolog_culprit(PASS_REGS1);
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
Yap_ClearExs();
|
||||
@ -380,7 +414,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
}
|
||||
if (LOCAL_within_print_message) {
|
||||
/* error within error */
|
||||
fprintf(stderr, "%% ERROR WITHIN WARNING %d: %s\n", LOCAL_CurrentError,
|
||||
fprintf(stderr, "%% ERROR WITHIN WARNING %d: %s\n", LOCAL_Error_TYPE,
|
||||
tmpbuf);
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
Yap_exit(1);
|
||||
@ -395,8 +429,8 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
#endif
|
||||
// fprintf(stderr, "warning: ");
|
||||
comment = MkAtomTerm(Yap_LookupAtom(s));
|
||||
} else if (LOCAL_ErrorSay && LOCAL_ErrorSay[0]) {
|
||||
comment = MkAtomTerm(Yap_LookupAtom(LOCAL_ErrorSay));
|
||||
} else if (LOCAL_ErrorMessage && LOCAL_ErrorMessage[0]) {
|
||||
comment = MkAtomTerm(Yap_LookupAtom(LOCAL_ErrorMessage));
|
||||
} else {
|
||||
comment = TermNil;
|
||||
}
|
||||
@ -410,7 +444,6 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
if (type == ABORT_EVENT || LOCAL_PrologMode & BootMode) {
|
||||
where = TermNil;
|
||||
LOCAL_PrologMode &= ~AbortMode;
|
||||
LOCAL_CurrentError = type;
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
/* make sure failure will be seen at next port */
|
||||
// no need to lock & unlock
|
||||
@ -426,7 +459,6 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
}
|
||||
/* Exit Abort Mode, if we were there */
|
||||
LOCAL_PrologMode &= ~AbortMode;
|
||||
LOCAL_CurrentError = type;
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
if (!(where = Yap_CopyTerm(where))) {
|
||||
where = TermNil;
|
||||
@ -528,14 +560,10 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
|
||||
/* This is used by some complex procedures to detect there was an error */
|
||||
if (IsAtomTerm(nt[0])) {
|
||||
strncpy(LOCAL_ErrorSay, (char *)RepAtom(AtomOfTerm(nt[0]))->StrOfAE,
|
||||
MAX_ERROR_MSG_SIZE);
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
LOCAL_ErrorMessage = RepAtom(AtomOfTerm(nt[0]))->StrOfAE;
|
||||
} else {
|
||||
strncpy(LOCAL_ErrorSay,
|
||||
(char *)RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE,
|
||||
MAX_ERROR_MSG_SIZE);
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
LOCAL_ErrorMessage =
|
||||
(char *)RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE;
|
||||
}
|
||||
nt[1] = TermNil;
|
||||
switch (type) {
|
||||
|
155
C/eval.c
155
C/eval.c
@ -27,11 +27,10 @@ static char SccsId[] = "%W% %G%";
|
||||
@ingroup arithmetic
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "Yap.h"
|
||||
#include "Yatom.h"
|
||||
|
||||
#include "YapHeap.h"
|
||||
#include "Yatom.h"
|
||||
#include "eval.h"
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
@ -46,9 +45,7 @@ static char SccsId[] = "%W% %G%";
|
||||
|
||||
static Term Eval(Term t1 USES_REGS);
|
||||
|
||||
static Term
|
||||
get_matrix_element(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
static Term get_matrix_element(Term t1, Term t2 USES_REGS) {
|
||||
if (!IsPairTerm(t2)) {
|
||||
if (t2 == MkAtomTerm(AtomLength)) {
|
||||
Int sz = 1;
|
||||
@ -93,12 +90,10 @@ get_matrix_element(Term t1, Term t2 USES_REGS)
|
||||
return Eval(t1 PASS_REGS);
|
||||
}
|
||||
|
||||
static Term
|
||||
Eval(Term t USES_REGS)
|
||||
{
|
||||
static Term Eval(Term t USES_REGS) {
|
||||
|
||||
if (IsVarTerm(t)) {
|
||||
return Yap_ArithError(INSTANTIATION_ERROR,t,"in arithmetic");
|
||||
Yap_ArithError(INSTANTIATION_ERROR, t, "in arithmetic");
|
||||
} else if (IsNumTerm(t)) {
|
||||
return t;
|
||||
} else if (IsAtomTerm(t)) {
|
||||
@ -106,7 +101,7 @@ Eval(Term t USES_REGS)
|
||||
Atom name = AtomOfTerm(t);
|
||||
|
||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 0)))) {
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, takeIndicator(t),
|
||||
Yap_ArithError(TYPE_ERROR_EVALUABLE, takeIndicator(t),
|
||||
"atom %s in arithmetic expression",
|
||||
RepAtom(name)->StrOfAE);
|
||||
}
|
||||
@ -117,10 +112,10 @@ Eval(Term t USES_REGS)
|
||||
const char *s = (const char *)StringOfTerm(t);
|
||||
if (s[1] == '\0')
|
||||
return MkIntegerTerm(s[0]);
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
|
||||
Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
|
||||
"string in arithmetic expression");
|
||||
} else if ((Atom)fun == AtomFoundVar) {
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, TermNil,
|
||||
Yap_ArithError(TYPE_ERROR_EVALUABLE, TermNil,
|
||||
"cyclic term in arithmetic expression");
|
||||
} else {
|
||||
Int n = ArityOfFunctor(fun);
|
||||
@ -129,7 +124,7 @@ Eval(Term t USES_REGS)
|
||||
Term t1, t2;
|
||||
|
||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, n)))) {
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, takeIndicator(t),
|
||||
Yap_ArithError(TYPE_ERROR_EVALUABLE, takeIndicator(t),
|
||||
"functor %s/%d for arithmetic expression",
|
||||
RepAtom(name)->StrOfAE, n);
|
||||
}
|
||||
@ -155,32 +150,29 @@ Eval(Term t USES_REGS)
|
||||
return FALSE;
|
||||
return Yap_eval_binary(p->FOfEE, t1, t2);
|
||||
}
|
||||
} /* else if (IsPairTerm(t)) */ {
|
||||
} /* else if (IsPairTerm(t)) */
|
||||
{
|
||||
if (TailOfTerm(t) != TermNil) {
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
|
||||
"string must contain a single character to be evaluated as an arithmetic expression");
|
||||
Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
|
||||
"string must contain a single character to be "
|
||||
"evaluated as an arithmetic expression");
|
||||
}
|
||||
return Eval(HeadOfTerm(t) PASS_REGS);
|
||||
}
|
||||
}
|
||||
|
||||
Term
|
||||
Yap_InnerEval__(Term t USES_REGS)
|
||||
{
|
||||
return Eval(t PASS_REGS);
|
||||
}
|
||||
Term Yap_InnerEval__(Term t USES_REGS) { return Eval(t PASS_REGS); }
|
||||
|
||||
#ifdef BEAM
|
||||
Int BEAM_is(void);
|
||||
|
||||
Int
|
||||
BEAM_is(void)
|
||||
{ /* X is Y */
|
||||
Int BEAM_is(void) { /* X is Y */
|
||||
union arith_ret res;
|
||||
blob_type bt;
|
||||
|
||||
bt = Eval(Deref(XREGS[2]), &res);
|
||||
if (bt==db_ref_e) return (NULL);
|
||||
if (bt == db_ref_e)
|
||||
return (NULL);
|
||||
return (EvalToTerm(bt, &res));
|
||||
}
|
||||
|
||||
@ -197,14 +189,13 @@ X is 2+3*4
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
succeeds with `X = 14`.
|
||||
|
||||
Consult @ref arithmetic_operators for the complete list of arithmetic_operators
|
||||
Consult @ref arithmetic_operators for the complete list of
|
||||
arithmetic_operators
|
||||
|
||||
*/
|
||||
|
||||
/// @memberof is/2
|
||||
static Int
|
||||
p_is( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
static Int p_is(USES_REGS1) { /* X is Y */
|
||||
Term out;
|
||||
yap_error_number err;
|
||||
|
||||
@ -239,20 +230,18 @@ p_is( USES_REGS1 )
|
||||
*/
|
||||
|
||||
/// @memberof isnan/1
|
||||
static Int
|
||||
p_isnan( USES_REGS1 )
|
||||
{ /* X isnan Y */
|
||||
static Int p_isnan(USES_REGS1) { /* X isnan Y */
|
||||
Term out = 0L;
|
||||
|
||||
while (!(out = Eval(Deref(ARG1) PASS_REGS))) {
|
||||
if (LOCAL_Error_TYPE == RESOURCE_ERROR_STACK) {
|
||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||
if (!Yap_gcl(LOCAL_Error_Size, 1, ENV, CP)) {
|
||||
Yap_EvalError(RESOURCE_ERROR_STACK, ARG2, LOCAL_ErrorMessage);
|
||||
Yap_EvalError(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Yap_EvalError(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_EvalError(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -274,9 +263,7 @@ p_isnan( USES_REGS1 )
|
||||
*/
|
||||
|
||||
/// @memberof isnan/1
|
||||
static Int
|
||||
p_isinf( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
static Int p_isinf(USES_REGS1) { /* X is Y */
|
||||
Term out = 0L;
|
||||
|
||||
while (!(out = Eval(Deref(ARG1) PASS_REGS))) {
|
||||
@ -287,7 +274,7 @@ p_isinf( USES_REGS1 )
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Yap_EvalError(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_EvalError(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -312,9 +299,7 @@ True if _Log1_ is the logarithm of the positive number _A1_,
|
||||
*/
|
||||
|
||||
/// @memberof logsum/3
|
||||
static Int
|
||||
p_logsum( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
static Int p_logsum(USES_REGS1) { /* X is Y */
|
||||
Term t1 = Deref(ARG1);
|
||||
Term t2 = Deref(ARG2);
|
||||
int done = FALSE;
|
||||
@ -341,7 +326,7 @@ p_logsum( USES_REGS1 )
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Yap_EvalError(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_EvalError(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -369,7 +354,7 @@ p_logsum( USES_REGS1 )
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Yap_EvalError(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
Yap_EvalError(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -384,66 +369,25 @@ p_logsum( USES_REGS1 )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Int
|
||||
Yap_ArithError__(const char *file, const char *function, int lineno, yap_error_number type, Term where,...)
|
||||
{
|
||||
yamop *Yap_EvalError__(const char *file, const char *function, int lineno,
|
||||
yap_error_number type, Term where, ...) {
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
char *format;
|
||||
char *format, buf[MAX_ERROR_MSG_SIZE];
|
||||
|
||||
if (LOCAL_ArithError)
|
||||
return 0L;
|
||||
LOCAL_ArithError = TRUE;
|
||||
LOCAL_Error_TYPE = type;
|
||||
LOCAL_Error_File = file;
|
||||
LOCAL_Error_Function = function;
|
||||
LOCAL_Error_Lineno = lineno;
|
||||
LOCAL_Error_Term = where;
|
||||
if (!LOCAL_ErrorMessage)
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
va_start(ap, where);
|
||||
format = va_arg(ap, char *);
|
||||
if (format != NULL) {
|
||||
#if HAVE_VSNPRINTF
|
||||
(void) vsnprintf(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, format, ap);
|
||||
(void)vsnprintf(buf, MAX_ERROR_MSG_SIZE, format, ap);
|
||||
#else
|
||||
(void) vsprintf(LOCAL_ErrorMessage, format, ap);
|
||||
(void)vsprintf(buf, format, ap);
|
||||
#endif
|
||||
} else {
|
||||
LOCAL_ErrorMessage[0] = '\0';
|
||||
buf[0] = '\0';
|
||||
}
|
||||
va_end(ap);
|
||||
return 0L;
|
||||
}
|
||||
|
||||
yamop *
|
||||
Yap_EvalError__(const char *file, const char *function, int lineno,yap_error_number type, Term where,...)
|
||||
{
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
char *format;
|
||||
|
||||
if (LOCAL_ArithError) {
|
||||
LOCAL_ArithError = YAP_NO_ERROR;
|
||||
return Yap_Error__(file, function, lineno, LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
}
|
||||
|
||||
if (!LOCAL_ErrorMessage)
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
va_start (ap, where);
|
||||
format = va_arg(ap, char *);
|
||||
if (format != NULL) {
|
||||
#if HAVE_VSNPRINTF
|
||||
(void) vsnprintf(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, format, ap);
|
||||
#else
|
||||
(void) vsprintf(LOCAL_ErrorMessage, format, ap);
|
||||
#endif
|
||||
} else {
|
||||
LOCAL_ErrorMessage[0] = '\0';
|
||||
}
|
||||
va_end (ap);
|
||||
return Yap_Error__(file, function, lineno, type, where, LOCAL_ErrorMessage);
|
||||
return Yap_Error__(file, function, lineno, type, where, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -461,8 +405,7 @@ Yap_EvalError__(const char *file, const char *function, int lineno,yap_error_num
|
||||
*/
|
||||
|
||||
/// @memberof between/3
|
||||
static Int cont_between( USES_REGS1 )
|
||||
{
|
||||
static Int cont_between(USES_REGS1) {
|
||||
Term t1 = EXTRA_CBACK_ARG(3, 1);
|
||||
Term t2 = EXTRA_CBACK_ARG(3, 2);
|
||||
|
||||
@ -496,9 +439,7 @@ static Int cont_between( USES_REGS1 )
|
||||
}
|
||||
|
||||
/// @memberof between/3
|
||||
static Int
|
||||
init_between( USES_REGS1 )
|
||||
{
|
||||
static Int init_between(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
Term t2 = Deref(ARG2);
|
||||
|
||||
@ -510,14 +451,11 @@ init_between( USES_REGS1 )
|
||||
Yap_EvalError(INSTANTIATION_ERROR, t1, "between/3");
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsIntegerTerm(t1) &&
|
||||
!IsBigIntTerm(t1)) {
|
||||
if (!IsIntegerTerm(t1) && !IsBigIntTerm(t1)) {
|
||||
Yap_EvalError(TYPE_ERROR_INTEGER, t1, "between/3");
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsIntegerTerm(t2) &&
|
||||
!IsBigIntTerm(t2) &&
|
||||
t2 != MkAtomTerm(AtomInf) &&
|
||||
if (!IsIntegerTerm(t2) && !IsBigIntTerm(t2) && t2 != MkAtomTerm(AtomInf) &&
|
||||
t2 != MkAtomTerm(AtomInfinity)) {
|
||||
Yap_EvalError(TYPE_ERROR_INTEGER, t2, "between/3");
|
||||
return FALSE;
|
||||
@ -542,7 +480,8 @@ init_between( USES_REGS1 )
|
||||
cut_fail();
|
||||
}
|
||||
}
|
||||
if (i1 > i2) cut_fail();
|
||||
if (i1 > i2)
|
||||
cut_fail();
|
||||
if (i1 == i2) {
|
||||
Yap_unify(ARG3, t1);
|
||||
cut_succeed();
|
||||
@ -575,12 +514,14 @@ init_between( USES_REGS1 )
|
||||
Yap_EvalError(TYPE_ERROR_INTEGER, t3, "between/3");
|
||||
return FALSE;
|
||||
}
|
||||
if (Yap_acmp(t3, t1 PASS_REGS) >= 0 && Yap_acmp(t2,t3 PASS_REGS) >= 0 && P != FAILCODE)
|
||||
if (Yap_acmp(t3, t1 PASS_REGS) >= 0 && Yap_acmp(t2, t3 PASS_REGS) >= 0 &&
|
||||
P != FAILCODE)
|
||||
cut_succeed();
|
||||
cut_fail();
|
||||
}
|
||||
cmp = Yap_acmp(t1, t2 PASS_REGS);
|
||||
if (cmp > 0) cut_fail();
|
||||
if (cmp > 0)
|
||||
cut_fail();
|
||||
if (cmp == 0) {
|
||||
Yap_unify(ARG3, t1);
|
||||
cut_succeed();
|
||||
@ -591,9 +532,7 @@ init_between( USES_REGS1 )
|
||||
return cont_between(PASS_REGS1);
|
||||
}
|
||||
|
||||
void
|
||||
Yap_InitEval(void)
|
||||
{
|
||||
void Yap_InitEval(void) {
|
||||
/* here are the arithmetical predicates */
|
||||
Yap_InitConstExps();
|
||||
Yap_InitUnaryExps();
|
||||
|
31
C/exec.c
31
C/exec.c
@ -292,7 +292,7 @@ inline static bool do_execute(Term t, Term mod USES_REGS) {
|
||||
Term t2 = ArgOfTerm(2, t);
|
||||
if (IsVarTerm(t2))
|
||||
return CallMetaCall(t, mod PASS_REGS);
|
||||
if (!CommaCall(t2, mod))
|
||||
if (1 || !CommaCall(t2, mod))
|
||||
return CallMetaCall(t, mod PASS_REGS);
|
||||
Term t1 = ArgOfTerm(1, t);
|
||||
|
||||
@ -315,6 +315,9 @@ inline static bool do_execute(Term t, Term mod USES_REGS) {
|
||||
/* I cannot use the standard macro here because
|
||||
otherwise I would dereference the argument and
|
||||
might skip a svar */
|
||||
if (pen->PredFlags & MetaPredFlag) {
|
||||
return CallMetaCall(t, mod PASS_REGS);
|
||||
}
|
||||
pt = RepAppl(t) + 1;
|
||||
for (i = 1; i <= arity; i++) {
|
||||
#if YAPOR_SBA
|
||||
@ -1020,7 +1023,6 @@ static Int protect_stack(USES_REGS1) {
|
||||
|
||||
static Int setup_call_catcher_cleanup(USES_REGS1) {
|
||||
Term Setup = Deref(ARG1);
|
||||
Term cmod = CurrentModule;
|
||||
Int oENV = LCL0 - ENV;
|
||||
choiceptr B0 = B;
|
||||
Term t3, t4;
|
||||
@ -1048,8 +1050,6 @@ static Int setup_call_catcher_cleanup(USES_REGS1) {
|
||||
prune_inner_computation(B0);
|
||||
}
|
||||
// at this point starts actual goal execution....
|
||||
cmod = CurrentModule;
|
||||
|
||||
rc = Yap_RunTopGoal(Yap_GetFromSlot(h2), false);
|
||||
complete_inner_computation(B);
|
||||
t4 = Yap_GetFromSlot(h4);
|
||||
@ -1446,7 +1446,6 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
||||
/* must be done here, otherwise siglongjmp will clobber all the
|
||||
* registers
|
||||
*/
|
||||
Yap_Error(LOCAL_matherror, TermNil, NULL);
|
||||
/* reset the registers so that we don't have trash in abstract
|
||||
* machine */
|
||||
Yap_set_fpu_exceptions(
|
||||
@ -1458,6 +1457,14 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
||||
LOCAL_CBorder = OldBorder;
|
||||
return false;
|
||||
}
|
||||
case 4: {
|
||||
/* abort */
|
||||
/* can be called from anywgerre, must reset registers,
|
||||
*/
|
||||
Yap_JumpToEnv(TermDAbort);
|
||||
P = (yamop *)FAILCODE;
|
||||
LOCAL_PrologMode = UserMode;
|
||||
} break;
|
||||
default:
|
||||
/* do nothing */
|
||||
LOCAL_PrologMode = UserMode;
|
||||
@ -2003,7 +2010,7 @@ bool is_cleanup_cp(choiceptr cp_b) {
|
||||
}
|
||||
|
||||
static Int JumpToEnv() {
|
||||
choiceptr handler = B, oh = NULL;
|
||||
choiceptr handler = B;
|
||||
/* just keep the throwm object away, we don't need to care about it
|
||||
*/
|
||||
/* careful, previous step may have caused a stack shift,
|
||||
@ -2021,7 +2028,6 @@ static Int JumpToEnv() {
|
||||
handler->cp_b == NULL)) {
|
||||
break;
|
||||
}
|
||||
oh = handler;
|
||||
handler = handler->cp_b;
|
||||
}
|
||||
if (LOCAL_PrologMode & AsyncIntMode) {
|
||||
@ -2074,7 +2080,7 @@ static Int jump_env(USES_REGS1) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t, "throw ball must be bound");
|
||||
return false;
|
||||
} else if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorError) {
|
||||
Term t2;
|
||||
Term t2, te;
|
||||
|
||||
Yap_find_prolog_culprit(PASS_REGS1);
|
||||
// LOCAL_Error_TYPE = ERROR_EVENT;
|
||||
@ -2089,7 +2095,7 @@ static Int jump_env(USES_REGS1) {
|
||||
} else {
|
||||
//LOCAL_Error_TYPE = THROW_EVENT;
|
||||
}
|
||||
LOCAL_ActiveError.prologPredName = NULL;
|
||||
LOCAL_ActiveError->prologPredName = NULL;
|
||||
Yap_PutException(t);
|
||||
bool out = JumpToEnv(PASS_REGS1);
|
||||
if (B != NULL && P == FAILCODE && B->cp_ap == NOCODE &&
|
||||
@ -2225,10 +2231,11 @@ bool Yap_PutException(Term t) {
|
||||
}
|
||||
|
||||
bool Yap_ResetException(int wid) {
|
||||
if (REMOTE_BallTerm(wid)) {
|
||||
Yap_PopTermFromDB(REMOTE_BallTerm(wid));
|
||||
if (REMOTE_ActiveError(wid)->errorTerm) {
|
||||
Yap_PopTermFromDB(REMOTE_ActiveError(wid)->errorTerm);
|
||||
}
|
||||
REMOTE_BallTerm(wid) = NULL;
|
||||
REMOTE_ActiveError(wid)->errorTerm = NULL;
|
||||
REMOTE_ActiveError(wid)->errorTerm = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
72
C/flags.c
72
C/flags.c
@ -175,40 +175,37 @@ static Term isaccess(Term inp) {
|
||||
static Term stream(Term inp) {
|
||||
if (IsVarTerm(inp))
|
||||
return inp;
|
||||
if (Yap_CheckStream( inp, Input_Stream_f | Output_Stream_f |
|
||||
Append_Stream_f | Socket_Stream_f, "yap_flag/3" ) >= 0)
|
||||
if (Yap_CheckStream(inp, Input_Stream_f | Output_Stream_f | Append_Stream_f |
|
||||
Socket_Stream_f,
|
||||
"yap_flag/3") >= 0)
|
||||
return inp;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static bool
|
||||
set_error_stream( Term inp ) {
|
||||
static bool set_error_stream(Term inp) {
|
||||
if (IsVarTerm(inp))
|
||||
return Yap_unify(inp, Yap_StreamUserName(LOCAL_c_error_stream));
|
||||
LOCAL_c_error_stream = Yap_CheckStream( inp, Output_Stream_f |
|
||||
Append_Stream_f | Socket_Stream_f, "yap_flag/3" );
|
||||
LOCAL_c_error_stream = Yap_CheckStream(
|
||||
inp, Output_Stream_f | Append_Stream_f | Socket_Stream_f, "yap_flag/3");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
set_input_stream( Term inp ) {
|
||||
static bool set_input_stream(Term inp) {
|
||||
if (IsVarTerm(inp))
|
||||
return Yap_unify(inp, Yap_StreamUserName(LOCAL_c_input_stream));
|
||||
LOCAL_c_input_stream = Yap_CheckStream( inp, Input_Stream_f | Socket_Stream_f, "yap_flag/3" );
|
||||
LOCAL_c_input_stream =
|
||||
Yap_CheckStream(inp, Input_Stream_f | Socket_Stream_f, "yap_flag/3");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
set_output_stream( Term inp ) {
|
||||
static bool set_output_stream(Term inp) {
|
||||
if (IsVarTerm(inp))
|
||||
return Yap_unify(inp, Yap_StreamUserName(LOCAL_c_output_stream));
|
||||
LOCAL_c_output_stream = Yap_CheckStream( inp, Output_Stream_f |
|
||||
Append_Stream_f | Socket_Stream_f, "yap_flag/3" );
|
||||
LOCAL_c_output_stream = Yap_CheckStream(
|
||||
inp, Output_Stream_f | Append_Stream_f | Socket_Stream_f, "yap_flag/3");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static Term isground(Term inp) {
|
||||
return Yap_IsGroundTerm(inp) ? inp : TermZERO;
|
||||
}
|
||||
@ -870,7 +867,7 @@ static Int cont_prolog_flag(USES_REGS1) {
|
||||
}
|
||||
EXTRA_CBACK_ARG(3, 1) = MkIntTerm(++i);
|
||||
flag = getYapFlag(f);
|
||||
if (!Yap_unify(f, ARG2))
|
||||
if (!Yap_unify(flag, ARG2))
|
||||
return false;
|
||||
return setYapFlag(f, Deref(ARG3));
|
||||
}
|
||||
@ -1175,31 +1172,33 @@ static Int source_mode(USES_REGS1) {
|
||||
if (!current && !Yap_unify_constant(ARG1, TermFalse))
|
||||
return false;
|
||||
targ = Deref(ARG2);
|
||||
setYapFlag(TermSource, ARG2);
|
||||
setYapFlag(TermSource, targ);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
||||
flag_term *tarr) {
|
||||
errno = 0;
|
||||
const char *ss = (const char *)s;
|
||||
|
||||
if (f == booleanFlag) {
|
||||
if (!bootstrap) {
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(s, "true")) {
|
||||
const char *ss = (const char *)s;
|
||||
if (!strcmp(ss, "true")) {
|
||||
tarr->at = TermTrue;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "false")) {
|
||||
if (!strcmp(ss, "false")) {
|
||||
tarr->at = TermFalse;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "on")) {
|
||||
if (!strcmp(ss, "on")) {
|
||||
tarr->at = TermTrue;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "off")) {
|
||||
if (!strcmp(ss, "off")) {
|
||||
tarr->at = TermFalse;
|
||||
return true;
|
||||
}
|
||||
@ -1210,7 +1209,7 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
||||
if (!bootstrap) {
|
||||
return 0;
|
||||
}
|
||||
UInt r = strtoul(s, NULL, 10);
|
||||
UInt r = strtoul(ss, NULL, 10);
|
||||
Term t;
|
||||
if (errno) {
|
||||
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, TermNil,
|
||||
@ -1229,27 +1228,27 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
||||
if (!bootstrap) {
|
||||
return false;
|
||||
}
|
||||
if (!strcmp(s, "INT_MAX")) {
|
||||
if (!strcmp(ss, "INT_MAX")) {
|
||||
tarr->at = MkIntTerm(Int_MAX);
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "MAX_THREADS")) {
|
||||
if (!strcmp(ss, "MAX_THREADS")) {
|
||||
tarr->at = MkIntTerm(MAX_THREADS);
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "MAX_WORKERS")) {
|
||||
if (!strcmp(ss, "MAX_WORKERS")) {
|
||||
tarr->at = MkIntTerm(MAX_WORKERS);
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "INT_MIN")) {
|
||||
if (!strcmp(ss, "INT_MIN")) {
|
||||
tarr->at = MkIntTerm(Int_MIN);
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "YAP_NUMERIC_VERSION")) {
|
||||
if (!strcmp(ss, "YAP_NUMERIC_VERSION")) {
|
||||
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(s, "YAP_NUMERIC_VERSION")) {
|
||||
if (!strcmp(ss, "YAP_NUMERIC_VERSION")) {
|
||||
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
|
||||
return true;
|
||||
}
|
||||
@ -1297,7 +1296,7 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(s, "@boot") == 0) {
|
||||
} else if (strcmp(ss, "@boot") == 0) {
|
||||
if (bootstrap) {
|
||||
return true;
|
||||
}
|
||||
@ -1317,9 +1316,9 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
||||
return false;
|
||||
}
|
||||
CACHE_REGS
|
||||
encoding_t encoding = ENC_ISO_UTF8;
|
||||
t0 =
|
||||
Yap_StringToTerm(s, strlen(s) + 1, &encoding, GLOBAL_MaxPriority, NULL);
|
||||
const unsigned char *us = (const unsigned char *)s;
|
||||
t0 = Yap_BufferToTermWithPrioBindings(us, strlen(s) + 1, TermNil,
|
||||
GLOBAL_MaxPriority, 0L);
|
||||
if (!t0)
|
||||
return false;
|
||||
if (IsAtomTerm(t0) || IsIntTerm(t0)) {
|
||||
@ -1369,7 +1368,7 @@ do_prolog_flag_property(Term tflag,
|
||||
args = Yap_ArgList2ToVector(opts, prolog_flag_property_defs,
|
||||
PROLOG_FLAG_PROPERTY_END);
|
||||
if (args == NULL) {
|
||||
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, NULL);
|
||||
Yap_Error(LOCAL_Error_TYPE, opts, NULL);
|
||||
return false;
|
||||
}
|
||||
if (!IsAtomTerm(tflag)) {
|
||||
@ -1533,7 +1532,7 @@ static Int do_create_prolog_flag(USES_REGS1) {
|
||||
args = Yap_ArgList2ToVector(opts, prolog_flag_property_defs,
|
||||
PROLOG_FLAG_PROPERTY_END);
|
||||
if (args == NULL) {
|
||||
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, NULL);
|
||||
Yap_Error(LOCAL_Error_TYPE, opts, NULL);
|
||||
return false;
|
||||
}
|
||||
fv = GetFlagProp(AtomOfTerm(tflag));
|
||||
@ -1621,8 +1620,9 @@ void Yap_InitFlags(bool bootstrap) {
|
||||
while (f->name != NULL) {
|
||||
bool itf = setInitialValue(bootstrap, f->def, f->init,
|
||||
LOCAL_Flags + LOCAL_flagCount);
|
||||
// Term itf = Yap_StringToTerm(f->init, strlen(f->init)+1,
|
||||
// EBC_ISO_UTF8, GLOBAL_MaxPriority, &tp);
|
||||
// Term itf = Yap_BufferToTermWithPrioBindings(f->init,
|
||||
// strlen(f->init)+1,
|
||||
// LOBAL_MaxPriority, &tp);
|
||||
if (itf) {
|
||||
initFlag(f, LOCAL_flagCount, false);
|
||||
}
|
||||
|
@ -1654,7 +1654,8 @@ static Int p_nb_queue_close(USES_REGS1) {
|
||||
return Yap_unify(ARG3, ARG2);
|
||||
}
|
||||
out = Yap_unify(ARG3, qp[QUEUE_TAIL]) && Yap_unify(ARG2, qp[QUEUE_HEAD]);
|
||||
qp[QUEUE_HEAD] = qp[QUEUE_TAIL] = RESET_VARIABLE(qp + QUEUE_TAIL);
|
||||
RESET_VARIABLE(qp + QUEUE_TAIL);
|
||||
qp[QUEUE_HEAD] = qp[QUEUE_TAIL] = (CELL)(qp + QUEUE_TAIL);
|
||||
qp[QUEUE_SIZE] = MkIntTerm(0);
|
||||
return out;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ MkBigAndClose(MP_INT *new)
|
||||
Term t = Yap_MkBigIntTerm(new);
|
||||
mpz_clear(new);
|
||||
if (t == TermNil) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_STACK, t, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_STACK, t, ">>/2");
|
||||
}
|
||||
return t;
|
||||
}
|
||||
@ -43,7 +43,7 @@ MkRatAndClose(MP_RAT *new)
|
||||
Term t = Yap_MkBigRatTerm(new);
|
||||
mpq_clear(new);
|
||||
if (t == TermNil) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_STACK, t, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_STACK, t, ">>/2");
|
||||
}
|
||||
return t;
|
||||
}
|
||||
@ -243,7 +243,7 @@ Yap_gmp_div_big_int(Term t, Int i)
|
||||
if (i > 0) {
|
||||
mpz_tdiv_q_ui(&new, &new, i);
|
||||
} else if (i == 0) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, MkIntTerm(0), "// /2");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, MkIntTerm(0), "// /2");
|
||||
} else {
|
||||
/* we do not handle MIN_INT */
|
||||
mpz_tdiv_q_ui(&new, &new, -i);
|
||||
@ -253,7 +253,7 @@ Yap_gmp_div_big_int(Term t, Int i)
|
||||
if (i > 0) {
|
||||
mpz_fdiv_q_ui(&new, &new, i);
|
||||
} else if (i == 0) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, MkIntTerm(0), "// /2");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, MkIntTerm(0), "// /2");
|
||||
} else {
|
||||
/* we do not handle MIN_INT */
|
||||
mpz_fdiv_q_ui(&new, &new, -i);
|
||||
@ -285,7 +285,7 @@ Yap_gmp_div2_big_int(Term t, Int i)
|
||||
if (i > 0) {
|
||||
mpz_fdiv_q_ui(&new, &new, i);
|
||||
} else if (i == 0) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, MkIntTerm(0), "// /2");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, MkIntTerm(0), "// /2");
|
||||
} else {
|
||||
/* we do not handle MIN_INT */
|
||||
mpz_fdiv_q_ui(&new, &new, -i);
|
||||
@ -311,7 +311,7 @@ Yap_gmp_and_int_big(Int i, Term t)
|
||||
CELL *pt = RepAppl(t);
|
||||
MP_INT *b;
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "/\\/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "/\\/2");
|
||||
}
|
||||
b = Yap_BigIntOfTerm(t);
|
||||
|
||||
@ -328,7 +328,7 @@ Yap_gmp_ior_int_big(Int i, Term t)
|
||||
CELL *pt = RepAppl(t);
|
||||
MP_INT *b;
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "\\/ /2");
|
||||
}
|
||||
b = Yap_BigIntOfTerm(t);
|
||||
|
||||
@ -367,7 +367,7 @@ Yap_gmp_xor_int_big(Int i, Term t)
|
||||
CELL *pt = RepAppl(t);
|
||||
MP_INT *b;
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "#/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "#/2");
|
||||
}
|
||||
b = Yap_BigIntOfTerm(t);
|
||||
|
||||
@ -394,7 +394,7 @@ Yap_gmp_sll_big_int(Term t, Int i)
|
||||
mpz_init(&new);
|
||||
if (i == Int_MIN) {
|
||||
CACHE_REGS
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, MkIntegerTerm(i), "<</2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, MkIntegerTerm(i), "<</2");
|
||||
}
|
||||
mpz_fdiv_q_2exp(&new, b, -i);
|
||||
}
|
||||
@ -628,9 +628,9 @@ Yap_gmp_and_big_big(Term t1, Term t2)
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "/\\/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "/\\/2");
|
||||
}
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "/\\/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "/\\/2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -649,9 +649,9 @@ Yap_gmp_ior_big_big(Term t1, Term t2)
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "\\/ /2");
|
||||
}
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,9 +670,9 @@ Yap_gmp_xor_big_big(Term t1, Term t2)
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "\\/ /2");
|
||||
}
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -691,9 +691,9 @@ Yap_gmp_mod_big_big(Term t1, Term t2)
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "mod/2");
|
||||
}
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "mod/2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ Yap_gmp_mod_big_int(Term t, Int i2)
|
||||
{
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
} else {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
MP_INT new;
|
||||
@ -719,7 +719,7 @@ Yap_gmp_mod_int_big(Int i1, Term t)
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
} else {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
/* integer is much smaller */
|
||||
@ -768,9 +768,9 @@ Yap_gmp_rem_big_big(Term t1, Term t2)
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "rem/2");
|
||||
}
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "rem/2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -779,7 +779,7 @@ Yap_gmp_rem_big_int(Term t, Int i2)
|
||||
{
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "rem/2");
|
||||
} else {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
MP_INT new;
|
||||
@ -796,7 +796,7 @@ Yap_gmp_rem_int_big(Int i1, Term t)
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "rem/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "rem/2");
|
||||
} else {
|
||||
/* integer is much smaller */
|
||||
return MkIntegerTerm(i1);
|
||||
@ -818,9 +818,9 @@ Yap_gmp_gcd_big_big(Term t1, Term t2)
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "gcd/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "gcd/2");
|
||||
}
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -830,7 +830,7 @@ Yap_gmp_gcd_int_big(Int i, Term t)
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "gcd/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "gcd/2");
|
||||
} else {
|
||||
/* integer is much smaller */
|
||||
if (i > 0) {
|
||||
@ -992,7 +992,7 @@ Yap_gmp_exp_int_big(Int i, Term t)
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t, "^/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t, "^/2");
|
||||
} else {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
Float dbl = mpz_get_d(b);
|
||||
@ -1009,7 +1009,7 @@ Yap_gmp_exp_big_big(Term t1, Term t2)
|
||||
Float dbl1, dbl2;
|
||||
|
||||
if (pt1[1] == BIG_INT && pt2[1] == BIG_INT) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, "^/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, "^/2");
|
||||
} else {
|
||||
if (pt1[1] != BIG_INT) {
|
||||
dbl1 = mpz_get_d(Yap_BigIntOfTerm(t1));
|
||||
@ -1476,7 +1476,7 @@ Yap_gmp_unot_big(Term t)
|
||||
mpz_com(&new, &new);
|
||||
return MkBigAndClose(&new);
|
||||
} else {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "#/1");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "#/1");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1571,7 +1571,7 @@ Yap_gmp_float_fractional_part(Term t)
|
||||
{
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_fractional_part(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_fractional_part(%f)", FloatOfTerm(t));
|
||||
} else {
|
||||
MP_RAT *b = Yap_BigRatOfTerm(t);
|
||||
MP_RAT new;
|
||||
@ -1591,7 +1591,7 @@ Yap_gmp_float_integer_part(Term t)
|
||||
{
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_integer_part(%f)", FloatOfTerm(t));
|
||||
Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_integer_part(%f)", FloatOfTerm(t));
|
||||
} else {
|
||||
MP_RAT *b = Yap_BigRatOfTerm(t);
|
||||
MP_INT new;
|
||||
@ -1624,12 +1624,12 @@ Yap_gmp_lsb(Term t)
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||
if ( mpz_sgn(big) <= 0 ) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t,
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t,
|
||||
"lsb/1 received negative bignum");
|
||||
}
|
||||
return MkIntegerTerm(mpz_scan1(big,0));
|
||||
} else {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "lsb");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "lsb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1641,12 +1641,12 @@ Yap_gmp_msb(Term t)
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||
if ( mpz_sgn(big) <= 0 ) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t,
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t,
|
||||
"msb/1 received negative bignum");
|
||||
}
|
||||
return MkIntegerTerm(mpz_sizeinbase(big,2));
|
||||
} else {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1658,12 +1658,12 @@ Yap_gmp_popcount(Term t)
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||
if ( mpz_sgn(big) <= 0 ) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t,
|
||||
Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t,
|
||||
"popcount/1 received negative bignum");
|
||||
}
|
||||
return MkIntegerTerm(mpz_popcount(big));
|
||||
} else {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount");
|
||||
}
|
||||
}
|
||||
|
||||
|
8
C/grow.c
8
C/grow.c
@ -749,9 +749,7 @@ AdjustScannerStacks(TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
break;
|
||||
case Var_tok:
|
||||
case String_tok:
|
||||
case WString_tok:
|
||||
case BQString_tok:
|
||||
case WBQString_tok:
|
||||
if (IsOldTrail(tks->TokInfo))
|
||||
tks->TokInfo = TrailAdjust(tks->TokInfo);
|
||||
break;
|
||||
@ -834,7 +832,7 @@ static_growheap(size_t esize, bool fix_code, struct intermediates *cip, tr_fr_pt
|
||||
fprintf( stderr, "%% Worker Id %d:\n", worker_id);
|
||||
#endif
|
||||
fprintf( stderr, "%% Database Overflow %d\n", LOCAL_heap_overflows);
|
||||
fprintf( stderr, "%% growing the heap %ld bytes\n", size);
|
||||
fprintf( stderr, "%% growing the heap " Int_FORMAT " bytes\n", size);
|
||||
}
|
||||
/* CreepFlag is set to force heap expansion */
|
||||
if ( Yap_only_has_signal( YAP_CDOVF_SIGNAL) ) {
|
||||
@ -978,7 +976,7 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
fprintf(stderr, "%% Worker Id %d:\n", worker_id);
|
||||
#endif
|
||||
fprintf(stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, LOCAL_delay_overflows);
|
||||
fprintf(stderr, "%% %cO growing the stacks %ld bytes\n", vb_msg1, size);
|
||||
fprintf(stderr, "%% %cO growing the stacks " UInt_FORMAT " bytes\n", vb_msg1, size);
|
||||
}
|
||||
ASP -= 256;
|
||||
YAPEnterCriticalSection();
|
||||
@ -1796,7 +1794,7 @@ static int do_growtrail(size_t esize, bool contiguous_only, bool in_parser, tr_f
|
||||
fprintf(stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
||||
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
||||
#endif
|
||||
fprintf(stderr, "%% growing the trail %ld bytes\n", size);
|
||||
fprintf(stderr, "%% growing the trail " UInt_FORMAT " bytes\n", size);
|
||||
}
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
if (!GLOBAL_AllowTrailExpansion) {
|
||||
|
43
C/learn2
Normal file
43
C/learn2
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/local/bin/python3.4
|
||||
import os, sys
|
||||
if 'LD_LIBRARY_PATH' not in os.environ:
|
||||
os.environ['LD_LIBRARY_PATH'] = '/usr/local/lib'
|
||||
try:
|
||||
os.execv(sys.argv[0], sys.argv)
|
||||
except Exception as exc:
|
||||
print( 'Failed re-exec:', exc )
|
||||
sys.exit(1)
|
||||
#
|
||||
# import yourmodule
|
||||
print( 'Success:', os.environ['LD_LIBRARY_PATH']
|
||||
# your program goes here
|
||||
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
|
||||
|
||||
#import sys, os
|
||||
sys.path = sys.path + [os.getcwd()]
|
||||
|
||||
sys.druwid_root = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
import dru.druwid
|
||||
import dru.druplot
|
||||
from dru.shell import AlephShell
|
||||
|
||||
cq = dru.druwid.ClauseQueue()
|
||||
|
||||
learner = dru.druwid.Aleph( cq )
|
||||
|
||||
#
|
||||
# initialize engine
|
||||
#
|
||||
def main():
|
||||
if not learner:
|
||||
print("Nothing to do, bye!")
|
||||
exit(2)
|
||||
AlephShell(learner).cmdloop()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
11
C/load_dl.c
11
C/load_dl.c
@ -127,7 +127,8 @@ void *Yap_LoadForeignFile(char *file, int flags) {
|
||||
if (out == NULL) {
|
||||
const char *m_os = dlerror();
|
||||
if (m_os) {
|
||||
strncpy(LOCAL_ErrorSay, m_os, MAX_ERROR_MSG_SIZE - 1);
|
||||
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE);
|
||||
strncpy(LOCAL_ErrorMessage, m_os, MAX_ERROR_MSG_SIZE - 1);
|
||||
} else {
|
||||
LOCAL_ErrorMessage = "dlopen failed";
|
||||
}
|
||||
@ -177,7 +178,8 @@ static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
|
||||
NULL)
|
||||
#endif
|
||||
{
|
||||
strcpy(LOCAL_ErrorSay, dlerror());
|
||||
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE);
|
||||
strcpy(LOCAL_ErrorMessage, dlerror());
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
libs = libs->next;
|
||||
@ -192,7 +194,8 @@ static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
|
||||
/* dlopen wants to follow the LD_CONFIG_PATH */
|
||||
const char *file = AtomName(ofiles->name);
|
||||
if (!Yap_findFile(file, NULL, NULL, LOCAL_FileNameBuf, true, YAP_OBJ, true, true)) {
|
||||
strcpy(LOCAL_ErrorSay,
|
||||
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE);
|
||||
strcpy(LOCAL_ErrorMessage,
|
||||
"%% Trying to open unexisting file in LoadForeign");
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
@ -217,7 +220,7 @@ static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
|
||||
}
|
||||
|
||||
if (!*init_proc) {
|
||||
strcpy(LOCAL_ErrorSay, "Could not locate initialization routine");
|
||||
LOCAL_ErrorMessage = "Could not locate initialization routine";
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
|
||||
|
10
C/load_dll.c
10
C/load_dll.c
@ -45,10 +45,10 @@ Yap_LoadForeignFile(char *file, int flags)
|
||||
void *ptr= (void *)LoadLibrary(file);
|
||||
if (!ptr) {
|
||||
CACHE_REGS
|
||||
LOCAL_ErrorSay[0]='\0';
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorSay, 256,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorMessage, 256,
|
||||
NULL);
|
||||
}
|
||||
return ptr;
|
||||
@ -86,13 +86,13 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
if (!Yap_findFile(file, NULL, NULL, LOCAL_FileNameBuf, true, YAP_OBJ, true, true) &&
|
||||
(handle=LoadLibrary(LOCAL_FileNameBuf)) != 0)
|
||||
{
|
||||
LOCAL_ErrorSay[0]=~'\0';
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
if (*init_proc == NULL)
|
||||
*init_proc = (YapInitProc)GetProcAddress((HMODULE)handle, proc_name);
|
||||
} else {
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorSay, 256,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorMessage, 256,
|
||||
NULL);
|
||||
//fprintf(stderr,"WinError: %s\n", LOCAL_ErrorSay);
|
||||
}
|
||||
@ -124,7 +124,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
}
|
||||
|
||||
if(*init_proc == NULL) {
|
||||
strcpy(LOCAL_ErrorSay,"Could not locate initialization routine");
|
||||
LOCAL_ErrorMessage = "Could not locate initialization routine";
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,8 @@ p_open_shared_object( USES_REGS1 ) {
|
||||
|
||||
s = (char *)RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||
if ((handle = Yap_LoadForeignFile(s, IntegerOfTerm(tflags)))==NULL) {
|
||||
Yap_Error(EXISTENCE_ERROR_SOURCE_SINK,t,"open_shared_object_failed for %s with %s\n", s, LOCAL_ErrorSay);
|
||||
Yap_Error(EXISTENCE_ERROR_SOURCE_SINK,t,"open_shared_object_failed for %s"
|
||||
" with %s\n", s, LOCAL_ErrorMessage);
|
||||
return FALSE;
|
||||
} else {
|
||||
return Yap_unify(MkIntegerTerm((Int)handle),ARG3);
|
||||
|
44
C/modules.c
44
C/modules.c
@ -382,6 +382,47 @@ static Int strip_module(USES_REGS1) {
|
||||
return Yap_unify(ARG3, t1) && Yap_unify(ARG2, tmod);
|
||||
}
|
||||
|
||||
static Int yap_strip_clause(USES_REGS1) {
|
||||
Functor f;
|
||||
Term t1 = Deref(ARG1), tmod = LOCAL_SourceModule;
|
||||
if (tmod == PROLOG_MODULE) {
|
||||
tmod = TermProlog;
|
||||
}
|
||||
t1 = Yap_StripModule(t1, &tmod);
|
||||
if (IsVarTerm(t1)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t1, "trying to obtain module");
|
||||
return false;
|
||||
} else if (IsVarTerm(tmod)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, tmod, "trying to obtain module");
|
||||
return false;
|
||||
} else if (IsIntTerm(t1) || (IsApplTerm(t1) && IsExtensionFunctor((f = FunctorOfTerm(t1))))) {
|
||||
Yap_Error(TYPE_ERROR_CALLABLE, t1, "trying to obtain module");
|
||||
return false;
|
||||
} else if (!IsAtomTerm(tmod)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM, tmod, "trying to obtain module");
|
||||
return false;
|
||||
}
|
||||
if (f == FunctorAssert || f == FunctorDoubleArrow) {
|
||||
Term thmod = tmod;
|
||||
Term th = ArgOfTerm(1, t1);
|
||||
th = Yap_StripModule(th, &thmod);
|
||||
if (IsVarTerm(th)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t1, "trying to obtain module");
|
||||
return false;
|
||||
} else if (IsVarTerm(thmod)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, thmod, "trying to obtain module");
|
||||
return false;
|
||||
} else if (IsIntTerm(th) || (IsApplTerm(th) && IsExtensionFunctor(FunctorOfTerm(t1)))) {
|
||||
Yap_Error(TYPE_ERROR_CALLABLE, t1, "trying to obtain module");
|
||||
return false;
|
||||
}else if (!IsAtomTerm(thmod)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM, thmod, "trying to obtain module");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return Yap_unify(ARG3, t1) && Yap_unify(ARG2, tmod);
|
||||
}
|
||||
|
||||
Term Yap_YapStripModule(Term t, Term *modp) {
|
||||
CACHE_REGS
|
||||
Term tmod;
|
||||
@ -565,10 +606,11 @@ void Yap_InitModulesC(void) {
|
||||
Yap_InitCPred("$change_module", 1, change_module,
|
||||
SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("strip_module", 3, strip_module, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("$yap_strip_module", 3, yap_strip_module, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("source_module", 1, source_module, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("current_source_module", 2, current_source_module,
|
||||
SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("$yap_strip_module", 3, yap_strip_module,
|
||||
Yap_InitCPred("$yap_strip_clause", 3, yap_strip_clause,
|
||||
SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("context_module", 1, context_module, 0);
|
||||
Yap_InitCPred("$is_system_module", 1, is_system_module, SafePredFlag);
|
||||
|
211
C/parser.c
211
C/parser.c
@ -138,11 +138,11 @@ dot with single quotes.
|
||||
*/
|
||||
|
||||
#include "Yap.h"
|
||||
#include "Yatom.h"
|
||||
#include "YapHeap.h"
|
||||
#include "YapText.h"
|
||||
#include "yapio.h"
|
||||
#include "Yatom.h"
|
||||
#include "eval.h"
|
||||
#include "yapio.h"
|
||||
/* stuff we want to use in standard YAP code */
|
||||
#include "iopreds.h"
|
||||
#if HAVE_STRING_H
|
||||
@ -163,23 +163,26 @@ dot with single quotes.
|
||||
typedef struct jmp_buff_struct { sigjmp_buf JmpBuff; } JMPBUFF;
|
||||
|
||||
static void GNextToken(CACHE_TYPE1);
|
||||
static void checkfor(wchar_t, JMPBUFF *, encoding_t CACHE_TYPE);
|
||||
static Term ParseArgs(Atom, wchar_t, JMPBUFF *, Term, encoding_t, Term CACHE_TYPE);
|
||||
static void checkfor(Term, JMPBUFF *, encoding_t CACHE_TYPE);
|
||||
static Term ParseArgs(Atom, Term, JMPBUFF *, Term, encoding_t, Term CACHE_TYPE);
|
||||
static Term ParseList(JMPBUFF *, encoding_t, Term CACHE_TYPE);
|
||||
static Term ParseTerm(int, JMPBUFF *, encoding_t, Term CACHE_TYPE);
|
||||
|
||||
const char *Yap_tokRep(TokEntry *tokptr, encoding_t enc);
|
||||
extern Term Yap_tokRep(void* tokptr);
|
||||
extern const char * Yap_tokText(void *tokptr);
|
||||
|
||||
static void syntax_msg(const char *msg, ...) {
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
|
||||
if (LOCAL_toktide == LOCAL_tokptr) {
|
||||
char out[YAP_FILENAME_MAX];
|
||||
if (!LOCAL_ErrorMessage ||
|
||||
(LOCAL_Error_TYPE == SYNTAX_ERROR &&
|
||||
LOCAL_ActiveError->prologParserLine < LOCAL_tokptr->TokPos)) {
|
||||
if (!LOCAL_ErrorMessage) {
|
||||
LOCAL_ErrorMessage = malloc(1024 + 1);
|
||||
}
|
||||
LOCAL_ActiveError->prologParserLine = LOCAL_tokptr->TokPos;
|
||||
va_start(ap, msg);
|
||||
vsnprintf(out, YAP_FILENAME_MAX - 1, msg, ap);
|
||||
LOCAL_Error_Term = MkStringTerm( out );
|
||||
LOCAL_Error_TYPE = SYNTAX_ERROR;
|
||||
vsnprintf(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
@ -225,11 +228,12 @@ static void syntax_msg(const char *msg, ...) {
|
||||
|
||||
#define FAIL siglongjmp(FailBuff->JmpBuff, 1)
|
||||
|
||||
VarEntry *
|
||||
Yap_LookupVar(const char *var) /* lookup variable in variables table */
|
||||
VarEntry *Yap_LookupVar(const char *var) /* lookup variable in variables table
|
||||
* */
|
||||
{
|
||||
CACHE_REGS
|
||||
VarEntry *p;
|
||||
Atom vat = Yap_LookupAtom(var);
|
||||
|
||||
#if DEBUG
|
||||
if (GLOBAL_Option[4])
|
||||
@ -245,7 +249,7 @@ Yap_LookupVar(const char *var) /* lookup variable in variables table */
|
||||
CELL hpv = p->hv;
|
||||
if (hv == hpv) {
|
||||
Int scmp;
|
||||
if ((scmp = strcmp(var, p->VarRep)) == 0) {
|
||||
if ((scmp = strcmp(var, RepAtom(p->VarRep)->StrOfAE)) == 0) {
|
||||
p->refs++;
|
||||
return (p);
|
||||
} else if (scmp < 0) {
|
||||
@ -263,22 +267,21 @@ Yap_LookupVar(const char *var) /* lookup variable in variables table */
|
||||
p = p->VarRight;
|
||||
}
|
||||
}
|
||||
p = (VarEntry *)Yap_AllocScannerMemory(strlen(var) + sizeof(VarEntry));
|
||||
p = (VarEntry *)Yap_AllocScannerMemory(sizeof(VarEntry));
|
||||
*op = p;
|
||||
p->VarLeft = p->VarRight = NULL;
|
||||
p->hv = hv;
|
||||
p->refs = 1L;
|
||||
strcpy(p->VarRep, var);
|
||||
p->VarRep = vat;
|
||||
} else {
|
||||
/* anon var */
|
||||
p = (VarEntry *)Yap_AllocScannerMemory(sizeof(VarEntry) + 2);
|
||||
p = (VarEntry *)Yap_AllocScannerMemory(sizeof(VarEntry));
|
||||
p->VarLeft = LOCAL_AnonVarTable;
|
||||
LOCAL_AnonVarTable = p;
|
||||
p->VarRight = NULL;
|
||||
p->refs = 0L;
|
||||
p->hv = 1L;
|
||||
p->VarRep[0] = '_';
|
||||
p->VarRep[1] = '\0';
|
||||
p->VarRep = vat;
|
||||
}
|
||||
p->VarAdr = TermNil;
|
||||
return (p);
|
||||
@ -286,11 +289,11 @@ Yap_LookupVar(const char *var) /* lookup variable in variables table */
|
||||
|
||||
static Term VarNames(VarEntry *p, Term l USES_REGS) {
|
||||
if (p != NULL) {
|
||||
if (strcmp(p->VarRep, "_") != 0) {
|
||||
if (strcmp(RepAtom(p->VarRep)->StrOfAE, "_") != 0) {
|
||||
Term t[2];
|
||||
Term o;
|
||||
|
||||
t[0] = MkAtomTerm(Yap_LookupAtom(p->VarRep));
|
||||
t[0] = MkAtomTerm(p->VarRep);
|
||||
if (!IsVarTerm(p->VarAdr))
|
||||
p->VarAdr = MkVarTerm();
|
||||
t[1] = p->VarAdr;
|
||||
@ -317,11 +320,11 @@ Term Yap_VarNames(VarEntry *p, Term l) {
|
||||
|
||||
static Term Singletons(VarEntry *p, Term l USES_REGS) {
|
||||
if (p != NULL) {
|
||||
if (p->VarRep[0] != '_' && p->refs == 1) {
|
||||
if (RepAtom(p->VarRep)->StrOfAE[0] != '_' && p->refs == 1) {
|
||||
Term t[2];
|
||||
Term o;
|
||||
|
||||
t[0] = MkAtomTerm(Yap_LookupAtom(p->VarRep));
|
||||
t[0] = MkAtomTerm(p->VarRep);
|
||||
t[1] = p->VarAdr;
|
||||
o = Yap_MkApplTerm(FunctorEq, 2, t);
|
||||
o = MkPairTerm(o,
|
||||
@ -364,6 +367,7 @@ static Term Variables(VarEntry *p, Term l USES_REGS) {
|
||||
|
||||
Term Yap_Variables(VarEntry *p, Term l) {
|
||||
CACHE_REGS
|
||||
l = Variables(LOCAL_AnonVarTable, l PASS_REGS);
|
||||
return Variables(p, l PASS_REGS);
|
||||
}
|
||||
|
||||
@ -394,15 +398,16 @@ int Yap_IsPrefixOp(Atom op, int *pptr, int *rpptr) {
|
||||
return IsPrefixOp(op, pptr, rpptr, CurrentModule PASS_REGS);
|
||||
}
|
||||
|
||||
static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr, Term cmod USES_REGS) {
|
||||
static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr,
|
||||
Term cmod USES_REGS) {
|
||||
int p;
|
||||
|
||||
OpEntry *opp = Yap_GetOpProp(op, INFIX_OP, cmod PASS_REGS);
|
||||
if (!opp)
|
||||
return FALSE;
|
||||
return false;
|
||||
if (opp->OpModule && opp->OpModule != cmod) {
|
||||
READ_UNLOCK(opp->OpRWLock);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if ((p = opp->Infix) != 0) {
|
||||
READ_UNLOCK(opp->OpRWLock);
|
||||
@ -459,12 +464,14 @@ inline static void GNextToken(USES_REGS1) {
|
||||
LOCAL_tokptr = LOCAL_tokptr->TokNext;
|
||||
}
|
||||
|
||||
inline static void checkfor(wchar_t c, JMPBUFF *FailBuff, encoding_t enc USES_REGS) {
|
||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
||||
LOCAL_tokptr->TokInfo != (Term)c) {
|
||||
inline static void checkfor(Term c, JMPBUFF *FailBuff,
|
||||
encoding_t enc USES_REGS) {
|
||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok) || LOCAL_tokptr->TokInfo != c) {
|
||||
char s[1024];
|
||||
strncpy(s, Yap_tokRep(LOCAL_tokptr, enc), 1023);
|
||||
syntax_msg("line %d: expected to find \'%c\', found %s", LOCAL_tokptr->TokPos, c, s);
|
||||
strncpy(s, Yap_tokText(LOCAL_tokptr), 1023);
|
||||
syntax_msg("line %d: expected to find "
|
||||
"\'%c....................................\', found %s",
|
||||
LOCAL_tokptr->TokPos, c, s);
|
||||
FAIL;
|
||||
}
|
||||
NextToken;
|
||||
@ -472,7 +479,8 @@ inline static void checkfor(wchar_t c, JMPBUFF *FailBuff, encoding_t enc USES_RE
|
||||
|
||||
#ifdef O_QUASIQUOTATIONS
|
||||
|
||||
static int is_quasi_quotation_syntax(Term goal, Atom *pat, encoding_t enc, Term cmod) {
|
||||
static int is_quasi_quotation_syntax(Term goal, Atom *pat, encoding_t enc,
|
||||
Term cmod) {
|
||||
CACHE_REGS
|
||||
Term m = cmod, t;
|
||||
Atom at;
|
||||
@ -520,12 +528,12 @@ static int get_quasi_quotation(term_t t, unsigned char **here,
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE; // errorWarning("end_of_file_in_quasi_quotation", 0, _PL_rd);
|
||||
return false; // errorWarning("end_of_file_in_quasi_quotation", 0, _PL_rd);
|
||||
}
|
||||
#endif /*O_QUASIQUOTATIONS*/
|
||||
|
||||
static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
Term arg1, encoding_t enc, Term cmod USES_REGS) {
|
||||
static Term ParseArgs(Atom a, Term close, JMPBUFF *FailBuff, Term arg1,
|
||||
encoding_t enc, Term cmod USES_REGS) {
|
||||
int nargs = 0;
|
||||
Term *p, t;
|
||||
Functor func;
|
||||
@ -567,7 +575,7 @@ static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
++nargs;
|
||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok))
|
||||
break;
|
||||
if (((int)LOCAL_tokptr->TokInfo) != ',')
|
||||
if (LOCAL_tokptr->TokInfo != TermComma)
|
||||
break;
|
||||
NextToken;
|
||||
}
|
||||
@ -606,7 +614,8 @@ static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
}
|
||||
|
||||
static Term MakeAccessor(Term t, Functor f USES_REGS) {
|
||||
UInt arity = ArityOfFunctor(FunctorOfTerm(t)), i;
|
||||
UInt arity = ArityOfFunctor(FunctorOfTerm(t));
|
||||
int i;
|
||||
Term tf[2], tl = TermNil;
|
||||
|
||||
tf[1] = ArgOfTerm(1, t);
|
||||
@ -626,7 +635,7 @@ loop:
|
||||
HR += 2;
|
||||
to_store[0] = ParseTerm(999, FailBuff, enc, cmod PASS_REGS);
|
||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
||||
if (((int)LOCAL_tokptr->TokInfo) == ',') {
|
||||
if (LOCAL_tokptr->TokInfo == TermComma) {
|
||||
NextToken;
|
||||
{
|
||||
/* check for possible overflow against local stack */
|
||||
@ -639,21 +648,22 @@ loop:
|
||||
goto loop;
|
||||
}
|
||||
}
|
||||
} else if (((int)LOCAL_tokptr->TokInfo) == '|') {
|
||||
} else if (LOCAL_tokptr->TokInfo == TermVBar) {
|
||||
NextToken;
|
||||
to_store[1] = ParseTerm(999, FailBuff, enc, cmod PASS_REGS);
|
||||
} else {
|
||||
to_store[1] = MkAtomTerm(AtomNil);
|
||||
}
|
||||
} else {
|
||||
syntax_msg("line %d: looking for symbol ',','|' got symbol '%s'",LOCAL_tokptr->TokPos,
|
||||
Yap_tokRep(LOCAL_tokptr, enc));
|
||||
syntax_msg("line %d: looking for symbol ',','|' got symbol '%s'",
|
||||
LOCAL_tokptr->TokPos, Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
return (o);
|
||||
}
|
||||
|
||||
static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USES_REGS) {
|
||||
static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc,
|
||||
Term cmod USES_REGS) {
|
||||
/* parse term with priority prio */
|
||||
Volatile Term t;
|
||||
Volatile Functor func;
|
||||
@ -667,7 +677,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
NextToken;
|
||||
/* special rules apply for +1, -2.3, etc... */
|
||||
if (LOCAL_tokptr->Tok == Number_tok) {
|
||||
if ((Atom)t == AtomMinus) {
|
||||
if (t == TermMinus) {
|
||||
t = LOCAL_tokptr->TokInfo;
|
||||
if (IsIntTerm(t))
|
||||
t = MkIntTerm(-IntOfTerm(t));
|
||||
@ -685,12 +695,12 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
}
|
||||
}
|
||||
if ((LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
||||
Unsigned(LOCAL_tokptr->TokInfo) != 'l') &&
|
||||
IsPrefixOp((Atom)t, &opprio, &oprprio, cmod PASS_REGS)) {
|
||||
LOCAL_tokptr->TokInfo != Terml) &&
|
||||
IsPrefixOp(AtomOfTerm(t), &opprio, &oprprio, cmod PASS_REGS)) {
|
||||
if (LOCAL_tokptr->Tok == Name_tok) {
|
||||
Atom at = (Atom)LOCAL_tokptr->TokInfo;
|
||||
Atom at = AtomOfTerm(LOCAL_tokptr->TokInfo);
|
||||
#ifndef _MSC_VER
|
||||
if ((Atom)t == AtomPlus) {
|
||||
if (t == TermPlus) {
|
||||
if (at == AtomInf) {
|
||||
t = MkFloatTerm(INFINITY);
|
||||
NextToken;
|
||||
@ -700,7 +710,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
NextToken;
|
||||
break;
|
||||
}
|
||||
} else if ((Atom)t == AtomMinus) {
|
||||
} else if (t == TermMinus) {
|
||||
if (at == AtomInf) {
|
||||
t = MkFloatTerm(-INFINITY);
|
||||
NextToken;
|
||||
@ -717,11 +727,10 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
/* try to parse as a prefix operator */
|
||||
TRY(
|
||||
/* build appl on the heap */
|
||||
func = Yap_MkFunctor((Atom)t, 1); if (func == NULL) {
|
||||
func = Yap_MkFunctor(AtomOfTerm(t), 1); if (func == NULL) {
|
||||
syntax_msg("line %d: Heap Overflow", LOCAL_tokptr->TokPos);
|
||||
FAIL;
|
||||
}
|
||||
t = ParseTerm(oprprio, FailBuff, enc, cmod PASS_REGS);
|
||||
} t = ParseTerm(oprprio, FailBuff, enc, cmod PASS_REGS);
|
||||
t = Yap_MkApplTerm(func, 1, &t);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
@ -732,10 +741,9 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
}
|
||||
}
|
||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok) &&
|
||||
Unsigned(LOCAL_tokptr->TokInfo) == 'l')
|
||||
t = ParseArgs((Atom)t, ')', FailBuff, 0L, enc, cmod PASS_REGS);
|
||||
else
|
||||
t = MkAtomTerm((Atom)t);
|
||||
LOCAL_tokptr->TokInfo == Terml)
|
||||
t = ParseArgs(AtomOfTerm(t), TermEndBracket, FailBuff, 0L, enc,
|
||||
cmod PASS_REGS);
|
||||
break;
|
||||
|
||||
case Number_tok:
|
||||
@ -757,33 +765,34 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
break;
|
||||
|
||||
case Error_tok:
|
||||
syntax_msg("line %d: found ill-formed \"%s\"",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||
syntax_msg("line %d: found ill-formed \"%s\"", LOCAL_tokptr->TokPos,
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
|
||||
case Ponctuation_tok:
|
||||
|
||||
switch ((int)LOCAL_tokptr->TokInfo) {
|
||||
switch (RepAtom(AtomOfTerm(LOCAL_tokptr->TokInfo))->StrOfAE[0]) {
|
||||
case '(':
|
||||
case 'l': /* non solo ( */
|
||||
NextToken;
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, enc, cmod PASS_REGS);
|
||||
checkfor(')', FailBuff, enc PASS_REGS);
|
||||
checkfor(TermEndBracket, FailBuff, enc PASS_REGS);
|
||||
break;
|
||||
case '[':
|
||||
NextToken;
|
||||
if (LOCAL_tokptr->Tok == Ponctuation_tok &&
|
||||
(int)LOCAL_tokptr->TokInfo == ']') {
|
||||
LOCAL_tokptr->TokInfo == TermEndSquareBracket) {
|
||||
t = TermNil;
|
||||
NextToken;
|
||||
break;
|
||||
}
|
||||
t = ParseList(FailBuff, enc, cmod PASS_REGS);
|
||||
checkfor(']', FailBuff, enc PASS_REGS);
|
||||
checkfor(TermEndSquareBracket, FailBuff, enc PASS_REGS);
|
||||
break;
|
||||
case '{':
|
||||
NextToken;
|
||||
if (LOCAL_tokptr->Tok == Ponctuation_tok &&
|
||||
(int)LOCAL_tokptr->TokInfo == '}') {
|
||||
(int)LOCAL_tokptr->TokInfo == TermEndCurlyBracket) {
|
||||
t = MkAtomTerm(AtomBraces);
|
||||
NextToken;
|
||||
break;
|
||||
@ -795,10 +804,11 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
syntax_msg("line %d: Stack Overflow", LOCAL_tokptr->TokPos);
|
||||
FAIL;
|
||||
}
|
||||
checkfor('}', FailBuff, enc PASS_REGS);
|
||||
checkfor(TermEndCurlyBracket, FailBuff, enc PASS_REGS);
|
||||
break;
|
||||
default:
|
||||
syntax_msg("line %d: unexpected ponctuation signal %s",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||
syntax_msg("line %d: unexpected ponctuation signal %s",
|
||||
LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
break;
|
||||
@ -843,12 +853,12 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, enc, cmod PASS_REGS);
|
||||
if (LOCAL_tokptr->Tok != QuasiQuotes_tok) {
|
||||
syntax_msg("expected to find quasi quotes, got \"%s\"", ,
|
||||
Yap_tokRep(LOCAL_tokptr, enc));
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
if (!(is_quasi_quotation_syntax(t, &at))) {
|
||||
syntax_msg("bad quasi quotation syntax, at \"%s\"",
|
||||
Yap_tokRep(LOCAL_tokptr, enc));
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
/* Arg 2: the content */
|
||||
@ -858,7 +868,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)), &qq->text,
|
||||
qq->text + strlen((const char *)qq->text))) {
|
||||
syntax_msg("could not get quasi quotation, at \"%s\"",
|
||||
Yap_tokRep(LOCAL_tokptr, enc));
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
if (positions) {
|
||||
@ -870,7 +880,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
qq->mid.charno + 2, /* end of | token */
|
||||
PL_INTPTR, qqend - 2)) /* end minus "|}" */
|
||||
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
||||
Yap_tokRep(LOCAL_tokptr, enc));
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
|
||||
@ -889,21 +899,23 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
NextToken;
|
||||
break;
|
||||
default:
|
||||
syntax_msg("line %d: expected operator, got \'%s\'",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||
syntax_msg("line %d: expected operator, got \'%s\'", LOCAL_tokptr->TokPos,
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
|
||||
/* main loop to parse infix and posfix operators starts here */
|
||||
while (true) {
|
||||
Atom name;
|
||||
if (LOCAL_tokptr->Tok == Ord(Name_tok) &&
|
||||
Yap_HasOp((Atom)(LOCAL_tokptr->TokInfo))) {
|
||||
Atom save_opinfo = opinfo = (Atom)(LOCAL_tokptr->TokInfo);
|
||||
Yap_HasOp((name = AtomOfTerm(LOCAL_tokptr->TokInfo)))) {
|
||||
Atom save_opinfo = opinfo = name;
|
||||
if (IsInfixOp(save_opinfo, &opprio, &oplprio, &oprprio, cmod PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
/* try parsing as infix operator */
|
||||
Volatile int oldprio = curprio;
|
||||
TRY3(
|
||||
func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 2);
|
||||
func = Yap_MkFunctor(save_opinfo, 2);
|
||||
if (func == NULL) {
|
||||
syntax_msg("line %d: Heap Overflow", LOCAL_tokptr->TokPos);
|
||||
FAIL;
|
||||
@ -923,10 +935,10 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
opinfo = save_opinfo; continue;, opinfo = save_opinfo;
|
||||
curprio = oldprio;)
|
||||
}
|
||||
if (IsPosfixOp(opinfo, &opprio, &oplprio, cmod PASS_REGS) && opprio <= prio &&
|
||||
oplprio >= curprio) {
|
||||
if (IsPosfixOp(opinfo, &opprio, &oplprio, cmod PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
/* parse as posfix operator */
|
||||
Functor func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 1);
|
||||
Functor func = Yap_MkFunctor(AtomOfTerm(LOCAL_tokptr->TokInfo), 1);
|
||||
if (func == NULL) {
|
||||
syntax_msg("line %d: Heap Overflow", LOCAL_tokptr->TokPos);
|
||||
FAIL;
|
||||
@ -944,8 +956,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
break;
|
||||
}
|
||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
||||
if (Unsigned(LOCAL_tokptr->TokInfo) == ',' && prio >= 1000 &&
|
||||
curprio <= 999) {
|
||||
if (LOCAL_tokptr->TokInfo == TermComma && prio >= 1000 && curprio <= 999) {
|
||||
Volatile Term args[2];
|
||||
NextToken;
|
||||
args[0] = t;
|
||||
@ -958,8 +969,9 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
}
|
||||
curprio = 1000;
|
||||
continue;
|
||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '|' &&
|
||||
IsInfixOp(AtomVBar, &opprio, &oplprio, &oprprio, cmod PASS_REGS) &&
|
||||
} else if (LOCAL_tokptr->TokInfo == TermVBar &&
|
||||
IsInfixOp(AtomVBar, &opprio, &oplprio, &oprprio,
|
||||
cmod PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
Volatile Term args[2];
|
||||
NextToken;
|
||||
@ -973,32 +985,37 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USE
|
||||
}
|
||||
curprio = opprio;
|
||||
continue;
|
||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '(' &&
|
||||
IsPosfixOp(AtomEmptyBrackets, &opprio, &oplprio, cmod PASS_REGS) &&
|
||||
} else if (LOCAL_tokptr->TokInfo == TermBeginBracket &&
|
||||
IsPosfixOp(AtomEmptyBrackets, &opprio, &oplprio,
|
||||
cmod PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
t = ParseArgs(AtomEmptyBrackets, ')', FailBuff, t, enc, cmod PASS_REGS);
|
||||
t = ParseArgs(AtomEmptyBrackets, TermEndBracket, FailBuff, t, enc,
|
||||
cmod PASS_REGS);
|
||||
curprio = opprio;
|
||||
continue;
|
||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '[' &&
|
||||
IsPosfixOp(AtomEmptySquareBrackets, &opprio,
|
||||
&oplprio, cmod PASS_REGS) &&
|
||||
} else if (LOCAL_tokptr->TokInfo == TermBeginSquareBracket &&
|
||||
IsPosfixOp(AtomEmptySquareBrackets, &opprio, &oplprio,
|
||||
cmod PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
t = ParseArgs(AtomEmptySquareBrackets, ']', FailBuff, t, enc, cmod PASS_REGS);
|
||||
t = ParseArgs(AtomEmptySquareBrackets, TermEndSquareBracket, FailBuff,
|
||||
t, enc, cmod PASS_REGS);
|
||||
t = MakeAccessor(t, FunctorEmptySquareBrackets PASS_REGS);
|
||||
curprio = opprio;
|
||||
continue;
|
||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '{' &&
|
||||
IsPosfixOp(AtomEmptyCurlyBrackets, &opprio,
|
||||
&oplprio, cmod PASS_REGS) &&
|
||||
} else if (LOCAL_tokptr->TokInfo == TermBeginCurlyBracket &&
|
||||
IsPosfixOp(AtomBraces, &opprio, &oplprio,
|
||||
cmod PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
t = ParseArgs(AtomEmptyCurlyBrackets, '}', FailBuff, t, enc, cmod PASS_REGS);
|
||||
t = MakeAccessor(t, FunctorEmptyCurlyBrackets PASS_REGS);
|
||||
t = ParseArgs(AtomBraces, TermEndCurlyBracket, FailBuff, t,
|
||||
enc, cmod PASS_REGS);
|
||||
t = MakeAccessor(t, FunctorBraces PASS_REGS);
|
||||
curprio = opprio;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (LOCAL_tokptr->Tok <= Ord(WString_tok)) {
|
||||
syntax_msg("line %d: expected operator, got \'%s\'",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||
if (LOCAL_tokptr->Tok <= Ord(String_tok)) {
|
||||
syntax_msg("line %d: expected operator, got \'%s\'", LOCAL_tokptr->TokPos,
|
||||
Yap_tokText(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
break;
|
||||
@ -1011,6 +1028,7 @@ Term Yap_Parse(UInt prio, encoding_t enc, Term cmod) {
|
||||
Volatile Term t;
|
||||
JMPBUFF FailBuff;
|
||||
yhandle_t sls = Yap_StartSlots();
|
||||
LOCAL_toktide = LOCAL_tokptr;
|
||||
|
||||
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
||||
|
||||
@ -1027,9 +1045,14 @@ Term Yap_Parse(UInt prio, encoding_t enc, Term cmod) {
|
||||
}
|
||||
#endif
|
||||
Yap_CloseSlots(sls);
|
||||
}
|
||||
if (LOCAL_tokptr != NULL && LOCAL_tokptr->Tok != Ord(eot_tok)) {
|
||||
LOCAL_Error_TYPE = SYNTAX_ERROR;
|
||||
if (LOCAL_tokptr->TokNext) {
|
||||
LOCAL_ErrorMessage = "operator misssing . ";
|
||||
} else {
|
||||
LOCAL_ErrorMessage = "term does not end on . ";
|
||||
}
|
||||
t = 0;
|
||||
}
|
||||
if (t != 0 && LOCAL_Error_TYPE == SYNTAX_ERROR) {
|
||||
@ -1040,9 +1063,5 @@ Term Yap_Parse(UInt prio, encoding_t enc, Term cmod) {
|
||||
// return (0L);
|
||||
return t;
|
||||
}
|
||||
Yap_CloseSlots(sls);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
1101
C/prim_absmi_insts.h
1101
C/prim_absmi_insts.h
File diff suppressed because it is too large
Load Diff
17
C/qlyr.c
17
C/qlyr.c
@ -688,22 +688,7 @@ static void ReadHash(FILE *stream) {
|
||||
Atom at;
|
||||
qlf_tag_t tg = read_tag(stream);
|
||||
|
||||
if (tg == QLY_ATOM_WIDE) {
|
||||
wchar_t *rep = (wchar_t *)AllocTempSpace();
|
||||
UInt len;
|
||||
|
||||
len = read_UInt(stream);
|
||||
if (!EnoughTempSpace(len))
|
||||
QLYR_ERROR(OUT_OF_TEMP_SPACE);
|
||||
read_bytes(stream, rep, (len + 1) * sizeof(wchar_t));
|
||||
while (!(at = Yap_LookupWideAtom(rep))) {
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (at == NIL)
|
||||
QLYR_ERROR(OUT_OF_ATOM_SPACE);
|
||||
} else if (tg == QLY_ATOM) {
|
||||
if (tg == QLY_ATOM) {
|
||||
char *rep = (char *)AllocTempSpace();
|
||||
UInt len;
|
||||
|
||||
|
7
C/qlyw.c
7
C/qlyw.c
@ -505,7 +505,6 @@ DBRefAdjust__ (DBRef dbt USES_REGS)
|
||||
|
||||
#define rehash(oldcode, NOfE, KindOfEntries)
|
||||
|
||||
#define RestoreSWIHash()
|
||||
|
||||
static void RestoreFlags( UInt NFlags )
|
||||
{
|
||||
@ -584,17 +583,11 @@ SaveHash(FILE *stream)
|
||||
if (a->val) {
|
||||
Atom at = a->val;
|
||||
CHECK(save_UInt(stream, (UInt)at));
|
||||
if (IsWideAtom(at)) {
|
||||
CHECK(save_tag(stream, QLY_ATOM_WIDE));
|
||||
CHECK(save_UInt(stream, wcslen(RepAtom(at)->WStrOfAE)));
|
||||
CHECK(save_bytes(stream, at->WStrOfAE, (wcslen(at->WStrOfAE)+1)*sizeof(wchar_t)));
|
||||
} else {
|
||||
CHECK(save_tag(stream, QLY_ATOM));
|
||||
CHECK(save_UInt(stream, strlen((char *)RepAtom(at)->StrOfAE)));
|
||||
CHECK(save_bytes(stream, (char *)at->StrOfAE, (strlen((char *)at->StrOfAE)+1)*sizeof(char)));
|
||||
}
|
||||
}
|
||||
}
|
||||
save_tag(stream, QLY_START_FUNCTORS);
|
||||
save_UInt(stream, LOCAL_ExportFunctorHashTableNum);
|
||||
for (i = 0; i < LOCAL_ExportFunctorHashTableSize; i++) {
|
||||
|
8
C/save.c
8
C/save.c
@ -165,9 +165,11 @@ static Int
|
||||
do_SYSTEM_ERROR_INTERNAL(yap_error_number etype, const char *msg)
|
||||
{
|
||||
CACHE_REGS
|
||||
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE+1);
|
||||
#if HAVE_SNPRINTF
|
||||
#if HAVE_STRERROR
|
||||
snprintf(LOCAL_ErrorSay,MAX_ERROR_MSG_SIZE,"%s (%s when reading %s)", msg, strerror(errno), LOCAL_FileNameBuf);
|
||||
snprintf(LOCAL_ErrorMessage,MAX_ERROR_MSG_SIZE,"%s (%s when reading %s)", msg,
|
||||
strerror(errno), LOCAL_FileNameBuf);
|
||||
#else
|
||||
snprintf(LOCAL_ErrorSay,MAX_ERROR_MSG_SIZE,"%s, (system error %d when reading %s)",msg,errno,LOCAL_FileNameBuf);
|
||||
#endif
|
||||
@ -178,7 +180,6 @@ do_SYSTEM_ERROR_INTERNAL(yap_error_number etype, const char *msg)
|
||||
sprintf(LOCAL_ErrorSay,"%s, (system error %d when reading %s)",msg,errno,LOCAL_FileNameBuf);
|
||||
#endif
|
||||
#endif
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
LOCAL_Error_TYPE = etype;
|
||||
return -1;
|
||||
}
|
||||
@ -685,8 +686,7 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
|
||||
}
|
||||
}
|
||||
if (strcmp(pp, msg) != 0) {
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
strncpy(LOCAL_ErrorMessage, "saved state ", MAX_ERROR_MSG_SIZE);
|
||||
strncpy(LOCAL_ErrorMessage, "saved state ", MAX_ERROR_MSG_SIZE-1);
|
||||
strncat(LOCAL_ErrorMessage, LOCAL_FileNameBuf, MAX_ERROR_MSG_SIZE-1);
|
||||
strncat(LOCAL_ErrorMessage, " failed to match version ID", MAX_ERROR_MSG_SIZE-1);
|
||||
LOCAL_Error_TYPE = SYSTEM_ERROR_SAVED_STATE;
|
||||
|
584
C/scanner.c
584
C/scanner.c
File diff suppressed because it is too large
Load Diff
27
C/signals.c
27
C/signals.c
@ -25,18 +25,18 @@ static char SccsId[] = "%W% %G%";
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if _WIN32
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include "Yatom.h"
|
||||
#include "YapHeap.h"
|
||||
#include "Yatom.h"
|
||||
#include "eval.h"
|
||||
#include "yapio.h"
|
||||
#ifdef TABLING
|
||||
#include "tab.macros.h"
|
||||
#endif /* TABLING */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
@ -64,6 +64,10 @@ static yap_signals InteractSIGINT(int ch) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
/* abort computation */
|
||||
#if PUSH_REGS
|
||||
// restore_absmi_regs(&Yap_standard_regs);
|
||||
#endif
|
||||
siglongjmp(LOCAL_RestartEnv, 4);
|
||||
return YAP_ABORT_SIGNAL;
|
||||
case 'b':
|
||||
/* continue */
|
||||
@ -183,35 +187,32 @@ inline static bool get_signal(yap_signals sig USES_REGS) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Yap_DisableInterrupts(int wid)
|
||||
{
|
||||
bool Yap_DisableInterrupts(int wid) {
|
||||
LOCAL_InterruptsDisabled = true;
|
||||
YAPEnterCriticalSection();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Yap_EnableInterrupts(int wid)
|
||||
{
|
||||
bool Yap_EnableInterrupts(int wid) {
|
||||
LOCAL_InterruptsDisabled = false;
|
||||
YAPLeaveCriticalSection();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Function called to handle delayed interrupts.
|
||||
*/
|
||||
int Yap_HandleInterrupts(void) {
|
||||
bool Yap_HandleSIGINT(void) {
|
||||
CACHE_REGS
|
||||
yap_signals sig;
|
||||
|
||||
if (get_signal(YAP_INT_SIGNAL PASS_REGS)) {
|
||||
do {
|
||||
if ((sig = ProcessSIGINT()) != YAP_NO_SIGNAL)
|
||||
do_signal(worker_id, sig PASS_REGS);
|
||||
LOCAL_PrologMode &= ~InterruptMode;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return true;
|
||||
} while (get_signal(YAP_INT_SIGNAL PASS_REGS));
|
||||
return false;
|
||||
}
|
||||
|
||||
static Int p_creep(USES_REGS1) {
|
||||
|
32
C/stack.c
32
C/stack.c
@ -1074,40 +1074,40 @@ bool set_clause_info(yamop *codeptr, PredEntry *pp) {
|
||||
Term ts[2];
|
||||
void *begin;
|
||||
if (pp->ArityOfPE == 0) {
|
||||
LOCAL_ActiveError.prologPredName = (Atom)pp->FunctorOfPred;
|
||||
LOCAL_ActiveError.prologPredArity = 0;
|
||||
LOCAL_ActiveError->prologPredName = (Atom)pp->FunctorOfPred;
|
||||
LOCAL_ActiveError->prologPredArity = 0;
|
||||
} else {
|
||||
LOCAL_ActiveError.prologPredName = NameOfFunctor(pp->FunctorOfPred);
|
||||
LOCAL_ActiveError.prologPredArity = pp->ArityOfPE;
|
||||
LOCAL_ActiveError->prologPredName = NameOfFunctor(pp->FunctorOfPred);
|
||||
LOCAL_ActiveError->prologPredArity = pp->ArityOfPE;
|
||||
}
|
||||
LOCAL_ActiveError.prologPredModule =
|
||||
LOCAL_ActiveError->prologPredModule =
|
||||
(pp->ModuleOfPred ? pp->ModuleOfPred : TermProlog);
|
||||
LOCAL_ActiveError.prologPredFile = pp->src.OwnerFile;
|
||||
LOCAL_ActiveError->prologPredFile = pp->src.OwnerFile;
|
||||
if (codeptr->opc == UNDEF_OPCODE) {
|
||||
LOCAL_ActiveError.prologPredFirstLine = 0;
|
||||
LOCAL_ActiveError.prologPredLine = 0;
|
||||
LOCAL_ActiveError.prologPredLastLine = 0;
|
||||
LOCAL_ActiveError->prologPredFirstLine = 0;
|
||||
LOCAL_ActiveError->prologPredLine = 0;
|
||||
LOCAL_ActiveError->prologPredLastLine = 0;
|
||||
return true;
|
||||
} else if (pp->cs.p_code.NOfClauses) {
|
||||
if ((LOCAL_ActiveError.prologPredCl =
|
||||
if ((LOCAL_ActiveError->prologPredCl =
|
||||
find_code_in_clause(pp, codeptr, &begin, NULL)) <= 0) {
|
||||
LOCAL_ActiveError.prologPredLine = 0;
|
||||
LOCAL_ActiveError->prologPredLine = 0;
|
||||
} else {
|
||||
LOCAL_ActiveError.prologPredLine = IntegerOfTerm(clause_loc(begin, pp));
|
||||
LOCAL_ActiveError->prologPredLine = IntegerOfTerm(clause_loc(begin, pp));
|
||||
}
|
||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||
LOCAL_ActiveError.prologPredFirstLine = IntegerOfTerm(
|
||||
LOCAL_ActiveError->prologPredFirstLine = IntegerOfTerm(
|
||||
ts[0] = clause_loc(
|
||||
ClauseCodeToLogUpdClause(pp->cs.p_code.FirstClause), pp));
|
||||
LOCAL_ActiveError.prologPredLastLine = IntegerOfTerm(
|
||||
LOCAL_ActiveError->prologPredLastLine = IntegerOfTerm(
|
||||
ts[1] = clause_loc(ClauseCodeToLogUpdClause(pp->cs.p_code.LastClause),
|
||||
pp));
|
||||
|
||||
} else {
|
||||
LOCAL_ActiveError.prologPredFirstLine = IntegerOfTerm(
|
||||
LOCAL_ActiveError->prologPredFirstLine = IntegerOfTerm(
|
||||
ts[0] = clause_loc(
|
||||
ClauseCodeToStaticClause(pp->cs.p_code.FirstClause), pp));
|
||||
LOCAL_ActiveError.prologPredLastLine = IntegerOfTerm(
|
||||
LOCAL_ActiveError->prologPredLastLine = IntegerOfTerm(
|
||||
ts[1] = clause_loc(ClauseCodeToStaticClause(pp->cs.p_code.LastClause),
|
||||
pp));
|
||||
}
|
||||
|
33
C/stdpreds.c
33
C/stdpreds.c
@ -1099,24 +1099,25 @@ void Yap_show_statistics(void) {
|
||||
#endif
|
||||
frag = (100.0 * (heap_space_taken - HeapUsed)) / heap_space_taken;
|
||||
|
||||
fprintf(stderr, "Code Space: %ld (%ld bytes needed, %ld bytes used, "
|
||||
fprintf(stderr, "Code Space: " UInt_FORMAT " (" UInt_FORMAT
|
||||
" bytes needed, " UInt_FORMAT " bytes used, "
|
||||
"fragmentation %.3f%%).\n",
|
||||
(unsigned long int)(Unsigned(H0) - Unsigned(Yap_HeapBase)),
|
||||
(unsigned long int)(Unsigned(HeapTop) - Unsigned(Yap_HeapBase)),
|
||||
(unsigned long int)(HeapUsed), frag);
|
||||
fprintf(stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n",
|
||||
(unsigned long int)(sizeof(CELL) * (LCL0 - H0)),
|
||||
(unsigned long int)(sizeof(CELL) * (HR - H0)),
|
||||
(unsigned long int)(sizeof(CELL) * (LCL0 - ASP)));
|
||||
fprintf(stderr, "Trail Space: %ld (%ld used).\n",
|
||||
(unsigned long int)(sizeof(tr_fr_ptr) * (Unsigned(LOCAL_TrailTop) -
|
||||
Unsigned(LOCAL_TrailBase))),
|
||||
(unsigned long int)(sizeof(tr_fr_ptr) *
|
||||
(Unsigned(TR) - Unsigned(LOCAL_TrailBase))));
|
||||
fprintf(stderr, "Runtime: %lds.\n", (unsigned long int)(runtime(PASS_REGS1)));
|
||||
fprintf(stderr, "Cputime: %lds.\n", (unsigned long int)(Yap_cputime()));
|
||||
Unsigned(H0) - Unsigned(Yap_HeapBase),
|
||||
Unsigned(HeapTop) - Unsigned(Yap_HeapBase), Unsigned(HeapUsed), frag);
|
||||
fprintf(stderr, "Stack Space: " UInt_FORMAT " (" UInt_FORMAT
|
||||
" for Global, " UInt_FORMAT " for local).\n",
|
||||
Unsigned(sizeof(CELL) * (LCL0 - H0)),
|
||||
Unsigned(sizeof(CELL) * (HR - H0)),
|
||||
Unsigned(sizeof(CELL) * (LCL0 - ASP)));
|
||||
fprintf(
|
||||
stderr, "Trail Space: " UInt_FORMAT " (" UInt_FORMAT " used).\n",
|
||||
Unsigned(sizeof(tr_fr_ptr) *
|
||||
(Unsigned(LOCAL_TrailTop) - Unsigned(LOCAL_TrailBase))),
|
||||
Unsigned(sizeof(tr_fr_ptr) * (Unsigned(TR) - Unsigned(LOCAL_TrailBase))));
|
||||
fprintf(stderr, "Runtime: " UInt_FORMAT "\n", runtime(PASS_REGS1));
|
||||
fprintf(stderr, "Cputime: " UInt_FORMAT "\n", Yap_cputime());
|
||||
|
||||
fprintf(stderr, "Walltime: " UInt_F ".\n", (UInt)(Yap_walltime() / 1000));
|
||||
fprintf(stderr, "Walltime: %" PRIu64 ".\n", Yap_walltime() / (UInt)1000);
|
||||
}
|
||||
|
||||
static Int p_statistics_heap_max(USES_REGS1) {
|
||||
|
356
C/text.c
356
C/text.c
@ -37,75 +37,136 @@ inline static size_t min_size(size_t i, size_t j) { return (i < j ? i : j); }
|
||||
|
||||
#define MAX_PATHNAME 2048
|
||||
|
||||
struct mblock {
|
||||
struct mblock *prev, *next;
|
||||
int lvl;
|
||||
size_t sz;
|
||||
};
|
||||
|
||||
typedef struct TextBuffer_manager {
|
||||
void *buf, *ptr;
|
||||
size_t sz;
|
||||
struct TextBuffer_manager *prev;
|
||||
struct mblock *first[16];
|
||||
struct mblock *last[16];
|
||||
int lvl;
|
||||
} text_buffer_t;
|
||||
|
||||
int lvl;
|
||||
int push_text_stack(USES_REGS1) { return LOCAL_TextBuffer->lvl++; }
|
||||
|
||||
/**
|
||||
* TextBuffer is allocated as a chain of blocks, They area
|
||||
* recovered at the end if the translation.
|
||||
*/
|
||||
INLINE_ONLY inline int init_alloc(int line) {
|
||||
// printf("l=%d\n",lvl);
|
||||
if (lvl )
|
||||
return;
|
||||
while (LOCAL_TextBuffer->prev ) {
|
||||
struct TextBuffer_manager *old = LOCAL_TextBuffer;
|
||||
LOCAL_TextBuffer = LOCAL_TextBuffer->prev;
|
||||
free(old);
|
||||
int pop_text_stack(int i) {
|
||||
int lvl = LOCAL_TextBuffer->lvl;
|
||||
while (lvl > i) {
|
||||
struct mblock *p = LOCAL_TextBuffer->first[lvl];
|
||||
while (p) {
|
||||
struct mblock *np = p->next;
|
||||
free(p);
|
||||
p = np;
|
||||
}
|
||||
LOCAL_TextBuffer->sz = (YAP_FILENAME_MAX + 1);
|
||||
LOCAL_TextBuffer->buf = LOCAL_TextBuffer->ptr = (void *)(LOCAL_TextBuffer + 1 );
|
||||
return lvl++;
|
||||
LOCAL_TextBuffer->first[lvl] = NULL;
|
||||
LOCAL_TextBuffer->last[lvl] = NULL;
|
||||
lvl--;
|
||||
}
|
||||
LOCAL_TextBuffer->lvl = lvl;
|
||||
return lvl;
|
||||
}
|
||||
|
||||
INLINE_ONLY inline int mark_stack(void) {
|
||||
return lvl; }
|
||||
|
||||
INLINE_ONLY inline void restore_stack(int i ) {lvl = i;} \
|
||||
INLINE_ONLY inline void unprotect_stack(int i) {
|
||||
lvl = i;}
|
||||
|
||||
static void *Malloc(size_t sz USES_REGS) {
|
||||
sz = ALIGN_BY_TYPE(sz, CELL);
|
||||
void *o = LOCAL_TextBuffer->ptr;
|
||||
if ((char*)LOCAL_TextBuffer->ptr+sz>(char*)LOCAL_TextBuffer->buf + LOCAL_TextBuffer->sz) {
|
||||
size_t nsz = max(sz*4/3,YAP_FILENAME_MAX + 1);
|
||||
struct TextBuffer_manager *new = malloc(sizeof(struct TextBuffer_manager)+nsz);
|
||||
new->prev = LOCAL_TextBuffer;
|
||||
new->buf = (struct TextBuffer_manager *)new+1;
|
||||
new->ptr = new->buf + sz;
|
||||
new->sz = nsz;
|
||||
LOCAL_TextBuffer= new;
|
||||
return new->buf;
|
||||
void *protected_pop_text_stack(int i, void *protected, bool tmp,
|
||||
size_t sz USES_REGS) {
|
||||
void *out = protected;
|
||||
int lvl = LOCAL_TextBuffer->lvl;
|
||||
while (lvl > i) {
|
||||
struct mblock *p = LOCAL_TextBuffer->first[lvl];
|
||||
while (p) {
|
||||
struct mblock *np = p->next;
|
||||
if (p + 1 == protected) {
|
||||
if (tmp)
|
||||
out = LOCAL_FileNameBuf;
|
||||
else
|
||||
out = p;
|
||||
memcpy(out, protected, sz);
|
||||
} else {
|
||||
free(p);
|
||||
}
|
||||
LOCAL_TextBuffer->ptr += sz;
|
||||
return o;
|
||||
p = np;
|
||||
}
|
||||
LOCAL_TextBuffer->first[lvl] = NULL;
|
||||
LOCAL_TextBuffer->last[lvl] = NULL;
|
||||
lvl--;
|
||||
}
|
||||
LOCAL_TextBuffer->lvl = lvl;
|
||||
return out;
|
||||
}
|
||||
|
||||
void *Yap_InitTextAllocator( void )
|
||||
{
|
||||
struct TextBuffer_manager *new = malloc(sizeof(struct TextBuffer_manager)\
|
||||
+MAX_PATHNAME*2 );
|
||||
new->prev = NULL;
|
||||
new->ptr = new->buf = (struct TextBuffer_manager *)new+1;
|
||||
new->sz = MAX_PATHNAME*2;
|
||||
LOCAL_TextBuffer = new;
|
||||
new->lvl = 0;
|
||||
// void pop_text_stack(int i) { LOCAL_TextBuffer->lvl = i; }
|
||||
|
||||
void *Malloc(size_t sz USES_REGS) {
|
||||
int lvl = LOCAL_TextBuffer->lvl;
|
||||
if (sz == 0)
|
||||
sz = 1024;
|
||||
sz = ALIGN_BY_TYPE(sz + sizeof(struct mblock), CELL);
|
||||
struct mblock *o = malloc(sz);
|
||||
o->prev = LOCAL_TextBuffer->last[lvl];
|
||||
if (o->prev) {
|
||||
o->prev->next = o;
|
||||
}
|
||||
if (LOCAL_TextBuffer->first[lvl]) {
|
||||
LOCAL_TextBuffer->last[lvl] = o;
|
||||
} else {
|
||||
LOCAL_TextBuffer->first[lvl] = LOCAL_TextBuffer->last[lvl] = o;
|
||||
}
|
||||
o->next = NULL;
|
||||
o->sz = sz;
|
||||
o->lvl = lvl;
|
||||
return o + 1;
|
||||
}
|
||||
|
||||
void *Realloc(void *pt, size_t sz USES_REGS) {
|
||||
sz = ALIGN_BY_TYPE(sz + sizeof(struct mblock), CELL);
|
||||
struct mblock *old = pt, *o;
|
||||
old--;
|
||||
int lvl = old->lvl;
|
||||
o = realloc(old, sz);
|
||||
if (o->prev)
|
||||
o->prev->next = o;
|
||||
if (o->next)
|
||||
o->next->prev = o;
|
||||
if (LOCAL_TextBuffer->first[lvl] == old) {
|
||||
LOCAL_TextBuffer->first[lvl] = o;
|
||||
}
|
||||
if (LOCAL_TextBuffer->last[lvl] == old) {
|
||||
LOCAL_TextBuffer->last[lvl] = o;
|
||||
}
|
||||
return o + 1;
|
||||
}
|
||||
|
||||
void Free(void *pt USES_REGS) {
|
||||
struct mblock *o = pt;
|
||||
o--;
|
||||
if (o->prev)
|
||||
o->prev->next = o->next;
|
||||
if (o->next)
|
||||
o->next->prev = o->prev;
|
||||
int lvl = o->lvl;
|
||||
if (LOCAL_TextBuffer->first[lvl] == o) {
|
||||
if (LOCAL_TextBuffer->last[lvl] == o) {
|
||||
LOCAL_TextBuffer->first[lvl] = LOCAL_TextBuffer->last[lvl] = NULL;
|
||||
}
|
||||
LOCAL_TextBuffer->first[lvl] = o->next;
|
||||
} else if (LOCAL_TextBuffer->last[lvl] == o) {
|
||||
LOCAL_TextBuffer->last[lvl] = o->prev;
|
||||
}
|
||||
free(o);
|
||||
}
|
||||
|
||||
void *Yap_InitTextAllocator(void) {
|
||||
struct TextBuffer_manager *new = calloc(sizeof(struct TextBuffer_manager), 1);
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static size_t MaxTmp(USES_REGS1) {
|
||||
|
||||
return ((char*)LOCAL_TextBuffer->buf + LOCAL_TextBuffer->sz) - (char*)LOCAL_TextBuffer->ptr;
|
||||
return ((char *)LOCAL_TextBuffer->buf + LOCAL_TextBuffer->sz) -
|
||||
(char *)LOCAL_TextBuffer->ptr;
|
||||
}
|
||||
|
||||
static Term Globalize(Term v USES_REGS) {
|
||||
@ -170,15 +231,7 @@ static Int SkipListCodes(unsigned char **bufp, Term *l, Term **tailp,
|
||||
(*atoms)++;
|
||||
if (*atoms < length) {
|
||||
*tailp = l;
|
||||
return -TYPE_ERROR_NUMBER;
|
||||
}
|
||||
if (IsWideAtom(AtomOfTerm(hd))) {
|
||||
int ch;
|
||||
if ((RepAtom(AtomOfTerm(hd))->WStrOfAE)[1] != '\0') {
|
||||
length = -REPRESENTATION_ERROR_CHARACTER;
|
||||
}
|
||||
ch = RepAtom(AtomOfTerm(hd))->WStrOfAE[0];
|
||||
*wide = true;
|
||||
return -REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||
} else {
|
||||
AtomEntry *ae = RepAtom(AtomOfTerm(hd));
|
||||
if ((ae->StrOfAE)[1] != '\0') {
|
||||
@ -191,10 +244,10 @@ static Int SkipListCodes(unsigned char **bufp, Term *l, Term **tailp,
|
||||
} else if (IsIntegerTerm(hd)) {
|
||||
ch = IntegerOfTerm(hd);
|
||||
if (*atoms)
|
||||
length = -TYPE_ERROR_ATOM;
|
||||
length = -REPRESENTATION_ERROR_CHARACTER;
|
||||
else if (ch < 0) {
|
||||
*tailp = l;
|
||||
length = -DOMAIN_ERROR_NOT_LESS_THAN_ZERO;
|
||||
length = -REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||
} else {
|
||||
*wide |= ch > 0x80;
|
||||
}
|
||||
@ -276,7 +329,6 @@ static unsigned char *to_buffer(unsigned char *buf, Term t, seq_tv_t *inp,
|
||||
n = SkipListCodes(&bufc, &t, &r, atoms, widep, inp PASS_REGS);
|
||||
if (n < 0) {
|
||||
LOCAL_Error_TYPE = -n;
|
||||
LOCAL_Error_Term = *r;
|
||||
return NULL;
|
||||
}
|
||||
*lenp = n;
|
||||
@ -350,7 +402,6 @@ unsigned char *Yap_readText(seq_tv_t *inp, size_t *lengp) {
|
||||
YAP_STRING_BIG)) == inp->type) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_NUMBER;
|
||||
}
|
||||
LOCAL_Error_Term = inp->val.t;
|
||||
}
|
||||
}
|
||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR)
|
||||
@ -360,37 +411,32 @@ unsigned char *Yap_readText(seq_tv_t *inp, size_t *lengp) {
|
||||
// this is a term, extract to a buffer, and representation is wide
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
Atom at = AtomOfTerm(inp->val.t);
|
||||
if (IsWideAtom(at)) {
|
||||
inp->val.w = at->WStrOfAE;
|
||||
return wchar2utf8(inp, lengp);
|
||||
} else {
|
||||
inp->val.c = at->StrOfAE;
|
||||
return latin2utf8(inp, lengp);
|
||||
}
|
||||
if (lengp)
|
||||
*lengp = strlen_utf8(at->UStrOfAE);
|
||||
return at->UStrOfAE;
|
||||
}
|
||||
if (IsStringTerm(inp->val.t) && inp->type & YAP_STRING_STRING) {
|
||||
// this is a term, extract to a buffer, and representation is wide
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
if (lengp)
|
||||
*lengp = strlen_utf8(UStringOfTerm(inp->val.t));
|
||||
return (unsigned char *)UStringOfTerm(inp->val.t);
|
||||
}
|
||||
if (((inp->type & (YAP_STRING_CODES | YAP_STRING_ATOMS)) ==
|
||||
(YAP_STRING_CODES | YAP_STRING_ATOMS)) &&
|
||||
IsPairOrNilTerm(inp->val.t)) {
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
return inp->val.uc =
|
||||
Yap_ListToBuffer(s0, inp->val.t, inp, &wide, lengp PASS_REGS);
|
||||
return Yap_ListToBuffer(s0, inp->val.t, inp, &wide, lengp PASS_REGS);
|
||||
// this is a term, extract to a sfer, and representation is wide
|
||||
}
|
||||
if (inp->type & YAP_STRING_CODES && IsPairOrNilTerm(inp->val.t)) {
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
return inp->val.uc = Yap_ListOfCodesToBuffer(s0, inp->val.t, inp, &wide,
|
||||
lengp PASS_REGS);
|
||||
return Yap_ListOfCodesToBuffer(s0, inp->val.t, inp, &wide, lengp PASS_REGS);
|
||||
// this is a term, extract to a sfer, and representation is wide
|
||||
}
|
||||
if (inp->type & YAP_STRING_ATOMS && IsPairOrNilTerm(inp->val.t)) {
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
return inp->val.uc = Yap_ListOfAtomsToBuffer(s0, inp->val.t, inp, &wide,
|
||||
lengp PASS_REGS);
|
||||
return Yap_ListOfAtomsToBuffer(s0, inp->val.t, inp, &wide, lengp PASS_REGS);
|
||||
// this is a term, extract to a buffer, and representation is wide
|
||||
}
|
||||
if (inp->type & YAP_STRING_INT && IsIntegerTerm(inp->val.t)) {
|
||||
@ -406,22 +452,27 @@ unsigned char *Yap_readText(seq_tv_t *inp, size_t *lengp) {
|
||||
AUX_ERROR(inp->val.t, 2 * MaxTmp(PASS_REGS1), s, char);
|
||||
}
|
||||
*lengp = strlen(s);
|
||||
Malloc(*lengp);
|
||||
return inp->val.uc = (unsigned char *)s;
|
||||
return (unsigned char *)s;
|
||||
}
|
||||
if (inp->type & YAP_STRING_FLOAT && IsFloatTerm(inp->val.t)) {
|
||||
char *s;
|
||||
size_t sz = 1024;
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
if (s0)
|
||||
if (s0) {
|
||||
s = (char *)s0;
|
||||
else
|
||||
s = Malloc(0);
|
||||
sz = strlen(s);
|
||||
} else
|
||||
s = Malloc(sz);
|
||||
if (!s)
|
||||
AUX_ERROR(inp->val.t, MaxTmp(PASS_REGS1), s, char);
|
||||
if (!Yap_FormatFloat(FloatOfTerm(inp->val.t), &s, MaxTmp() - 1)) {
|
||||
AUX_ERROR(inp->val.t, 2 * MaxTmp(PASS_REGS1), s, char);
|
||||
while (!Yap_FormatFloat(FloatOfTerm(inp->val.t), &s, sz - 1)) {
|
||||
if (s0) {
|
||||
s = Malloc(sz = 1024);
|
||||
s0 = NULL;
|
||||
} else
|
||||
s = Realloc(s, sz + 1024);
|
||||
}
|
||||
*lengp = strlen(s);
|
||||
Malloc(*lengp);
|
||||
return inp->val.uc = (unsigned char *)s;
|
||||
}
|
||||
#if USE_GMP
|
||||
@ -526,19 +577,20 @@ static Term write_atoms(void *s0, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
|
||||
unsigned char *s = s0, *lim = s + strnlen((char *)s, max);
|
||||
unsigned char *cp = s;
|
||||
wchar_t w[2];
|
||||
w[1] = '\0';
|
||||
unsigned char w[10], *wp = w;
|
||||
LOCAL_TERM_ERROR(t, 2 * (lim - s));
|
||||
while (cp < lim && *cp) {
|
||||
utf8proc_int32_t chr;
|
||||
CELL *cl;
|
||||
cp += get_utf8(cp, -1, &chr);
|
||||
if (chr == '\0')
|
||||
s += get_utf8(s, 1, &chr);
|
||||
if (chr == '\0') {
|
||||
wp[0] = '\0';
|
||||
break;
|
||||
w[0] = chr;
|
||||
}
|
||||
wp += put_utf8(w, chr);
|
||||
cl = HR;
|
||||
HR += 2;
|
||||
cl[0] = MkAtomTerm(Yap_LookupMaybeWideAtom(w));
|
||||
cl[0] = MkAtomTerm(Yap_ULookupAtom(w));
|
||||
cl[1] = AbsPair(HR);
|
||||
sz++;
|
||||
if (sz == max)
|
||||
@ -574,8 +626,7 @@ static Term write_codes(void *s0, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
|
||||
unsigned char *s = s0, *lim = s + strlen((char *)s);
|
||||
unsigned char *cp = s;
|
||||
wchar_t w[2];
|
||||
w[1] = '\0';
|
||||
|
||||
LOCAL_TERM_ERROR(t, 2 * (lim - s));
|
||||
while (*cp) {
|
||||
utf8proc_int32_t chr;
|
||||
@ -607,34 +658,18 @@ static Term write_codes(void *s0, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
}
|
||||
|
||||
static Atom write_atom(void *s0, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
{
|
||||
unsigned char *s = s0;
|
||||
utf8proc_int32_t chr;
|
||||
while (*s && get_utf8(s, -1, &chr) == 1)
|
||||
s++;
|
||||
if (*s == '\0')
|
||||
return out->val.a = Yap_LookupAtom((char *)s0);
|
||||
s = s0;
|
||||
size_t l = strlen(s0);
|
||||
wchar_t *wbuf = Malloc(sizeof(wchar_t) * ((l + 1))), *wptr = wbuf;
|
||||
Atom at;
|
||||
if (!wbuf)
|
||||
return NULL;
|
||||
while (*s) {
|
||||
utf8proc_int32_t chr;
|
||||
int off = get_utf8(s, -1, &chr);
|
||||
if (off < 0) {
|
||||
s++;
|
||||
continue;
|
||||
int32_t ch;
|
||||
if (leng == 0) {
|
||||
return Yap_LookupAtom("");
|
||||
}
|
||||
s++;
|
||||
*wptr++ = chr;
|
||||
}
|
||||
*wptr++ = '\0';
|
||||
|
||||
at = Yap_LookupMaybeWideAtom(wbuf);
|
||||
out->val.a = at;
|
||||
return at;
|
||||
if (strlen_utf8(s0) <= leng) {
|
||||
return Yap_LookupAtom(s0);
|
||||
} else {
|
||||
size_t n = get_utf8(s, 1, &ch);
|
||||
unsigned char *buf = Malloc(n + 1);
|
||||
memcpy(buf, s0, n + 1);
|
||||
return Yap_ULookupAtom(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -711,31 +746,34 @@ static size_t write_length(const unsigned char *s0, seq_tv_t *out,
|
||||
return leng;
|
||||
}
|
||||
|
||||
static Term write_number(unsigned char *s, seq_tv_t *out, int size USES_REGS) {
|
||||
static Term write_number(unsigned char *s, seq_tv_t *out, int size,
|
||||
bool error_on USES_REGS) {
|
||||
Term t;
|
||||
int i = mark_stack();
|
||||
t = Yap_StringToNumberTerm((char *)s, &out->enc);
|
||||
restore_stack(i);
|
||||
int i = push_text_stack();
|
||||
t = Yap_StringToNumberTerm((char *)s, &out->enc, error_on);
|
||||
pop_text_stack(i);
|
||||
return t;
|
||||
}
|
||||
|
||||
static Term string_to_term(void *s, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
Term o;
|
||||
int i = mark_stack();
|
||||
o = out->val.t =
|
||||
Yap_StringToTerm(s, strlen(s) + 1, &out->enc, GLOBAL_MaxPriority, NULL);
|
||||
restore_stack(i);
|
||||
o = out->val.t = Yap_BufferToTerm(s, strlen(s) + 1, TermNil);
|
||||
return o;
|
||||
}
|
||||
|
||||
bool write_Text(unsigned char *inp, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
/* we know what the term is */
|
||||
if (out->type == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (out->type & YAP_STRING_TERM) {
|
||||
if ((out->val.t = string_to_term(inp, out, leng PASS_REGS)) != 0L)
|
||||
return out->val.t != 0;
|
||||
}
|
||||
if (out->type & (YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG)) {
|
||||
if ((out->val.t = write_number(inp, out, leng PASS_REGS)) != 0L) {
|
||||
if ((out->val.t = write_number(
|
||||
inp, out, leng, !(out->type & YAP_STRING_ATOM)PASS_REGS)) != 0L) {
|
||||
// Yap_DebugPlWriteln(out->val.t);
|
||||
|
||||
return true;
|
||||
@ -745,7 +783,7 @@ bool write_Text(unsigned char *inp, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
return false;
|
||||
}
|
||||
if (out->type & (YAP_STRING_ATOM)) {
|
||||
if (write_atom(inp, out, leng PASS_REGS) != NIL) {
|
||||
if ((out->val.a = write_atom(inp, out, leng PASS_REGS)) != NIL) {
|
||||
Atom at = out->val.a;
|
||||
if (at && (out->type & YAP_STRING_OUTPUT_TERM))
|
||||
out->val.t = MkAtomTerm(at);
|
||||
@ -786,10 +824,10 @@ bool write_Text(unsigned char *inp, seq_tv_t *out, size_t leng USES_REGS) {
|
||||
// Yap_DebugPlWriteln(out->val.t);
|
||||
return out->val.a != NULL;
|
||||
case YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG:
|
||||
out->val.t = write_number(inp, out, leng PASS_REGS);
|
||||
out->val.t = write_number(inp, out, leng, true PASS_REGS);
|
||||
// Yap_DebugPlWriteln(out->val.t);
|
||||
return out->val.t != 0;
|
||||
default: {}
|
||||
default: { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -825,9 +863,8 @@ bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
|
||||
bool rc;
|
||||
|
||||
size_t leng;
|
||||
int l = init_alloc(__LINE__);
|
||||
/*
|
||||
f//printf(stderr, "[ %d ", n++) ;
|
||||
f//printfmark(stderr, "[ %d ", n++) ;
|
||||
if (inp->type & (YAP_STRING_TERM|YAP_STRING_ATOM|YAP_STRING_ATOMS_CODES
|
||||
|YAP_STRING_STRING))
|
||||
//Yap_DebugPlWriteln(inp->val.t);
|
||||
@ -850,26 +887,22 @@ bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
|
||||
}
|
||||
|
||||
if (!buf) {
|
||||
unprotect_stack(0);
|
||||
return 0L;
|
||||
}
|
||||
if (out->type & (YAP_STRING_UPCASE | YAP_STRING_DOWNCASE)) {
|
||||
if (out->type & YAP_STRING_UPCASE) {
|
||||
if (!upcase(buf, out)) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (out->type & YAP_STRING_DOWNCASE) {
|
||||
if (!downcase(buf, out)) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = write_Text(buf, out, leng PASS_REGS);
|
||||
unprotect_stack(l);
|
||||
/* fprintf(stderr, " -> ");
|
||||
if (!rc) fprintf(stderr, "NULL");
|
||||
else if (out->type &
|
||||
@ -899,8 +932,8 @@ static int cmp_Text(const unsigned char *s1, const unsigned char *s2, int l) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char *concat(int n, unsigned char *sv[] USES_REGS) {
|
||||
char *buf;
|
||||
static unsigned char *concat(int n, void *sv[] USES_REGS) {
|
||||
void *buf;
|
||||
unsigned char *buf0;
|
||||
size_t room = 0;
|
||||
int i;
|
||||
@ -909,11 +942,14 @@ static unsigned char *concat(int n, unsigned char *sv[] USES_REGS) {
|
||||
room += strlen((char *)sv[i]);
|
||||
}
|
||||
buf = Malloc(room + 1);
|
||||
buf0 = (unsigned char *)buf;
|
||||
buf0 = buf;
|
||||
for (i = 0; i < n; i++) {
|
||||
char *s = (char *)sv[i];
|
||||
buf = strcpy(buf, s);
|
||||
buf += strlen(s);
|
||||
#if _WIN32 || defined(__ANDROID__)
|
||||
strcpy(buf, sv[i]);
|
||||
buf = (char *)buf + strlen(buf);
|
||||
#else
|
||||
buf = stpcpy(buf, sv[i]);
|
||||
#endif
|
||||
}
|
||||
return buf0;
|
||||
}
|
||||
@ -935,14 +971,13 @@ static void *slice(size_t min, size_t max, unsigned char *buf USES_REGS) {
|
||||
//
|
||||
// Out must be an atom or a string
|
||||
bool Yap_Concat_Text(int tot, seq_tv_t inp[], seq_tv_t *out USES_REGS) {
|
||||
unsigned char **bufv;
|
||||
void **bufv;
|
||||
unsigned char *buf;
|
||||
size_t leng;
|
||||
int i;
|
||||
int l = init_alloc(__LINE__);
|
||||
size_t leng;
|
||||
|
||||
bufv = Malloc(tot * sizeof(unsigned char *));
|
||||
if (!bufv) {
|
||||
unprotect_stack(0);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < tot; i++) {
|
||||
@ -950,14 +985,12 @@ bool Yap_Concat_Text(int tot, seq_tv_t inp[], seq_tv_t *out USES_REGS) {
|
||||
unsigned char *nbuf = Yap_readText(inp + i, &leng PASS_REGS);
|
||||
|
||||
if (!nbuf) {
|
||||
unprotect_stack(0);
|
||||
return NULL;
|
||||
}
|
||||
bufv[i] = nbuf;
|
||||
}
|
||||
buf = concat(tot, bufv PASS_REGS);
|
||||
bool rc = write_Text(buf, out, leng PASS_REGS);
|
||||
unprotect_stack(l);
|
||||
bool rc = write_Text(buf, out, strlen_utf8(buf) PASS_REGS);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -965,12 +998,11 @@ bool Yap_Concat_Text(int tot, seq_tv_t inp[], seq_tv_t *out USES_REGS) {
|
||||
bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||
seq_tv_t outv[] USES_REGS) {
|
||||
unsigned char *buf;
|
||||
int l = init_alloc(__LINE__);
|
||||
size_t l;
|
||||
|
||||
inp->type |= YAP_STRING_IN_TMP;
|
||||
buf = Yap_readText(inp, &l PASS_REGS);
|
||||
if (!buf) {
|
||||
unprotect_stack(0);
|
||||
|
||||
return false;
|
||||
}
|
||||
if (!cuts) {
|
||||
@ -981,11 +1013,9 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||
if (outv[0].val.t) {
|
||||
buf0 = Yap_readText(outv, &l0 PASS_REGS);
|
||||
if (!buf0) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
if (cmp_Text(buf, buf0, l0) != 0) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
l1 = l - l0;
|
||||
@ -993,26 +1023,21 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||
buf1 = slice(l0, l, buf PASS_REGS);
|
||||
bool rc = write_Text(buf1, outv + 1, l1 PASS_REGS);
|
||||
if (!rc) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
unprotect_stack(l);
|
||||
return rc;
|
||||
} else /* if (outv[1].val.t) */ {
|
||||
buf1 = Yap_readText(outv + 1, &l1 PASS_REGS);
|
||||
if (!buf1) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
l0 = l - l1;
|
||||
if (cmp_Text(skip_utf8((const unsigned char *)buf, l0), buf1, l1) !=
|
||||
0) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
buf0 = slice(0, l0, buf PASS_REGS);
|
||||
bool rc = write_Text(buf0, outv, l0 PASS_REGS);
|
||||
unprotect_stack((rc ? 0 : l + 0));
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@ -1023,20 +1048,20 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||
next = 0;
|
||||
else
|
||||
next = cuts[i - 1];
|
||||
if (i > 0 && cuts[i] == 0)
|
||||
break;
|
||||
void *bufi = slice(next, cuts[i], buf PASS_REGS);
|
||||
if (!write_Text(bufi, outv + i, cuts[i] - next PASS_REGS)) {
|
||||
unprotect_stack(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
unprotect_stack(l);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to convert a generic text term (string, atom, list of codes, list
|
||||
of
|
||||
of<
|
||||
atoms) into a buff
|
||||
er.
|
||||
*
|
||||
@ -1055,10 +1080,7 @@ const char *Yap_TextTermToText(Term t, char *buf, size_t len, encoding_t enc) {
|
||||
inp.val.t = t;
|
||||
if (IsAtomTerm(t) && t != TermNil) {
|
||||
inp.type = YAP_STRING_ATOM;
|
||||
if (IsWideAtom(AtomOfTerm(t)))
|
||||
inp.enc = ENC_WCHAR;
|
||||
else
|
||||
inp.enc = ENC_ISO_LATIN1;
|
||||
inp.enc = ENC_ISO_UTF8;
|
||||
} else if (IsStringTerm(t)) {
|
||||
inp.type = YAP_STRING_STRING;
|
||||
inp.enc = ENC_ISO_UTF8;
|
||||
@ -1090,7 +1112,7 @@ const char *Yap_TextTermToText(Term t, char *buf, size_t len, encoding_t enc) {
|
||||
const char *Yap_PredIndicatorToUTF8String(PredEntry *ap) {
|
||||
CACHE_REGS
|
||||
Atom at;
|
||||
arity_t arity;
|
||||
arity_t arity = 0;
|
||||
Functor f;
|
||||
char *s, *smax, *s0;
|
||||
s = s0 = malloc(1024);
|
||||
|
@ -799,22 +799,12 @@ Atom export_atom(Atom at, char **hpp, char *buf, size_t len)
|
||||
ptr = (char *)AdjustSize((CELL*)ptr, buf);
|
||||
|
||||
p0 = ptr;
|
||||
if (IsWideAtom(at)) {
|
||||
wchar_t *wptr = (wchar_t *)ptr;
|
||||
*wptr++ = -1;
|
||||
sz = wcslen(RepAtom(at)->WStrOfAE);
|
||||
if (sizeof(wchar_t)*(sz+1) >= len)
|
||||
return (Atom)NULL;
|
||||
wcsncpy(wptr, RepAtom(at)->WStrOfAE, len);
|
||||
*hpp = (char *)(wptr+(sz+1));
|
||||
} else {
|
||||
*ptr++ = 0;
|
||||
sz = strlen(RepAtom(at)->StrOfAE);
|
||||
if (sz + 1 + sizeof(wchar_t) >= len)
|
||||
if (sz + 1 >= len)
|
||||
return (Atom)NULL;
|
||||
strcpy(ptr, RepAtom(at)->StrOfAE);
|
||||
*hpp = ptr+(sz+1);
|
||||
}
|
||||
return (Atom)(p0-buf);
|
||||
}
|
||||
|
||||
@ -1179,10 +1169,8 @@ addAtom(Atom t, char *buf)
|
||||
|
||||
if (!*s) {
|
||||
return Yap_LookupAtom(s+1);
|
||||
} else {
|
||||
wchar_t *w = (wchar_t *)s;
|
||||
return Yap_LookupWideAtom(w+1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static UInt
|
||||
@ -3386,19 +3374,6 @@ addAtomToHash(CELL *st, Atom at)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
if (IsWideAtom(at)) {
|
||||
wchar_t *c = RepAtom(at)->WStrOfAE;
|
||||
int ulen = wcslen(c);
|
||||
len = ulen*sizeof(wchar_t);
|
||||
if (len % CellSize == 0) {
|
||||
len /= CellSize;
|
||||
} else {
|
||||
len /= CellSize;
|
||||
len++;
|
||||
}
|
||||
st[len-1] = 0L;
|
||||
wcsncpy((wchar_t *)st, c, ulen);
|
||||
} else {
|
||||
char *c = RepAtom(at)->StrOfAE;
|
||||
int ulen = strlen(c);
|
||||
/* fix hashing over empty atom */
|
||||
@ -3413,7 +3388,6 @@ addAtomToHash(CELL *st, Atom at)
|
||||
}
|
||||
st[len-1] = 0L;
|
||||
strncpy((char *)st, c, ulen);
|
||||
}
|
||||
return st+len;
|
||||
}
|
||||
|
||||
|
37
C/write.c
37
C/write.c
@ -187,12 +187,6 @@ inline static void wrputs(char *s, StreamDesc *stream) {
|
||||
wrputc(c, stream);
|
||||
}
|
||||
|
||||
static void wrputws(wchar_t *s, wrf stream) /* writes a string */
|
||||
{
|
||||
while (*s)
|
||||
wrputc(*s++, stream);
|
||||
}
|
||||
|
||||
#ifdef USE_GMP
|
||||
|
||||
static char *ensure_space(size_t sz) {
|
||||
@ -571,9 +565,12 @@ static void write_string(const unsigned char *s,
|
||||
qt = '"';
|
||||
wrputc(qt, stream);
|
||||
do {
|
||||
ptr += get_utf8(ptr, -1, &chr);
|
||||
int delta;
|
||||
ptr += (delta = get_utf8(ptr, -1, &chr) );
|
||||
|
||||
if (chr == '\0')
|
||||
break;
|
||||
if (delta == 0) {chr = *ptr++; }
|
||||
write_quoted(chr, qt, stream);
|
||||
} while (TRUE);
|
||||
wrputc(qt, stream);
|
||||
@ -589,22 +586,7 @@ static void putAtom(Atom atom, int Quote_illegal, struct write_globs *wglb) {
|
||||
wrputblob(RepAtom(atom), Quote_illegal, wglb);
|
||||
return;
|
||||
}
|
||||
if (IsWideAtom(atom)) {
|
||||
wchar_t *ws = RepAtom(atom)->WStrOfAE;
|
||||
|
||||
if (Quote_illegal) {
|
||||
wrputc('\'', stream);
|
||||
while (*ws) {
|
||||
wchar_t ch = *ws++;
|
||||
write_quoted(ch, '\'', stream);
|
||||
}
|
||||
wrputc('\'', stream);
|
||||
} else {
|
||||
wrputws(ws, stream);
|
||||
}
|
||||
return;
|
||||
}
|
||||
s = (unsigned char *)RepAtom(atom)->StrOfAE;
|
||||
s = RepAtom(atom)->UStrOfAE;
|
||||
/* #define CRYPT_FOR_STEVE 1*/
|
||||
#ifdef CRYPT_FOR_STEVE
|
||||
if (Yap_GetValue(AtomCryptAtoms) != TermNil &&
|
||||
@ -624,7 +606,8 @@ static void putAtom(Atom atom, int Quote_illegal, struct write_globs *wglb) {
|
||||
if (Quote_illegal && !legalAtom(s)) {
|
||||
wrputc('\'', stream);
|
||||
while (*s) {
|
||||
wchar_t ch = *s++;
|
||||
int32_t ch;
|
||||
s += get_utf8(s, 1, &ch);
|
||||
write_quoted(ch, '\'', stream);
|
||||
}
|
||||
wrputc('\'', stream);
|
||||
@ -1032,7 +1015,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
}
|
||||
} else if (!wglb->Ignore_ops &&
|
||||
(Arity == 1 ||
|
||||
((atom == AtomEmptyBrackets || atom == AtomEmptyCurlyBrackets ||
|
||||
((atom == AtomEmptyBrackets || atom == AtomCurly ||
|
||||
atom == AtomEmptySquareBrackets) &&
|
||||
Yap_IsListTerm(ArgOfTerm(1, t)))) &&
|
||||
Yap_IsPosfixOp(atom, &op, &lp)) {
|
||||
@ -1067,7 +1050,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
wrputc('(', wglb->stream);
|
||||
} else if (atom == AtomEmptySquareBrackets) {
|
||||
wrputc('[', wglb->stream);
|
||||
} else if (atom == AtomEmptyCurlyBrackets) {
|
||||
} else if (atom == AtomCurly) {
|
||||
wrputc('{', wglb->stream);
|
||||
}
|
||||
lastw = separator;
|
||||
@ -1076,7 +1059,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
wrputc(')', wglb->stream);
|
||||
} else if (atom == AtomEmptySquareBrackets) {
|
||||
wrputc(']', wglb->stream);
|
||||
} else if (atom == AtomEmptyCurlyBrackets) {
|
||||
} else if (atom == AtomCurly) {
|
||||
wrputc('}', wglb->stream);
|
||||
}
|
||||
lastw = separator;
|
||||
|
@ -370,7 +370,6 @@ X_API YAP_file_type_t YAP_parse_yap_arguments(int argc, char *argv[],
|
||||
}
|
||||
} else {
|
||||
YAP_SetOutputMessage();
|
||||
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -446,13 +445,13 @@ X_API YAP_file_type_t YAP_parse_yap_arguments(int argc, char *argv[],
|
||||
break;
|
||||
case 'n':
|
||||
if (!strcmp("nosignals", p)) {
|
||||
iap->PrologShouldHandleInterrupts = FALSE;
|
||||
iap->PrologCannotHandleInterrupts = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
if (!strcmp("-nosignals", p)) {
|
||||
iap->PrologShouldHandleInterrupts = FALSE;
|
||||
iap->PrologCannotHandleInterrupts = true;
|
||||
break;
|
||||
} else if (!strncmp("-home=", p, strlen("-home="))) {
|
||||
GLOBAL_Home = p + strlen("-home=");
|
||||
|
@ -1,5 +1,3 @@
|
||||
# Sets the minimum version of CMake required to build the native
|
||||
# library. You should either keep the default value or only pass a
|
||||
# value of 3.4.0 or lower.
|
||||
|
||||
# Sets the minimum version of CMake required to build the native
|
||||
@ -8,15 +6,20 @@
|
||||
|
||||
project( YAP )
|
||||
|
||||
if (ANDROID)
|
||||
set(YAP_APP_DIR "${CMAKE_SOURCE_DIR}/../..")
|
||||
cmake_policy(VERSION 3.4)
|
||||
|
||||
else ()
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# cmake_policy(VERSION 3.4)
|
||||
|
||||
include(CMakeToolsHelpers OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(
|
||||
CMAKE_MODULE_PATH
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/cmake")
|
||||
"${CMAKE_SOURCE_DIR}/cmake"
|
||||
)
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckLibraryExists)
|
||||
@ -28,11 +31,28 @@ include(MacroOptionalFindPackage)
|
||||
include(MacroLogFeature)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include (GNUInstallDirs)
|
||||
|
||||
# Creates and names a library, sets it as either STATIC
|
||||
# or SHARED, and provides the relative paths to its source code.
|
||||
# You can define multiple libraries, and CMake builds it for you.
|
||||
# Gradle automatically packages shared libraries with your APK.
|
||||
|
||||
#cross-compilation support
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation these macro should be defined by toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library" ON)
|
||||
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
include(Prelims NO_POLICY_SCOPE)
|
||||
|
||||
@ -40,10 +60,15 @@ include(Sources NO_POLICY_SCOPE)
|
||||
|
||||
include(Model NO_POLICY_SCOPE)
|
||||
|
||||
include_directories ( utf8proc packages/myddas packages/myddas/sqlite3 )
|
||||
include_directories ( utf8proc packages/myddas packages/myddas/sqlite3/src)
|
||||
|
||||
if (ANDROID)
|
||||
include_directories ( packages/myddas/sqlite3/Android/jni/sqlite/nativehelper packages/myddas/sqlite3/Android/jni/sqlite )
|
||||
include_directories (
|
||||
packages/myddas/sqlite3/src/Android/jni/sqlite
|
||||
packages/myddas/sqlite3/src/Android/jni/sqlite/nativehelper
|
||||
)
|
||||
endif (ANDROID)
|
||||
|
||||
add_definitions(-DUSE_MYDDAS=1 -DMYDDAS_SQLITE3=1)
|
||||
|
||||
if (MYSQL_FOUND)
|
||||
@ -58,39 +83,21 @@ if (MYSQL_POSTGRES)
|
||||
add_definitions(= -DMYDDAS_POSTGRES=1)
|
||||
endif()
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
|
||||
#
|
||||
# SWIG_FOUND - set to true if SWIG is found
|
||||
# SWIG_DIR - t he directory where swig is installed
|
||||
# SWIG_EXECUTABLE - the path to the swig executable
|
||||
# SWIG_VERSION - the version number of the swig executable
|
||||
#
|
||||
|
||||
#
|
||||
set (SWIG_SOURCES ${CMAKE_SOURCE_DIR}/packages/swig/yap.i)
|
||||
set (SWIG_CXX ${CMAKE_BINARY_DIR}/yap_swig.cpp)
|
||||
find_host_package (SWIG)
|
||||
macro_log_feature (SWIG_FOUND "Swig"
|
||||
"Use SWIG Language Interface "
|
||||
"http://www.swig.org" ON)
|
||||
|
||||
|
||||
add_custom_command (OUTPUT ${SWIG_CXX}
|
||||
COMMAND ${SWIG_EXECUTABLE} -c++ -java -package pt.up.yap.lib -outdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../../../../src/generated/java -I${CMAKE_SOURCE_DIR}/CXX -o ${SWIG_CXX}
|
||||
${SWIG_SOURCES}
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(os)
|
||||
ADD_SUBDIRECTORY(OPTYap)
|
||||
ADD_SUBDIRECTORY(packages/myddas)
|
||||
ADD_SUBDIRECTORY(library/random)
|
||||
ADD_SUBDIRECTORY(library/system)
|
||||
ADD_SUBDIRECTORY(utf8proc)
|
||||
ADD_SUBDIRECTORY(CXX)
|
||||
|
||||
|
||||
set (SWIG_FILES ${CMAKE_SOURCE_DIR}/../generated/jni/yap_wrap.cpp )
|
||||
|
||||
else ()
|
||||
set(YLIBS
|
||||
$<TARGET_OBJECTS:core>
|
||||
$<TARGET_OBJECTS:libYAPOs>
|
||||
$<TARGET_OBJECTS:libOPTYap>
|
||||
$<TARGET_OBJECTS:myddas>
|
||||
@ -103,21 +110,24 @@ else ()
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND YLIBS $<TARGET_OBJECTS:Yap++>)
|
||||
|
||||
list (APPEND YLIBS $<TARGET_OBJECTS:YapC++>)
|
||||
endif()
|
||||
|
||||
|
||||
add_component (core
|
||||
${ENGINE_SOURCES}
|
||||
${SWIG_FILES}
|
||||
${C_INTERFACE_SOURCES}
|
||||
${STATIC_SOURCES}
|
||||
${ALL_SOURCES}
|
||||
)
|
||||
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
libYap
|
||||
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
${ENGINE_SOURCES}
|
||||
${SWIG_CXX}
|
||||
${C_INTERFACE_SOURCES}
|
||||
${STATIC_SOURCES}
|
||||
${ALL_SOURCES}
|
||||
${YLIBS}
|
||||
${WINDLLS}
|
||||
)
|
||||
|
10
CXX/yapa.hh
10
CXX/yapa.hh
@ -23,8 +23,6 @@ enum PropTag {
|
||||
MUTEX_TAG = MutexProperty, // 0xFFF6,
|
||||
/// A typed array, may be in-db or in-stack deped
|
||||
ARRAY_TAG = ArrayProperty, // 0xFFF7,
|
||||
/// atom does not fit ISO-LATIN-1
|
||||
WIDE_TAG = WideAtomProperty, // 0xFFF8,
|
||||
/// module
|
||||
MODULE_TAG = ModProperty, // 0xFFFA,
|
||||
/// the original SICStus blackboard
|
||||
@ -59,14 +57,14 @@ class YAPAtom {
|
||||
/// construct new YAPAtom from Atom
|
||||
YAPAtom( Atom at ) { a = at; }
|
||||
public:
|
||||
/// construct new YAPAtom from string
|
||||
/// construct new YAPAtom from UTF-8 string
|
||||
YAPAtom( const char * s) { a = Yap_LookupAtom( s ); }
|
||||
/// construct new YAPAtom from UTF-8 string
|
||||
YAPAtom( const wchar_t * s) { CACHE_REGS a = UTF32ToAtom( s PASS_REGS ); }
|
||||
/// construct new YAPAtom from wide string
|
||||
YAPAtom( const wchar_t * s) { a = Yap_LookupMaybeWideAtom( s ); }
|
||||
//YAPAtom( const wchar_t * s) { a = Yap_LookupMaybeWideAtom( s ); }
|
||||
/// construct new YAPAtom from max-length string
|
||||
YAPAtom( const char * s, size_t len) { a = Yap_LookupAtomWithLength( s, len ); }
|
||||
/// construct new YAPAtom from max-length wide string
|
||||
YAPAtom( const wchar_t * s, size_t len) { a = Yap_LookupMaybeWideAtomWithLength( s, len ); }
|
||||
/// get name of atom
|
||||
const char *getName(void);
|
||||
/// get name of (other way)
|
||||
|
14
CXX/yapdb.hh
14
CXX/yapdb.hh
@ -97,7 +97,7 @@ public:
|
||||
/// Note: Python confuses the 3 constructors,
|
||||
/// use YAPFunctorFromWideString
|
||||
inline YAPFunctor(const wchar_t *s, uintptr_t arity) {
|
||||
f = Yap_MkFunctor(Yap_LookupWideAtom(s), arity);
|
||||
CACHE_REGS f = Yap_MkFunctor(UTF32ToAtom(s PASS_REGS), arity);
|
||||
}
|
||||
~YAPFunctor(){};
|
||||
/// Getter: extract name of functor as an atom
|
||||
@ -137,8 +137,10 @@ protected:
|
||||
CACHE_REGS
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term *modp = NULL;
|
||||
|
||||
out = Yap_StringToTerm(s0, strlen(s0) + 1, &LOCAL_encoding, 1200, &names);
|
||||
names = MkVarTerm ();
|
||||
const unsigned char *us = (const unsigned char *)s0;
|
||||
out =
|
||||
Yap_BufferToTermWithPrioBindings(us, strlen(s0), TermNil, 1200, names);
|
||||
// extern char *s0;
|
||||
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
|
||||
// Yap_DebugPlWrite(out);
|
||||
@ -217,13 +219,15 @@ public:
|
||||
/// char */module constructor for predicates.
|
||||
///
|
||||
inline YAPPredicate(const char *at, uintptr_t arity) {
|
||||
ap = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity), CurrentModule));
|
||||
ap = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity),
|
||||
CurrentModule));
|
||||
};
|
||||
|
||||
/// char */module constructor for predicates.
|
||||
///
|
||||
inline YAPPredicate(const char *at, uintptr_t arity, YAPTerm mod) {
|
||||
ap = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity), mod.t));
|
||||
ap = RepPredProp(
|
||||
PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity), mod.t));
|
||||
};
|
||||
|
||||
/// char */module constructor for predicates.
|
||||
|
255
CXX/yapi.cpp
255
CXX/yapi.cpp
@ -162,6 +162,8 @@ YAPApplTerm::YAPApplTerm(YAPFunctor f, YAPTerm ts[]) : YAPTerm() {
|
||||
RECOVER_H();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
YAPApplTerm::YAPApplTerm(const char *f, std::vector<YAPTerm> ts) : YAPTerm() {
|
||||
BACKUP_H();
|
||||
arity_t arity = ts.size();
|
||||
@ -179,29 +181,32 @@ YAPApplTerm::YAPApplTerm(YAPFunctor f) : YAPTerm() {
|
||||
mk(Yap_MkNewApplTerm(f.f, arity));
|
||||
RECOVER_H();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
YAPFunctor YAPApplTerm::getFunctor() { return YAPFunctor(FunctorOfTerm(gt())); }
|
||||
|
||||
YAPTerm &YAPTerm::operator[](arity_t i) {
|
||||
Term &YAPTerm::operator[](arity_t i) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term t0 = gt();
|
||||
Term tf = 0;
|
||||
if (IsApplTerm(t0)) {
|
||||
Functor f = FunctorOfTerm(t0);
|
||||
if (IsExtensionFunctor(f))
|
||||
return *new YAPTerm();
|
||||
tf = ArgOfTerm(i + 1, t0);
|
||||
// Functor f = FunctorOfTerm(t0);
|
||||
// if (IsExtensionFunctor(f))
|
||||
// return 0;
|
||||
RECOVER_MACHINE_REGS();
|
||||
return RepAppl(t0)[(i + 1)];
|
||||
} else if (IsPairTerm(t0)) {
|
||||
if (i == 0)
|
||||
tf = HeadOfTerm(t0);
|
||||
else if (i == 1)
|
||||
tf = TailOfTerm(t0);
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return *new YAPTerm(tf);
|
||||
return RepPair(tf)[i];
|
||||
}
|
||||
}
|
||||
|
||||
YAPTerm &YAPListTerm::operator[](arity_t i) {
|
||||
Term &YAPListTerm::operator[](arity_t i) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term t0 = gt();
|
||||
Term tf = 0;
|
||||
@ -215,7 +220,7 @@ YAPTerm &YAPListTerm::operator[](arity_t i) {
|
||||
}
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return *new YAPTerm(tf);
|
||||
return RepPair(tf)[i];
|
||||
}
|
||||
|
||||
YAPPairTerm::YAPPairTerm(YAPTerm th, YAPTerm tl) : YAPTerm() {
|
||||
@ -231,11 +236,6 @@ YAPPairTerm::YAPPairTerm() : YAPTerm() {
|
||||
RECOVER_H();
|
||||
}
|
||||
|
||||
Term YAPTerm::gt() { CACHE_REGS return Yap_GetFromSlot(t); }
|
||||
|
||||
void YAPTerm::mk(Term t0) { CACHE_REGS t= Yap_InitSlot(t0); }
|
||||
|
||||
|
||||
YAP_tag_t YAPTerm::tag() {
|
||||
Term tt = gt();
|
||||
if (IsVarTerm(tt)) {
|
||||
@ -280,24 +280,24 @@ YAP_tag_t YAPTerm::tag() {
|
||||
}
|
||||
}
|
||||
|
||||
YAPTerm YAPTerm::deepCopy() {
|
||||
Term YAPTerm::deepCopy() {
|
||||
yhandle_t tn;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
tn = Yap_CopyTerm(gt());
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return *new YAPTerm(tn);
|
||||
return (tn);
|
||||
}
|
||||
|
||||
YAPListTerm YAPListTerm::dup() {
|
||||
Term YAPListTerm::dup() {
|
||||
yhandle_t tn;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
tn = Yap_CopyTerm(gt());
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return *new YAPListTerm(tn);
|
||||
return tn;
|
||||
}
|
||||
|
||||
intptr_t YAPTerm::numberVars(intptr_t i0, bool skip_singletons) {
|
||||
@ -309,77 +309,7 @@ intptr_t YAPTerm::numberVars(intptr_t i0, bool skip_singletons) {
|
||||
return i;
|
||||
}
|
||||
|
||||
bool YAPTerm::exactlyEqual(YAPTerm t1) {
|
||||
bool out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
out = Yap_eq(gt(), t1.term());
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
}
|
||||
|
||||
bool YAPTerm::unify(YAPTerm t1) {
|
||||
intptr_t out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
out = Yap_unify(gt(), t1.term());
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
}
|
||||
|
||||
bool YAPTerm::unifiable(YAPTerm t1) {
|
||||
intptr_t out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
out = Yap_Unifiable(gt(), t1.term());
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
}
|
||||
|
||||
bool YAPTerm::variant(YAPTerm t1) {
|
||||
intptr_t out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
out = Yap_Variant(gt(), t1.term());
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
}
|
||||
|
||||
intptr_t YAPTerm::hashTerm(size_t sz, size_t depth, bool variant) {
|
||||
intptr_t out;
|
||||
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
out = Yap_TermHash(gt(), sz, depth, variant);
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
}
|
||||
|
||||
const char *YAPTerm::text() {
|
||||
CACHE_REGS
|
||||
size_t length = 0;
|
||||
encoding_t enc = LOCAL_encoding;
|
||||
char *os;
|
||||
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (!(os = Yap_TermToString(Yap_GetFromSlot(t), &length, enc,
|
||||
Handle_vars_f))) {
|
||||
RECOVER_MACHINE_REGS();
|
||||
return 0;
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
length = strlen(os) + 1;
|
||||
char *sm = (char *)malloc(length + 1);
|
||||
strcpy(sm, os);
|
||||
return sm;
|
||||
}
|
||||
|
||||
const char *YAPQuery::text() { return goal.text(); }
|
||||
const char *YAPQuery::text() { return YAPTerm(goal).text(); }
|
||||
|
||||
YAPIntegerTerm::YAPIntegerTerm(intptr_t i) {
|
||||
CACHE_REGS Term tn = MkIntegerTerm(i);
|
||||
@ -402,42 +332,16 @@ YAPTerm::YAPTerm(void *ptr) {
|
||||
mk(MkIntegerTerm((Int)ptr));
|
||||
}
|
||||
|
||||
YAPTerm YAPListTerm::car() {
|
||||
Term YAPListTerm::car() {
|
||||
Term to = gt();
|
||||
if (IsPairTerm(to))
|
||||
return YAPTerm(HeadOfTerm(to));
|
||||
return (HeadOfTerm(to));
|
||||
else {
|
||||
Yap_Error(TYPE_ERROR_LIST, to, "");
|
||||
throw YAPError();
|
||||
}
|
||||
}
|
||||
|
||||
YAPTerm::YAPTerm(YAPFunctor f, YAPTerm ts[]) {
|
||||
CACHE_REGS
|
||||
BACKUP_H();
|
||||
Functor fun = f.f;
|
||||
arity_t arity = ArityOfFunctor(fun);
|
||||
while (HR + arity > ASP - 1024) {
|
||||
RECOVER_H();
|
||||
if (!Yap_dogc(0, NULL PASS_REGS)) {
|
||||
t = TermNil;
|
||||
}
|
||||
BACKUP_H();
|
||||
}
|
||||
if (fun == FunctorDot) {
|
||||
t = AbsPair(HR);
|
||||
HR[0] = ts[0].term();
|
||||
HR[1] = ts[1].term();
|
||||
} else {
|
||||
t = AbsAppl(HR);
|
||||
*HR++ = (CELL)fun;
|
||||
for (arity_t i = 0; i < arity; i++) {
|
||||
HR[i] = ts[i].term();
|
||||
}
|
||||
RECOVER_H();
|
||||
}
|
||||
}
|
||||
|
||||
YAPListTerm::YAPListTerm(YAPTerm ts[], arity_t n) {
|
||||
CACHE_REGS
|
||||
BACKUP_H();
|
||||
@ -462,19 +366,14 @@ YAPVarTerm::YAPVarTerm() {
|
||||
mk(MkVarTerm());
|
||||
}
|
||||
|
||||
const char *YAPAtom::getName(void) {
|
||||
return Yap_AtomToUTF8Text( a, nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *YAPAtom::getName(void) { return Yap_AtomToUTF8Text(a, nullptr); }
|
||||
|
||||
void YAPQuery::openQuery() {
|
||||
CACHE_REGS
|
||||
arity_t arity = ap->ArityOfPE;
|
||||
if (arity) {
|
||||
Term *ts;
|
||||
Term t = goal.term();
|
||||
Term t = goal;
|
||||
if (IsPairTerm(t)) {
|
||||
ts = RepPair(t);
|
||||
} else {
|
||||
@ -496,7 +395,6 @@ const char *YAPAtom::getName(void) {
|
||||
q_handles = Yap_StartSlots();
|
||||
}
|
||||
|
||||
|
||||
bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
||||
CACHE_REGS
|
||||
BACKUP_MACHINE_REGS();
|
||||
@ -505,8 +403,9 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
||||
YAP_dogoalinfo q;
|
||||
Term terr;
|
||||
jmp_buf q_env;
|
||||
|
||||
for (arity_t i = 0; i < arity; i++)
|
||||
Yap_XREGS[i + 1] = ts[i].term();
|
||||
XREGS[i + 1] = ts[i].term();
|
||||
q.CurSlot = Yap_StartSlots();
|
||||
q.p = P;
|
||||
q.cp = CP;
|
||||
@ -519,20 +418,13 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// don't forget, on success these l);
|
||||
if (!result) {
|
||||
// don't forget, on success these bindings will still be there);
|
||||
YAP_LeaveGoal(false, &q);
|
||||
} else {
|
||||
YAP_LeaveGoal(FALSE, &q);
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool YAPEngine::goalt(YAPTerm Yt) {
|
||||
return Yt.term();
|
||||
}
|
||||
|
||||
bool YAPEngine::goalt(YAPTerm Yt) { return Yt.term(); }
|
||||
|
||||
bool YAPEngine::goal(Term t) {
|
||||
CACHE_REGS
|
||||
@ -566,7 +458,6 @@ bool YAPEngine::goal(Term t) {
|
||||
// don't forget, on success these guys may create slots
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||
|
||||
|
||||
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
||||
if ((terr = Yap_GetException())) {
|
||||
YAP_LeaveGoal(false, &q);
|
||||
@ -595,12 +486,11 @@ Term YAPEngine::fun(Term t) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term tmod = CurrentModule, *ts = nullptr;
|
||||
PredEntry *ap;
|
||||
arity_t arity = arity;
|
||||
arity_t arity;
|
||||
Functor f;
|
||||
jmp_buf q_env;
|
||||
Atom name;
|
||||
|
||||
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (IsApplTerm(t)) {
|
||||
ts = RepAppl(t) + 1;
|
||||
@ -612,11 +502,16 @@ Term YAPEngine::fun(Term t) {
|
||||
} else if (IsAtomTerm(t)) {
|
||||
name = AtomOfTerm(t);
|
||||
f = nullptr;
|
||||
} else if (IsAtomTerm(t)) {
|
||||
arity = 0;
|
||||
} else if (IsPairTerm(t)) {
|
||||
XREGS[1] = ts[0];
|
||||
XREGS[2] = ts[1];
|
||||
arity = 2;
|
||||
name = AtomDot;
|
||||
f = FunctorDot;
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_CALLABLE, t, 0);
|
||||
return 0L;
|
||||
}
|
||||
XREGS[arity + 1] = MkVarTerm();
|
||||
arity++;
|
||||
@ -648,14 +543,13 @@ Term YAPEngine::fun(Term t) {
|
||||
Yap_CloseHandles(q.CurSlot);
|
||||
throw YAPError();
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "out %d", result);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "out %ld", o);
|
||||
|
||||
Term result;
|
||||
t = Yap_GetFromSlot(q.CurSlot);
|
||||
Yap_CloseHandles(q.CurSlot);
|
||||
if (!t) {
|
||||
YAP_LeaveGoal(false, &q);
|
||||
result = 0;
|
||||
t = 0;
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return t;
|
||||
@ -665,41 +559,43 @@ YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[])
|
||||
: YAPPredicate(f, mod) {
|
||||
/* ignore flags for now */
|
||||
BACKUP_MACHINE_REGS();
|
||||
goal = YAPTerm(f, ts);
|
||||
vnames = YAPListTerm();
|
||||
goal = YAPApplTerm(f, ts).gt();
|
||||
names = TermNil;
|
||||
openQuery();
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
#if 0
|
||||
YAPQuery::YAPQuery(YAPFunctor f, YAPTerm ts[]) : YAPPredicate(f) {
|
||||
/* ignore flags for now */
|
||||
BACKUP_MACHINE_REGS();
|
||||
goal = YAPTerm(f, ts);
|
||||
vnames = YAPListTerm();
|
||||
goal = YAPApplTerm(f, ts).gt();
|
||||
names = TermNil;
|
||||
openQuery();
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
#endif
|
||||
|
||||
YAPQuery::YAPQuery(YAPPredicate p, YAPTerm ts[]) : YAPPredicate(p.ap) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
goal = YAPTerm(YAPFunctor(ap->FunctorOfPred), ts);
|
||||
vnames = YAPListTerm();
|
||||
goal = YAPApplTerm(YAPFunctor(p.ap->FunctorOfPred), ts).term();
|
||||
names = TermNil;
|
||||
openQuery();
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
YAPListTerm YAPQuery::namedVars() {
|
||||
Term YAPQuery::namedVars() {
|
||||
CACHE_REGS
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "vnames %s %d",
|
||||
vnames.text(), LOCAL_CurSlot);
|
||||
return vnames; // should be o
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "vnames %s %ld",
|
||||
names.text(), LOCAL_CurSlot);
|
||||
return (names); // should be o
|
||||
}
|
||||
|
||||
YAPListTerm YAPQuery::namedVarsCopy() {
|
||||
Term YAPQuery::namedVarsCopy() {
|
||||
CACHE_REGS
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "vnames %s %d",
|
||||
vnames.text(), LOCAL_CurSlot);
|
||||
return YAPListTerm(YAP_CopyTerm(vnames.term())); // should be o
|
||||
__android_log_print(NDROID_LOG_INFO, "YAPDroid", "vnames %s %ld",
|
||||
names.text(), LOCAL_CurSlot);
|
||||
return (YAP_CopyTerm(names)); // should be o
|
||||
}
|
||||
|
||||
bool YAPQuery::next() {
|
||||
@ -728,7 +624,7 @@ bool YAPQuery::next() {
|
||||
result = (bool)YAP_RetryGoal(&q_h);
|
||||
}
|
||||
if (result) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "vnames %d %s %d",
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "vnames %d %s %ld",
|
||||
q_state, vnames.text(), LOCAL_CurSlot);
|
||||
} else {
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "fail");
|
||||
@ -871,8 +767,7 @@ void YAPEngine::doInit(YAP_file_type_t BootMode) {
|
||||
YAPEngine::YAPEngine(char *savedState, char *bootFile, size_t stackSize,
|
||||
size_t trailSize, size_t maxStackSize, size_t maxTrailSize,
|
||||
char *libDir, char *goal, char *topLevel, bool script,
|
||||
bool fastBoot,
|
||||
bool embedded,
|
||||
bool fastBoot, bool embedded,
|
||||
YAPCallback *cb)
|
||||
: _callback(0) { // a single engine can be active
|
||||
|
||||
@ -1029,37 +924,37 @@ const char *YAPError::text() {
|
||||
|
||||
char buf[256];
|
||||
std::string s = "";
|
||||
if (LOCAL_ActiveError.errorFunction) {
|
||||
s += LOCAL_ActiveError.errorFile;
|
||||
if (LOCAL_ActiveError->errorFunction) {
|
||||
s += LOCAL_ActiveError->errorFile;
|
||||
s += ":";
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError.errorLine);
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError->errorLine);
|
||||
s += buf;
|
||||
s += ":0 in C-code";
|
||||
}
|
||||
if (LOCAL_ActiveError.prologPredLine) {
|
||||
if (LOCAL_ActiveError->prologPredLine) {
|
||||
s += "\n";
|
||||
s += LOCAL_ActiveError.prologPredFile->StrOfAE;
|
||||
s += LOCAL_ActiveError->prologPredFile->StrOfAE;
|
||||
s += ":";
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError.prologPredLine);
|
||||
s += buf; // std::to_string(LOCAL_ActiveError.prologPredLine) ;
|
||||
// YAPIntegerTerm(LOCAL_ActiveError.prologPredLine).text();
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError->prologPredLine);
|
||||
s += buf; // std::to_string(LOCAL_ActiveError->prologPredLine) ;
|
||||
// YAPIntegerTerm(LOCAL_ActiveError->prologPredLine).text();
|
||||
s += ":0 ";
|
||||
s += LOCAL_ActiveError.prologPredModule;
|
||||
s += LOCAL_ActiveError->prologPredModule;
|
||||
s += ":";
|
||||
s += (LOCAL_ActiveError.prologPredName)->StrOfAE;
|
||||
s += (LOCAL_ActiveError->prologPredName)->StrOfAE;
|
||||
s += "/";
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError.prologPredArity);
|
||||
s += // std::to_string(LOCAL_ActiveError.prologPredArity);
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError->prologPredArity);
|
||||
s += // std::to_string(LOCAL_ActiveError->prologPredArity);
|
||||
buf;
|
||||
}
|
||||
s += " error ";
|
||||
if (LOCAL_ActiveError.classAsText != nullptr)
|
||||
s += LOCAL_ActiveError.classAsText->StrOfAE;
|
||||
if (LOCAL_ActiveError->classAsText != nullptr)
|
||||
s += LOCAL_ActiveError->classAsText->StrOfAE;
|
||||
s += ".";
|
||||
s += LOCAL_ActiveError.errorAsText->StrOfAE;
|
||||
s += LOCAL_ActiveError->errorAsText->StrOfAE;
|
||||
s += ".\n";
|
||||
if (LOCAL_ActiveError.errorTerm) {
|
||||
Term t = Yap_PopTermFromDB(LOCAL_ActiveError.errorTerm);
|
||||
if (LOCAL_ActiveError->errorTerm) {
|
||||
Term t = Yap_PopTermFromDB(LOCAL_ActiveError->errorTerm);
|
||||
if (t) {
|
||||
s += "error term is: ";
|
||||
s += YAPTerm(t).text();
|
||||
@ -1070,12 +965,12 @@ const char *YAPError::text() {
|
||||
return s.c_str();
|
||||
}
|
||||
|
||||
void YAPEngine::reSet()
|
||||
{
|
||||
void YAPEngine::reSet() {
|
||||
/* ignore flags for now */
|
||||
BACKUP_MACHINE_REGS();
|
||||
Yap_RebootHandles(worker_id);
|
||||
while (B->cp_b) B= B->cp_b;
|
||||
while (B->cp_b)
|
||||
B = B->cp_b;
|
||||
P = FAILCODE;
|
||||
Yap_exec_absmi(true, YAP_EXEC_ABSMI);
|
||||
/* recover stack space */
|
||||
@ -1088,5 +983,3 @@ void YAPEngine::reSet()
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
|
||||
|
10
CXX/yapie.hh
10
CXX/yapie.hh
@ -15,17 +15,17 @@ public:
|
||||
YAPError(){};
|
||||
/// we just know the error number
|
||||
/// exact error ID
|
||||
yap_error_number getID() { return LOCAL_ActiveError.errorNo; };
|
||||
yap_error_number getID() { return LOCAL_ActiveError->errorNo; };
|
||||
/// class of error
|
||||
yap_error_class_number getErrorClass() {
|
||||
return Yap_errorClass(LOCAL_ActiveError.errorNo);
|
||||
return Yap_errorClass(LOCAL_ActiveError->errorNo);
|
||||
};
|
||||
/// where in the code things happened;
|
||||
const char *getFile() { return LOCAL_ActiveError.errorFile; };
|
||||
const char *getFile() { return LOCAL_ActiveError->errorFile; };
|
||||
/// predicate things happened;
|
||||
Int getLine() { return LOCAL_ActiveError.errorLine; };
|
||||
Int getLine() { return LOCAL_ActiveError->errorLine; };
|
||||
/// the term that caused the bug
|
||||
// YAPTerm getCulprit(LOCAL_ActiveError.errorFile){};
|
||||
// YAPTerm getCulprit(LOCAL_ActiveError->errorFile){};
|
||||
/// text describing the Error
|
||||
const char *text();
|
||||
};
|
||||
|
21
CXX/yapq.hh
21
CXX/yapq.hh
@ -22,10 +22,9 @@ class YAPQuery : public YAPPredicate {
|
||||
int q_flags;
|
||||
YAP_dogoalinfo q_h;
|
||||
YAPQuery *oq;
|
||||
YAPListTerm vnames;
|
||||
YAPTerm goal;
|
||||
Term names;
|
||||
Term goal;
|
||||
// temporaries
|
||||
Term tgoal, names;
|
||||
|
||||
void openQuery();
|
||||
|
||||
@ -46,20 +45,18 @@ public:
|
||||
///
|
||||
/// It is given a functor, and an array of terms that must have at least
|
||||
/// the same arity as the functor. Works within the current module.
|
||||
YAPQuery(YAPFunctor f, YAPTerm t[]);
|
||||
//YAPQuery(YAPFunctor f, YAPTerm t[]);
|
||||
/// string constructor without varnames
|
||||
///
|
||||
/// It is given a string, calls the parser and obtains a Prolog term that
|
||||
/// should be a callable
|
||||
/// goal.
|
||||
inline YAPQuery(const char *s) : YAPPredicate(s, tgoal, names) {
|
||||
inline YAPQuery(const char *s) : YAPPredicate(s, goal, names) {
|
||||
BACKUP_H();
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "got game %d",
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "got game %ld",
|
||||
LOCAL_CurSlot);
|
||||
if (!ap)
|
||||
return;
|
||||
goal = YAPTerm(tgoal);
|
||||
vnames = YAPListTerm(names);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "%s", vnames.text());
|
||||
openQuery();
|
||||
RECOVER_H();
|
||||
@ -69,8 +66,8 @@ public:
|
||||
/// It is given an atom, and a Prolog term that should be a callable
|
||||
/// goal, say `main`, `init`, `live`.
|
||||
inline YAPQuery(YAPAtom g) : YAPPredicate(g) {
|
||||
goal = YAPAtomTerm(g);
|
||||
vnames = YAPListTerm();
|
||||
goal = YAPAtomTerm(g).gt();
|
||||
names = TermNil;
|
||||
openQuery();
|
||||
};
|
||||
|
||||
@ -96,9 +93,9 @@ public:
|
||||
/// finish the current query: undo all bindings.
|
||||
void close();
|
||||
/// query variables.
|
||||
YAPListTerm namedVars();
|
||||
Term namedVars();
|
||||
/// query variables, but copied out
|
||||
YAPListTerm namedVarsCopy();
|
||||
Term namedVarsCopy();
|
||||
/// convert a ref to a binding.
|
||||
YAPTerm getTerm(yhandle_t t);
|
||||
/// simple YAP Query;
|
||||
|
177
CXX/yapt.hh
177
CXX/yapt.hh
@ -2,9 +2,23 @@
|
||||
#ifndef YAPT_HH
|
||||
#define YAPT_HH 1
|
||||
|
||||
extern "C" Term YAP_ReadBuffer(const char *s, Term *tp);
|
||||
#include "config.h"
|
||||
|
||||
extern "C" {
|
||||
Term YAP_ReadBuffer(const char *s, Term *tp);
|
||||
#if defined(SWIGPYTHON) && 0
|
||||
#include <Python.h>
|
||||
extern Term pythonToYAP(PyObject *inp);
|
||||
#define YAPTerm _YAPTERM
|
||||
#elifndef HAVE_PYTHON_H
|
||||
typdef struct { int no_python; } PyObject;
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
};
|
||||
|
||||
class YAPError;
|
||||
|
||||
/**
|
||||
* @brief Generic Prolog Term
|
||||
*/
|
||||
@ -19,19 +33,40 @@ class YAPTerm {
|
||||
|
||||
protected:
|
||||
yhandle_t t; /// handle to term, equivalent to term_t
|
||||
void mk(Term t0); /// internal method to convert from term to handle
|
||||
Term gt(); /// get handle and obtain term
|
||||
public:
|
||||
virtual ~YAPTerm(){ LOCAL_HandleBase[t] = TermFreeTerm;
|
||||
while ( LOCAL_HandleBase[LOCAL_CurSlot-1] == TermFreeTerm)
|
||||
virtual ~YAPTerm() {
|
||||
// fprintf(stderr,"-%d,%lx,%p ",t,LOCAL_HandleBase[t] ,HR);
|
||||
// Yap_DebugPlWriteln(LOCAL_HandleBase[t]); }
|
||||
// LOCAL_HandleBase[t] = TermFreeTerm;
|
||||
// while ( LOCAL_HandleBase[LOCAL_CurSlot-1] == TermFreeTerm)
|
||||
LOCAL_CurSlot--;
|
||||
};
|
||||
|
||||
Term gt() {
|
||||
CACHE_REGS
|
||||
// fprintf(stderr,"?%d,%lx,%p\n",t,LOCAL_HandleBase[t], HR);
|
||||
// Yap_DebugPlWriteln(LOCAL_HandleBase[t]);
|
||||
return Yap_GetFromSlot(t);
|
||||
};
|
||||
|
||||
void mk(Term t0) {
|
||||
CACHE_REGS t = Yap_InitSlot(t0);
|
||||
// fprintf(stderr,"+%d,%lx,%p,%p",t,t0,HR,ASP); Yap_DebugPlWriteln(t0);
|
||||
};
|
||||
|
||||
YAPTerm(Term tn) { mk(tn); };
|
||||
YAPTerm(PyObject *inp) {
|
||||
#ifdef SWIGPYTHON
|
||||
Term tinp = pythonToYAP(inp);
|
||||
t = Yap_InitSlot(tinp);
|
||||
#else
|
||||
t = 0;
|
||||
#endif
|
||||
}
|
||||
YAPTerm(Term tn) {
|
||||
mk(tn);
|
||||
} /// private method to convert from Term (internal YAP representation) to
|
||||
/// private method to convert from Term (internal YAP representation) to
|
||||
/// YAPTerm
|
||||
// do nothing constructor
|
||||
YAPTerm() { mk(MkVarTerm()); }
|
||||
YAPTerm() { mk(MkVarTerm()); };
|
||||
// YAPTerm(yhandle_t i) { t = i; };
|
||||
/// pointer to term
|
||||
YAPTerm(void *ptr);
|
||||
@ -42,32 +77,73 @@ public:
|
||||
}
|
||||
/// construct a term out of an integer (if you know object type use
|
||||
/// YAPIntegerTerm)
|
||||
YAPTerm(long int num) { mk(MkIntegerTerm(num)); }
|
||||
/// YAPTerm(long int num) { mk(MkIntegerTerm(num)); }
|
||||
/// construct a term out of an integer (if you know object type use
|
||||
/// YAPIntegerTerm)
|
||||
YAPTerm(double num) { mk(MkFloatTerm(num)); }
|
||||
/// YAPTerm(double num) { mk(MkFloatTerm(num)); }
|
||||
/// parse string s and construct a term.
|
||||
YAPTerm(YAPFunctor f, YAPTerm ts[]);
|
||||
/// YAPTerm(YAPFunctor f, YAPTerm ts[]);
|
||||
/// extract the tag of a term, after dereferencing.
|
||||
YAP_tag_t tag();
|
||||
/// copy the term ( term copy )
|
||||
YAPTerm deepCopy();
|
||||
Term deepCopy();
|
||||
/// numbervars ( int start, bool process=false )
|
||||
intptr_t numberVars(intptr_t start, bool skip_singletons = false);
|
||||
inline Term term() {
|
||||
return gt();
|
||||
} /// from YAPTerm to Term (internal YAP representation)
|
||||
inline void bind(Term b) { LOCAL_HandleBase[t] = b; }
|
||||
inline void bind(YAPTerm *b) { LOCAL_HandleBase[t] = b->term(); }
|
||||
/// from YAPTerm to Term (internal YAP representation)
|
||||
/// fetch a sub-term
|
||||
YAPTerm &operator[](size_t n);
|
||||
Term &operator[](size_t n);
|
||||
// const YAPTerm *vars();
|
||||
/// this term is == to t1
|
||||
virtual bool exactlyEqual(YAPTerm t1);
|
||||
virtual bool unify(YAPTerm t1); /// t = t1
|
||||
virtual bool unifiable(YAPTerm t1); /// we can unify t and t1
|
||||
virtual bool variant(
|
||||
YAPTerm t1); /// t =@= t1, the two terms are equal up to variable renaming
|
||||
virtual intptr_t hashTerm(size_t sz, size_t depth,
|
||||
bool variant); /// term hash,
|
||||
virtual bool exactlyEqual(YAPTerm t1) {
|
||||
bool out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
out = Yap_eq(gt(), t1.term());
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
};
|
||||
|
||||
/// t = t1
|
||||
virtual bool unify(YAPTerm t1) {
|
||||
intptr_t out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
out = Yap_unify(gt(), t1.term());
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
};
|
||||
|
||||
/// we can unify t and t1
|
||||
virtual bool unifiable(YAPTerm t1) {
|
||||
bool out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
out = Yap_eq(gt(), t1.term());
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
};
|
||||
|
||||
/// t =@= t1, the two terms are equal up to variable renamingvirtual bool
|
||||
/// variant(
|
||||
inline virtual YAP_Term variant(YAPTerm t1) {
|
||||
intptr_t out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
out = Yap_Variant(gt(), t1.term());
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
};
|
||||
|
||||
virtual intptr_t hashTerm(size_t sz, size_t depth, bool variant) {
|
||||
intptr_t out;
|
||||
|
||||
BACKUP_MACHINE_REGS();
|
||||
out = Yap_TermHash(gt(), sz, depth, variant);
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
};
|
||||
/// term hash,
|
||||
virtual bool isVar() { return IsVarTerm(gt()); } /// type check for unound
|
||||
virtual bool isAtom() { return IsAtomTerm(gt()); } /// type check for atom
|
||||
virtual bool isInteger() {
|
||||
@ -88,19 +164,19 @@ public:
|
||||
virtual bool isList() { return Yap_IsListTerm(gt()); } /// term is a list
|
||||
|
||||
/// extract the argument i of the term, where i in 1...arity
|
||||
virtual YAPTerm getArg(arity_t i) {
|
||||
virtual Term getArg(arity_t i) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term tf = 0;
|
||||
Term t0 = gt();
|
||||
YAPTerm tf;
|
||||
if (IsApplTerm(t0))
|
||||
tf = YAPTerm(ArgOfTerm(i, t0));
|
||||
tf = (ArgOfTerm(i, t0));
|
||||
else if (IsPairTerm(t0)) {
|
||||
if (i == 1)
|
||||
tf = YAPTerm(HeadOfTerm(t0));
|
||||
tf = (HeadOfTerm(t0));
|
||||
else if (i == 2)
|
||||
tf = YAPTerm(TailOfTerm(t0));
|
||||
tf = (TailOfTerm(t0));
|
||||
} else {
|
||||
tf = YAPTerm((Term)0);
|
||||
tf = ((Term)0);
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return tf;
|
||||
@ -123,7 +199,24 @@ public:
|
||||
}
|
||||
|
||||
/// return a string with a textual representation of the term
|
||||
virtual const char *text();
|
||||
virtual const char *text(){
|
||||
CACHE_REGS
|
||||
size_t length = 0;
|
||||
encoding_t enc = LOCAL_encoding;
|
||||
char *os;
|
||||
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (!(os = Yap_TermToString(Yap_GetFromSlot(t), &length, enc,
|
||||
Handle_vars_f))) {
|
||||
RECOVER_MACHINE_REGS();
|
||||
return 0;
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
length = strlen(os) + 1;
|
||||
char *sm = (char *)malloc(length + 1);
|
||||
strcpy(sm, os);
|
||||
return sm;
|
||||
};
|
||||
|
||||
/// return a handle to the term
|
||||
inline yhandle_t handle() { return t; };
|
||||
@ -171,14 +264,14 @@ class YAPApplTerm : public YAPTerm {
|
||||
public:
|
||||
~YAPApplTerm() {}
|
||||
YAPApplTerm(YAPFunctor f, YAPTerm ts[]);
|
||||
YAPApplTerm(const char *s, std::vector<YAPTerm> ts);
|
||||
YAPApplTerm(YAPFunctor f);
|
||||
//YAPApplTerm(const char *s, std::vector<YAPTerm> ts);
|
||||
//YAPApplTerm(YAPFunctor f);
|
||||
YAPFunctor getFunctor();
|
||||
YAPTerm getArg(arity_t i) {
|
||||
Term getArg(arity_t i) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term t0 = gt();
|
||||
YAPTerm tf;
|
||||
tf = YAPTerm(ArgOfTerm(i, t0));
|
||||
Term tf;
|
||||
tf = ArgOfTerm(i, t0);
|
||||
RECOVER_MACHINE_REGS();
|
||||
return tf;
|
||||
};
|
||||
@ -209,8 +302,8 @@ class YAPPairTerm : public YAPTerm {
|
||||
public:
|
||||
YAPPairTerm(YAPTerm hd, YAPTerm tl);
|
||||
YAPPairTerm();
|
||||
YAPTerm getHead() { return YAPTerm(HeadOfTerm(gt())); }
|
||||
YAPTerm getTail() { return YAPTerm(TailOfTerm(gt())); }
|
||||
Term getHead() { return (HeadOfTerm(gt())); }
|
||||
Term getTail() { return (TailOfTerm(gt())); }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -267,20 +360,20 @@ public:
|
||||
return Yap_SkipList(&t1, &tailp);
|
||||
}
|
||||
/// Extract the nth element.
|
||||
YAPTerm &operator[](size_t n);
|
||||
Term &operator[](size_t n);
|
||||
/// Extract the first element of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPTerm car();
|
||||
Term car();
|
||||
/// Extract the tail elements of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPListTerm cdr() {
|
||||
Term cdr() {
|
||||
Term to = gt();
|
||||
if (IsPairTerm(to))
|
||||
return YAPListTerm(TailOfTerm(to));
|
||||
return (TailOfTerm(to));
|
||||
else if (to == TermNil)
|
||||
return YAPListTerm();
|
||||
return TermNil;
|
||||
/* error */
|
||||
Yap_Error(TYPE_ERROR_LIST, t, 0);
|
||||
throw YAPError();
|
||||
@ -288,7 +381,7 @@ public:
|
||||
/// copy a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPListTerm dup();
|
||||
Term dup();
|
||||
|
||||
/// Check if the list is empty.
|
||||
///
|
||||
@ -325,8 +418,6 @@ class YAPAtomTerm : public YAPTerm {
|
||||
// Constructor: receives a C-atom;
|
||||
YAPAtomTerm(Atom a) { mk(MkAtomTerm(a)); }
|
||||
YAPAtomTerm(Term t) : YAPTerm(t) { IsAtomTerm(t); }
|
||||
// Getter for Prolog atom
|
||||
Term getTerm() { return t; }
|
||||
|
||||
public:
|
||||
// Constructor: receives an atom;
|
||||
|
10
GIT
10
GIT
@ -1,10 +0,0 @@
|
||||
|
||||
You need at least git-1.6 to install the development version.
|
||||
|
||||
Please proceed as follows for the main branch:
|
||||
|
||||
git clone git://gitorious.org/yap-git/mainline.git yap
|
||||
cd yap-6
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
21
H/ATOMS
21
H/ATOMS
@ -29,9 +29,14 @@ A Arrow N "->"
|
||||
A AttributedModule N "attributes_module"
|
||||
A DoubleArrow N "-->"
|
||||
A Assert N ":-"
|
||||
A BeginBracket N "("
|
||||
A EndBracket N ")"
|
||||
A BeginSquareBracket N "["
|
||||
A EndSquareBracket N "]"
|
||||
A BeginCurlyBracket N "{"
|
||||
A EndCurlyBracket N "}"
|
||||
A EmptyBrackets N "()"
|
||||
A EmptySquareBrackets N "[]"
|
||||
A EmptyCurlyBrackets N "{}"
|
||||
A Asserta N "asserta"
|
||||
A AssertaStatic N "asserta_static"
|
||||
A Assertz N "assertz"
|
||||
@ -68,6 +73,7 @@ A Chars N "chars"
|
||||
A Charset N "charset"
|
||||
A ChType F "$char_type"
|
||||
A CleanCall F "$clean_call"
|
||||
A Close N "close"
|
||||
A Colon N ":"
|
||||
A CodeSpace N "code_space"
|
||||
A Codes N "codes"
|
||||
@ -89,7 +95,7 @@ A Csult F "$csult"
|
||||
A CurrentModule F "$current_module"
|
||||
A Cut N "!"
|
||||
A CutBy F "$cut_by"
|
||||
A DAbort F "$abort"
|
||||
A DAbort N "abort"
|
||||
A DBLoad F "$db_load"
|
||||
A DBREF N "DBRef"
|
||||
A DBReference N "db_reference"
|
||||
@ -190,6 +196,7 @@ A Id N "id"
|
||||
A Ignore N "ignore"
|
||||
A Inf N "inf"
|
||||
A Infinity N "infinity"
|
||||
A Info N "info"
|
||||
A InitGoal F "$init_goal"
|
||||
A InitProlog F "$init_prolog"
|
||||
A InStackExpansion N "in stack expansion"
|
||||
@ -201,6 +208,7 @@ A Integer N "integer"
|
||||
A InternalCompilerError N "internal_compiler_error"
|
||||
A Is N "is"
|
||||
A J N "j"
|
||||
A l N "l"
|
||||
A Key N "key"
|
||||
A LDLibraryPath N "LD_LIBRARY_PATH"
|
||||
A LONGINT N "LongInt"
|
||||
@ -286,6 +294,7 @@ A PastEndOfStream N "past_end_of_stream"
|
||||
A PermissionError N "permission_error"
|
||||
A Pi N "pi"
|
||||
A Pipe N "pipe"
|
||||
A Priority N "priority"
|
||||
A Plus N "+"
|
||||
A Pointer N "pointer"
|
||||
A Portray F "portray"
|
||||
@ -488,9 +497,9 @@ F Dot6 Dot 6
|
||||
F Dot7 Dot 7
|
||||
F Dot8 Dot 8
|
||||
F Dot9 Dot 9
|
||||
F DoubleArrow DoubleArrow 2
|
||||
F DoubleSlash DoubleSlash 2
|
||||
F EmptySquareBrackets EmptySquareBrackets 2
|
||||
F EmptyCurlyBrackets EmptyCurlyBrackets 2
|
||||
F Eq Eq 2
|
||||
F Error Error 2
|
||||
F EvaluationError EvaluationError 1
|
||||
@ -517,6 +526,10 @@ F HandleThrow HandleThrow 3
|
||||
F Hat Hat 2
|
||||
F I I 2
|
||||
F Id Id 1
|
||||
F Info1 Info 1
|
||||
F Info2 Info 2
|
||||
F Info3 Info 3
|
||||
F Info4 Info 4
|
||||
F Is Is 2
|
||||
F J J 2
|
||||
F LastExecuteWithin LastExecuteWithin 1
|
||||
@ -534,11 +547,13 @@ F NBQueue Queue 4
|
||||
F Not Not 1
|
||||
F Obj Obj 1
|
||||
F Or Semic 2
|
||||
F Output Output 1
|
||||
F PermissionError PermissionError 3
|
||||
F Plus Plus 2
|
||||
F Portray Portray 1
|
||||
F PrintMessage PrintMessage 2
|
||||
F Procedure Procedure 5
|
||||
F Priority Priority 1
|
||||
F PrologConstraint Prolog 2
|
||||
F ProtectStack ProtectStack 4
|
||||
F Query Query 1
|
||||
|
@ -59,7 +59,6 @@ typedef struct AtomEntryStruct {
|
||||
union {
|
||||
unsigned char uUStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
|
||||
char uStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
|
||||
wchar_t uWStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
|
||||
struct atom_blob blob[MIN_ARRAY];
|
||||
} rep;
|
||||
} AtomEntry;
|
||||
@ -75,14 +74,12 @@ typedef struct ExtraAtomEntryStruct {
|
||||
union {
|
||||
unsigned char uUStrOfAE[4]; /* representation of atom as a string */
|
||||
char uStrOfAE[4]; /* representation of atom as a string */
|
||||
wchar_t uWStrOfAE[2]; /* representation of atom as a string */
|
||||
struct atom_blob blob[2];
|
||||
} rep;
|
||||
} ExtraAtomEntry;
|
||||
|
||||
#define UStrOfAE rep.uUStrOfAE
|
||||
#define StrOfAE rep.uStrOfAE
|
||||
#define WStrOfAE rep.uWStrOfAE
|
||||
|
||||
/* Props and Atoms are stored in chains, ending with a NIL */
|
||||
#ifdef USE_OFFSETS
|
||||
|
10
H/LOCALS
10
H/LOCALS
@ -79,7 +79,6 @@ UInt GlobalArenaOverflows =0L
|
||||
Int ArenaOverflows =0L
|
||||
Int DepthArenas =0
|
||||
|
||||
int ArithError =FALSE
|
||||
struct pred_entry* LastAssertedPred =NULL
|
||||
struct pred_entry* TmpPred =NULL
|
||||
char* ScannerStack =NULL
|
||||
@ -194,13 +193,10 @@ ADDR LocalBase void
|
||||
ADDR GlobalBase void
|
||||
ADDR TrailBase void
|
||||
ADDR TrailTop void
|
||||
char* ErrorMessage void
|
||||
Term Error_Term void
|
||||
|
||||
/** error handling info, designed to be easy to pass to the foreign world */
|
||||
struct yap_error_descriptor ActiveError void
|
||||
/* error handling info, designed to be easy to pass to the foreign world */
|
||||
yap_error_descriptor_t* ActiveError =calloc(sizeof(yap_error_descriptor_t),1)
|
||||
/// pointer to an exception term, from throw
|
||||
struct DB_TERM* BallTerm =NULL
|
||||
|
||||
jmp_buf IOBotch void
|
||||
TokEntry* tokptr void
|
||||
@ -239,10 +235,8 @@ YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1] void
|
||||
struct db_globs* s_dbg void
|
||||
|
||||
//eval.c
|
||||
yap_error_number matherror =YAP_NO_ERROR
|
||||
Term mathtt void
|
||||
char* mathstring =NULL
|
||||
yap_error_number CurrentError =YAP_NO_ERROR
|
||||
|
||||
//grow.c
|
||||
int heap_overflows =0
|
||||
|
@ -3,13 +3,10 @@ typedef enum TokenKinds {
|
||||
Number_tok,
|
||||
Var_tok,
|
||||
String_tok,
|
||||
WString_tok,
|
||||
BQString_tok,
|
||||
WBQString_tok,
|
||||
Ponctuation_tok,
|
||||
Error_tok,
|
||||
QuasiQuotes_tok,
|
||||
WQuasiQuotes_tok,
|
||||
eot_tok
|
||||
} tkinds;
|
||||
|
||||
@ -29,5 +26,5 @@ typedef struct VARSTRUCT {
|
||||
CELL hv;
|
||||
UInt refs;
|
||||
struct VARSTRUCT *VarLeft, *VarRight;
|
||||
char VarRep[1];
|
||||
Atom VarRep;
|
||||
} VarEntry;
|
||||
|
3
H/Yap.h
3
H/Yap.h
@ -462,6 +462,7 @@ extern ADDR Yap_HeapBase;
|
||||
/* This is ok for Linux, should be ok for everyone */
|
||||
#define YAP_FILENAME_MAX 1024
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
Debugging Support
|
||||
*************************************************************************************************/
|
||||
@ -853,3 +854,5 @@ inline static void LOG0(const char *f, int l, const char *fmt, ...) {
|
||||
extern bool Yap_embedded, Yap_Server;
|
||||
|
||||
#endif /* YAP_H */
|
||||
|
||||
#include "YapText.h"
|
||||
|
@ -204,7 +204,7 @@ typedef struct x_el {
|
||||
} xarg;
|
||||
|
||||
typedef struct struct_param {
|
||||
char *name;
|
||||
const char *name;
|
||||
flag_func type;
|
||||
int id;
|
||||
} param_t;
|
||||
|
@ -524,7 +524,7 @@ and _Patch_ is the patch number.
|
||||
*/
|
||||
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION,
|
||||
NULL), /**<
|
||||
`version ` Read-only flag that returns an a compound term with the
|
||||
`version ` Read-only flag that returns a compound term with the
|
||||
current version of YAP. The term will have the name `yap` and arity 4, the first
|
||||
argument will be the
|
||||
major version, the second the minor version, the third the patch number, and the
|
||||
|
56
H/YapText.h
56
H/YapText.h
@ -31,6 +31,22 @@
|
||||
#include "../utf8proc/utf8proc.h"
|
||||
#include "Yap.h"
|
||||
|
||||
/// allocate a temporary text block
|
||||
///
|
||||
extern void *Malloc(size_t sz USES_REGS);
|
||||
extern void *Realloc(void *buf, size_t sz USES_REGS);
|
||||
extern void Free(void *buf USES_REGS);
|
||||
|
||||
extern int push_text_stack(USES_REGS1);
|
||||
extern int pop_text_stack(int lvl USES_REGS);
|
||||
extern void *protected_pop_text_stack(int lvl, void *safe, bool tmp,
|
||||
size_t sz USES_REGS);
|
||||
|
||||
#ifndef min
|
||||
#define min(x, y) (x < y ? x : y)
|
||||
#endif
|
||||
|
||||
#define MBYTE (1024 * 1024)
|
||||
|
||||
/* Character types for tokenizer and write.c */
|
||||
|
||||
@ -142,12 +158,20 @@ INLINE_ONLY EXTERN inline char_kind_t chtype(Int ch) {
|
||||
#define __android_log_print(...)
|
||||
#endif
|
||||
|
||||
inline static utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr, size_t n,
|
||||
INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
|
||||
size_t n,
|
||||
utf8proc_int32_t *valp);
|
||||
|
||||
INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
|
||||
size_t n,
|
||||
utf8proc_int32_t *valp) {
|
||||
return utf8proc_iterate(ptr, n, valp);
|
||||
}
|
||||
|
||||
inline static utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
||||
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
||||
utf8proc_int32_t val);
|
||||
|
||||
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
||||
utf8proc_int32_t val) {
|
||||
return utf8proc_encode_char(val, ptr);
|
||||
}
|
||||
@ -178,7 +202,7 @@ inline static utf8proc_ssize_t strlen_utf8(const utf8proc_uint8_t *pt) {
|
||||
return rc;
|
||||
else if (b > 0) {
|
||||
pt += l;
|
||||
rc += l;
|
||||
rc++;
|
||||
} else {
|
||||
pt++;
|
||||
}
|
||||
@ -274,7 +298,8 @@ inline static int cmpn_utf8(const utf8proc_uint8_t *pt1,
|
||||
#define SURROGATE_OFFSET \
|
||||
((uint32_t)0x10000 - (uint32_t)(0xD800 << 10) - (uint32_t)0xDC00)
|
||||
|
||||
const char *Yap_tokRep(TokEntry *tokptr, encoding_t enc);
|
||||
extern const char *Yap_tokText(void *tokptr);
|
||||
extern Term Yap_tokRep(void *tokptr);
|
||||
|
||||
// standard strings
|
||||
|
||||
@ -658,6 +683,17 @@ static inline Term Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) {
|
||||
return out.val.t;
|
||||
}
|
||||
|
||||
static inline wchar_t *Yap_AtomToWide(Atom at USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
inp.val.a = at;
|
||||
inp.type = YAP_STRING_ATOM;
|
||||
out.val.uc = NULL;
|
||||
out.type = YAP_STRING_WCHARS;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return NIL;
|
||||
return out.val.w;
|
||||
}
|
||||
|
||||
static inline Term Yap_AtomicToTBQ(Term t0, Term mod USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
|
||||
@ -1350,6 +1386,18 @@ static inline Term Yap_UTF8ToString(const char *s USES_REGS) {
|
||||
return MkStringTerm(s);
|
||||
}
|
||||
|
||||
static inline Atom UTF32ToAtom(const wchar_t *s USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
|
||||
inp.val.w0 = s;
|
||||
inp.type = YAP_STRING_WCHARS;
|
||||
out.type = YAP_STRING_ATOM;
|
||||
out.max = -1;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.a;
|
||||
}
|
||||
|
||||
static inline Term Yap_WCharsToListOfCodes(const wchar_t *s USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
inp.val.w0 = s;
|
||||
|
@ -35,9 +35,6 @@ extern struct operator_entry *
|
||||
extern Atom Yap_LookupAtom(const char *);
|
||||
extern Atom Yap_ULookupAtom(const unsigned char *);
|
||||
extern Atom Yap_LookupAtomWithLength(const char *, size_t);
|
||||
extern Atom Yap_LookupUTF8Atom(const unsigned char *);
|
||||
extern Atom Yap_LookupMaybeWideAtom(const wchar_t *);
|
||||
extern Atom Yap_LookupMaybeWideAtomWithLength(const wchar_t *, size_t);
|
||||
extern Atom Yap_FullLookupAtom(const char *);
|
||||
extern void Yap_LookupAtomWithAddress(const char *, struct AtomEntryStruct *);
|
||||
extern Prop Yap_NewPredPropByFunctor(struct FunctorEntryStruct *, Term);
|
||||
@ -447,6 +444,8 @@ extern intptr_t system_thread_id(void);
|
||||
extern void Yap_InitLowLevelTrace(void);
|
||||
#endif
|
||||
|
||||
extern void *Yap_InitTextAllocator( void );
|
||||
|
||||
/* udi.c */
|
||||
extern void Yap_udi_init(void);
|
||||
extern void Yap_udi_abolish(struct pred_entry *);
|
||||
|
59
H/Yatom.h
59
H/Yatom.h
@ -198,58 +198,6 @@ INLINE_ONLY inline EXTERN PropFlags IsGlobalProperty(int flags) {
|
||||
return (PropFlags)((flags == GlobalProperty));
|
||||
}
|
||||
|
||||
/* Wide Atom property */
|
||||
typedef struct {
|
||||
Prop NextOfPE; /* used to chain properties */
|
||||
PropFlags KindOfPE; /* kind of property */
|
||||
UInt SizeOfAtom; /* index in module table */
|
||||
} WideAtomEntry;
|
||||
|
||||
#if USE_OFFSETS_IN_PROPS
|
||||
|
||||
INLINE_ONLY inline EXTERN WideAtomEntry *RepWideAtomProp(Prop p);
|
||||
|
||||
INLINE_ONLY inline EXTERN WideAtomEntry *RepWideAtomProp(Prop p) {
|
||||
return (WideAtomEntry *)(AtomBase + Unsigned(p));
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN Prop AbsWideAtomProp(WideAtomEntry *p);
|
||||
|
||||
INLINE_ONLY inline EXTERN Prop AbsWideAtomProp(WideAtomEntry *p) {
|
||||
return (Prop)(Addr(p) - AtomBase);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
INLINE_ONLY inline EXTERN WideAtomEntry *RepWideAtomProp(Prop p);
|
||||
|
||||
INLINE_ONLY inline EXTERN WideAtomEntry *RepWideAtomProp(Prop p) {
|
||||
return (WideAtomEntry *)(p);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN Prop AbsWideAtomProp(WideAtomEntry *p);
|
||||
|
||||
INLINE_ONLY inline EXTERN Prop AbsWideAtomProp(WideAtomEntry *p) {
|
||||
return (Prop)(p);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define WideAtomProperty ((PropFlags)0xfff8)
|
||||
|
||||
INLINE_ONLY inline EXTERN bool IsWideAtomProperty(PropFlags);
|
||||
|
||||
INLINE_ONLY inline EXTERN bool IsWideAtomProperty(PropFlags flags) {
|
||||
return (flags == WideAtomProperty);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN bool IsWideAtom(Atom);
|
||||
|
||||
INLINE_ONLY inline EXTERN bool IsWideAtom(Atom at) {
|
||||
return RepAtom(at)->PropsOfAE != NIL &&
|
||||
IsWideAtomProperty(RepWideAtomProp(RepAtom(at)->PropsOfAE)->KindOfPE);
|
||||
}
|
||||
|
||||
/** Module property: low-level data used to manage modes.
|
||||
|
||||
Includes lists of pedicates, operators and other well-defIned
|
||||
@ -1609,16 +1557,9 @@ INLINE_ONLY EXTERN inline void AddPropToAtom(AtomEntry *, PropEntry *p);
|
||||
INLINE_ONLY EXTERN inline void AddPropToAtom(AtomEntry *ae, PropEntry *p) {
|
||||
/* old properties should be always last, and wide atom properties
|
||||
should always be first */
|
||||
if (ae->PropsOfAE != NIL &&
|
||||
RepProp(ae->PropsOfAE)->KindOfPE == WideAtomProperty) {
|
||||
PropEntry *pp = RepProp(ae->PropsOfAE);
|
||||
p->NextOfPE = pp->NextOfPE;
|
||||
pp->NextOfPE = AbsProp(p);
|
||||
} else {
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsProp(p);
|
||||
}
|
||||
}
|
||||
|
||||
// auxiliary functions
|
||||
|
||||
|
13
H/absmi.h
13
H/absmi.h
@ -99,7 +99,8 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */
|
||||
#define LIMITED_PREFETCH 1
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#if defined(__arm__) || defined(__thumb__) || defined(mips) || defined(__mips64) || defined(__aarch64__)
|
||||
#if defined(__arm__) || defined(__thumb__) || defined(mips) || \
|
||||
defined(__mips64) || defined(__aarch64__)
|
||||
|
||||
#define Y_IN_MEM 1
|
||||
#define S_IN_MEM 1
|
||||
@ -2075,7 +2076,8 @@ cufail:
|
||||
|
||||
#endif
|
||||
|
||||
#if /* defined(IN_ABSMI_C) ||*/ defined(IN_INLINES_C) /*|| defined(IN_TRACED_ABSMI_C) */
|
||||
#if /* defined(IN_ABSMI_C) ||*/ defined( \
|
||||
IN_INLINES_C) /*|| defined(IN_TRACED_ABSMI_C) */
|
||||
|
||||
static int iequ_complex(register CELL *pt0, register CELL *pt0_end,
|
||||
register CELL *pt1) {
|
||||
@ -2450,4 +2452,11 @@ extern yamop *headoftrace;
|
||||
ENDD(d0);
|
||||
#endif
|
||||
|
||||
#define Yap_AsmError(e, d) \
|
||||
{ \
|
||||
saveregs(); \
|
||||
Yap_ThrowError(e, d, "while exwcuting inlined built-in"); \
|
||||
setregs(); \
|
||||
}
|
||||
|
||||
#endif // ABSMI_H
|
||||
|
46
H/arith2.h
46
H/arith2.h
@ -301,12 +301,12 @@ static Term p_div(Term t1, Term t2 USES_REGS) {
|
||||
Int i1 = IntegerOfTerm(t1), i2 = IntegerOfTerm(t2);
|
||||
|
||||
if (i2 == 0) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "// /2");
|
||||
Yap_ArithError(EVALUATION_ERROR_ZERO_DIVISOR, t2, "// /2");
|
||||
} else if (i1 == Int_MIN && i2 == -1) {
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_add_ints(Int_MAX, 1);
|
||||
#else
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, t1,
|
||||
Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, t1,
|
||||
"rem/2 with %d and %d", i1, i2);
|
||||
#endif
|
||||
} else {
|
||||
@ -314,7 +314,7 @@ static Term p_div(Term t1, Term t2 USES_REGS) {
|
||||
}
|
||||
}
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "// /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "// /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
/* dividing a bignum by an integer */
|
||||
@ -325,7 +325,7 @@ static Term p_div(Term t1, Term t2 USES_REGS) {
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "// /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "// /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -336,7 +336,7 @@ static Term p_div(Term t1, Term t2 USES_REGS) {
|
||||
/* two bignums */
|
||||
return Yap_gmp_div_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "// /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "// /2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -355,7 +355,7 @@ static Term p_and(Term t1, Term t2 USES_REGS) {
|
||||
/* two integers */
|
||||
RINT(IntegerOfTerm(t1) & IntegerOfTerm(t2));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "/\\ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "/\\ /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_and_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -365,7 +365,7 @@ static Term p_and(Term t1, Term t2 USES_REGS) {
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "/\\ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "/\\ /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -376,7 +376,7 @@ static Term p_and(Term t1, Term t2 USES_REGS) {
|
||||
/* two bignums */
|
||||
return Yap_gmp_and_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "/\\ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "/\\ /2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -395,7 +395,7 @@ static Term p_or(Term t1, Term t2 USES_REGS) {
|
||||
/* two integers */
|
||||
RINT(IntegerOfTerm(t1) | IntegerOfTerm(t2));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_gmp_ior_int_big(IntegerOfTerm(t1), t2);
|
||||
@ -405,7 +405,7 @@ static Term p_or(Term t1, Term t2 USES_REGS) {
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "\\/ /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -416,7 +416,7 @@ static Term p_or(Term t1, Term t2 USES_REGS) {
|
||||
/* two bignums */
|
||||
return Yap_gmp_ior_big_big(t1, t2);
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "\\/ /2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -438,33 +438,33 @@ static Term p_sll(Term t1, Term t2 USES_REGS) {
|
||||
|
||||
if (i2 <= 0) {
|
||||
if (i2 == Int_MIN) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
}
|
||||
RINT(SLR(IntegerOfTerm(t1), -i2));
|
||||
}
|
||||
return do_sll(IntegerOfTerm(t1), i2 PASS_REGS);
|
||||
}
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "<</2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "<</2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, "<</2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, "<</2");
|
||||
#endif
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, "<< /2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, "<< /2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
return Yap_gmp_sll_big_int(t1, IntegerOfTerm(t2));
|
||||
case big_int_e:
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "<</2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, "<</2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
@ -486,33 +486,33 @@ static Term p_slr(Term t1, Term t2 USES_REGS) {
|
||||
|
||||
if (i2 < 0) {
|
||||
if (i2 == Int_MIN) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
}
|
||||
return do_sll(IntegerOfTerm(t1), -i2 PASS_REGS);
|
||||
}
|
||||
RINT(SLR(IntegerOfTerm(t1), i2));
|
||||
}
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, ">>/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, ">>/2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
#endif
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
break;
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t1, ">>/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t1, ">>/2");
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
return Yap_gmp_sll_big_int(t1, -IntegerOfTerm(t2));
|
||||
case big_int_e:
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, ">>/2");
|
||||
Yap_ArithError(TYPE_ERROR_INTEGER, t2, ">>/2");
|
||||
default:
|
||||
RERROR();
|
||||
}
|
||||
|
17
H/eval.h
17
H/eval.h
@ -375,6 +375,7 @@ Functor EvalArg(Term);
|
||||
eval_flt = (F); \
|
||||
return (FFloat); \
|
||||
}
|
||||
|
||||
#define REvalError() \
|
||||
{ return (FError); }
|
||||
|
||||
@ -406,9 +407,13 @@ yamop *Yap_EvalError__(const char *, const char *, int, yap_error_number, Term,
|
||||
...);
|
||||
|
||||
#define Yap_ArithError(id, t, ...) \
|
||||
Yap_ArithError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
||||
Int Yap_ArithError__(const char *, const char *, int, yap_error_number, Term,
|
||||
...);
|
||||
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
||||
#define Yap_BinError(id) \
|
||||
Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
||||
#define Yap_AbsmiError(id) \
|
||||
Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
||||
extern Int Yap_ArithError__(const char *, const char *, int, yap_error_number,
|
||||
Term, ...);
|
||||
|
||||
#include "inline-only.h"
|
||||
|
||||
@ -463,7 +468,11 @@ Atom Yap_NameOfBinaryOp(int i);
|
||||
#define RINT(v) return (MkIntegerTerm(v))
|
||||
#define RFLOAT(v) return (MkFloatTerm(v))
|
||||
#define RBIG(v) return (Yap_MkBigIntTerm(v))
|
||||
#define RERROR() return (0L)
|
||||
#define RERROR() \
|
||||
{ \
|
||||
Yap_BinError(LOCAL_Error_TYPE); \
|
||||
return (0L); \
|
||||
}
|
||||
|
||||
static inline blob_type ETypeOfTerm(Term t) {
|
||||
if (IsIntTerm(t))
|
||||
|
@ -121,8 +121,6 @@
|
||||
#define REMOTE_ArenaOverflows(wid) REMOTE(wid)->ArenaOverflows_
|
||||
#define LOCAL_DepthArenas LOCAL->DepthArenas_
|
||||
#define REMOTE_DepthArenas(wid) REMOTE(wid)->DepthArenas_
|
||||
#define LOCAL_ArithError LOCAL->ArithError_
|
||||
#define REMOTE_ArithError(wid) REMOTE(wid)->ArithError_
|
||||
#define LOCAL_LastAssertedPred LOCAL->LastAssertedPred_
|
||||
#define REMOTE_LastAssertedPred(wid) REMOTE(wid)->LastAssertedPred_
|
||||
#define LOCAL_TmpPred LOCAL->TmpPred_
|
||||
@ -288,16 +286,10 @@
|
||||
#define REMOTE_TrailBase(wid) REMOTE(wid)->TrailBase_
|
||||
#define LOCAL_TrailTop LOCAL->TrailTop_
|
||||
#define REMOTE_TrailTop(wid) REMOTE(wid)->TrailTop_
|
||||
#define LOCAL_ErrorMessage LOCAL->ErrorMessage_
|
||||
#define REMOTE_ErrorMessage(wid) REMOTE(wid)->ErrorMessage_
|
||||
#define LOCAL_Error_Term LOCAL->Error_Term_
|
||||
#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_
|
||||
|
||||
#define LOCAL_ActiveError LOCAL->ActiveError_
|
||||
#define REMOTE_ActiveError(wid) REMOTE(wid)->ActiveError_
|
||||
|
||||
#define LOCAL_BallTerm LOCAL->BallTerm_
|
||||
#define REMOTE_BallTerm(wid) REMOTE(wid)->BallTerm_
|
||||
#define LOCAL_IOBotch LOCAL->IOBotch_
|
||||
#define REMOTE_IOBotch(wid) REMOTE(wid)->IOBotch_
|
||||
#define LOCAL_tokptr LOCAL->tokptr_
|
||||
@ -352,14 +344,10 @@
|
||||
#define LOCAL_s_dbg LOCAL->s_dbg_
|
||||
#define REMOTE_s_dbg(wid) REMOTE(wid)->s_dbg_
|
||||
|
||||
#define LOCAL_matherror LOCAL->matherror_
|
||||
#define REMOTE_matherror(wid) REMOTE(wid)->matherror_
|
||||
#define LOCAL_mathtt LOCAL->mathtt_
|
||||
#define REMOTE_mathtt(wid) REMOTE(wid)->mathtt_
|
||||
#define LOCAL_mathstring LOCAL->mathstring_
|
||||
#define REMOTE_mathstring(wid) REMOTE(wid)->mathstring_
|
||||
#define LOCAL_CurrentError LOCAL->CurrentError_
|
||||
#define REMOTE_CurrentError(wid) REMOTE(wid)->CurrentError_
|
||||
|
||||
#define LOCAL_heap_overflows LOCAL->heap_overflows_
|
||||
#define REMOTE_heap_overflows(wid) REMOTE(wid)->heap_overflows_
|
||||
|
@ -69,7 +69,6 @@ typedef struct worker_local {
|
||||
UInt GlobalArenaOverflows_;
|
||||
Int ArenaOverflows_;
|
||||
Int DepthArenas_;
|
||||
int ArithError_;
|
||||
struct pred_entry* LastAssertedPred_;
|
||||
struct pred_entry* TmpPred_;
|
||||
char* ScannerStack_;
|
||||
@ -164,12 +163,9 @@ typedef struct worker_local {
|
||||
ADDR GlobalBase_;
|
||||
ADDR TrailBase_;
|
||||
ADDR TrailTop_;
|
||||
char* ErrorMessage_;
|
||||
Term Error_Term_;
|
||||
/** error handling info, designed to be easy to pass to the foreign world */
|
||||
struct yap_error_descriptor ActiveError_;
|
||||
/* error handling info, designed to be easy to pass to the foreign world */
|
||||
yap_error_descriptor_t* ActiveError_;
|
||||
/// pointer to an exception term, from throw
|
||||
struct DB_TERM* BallTerm_;
|
||||
jmp_buf IOBotch_;
|
||||
TokEntry* tokptr_;
|
||||
TokEntry* toktide_;
|
||||
@ -201,10 +197,8 @@ typedef struct worker_local {
|
||||
//dbase.c
|
||||
struct db_globs* s_dbg_;
|
||||
//eval.c
|
||||
yap_error_number matherror_;
|
||||
Term mathtt_;
|
||||
char* mathstring_;
|
||||
yap_error_number CurrentError_;
|
||||
//grow.c
|
||||
int heap_overflows_;
|
||||
Int total_heap_overflow_time_;
|
||||
|
@ -24,9 +24,14 @@
|
||||
AtomAttributedModule = Yap_LookupAtom("attributes_module"); TermAttributedModule = MkAtomTerm(AtomAttributedModule);
|
||||
AtomDoubleArrow = Yap_LookupAtom("-->"); TermDoubleArrow = MkAtomTerm(AtomDoubleArrow);
|
||||
AtomAssert = Yap_LookupAtom(":-"); TermAssert = MkAtomTerm(AtomAssert);
|
||||
AtomBeginBracket = Yap_LookupAtom("("); TermBeginBracket = MkAtomTerm(AtomBeginBracket);
|
||||
AtomEndBracket = Yap_LookupAtom(")"); TermEndBracket = MkAtomTerm(AtomEndBracket);
|
||||
AtomBeginSquareBracket = Yap_LookupAtom("["); TermBeginSquareBracket = MkAtomTerm(AtomBeginSquareBracket);
|
||||
AtomEndSquareBracket = Yap_LookupAtom("]"); TermEndSquareBracket = MkAtomTerm(AtomEndSquareBracket);
|
||||
AtomBeginCurlyBracket = Yap_LookupAtom("{"); TermBeginCurlyBracket = MkAtomTerm(AtomBeginCurlyBracket);
|
||||
AtomEndCurlyBracket = Yap_LookupAtom("}"); TermEndCurlyBracket = MkAtomTerm(AtomEndCurlyBracket);
|
||||
AtomEmptyBrackets = Yap_LookupAtom("()"); TermEmptyBrackets = MkAtomTerm(AtomEmptyBrackets);
|
||||
AtomEmptySquareBrackets = Yap_LookupAtom("[]"); TermEmptySquareBrackets = MkAtomTerm(AtomEmptySquareBrackets);
|
||||
AtomEmptyCurlyBrackets = Yap_LookupAtom("{}"); TermEmptyCurlyBrackets = MkAtomTerm(AtomEmptyCurlyBrackets);
|
||||
AtomAsserta = Yap_LookupAtom("asserta"); TermAsserta = MkAtomTerm(AtomAsserta);
|
||||
AtomAssertaStatic = Yap_LookupAtom("asserta_static"); TermAssertaStatic = MkAtomTerm(AtomAssertaStatic);
|
||||
AtomAssertz = Yap_LookupAtom("assertz"); TermAssertz = MkAtomTerm(AtomAssertz);
|
||||
@ -63,6 +68,7 @@
|
||||
AtomCharset = Yap_LookupAtom("charset"); TermCharset = MkAtomTerm(AtomCharset);
|
||||
AtomChType = Yap_FullLookupAtom("$char_type"); TermChType = MkAtomTerm(AtomChType);
|
||||
AtomCleanCall = Yap_FullLookupAtom("$clean_call"); TermCleanCall = MkAtomTerm(AtomCleanCall);
|
||||
AtomClose = Yap_LookupAtom("close"); TermClose = MkAtomTerm(AtomClose);
|
||||
AtomColon = Yap_LookupAtom(":"); TermColon = MkAtomTerm(AtomColon);
|
||||
AtomCodeSpace = Yap_LookupAtom("code_space"); TermCodeSpace = MkAtomTerm(AtomCodeSpace);
|
||||
AtomCodes = Yap_LookupAtom("codes"); TermCodes = MkAtomTerm(AtomCodes);
|
||||
@ -84,7 +90,7 @@
|
||||
AtomCurrentModule = Yap_FullLookupAtom("$current_module"); TermCurrentModule = MkAtomTerm(AtomCurrentModule);
|
||||
AtomCut = Yap_LookupAtom("!"); TermCut = MkAtomTerm(AtomCut);
|
||||
AtomCutBy = Yap_FullLookupAtom("$cut_by"); TermCutBy = MkAtomTerm(AtomCutBy);
|
||||
AtomDAbort = Yap_FullLookupAtom("$abort"); TermDAbort = MkAtomTerm(AtomDAbort);
|
||||
AtomDAbort = Yap_LookupAtom("abort"); TermDAbort = MkAtomTerm(AtomDAbort);
|
||||
AtomDBLoad = Yap_FullLookupAtom("$db_load"); TermDBLoad = MkAtomTerm(AtomDBLoad);
|
||||
AtomDBREF = Yap_LookupAtom("DBRef"); TermDBREF = MkAtomTerm(AtomDBREF);
|
||||
AtomDBReference = Yap_LookupAtom("db_reference"); TermDBReference = MkAtomTerm(AtomDBReference);
|
||||
@ -185,6 +191,7 @@
|
||||
AtomIgnore = Yap_LookupAtom("ignore"); TermIgnore = MkAtomTerm(AtomIgnore);
|
||||
AtomInf = Yap_LookupAtom("inf"); TermInf = MkAtomTerm(AtomInf);
|
||||
AtomInfinity = Yap_LookupAtom("infinity"); TermInfinity = MkAtomTerm(AtomInfinity);
|
||||
AtomInfo = Yap_LookupAtom("info"); TermInfo = MkAtomTerm(AtomInfo);
|
||||
AtomInitGoal = Yap_FullLookupAtom("$init_goal"); TermInitGoal = MkAtomTerm(AtomInitGoal);
|
||||
AtomInitProlog = Yap_FullLookupAtom("$init_prolog"); TermInitProlog = MkAtomTerm(AtomInitProlog);
|
||||
AtomInStackExpansion = Yap_LookupAtom("in stack expansion"); TermInStackExpansion = MkAtomTerm(AtomInStackExpansion);
|
||||
@ -196,6 +203,7 @@
|
||||
AtomInternalCompilerError = Yap_LookupAtom("internal_compiler_error"); TermInternalCompilerError = MkAtomTerm(AtomInternalCompilerError);
|
||||
AtomIs = Yap_LookupAtom("is"); TermIs = MkAtomTerm(AtomIs);
|
||||
AtomJ = Yap_LookupAtom("j"); TermJ = MkAtomTerm(AtomJ);
|
||||
Atoml = Yap_LookupAtom("l"); Terml = MkAtomTerm(Atoml);
|
||||
AtomKey = Yap_LookupAtom("key"); TermKey = MkAtomTerm(AtomKey);
|
||||
AtomLDLibraryPath = Yap_LookupAtom("LD_LIBRARY_PATH"); TermLDLibraryPath = MkAtomTerm(AtomLDLibraryPath);
|
||||
AtomLONGINT = Yap_LookupAtom("LongInt"); TermLONGINT = MkAtomTerm(AtomLONGINT);
|
||||
@ -281,6 +289,7 @@
|
||||
AtomPermissionError = Yap_LookupAtom("permission_error"); TermPermissionError = MkAtomTerm(AtomPermissionError);
|
||||
AtomPi = Yap_LookupAtom("pi"); TermPi = MkAtomTerm(AtomPi);
|
||||
AtomPipe = Yap_LookupAtom("pipe"); TermPipe = MkAtomTerm(AtomPipe);
|
||||
AtomPriority = Yap_LookupAtom("priority"); TermPriority = MkAtomTerm(AtomPriority);
|
||||
AtomPlus = Yap_LookupAtom("+"); TermPlus = MkAtomTerm(AtomPlus);
|
||||
AtomPointer = Yap_LookupAtom("pointer"); TermPointer = MkAtomTerm(AtomPointer);
|
||||
AtomPortray = Yap_FullLookupAtom("portray"); TermPortray = MkAtomTerm(AtomPortray);
|
||||
@ -483,9 +492,9 @@
|
||||
FunctorDot7 = Yap_MkFunctor(AtomDot,7);
|
||||
FunctorDot8 = Yap_MkFunctor(AtomDot,8);
|
||||
FunctorDot9 = Yap_MkFunctor(AtomDot,9);
|
||||
FunctorDoubleArrow = Yap_MkFunctor(AtomDoubleArrow,2);
|
||||
FunctorDoubleSlash = Yap_MkFunctor(AtomDoubleSlash,2);
|
||||
FunctorEmptySquareBrackets = Yap_MkFunctor(AtomEmptySquareBrackets,2);
|
||||
FunctorEmptyCurlyBrackets = Yap_MkFunctor(AtomEmptyCurlyBrackets,2);
|
||||
FunctorEq = Yap_MkFunctor(AtomEq,2);
|
||||
FunctorError = Yap_MkFunctor(AtomError,2);
|
||||
FunctorEvaluationError = Yap_MkFunctor(AtomEvaluationError,1);
|
||||
@ -512,6 +521,10 @@
|
||||
FunctorHat = Yap_MkFunctor(AtomHat,2);
|
||||
FunctorI = Yap_MkFunctor(AtomI,2);
|
||||
FunctorId = Yap_MkFunctor(AtomId,1);
|
||||
FunctorInfo1 = Yap_MkFunctor(AtomInfo,1);
|
||||
FunctorInfo2 = Yap_MkFunctor(AtomInfo,2);
|
||||
FunctorInfo3 = Yap_MkFunctor(AtomInfo,3);
|
||||
FunctorInfo4 = Yap_MkFunctor(AtomInfo,4);
|
||||
FunctorIs = Yap_MkFunctor(AtomIs,2);
|
||||
FunctorJ = Yap_MkFunctor(AtomJ,2);
|
||||
FunctorLastExecuteWithin = Yap_MkFunctor(AtomLastExecuteWithin,1);
|
||||
@ -529,11 +542,13 @@
|
||||
FunctorNot = Yap_MkFunctor(AtomNot,1);
|
||||
FunctorObj = Yap_MkFunctor(AtomObj,1);
|
||||
FunctorOr = Yap_MkFunctor(AtomSemic,2);
|
||||
FunctorOutput = Yap_MkFunctor(AtomOutput,1);
|
||||
FunctorPermissionError = Yap_MkFunctor(AtomPermissionError,3);
|
||||
FunctorPlus = Yap_MkFunctor(AtomPlus,2);
|
||||
FunctorPortray = Yap_MkFunctor(AtomPortray,1);
|
||||
FunctorPrintMessage = Yap_MkFunctor(AtomPrintMessage,2);
|
||||
FunctorProcedure = Yap_MkFunctor(AtomProcedure,5);
|
||||
FunctorPriority = Yap_MkFunctor(AtomPriority,1);
|
||||
FunctorPrologConstraint = Yap_MkFunctor(AtomProlog,2);
|
||||
FunctorProtectStack = Yap_MkFunctor(AtomProtectStack,4);
|
||||
FunctorQuery = Yap_MkFunctor(AtomQuery,1);
|
||||
|
@ -69,7 +69,6 @@ static void InitWorker(int wid) {
|
||||
REMOTE_GlobalArenaOverflows(wid) = 0L;
|
||||
REMOTE_ArenaOverflows(wid) = 0L;
|
||||
REMOTE_DepthArenas(wid) = 0;
|
||||
REMOTE_ArithError(wid) = FALSE;
|
||||
REMOTE_LastAssertedPred(wid) = NULL;
|
||||
REMOTE_TmpPred(wid) = NULL;
|
||||
REMOTE_ScannerStack(wid) = NULL;
|
||||
@ -165,14 +164,11 @@ static void InitWorker(int wid) {
|
||||
|
||||
|
||||
|
||||
REMOTE_ActiveError(wid) = calloc(sizeof(yap_error_descriptor_t),1);
|
||||
|
||||
|
||||
|
||||
|
||||
REMOTE_BallTerm(wid) = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -201,10 +197,8 @@ static void InitWorker(int wid) {
|
||||
|
||||
|
||||
|
||||
REMOTE_matherror(wid) = YAP_NO_ERROR;
|
||||
|
||||
REMOTE_mathstring(wid) = NULL;
|
||||
REMOTE_CurrentError(wid) = YAP_NO_ERROR;
|
||||
|
||||
REMOTE_heap_overflows(wid) = 0;
|
||||
REMOTE_total_heap_overflow_time(wid) = 0;
|
||||
|
@ -24,9 +24,14 @@
|
||||
AtomAttributedModule = AtomAdjust(AtomAttributedModule); TermAttributedModule = MkAtomTerm(AtomAttributedModule);
|
||||
AtomDoubleArrow = AtomAdjust(AtomDoubleArrow); TermDoubleArrow = MkAtomTerm(AtomDoubleArrow);
|
||||
AtomAssert = AtomAdjust(AtomAssert); TermAssert = MkAtomTerm(AtomAssert);
|
||||
AtomBeginBracket = AtomAdjust(AtomBeginBracket); TermBeginBracket = MkAtomTerm(AtomBeginBracket);
|
||||
AtomEndBracket = AtomAdjust(AtomEndBracket); TermEndBracket = MkAtomTerm(AtomEndBracket);
|
||||
AtomBeginSquareBracket = AtomAdjust(AtomBeginSquareBracket); TermBeginSquareBracket = MkAtomTerm(AtomBeginSquareBracket);
|
||||
AtomEndSquareBracket = AtomAdjust(AtomEndSquareBracket); TermEndSquareBracket = MkAtomTerm(AtomEndSquareBracket);
|
||||
AtomBeginCurlyBracket = AtomAdjust(AtomBeginCurlyBracket); TermBeginCurlyBracket = MkAtomTerm(AtomBeginCurlyBracket);
|
||||
AtomEndCurlyBracket = AtomAdjust(AtomEndCurlyBracket); TermEndCurlyBracket = MkAtomTerm(AtomEndCurlyBracket);
|
||||
AtomEmptyBrackets = AtomAdjust(AtomEmptyBrackets); TermEmptyBrackets = MkAtomTerm(AtomEmptyBrackets);
|
||||
AtomEmptySquareBrackets = AtomAdjust(AtomEmptySquareBrackets); TermEmptySquareBrackets = MkAtomTerm(AtomEmptySquareBrackets);
|
||||
AtomEmptyCurlyBrackets = AtomAdjust(AtomEmptyCurlyBrackets); TermEmptyCurlyBrackets = MkAtomTerm(AtomEmptyCurlyBrackets);
|
||||
AtomAsserta = AtomAdjust(AtomAsserta); TermAsserta = MkAtomTerm(AtomAsserta);
|
||||
AtomAssertaStatic = AtomAdjust(AtomAssertaStatic); TermAssertaStatic = MkAtomTerm(AtomAssertaStatic);
|
||||
AtomAssertz = AtomAdjust(AtomAssertz); TermAssertz = MkAtomTerm(AtomAssertz);
|
||||
@ -63,6 +68,7 @@
|
||||
AtomCharset = AtomAdjust(AtomCharset); TermCharset = MkAtomTerm(AtomCharset);
|
||||
AtomChType = AtomAdjust(AtomChType); TermChType = MkAtomTerm(AtomChType);
|
||||
AtomCleanCall = AtomAdjust(AtomCleanCall); TermCleanCall = MkAtomTerm(AtomCleanCall);
|
||||
AtomClose = AtomAdjust(AtomClose); TermClose = MkAtomTerm(AtomClose);
|
||||
AtomColon = AtomAdjust(AtomColon); TermColon = MkAtomTerm(AtomColon);
|
||||
AtomCodeSpace = AtomAdjust(AtomCodeSpace); TermCodeSpace = MkAtomTerm(AtomCodeSpace);
|
||||
AtomCodes = AtomAdjust(AtomCodes); TermCodes = MkAtomTerm(AtomCodes);
|
||||
@ -185,6 +191,7 @@
|
||||
AtomIgnore = AtomAdjust(AtomIgnore); TermIgnore = MkAtomTerm(AtomIgnore);
|
||||
AtomInf = AtomAdjust(AtomInf); TermInf = MkAtomTerm(AtomInf);
|
||||
AtomInfinity = AtomAdjust(AtomInfinity); TermInfinity = MkAtomTerm(AtomInfinity);
|
||||
AtomInfo = AtomAdjust(AtomInfo); TermInfo = MkAtomTerm(AtomInfo);
|
||||
AtomInitGoal = AtomAdjust(AtomInitGoal); TermInitGoal = MkAtomTerm(AtomInitGoal);
|
||||
AtomInitProlog = AtomAdjust(AtomInitProlog); TermInitProlog = MkAtomTerm(AtomInitProlog);
|
||||
AtomInStackExpansion = AtomAdjust(AtomInStackExpansion); TermInStackExpansion = MkAtomTerm(AtomInStackExpansion);
|
||||
@ -196,6 +203,7 @@
|
||||
AtomInternalCompilerError = AtomAdjust(AtomInternalCompilerError); TermInternalCompilerError = MkAtomTerm(AtomInternalCompilerError);
|
||||
AtomIs = AtomAdjust(AtomIs); TermIs = MkAtomTerm(AtomIs);
|
||||
AtomJ = AtomAdjust(AtomJ); TermJ = MkAtomTerm(AtomJ);
|
||||
Atoml = AtomAdjust(Atoml); Terml = MkAtomTerm(Atoml);
|
||||
AtomKey = AtomAdjust(AtomKey); TermKey = MkAtomTerm(AtomKey);
|
||||
AtomLDLibraryPath = AtomAdjust(AtomLDLibraryPath); TermLDLibraryPath = MkAtomTerm(AtomLDLibraryPath);
|
||||
AtomLONGINT = AtomAdjust(AtomLONGINT); TermLONGINT = MkAtomTerm(AtomLONGINT);
|
||||
@ -281,6 +289,7 @@
|
||||
AtomPermissionError = AtomAdjust(AtomPermissionError); TermPermissionError = MkAtomTerm(AtomPermissionError);
|
||||
AtomPi = AtomAdjust(AtomPi); TermPi = MkAtomTerm(AtomPi);
|
||||
AtomPipe = AtomAdjust(AtomPipe); TermPipe = MkAtomTerm(AtomPipe);
|
||||
AtomPriority = AtomAdjust(AtomPriority); TermPriority = MkAtomTerm(AtomPriority);
|
||||
AtomPlus = AtomAdjust(AtomPlus); TermPlus = MkAtomTerm(AtomPlus);
|
||||
AtomPointer = AtomAdjust(AtomPointer); TermPointer = MkAtomTerm(AtomPointer);
|
||||
AtomPortray = AtomAdjust(AtomPortray); TermPortray = MkAtomTerm(AtomPortray);
|
||||
@ -483,9 +492,9 @@
|
||||
FunctorDot7 = FuncAdjust(FunctorDot7);
|
||||
FunctorDot8 = FuncAdjust(FunctorDot8);
|
||||
FunctorDot9 = FuncAdjust(FunctorDot9);
|
||||
FunctorDoubleArrow = FuncAdjust(FunctorDoubleArrow);
|
||||
FunctorDoubleSlash = FuncAdjust(FunctorDoubleSlash);
|
||||
FunctorEmptySquareBrackets = FuncAdjust(FunctorEmptySquareBrackets);
|
||||
FunctorEmptyCurlyBrackets = FuncAdjust(FunctorEmptyCurlyBrackets);
|
||||
FunctorEq = FuncAdjust(FunctorEq);
|
||||
FunctorError = FuncAdjust(FunctorError);
|
||||
FunctorEvaluationError = FuncAdjust(FunctorEvaluationError);
|
||||
@ -512,6 +521,10 @@
|
||||
FunctorHat = FuncAdjust(FunctorHat);
|
||||
FunctorI = FuncAdjust(FunctorI);
|
||||
FunctorId = FuncAdjust(FunctorId);
|
||||
FunctorInfo1 = FuncAdjust(FunctorInfo1);
|
||||
FunctorInfo2 = FuncAdjust(FunctorInfo2);
|
||||
FunctorInfo3 = FuncAdjust(FunctorInfo3);
|
||||
FunctorInfo4 = FuncAdjust(FunctorInfo4);
|
||||
FunctorIs = FuncAdjust(FunctorIs);
|
||||
FunctorJ = FuncAdjust(FunctorJ);
|
||||
FunctorLastExecuteWithin = FuncAdjust(FunctorLastExecuteWithin);
|
||||
@ -529,11 +542,13 @@
|
||||
FunctorNot = FuncAdjust(FunctorNot);
|
||||
FunctorObj = FuncAdjust(FunctorObj);
|
||||
FunctorOr = FuncAdjust(FunctorOr);
|
||||
FunctorOutput = FuncAdjust(FunctorOutput);
|
||||
FunctorPermissionError = FuncAdjust(FunctorPermissionError);
|
||||
FunctorPlus = FuncAdjust(FunctorPlus);
|
||||
FunctorPortray = FuncAdjust(FunctorPortray);
|
||||
FunctorPrintMessage = FuncAdjust(FunctorPrintMessage);
|
||||
FunctorProcedure = FuncAdjust(FunctorProcedure);
|
||||
FunctorPriority = FuncAdjust(FunctorPriority);
|
||||
FunctorPrologConstraint = FuncAdjust(FunctorPrologConstraint);
|
||||
FunctorProtectStack = FuncAdjust(FunctorProtectStack);
|
||||
FunctorQuery = FuncAdjust(FunctorQuery);
|
||||
|
@ -86,7 +86,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef COROUTINING
|
||||
@ -187,9 +186,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -215,8 +211,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef LOAD_DYLD
|
||||
|
||||
#endif
|
||||
|
@ -24,9 +24,14 @@ EXTERNAL Atom AtomArrow; EXTERNAL Term TermArrow;
|
||||
EXTERNAL Atom AtomAttributedModule; EXTERNAL Term TermAttributedModule;
|
||||
EXTERNAL Atom AtomDoubleArrow; EXTERNAL Term TermDoubleArrow;
|
||||
EXTERNAL Atom AtomAssert; EXTERNAL Term TermAssert;
|
||||
EXTERNAL Atom AtomBeginBracket; EXTERNAL Term TermBeginBracket;
|
||||
EXTERNAL Atom AtomEndBracket; EXTERNAL Term TermEndBracket;
|
||||
EXTERNAL Atom AtomBeginSquareBracket; EXTERNAL Term TermBeginSquareBracket;
|
||||
EXTERNAL Atom AtomEndSquareBracket; EXTERNAL Term TermEndSquareBracket;
|
||||
EXTERNAL Atom AtomBeginCurlyBracket; EXTERNAL Term TermBeginCurlyBracket;
|
||||
EXTERNAL Atom AtomEndCurlyBracket; EXTERNAL Term TermEndCurlyBracket;
|
||||
EXTERNAL Atom AtomEmptyBrackets; EXTERNAL Term TermEmptyBrackets;
|
||||
EXTERNAL Atom AtomEmptySquareBrackets; EXTERNAL Term TermEmptySquareBrackets;
|
||||
EXTERNAL Atom AtomEmptyCurlyBrackets; EXTERNAL Term TermEmptyCurlyBrackets;
|
||||
EXTERNAL Atom AtomAsserta; EXTERNAL Term TermAsserta;
|
||||
EXTERNAL Atom AtomAssertaStatic; EXTERNAL Term TermAssertaStatic;
|
||||
EXTERNAL Atom AtomAssertz; EXTERNAL Term TermAssertz;
|
||||
@ -63,6 +68,7 @@ EXTERNAL Atom AtomChars; EXTERNAL Term TermChars;
|
||||
EXTERNAL Atom AtomCharset; EXTERNAL Term TermCharset;
|
||||
EXTERNAL Atom AtomChType; EXTERNAL Term TermChType;
|
||||
EXTERNAL Atom AtomCleanCall; EXTERNAL Term TermCleanCall;
|
||||
EXTERNAL Atom AtomClose; EXTERNAL Term TermClose;
|
||||
EXTERNAL Atom AtomColon; EXTERNAL Term TermColon;
|
||||
EXTERNAL Atom AtomCodeSpace; EXTERNAL Term TermCodeSpace;
|
||||
EXTERNAL Atom AtomCodes; EXTERNAL Term TermCodes;
|
||||
@ -185,6 +191,7 @@ EXTERNAL Atom AtomId; EXTERNAL Term TermId;
|
||||
EXTERNAL Atom AtomIgnore; EXTERNAL Term TermIgnore;
|
||||
EXTERNAL Atom AtomInf; EXTERNAL Term TermInf;
|
||||
EXTERNAL Atom AtomInfinity; EXTERNAL Term TermInfinity;
|
||||
EXTERNAL Atom AtomInfo; EXTERNAL Term TermInfo;
|
||||
EXTERNAL Atom AtomInitGoal; EXTERNAL Term TermInitGoal;
|
||||
EXTERNAL Atom AtomInitProlog; EXTERNAL Term TermInitProlog;
|
||||
EXTERNAL Atom AtomInStackExpansion; EXTERNAL Term TermInStackExpansion;
|
||||
@ -196,6 +203,7 @@ EXTERNAL Atom AtomInteger; EXTERNAL Term TermInteger;
|
||||
EXTERNAL Atom AtomInternalCompilerError; EXTERNAL Term TermInternalCompilerError;
|
||||
EXTERNAL Atom AtomIs; EXTERNAL Term TermIs;
|
||||
EXTERNAL Atom AtomJ; EXTERNAL Term TermJ;
|
||||
EXTERNAL Atom Atoml; EXTERNAL Term Terml;
|
||||
EXTERNAL Atom AtomKey; EXTERNAL Term TermKey;
|
||||
EXTERNAL Atom AtomLDLibraryPath; EXTERNAL Term TermLDLibraryPath;
|
||||
EXTERNAL Atom AtomLONGINT; EXTERNAL Term TermLONGINT;
|
||||
@ -281,6 +289,7 @@ EXTERNAL Atom AtomPastEndOfStream; EXTERNAL Term TermPastEndOfStream;
|
||||
EXTERNAL Atom AtomPermissionError; EXTERNAL Term TermPermissionError;
|
||||
EXTERNAL Atom AtomPi; EXTERNAL Term TermPi;
|
||||
EXTERNAL Atom AtomPipe; EXTERNAL Term TermPipe;
|
||||
EXTERNAL Atom AtomPriority; EXTERNAL Term TermPriority;
|
||||
EXTERNAL Atom AtomPlus; EXTERNAL Term TermPlus;
|
||||
EXTERNAL Atom AtomPointer; EXTERNAL Term TermPointer;
|
||||
EXTERNAL Atom AtomPortray; EXTERNAL Term TermPortray;
|
||||
@ -537,12 +546,12 @@ EXTERNAL Functor FunctorDot8;
|
||||
|
||||
EXTERNAL Functor FunctorDot9;
|
||||
|
||||
EXTERNAL Functor FunctorDoubleArrow;
|
||||
|
||||
EXTERNAL Functor FunctorDoubleSlash;
|
||||
|
||||
EXTERNAL Functor FunctorEmptySquareBrackets;
|
||||
|
||||
EXTERNAL Functor FunctorEmptyCurlyBrackets;
|
||||
|
||||
EXTERNAL Functor FunctorEq;
|
||||
|
||||
EXTERNAL Functor FunctorError;
|
||||
@ -595,6 +604,14 @@ EXTERNAL Functor FunctorI;
|
||||
|
||||
EXTERNAL Functor FunctorId;
|
||||
|
||||
EXTERNAL Functor FunctorInfo1;
|
||||
|
||||
EXTERNAL Functor FunctorInfo2;
|
||||
|
||||
EXTERNAL Functor FunctorInfo3;
|
||||
|
||||
EXTERNAL Functor FunctorInfo4;
|
||||
|
||||
EXTERNAL Functor FunctorIs;
|
||||
|
||||
EXTERNAL Functor FunctorJ;
|
||||
@ -629,6 +646,8 @@ EXTERNAL Functor FunctorObj;
|
||||
|
||||
EXTERNAL Functor FunctorOr;
|
||||
|
||||
EXTERNAL Functor FunctorOutput;
|
||||
|
||||
EXTERNAL Functor FunctorPermissionError;
|
||||
|
||||
EXTERNAL Functor FunctorPlus;
|
||||
@ -639,6 +658,8 @@ EXTERNAL Functor FunctorPrintMessage;
|
||||
|
||||
EXTERNAL Functor FunctorProcedure;
|
||||
|
||||
EXTERNAL Functor FunctorPriority;
|
||||
|
||||
EXTERNAL Functor FunctorPrologConstraint;
|
||||
|
||||
EXTERNAL Functor FunctorProtectStack;
|
||||
|
3
H/qly.h
3
H/qly.h
@ -96,10 +96,9 @@ typedef enum {
|
||||
QLY_END_OPS = 11,
|
||||
QLY_START_PREDICATE = 12,
|
||||
QLY_END_PREDICATES = 13,
|
||||
QLY_ATOM_WIDE = 14,
|
||||
QLY_FAILCODE = 15,
|
||||
QLY_ATOM = 16,
|
||||
QLY_ATOM_BLOB = 17
|
||||
QLY_ATOM_BLOB = 14
|
||||
} qlf_tag_t;
|
||||
|
||||
#define STATIC_PRED_FLAGS \
|
||||
|
@ -1460,9 +1460,6 @@ static void RestoreEntries(PropEntry *pp, int int_key USES_REGS) {
|
||||
case ExpProperty:
|
||||
pp->NextOfPE = PropAdjust(pp->NextOfPE);
|
||||
break;
|
||||
case WideAtomProperty:
|
||||
pp->NextOfPE = PropAdjust(pp->NextOfPE);
|
||||
break;
|
||||
case BlobProperty:
|
||||
pp->NextOfPE = PropAdjust(pp->NextOfPE);
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
|
||||
/* This file was generated automatically by "yap -L misc/buildops"
|
||||
please do not update */
|
||||
|
||||
|
||||
while (TRUE) {
|
||||
op_numbers op;
|
||||
|
||||
|
@ -120,7 +120,7 @@ struct page_statistics {
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
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) */
|
||||
size_t structs_in_use; /* same as struct pages (opt.structs.h) */
|
||||
long bytes_in_use;
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ struct threads_dependency_frame {
|
||||
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
typedef struct page_header {
|
||||
volatile int structs_in_use;
|
||||
volatile size_t structs_in_use;
|
||||
void *allocated_area;
|
||||
void *first_free_struct;
|
||||
struct page_header *previous;
|
||||
@ -125,7 +125,7 @@ struct global_page_entry {
|
||||
int structs_per_page;
|
||||
volatile long pages_in_use;
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
volatile long structs_in_use;
|
||||
volatile size_t structs_in_use;
|
||||
};
|
||||
|
||||
struct local_page_entry {
|
||||
@ -133,9 +133,10 @@ struct local_page_entry {
|
||||
struct page_header *first_page;
|
||||
struct page_header *last_page;
|
||||
int structs_per_page;
|
||||
long pages_in_use;
|
||||
|
||||
size_t pages_in_use;
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
long structs_in_use;
|
||||
size_t structs_in_use;
|
||||
};
|
||||
|
||||
#define PgEnt_lock(X) ((X).lock)
|
||||
|
@ -38,7 +38,10 @@ ENDIF(WITH_CPLINT)
|
||||
|
||||
|
||||
#must be last
|
||||
OPTION (WITH_SWIG " Enable SWIG interfaces to foreign languages" ON)
|
||||
IF (WITH_SWIG)
|
||||
add_subDIRECTORY (packages/swig)
|
||||
ENDIF (WITH_SWIG)
|
||||
|
||||
|
||||
# please install doxygen for prolog first
|
||||
@ -50,11 +53,17 @@ add_subDIRECTORY (packages/swig)
|
||||
option (WITH_DOCS
|
||||
"generate YAP docs" OFF)
|
||||
|
||||
# add_subDIRECTORY (docs)
|
||||
IF (WITH_DOCS)
|
||||
add_subDIRECTORY (docs)
|
||||
ENDIF (WITH_DOCS)
|
||||
|
||||
# add_subDIRECTORY (packages/cuda)
|
||||
|
||||
option (WITH_GECODE
|
||||
"interface gecode constraint solver" ON)
|
||||
if (WITH_GECODE)
|
||||
add_subDIRECTORY (packages/gecode)
|
||||
endif()
|
||||
|
||||
add_subDIRECTORY (packages/real)
|
||||
|
||||
@ -68,6 +77,8 @@ add_subDIRECTORY (packages/ProbLog)
|
||||
|
||||
add_subDIRECTORY (packages/swi-minisat2)
|
||||
|
||||
add_subDIRECTORY (packages/clpqr)
|
||||
|
||||
|
||||
#todo: use cmake target builds
|
||||
# option (USE_MAXPERFORMANCE
|
||||
|
@ -105,20 +105,6 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
#cross-compilation support
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation these macro should be defined by toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
# where we have most scripts
|
||||
# set path to additional CMake modules
|
||||
|
||||
@ -141,22 +127,22 @@ if(POLICY CMP0043)
|
||||
endif(POLICY CMP0043)
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
set ( prefix ${YAP_APP_DIR}/build )
|
||||
set ( datarootdir ${prefix}/assets )
|
||||
else()
|
||||
set ( prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set ( datarootdir ${prefix}/share )
|
||||
endif()
|
||||
set ( libpl ${datarootdir}/Yap)
|
||||
set ( includedir "${prefix}/include")
|
||||
set ( exec_prefix "${prefix}")
|
||||
set ( libdir "${exec_prefix}/lib")
|
||||
set ( dlls "${exec_prefix}/lib/Yap")
|
||||
set ( includedir "${prefix}/include")
|
||||
set ( datarootdir "${prefix}/share")
|
||||
if (ANDROID)
|
||||
set ( libpl "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../../../../build/generated/assets/Yap")
|
||||
else()
|
||||
set ( libpl "${datarootdir}/Yap")
|
||||
|
||||
endif()
|
||||
set ( datadir "${datarootdir}")
|
||||
set ( mandir "${datarootdir}/man")
|
||||
set ( bindir "${exec_prefix}/bin")
|
||||
set ( docdir "${exec_prefix}/doc/Yap")
|
||||
set ( docdir "${datarootdir}/doc/Yap")
|
||||
|
||||
set(YAP_ROOTDIR ${prefix})
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
Prolog Commons {#prolog_commons}
|
||||
=============
|
||||
This directory should hold files from the Prolog Commons
|
||||
project. Please see
|
||||
|
||||
|
23
README.md
23
README.md
@ -3,10 +3,10 @@
|
||||

|
||||
</center>
|
||||
|
||||
README for YAP6
|
||||
User Manual for YAP6 (#main)
|
||||
====================
|
||||
|
||||
NOTE: this version of YAP is stil experimental, documentation may be out of date.
|
||||
NOTE: this version of YAP is still experimental, documentation may be out of date.
|
||||
|
||||
## Introduction
|
||||
|
||||
@ -94,22 +94,3 @@ DTAI group of KULeuven.
|
||||
|
||||
+ The [R](http://stoics.org.uk/~nicos/sware/packs/real/) interface package developed by Nicos Angelopoulos,
|
||||
Vítor Santos Costa, João Azevedo, Jan Wielemaker, and Rui Camacho.
|
||||
|
||||
|
||||
Downloading YAP {#download}
|
||||
==============
|
||||
|
||||
The latest development version of Yap-6 is yap-6.3.4 and can be
|
||||
obtained from the repositories
|
||||
|
||||
<http://sourceforge.net/p/yap/yap-6.3>
|
||||
|
||||
and
|
||||
|
||||
<https://github.com/vscosta/yap-6.3>
|
||||
|
||||
YAP-6.3.4 does not use modules. Please just use `git clone` to obtain the distribution.
|
||||
|
||||
Most of these repositories are basically copies of the original
|
||||
repositories at the SWI-Prolog site. YAP-6 will work either with or
|
||||
without these packages.
|
||||
|
337
Untitled
337
Untitled
@ -1,337 +0,0 @@
|
||||
Process: Python [88916]
|
||||
Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
||||
Identifier: Python
|
||||
Version: 2.7.10 (2.7.10)
|
||||
Code Type: X86-64 (Native)
|
||||
Parent Process: Atom Helper [88821]
|
||||
Responsible: Atom [88817]
|
||||
User ID: 501
|
||||
|
||||
Date/Time: 2016-06-12 12:40:34.078 +0100
|
||||
OS Version: Mac OS X 10.11.5 (15F34)
|
||||
Report Version: 11
|
||||
Anonymous UUID: B8085CAA-5C3C-7B89-D7A4-E30E7D5EAC9C
|
||||
|
||||
Sleep/Wake UUID: ABD12798-599D-4E2A-8BAF-24F5ACC919E7
|
||||
|
||||
Time Awake Since Boot: 220000 seconds
|
||||
Time Since Wake: 4000 seconds
|
||||
|
||||
System Integrity Protection: enabled
|
||||
|
||||
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
|
||||
|
||||
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
|
||||
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
|
||||
|
||||
VM Regions Near 0x8:
|
||||
-->
|
||||
__TEXT 0000000105287000-0000000105288000 [ 4K] r-x/rwx SM=COW /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
||||
|
||||
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
|
||||
0 org.python.python 0x000000010532ffce 0x10528f000 + 659406
|
||||
1 org.python.python 0x0000000105330481 PyGILState_Ensure + 55
|
||||
2 com.apple.LLDB.framework 0x0000000108b1e37a lldb_private::ScriptInterpreterPython::Locker::DoAcquireLock() + 28
|
||||
3 com.apple.LLDB.framework 0x0000000108b23a6b lldb_private::ScriptInterpreterPython::Clear() + 37
|
||||
4 com.apple.LLDB.framework 0x000000010885e510 lldb_private::Debugger::Clear() + 266
|
||||
5 com.apple.LLDB.framework 0x000000010885f8ec lldb_private::Debugger::~Debugger() + 28
|
||||
6 com.apple.LLDB.framework 0x000000010885fc0e lldb_private::Debugger::~Debugger() + 14
|
||||
7 libc++.1.dylib 0x00007fff91f31cb8 std::__1::__shared_weak_count::__release_shared() + 44
|
||||
8 com.apple.LLDB.framework 0x00000001068a06cf std::__1::__vector_base<std::__1::shared_ptr<lldb_private::TypeImpl>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeImpl> > >::~__vector_base() + 49
|
||||
9 libsystem_c.dylib 0x00007fff9321246b __cxa_finalize_ranges + 345
|
||||
10 libsystem_c.dylib 0x00007fff9321276f exit + 55
|
||||
11 org.python.python 0x000000010533200c 0x10528f000 + 667660
|
||||
12 org.python.python 0x0000000105331c45 PyErr_PrintEx + 41
|
||||
13 org.python.python 0x0000000105331668 PyRun_SimpleFileExFlags + 750
|
||||
14 org.python.python 0x0000000105343011 Py_Main + 3137
|
||||
15 libdyld.dylib 0x00007fff8d16d5ad start + 1
|
||||
|
||||
Thread 1:
|
||||
0 libsystem_kernel.dylib 0x00007fff9af6bf72 mach_msg_trap + 10
|
||||
1 libsystem_kernel.dylib 0x00007fff9af6b3b3 mach_msg + 55
|
||||
2 com.apple.CoreFoundation 0x00007fff95f861c4 __CFRunLoopServiceMachPort + 212
|
||||
3 com.apple.CoreFoundation 0x00007fff95f8568c __CFRunLoopRun + 1356
|
||||
4 com.apple.CoreFoundation 0x00007fff95f84ed8 CFRunLoopRunSpecific + 296
|
||||
5 com.apple.CoreFoundation 0x00007fff95fc69b1 CFRunLoopRun + 97
|
||||
6 com.apple.DebugSymbols 0x00007fff87a2c69a SpotlightQueryThread(void*) + 346
|
||||
7 libsystem_pthread.dylib 0x00007fff9490e99d _pthread_body + 131
|
||||
8 libsystem_pthread.dylib 0x00007fff9490e91a _pthread_start + 168
|
||||
9 libsystem_pthread.dylib 0x00007fff9490c351 thread_start + 13
|
||||
|
||||
Thread 2:
|
||||
0 libsystem_kernel.dylib 0x00007fff9af725e2 __workq_kernreturn + 10
|
||||
1 libsystem_pthread.dylib 0x00007fff9490e578 _pthread_wqthread + 1283
|
||||
2 libsystem_pthread.dylib 0x00007fff9490c341 start_wqthread + 13
|
||||
|
||||
Thread 3:
|
||||
0 libsystem_kernel.dylib 0x00007fff9af725e2 __workq_kernreturn + 10
|
||||
1 libsystem_pthread.dylib 0x00007fff9490e578 _pthread_wqthread + 1283
|
||||
2 libsystem_pthread.dylib 0x00007fff9490c341 start_wqthread + 13
|
||||
|
||||
Thread 4:: Dispatch queue: com.apple.libdispatch-manager
|
||||
0 libsystem_kernel.dylib 0x00007fff9af72efa kevent_qos + 10
|
||||
1 libdispatch.dylib 0x00007fff87927165 _dispatch_mgr_invoke + 216
|
||||
2 libdispatch.dylib 0x00007fff87926dcd _dispatch_mgr_thread + 52
|
||||
|
||||
Thread 5:
|
||||
0 libsystem_kernel.dylib 0x00007fff9af725e2 __workq_kernreturn + 10
|
||||
1 libsystem_pthread.dylib 0x00007fff9490e578 _pthread_wqthread + 1283
|
||||
2 libsystem_pthread.dylib 0x00007fff9490c341 start_wqthread + 13
|
||||
|
||||
Thread 6:
|
||||
0 libsystem_kernel.dylib 0x00007fff9af725e2 __workq_kernreturn + 10
|
||||
1 libsystem_pthread.dylib 0x00007fff9490e578 _pthread_wqthread + 1283
|
||||
2 libsystem_pthread.dylib 0x00007fff9490c341 start_wqthread + 13
|
||||
|
||||
Thread 7:
|
||||
0 libsystem_kernel.dylib 0x00007fff9af725e2 __workq_kernreturn + 10
|
||||
1 libsystem_pthread.dylib 0x00007fff9490e578 _pthread_wqthread + 1283
|
||||
2 libsystem_pthread.dylib 0x00007fff9490c341 start_wqthread + 13
|
||||
|
||||
Thread 0 crashed with X86 Thread State (64-bit):
|
||||
rax: 0x0000000000000001 rbx: 0x00007fb1e266bdb0 rcx: 0x00000b0000000000 rdx: 0x00007fb1e2403388
|
||||
rdi: 0x00007fb1e2403368 rsi: 0x00000b0000000b00 rbp: 0x00007fff5a9785a0 rsp: 0x00007fff5a978580
|
||||
r8: 0x00000000fffffffc r9: 0x00007fb1e2403380 r10: 0x00000000ffffffff r11: 0xffffffff00000000
|
||||
r12: 0x0000000000000001 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000001
|
||||
rip: 0x000000010532ffce rfl: 0x0000000000010206 cr2: 0x0000000000000008
|
||||
|
||||
Logical CPU: 6
|
||||
Error Code: 0x00000004
|
||||
Trap Number: 14
|
||||
|
||||
|
||||
Binary Images:
|
||||
0x105287000 - 0x105287fff org.python.python (2.7.10 - 2.7.10) <307E6E15-ECF7-3BB2-AF06-3E8D23DFDECA> /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
||||
0x10528f000 - 0x105380ff7 org.python.python (2.7.10 - 2.7.10) <83AFAAA7-BDFA-354D-8A7A-8F40A30ACB91> /System/Library/Frameworks/Python.framework/Versions/2.7/Python
|
||||
0x105746000 - 0x105747fff _locale.so (94) <4394AC91-22AE-3D7D-85C4-792A4F35F3F2> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so
|
||||
0x10580c000 - 0x10580dff7 time.so (94) <94E8BF2A-7841-32AD-8722-6B2526999CA1> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/time.so
|
||||
0x105814000 - 0x105816fff select.so (94) <22170D1C-40EF-303A-8BB7-A48E783F9350> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/select.so
|
||||
0x10581d000 - 0x10581efff fcntl.so (94) <419069D5-A61F-3925-B320-EA7B9E38F44B> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/fcntl.so
|
||||
0x105823000 - 0x105826fff _struct.so (94) <0DCC6B47-A763-3AA6-82C5-B6A58073286B> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_struct.so
|
||||
0x10582d000 - 0x10582ffff binascii.so (94) <9044E1C3-221F-3B79-847A-C9C3D8FEA9FD> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/binascii.so
|
||||
0x105834000 - 0x105835fff cStringIO.so (94) <EC2054BE-E4CD-38B3-BBFB-4FEFB76CF1EF> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/cStringIO.so
|
||||
0x10596c000 - 0x10596dfff libpanel.5.4.dylib (46) <AF43720C-CE1D-3F76-9E99-4CDCB6FAE3C1> /usr/lib/libpanel.5.4.dylib
|
||||
0x1059a2000 - 0x1059b0fff _ctypes.so (94) <57C51BC5-542B-3E78-94AC-0AC3DDEAFE8F> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so
|
||||
0x1059bd000 - 0x1059c1fff itertools.so (94) <889782F7-5414-3881-BAAB-83CACDFDF0C5> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/itertools.so
|
||||
0x1059cb000 - 0x1059cefff operator.so (94) <D60F7C86-DED4-34F8-BA1B-106E044B6F83> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/operator.so
|
||||
0x1059d5000 - 0x1059d6ff7 readline.so (94) <9761BEFB-EF61-3542-B6D7-D4EE20F4FCF2> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
|
||||
0x1059dd000 - 0x1059dffff _collections.so (94) <5FEB3871-0B8F-3233-876C-0E81CF581963> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so
|
||||
0x1059e6000 - 0x1059e7fff _heapq.so (94) <9200023E-75BA-3F20-843C-398C3709CA88> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_heapq.so
|
||||
0x1059ed000 - 0x1059f4ff7 _socket.so (94) <0995C171-1F75-3087-89BE-EC0F68FB1231> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_socket.so
|
||||
0x1059ff000 - 0x105a00fff _functools.so (94) <49B479ED-A07D-322D-9A29-AFF4CA084219> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_functools.so
|
||||
0x105a05000 - 0x105a0efff _ssl.so (94) <027A0AA6-E941-32D2-A091-47C3A43DD846> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ssl.so
|
||||
0x105a1a000 - 0x105a25fff cPickle.so (94) <C34DAE95-E5D5-3B06-9CE1-1FAACAE18EE4> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/cPickle.so
|
||||
0x105a2c000 - 0x105a3bfff _io.so (94) <39FEF2EC-8D20-33A6-B91F-EF7B2FAE9009> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
|
||||
0x105a4c000 - 0x105a4fff7 math.so (94) <216DBA90-4498-361D-8321-B41F9A3B121C> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/math.so
|
||||
0x105a56000 - 0x105a57fff _hashlib.so (94) <D6322B35-8141-3A7B-84CF-07BD4E35C938> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_hashlib.so
|
||||
0x105a5d000 - 0x105a5eff7 _random.so (94) <5A3C615E-01F8-37C2-A3F2-B1EDEB31C954> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_random.so
|
||||
0x105a63000 - 0x105a66ff7 strop.so (94) <44D8B4D6-D536-31EE-94EA-4F3C0FC773FA> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/strop.so
|
||||
0x105a6c000 - 0x105a6cfff _scproxy.so (94) <07D4037C-CB1A-3850-9C0A-A29446A772CE> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_scproxy.so
|
||||
0x105ab1000 - 0x105ab5fff _json.so (94) <8DF51919-72DB-335D-B4F5-D8B3B7A96A89> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_json.so
|
||||
0x105ac0000 - 0x105ac9ff7 datetime.so (94) <94EF278A-0BE1-3990-A13B-2A5F36F64263> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/datetime.so
|
||||
0x10687c000 - 0x10941cff7 com.apple.LLDB.framework (1.350.0.21.9 - 350.0.21.9) <7862FFB0-5204-36DE-A5FA-9BE017CC7E45> /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
|
||||
0x7fff6497b000 - 0x7fff649b225f dyld (360.22) <A468D85E-D8D6-3461-8C99-49D3B9ACFC63> /usr/lib/dyld
|
||||
0x7fff87008000 - 0x7fff872a2ff3 com.apple.security (7.0 - 57337.50.23) <8B6CF71D-A63E-34C9-9227-0AACAB643584> /System/Library/Frameworks/Security.framework/Versions/A/Security
|
||||
0x7fff875a4000 - 0x7fff875a6ff7 com.apple.xpc.ServiceManagement (1.0 - 1) <D96D7A6D-EDEB-35EE-B5D9-E33A3BF011B5> /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement
|
||||
0x7fff875d7000 - 0x7fff875dbfff libGIF.dylib (1450) <DDEA46A2-85B7-32D7-8CC2-8F4C10AA12D5> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib
|
||||
0x7fff8767e000 - 0x7fff87686fff com.apple.CoreServices.FSEvents (1223.10.1 - 1223.10.1) <7F5B7A23-BC1D-3FA9-A9B8-D534F1E1979A> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents
|
||||
0x7fff87765000 - 0x7fff877a7ff7 com.apple.Metal (56.6 - 56.6) <2B2C0F78-20B8-3878-B9B1-DE18BB92919D> /System/Library/Frameworks/Metal.framework/Versions/A/Metal
|
||||
0x7fff877a8000 - 0x7fff8780eff7 libsystem_network.dylib (583.50.1) <B52DAB73-92DC-3DA7-B9F4-B899D66445C1> /usr/lib/system/libsystem_network.dylib
|
||||
0x7fff8780f000 - 0x7fff8791efe7 libvDSP.dylib (563.5) <9AB6CA3C-4F0E-35E6-9184-9DF86E7C3DAD> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
|
||||
0x7fff8791f000 - 0x7fff8794cfff libdispatch.dylib (501.40.12) <C7499857-61A5-3D7D-A5EA-65DCC8C3DF92> /usr/lib/system/libdispatch.dylib
|
||||
0x7fff87961000 - 0x7fff87964fff libCoreVMClient.dylib (119.5) <560D70FB-709F-3030-96C9-F249FCB7DA6D> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib
|
||||
0x7fff87a2b000 - 0x7fff87a65ff7 com.apple.DebugSymbols (132 - 132) <23A42C53-B941-3871-9EE2-4C87A46005B5> /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols
|
||||
0x7fff87a66000 - 0x7fff87a6fff7 com.apple.CommonAuth (4.0 - 2.0) <4B8673E1-3697-3FE2-8D30-AC7AC5D4F8BF> /System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth
|
||||
0x7fff87a9f000 - 0x7fff87abbff3 libresolv.9.dylib (60) <A650B5C8-1950-36A0-86D1-0B2465318BFA> /usr/lib/libresolv.9.dylib
|
||||
0x7fff87b6d000 - 0x7fff87c5fff7 libiconv.2.dylib (44) <F05A0A5A-92A9-3668-8F20-F27CBDA26BE9> /usr/lib/libiconv.2.dylib
|
||||
0x7fff87c60000 - 0x7fff87c60fff com.apple.Accelerate.vecLib (3.10 - vecLib 3.10) <054DFE32-737D-3211-9A14-0FC5E1A880E3> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
|
||||
0x7fff87dcf000 - 0x7fff87e76fff com.apple.LanguageModeling (1.0 - 1) <58C18A47-BDE7-3CBE-81C0-797029D170A1> /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling
|
||||
0x7fff87e77000 - 0x7fff87f27fe7 libvMisc.dylib (563.5) <6D73C20D-D1C4-3BA5-809B-4B597C15AA86> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
|
||||
0x7fff87f5a000 - 0x7fff882aefff com.apple.Foundation (6.9 - 1259) <71A9D3A0-0B1F-3E3A-86F3-1486365A6EF2> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
|
||||
0x7fff88488000 - 0x7fff88488fff com.apple.CoreServices (728.12 - 728.12) <A4FFF004-53B0-3EAC-A13F-5416BFFD8886> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
|
||||
0x7fff884b9000 - 0x7fff8850afff com.apple.audio.CoreAudio (4.3.0 - 4.3.0) <EA7D4F3B-062B-3C81-A98C-C89264D00D48> /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio
|
||||
0x7fff8874d000 - 0x7fff88755ffb libsystem_dnssd.dylib (625.50.5) <4D10E12B-59B5-386F-82DA-326F18028F0A> /usr/lib/system/libsystem_dnssd.dylib
|
||||
0x7fff88756000 - 0x7fff8876cff7 libLinearAlgebra.dylib (1162.2) <FFE54EDF-F06F-3C0A-864A-4CA7BBFD4B2D> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
|
||||
0x7fff8876d000 - 0x7fff8879efff com.apple.GSS (4.0 - 2.0) <B490333A-3B3E-397A-AD75-68846E9A9140> /System/Library/Frameworks/GSS.framework/Versions/A/GSS
|
||||
0x7fff88c4f000 - 0x7fff88d3efff libxml2.2.dylib (29.7) <32BBF51E-B084-3FC2-AE9C-C008BE84102B> /usr/lib/libxml2.2.dylib
|
||||
0x7fff88ef9000 - 0x7fff88f01fff libcopyfile.dylib (127) <A48637BC-F3F2-34F2-BB68-4C65FD012832> /usr/lib/system/libcopyfile.dylib
|
||||
0x7fff88f71000 - 0x7fff88fa7fff libssl.0.9.8.dylib (59.40.2) <523FEBFA-4BF7-3A69-83B7-164265BE7F4D> /usr/lib/libssl.0.9.8.dylib
|
||||
0x7fff88fa8000 - 0x7fff88faaff7 libRadiance.dylib (1450) <BE9E0EBE-C589-3684-B4AE-04F95C8D410A> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib
|
||||
0x7fff893ee000 - 0x7fff89417ff7 libxslt.1.dylib (14.2) <6E8D0F06-9086-32D3-9D87-3870A1CE9E99> /usr/lib/libxslt.1.dylib
|
||||
0x7fff8949d000 - 0x7fff894b7ff3 liblzma.5.dylib (10) <CC03591B-FA57-3CA5-AC81-0D76033AC0CE> /usr/lib/liblzma.5.dylib
|
||||
0x7fff894b8000 - 0x7fff894dcfff libJPEG.dylib (1450) <1775E59E-D82C-3F7A-8E4F-B0C13F88F691> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib
|
||||
0x7fff894dd000 - 0x7fff894e0fff com.apple.IOSurface (108.2.1 - 108.2.1) <A0037B0A-277A-393E-9BF6-688595BD564D> /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface
|
||||
0x7fff89742000 - 0x7fff89747fff com.apple.TCC (1.0 - 1) <F5EEB2D3-9517-3975-97BE-22CB8E11B8A3> /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC
|
||||
0x7fff89b44000 - 0x7fff89b46fff libsystem_coreservices.dylib (19.2) <1B3F5AFC-FFCD-3ECB-8B9A-5538366FB20D> /usr/lib/system/libsystem_coreservices.dylib
|
||||
0x7fff89bdd000 - 0x7fff89bddff7 libunc.dylib (29) <DDB1E947-C775-33B8-B461-63E5EB698F0E> /usr/lib/system/libunc.dylib
|
||||
0x7fff89bde000 - 0x7fff89c09ffb libarchive.2.dylib (33.20.2) <6C370A21-63FD-3A68-B4B3-5333F24B770B> /usr/lib/libarchive.2.dylib
|
||||
0x7fff8a0fc000 - 0x7fff8a16bfff com.apple.SearchKit (1.4.0 - 1.4.0) <F159A888-34CA-36F1-AC8E-EB1B38C9DFB3> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
|
||||
0x7fff8a170000 - 0x7fff8a174fff libcache.dylib (75) <9548AAE9-2AB7-3525-9ECE-A2A7C4688447> /usr/lib/system/libcache.dylib
|
||||
0x7fff8a1e1000 - 0x7fff8a1fdff7 libsystem_malloc.dylib (67.40.1) <5748E8B2-F81C-34C6-8B13-456213127678> /usr/lib/system/libsystem_malloc.dylib
|
||||
0x7fff8a245000 - 0x7fff8a245fff libmetal_timestamp.dylib (600.0.44.1) <6576F284-BACA-332A-A6E7-FA1C347636E3> /System/Library/PrivateFrameworks/GPUCompiler.framework/libmetal_timestamp.dylib
|
||||
0x7fff8a2d9000 - 0x7fff8a2dafff liblangid.dylib (122) <9CC4F0D1-5C51-3B69-BC8F-EE3A51FD0822> /usr/lib/liblangid.dylib
|
||||
0x7fff8a2db000 - 0x7fff8a2e9fff com.apple.opengl (12.1.0 - 12.1.0) <BBC4458E-12FC-3C9B-BF7E-6985D61C7A67> /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
|
||||
0x7fff8ae82000 - 0x7fff8aeabff7 libxpc.dylib (765.50.8) <54D1328E-054E-3DAA-89E2-375722F9D18F> /usr/lib/system/libxpc.dylib
|
||||
0x7fff8aeac000 - 0x7fff8b2a8fff libLAPACK.dylib (1162.2) <987E42B0-5108-3065-87F0-9DF7616A8A06> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
|
||||
0x7fff8b3a2000 - 0x7fff8b648ff7 com.apple.CoreData (120 - 641.3) <A29A5491-6169-372B-828F-84EE0CFD4BC4> /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
|
||||
0x7fff8b649000 - 0x7fff8b678ffb libsystem_m.dylib (3105) <08E1A4B2-6448-3DFE-A58C-ACC7335BE7E4> /usr/lib/system/libsystem_m.dylib
|
||||
0x7fff8be57000 - 0x7fff8be6efff libmarisa.dylib (4) <E4919B03-D9BD-3AF8-B436-C415C98E3F0A> /usr/lib/libmarisa.dylib
|
||||
0x7fff8c64b000 - 0x7fff8c778ff3 com.apple.CoreText (352.0 - 494.11) <08E8640E-6602-3A00-BC28-94235FD311B4> /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText
|
||||
0x7fff8c794000 - 0x7fff8c7e9fff com.apple.AE (701 - 701) <AD492742-F884-386B-A450-FAC281B9FFA4> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
|
||||
0x7fff8c83b000 - 0x7fff8c83dfff com.apple.loginsupport (1.0 - 1) <9B2F5F9B-ED38-313F-B798-D2B667BCD6B5> /System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport
|
||||
0x7fff8cb98000 - 0x7fff8cb9bfff libsystem_sandbox.dylib (460.50.4) <150A9D3D-F69E-32F7-8C7B-8E72CAAFF7E4> /usr/lib/system/libsystem_sandbox.dylib
|
||||
0x7fff8cb9c000 - 0x7fff8cb9cff7 libkeymgr.dylib (28) <8371CE54-5FDD-3CE9-B3DF-E98C761B6FE0> /usr/lib/system/libkeymgr.dylib
|
||||
0x7fff8cbff000 - 0x7fff8cc00fff com.apple.TrustEvaluationAgent (2.0 - 25) <0239494E-FEFE-39BC-9FC7-E251BA5128F1> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent
|
||||
0x7fff8cc01000 - 0x7fff8cc01fff libOpenScriptingUtil.dylib (169.1) <AD0DAC8A-9849-3077-999F-9AEC6112BDAB> /usr/lib/libOpenScriptingUtil.dylib
|
||||
0x7fff8d16a000 - 0x7fff8d16dffb libdyld.dylib (360.22) <CC088C2A-D407-33E7-A6B6-B06E0D4AD999> /usr/lib/system/libdyld.dylib
|
||||
0x7fff8d245000 - 0x7fff8d246fff libffi.dylib (18.1) <5BA9612C-747E-33CE-9DB1-3C01ECF3041D> /usr/lib/libffi.dylib
|
||||
0x7fff8d2e2000 - 0x7fff8d378fff com.apple.ColorSync (4.9.0 - 4.9.0) <8FC37E20-6579-3CB2-9D49-BC39FC38DF87> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync
|
||||
0x7fff8d6fd000 - 0x7fff8d771ff7 com.apple.Heimdal (4.0 - 2.0) <5D365381-8B5E-3259-8867-FC4A7D307BDE> /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal
|
||||
0x7fff8d772000 - 0x7fff8d773fff libDiagnosticMessagesClient.dylib (100) <4243B6B4-21E9-355B-9C5A-95A216233B96> /usr/lib/libDiagnosticMessagesClient.dylib
|
||||
0x7fff8d7e3000 - 0x7fff8d808ff7 libPng.dylib (1450) <F7944170-4854-3CA5-B66F-7A6CA2292DF2> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib
|
||||
0x7fff8ebb0000 - 0x7fff8ed56ff7 com.apple.audio.toolbox.AudioToolbox (1.13 - 1.13) <082319FC-59F2-3D36-AC9B-94759724E302> /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
|
||||
0x7fff8f074000 - 0x7fff8f090ff7 libextension.dylib (78) <FD952DA6-BBEC-3CB6-98B3-E1D111C5C54E> /usr/lib/libextension.dylib
|
||||
0x7fff8f127000 - 0x7fff8f137fff libbsm.0.dylib (34) <7E14504C-A8B0-3574-B6EB-5D5FABC72926> /usr/lib/libbsm.0.dylib
|
||||
0x7fff8f177000 - 0x7fff903c5fe7 com.apple.CoreGraphics (1.600.0 - 957) <B5D82A82-EDF9-34D5-A8C5-7F25B80985EE> /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
|
||||
0x7fff903c6000 - 0x7fff904eafff libsqlite3.dylib (216.4) <280D67B8-F93D-3587-A146-19F36C817548> /usr/lib/libsqlite3.dylib
|
||||
0x7fff90521000 - 0x7fff9055fff7 libGLImage.dylib (12.1) <BB1F1A93-5101-3906-AB17-8D83FCB200F9> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib
|
||||
0x7fff90622000 - 0x7fff90667ff7 com.apple.coreservices.SharedFileList (24.4 - 24.5) <1D2AD77B-778F-3253-A295-3D0A32A8121C> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList
|
||||
0x7fff90709000 - 0x7fff90717fff libxar.1.dylib (302) <03207F66-2C4A-3DBD-8D81-70F4C85903C4> /usr/lib/libxar.1.dylib
|
||||
0x7fff90e64000 - 0x7fff90e73ffb com.apple.LangAnalysis (1.7.0 - 1.7.0) <18D21123-A3E7-3851-974A-08E5D4540475> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis
|
||||
0x7fff90f0b000 - 0x7fff90f57fff com.apple.print.framework.PrintCore (11.2 - 472.2) <5AE8AA6B-CE09-397D-B0D4-0F9CCBF1F77D> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore
|
||||
0x7fff90f96000 - 0x7fff90fbafff com.apple.MultitouchSupport.framework (304.12 - 304.12) <65CB7653-EACD-3ADB-ABB6-2E0671708301> /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport
|
||||
0x7fff91154000 - 0x7fff91165ff7 libsystem_trace.dylib (201.10.3) <F00E92E4-DBDA-3749-B5B3-0C3FBBABA1CB> /usr/lib/system/libsystem_trace.dylib
|
||||
0x7fff911f6000 - 0x7fff91254fff com.apple.SystemConfiguration (1.14 - 1.14) <D801FAD7-5A2D-3E5E-9F44-B6C9B8BEA747> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
|
||||
0x7fff919db000 - 0x7fff919f2ff7 libsystem_coretls.dylib (83.40.5) <C90DAE38-4082-381C-A185-2A6A8B677628> /usr/lib/system/libsystem_coretls.dylib
|
||||
0x7fff919f3000 - 0x7fff919f3fff com.apple.ApplicationServices (48 - 48) <ADD57D3A-142F-3EF5-BFD8-EACD82164884> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
|
||||
0x7fff91b86000 - 0x7fff91bd2ffb com.apple.HIServices (1.22 - 550) <6B76B41C-CF5A-34C4-89F4-EFD7CA3D1C9D> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices
|
||||
0x7fff91c23000 - 0x7fff91c64ff7 libGLU.dylib (12.1) <CD7A5916-3E3C-3EF3-A275-B281016B99CB> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib
|
||||
0x7fff91c65000 - 0x7fff91c96ff7 libncurses.5.4.dylib (46) <D4C10699-3E8F-3F42-A695-7490EA4B6B32> /usr/lib/libncurses.5.4.dylib
|
||||
0x7fff91ef6000 - 0x7fff91f49ff7 libc++.1.dylib (120.1) <8FC3D139-8055-3498-9AC5-6467CB7F4D14> /usr/lib/libc++.1.dylib
|
||||
0x7fff91f8c000 - 0x7fff91f8eff7 libquarantine.dylib (80) <0F4169F0-0C84-3A25-B3AE-E47B3586D908> /usr/lib/system/libquarantine.dylib
|
||||
0x7fff91fc3000 - 0x7fff91fddfff com.apple.Kerberos (3.0 - 1) <1B4744BF-E5AE-38E2-AA56-E22D3270F2E8> /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos
|
||||
0x7fff9233c000 - 0x7fff9269ef3f libobjc.A.dylib (680) <7489D2D6-1EFD-3414-B18D-2AECCCC90286> /usr/lib/libobjc.A.dylib
|
||||
0x7fff926df000 - 0x7fff926f0fff libcmph.dylib (6) <BA4BF2C6-7F4E-33B8-9DD7-619C9EB83ECF> /usr/lib/libcmph.dylib
|
||||
0x7fff92756000 - 0x7fff9279bff3 libFontRegistry.dylib (155.2) <A70DD497-35F3-34DA-9C19-F4B90080E961> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontRegistry.dylib
|
||||
0x7fff927b9000 - 0x7fff927c4ff7 libcommonCrypto.dylib (60075.50.1) <93732261-34B4-3914-B7A2-90A81A182DBA> /usr/lib/system/libcommonCrypto.dylib
|
||||
0x7fff927c5000 - 0x7fff927c6ffb libremovefile.dylib (41) <552EF39E-14D7-363E-9059-4565AC2F894E> /usr/lib/system/libremovefile.dylib
|
||||
0x7fff93126000 - 0x7fff93131ff7 libChineseTokenizer.dylib (16) <79B8C67A-3061-3C78-92CD-4650719E68D4> /usr/lib/libChineseTokenizer.dylib
|
||||
0x7fff93132000 - 0x7fff9313cfff com.apple.NetAuth (6.0 - 6.0) <D692B1EF-534F-3892-8E2F-2BBA7C8AFD74> /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth
|
||||
0x7fff931b3000 - 0x7fff93240fff libsystem_c.dylib (1082.50.1) <B552D565-B798-3B9B-AE63-F623B42A5F01> /usr/lib/system/libsystem_c.dylib
|
||||
0x7fff93250000 - 0x7fff935e5fdb com.apple.vImage (8.0 - 8.0) <4BAC9B6F-7482-3580-8787-AB0A5B4D331B> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
|
||||
0x7fff9394a000 - 0x7fff939bffff com.apple.framework.IOKit (2.0.2 - 1179.50.2) <A509D3AE-9D48-31B7-89C7-326A7A2007B2> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
|
||||
0x7fff939e9000 - 0x7fff93a02fff com.apple.CFOpenDirectory (10.11 - 194) <11F95672-55E0-3F9D-9171-5E8C56AEE948> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory
|
||||
0x7fff93ad9000 - 0x7fff93ae1fff libGFXShared.dylib (12.1) <5A0C2493-200C-30BE-97D5-8E8C0B8E604D> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib
|
||||
0x7fff93ae2000 - 0x7fff93aeafff libsystem_networkextension.dylib (385.40.36) <66095DC7-6539-38F2-95EE-458F15F6D014> /usr/lib/system/libsystem_networkextension.dylib
|
||||
0x7fff93d66000 - 0x7fff93d83ff7 com.apple.AppleVPAFramework (2.1.2 - 2.1.2) <41378C0B-B56A-3A73-9BD0-E06FA1F87B8C> /System/Library/PrivateFrameworks/AppleVPA.framework/Versions/A/AppleVPA
|
||||
0x7fff94496000 - 0x7fff9449efff com.apple.NetFS (6.0 - 4.0) <842A5346-24C3-3F22-9ECF-E586A10EA1F2> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
|
||||
0x7fff9449f000 - 0x7fff944a4ff7 libmacho.dylib (875.1) <318264FA-58F1-39D8-8285-1F6254EE410E> /usr/lib/system/libmacho.dylib
|
||||
0x7fff944a5000 - 0x7fff944cefff libsystem_info.dylib (477.50.4) <FAA9226D-64DE-3769-A6D8-6CABA4B7FF4D> /usr/lib/system/libsystem_info.dylib
|
||||
0x7fff945f8000 - 0x7fff9466ffeb libcorecrypto.dylib (335.50.1) <B5C05FD7-A540-345A-87BF-8E41848A3C17> /usr/lib/system/libcorecrypto.dylib
|
||||
0x7fff94672000 - 0x7fff9467afef libsystem_platform.dylib (74.40.2) <29A905EF-6777-3C33-82B0-6C3A88C4BA15> /usr/lib/system/libsystem_platform.dylib
|
||||
0x7fff947a8000 - 0x7fff94835dd7 com.apple.AppleJPEG (1.0 - 1) <558ACADA-C41F-3EEF-82A0-C2D7B13C5428> /System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG
|
||||
0x7fff9490b000 - 0x7fff94914ff7 libsystem_pthread.dylib (138.10.4) <3DD1EF4C-1D1B-3ABF-8CC6-B3B1CEEE9559> /usr/lib/system/libsystem_pthread.dylib
|
||||
0x7fff94915000 - 0x7fff94923ff7 libbz2.1.0.dylib (38) <28E54258-C0FE-38D4-AB76-1734CACCB344> /usr/lib/libbz2.1.0.dylib
|
||||
0x7fff949d8000 - 0x7fff949e4fff com.apple.speech.synthesis.framework (5.4.12 - 5.4.12) <71DA00B8-5EA2-326B-8814-59DB25512F65> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis
|
||||
0x7fff949e5000 - 0x7fff94a43fff com.apple.CoreServices.OSServices (728.12 - 728.12) <776EBD4F-7052-377F-A70D-E2FDBD465A5E> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
|
||||
0x7fff94c55000 - 0x7fff94c6dfef libcompression.dylib (28) <E7601B62-1053-369D-8A9E-91CF86239220> /usr/lib/libcompression.dylib
|
||||
0x7fff94d75000 - 0x7fff94d81ff7 com.apple.OpenDirectory (10.11 - 194) <31A67AD5-5CC2-350A-96D7-821DF4BC4196> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory
|
||||
0x7fff94dd2000 - 0x7fff94de9ff7 libsystem_asl.dylib (323.50.1) <41F8E11F-1BD0-3F1D-BA3A-AA1577ED98A9> /usr/lib/system/libsystem_asl.dylib
|
||||
0x7fff95efc000 - 0x7fff96372fff com.apple.CoreFoundation (6.9 - 1258.1) <943A1383-DA6A-3DC0-ABCD-D9AEB3D0D34D> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
|
||||
0x7fff96a8b000 - 0x7fff96a8cffb libSystem.B.dylib (1226.10.1) <C5D09FE1-CC70-383E-AC27-18602F2EDEC4> /usr/lib/libSystem.B.dylib
|
||||
0x7fff96b0b000 - 0x7fff96b67fff libTIFF.dylib (1450) <14EB7C03-7DDA-3276-BAC5-D597913AC9C4> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
|
||||
0x7fff9788c000 - 0x7fff97900ff3 com.apple.securityfoundation (6.0 - 55126) <130656AE-2711-3914-8736-D8B021C93FE0> /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation
|
||||
0x7fff97901000 - 0x7fff9796fff7 com.apple.ApplicationServices.ATS (377 - 394.4) <9779E916-0788-3CAC-B1EC-F68BCB12A2B6> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS
|
||||
0x7fff97970000 - 0x7fff979c1ff7 libcups.2.dylib (435.2) <91584A40-214D-33E8-A613-CE22289037C8> /usr/lib/libcups.2.dylib
|
||||
0x7fff97acb000 - 0x7fff97ad4ff3 libsystem_notify.dylib (150.40.1) <D48BDE34-0F7E-34CA-A0FF-C578E39987CC> /usr/lib/system/libsystem_notify.dylib
|
||||
0x7fff97c56000 - 0x7fff97c58fff libCVMSPluginSupport.dylib (12.1) <D81B3D8D-B83F-3918-BD4B-6C794A30AF9F> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginSupport.dylib
|
||||
0x7fff97c59000 - 0x7fff97c5cff7 libCoreFSCache.dylib (119.5) <2389D7DA-B8EF-3EB4-AAAF-FBEDE01CDECA> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreFSCache.dylib
|
||||
0x7fff97d7b000 - 0x7fff97d80ff7 libheimdal-asn1.dylib (453.40.10) <981DE40B-FA16-36F7-BE92-8C8A115D6CD9> /usr/lib/libheimdal-asn1.dylib
|
||||
0x7fff97d81000 - 0x7fff97d9fffb libedit.3.dylib (43) <1D3E3152-4001-3C19-B56A-7543F1BBA47C> /usr/lib/libedit.3.dylib
|
||||
0x7fff987b2000 - 0x7fff989bffff libicucore.A.dylib (551.51.3) <5BC80F94-C90D-3175-BD96-FF1DC222EC9C> /usr/lib/libicucore.A.dylib
|
||||
0x7fff989c0000 - 0x7fff989c0ff7 liblaunch.dylib (765.50.8) <834ED605-5114-3641-AA4D-ECF31B801C50> /usr/lib/system/liblaunch.dylib
|
||||
0x7fff98b55000 - 0x7fff98b8ffff com.apple.QD (3.12 - 302) <0FE53180-2895-3D14-A1E7-F82DE1D106E1> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD
|
||||
0x7fff98be1000 - 0x7fff98be1fff libenergytrace.dylib (10.40.1) <0A491CA7-3451-3FD5-999A-58AB4362682B> /usr/lib/libenergytrace.dylib
|
||||
0x7fff98c36000 - 0x7fff98c41fff libGL.dylib (12.1) <70D51643-04AC-3400-8F11-A6FC25985289> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
|
||||
0x7fff98c77000 - 0x7fff98ca0fff libc++abi.dylib (125) <DCCC8177-3D09-35BC-9784-2A04FEC4C71B> /usr/lib/libc++abi.dylib
|
||||
0x7fff98cb0000 - 0x7fff98cdfff7 com.apple.DictionaryServices (1.2 - 250.3) <30250542-CBAA-39C1-91AA-B57A5DE17594> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
|
||||
0x7fff98ce0000 - 0x7fff98ce7ff7 libcompiler_rt.dylib (62) <A13ECF69-F59F-38AE-8609-7B731450FBCD> /usr/lib/system/libcompiler_rt.dylib
|
||||
0x7fff98d10000 - 0x7fff98fa6fff libmecabra.dylib (696.5) <EF6C0BD4-5FE8-34FB-8ADF-69A53CEC97A9> /usr/lib/libmecabra.dylib
|
||||
0x7fff99bdb000 - 0x7fff99bdbfff com.apple.Accelerate (1.10 - Accelerate 1.10) <185EC96A-5AF0-3620-A4ED-4D3654D25B39> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
|
||||
0x7fff99bdc000 - 0x7fff99bddfff libsystem_blocks.dylib (65) <1244D9D5-F6AA-35BB-B307-86851C24B8E5> /usr/lib/system/libsystem_blocks.dylib
|
||||
0x7fff99d2d000 - 0x7fff99e94fff libBLAS.dylib (1162.2) <A1398FE0-39D2-33EA-9A0F-B2644EEA29A0> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
|
||||
0x7fff99f74000 - 0x7fff9a259ffb com.apple.CoreServices.CarbonCore (1136.2 - 1136.2) <2DBAFC9A-6CD6-351D-B1F4-87D81AA6D640> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
|
||||
0x7fff9a2cc000 - 0x7fff9a312ff7 libauto.dylib (186) <999E610F-41FC-32A3-ADCA-5EC049B65DFB> /usr/lib/libauto.dylib
|
||||
0x7fff9a359000 - 0x7fff9a35ffff com.apple.IOAccelerator (205.10 - 205.10) <E46ED853-C2CC-3F29-A7DD-5E9351A2E754> /System/Library/PrivateFrameworks/IOAccelerator.framework/Versions/A/IOAccelerator
|
||||
0x7fff9a40b000 - 0x7fff9a410ff3 libunwind.dylib (35.3) <F6EB48E5-4D12-359A-AB54-C937FBBE9043> /usr/lib/system/libunwind.dylib
|
||||
0x7fff9a833000 - 0x7fff9a923fff libJP2.dylib (1450) <FAFF00CD-1CF6-34DE-A06F-31D4BB9C8BA9> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib
|
||||
0x7fff9ab94000 - 0x7fff9aba5fff libSparseBLAS.dylib (1162.2) <EBEB3848-3468-342A-91A6-5C47F2369CD9> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib
|
||||
0x7fff9abea000 - 0x7fff9ac8afff com.apple.Metadata (10.7.0 - 972.34) <A93B485D-094C-3024-8CBB-D9E035FB83C4> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
|
||||
0x7fff9af5b000 - 0x7fff9af79ff7 libsystem_kernel.dylib (3248.50.21) <78E54D59-D2B0-3F54-9A4A-0A68D671F253> /usr/lib/system/libsystem_kernel.dylib
|
||||
0x7fff9b073000 - 0x7fff9b159ff7 libcrypto.0.9.8.dylib (59.40.2) <2486D801-C756-3488-B519-1AA6807E8948> /usr/lib/libcrypto.0.9.8.dylib
|
||||
0x7fff9b3c1000 - 0x7fff9b4bdff7 libFontParser.dylib (158.6) <267A9AE4-4138-3112-8D73-BDFDC96568FF> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontParser.dylib
|
||||
0x7fff9b4c2000 - 0x7fff9b4ddff7 libCRFSuite.dylib (34) <078B4CD8-6A8C-3067-B2BA-0C2A0BAB8AC3> /usr/lib/libCRFSuite.dylib
|
||||
0x7fff9b625000 - 0x7fff9b8acff3 com.apple.CFNetwork (760.5.1 - 760.5.1) <EE9426D1-F11C-3DD4-AE08-EA29AEB27177> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
|
||||
0x7fff9b928000 - 0x7fff9baeefe7 com.apple.ImageIO.framework (3.3.0 - 1450) <18ABA1F4-43EC-3990-9777-C91FD3D6AF71> /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
|
||||
0x7fff9bdf0000 - 0x7fff9be24ff7 com.apple.CoreVideo (1.8 - 191.3) <1AA24A1B-CB84-3F6B-B6DE-11494542649C> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo
|
||||
0x7fff9bf5b000 - 0x7fff9bf60fff com.apple.DiskArbitration (2.7 - 2.7) <F55902AA-5316-3255-A701-FDED5B553065> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
|
||||
0x7fff9bf61000 - 0x7fff9c086fff com.apple.LaunchServices (728.12 - 728.12) <F5AB56CD-CF33-33F0-A48D-372551714E77> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
|
||||
0x7fff9c0e4000 - 0x7fff9c0effff libkxld.dylib (3248.50.21) <99195052-038E-3490-ACF8-76F9AC43897E> /usr/lib/system/libkxld.dylib
|
||||
0x7fff9d382000 - 0x7fff9d386fff libpam.2.dylib (20) <CFCD19BD-87BC-3F2B-BB1C-4C23E8E55F1A> /usr/lib/libpam.2.dylib
|
||||
0x7fff9d4b7000 - 0x7fff9d4c8ff7 libz.1.dylib (61.20.1) <B3EBB42F-48E3-3287-9F0D-308E04D407AC> /usr/lib/libz.1.dylib
|
||||
0x7fff9d4ca000 - 0x7fff9d4f8ff7 com.apple.CoreServicesInternal (248.2 - 248.2) <6E111F0A-D7F1-3738-ADE7-CF983BD4EC8B> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal
|
||||
0x7fff9d4f9000 - 0x7fff9d4fbff7 libsystem_configuration.dylib (802.40.13) <3DEB7DF9-6804-37E1-BC83-0166882FF0FF> /usr/lib/system/libsystem_configuration.dylib
|
||||
0x7fff9d5ab000 - 0x7fff9d5acfff libsystem_secinit.dylib (20) <32B1A8C6-DC84-3F4F-B8CE-9A52B47C3E6B> /usr/lib/system/libsystem_secinit.dylib
|
||||
|
||||
External Modification Summary:
|
||||
Calls made by other processes targeting this process:
|
||||
task_for_pid: 11
|
||||
thread_create: 0
|
||||
thread_set_state: 0
|
||||
Calls made by this process:
|
||||
task_for_pid: 0
|
||||
thread_create: 0
|
||||
thread_set_state: 0
|
||||
Calls made by all processes on this machine:
|
||||
task_for_pid: 199747
|
||||
thread_create: 0
|
||||
thread_set_state: 9181
|
||||
|
||||
VM Region Summary:
|
||||
ReadOnly portion of Libraries: Total=231.3M resident=0K(0%) swapped_out_or_unallocated=231.3M(100%)
|
||||
Writable regions: Total=112.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=112.3M(100%)
|
||||
|
||||
VIRTUAL REGION
|
||||
REGION TYPE SIZE COUNT (non-coalesced)
|
||||
=========== ======= =======
|
||||
Activity Tracing 2048K 2
|
||||
Dispatch continuations 16.0M 2
|
||||
Kernel Alloc Once 4K 2
|
||||
MALLOC 75.5M 22
|
||||
MALLOC guard page 32K 7
|
||||
STACK GUARD 56.0M 9
|
||||
Stack 11.1M 16
|
||||
VM_ALLOCATE 7448K 21
|
||||
__DATA 11.8M 183
|
||||
__LINKEDIT 101.5M 32
|
||||
__TEXT 129.8M 182
|
||||
__UNICODE 552K 2
|
||||
mapped file 47.0M 49
|
||||
shared memory 324K 9
|
||||
=========== ======= =======
|
||||
TOTAL 458.9M 524
|
||||
|
||||
Model: MacBookPro11,5, BootROM MBP114.0172.B09, 4 processors, Intel Core i7, 2,5 GHz, 16 GB, SMC 2.30f2
|
||||
Graphics: AMD Radeon R9 M370X, AMD Radeon R9 M370X, PCIe, 2048 MB
|
||||
Graphics: Intel Iris Pro, Intel Iris Pro, Built-In
|
||||
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533642465238412D50422020
|
||||
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533642465238412D50422020
|
||||
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x152), Broadcom BCM43xx 1.0 (7.21.95.175.1a6)
|
||||
Bluetooth: Version 4.4.5f3 17904, 3 services, 27 devices, 1 incoming serial ports
|
||||
Network Service: Wi-Fi, AirPort, en0
|
||||
Serial ATA Device: APPLE SSD SM0512G, 500,28 GB
|
||||
USB Device: USB 3.0 Bus
|
||||
USB Device: Card Reader
|
||||
USB Device: Apple Internal Keyboard / Trackpad
|
||||
USB Device: Bluetooth USB Host Controller
|
||||
Thunderbolt Bus: MacBook Pro, Apple Inc., 27.1
|
@ -15,13 +15,15 @@ include(TestBigEndian)
|
||||
include(GetGitRevisionDescription)
|
||||
|
||||
# modern systems do this.
|
||||
|
||||
set(MALLOC_T "void *")
|
||||
OPTION(WITH_SYSTEM_MALLOC
|
||||
"use malloc to allocate memory" ON)
|
||||
OPTION(WITH_DL_MALLOC
|
||||
"use malloc to allocate memory" OFF)
|
||||
OPTION(WITH_YAP_MALLOC
|
||||
"use malloc to allocate memory" OFF)
|
||||
"use malloc to allocate mem
|
||||
ory" OFF)
|
||||
|
||||
if (WITH_SYSTEM_MALLOC)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS USE_SYSTEM_MALLOC=1)
|
||||
@ -144,6 +146,7 @@ endif (HAVE_LIBDL)
|
||||
if (WIN32)
|
||||
check_library_exists(comdlg32 FindText "" HAVE_LIBCOMDLG32)
|
||||
if (HAVE_LIBCOMDLG32)
|
||||
|
||||
set(EXTRALIBS ${EXTRALIBS} comdlg32)
|
||||
endif (HAVE_LIBCOMDLG32)
|
||||
check_library_exists(msvcrt strtok "" HAVE_LIBMSCRT)
|
||||
@ -215,6 +218,7 @@ if (HAVE_LIBPTHREAD)
|
||||
endif (HAVE_LIBPTHREAD)
|
||||
|
||||
|
||||
|
||||
check_library_exists(unicode main "" HAVE_LIBUNICODE)
|
||||
if (HAVE_LIBUNICODE)
|
||||
set(EXTRALIBS ${EXTRALIBS} unicode)
|
||||
@ -255,6 +259,7 @@ check_function_exists(__builtin_ffsll HAVE___BUILTIN_FFSLL)
|
||||
check_function_exists(fgetpos HAVE_FGETPOS)
|
||||
check_function_exists(finite HAVE_FINITE)
|
||||
check_function_exists(iswblank HAVE_ISWBLANK)
|
||||
check_function_exists(iswspace HAVE_ISWSPACE)
|
||||
check_symbol_exists(flsl <string.h> HAVE_FLSL)
|
||||
check_symbol_exists(flsll <string.h> HAVE_FLSLL)
|
||||
check_function_exists(fmemopen HAVE_FMEMOPEN)
|
||||
@ -262,7 +267,7 @@ check_function_exists(fpclass HAVE_FPCLASS)
|
||||
check_function_exists(ftime HAVE_FTIME)
|
||||
check_function_exists(ftruncate HAVE_FTRUNCATE)
|
||||
check_function_exists(funopen HAVE_FUNOPEN)
|
||||
check_function_exists(gcc HAVE_GCC)
|
||||
#check_function_exists(gcc HAVE_GCC)
|
||||
check_function_exists(getcwd HAVE_GETCWD)
|
||||
check_function_exists(getenv HAVE_GETENV)
|
||||
check_function_exists(getexecname HAVE_GETEXECNAME)
|
||||
@ -336,10 +341,14 @@ check_function_exists(socklen_t HAVE_SOCKLEN_T)
|
||||
check_function_exists(sqllen HAVE_SQLLEN)
|
||||
check_function_exists(sqlulen HAVE_SQLULEN)
|
||||
check_function_exists(srand HAVE_SRAND)
|
||||
check_function_exists(srand HAVE_SRAND48)
|
||||
check_function_exists(srand48 HAVE_SRAND48)
|
||||
check_function_exists(srandom HAVE_SRANDOM)
|
||||
check_function_exists(stpcpy HAVE_STPCPY)
|
||||
check_function_exists(stpncpy HAVE_STPNCPY)
|
||||
check_function_exists(ssize_t HAVE_SSIZE_T)
|
||||
check_function_exists(stat HAVE_STAT)
|
||||
check_function_exists(strcat HAVE_STRCAT)
|
||||
check_function_exists(strncat HAVE_STRNCAT)
|
||||
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
||||
check_function_exists(strcasestr HAVE_STRCASESTR)
|
||||
check_function_exists(strchr HAVE_STRCHR)
|
||||
@ -395,5 +404,13 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/../YapTermConfig.h.cmake
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/../config.h.cmake
|
||||
${CMAKE_BINARY_DIR}/config.h)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/../GitSHA1.c.in GitSHA1.c @ONLY)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/../os/YapIOConfig.h.cmake ${CMAKE_BINARY_DIR}/os/YapIOConfig.h)
|
||||
|
||||
check_include_files( "stdio.h;cudd.h" HAVE_CTYPE_HUDD_H )
|
||||
|
||||
check_include_files( "stdio.h;cuddI.h" HAVE_CUDD_H )
|
||||
check_include_files( "cudd.h;cuddInt.h" HAVE_CUDDINT_H )
|
||||
check_include_files( "stdio.h;cudd/cudd.h" HAVE_CUDD_CUDD_H )
|
||||
check_include_files( "stdio.h;cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
|
||||
configure_file (cmake/cudd_config.h.cmake
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cudd_config.h" )
|
||||
|
@ -13,6 +13,7 @@
|
||||
SET( CUDD_FOUND "NO" )
|
||||
|
||||
set (CUDD_INCLUDE_SEARCH_PATH
|
||||
${CUDD_ROOT_DIR}/include
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
/usr/local/yap/include
|
||||
/usr/local/Yap/include
|
||||
@ -32,6 +33,7 @@ set (CUDD_INCLUDE_SEARCH_PATH
|
||||
|
||||
|
||||
set (CUDD_LIB_SEARCH_PATH
|
||||
${CUDD_ROOT_DIR}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib/cudd
|
||||
|
@ -1,12 +1,12 @@
|
||||
#source from http://code.google.com/p/cpfloat-gecode/source/browse/trunk/cmake-support/FindGecode.cmake?r=9
|
||||
|
||||
#
|
||||
#Works under the assumption than when gecode is installed at least the kernel component exists
|
||||
# Look for the header file
|
||||
find_path(GECODE_INCLUDE_DIR NAMES gecode/kernel.hh PATHS ${CMAKE_INSTALL_PREFIX}/include)
|
||||
find_file(GECODE_CONFIG gecode/support/config.hpp PATHS ${CMAKE_INSTALL_PREFIX}/include)
|
||||
find_path(GECODE_INCLUDE_DIR NAMES gecode/kernel.hh PATHS ${GECODE_ROOT_DIR}/include ${CMAKE_INSTALL_PREFIX}/include /usr/local/include /opt/local/include /usr}/include)
|
||||
find_file(GECODE_CONFIG gecode/support/config.hpp PATHS ${GECODE_ROOT_DIR}/include ${CMAKE_INSTALL_PREFIX}/include /usr/local/include /opt/local/include /usr}/include)
|
||||
# Look for the library
|
||||
find_library(GECODE_LIBRARY NAMES gecodekernel PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_SUPPORT_LIBRARY NAMES gecodesupportl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_LIBRARY NAMES gecodekernel PATHS ${GECODE_ROOT_DIR}/lib ${CMAKE_INSTALL_PREFIX}/lib /usr/local/lib /opt/local/lib /usr}/lib)
|
||||
find_library(GECODE_SUPPORT_LIBRARY NAMES gecodesupport PATHS ${GECODE_ROOT_DIR}/lib ${CMAKE_INSTALL_PREFIX}/lib /usr/local/lib /opt/local/lib /usr}/include)
|
||||
|
||||
if(GECODE_CONFIG)
|
||||
file(STRINGS ${GECODE_CONFIG} GECODE_LINE_VERSION REGEX "^#define GECODE_VERSION .*")
|
||||
@ -20,39 +20,39 @@ endif()
|
||||
if(GECODE_FOUND)
|
||||
set(GECODE_LIBRARIES ${GECODE_LIBRARY} ${GECODE_SUPPORT_LIBRARY})
|
||||
set(GECODE_INCLUDE_DIRS ${GECODE_INCLUDE_DIR})
|
||||
find_library(GECODE_DRIVER_LIBRARY gecodedriverl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_DRIVER_LIBRARY gecodedriver PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_FZ_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_FZ_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_GIST_LIBRARY gecodegistl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_GIST_LIBRARY gecodegist PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_GIST_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_GIST_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_GRAPH_LIBRARY gecodegraphl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_GRAPH_LIBRARY gecodegraph PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_GRAPH_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_GRAPH_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_INT_LIBRARY gecodeintl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_INT_LIBRARY gecodeint PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_INT_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_INT_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_FLOAT_LIBRARY gecodefloatl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_FLOAT_LIBRARY gecodefloat PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_FLOAT_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_FLOAT_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_MM_LIBRARY gecodeminimodell PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_MM_LIBRARY gecodeminimodel PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_MM_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_MM_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_SCHEDULING_LIBRARY gecodeschedulingl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_SCHEDULING_LIBRARY gecodescheduling PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_SCHEDULING_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_SCHEDULING_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_SEARCH_LIBRARY gecodesearchl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_SEARCH_LIBRARY gecodesearch PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_SEARCH_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_SEARCH_LIBRARY})
|
||||
endif()
|
||||
find_library(GECODE_SET_LIBRARY gecodesetl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
find_library(GECODE_SET_LIBRARY gecodeset PATHS ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
if(GECODE_SET_LIBRARY)
|
||||
list(APPEND GECODE_LIBRARIES ${GECODE_SET_LIBRARY})
|
||||
endif()
|
||||
|
@ -11,6 +11,7 @@ IF (MYSQL_INCLUDE_DIR)
|
||||
ENDIF (MYSQL_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
||||
${MYSQL_ROOT_DIR}/include
|
||||
/usr/local/include/mysql
|
||||
/usr/include/mysql
|
||||
/usr/include/mariadb
|
||||
@ -18,7 +19,8 @@ FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
||||
|
||||
SET(MYSQL_NAMES mysqlclient mysqlclient_r mariadb )
|
||||
FIND_LIBRARY(MYSQL_LIBRARY
|
||||
NAMES ${MYSQL_NAMES}
|
||||
NAMES ${MYSQL_ROOT_DIR}/lib
|
||||
${MYSQL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
)
|
||||
|
@ -19,6 +19,7 @@
|
||||
set(ODBC_FOUND FALSE)
|
||||
|
||||
find_path(ODBC_INCLUDE_DIRECTORIES sql.h
|
||||
${ODBC_ROOT_DIR}/include
|
||||
/usr/include
|
||||
/usr/include/odbc
|
||||
/usr/local/include
|
||||
@ -34,6 +35,7 @@ find_path(ODBC_INCLUDE_DIRECTORIES sql.h
|
||||
find_library(ODBC_LIBRARY
|
||||
NAMES iodbc odbc odbcinst odbc32
|
||||
PATHS
|
||||
${ODBC_ROOT_DIR}/lib
|
||||
/usr/lib
|
||||
/usr/lib/odbc
|
||||
/usr/local/lib
|
||||
|
@ -2,7 +2,7 @@ set(YAP_FOUND ON)
|
||||
|
||||
set(YAP_MAJOR_VERSION 6)
|
||||
set(YAP_MINOR_VERSION 3)
|
||||
set(YAP_PATCH_VERSION 4)
|
||||
set(YAP_PATCH_VERSION 5)
|
||||
|
||||
set(YAP_FULL_VERSION
|
||||
${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}.${YAP_PATCH_VERSION})
|
||||
|
@ -18,10 +18,7 @@ if (CUDD_FOUND)
|
||||
|
||||
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CUDD_INCLUDE_DIR} )
|
||||
|
||||
check_include_files( "stdio.h;cudd.h" HAVE_CUDD_H )
|
||||
check_include_files( "stdio.h;cudd/cudd.h" HAVE_CUDD_CUDD_H )
|
||||
check_include_files( "cuddInt.h" HAVE_CUDDINT_H )
|
||||
check_include_files( "cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
|
||||
endif (CUDD_FOUND)
|
||||
|
||||
|
||||
endif(WITH_CUDD)
|
||||
|
@ -1,4 +1,8 @@
|
||||
|
||||
option (WITH_PYTHON
|
||||
"Allow Python->YAP and YAP->Python" ON)
|
||||
|
||||
IF (WITH_PYTHON)
|
||||
|
||||
#BREW install for Python3
|
||||
|
||||
@ -31,3 +35,6 @@ find_package(PythonLibs)
|
||||
|
||||
set( CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_DIRS} ${CMAKE_REQUIRED_INCLUDES} )
|
||||
check_include_file(Python.h HAVE_PYTHON_H)
|
||||
|
||||
endif(WITH_PYTHON)
|
||||
|
||||
|
@ -586,6 +586,11 @@ function. */
|
||||
#cmakedefine HAVE_ISWBLANK ${HAVE_ISWBLANK}
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `iswspace' function. */
|
||||
#ifndef HAVE_ISWSPACE
|
||||
#cmakedefine HAVE_ISWSPACE ${HAVE_ISWSPACE}
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <Judy.h> header file. */
|
||||
#ifndef HAVE_JUDY_H
|
||||
#cmakedefine HAVE_JUDY_H ${HAVE_JUDY_H}
|
||||
|
68
configure
vendored
68
configure
vendored
@ -22,7 +22,7 @@
|
||||
# details, see <https://creativecommons.org/publicdomain/zero/1.0/>
|
||||
|
||||
TOP_SRCDIR="$(dirname $0)"
|
||||
CMAKE_CMD="cmake ${TOP_SRCDIR}"
|
||||
CMAKE=cmake
|
||||
|
||||
BUILD_TYPE="Debug"
|
||||
PREFIX=/usr/local
|
||||
@ -39,15 +39,19 @@ quote() {
|
||||
|
||||
extract_var_string() {
|
||||
VAR_NAME=$1
|
||||
VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//')
|
||||
VAR_NAME=$(echo $1 | sed -e 's/[\\b]*$//')
|
||||
|
||||
if [ "x$VAR_VALUE" = "x" ]; then
|
||||
if [ "x$2" != "x" ]; then
|
||||
VAR_VALUE=$2
|
||||
else
|
||||
VAR_VALUE=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$3" != "x" ]; then
|
||||
VAR_UC_NAME=$3
|
||||
VAR_UC=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
|
||||
else
|
||||
VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
|
||||
fi
|
||||
@ -55,24 +59,62 @@ extract_var_string() {
|
||||
|
||||
set_config_var() {
|
||||
is_with=n
|
||||
found=y
|
||||
arg=$(echo "${2}" | tr '[:upper:]' '[:lower:]' )
|
||||
case "$1" in
|
||||
"--enable-"*)
|
||||
name="${1#--enable-}"
|
||||
cfg="${ENABLE_VARS}"
|
||||
case "x$arg" in
|
||||
"xy"|"xyes"|"xtrue")
|
||||
VAR_VALUE=yes
|
||||
;;
|
||||
"xn"|"xno"|"xfalse")
|
||||
found=y
|
||||
VAR_VALUE=no
|
||||
;;
|
||||
**)
|
||||
VAR_VALUE=""
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"--disable-"*)
|
||||
name="${1#--disable-}";
|
||||
cfg="${DISABLE_VARS}";
|
||||
cfg="${ENABLE_VARS}"
|
||||
case "x$arg" in
|
||||
"xy"|"xyes"|"xtrue")
|
||||
VAR_VALUE=no
|
||||
;;
|
||||
"xn"|"xno"|"xfalse")
|
||||
VAR_VALUE=yes
|
||||
;;
|
||||
**)
|
||||
VAR_VALUE=""
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"--with-"*)
|
||||
# IFS="=" read -ra WITHARGS <<< "${1}"
|
||||
name="${1#--with-}"
|
||||
cfg="${WITH_VARS}"
|
||||
case "x$arg" in
|
||||
"x"|"xy"|"xyes"|"xtrue")
|
||||
is_with=n
|
||||
VAR_VALUE=yes
|
||||
``;;
|
||||
"xn"|"xno"|"xfalse")
|
||||
is_with=n
|
||||
VAR_VALUE=no
|
||||
;;
|
||||
**)
|
||||
is_with=y
|
||||
VAR_VALUE=""
|
||||
;;
|
||||
esac
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
found=n
|
||||
for varstring in $cfg; do
|
||||
extract_var_string $(echo "${varstring}" | tr '|' ' ')
|
||||
if [ "x$VAR_NAME" = "x$name" ]; then
|
||||
@ -83,7 +125,7 @@ set_config_var() {
|
||||
|
||||
if [ "$found" = "y" ]; then
|
||||
if [ "x$is_with" = "xy" ]; then
|
||||
CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")"
|
||||
CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$VAR_VALUE") -D${VAR_UC}_ROOT_DIR=$(quote "$2")"
|
||||
else
|
||||
CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")"
|
||||
fi
|
||||
@ -100,6 +142,7 @@ prefix_to_offset() {
|
||||
print_help() {
|
||||
cat <<EOF >&2
|
||||
-h, --help display this help and exit
|
||||
--cmake=CMAKE use a specific cmake, not the default
|
||||
--disable-debug disable debugging mode
|
||||
--pass-thru pass remaining arguments through to CMake
|
||||
|
||||
@ -154,7 +197,6 @@ EOF
|
||||
fi
|
||||
done
|
||||
|
||||
first=y
|
||||
for varstring in ${WITH_VARS}; do
|
||||
if [ $first = 'y' ]; then
|
||||
echo ""
|
||||
@ -164,6 +206,7 @@ EOF
|
||||
var_doc_name="WITH_${VAR_UC_NAME}_DOC"
|
||||
eval "docstring=\$$var_doc_name"
|
||||
paraminfo="${VAR_NAME}=${VAR_VALUE}"
|
||||
|
||||
if [ "x${docstring}" = "x" ]; then
|
||||
printf " --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
|
||||
else
|
||||
@ -176,6 +219,10 @@ EOF
|
||||
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
"--cmake="*)
|
||||
CMAKE="${1#*=}";;
|
||||
"--cmake")
|
||||
CMAKE="${2}"; shift;;
|
||||
"--prefix="*)
|
||||
PREFIX="${1#*=}";;
|
||||
"--prefix")
|
||||
@ -274,11 +321,13 @@ while [ $# != 0 ]; do
|
||||
done;;
|
||||
|
||||
"--enable-"*)
|
||||
set_config_var "$1"
|
||||
name=$(echo "${1#--enable-}" | awk '{split($1,v,"="); print v[1]}')
|
||||
set_config_var "--with-${name}" "${1#--enable-${name}=}"
|
||||
;;
|
||||
|
||||
"--disable-"*)
|
||||
set_config_var "$1"
|
||||
name=$(echo "${1#--disable-}" | awk '{split($1,v,"="); print v[1]}')
|
||||
set_config_var "--with-${name}" "${1#--disable-${name}=}"
|
||||
;;
|
||||
|
||||
"--with-"*)
|
||||
@ -312,4 +361,5 @@ if [ "x${LDFLAGS}" != "x" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
eval "cmake ${TOP_SRCDIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${LIBDIR} ${CMAKE_ARGS}"
|
||||
CMAKE_CMD="${CMAKE} ${TOP_SRCDIR}"
|
||||
${CMAKE_CMD} ${TOP_SRCDIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${LIBDIR} ${CMAKE_ARGS}
|
||||
|
@ -78,8 +78,7 @@ static int init_standard_system(int argc, char *argv[], YAP_init_args *iap) {
|
||||
BootMode = YAP_parse_yap_arguments(argc, argv, iap);
|
||||
iap->Embedded = false;
|
||||
/* init memory */
|
||||
iap->boot_file_type =
|
||||
BootMode = YAP_Init(iap);
|
||||
iap->boot_file_type = BootMode = YAP_Init(iap);
|
||||
if (iap->ErrorNo) {
|
||||
/* boot failed */
|
||||
YAP_Error(iap->ErrorNo, 0L, iap->ErrorCause);
|
||||
|
@ -785,9 +785,8 @@ INPUT = /Users/vsc/git/yap-6.3/pl \
|
||||
/Users/vsc/git/yap-6.3/library \
|
||||
/Users/vsc/git/yap-6.3/packages \
|
||||
/Users/vsc/git/yap-6.3/swi/library \
|
||||
/Users/vsc/git/yap-6.3/docs/yap.md \
|
||||
/Users/vsc/git/yap-6.3/docs/chr.md \
|
||||
/Users/vsc/git/yap-6.3/docs/clpqr.md \
|
||||
/Users/vsc/git/yap-6.3/docs/md \
|
||||
/Users/vsc/git/yap-6.3/INSTALL.md \
|
||||
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
|
@ -384,7 +384,7 @@ INLINE_GROUPED_CLASSES = NO
|
||||
# with only public data fields or simple typedef fields will be shown inline in
|
||||
# the documentation of the scope in which they are defined (i.e. file,
|
||||
# namespace, or group documentation), provided this scope is documented. If set
|
||||
v# to NO, structs, classes, and unions are shown on a separate page (for HTML and
|
||||
# to NO, structs, classes, and unions are shown on a separate page (for HTML and
|
||||
# Man pages) or section (for LaTeX and RTF).
|
||||
# The default value is: NO.
|
||||
|
||||
@ -785,9 +785,8 @@ INPUT = @PROJECT_SOURCE_DIR@/pl \
|
||||
@PROJECT_SOURCE_DIR@/library \
|
||||
@PROJECT_SOURCE_DIR@/packages \
|
||||
@PROJECT_SOURCE_DIR@/swi/library \
|
||||
@PROJECT_SOURCE_DIR@/docs/yap.md \
|
||||
@PROJECT_SOURCE_DIR@/docs/chr.md \
|
||||
@PROJECT_SOURCE_DIR@/docs/clpqr.md \
|
||||
@PROJECT_SOURCE_DIR@/docs/md \
|
||||
@PROJECT_SOURCE_DIR@/INSTALL.md
|
||||
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
@ -828,7 +827,11 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = *pltotex.pl
|
||||
EXCLUDE = *pltotex.pl \
|
||||
@PROJECT_SOURCE_DIR@/packages/myddas/sqlite3/src \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/4.0.* \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/3,* \
|
||||
@PROJECT_SOURCE_DIR@/C/traced_absmi_insts.h
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@ -1134,7 +1137,7 @@ HTML_STYLESHEET =
|
||||
# list). For an example see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/docs/solarized-light.css
|
||||
|
||||
# @CMAKE_SOURCE_DIR@/docs/solarized-light.css
|
||||
|
||||
|
6
docs/jquery-2.0.3.min.js
vendored
6
docs/jquery-2.0.3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,5 @@
|
||||
@{
|
||||
|
||||
@defgroup AttributedVariables Attributed Variables and Co-Routining
|
||||
@ingroup extensions
|
||||
Attributed Variables and Co-Routining {#AttributedVariables}
|
||||
=======================================
|
||||
|
||||
YAP supports attributed variables, originally developed at OFAI by
|
||||
Christian Holzbaur. Attributes are a means of declaring that an
|
||||
@ -10,7 +8,6 @@ updated during forward execution. Moreover, the unification algorithm is
|
||||
aware of attributed variables and will call user defined handlers when
|
||||
trying to unify these variables.
|
||||
|
||||
|
||||
Attributed variables provide an elegant abstraction over which one can
|
||||
extend Prolog systems. Their main application so far has been in
|
||||
implementing constraint handlers, such as Holzbaur's CLPQR, Fruewirth
|
||||
@ -27,15 +24,12 @@ work with. Most packages included in YAP that use attributed
|
||||
variables, such as CHR, CLP(FD), and CLP(QR), rely on the SWI-Prolog
|
||||
interface.
|
||||
|
||||
+ @ref attributes
|
||||
+ @ewd attributes
|
||||
+ @ref New_Style_Attribute_Declarations
|
||||
+ @ref CohYroutining
|
||||
+ @ref AttributeVariables_Builtins
|
||||
|
||||
@{
|
||||
|
||||
@defgroup attributes SICStus Style attribute declarations.
|
||||
@ingroup AttributedVariables
|
||||
@section attributes SICStus Style attribute declarations.
|
||||
|
||||
The YAP library `atts` implements attribute variables in the style of
|
||||
SICStus Prolog. Attributed variables work as follows:
|
||||
@ -282,7 +276,6 @@ Module:get_atts/2`.
|
||||
@{
|
||||
|
||||
@defgroup New_Style_Attribute_Declarations hProlog and SWI-Prolog style Attribute Declarations
|
||||
@ingroup AttributedVariables
|
||||
|
||||
The following documentation is taken from the SWI-Prolog manual.
|
||||
|
||||
@ -305,7 +298,7 @@ Module:get_atts/2`.
|
||||
get_attr(X, domain, Dom).
|
||||
domain(X, List) :-
|
||||
list_to_ord_set(List, Domain),
|
||||
put_attr(Y, domain, Domain),
|
||||
v put_attr(Y, domain, Domain),
|
||||
X = Y.
|
||||
|
||||
% An attributed variable with attribute value Domain has been %
|
||||
@ -355,7 +348,6 @@ Module:get_atts/2`.
|
||||
|
||||
@{
|
||||
@defgroup CohYroutining Co-routining
|
||||
@ingroup AttributedVariables
|
||||
|
||||
Prolog uses a simple left-to-right flow of control. It is sometimes
|
||||
convenient to change this control so that goals will only execute when
|
31
docs/md/builtins.md
Normal file
31
docs/md/builtins.md
Normal file
@ -0,0 +1,31 @@
|
||||
YAP Built-ins {#builtins}
|
||||
=================
|
||||
|
||||
This chapter describes the core predicates that control the execution of
|
||||
Prolog programs, provide fundamental functionality such as termm manipulation or arithmetic, and support interaction with external
|
||||
resources, Many of the predicates described here have been standardised by the ISO. The standartised subset of Proloh also known as ISO-Prolog.
|
||||
|
||||
In the description of the arguments of functors the following notation
|
||||
will be used:
|
||||
|
||||
+ a preceding plus sign will denote an argument as an "input
|
||||
argument" - it cannot be a free variable at the time of the call;
|
||||
+ a preceding minus sign will denote an "output argument";
|
||||
+ an argument with no preceding symbol can be used in both ways.
|
||||
+ @ref YAPControl
|
||||
|
||||
+ @ref Arithmetic
|
||||
|
||||
+ @ref YAPChars
|
||||
|
||||
+ @ref YAP_Terms
|
||||
|
||||
+ @ref InputOutput
|
||||
|
||||
+ @ref AbsoluteFileName
|
||||
|
||||
+ @ref YAPOS
|
||||
|
||||
+ @ref Internal_Database
|
||||
|
||||
+ @ref Sets
|
18
docs/md/download.md
Normal file
18
docs/md/download.md
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
Downloading YAP {#download}
|
||||
==============
|
||||
|
||||
The latest development version of Yap-6 is yap-6.3.4 and can be
|
||||
obtained from the repositories
|
||||
|
||||
<http://sourceforge.net/p/yap/yap-6.3>
|
||||
|
||||
and
|
||||
|
||||
<https://github.com/vscosta/yap-6.3>
|
||||
|
||||
YAP-6.3.4 does not use modules. Please just use `git clone` to obtain the distribution.
|
||||
|
||||
Most of these repositories are basically copies of the original
|
||||
repositories at the SWI-Prolog site. YAP-6 will work either with or
|
||||
without these packages.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user