a question of size

This commit is contained in:
Vitor Santos Costa 2017-09-19 13:19:13 +01:00
parent 53822922c8
commit 98a5538f45
17 changed files with 2070 additions and 1872 deletions

View File

@ -184,9 +184,7 @@ LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
#endif
/* add new atom to start of chain */
size_t asz = strlen((const char *)atom);
ae = (AtomEntry *)Yap_AllocAtomSpace((sizeof *ae) +
asz+4);
ae = (AtomEntry *)Yap_AllocAtomSpace((sizeof *ae) + asz+1);
if (ae == NULL) {
WRITE_UNLOCK(HashChain[hash].AERWLock);
return NIL;
@ -194,7 +192,7 @@ LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
NOfAtoms++;
na = AbsAtom(ae);
ae->PropsOfAE = NIL;
stpncpy((char *)ae->StrOfAE, (const char *)atom, asz+1);
strcpy(ae->StrOfAE, (const char *)atom);
ae->NextOfAE = a;
HashChain[hash].Entry = na;

View File

@ -800,7 +800,8 @@ restart_aux:
ReleaseAndReturn(FALSE);
}
static Int cont_atom_concat3(USES_REGS1) {
static Int
cont_atom_concat3(USES_REGS1) {
Term t3;
Atom ats[2];
Int i, max;
@ -858,7 +859,7 @@ restart_aux:
ot = ARG1;
} else if (g3) {
EXTRA_CBACK_ARG(3, 1) = MkIntTerm(0);
EXTRA_CBACK_ARG(3, 2) = MkIntTerm(Yap_AtomToLength(t3 PASS_REGS));
EXTRA_CBACK_ARG(3, 2) = MkIntTerm(Yap_AtomToUnicodeLength(t3 PASS_REGS));
ReleaseAndReturn(cont_atom_concat3(PASS_REGS1));
} else {
LOCAL_Error_TYPE = INSTANTIATION_ERROR;
@ -948,7 +949,7 @@ restart_aux:
ot = ARG1;
} else if (g3) {
EXTRA_CBACK_ARG(3, 1) = MkIntTerm(0);
EXTRA_CBACK_ARG(3, 2) = MkIntTerm(Yap_AtomicToLength(t3 PASS_REGS));
EXTRA_CBACK_ARG(3, 2) = MkIntTerm(Yap_AtomicToUnicodeLength(t3 PASS_REGS));
return cont_atomic_concat3(PASS_REGS1);
} else {
LOCAL_Error_TYPE = INSTANTIATION_ERROR;
@ -1032,7 +1033,7 @@ restart_aux:
ot = ARG1;
} else if (g3) {
EXTRA_CBACK_ARG(3, 1) = MkIntTerm(0);
EXTRA_CBACK_ARG(3, 2) = MkIntTerm(Yap_StringToLength(t3 PASS_REGS));
EXTRA_CBACK_ARG(3, 2) = MkIntTerm(Yap_StringToUnicodeLength(t3 PASS_REGS));
pop_text_stack(l);
return cont_string_concat3(PASS_REGS1);
} else {
@ -1482,7 +1483,7 @@ static Int atom_length(USES_REGS1) {
}
}
restart_aux:
len = Yap_AtomicToLength(t1 PASS_REGS);
len = Yap_AtomToUnicodeLength(t1 PASS_REGS);
if (len != (size_t)-1)
ReleaseAndReturn(Yap_unify(ARG2, MkIntegerTerm(len)));
/* error handling */
@ -1523,7 +1524,7 @@ static Int atomic_length(USES_REGS1) {
}
}
restart_aux:
len = Yap_AtomicToLength(t1 PASS_REGS);
len = Yap_AtomicToUnicodeLength(t1 PASS_REGS);
if (len != (size_t)-1)
ReleaseAndReturn(Yap_unify(ARG2, MkIntegerTerm(len)));
/* error handling */
@ -1552,7 +1553,7 @@ static Int string_length(USES_REGS1) {
}
restart_aux:
t1 = Deref(ARG1);
len = Yap_AtomicToLength(t1 PASS_REGS);
len = Yap_StringToUnicodeLength(t1 PASS_REGS);
if (len != (size_t)-1)
ReleaseAndReturn(Yap_unify(ARG2, MkIntegerTerm(len)));
/* error handling */

View File

@ -188,18 +188,18 @@ static Term Globalize(Term v USES_REGS) {
static Int SkipListCodes(unsigned char **bufp, Term *l, Term **tailp,
Int *atoms, bool *wide, seq_tv_t *inp USES_REGS) {
Int length = 0;
Term *s; /* slow */
Term v; /* temporary */
*wide = false;
unsigned char *st0 = *bufp, *st;
bool atomst;
size_t max_lim = 1024;
if (!st0) {
st0 = Malloc(0);
st0 = Malloc(1024);
}
do_derefa(v, l, derefa_unk, derefa_nonvar);
*tailp = l;
s = l;
*bufp = st = st0;
@ -215,17 +215,18 @@ static Int SkipListCodes(unsigned char **bufp, Term *l, Term **tailp,
// are we looking for atoms/codes?
// whatever the case, we should be consistent throughout,
// so we should be consistent with the first arg.
if (*atoms == 1) {
if (!IsIntegerTerm(hd0)) {
return -INSTANTIATION_ERROR;
}
} else if (*atoms == 2) {
if (!IsAtomTerm(hd0)) {
return -TYPE_ERROR_ATOM;
if (st > st0+max_lim) {
max_lim += 2048;
*bufp = st0 = Realloc(st0,max_lim);
}
if (IsAtomTerm(hd0)) {
atomst = true;
} else {
atomst = false;
}
do {
while ( IsPairTerm(*l)) {
int ch;
length++;
{
@ -233,41 +234,35 @@ static Int SkipListCodes(unsigned char **bufp, Term *l, Term **tailp,
if (IsVarTerm(hd)) {
return -INSTANTIATION_ERROR;
} else if (IsAtomTerm(hd)) {
(*atoms)++;
if (*atoms < length) {
*tailp = l;
return -REPRESENTATION_ERROR_CHARACTER_CODE;
if (!atomst) {
return -REPRESENTATION_ERROR_CHARACTER;
} else {
AtomEntry *ae = RepAtom(AtomOfTerm(hd));
st = stpcpy(st, ae->StrOfAE);
st = (unsigned char *) stpcpy( ( char *)st, ae->StrOfAE);
}
} else if (IsIntegerTerm(hd)) {
ch = IntegerOfTerm(hd);
if (*atoms)
length = -REPRESENTATION_ERROR_CHARACTER;
if (atomst)
return -REPRESENTATION_ERROR_CHARACTER;
else if (ch < 0) {
*tailp = l;
length = -REPRESENTATION_ERROR_CHARACTER_CODE;
return -REPRESENTATION_ERROR_CHARACTER_CODE;
} else {
*wide |= ch > 0x80;
st += put_utf8(st,ch);
}
} else {
length = -TYPE_ERROR_INTEGER;
return -TYPE_ERROR_INTEGER;
}
if (length < 0) {
*tailp = l;
return length;
}
// now copy char to buffer
int chsz = put_utf8(st, ch);
if (chsz > 0) {
st += chsz;
}
}
l = RepPair(*l) + 1;
do_derefa(v, l, derefa2_unk, derefa2_nonvar);
} while (*l != *s && IsPairTerm(*l));
}
}
if (IsVarTerm(*l)) {
return -INSTANTIATION_ERROR;
@ -315,7 +310,7 @@ static unsigned char *wchar2utf8(seq_tv_t *inp, size_t *lengp) {
return buf;
}
static void *slice(size_t min, size_t max, unsigned char *buf USES_REGS);
static void *slice(size_t min, size_t max, const unsigned char *buf USES_REGS);
static unsigned char *to_buffer(unsigned char *buf, Term t, seq_tv_t *inp,
bool *widep, Int *atoms,
@ -537,11 +532,10 @@ static Term write_strings(unsigned char *s0, seq_tv_t *out,
Term t = init_tstring(PASS_REGS1);
LOCAL_TERM_ERROR(t, 2 * max);
unsigned char *buf = buf_from_tstring(HR);
strcpy( (char *)buf, s )
;
strcpy( (char *)buf, s );
if (max+1 < min) {
LOCAL_TERM_ERROR(t, 2 * min);
memset(buf+min, max, '\0');
memset(buf+min, '\0', max);
buf += min;
} else {
buf += max+1;
@ -911,19 +905,6 @@ bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
return rc;
}
static int cmp_Text(const unsigned char *s1, const unsigned char *s2, int l) {
const unsigned char *w1 = s1;
utf8proc_int32_t chr1, chr2;
const unsigned char *w2 = s2;
int i;
for (i = 0; i < l; i++) {
w2 += get_utf8(w2, -1, &chr2);
w1 += get_utf8(w1, -1, &chr1);
if (chr1 - chr2)
return chr1 - chr2;
}
return 0;
}
static unsigned char *concat(int n, void *sv[] USES_REGS) {
void *buf;
@ -947,7 +928,7 @@ static unsigned char *concat(int n, void *sv[] USES_REGS) {
return buf0;
}
static void *slice(size_t min, size_t max, unsigned char *buf USES_REGS) {
static void *slice(size_t min, size_t max, const unsigned char *buf USES_REGS) {
unsigned char *nbuf = Malloc((max - min) * 4 + 1);
const unsigned char *ptr = skip_utf8(buf, min);
unsigned char *nptr = nbuf;
@ -1018,7 +999,7 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
u_l1 = u_l - u_l0;
buf1 = slice(u_l0, u_l, buf PASS_REGS);
b_l1 = strlen(buf1);
b_l1 = strlen((const char *)buf1);
bool rc = write_Text(buf1, outv + 1, b_l1 PASS_REGS);
if (!rc) {
return false;
@ -1032,7 +1013,7 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
u_l1 = strlen_utf8(buf1);
b_l0 = b_l - b_l1;
u_l0 = u_l - u_l1;
if (bcmp(skip_utf8((const char *)buf, b_l0), buf1, b_l1) !=
if (bcmp(skip_utf8((const unsigned char *)buf, b_l0), buf1, b_l1) !=
0) {
return false;
}

View File

@ -389,7 +389,6 @@ int Yap_FormatFloat(Float f, char **s, size_t sz) {
wglb.lw = separator;
wglb.stream = GLOBAL_Stream + sno;
wrputf(f, &wglb);
wrputc('\0', wglb.stream);
so = Yap_MemExportStreamPtr(sno);
*s = Malloc( strlen(so) )+1;
strcpy(*s, so );

View File

@ -12,9 +12,10 @@ string(REGEX REPLACE "^LOCAL[^(]*[(][ \t]*([^,]+)[ \t]*,[ \t]*([^),]+).*" "#de
list( APPEND tmp2 ${i2} "\n")
endforeach()
endif()
file( WRITE ${CMAKE_TOP_BINARY_DIR}/dlocals.h ${tmp2})
file( WRITE ${CMAKE_TOP_BINARY_DIR}/dlocals.h ${tmp2})
add_custom_command( OUTPUT ${CMAKE_TOP_BINARY_DIR}/dlocals.h
COMMAND ${CMAKE_COMMAND} -E COPY ${CMAKE_TOP_BINARY_DIR}/deflocals.h ${CMAKE_TOP_BINARY_DIR}/dlocals.h
DEPENDS locals.h )
install (FILES ${PL_SOURCES}
DESTINATION ${libpl}/pl
)

View File

@ -185,7 +185,13 @@ INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
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);
utf8proc_ssize_t rc = utf8proc_iterate(ptr, n, valp);
if (rc < 0) {
if (rc == UTF8PROC_ERROR_INVALIDUTF8) Yap_Warning("get_utf8 found bad UTF-8 char %s, skipping...", ptr);
else Yap_Warning("UTF-8 error %d, skipping...", *ptr);
rc = 1;
}
return rc;
}
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
@ -193,7 +199,9 @@ INLINE_ONLY inline EXTERN 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) {
return utf8proc_encode_char(val, ptr);
utf8proc_ssize_t rc = utf8proc_encode_char(val, ptr);
if (rc == 0) Yap_Warning("UTF-8 error at %s", ptr);
return rc;
}
inline static const utf8proc_uint8_t *skip_utf8(const utf8proc_uint8_t *pt,
@ -204,6 +212,11 @@ inline static const utf8proc_uint8_t *skip_utf8(const utf8proc_uint8_t *pt,
utf8proc_ssize_t l = utf8proc_iterate(pt, -1, &b);
if (b == 0)
return pt;
if (l < 0) {
if (l == UTF8PROC_ERROR_INVALIDUTF8) Yap_Warning("skip_utf8: found bad UTF-8 in char %s[%d], skipping...", pt, i);
else Yap_Warning("UTF-8 error %d at %s[%d], skipping...", l,pt,i);
l = 1;
}
pt += l;
}
return pt;
@ -224,6 +237,8 @@ inline static utf8proc_ssize_t strlen_utf8(const utf8proc_uint8_t *pt) {
pt += l;
rc++;
} else {
if (l == UTF8PROC_ERROR_INVALIDUTF8) Yap_Warning("found bad UTF-8 char %d, skipping %s...", *pt, pt);
else Yap_Warning("UTF-8 error %d, skipping...", l);
pt++;
}
}
@ -542,16 +557,16 @@ static inline Term Yap_AtomicToUpListOfAtoms(Term t0 USES_REGS) {
return out.val.t;
}
static inline size_t Yap_AtomicToLength(Term t0 USES_REGS) {
static inline size_t Yap_AtomicToUnicodeLength(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
YAP_STRING_BIG | YAP_STRING_TERM;
out.type = YAP_STRING_LENGTH;
out.type = YAP_STRING_CHARS|YAP_STRING_OUTPUT_TERM;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
return strlen_utf8(out.val.uc0);
}
static inline Term Yap_AtomicToListOfAtoms(Term t0 USES_REGS) {
@ -590,17 +605,20 @@ static inline Atom Yap_AtomicToAtom(Term t0 USES_REGS) {
}
static inline size_t Yap_AtomToLength(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOM;
out.val.uc = NULL;
out.type = YAP_STRING_LENGTH;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return (size_t)(-1L);
return out.val.l;
if (!IsAtomTerm(t0)) {
return -TYPE_ERROR_ATOM;
}
return strlen(RepAtom(AtomOfTerm(t0))->StrOfAE);
}
static inline Term Yap_AtomToListOfAtoms(Term t0 USES_REGS) {
static inline size_t Yap_AtomToUnicodeLength(Term t0 USES_REGS) {
if (!IsAtomTerm(t0)) {
return -TYPE_ERROR_ATOM;
}
return strlen_utf8(RepAtom(AtomOfTerm(t0))->UStrOfAE);
}
static inline Term Yap_AtomToListOfAtoms(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOM;
@ -609,9 +627,9 @@ static inline Term Yap_AtomToListOfAtoms(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomSWIToListOfAtoms(Term t0 USES_REGS) {
static inline Term Yap_AtomSWIToListOfAtoms(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -624,9 +642,9 @@ static inline Term Yap_AtomSWIToListOfAtoms(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomToListOfCodes(Term t0 USES_REGS) {
static inline Term Yap_AtomToListOfCodes(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOM;
@ -635,9 +653,9 @@ static inline Term Yap_AtomToListOfCodes(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomToNumber(Term t0 USES_REGS) {
static inline Term Yap_AtomToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOM;
@ -646,9 +664,9 @@ static inline Term Yap_AtomToNumber(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomToString(Term t0 USES_REGS) {
static inline Term Yap_AtomToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -659,9 +677,9 @@ static inline Term Yap_AtomToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomSWIToString(Term t0 USES_REGS) {
static inline Term Yap_AtomSWIToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -673,9 +691,9 @@ static inline Term Yap_AtomSWIToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomicToString(Term t0 USES_REGS) {
static inline Term Yap_AtomicToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -687,9 +705,9 @@ static inline Term Yap_AtomicToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) {
static inline Term Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -701,9 +719,9 @@ static inline Term Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline wchar_t *Yap_AtomToWide(Atom at USES_REGS) {
static inline wchar_t *Yap_AtomToWide(Atom at USES_REGS) {
seq_tv_t inp, out;
inp.val.a = at;
inp.type = YAP_STRING_ATOM;
@ -712,9 +730,9 @@ static inline wchar_t *Yap_AtomToWide(Atom at USES_REGS) {
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) {
static inline Term Yap_AtomicToTBQ(Term t0, Term mod USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -726,9 +744,9 @@ static inline Term Yap_AtomicToTBQ(Term t0, Term mod USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_CharsToAtom(const char *s, encoding_t enc USES_REGS) {
static inline Atom Yap_CharsToAtom(const char *s, encoding_t enc USES_REGS) {
seq_tv_t inp, out;
inp.val.c0 = s;
@ -739,9 +757,9 @@ static inline Atom Yap_CharsToAtom(const char *s, encoding_t enc USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_CharsToListOfAtoms(const char *s,
static inline Term Yap_CharsToListOfAtoms(const char *s,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -753,9 +771,9 @@ static inline Term Yap_CharsToListOfAtoms(const char *s,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_CharsToListOfCodes(const char *s,
static inline Term Yap_CharsToListOfCodes(const char *s,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -767,9 +785,9 @@ static inline Term Yap_CharsToListOfCodes(const char *s,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_UTF8ToListOfCodes(const char *s USES_REGS) {
static inline Term Yap_UTF8ToListOfCodes(const char *s USES_REGS) {
seq_tv_t inp, out;
inp.val.c0 = s;
@ -779,9 +797,9 @@ static inline Term Yap_UTF8ToListOfCodes(const char *s USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_UTF8ToAtom(const unsigned char *s USES_REGS) {
static inline Atom Yap_UTF8ToAtom(const unsigned char *s USES_REGS) {
seq_tv_t inp, out;
inp.val.uc0 = s;
@ -791,9 +809,9 @@ static inline Atom Yap_UTF8ToAtom(const unsigned char *s USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_CharsToDiffListOfCodes(const char *s, Term tail,
static inline Term Yap_CharsToDiffListOfCodes(const char *s, Term tail,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -806,9 +824,9 @@ static inline Term Yap_CharsToDiffListOfCodes(const char *s, Term tail,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_UTF8ToDiffListOfCodes(const char *s,
static inline Term Yap_UTF8ToDiffListOfCodes(const char *s,
Term tail USES_REGS) {
seq_tv_t inp, out;
@ -821,9 +839,9 @@ static inline Term Yap_UTF8ToDiffListOfCodes(const char *s,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_WCharsToDiffListOfCodes(const wchar_t *s,
static inline Term Yap_WCharsToDiffListOfCodes(const wchar_t *s,
Term tail USES_REGS) {
seq_tv_t inp, out;
@ -836,9 +854,9 @@ static inline Term Yap_WCharsToDiffListOfCodes(const wchar_t *s,
return 0L;
return out.val.t;
}
}
static inline Term Yap_CharsToString(const char *s, encoding_t enc USES_REGS) {
static inline Term Yap_CharsToString(const char *s, encoding_t enc USES_REGS) {
seq_tv_t inp, out;
inp.val.c0 = s;
@ -849,9 +867,9 @@ static inline Term Yap_CharsToString(const char *s, encoding_t enc USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline char *Yap_AtomToUTF8Text(Atom at, const char *s USES_REGS) {
static inline char *Yap_AtomToUTF8Text(Atom at, const char *s USES_REGS) {
seq_tv_t inp, out;
inp.val.a = at;
@ -869,9 +887,9 @@ static inline char *Yap_AtomToUTF8Text(Atom at, const char *s USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.c;
}
}
static inline Term Yap_CharsToTDQ(const char *s, Term mod,
static inline Term Yap_CharsToTDQ(const char *s, Term mod,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -884,9 +902,9 @@ static inline Term Yap_CharsToTDQ(const char *s, Term mod,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_CharsToTBQ(const char *s, Term mod,
static inline Term Yap_CharsToTBQ(const char *s, Term mod,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -899,9 +917,9 @@ static inline Term Yap_CharsToTBQ(const char *s, Term mod,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) {
static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS;
@ -910,9 +928,9 @@ static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return (Atom)NULL;
return out.val.a;
}
}
static inline Term Yap_ListOfAtomsToNumber(Term t0 USES_REGS) {
static inline Term Yap_ListOfAtomsToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS;
@ -922,9 +940,9 @@ static inline Term Yap_ListOfAtomsToNumber(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_ListOfAtomsToString(Term t0 USES_REGS) {
static inline Term Yap_ListOfAtomsToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS;
@ -933,9 +951,9 @@ static inline Term Yap_ListOfAtomsToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_ListOfCodesToAtom(Term t0 USES_REGS) {
static inline Atom Yap_ListOfCodesToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_CODES;
@ -944,9 +962,9 @@ static inline Atom Yap_ListOfCodesToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return (Atom)NULL;
return out.val.a;
}
}
static inline Term Yap_ListOfCodesToNumber(Term t0 USES_REGS) {
static inline Term Yap_ListOfCodesToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_CODES;
@ -955,9 +973,9 @@ static inline Term Yap_ListOfCodesToNumber(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_ListOfCodesToString(Term t0 USES_REGS) {
static inline Term Yap_ListOfCodesToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_CODES;
@ -966,9 +984,9 @@ static inline Term Yap_ListOfCodesToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_ListToAtom(Term t0 USES_REGS) {
static inline Atom Yap_ListToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS_CODES;
@ -977,9 +995,9 @@ static inline Atom Yap_ListToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_ListToAtomic(Term t0 USES_REGS) {
static inline Term Yap_ListToAtomic(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING | YAP_STRING_ATOMS_CODES | YAP_STRING_TERM;
@ -989,9 +1007,9 @@ static inline Term Yap_ListToAtomic(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_ListToNumber(Term t0 USES_REGS) {
static inline Term Yap_ListToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1002,9 +1020,9 @@ static inline Term Yap_ListToNumber(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_ListToString(Term t0 USES_REGS) {
static inline Term Yap_ListToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1015,9 +1033,9 @@ static inline Term Yap_ListToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_ListSWIToString(Term t0 USES_REGS) {
static inline Term Yap_ListSWIToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1030,9 +1048,9 @@ static inline Term Yap_ListSWIToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term YapListToTDQ(Term t0, Term mod USES_REGS) {
static inline Term YapListToTDQ(Term t0, Term mod USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1043,9 +1061,9 @@ static inline Term YapListToTDQ(Term t0, Term mod USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term YapListToTBQ(Term t0, Term mod USES_REGS) {
static inline Term YapListToTBQ(Term t0, Term mod USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1056,9 +1074,9 @@ static inline Term YapListToTBQ(Term t0, Term mod USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_NCharsToAtom(const char *s, size_t len,
static inline Atom Yap_NCharsToAtom(const char *s, size_t len,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -1071,9 +1089,9 @@ static inline Atom Yap_NCharsToAtom(const char *s, size_t len,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_CharsToDiffListOfAtoms(const char *s, encoding_t enc,
static inline Term Yap_CharsToDiffListOfAtoms(const char *s, encoding_t enc,
Term tail USES_REGS) {
seq_tv_t inp, out;
@ -1085,9 +1103,9 @@ static inline Term Yap_CharsToDiffListOfAtoms(const char *s, encoding_t enc,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NCharsToListOfCodes(const char *s, size_t len,
static inline Term Yap_NCharsToListOfCodes(const char *s, size_t len,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -1099,9 +1117,9 @@ static inline Term Yap_NCharsToListOfCodes(const char *s, size_t len,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NCharsToString(const char *s, size_t len,
static inline Term Yap_NCharsToString(const char *s, size_t len,
encoding_t enc USES_REGS) {
seq_tv_t inp, out;
@ -1113,9 +1131,9 @@ static inline Term Yap_NCharsToString(const char *s, size_t len,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NCharsToTDQ(const char *s, size_t len, encoding_t enc,
static inline Term Yap_NCharsToTDQ(const char *s, size_t len, encoding_t enc,
Term mod USES_REGS) {
seq_tv_t inp, out;
@ -1128,9 +1146,9 @@ static inline Term Yap_NCharsToTDQ(const char *s, size_t len, encoding_t enc,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NCharsToTBQ(const char *s, size_t len, encoding_t enc,
static inline Term Yap_NCharsToTBQ(const char *s, size_t len, encoding_t enc,
Term mod USES_REGS) {
seq_tv_t inp, out;
@ -1143,9 +1161,9 @@ static inline Term Yap_NCharsToTBQ(const char *s, size_t len, encoding_t enc,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_NumberToAtom(Term t0 USES_REGS) {
static inline Atom Yap_NumberToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type =
@ -1154,9 +1172,9 @@ static inline Atom Yap_NumberToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_NumberToListOfAtoms(Term t0 USES_REGS) {
static inline Term Yap_NumberToListOfAtoms(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type =
@ -1165,9 +1183,9 @@ static inline Term Yap_NumberToListOfAtoms(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NumberToListOfCodes(Term t0 USES_REGS) {
static inline Term Yap_NumberToListOfCodes(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type =
@ -1176,9 +1194,9 @@ static inline Term Yap_NumberToListOfCodes(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NumberToString(Term t0 USES_REGS) {
static inline Term Yap_NumberToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type =
@ -1187,9 +1205,9 @@ static inline Term Yap_NumberToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_NWCharsToAtom(const wchar_t *s, size_t len USES_REGS) {
static inline Atom Yap_NWCharsToAtom(const wchar_t *s, size_t len USES_REGS) {
seq_tv_t inp, out;
inp.val.w0 = s;
@ -1199,9 +1217,9 @@ static inline Atom Yap_NWCharsToAtom(const wchar_t *s, size_t len USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_NWCharsToListOfAtoms(const wchar_t *s,
static inline Term Yap_NWCharsToListOfAtoms(const wchar_t *s,
size_t len USES_REGS) {
seq_tv_t inp, out;
@ -1212,9 +1230,9 @@ static inline Term Yap_NWCharsToListOfAtoms(const wchar_t *s,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NWCharsToListOfCodes(const wchar_t *s,
static inline Term Yap_NWCharsToListOfCodes(const wchar_t *s,
size_t len USES_REGS) {
seq_tv_t inp, out;
@ -1226,9 +1244,9 @@ static inline Term Yap_NWCharsToListOfCodes(const wchar_t *s,
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_NWCharsToString(const wchar_t *s, size_t len USES_REGS) {
static inline Term Yap_NWCharsToString(const wchar_t *s, size_t len USES_REGS) {
seq_tv_t inp, out;
inp.val.w0 = s;
@ -1239,9 +1257,9 @@ static inline Term Yap_NWCharsToString(const wchar_t *s, size_t len USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_StringToAtom(Term t0 USES_REGS) {
static inline Atom Yap_StringToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING;
@ -1250,9 +1268,9 @@ static inline Atom Yap_StringToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Atom Yap_StringSWIToAtom(Term t0 USES_REGS) {
static inline Atom Yap_StringSWIToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
@ -1263,9 +1281,9 @@ static inline Atom Yap_StringSWIToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline size_t Yap_StringToAtomic(Term t0 USES_REGS) {
static inline size_t Yap_StringToAtomic(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING;
@ -1275,20 +1293,16 @@ static inline size_t Yap_StringToAtomic(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline size_t Yap_StringToLength(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING;
out.type = YAP_STRING_LENGTH;
out.val.uc = NULL;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return (size_t)(-1L);
return out.val.l;
}
static inline size_t Yap_StringToUnicodeLength(Term t0 USES_REGS) {
if (!IsStringTerm(t0)) {
return -TYPE_ERROR_STRING;
}
return strlen_utf8(UStringOfTerm(t0));
}
static inline size_t Yap_StringToListOfAtoms(Term t0 USES_REGS) {
static inline size_t Yap_StringToListOfAtoms(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING;
@ -1297,9 +1311,9 @@ static inline size_t Yap_StringToListOfAtoms(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline size_t Yap_StringSWIToListOfAtoms(Term t0 USES_REGS) {
static inline size_t Yap_StringSWIToListOfAtoms(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
@ -1310,9 +1324,9 @@ static inline size_t Yap_StringSWIToListOfAtoms(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline size_t Yap_StringToListOfCodes(Term t0 USES_REGS) {
static inline size_t Yap_StringToListOfCodes(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING;
@ -1321,9 +1335,9 @@ static inline size_t Yap_StringToListOfCodes(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline size_t Yap_StringSWIToListOfCodes(Term t0 USES_REGS) {
static inline size_t Yap_StringSWIToListOfCodes(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
@ -1334,9 +1348,9 @@ static inline size_t Yap_StringSWIToListOfCodes(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_StringToNumber(Term t0 USES_REGS) {
static inline Term Yap_StringToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_STRING;
@ -1346,9 +1360,9 @@ static inline Term Yap_StringToNumber(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_TextToAtom(Term t0 USES_REGS) {
static inline Atom Yap_TextToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1360,9 +1374,9 @@ static inline Atom Yap_TextToAtom(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
}
static inline Term Yap_TextToString(Term t0 USES_REGS) {
static inline Term Yap_TextToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1374,9 +1388,9 @@ static inline Term Yap_TextToString(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline void Yap_OverwriteUTF8BufferToLowCase(void *buf USES_REGS) {
static inline void Yap_OverwriteUTF8BufferToLowCase(void *buf USES_REGS) {
unsigned char *s = (unsigned char *)buf;
while (*s) {
// assumes the two code have always the same size;
@ -1385,9 +1399,9 @@ static inline void Yap_OverwriteUTF8BufferToLowCase(void *buf USES_REGS) {
chr = utf8proc_tolower(chr);
s += put_utf8(s, chr);
}
}
}
static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
@ -1400,13 +1414,13 @@ static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.uc0;
}
}
static inline Term Yap_UTF8ToString(const char *s USES_REGS) {
static inline Term Yap_UTF8ToString(const char *s USES_REGS) {
return MkStringTerm(s);
}
}
static inline Atom UTF32ToAtom(const wchar_t *s USES_REGS) {
static inline Atom UTF32ToAtom(const wchar_t *s USES_REGS) {
seq_tv_t inp, out;
inp.val.w0 = s;
@ -1416,9 +1430,9 @@ static inline Atom UTF32ToAtom(const wchar_t *s USES_REGS) {
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) {
static inline Term Yap_WCharsToListOfCodes(const wchar_t *s USES_REGS) {
seq_tv_t inp, out;
inp.val.w0 = s;
inp.type = YAP_STRING_WCHARS;
@ -1427,9 +1441,9 @@ static inline Term Yap_WCharsToListOfCodes(const wchar_t *s USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_WCharsToTDQ(wchar_t *s, Term mod USES_REGS) {
static inline Term Yap_WCharsToTDQ(wchar_t *s, Term mod USES_REGS) {
seq_tv_t inp, out;
inp.val.w0 = s;
@ -1441,9 +1455,9 @@ static inline Term Yap_WCharsToTDQ(wchar_t *s, Term mod USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_WCharsToTBQ(wchar_t *s, Term mod USES_REGS) {
static inline Term Yap_WCharsToTBQ(wchar_t *s, Term mod USES_REGS) {
seq_tv_t inp, out;
inp.val.w = s;
@ -1454,9 +1468,9 @@ static inline Term Yap_WCharsToTBQ(wchar_t *s, Term mod USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Term Yap_WCharsToString(const wchar_t *s USES_REGS) {
static inline Term Yap_WCharsToString(const wchar_t *s USES_REGS) {
seq_tv_t inp, out;
inp.val.w0 = s;
inp.type = YAP_STRING_WCHARS;
@ -1465,9 +1479,9 @@ static inline Term Yap_WCharsToString(const wchar_t *s USES_REGS) {
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_ConcatAtoms(Term t1, Term t2 USES_REGS) {
static inline Atom Yap_ConcatAtoms(Term t1, Term t2 USES_REGS) {
seq_tv_t inpv[2], out;
inpv[0].val.t = t1;
inpv[0].type = YAP_STRING_ATOM;
@ -1478,9 +1492,9 @@ static inline Atom Yap_ConcatAtoms(Term t1, Term t2 USES_REGS) {
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
return (Atom)NULL;
return out.val.a;
}
}
static inline Atom Yap_ConcatAtomics(Term t1, Term t2 USES_REGS) {
static inline Atom Yap_ConcatAtomics(Term t1, Term t2 USES_REGS) {
seq_tv_t inpv[2], out;
inpv[0].val.t = t1;
inpv[0].type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
@ -1493,9 +1507,9 @@ static inline Atom Yap_ConcatAtomics(Term t1, Term t2 USES_REGS) {
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
return (Atom)NULL;
return out.val.a;
}
}
static inline Term Yap_ConcatStrings(Term t1, Term t2 USES_REGS) {
static inline Term Yap_ConcatStrings(Term t1, Term t2 USES_REGS) {
seq_tv_t inpv[2], out;
inpv[0].val.t = t1;
inpv[0].type = YAP_STRING_STRING;
@ -1506,9 +1520,9 @@ static inline Term Yap_ConcatStrings(Term t1, Term t2 USES_REGS) {
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
return 0L;
return out.val.t;
}
}
static inline Atom Yap_SpliceAtom(Term t1, Atom ats[], size_t cut,
static inline Atom Yap_SpliceAtom(Term t1, Atom ats[], size_t cut,
size_t max USES_REGS) {
seq_tv_t outv[2], inp;
size_t cuts[2];
@ -1523,9 +1537,9 @@ static inline Atom Yap_SpliceAtom(Term t1, Atom ats[], size_t cut,
ats[0] = outv[0].val.a;
ats[1] = outv[1].val.a;
return ats[0];
}
}
static inline Atom Yap_SubtractHeadAtom(Term t1, Term th USES_REGS) {
static inline Atom Yap_SubtractHeadAtom(Term t1, Term th USES_REGS) {
seq_tv_t outv[2], inp;
inp.type = YAP_STRING_ATOM;
inp.val.t = t1;
@ -1536,9 +1550,9 @@ static inline Atom Yap_SubtractHeadAtom(Term t1, Term th USES_REGS) {
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS))
return (Atom)NULL;
return outv[1].val.a;
}
}
static inline Atom Yap_SubtractTailAtom(Term t1, Term th USES_REGS) {
static inline Atom Yap_SubtractTailAtom(Term t1, Term th USES_REGS) {
seq_tv_t outv[2], inp;
inp.type = YAP_STRING_ATOM;
inp.val.t = t1;
@ -1549,9 +1563,9 @@ static inline Atom Yap_SubtractTailAtom(Term t1, Term th USES_REGS) {
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS))
return (Atom)NULL;
return outv[0].val.a;
}
}
static inline Term Yap_SpliceString(Term t1, Term ts[], size_t cut,
static inline Term Yap_SpliceString(Term t1, Term ts[], size_t cut,
size_t max USES_REGS) {
seq_tv_t outv[2], inp;
size_t cuts[2];
@ -1566,9 +1580,9 @@ static inline Term Yap_SpliceString(Term t1, Term ts[], size_t cut,
ts[0] = outv[0].val.t;
ts[1] = outv[1].val.t;
return ts[0];
}
}
static inline Term Yap_SubtractHeadString(Term t1, Term th USES_REGS) {
static inline Term Yap_SubtractHeadString(Term t1, Term th USES_REGS) {
seq_tv_t outv[2], inp;
inp.type = YAP_STRING_STRING;
inp.val.t = t1;
@ -1579,9 +1593,9 @@ static inline Term Yap_SubtractHeadString(Term t1, Term th USES_REGS) {
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS))
return 0L;
return outv[1].val.t;
}
}
static inline Term Yap_SubtractTailString(Term t1, Term th USES_REGS) {
static inline Term Yap_SubtractTailString(Term t1, Term th USES_REGS) {
seq_tv_t outv[2], inp;
inp.type = YAP_STRING_STRING;
inp.val.t = t1;
@ -1592,9 +1606,9 @@ static inline Term Yap_SubtractTailString(Term t1, Term th USES_REGS) {
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS))
return 0L;
return outv[0].val.t;
}
}
#endif // ≈YAP_TEXT_H
const char *Yap_TextTermToText(Term t, char *buf, size_t len, encoding_t enc);
Term Yap_MkTextTerm(const char *s, encoding_t e, Term tguide);
const char *Yap_TextTermToText(Term t, char *buf, size_t len, encoding_t enc);
Term Yap_MkTextTerm(const char *s, encoding_t e, Term tguide);

View File

@ -376,6 +376,7 @@ static void AdjustSwitchTable__(op_numbers op, yamop *table,
startcode += 2;
}
/* adjust fail code */
startcode[1] = (CELL)CodeAddrAdjust((CODEADDR)startcode[1]);
} break;
case _if_cons: {

File diff suppressed because it is too large Load Diff

View File

@ -379,8 +379,8 @@ typedef void (*YAP_halt_hook)(int exit_code, void *closure);
/* each type has a tag */
typedef YAP_Int YAP_opaque_tag_t;
typedef YAP_Bool (*YAP_Opaque_CallOnFail)(YAP_Term);
typedef YAP_Bool (*YAP_Opaque_CallOnCut)(YAP_Term);
typedef YAP_Bool (*YAP_Opaque_CallOnFail)(void *);
typedef YAP_Bool (*YAP_Opaque_CallOnCut)(void *);
typedef YAP_Bool (*YAP_Opaque_CallOnWrite)(FILE *, YAP_opaque_tag_t, void *,
int);
typedef YAP_Int (*YAP_Opaque_CallOnGCMark)(YAP_opaque_tag_t, void *, YAP_Term *,
@ -390,7 +390,7 @@ typedef YAP_Bool (*YAP_Opaque_CallOnGCRelocate)(YAP_opaque_tag_t, void *,
/// opaque variables can interact with the system
typedef struct YAP_opaque_handler_struct {
YAP_Opaque_CallOnCut cut_handler; //< called at cut, which may be a forward
// cut or an exception.
//cut or an exception.
YAP_Opaque_CallOnFail
fail_handler; //< called at exit, it can be used to cleanup resources
YAP_Opaque_CallOnWrite write_handler; //< text representation

View File

@ -1089,6 +1089,7 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name,
if (name == NULL) {
char buf[YAP_FILENAME_MAX + 1];
memset(buf, 0, YAP_FILENAME_MAX + 1);
name = Yap_guessFileName(fd, sno, buf, YAP_FILENAME_MAX);
if (name)
st->name = Yap_LookupAtom(name);

View File

@ -286,7 +286,7 @@ form:
+ symbols, including `(`, `)`, `,`, `;`
*/
static Int scan_to_list(USE_ARGS1) {
static Int scan_to_list(USES_ARGS1) {
int inp_stream;
Term tpos, tout;

View File

@ -300,7 +300,7 @@ has_reposition(int sno,
}
char *Yap_guessFileName(FILE *file, int sno, char *nameb, size_t max) {
size_t maxs = Yap_Max(255, max);
size_t maxs = Yap_Max(1024, max);
if (!nameb) {
nameb = malloc(maxs + 1);
}
@ -315,25 +315,30 @@ char *Yap_guessFileName(FILE *file, int sno, char *nameb, size_t max) {
}
#if __linux__
char path[256];
if (snprintf(path, 255, "/proc/self/fd/%d", f) && readlink(path, nameb, max))
char *path= malloc(1024);
if (snprintf(path, 1023, "/proc/self/fd/%d", f) && readlink(path, nameb, maxs)) {
free(path);
return nameb;
}
#elif __APPLE__
if (fcntl(f, F_GETPATH, nameb) != -1) {
return nameb;
}
#else
TCHAR path[MAX_PATH + 1];
if (!GetFullPathName(path, MAX_PATH, path, NULL))
TCHAR path= malloc(MAX_PATH + 1);
if (!GetFullPathName(path, MAX_PATH, path, NULL)) {
free(path);
return NULL;
else {
} else {
int i;
unsigned char *ptr = (unsigned char *)nameb;
for (i = 0; i < strlen(path); i++)
ptr += put_utf8(ptr, path[i]);
*ptr = '\0';
free(path);
return nameb;
}
free(path);
#endif
if (!StreamName(sno)) {
return NULL;

View File

@ -13,6 +13,11 @@ set (SQLITE3_FOUND ON CACHE PRIVATE "")
include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
if (ANDROID)
add_definitions(-DSQLITE_FCNTL_MMAP_SIZE=0 )
endif()
add_definitions(-DSQLITE_ENABLE_COLUMN_METADATA=1 )
add_definitions(-DSQLITE_ENABLE_JSON1=1 )
@ -30,34 +35,34 @@ if (ANDROID)
include_directories( .. src/Android/jni/sqlite src/Android/jni/sqlite/nativehelper )
set(YAPSQLITE3_SOURCES
${YAPSQLITE3_SOURCES}
src/Android/jni/sqlite/JNIHelp.cpp
src/Android/jni/sqlite/JniConstants.cpp
src/Android/jni/sqlite/android_database_SQLiteCommon.cpp
src/Android/jni/sqlite/android_database_SQLiteCommon.h
src/Android/jni/sqlite/android_database_SQLiteConnection.cpp
src/Android/jni/sqlite/android_database_SQLiteDebug.cpp
src/Android/jni/sqlite/android_database_SQLiteGlobal.cpp
src/Android/jni/sqlite/nativehelper/jni.h
src/Android/jni/sqlite/nativehelper/JniConstants.h
src/Android/jni/sqlite/nativehelper/JNIHelp.h
src/Android/jni/sqlite/nativehelper/ScopedLocalRef.h
)
set(YAPSQLITE3_SOURCES
${YAPSQLITE3_SOURCES}
src/Android/jni/sqlite/JNIHelp.cpp
src/Android/jni/sqlite/JniConstants.cpp
src/Android/jni/sqlite/android_database_SQLiteCommon.cpp
src/Android/jni/sqlite/android_database_SQLiteCommon.h
src/Android/jni/sqlite/android_database_SQLiteConnection.cpp
src/Android/jni/sqlite/android_database_SQLiteDebug.cpp
src/Android/jni/sqlite/android_database_SQLiteGlobal.cpp
src/Android/jni/sqlite/nativehelper/jni.h
src/Android/jni/sqlite/nativehelper/JniConstants.h
src/Android/jni/sqlite/nativehelper/JNIHelp.h
src/Android/jni/sqlite/nativehelper/ScopedLocalRef.h
)
endif (ANDROID)
add_lib( Yapsqlite3
${YAPSQLITE3_SOURCES} )
MY_set_target_properties(Yapsqlite3
MY_set_target_properties(Yapsqlite3
PROPERTIES
# RPATH ${libdir} VERSION ${LIBYAPTAI_FULL_VERSION}
# SOVERSION ${LIBYAPTAI_MAJOR_VERSION}.${LIBYAPTAI_MINOR_VERSION}
POSITION_INDEPENDENT_CODE TRUE
)
target_link_libraries(Yapsqlite3 libYap)
target_link_libraries(Yapsqlite3 libYap)
if (ANDROID)
target_link_libraries(Yapsqlite3 android log)

View File

@ -1,16 +1,13 @@
"""A setuptools based setup module.
#!/usr/bin/env python
# coding: utf-8
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
"""
# Always prefer setuptools over distutils
import setuptools
from setuptools import setup
from setuptools.extension import Extension
# To use a consistent encoding
from codecs import open
from os import path, makedirs, walk
from shutil import copytree, rmtree, copy2, move
@ -19,81 +16,165 @@ from pathlib import Path
import platform
import os.path
my_extra_link_args = []
if platform.system() == 'Darwin':
my_extra_link_args = ['-Wl,-rpath','-Wl,']
so = 'dylib'
#or dll in glob('yap/dlls/*'):
# move( dll ,'lib' )
pls = []
for (r,d,fs) in walk('yap/pl'):
for f in fs:
pls += [os.path.join(r, f)]
for (r,d,fs) in walk('yap'):
for f in fs:
pls += [os.path.join(r, f)]
# for f in glob( 'lib*.*' ):
# ofile.write(f+"\n")
cplus=['../../../CXX/yapi.cpp']
py2yap=['../../../packages/python/python.c',
'../../../packages/python/pl2py.c',
'../../../packages/python/pybips.c',
'../../../packages/python/py2pl.c',
'../../../packages/python/pl2pl.c',
'../../../packages/python/pypreds.c'
]
python_sources = ['yapPYTHON_wrap.cxx']+py2yap+cplus
here = path.abspath(path.dirname(__file__))
# the name of the package
name = 'YAP4PY'
# -----------------------------------------------------------------------------
# Minimal Python version sanity check
# -----------------------------------------------------------------------------
import sys
v = sys.version_info
if v[:2] < (2, 7) or (v[0] >= 3 and v[:2] < (3, 3)):
error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name
print(error, file=sys.stderr)
sys.exit(1)
PY3 = (sys.version_info[0] >= 3)
# -----------------------------------------------------------------------------
# get on with it
# -----------------------------------------------------------------------------
from codecs import open
from os import path, makedirs, walk
from shutil import copytree, rmtree, copy2, move
from glob import glob
from pathlib import Path
import platform
import os.path
import os
import shutil
from distutils.core import setup
pjoin = os.path.join
here = os.path.abspath(os.path.dirname(__file__))
#pkg_root = pjoin(here, name)
sys.path.insert(0, "/home/vsc/github/yap-6.3/packages/python/swig")
my_extra_link_args = []
if platform.system() == 'Windows':
local_libs = []
win_libs = ['wsock32','ws2_32']
my_extra_link_args = ['-Wl,-export-all-symbols']
else:
# if platform.system() == 'Darwin':
my_extra_link_args = ['-Wl,-rpath', '-Wl,']
win_libs = []
local_libs = ['YAP++','Py4YAP']
# or dll in glob('yap/dlls/*'):
# move( dll ,'lib' )
native_sources = ["yap.i"]
for i in '/home/vsc/github/yap-6.3/packages/python/swig/yap4py/yapi.py;/home/vsc/github/yap-6.3/packages/python/swig/yap4py/__init__.py;/home/vsc/github/yap-6.3/packages/python/swig/yap4py/__main__.py'.split(";"):
copy2(i, 'yap4py')
for i in '/home/vsc/github/yap-6.3/packages/python/python.pl;/home/vsc/github/yap-6.3/library/INDEX.pl;/home/vsc/github/yap-6.3/library/apply.yap;/home/vsc/github/yap-6.3/library/apply_macros.yap;/home/vsc/github/yap-6.3/library/arg.yap;/home/vsc/github/yap-6.3/library/assoc.yap;/home/vsc/github/yap-6.3/library/atts.yap;/home/vsc/github/yap-6.3/library/autoloader.yap;/home/vsc/github/yap-6.3/library/avl.yap;/home/vsc/github/yap-6.3/library/bhash.yap;/home/vsc/github/yap-6.3/library/charsio.yap;/home/vsc/github/yap-6.3/library/clauses.yap;/home/vsc/github/yap-6.3/library/coinduction.yap;/home/vsc/github/yap-6.3/library/dbqueues.yap;/home/vsc/github/yap-6.3/library/dbusage.yap;/home/vsc/github/yap-6.3/library/dgraphs.yap;/home/vsc/github/yap-6.3/library/exo_interval.yap;/home/vsc/github/yap-6.3/library/expand_macros.yap;/home/vsc/github/yap-6.3/library/gensym.yap;/home/vsc/github/yap-6.3/library/hacks.yap;/home/vsc/github/yap-6.3/library/heaps.yap;/home/vsc/github/yap-6.3/library/lambda.pl;/home/vsc/github/yap-6.3/library/lineutils.yap;/home/vsc/github/yap-6.3/library/listing.yap;/home/vsc/github/yap-6.3/library/lists.yap;/home/vsc/github/yap-6.3/library/log2md.yap;/home/vsc/github/yap-6.3/library/nb.yap;/home/vsc/github/yap-6.3/library/ordsets.yap;/home/vsc/github/yap-6.3/library/mapargs.yap;/home/vsc/github/yap-6.3/library/maplist.yap;/home/vsc/github/yap-6.3/library/maputils.yap;/home/vsc/github/yap-6.3/library/matlab.yap;/home/vsc/github/yap-6.3/library/matrix.yap;/home/vsc/github/yap-6.3/library/prandom.yap;/home/vsc/github/yap-6.3/library/queues.yap;/home/vsc/github/yap-6.3/library/random.yap;/home/vsc/github/yap-6.3/library/range.yap;/home/vsc/github/yap-6.3/library/rbtrees.yap;/home/vsc/github/yap-6.3/library/regexp.yap;/home/vsc/github/yap-6.3/library/readutil.yap;/home/vsc/github/yap-6.3/library/rltree.yap;/home/vsc/github/yap-6.3/library/sockets.yap;/home/vsc/github/yap-6.3/library/splay.yap;/home/vsc/github/yap-6.3/library/stringutils.yap;/home/vsc/github/yap-6.3/library/system.yap;/home/vsc/github/yap-6.3/library/terms.yap;/home/vsc/github/yap-6.3/library/tries.yap;/home/vsc/github/yap-6.3/library/itries.yap;/home/vsc/github/yap-6.3/library/timeout.yap;/home/vsc/github/yap-6.3/library/trees.yap;/home/vsc/github/yap-6.3/library/ugraphs.yap;/home/vsc/github/yap-6.3/library/undgraphs.yap;/home/vsc/github/yap-6.3/library/varnumbers.yap;/home/vsc/github/yap-6.3/library/wdgraphs.yap;/home/vsc/github/yap-6.3/library/wgraphs.yap;/home/vsc/github/yap-6.3/library/wundgraphs.yap;/home/vsc/github/yap-6.3/library/lam_mpi.yap;/home/vsc/github/yap-6.3/library/ypp.yap;/home/vsc/github/yap-6.3/library/ytest.yap;/home/vsc/github/yap-6.3/library/c_alarms.yap;/home/vsc/github/yap-6.3/library/flags.yap;/home/vsc/github/yap-6.3/library/block_diagram.yap;/home/vsc/github/yap-6.3/packages/real/real.pl;/home/vsc/github/yap-6.3/packages/python/swig/prolog/jupyter.yap;/home/vsc/github/yap-6.3/packages/python/swig/prolog/yapi.yap'.split(";") + '/home/vsc/github/yap-6.3/swi/library/aggregate.pl;/home/vsc/github/yap-6.3/swi/library/base64.pl;/home/vsc/github/yap-6.3/swi/library/broadcast.pl;/home/vsc/github/yap-6.3/swi/library/ctypes.pl;/home/vsc/github/yap-6.3/swi/library/date.pl;/home/vsc/github/yap-6.3/swi/library/debug.pl;/home/vsc/github/yap-6.3/swi/library/edit.pl;/home/vsc/github/yap-6.3/swi/library/error.pl;/home/vsc/github/yap-6.3/swi/library/main.pl;/home/vsc/github/yap-6.3/swi/library/menu.pl;/home/vsc/github/yap-6.3/swi/library/nb_set.pl;/home/vsc/github/yap-6.3/swi/library/occurs.yap;/home/vsc/github/yap-6.3/swi/library/operators.pl;/home/vsc/github/yap-6.3/swi/library/option.pl;/home/vsc/github/yap-6.3/swi/library/pairs.pl;/home/vsc/github/yap-6.3/swi/library/plunit.pl;/home/vsc/github/yap-6.3/swi/library/predicate_options.pl;/home/vsc/github/yap-6.3/swi/library/predopts.pl;/home/vsc/github/yap-6.3/swi/library/prolog_clause.pl;/home/vsc/github/yap-6.3/swi/library/prolog_colour.pl;/home/vsc/github/yap-6.3/swi/library/prolog_source.pl;/home/vsc/github/yap-6.3/swi/library/prolog_xref.pl;/home/vsc/github/yap-6.3/swi/library/pure_input.pl;/home/vsc/github/yap-6.3/swi/library/quasi_quotations.pl;/home/vsc/github/yap-6.3/swi/library/quintus.pl;/home/vsc/github/yap-6.3/swi/library/record.pl;/home/vsc/github/yap-6.3/swi/library/settings.pl;/home/vsc/github/yap-6.3/swi/library/shlib.pl;/home/vsc/github/yap-6.3/swi/library/thread_pool.pl;/home/vsc/github/yap-6.3/swi/library/unix.pl;/home/vsc/github/yap-6.3/swi/library/url.pl;/home/vsc/github/yap-6.3/swi/library/utf8.pl;/home/vsc/github/yap-6.3/swi/library/win_menu.pl;/home/vsc/github/yap-6.3/swi/library/www_browser.pl;/home/vsc/github/yap-6.3/swi/library/dcg/basics.pl'.split(";") :
copy2(i, 'yap4py/prolog')
for i in '/home/vsc/github/yap-6.3/os/edio.yap;/home/vsc/github/yap-6.3/os/chartypes.yap'.split(";") :
copy2(i, 'yap4py/prolog/os')
for i in '/home/vsc/github/yap-6.3/pl/absf.yap;/home/vsc/github/yap-6.3/pl/arith.yap;/home/vsc/github/yap-6.3/pl/arithpreds.yap;/home/vsc/github/yap-6.3/pl/arrays.yap;/home/vsc/github/yap-6.3/pl/atoms.yap;/home/vsc/github/yap-6.3/pl/attributes.yap;/home/vsc/github/yap-6.3/pl/boot.yap;/home/vsc/github/yap-6.3/pl/bootlists.yap;/home/vsc/github/yap-6.3/pl/callcount.yap;/home/vsc/github/yap-6.3/pl/checker.yap;/home/vsc/github/yap-6.3/pl/consult.yap;/home/vsc/github/yap-6.3/pl/control.yap;/home/vsc/github/yap-6.3/pl/corout.yap;/home/vsc/github/yap-6.3/pl/dbload.yap;/home/vsc/github/yap-6.3/pl/debug.yap;/home/vsc/github/yap-6.3/pl/depth_bound.yap;/home/vsc/github/yap-6.3/pl/dialect.yap;/home/vsc/github/yap-6.3/pl/directives.yap;/home/vsc/github/yap-6.3/pl/eam.yap;/home/vsc/github/yap-6.3/pl/error.yap;/home/vsc/github/yap-6.3/pl/errors.yap;/home/vsc/github/yap-6.3/pl/eval.yap;/home/vsc/github/yap-6.3/pl/flags.yap;/home/vsc/github/yap-6.3/pl/grammar.yap;/home/vsc/github/yap-6.3/pl/ground.yap;/home/vsc/github/yap-6.3/pl/hacks.yap;/home/vsc/github/yap-6.3/pl/init.yap;/home/vsc/github/yap-6.3/pl/listing.yap;/home/vsc/github/yap-6.3/pl/load_foreign.yap;/home/vsc/github/yap-6.3/pl/messages.yap;/home/vsc/github/yap-6.3/pl/meta.yap;/home/vsc/github/yap-6.3/pl/modules.yap;/home/vsc/github/yap-6.3/pl/newmod.yap;/home/vsc/github/yap-6.3/pl/os.yap;/home/vsc/github/yap-6.3/pl/pathconf.yap;/home/vsc/github/yap-6.3/pl/preddecls.yap;/home/vsc/github/yap-6.3/pl/preddyns.yap;/home/vsc/github/yap-6.3/pl/preds.yap;/home/vsc/github/yap-6.3/pl/profile.yap;/home/vsc/github/yap-6.3/pl/protect.yap;/home/vsc/github/yap-6.3/pl/qly.yap;/home/vsc/github/yap-6.3/pl/save.yap;/home/vsc/github/yap-6.3/pl/setof.yap;/home/vsc/github/yap-6.3/pl/signals.yap;/home/vsc/github/yap-6.3/pl/sort.yap;/home/vsc/github/yap-6.3/pl/spy.yap;/home/vsc/github/yap-6.3/pl/statistics.yap;/home/vsc/github/yap-6.3/pl/strict_iso.yap;/home/vsc/github/yap-6.3/pl/swi.yap;/home/vsc/github/yap-6.3/pl/tabling.yap;/home/vsc/github/yap-6.3/pl/threads.yap;/home/vsc/github/yap-6.3/pl/udi.yap;/home/vsc/github/yap-6.3/pl/undefined.yap;/home/vsc/github/yap-6.3/pl/utils.yap;/home/vsc/github/yap-6.3/pl/yapor.yap;/home/vsc/github/yap-6.3/pl/yio.yap'.split(";") :
copy2(i, 'yap4py/prolog/pl')
my_libs0 = '/home/vsc/github/yap-6.3/packages/python/*YAPPython*.so;/home/vsc/github/yap-6.3/packages/python/*Py4YAP*.so;/home/vsc/github/yap-6.3/*libYap*.so;/home/vsc/github/yap-6.3/packages/myddas/sqlite3/*Yapsqlite3*.so;/home/vsc/github/yap-6.3/packages/myddas/mysql/*Yapmysql*.so;/home/vsc/github/yap-6.3/packages/myddas/odbc/*Yapodbc*.so;/home/vsc/github/yap-6.3/CXX/*YAP++*.so;/home/vsc/github/yap-6.3/library/matrix/*matrix*.so;/home/vsc/github/yap-6.3/library/random/*yap_random*.so;/home/vsc/github/yap-6.3/library/regex/*regexp*.so;/home/vsc/github/yap-6.3/library/rltree/*yap_rl*.so;/home/vsc/github/yap-6.3/library/system/*sys*.so;/home/vsc/github/yap-6.3/library/tries/*tries*.so;/home/vsc/github/yap-6.3/library/tries/*itries*.so;/home/vsc/github/yap-6.3/packages/raptor/*libxml2*.so;/home/vsc/github/yap-6.3/packages/raptor/*raptor*.so;/home/vsc/github/yap-6.3/packages/CLPBN/horus/*horus*.so;/home/vsc/github/yap-6.3/packages/gecode/*gecode_yap*.so;/home/vsc/github/yap-6.3/packages/real/*real*.so;/home/vsc/github/yap-6.3/packages/jpl/src/c/*jplYap*.so;/home/vsc/github/yap-6.3/packages/swi-minisat2/C/*minisat2*.so;/home/vsc/github/yap-6.3/library/lammpi/*yap_mpi*.so'.split(";")+['/home/vsc/github/yap-6.3/startup.yss']
my_libs = []
for i in my_libs0:
my_libs = glob(i) + my_libs
for i in my_libs:
copy2(i, 'yap4py')
bpy2yap = []
here = path.abspath(path.dirname(__file__))
#gmp_dir = path.abspath(path.dirname("/usr/lib/x86_64-linux-gnu/libgmp.so"))
#python_libdir = path.abspath(path.dirname("/usr/lib/x86_64-linux-gnu/libpython2.7.so")
# Get the long description from the README file
extensions=[Extension('_yap', python_sources,
define_macros = [('MAJOR_VERSION', '1'),
extensions = [Extension('_yap', native_sources,
define_macros=[('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0'),
('_YAP_NOT_INSTALLED_', '1'),
('YAP_PYTHON', '1')],
runtime_library_dirs=['yap4py','/usr/local/lib','/usr/local/bin'],
swig_opts=['-modern', '-c++', '-py3','-I../../..//CXX'],
library_dirs=['../../..','../../../CXX','../../packages/python',"/usr/local/lib/Yap","/usr/local/bin", '.'],
('YAP_PYTHON', '1'),
('_GNU_SOURCE', '1')],
runtime_library_dirs=['yap4py', '/usr/local/lib', '/usr/local/bin', '', ''],
swig_opts=['-modern', '-c++', '-py3',
'-DX_API', '-I/home/vsc/github/yap-6.3/CXX', '-I/home/vsc/github/yap-6.3/include',
'-I/home/vsc/github/yap-6.3/H', '-I/home/vsc/github/yap-6.3/H/generated',
'-I/home/vsc/github/yap-6.3/os', '-I/home/vsc/github/yap-6.3/OPTYap',
'-I/home/vsc/github/yap-6.3/packages/python'],
library_dirs=['../../..', '../../../CXX', '..', "/usr/local/bin"],
extra_link_args=my_extra_link_args,
extra_compile_args=['-g'],
libraries=['Yap','/usr/local/lib/libgmp.dylib'],
libraries=['Yap','gmp']+win_libs+local_libs,
include_dirs=['../../..',
'/usr/local/include',
'../../../H',
'../../../H/generated',
'../../../OPTYap',
'../../../os',
'../../../include',
'../../../CXX', '.']
)]
'/usr/include/x86_64-linux-gnu',
'/home/vsc/github/yap-6.3/H',
'/home/vsc/github/yap-6.3/H/generated',
'/home/vsc/github/yap-6.3/OPTYap',
'/home/vsc/github/yap-6.3/os',
'/home/vsc/github/yap-6.3/packages/python',
'/home/vsc/github/yap-6.3/include',
'/home/vsc/github/yap-6.3/CXX', '.']
)]#
setup(
name='YAP4Py',
version='6.3.5',
description='The YAP Prolog compiler as a Python Library',
url='https://github.com/vscosta/yap-6.3',
author='Vitor Santos Costa',
author_email='vsc@dcc.fc.up.pt',
license='Artistic',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: Artistic License',
'Programming Language :: Python :: 3',
packages = packages = setuptools.find_packages('/home/vsc/github/yap-6.3/packages/python/swig')
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'],
keywords=['Logic Programing'],
#spackage_data={'': ['yap']},
package_data = {
'yap4py/prolog': 'prolog/*.*',
'': '*.*'
}
version_ns = {'__version__': '6.3.5', 'minor-version': '6', 'minor-version': '3', 'patch': '5'}
setup_args = dict(
name=name,
version=version_ns['__version__'],
scripts=glob(pjoin('scripts', '*')),
packages=packages,
py_modules=['yap','yap4py'],
package_data=package_data,
include_package_data=True,
ext_modules = extensions,
py_modules = ['yap'],
zip_safe=False,
eager_resources = ['yap4py'],
packages=['yap4py'] # find_packages()
#package_dir = {'':'yap4py'}
requirements=[
'm2w64-gmp',
'm2-msys2-keyring',
'm2-msys2-launcher-git',
'm2-msys2-runtime',
],
description="YAP in Python",
author='YAP Development Team',
author_email='ipython-dev@scipy.org',
url='http://ipython.org',
license='BSD',
ext_modules=extensions,
platforms="Linux, Mac OS X, Windows",
keywords=['Interactive', 'Interpreter', 'Shell', 'Web'],
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
)
if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
import setuptools
setuptools_args = {}
install_requires = setuptools_args['install_requires'] = [
]
extras_require = setuptools_args['extras_require'] = {
'test:python_version=="2.7"': ['mock'],
'test': ['nose_warnings_filters', 'nose-timer'],
}
if 'setuptools' in sys.modules:
setup_args.update(setuptools_args)
if __name__ == '__main__':
setup(**setup_args)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -412,7 +412,7 @@ be lost.
'$undefined'(G, M), !,
'$get_undefined_pred'(G, M, Goal, NM), NM \= M,
'$spycall'(Goal, NM, CP, expanded).
'$spycall'(G, M, CP, _) :-
'$spycall'(G, M, _CP, _) :-
/* get goal no. */
'__NB_getval__'('$spy_gn',L,fail),
/* bump it */