:Merge /home/vsc/yap
This commit is contained in:
commit
244d04f90b
53
C/terms.c
53
C/terms.c
@ -164,6 +164,9 @@ var_in_term_nvar : { \
|
||||
/* store the terms to visit */ \
|
||||
ptd0 = RepAppl(d0); \
|
||||
f = (Functor)(d0 = *ptd0); \
|
||||
if (IsExtensionFunctor(f)) {\
|
||||
continue;\
|
||||
}\
|
||||
\
|
||||
if (to_visit + 32 >= to_visit_max) { \
|
||||
goto aux_overflow; \
|
||||
@ -363,15 +366,15 @@ static int cycles_in_complex_term(register CELL *pt0,
|
||||
/* store the terms to visit */
|
||||
ptd0 = RepAppl(d0);
|
||||
f = (Functor)(d0 = *ptd0);
|
||||
if (IsExtensionFunctor(f)) {
|
||||
*ptf++ = d0;
|
||||
continue;
|
||||
}
|
||||
if (IS_VISIT_MARKER) {
|
||||
rc++;
|
||||
*ptf++ = BREAK_LOOP(to_visit - to_visit0);
|
||||
continue;
|
||||
}
|
||||
if (IsExtensionFunctor(f)) {
|
||||
*ptf++ = d0;
|
||||
continue;
|
||||
}
|
||||
if (to_visit + 32 >= to_visit_max) {
|
||||
goto aux_overflow;
|
||||
}
|
||||
@ -1382,30 +1385,31 @@ static Int create_entry(Term t, Int i, Int j, cl_connector * q, Int max) {
|
||||
Term ref, h, *s, *ostart;
|
||||
ssize_t n;
|
||||
// first time, create a new term
|
||||
if (i==0)
|
||||
return 0;
|
||||
if (IsVarTerm(t)) {
|
||||
return -1;
|
||||
}
|
||||
if (IsPairTerm(t)) {
|
||||
Int me;
|
||||
s = RepPair(t);
|
||||
h = s[0];
|
||||
if (IsAtomTerm(h)) {
|
||||
return t_ref((cl_connector*)AtomOfTerm(h),q,max);
|
||||
if (IsAtomTerm(h) &&
|
||||
(me = t_ref((cl_connector*)AtomOfTerm(h),q,max)) >= 0 ) {
|
||||
return me;
|
||||
}
|
||||
n = 2;
|
||||
ostart = HR;
|
||||
ref = AbsPair(ostart);
|
||||
HR += 2;
|
||||
q[max].header = Deref(s[0]);
|
||||
} else if (IsApplTerm(t)) {
|
||||
Int me;
|
||||
h = (CELL)FunctorOfTerm(t);
|
||||
n = ArityOfFunctor((Functor)h);
|
||||
if (IsExtensionFunctor((Functor)h)) {
|
||||
return -1;
|
||||
}
|
||||
if (IsAtomTerm(h)) {
|
||||
return t_ref((cl_connector*)AtomOfTerm(h),q,max);
|
||||
n = ArityOfFunctor((Functor)h);
|
||||
if (IsAtomTerm(h) &&
|
||||
(me = t_ref((cl_connector*)AtomOfTerm(h),q,max)) >= 0) {
|
||||
return me;
|
||||
}
|
||||
s = RepAppl(t);
|
||||
q[max].header = s[0];
|
||||
@ -1413,13 +1417,16 @@ static Int create_entry(Term t, Int i, Int j, cl_connector * q, Int max) {
|
||||
ref = AbsAppl(ostart);
|
||||
*ostart++ = s[0];
|
||||
HR=ostart+n;
|
||||
} else if (IsAtomTerm(t) &&
|
||||
(max = t_ref((cl_connector*)AtomOfTerm(t),q,max)) >= 0) {
|
||||
return max;
|
||||
} else {
|
||||
Int me;
|
||||
if (IsAtomTerm(t) &&
|
||||
(me = t_ref((cl_connector*)AtomOfTerm(t),q,max)) >= 0 ) {
|
||||
return me;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
q[max].header = h;
|
||||
q[max].parent = q[i].copy+j;
|
||||
q[max].source = t;
|
||||
q[max].copy = ostart;
|
||||
@ -1440,17 +1447,19 @@ Int cp_link(Term t, Int i, Int j, cl_connector * q, Int max, CELL * tailp) {
|
||||
if (IsVarTerm(ref)) {
|
||||
q[i].copy[j] = ref;
|
||||
} else if (i == 0){
|
||||
|
||||
Term p = TermNil;
|
||||
Term v = UNFOLD_LOOP(ref,&p);
|
||||
q[i].reference = HeadOfTerm(p);
|
||||
q[i].copy[j] = v;
|
||||
|
||||
} else if (tailp && q[me].parent) {
|
||||
}
|
||||
else if (tailp && q[me].parent) {
|
||||
Term v = UNFOLD_LOOP(ref, tailp);
|
||||
q[i].copy[j] = v;
|
||||
q[me].parent[0] = v;
|
||||
q[i].reference = v;
|
||||
fprintf(stderr,"C i=%ld me=%ld %lx\n", i, me, q[i].copy[j]); }
|
||||
|
||||
}
|
||||
return max;
|
||||
}
|
||||
q[i].copy[j] = t;
|
||||
@ -1482,12 +1491,9 @@ Term Yap_BreakCycles(Term inp, UInt arity, Term * listp USES_REGS) {
|
||||
n = 2;
|
||||
// fetch using header field.
|
||||
qlen = cp_link(q[i].header, i, 0, q, qlen, listp);
|
||||
fprintf(stderr,"C q[0].reference\n", q[0].reference);
|
||||
fprintf(stderr,"C i=%ld,%ld--%ld %lx\n", i, 0, q[i].copy[j]); }
|
||||
// fetch using standard access
|
||||
qlen = cp_link(s[1], i, 1, q, qlen, listp);
|
||||
fprintf(stderr,"C i=%ld,%ld--%ld %lx\n", i, j, q[i].copy[j]);
|
||||
} 1else {
|
||||
} else {
|
||||
s = RepAppl(q[i].source) + 1;
|
||||
n = ArityOfFunctor((Functor)q[i].header);
|
||||
for (j = 0; j < n; j++) {
|
||||
@ -1501,7 +1507,6 @@ Term Yap_BreakCycles(Term inp, UInt arity, Term * listp USES_REGS) {
|
||||
for (i=0; i< qlen; i++) {
|
||||
CELL *p = IsPairTerm(q[i].source) ? RepPair(q[i].source) : RepAppl(q[i].source);
|
||||
p[0] = q[i].header;
|
||||
|
||||
}
|
||||
|
||||
pop_text_stack(lvl);
|
||||
|
@ -89,14 +89,12 @@ set(
|
||||
ex/learning/train.yap
|
||||
)
|
||||
|
||||
IF (WITH_HORUS)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
add_subDIRECTORY (horus)
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
install(FILES
|
||||
${CLPBN_TOP}
|
||||
|
@ -68,7 +68,7 @@ if (CMAKE_MAJOR_VERSION GREATER 2)
|
||||
|
||||
|
||||
install(TARGETS horus HorusCli
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
RUNTIME DESTINATION ${YAP_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${YAP_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${YAP_INSTALL_LIBDIR}
|
||||
)
|
||||
|
@ -85,7 +85,7 @@ native_sources = ["yap4py/yap_wrap.cxx","yap4py/yapi.cpp"]
|
||||
|
||||
extensions = [Extension('_yap', native_sources,
|
||||
define_macros=[('MAJOR_VERSION', '6'),
|
||||
('MINOR_VERSION', '4'),
|
||||
('MINOR_VERSION', '5'),
|
||||
('_YAP_NOT_INSTALLED_', '1'),
|
||||
('YAP_PYTHON', '1'),
|
||||
('PYTHONSWIG', '1'),
|
||||
@ -115,7 +115,7 @@ package_data = {
|
||||
|
||||
data_files=[]
|
||||
|
||||
version_ns = {'__version__': '6.4.1', 'major-version': '6', 'minor-version': '4', 'patch': '1'}
|
||||
version_ns = {'__version__': '6.5.0', 'major-version': '6', 'minor-version': '5', 'patch': '0'}
|
||||
|
||||
setup_args = dict(
|
||||
name=name,
|
||||
|
@ -72,6 +72,7 @@ d(X, ( X= f(A,A,X)) ).
|
||||
d(X, ( X= f(A,A,g(A))) ).
|
||||
d(X, ( X= f(A,g(X,[A|A]),X)) ).
|
||||
d(X, ( X= f(X,[X,X])) ).
|
||||
d(X, ( X= f(3.14,[22.3,X])) ).
|
||||
d(X, ( X= f(X,[X,g(X)])) ).
|
||||
d(X, ( X= f(_,X/[X])) ).
|
||||
d(X, ( X= f(_,A/[A]), A= f(X,[X,g(X)])) ).
|
||||
|
Reference in New Issue
Block a user