Merge branch 'master' of ssh://git.code.sf.net/p/yap/yap-6.3

Conflicts:
	pl/boot.yap
	pl/control.yap
	pl/debug.yap
This commit is contained in:
Vitor Santos Costa 2013-11-04 11:03:27 +00:00
commit f397cbe0b6
144 changed files with 5555 additions and 4342 deletions

View File

@ -7975,11 +7975,6 @@ Yap_absmi(int inp)
JMPNext();
}
}
if (!LOCAL_DebugOn) {
PREG = pe->cs.p_code.TrueCodeOfPred;
UNLOCKPE(24,pe);
JMPNext();
}
UNLOCKPE(25,pe);
d0 = pe->ArityOfPE;
@ -12641,23 +12636,23 @@ Yap_absmi(int inp)
ENDD(d0);
ENDOp();
Op(p_func2s_y_cv, yxn);
Op(p_func2s_y_cv, yxc);
/* A1 is a variable */
restart_func2s_y_cv:
#ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) {
RESET_VARIABLE(H);
H[1] = PREG->u.yxn.c;
H[2] = XREG(PREG->u.yxn.xi);
H[1] = PREG->u.yxc.c;
H[2] = XREG(PREG->u.yxc.xi);
low_level_trace(enter_pred,RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor,0)),H);
}
#endif /* LOW_LEVEL_TRACE */
/* We have to build the structure */
BEGD(d0);
d0 = PREG->u.yxn.c;
d0 = PREG->u.yxc.c;
/* we do, let's get the third argument */
BEGD(d1);
d1 = XREG(PREG->u.yxn.xi);
d1 = XREG(PREG->u.yxc.xi);
deref_head(d1, func2s_y_unk_cv);
func2s_y_nvar_cv:
/* Uuuff, the second and third argument are bound */
@ -12683,8 +12678,8 @@ Yap_absmi(int inp)
/* else if arity is 0 just pass d0 through */
/* Ding, ding, we made it */
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
pt1 = YREG + PREG->u.yxc.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxc),Osbpp),l);
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
@ -12709,7 +12704,7 @@ Yap_absmi(int inp)
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) {
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxn),Osbpp))) {
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxc),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
@ -12728,15 +12723,15 @@ Yap_absmi(int inp)
/* else if arity is 0 just pass d0 through */
/* Ding, ding, we made it */
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
pt1 = YREG + PREG->u.yxc.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxc),Osbpp),l);
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
} else if (d1 == 0) {
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
pt1 = YREG + PREG->u.yxc.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxc),Osbpp),l);
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();

View File

@ -1459,7 +1459,7 @@ p_atom_split( USES_REGS1 )
Yap_Error(TYPE_ERROR_INTEGER, t2, "$atom_split/4");
return(FALSE);
}
if ((len = IntOfTerm(t2)) < 0) {
if ((Int)(len = IntOfTerm(t2)) < 0) {
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2, "$atom_split/4");
return(FALSE);
}
@ -2025,7 +2025,7 @@ check_sub_atom_bef(int max, Atom at, Atom nat)
} else {
size_t len = strlen(RepAtom(nat)->StrOfAE);
int min = max- len;
if (min - len < 0) return FALSE;
if ((Int)(min - len) < 0) return FALSE;
if (IsWideAtom(at)) {
wchar_t *p1;
char *p2;
@ -2269,7 +2269,7 @@ init_sub_atom( USES_REGS1 )
if ((mask & (SUB_ATOM_HAS_MIN|SUB_ATOM_HAS_SIZE)) ==
(SUB_ATOM_HAS_MIN|SUB_ATOM_HAS_SIZE)) {
if (min+len > sz) cut_fail();
if ((after = (sz-(min+len))) < 0) cut_fail();
if ((Int)(after = (sz-(min+len))) < 0) cut_fail();
nat = build_new_atom(mask, wp, p, min, len PASS_REGS);
if (!nat) cut_fail();
out = Yap_unify(ARG4,MkIntegerTerm(after)) &&

View File

@ -2246,6 +2246,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
if ((pflags & (UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) ||
(p->ModuleOfPred == PROLOG_MODULE &&
mod != TermProlog && mod) ) {
/* printf("p=%p p->PredFlags=%lx p->cs.p_code.NOfClauses=%ld\n", p, p->PredFlags, p->cs.p_code.NOfClauses) */
addcl_permission_error(RepAtom(at), Arity, FALSE);
UNLOCKPE(30,p);
return TermNil;

View File

@ -102,6 +102,8 @@ typedef greg_t context_reg;
#else
#define CONTEXT_PC(scv) NULL
#define CONTEXT_BP(scv) NULL
#ifdef LOW_PROF
#undef LOW_PROF
#endif

View File

@ -919,7 +919,6 @@ InitFlags(void)
yap_flags[WRITE_QUOTED_STRING_FLAG] = FALSE;
/* we do not garantee safe assert in parallel mode */
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = TRUE;
yap_flags[GENERATE_DEBUG_INFO_FLAG] = TRUE;
/* current default */
yap_flags[INDEXING_MODE_FLAG] = INDEX_MODE_MULTI;
yap_flags[TABLING_MODE_FLAG] = 0;

View File

@ -334,11 +334,7 @@ syntax_error (TokEntry * tokptr, IOSTREAM *st, Term *outp)
{
char s[2];
s[1] = '\0';
if (Ord (info) == 'l') {
s[0] = '(';
} else {
s[0] = (char)info;
}
s[0] = (char)info;
ts[0] = MkAtomTerm(Yap_LookupAtom(s));
}
}
@ -561,7 +557,6 @@ static Int
Term tcomms = Deref(ARG7);
int store_comments = IsVarTerm(tcomms);
Yap_setCurrentSourceLocation(&inp_stream);
if (IsVarTerm(tmod)) {
tmod = CurrentModule;
} else if (!IsAtomTerm(tmod)) {

View File

@ -854,6 +854,7 @@ Yap_tokenizer(IOSTREAM *inp_stream, int store_comments, Term *tposp)
ch = getchr(inp_stream);
}
*tposp = Yap_StreamPosition(inp_stream);
Yap_setCurrentSourceLocation(&inp_stream);
LOCAL_StartLine = inp_stream->posbuf.lineno;
do {
wchar_t och;
@ -917,6 +918,7 @@ Yap_tokenizer(IOSTREAM *inp_stream, int store_comments, Term *tposp)
}
CHECK_SPACE();
*tposp = Yap_StreamPosition(inp_stream);
Yap_setCurrentSourceLocation(&inp_stream);
}
goto restart;
} else {
@ -1235,6 +1237,7 @@ Yap_tokenizer(IOSTREAM *inp_stream, int store_comments, Term *tposp)
}
CHECK_SPACE();
*tposp = Yap_StreamPosition(inp_stream);
Yap_setCurrentSourceLocation(&inp_stream);
}
}
goto restart;

View File

@ -116,24 +116,6 @@ p_creep_allowed( USES_REGS1 )
return FALSE;
}
static Int
p_debug_on( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsVarTerm(t)) {
if (LOCAL_DebugOn)
return Yap_unify(MkAtomTerm(AtomTrue),ARG1);
else
return Yap_unify(MkAtomTerm(AtomFalse),ARG1);
}
if (t == MkAtomTerm(AtomTrue))
LOCAL_DebugOn = TRUE;
else
LOCAL_DebugOn = FALSE;
return TRUE;
}
void
Yap_signal(yap_signals sig)
{
@ -370,7 +352,6 @@ Yap_InitSignalCPreds(void)
Yap_InitCPred("$stop_creeping", 0, p_stop_creeping, SafePredFlag);
Yap_InitCPred ("$first_signal", 1, p_first_signal, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("$continue_signals", 0, p_continue_signals, SafePredFlag|SyncPredFlag);
Yap_InitCPred("$debug_on", 1, p_debug_on, 0);
Yap_InitCPred("$creep_allowed", 0, p_creep_allowed, 0);
#ifdef DEBUG
Yap_InitCPred("$debug", 1, p_debug, SafePredFlag|SyncPredFlag);

View File

@ -1706,11 +1706,6 @@ p_set_yap_flags( USES_REGS1 )
return(FALSE);
yap_flags[STACK_DUMP_ON_ERROR_FLAG] = value;
break;
case GENERATE_DEBUG_INFO_FLAG:
if (value != 0 && value != 1)
return(FALSE);
yap_flags[GENERATE_DEBUG_INFO_FLAG] = value;
break;
case INDEXING_MODE_FLAG:
if (value < INDEX_MODE_OFF || value > INDEX_MODE_MAX)
return(FALSE);

View File

@ -359,7 +359,6 @@ typedef enum
HALT_AFTER_CONSULT_FLAG = 15,
FAST_BOOT_FLAG = 16,
STACK_DUMP_ON_ERROR_FLAG = 17,
GENERATE_DEBUG_INFO_FLAG = 18,
INDEXING_MODE_FLAG = 19,
TABLING_MODE_FLAG = 20,
VARS_CAN_HAVE_QUOTE_FLAG = 21,

View File

@ -322,7 +322,7 @@
OPCODE(p_func2s_cv ,xxc),
OPCODE(p_func2s_vc ,xxn),
OPCODE(p_func2s_y_vv ,yxx),
OPCODE(p_func2s_y_cv ,yxn),
OPCODE(p_func2s_y_cv ,yxc),
OPCODE(p_func2s_y_vc ,yxn),
OPCODE(p_func2f_xx ,xxx),
OPCODE(p_func2f_xy ,xxy),

View File

@ -126,6 +126,7 @@ Int YAP_Execute(struct pred_entry *, CPredicate);
Int YAP_ExecuteFirst(struct pred_entry *, CPredicate);
Int YAP_ExecuteNext(struct pred_entry *, CPredicate);
Int YAP_ExecuteOnCut(struct pred_entry *, CPredicate, struct cut_c_str *);
Int YAP_RunGoalOnce(Term);
/* cdmgr.c */
Term Yap_all_calls(void);

View File

@ -254,6 +254,7 @@ typedef enum {
The meaning and type of the symbols in a abstract machine instruction is:
A: Atom
b: arity (Int)
b: bitmap (CELL *)
c: constant, is a Term
@ -864,6 +865,12 @@ typedef struct yami {
Int c;
CELL next;
} yxn;
struct {
yslot y;
wamreg xi;
Term c;
CELL next;
} yxc;
} u;
} yamop;

View File

@ -209,7 +209,11 @@ typedef struct PSEUDO {
CELL rnd1;
union {
Int oprnd2;
#if MIN_ARRAY == 0
CELL opseqt[MIN_ARRAY];
#else
CELL opseqt[1];
#endif
} ops;
} PInstr;

View File

@ -1317,6 +1317,13 @@
}
cl = NEXTOP(cl,yx);
break;
case _p_func2s_y_cv:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.yxc.y))) {
clause->Tag = (CELL)NULL;
return;
}
cl = NEXTOP(cl,yxc);
break;
case _p_and_y_vc:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.yxn.y))) {
clause->Tag = (CELL)NULL;
@ -1345,13 +1352,6 @@
}
cl = NEXTOP(cl,yxn);
break;
case _p_func2s_y_cv:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.yxn.y))) {
clause->Tag = (CELL)NULL;
return;
}
cl = NEXTOP(cl,yxn);
break;
case _p_func2s_y_vc:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.yxn.y))) {
clause->Tag = (CELL)NULL;

View File

@ -750,12 +750,18 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
pc->u.yx.x = XAdjust(pc->u.yx.x);
pc = NEXTOP(pc,yx);
break;
/* instructions type yxc */
case _p_func2s_y_cv:
pc->u.yxc.y = YAdjust(pc->u.yxc.y);
pc->u.yxc.xi = XAdjust(pc->u.yxc.xi);
pc->u.yxc.c = ConstantTermAdjust(pc->u.yxc.c);
pc = NEXTOP(pc,yxc);
break;
/* instructions type yxn */
case _p_and_y_vc:
case _p_arg_y_cv:
case _p_div_y_cv:
case _p_div_y_vc:
case _p_func2s_y_cv:
case _p_func2s_y_vc:
case _p_minus_y_cv:
case _p_or_y_vc:

View File

@ -766,12 +766,18 @@
CHECK(save_X(stream, pc->u.yx.x));
pc = NEXTOP(pc,yx);
break;
/* instructions type yxc */
case _p_func2s_y_cv:
CHECK(save_Y(stream, pc->u.yxc.y));
CHECK(save_X(stream, pc->u.yxc.xi));
CHECK(save_ConstantTerm(stream, pc->u.yxc.c));
pc = NEXTOP(pc,yxc);
break;
/* instructions type yxn */
case _p_and_y_vc:
case _p_arg_y_cv:
case _p_div_y_cv:
case _p_div_y_vc:
case _p_func2s_y_cv:
case _p_func2s_y_vc:
case _p_minus_y_cv:
case _p_or_y_vc:

View File

@ -565,12 +565,15 @@
case _put_y_var:
pc = NEXTOP(pc,yx);
break;
/* instructions type yxc */
case _p_func2s_y_cv:
pc = NEXTOP(pc,yxc);
break;
/* instructions type yxn */
case _p_and_y_vc:
case _p_arg_y_cv:
case _p_div_y_cv:
case _p_div_y_vc:
case _p_func2s_y_cv:
case _p_func2s_y_vc:
case _p_minus_y_cv:
case _p_or_y_vc:

View File

@ -697,7 +697,7 @@ mycb: $(srcdir)/mycb.c
$(CC) $(CFLAGS) $(srcdir)/mycb.c -o mycb
all: startup.yss
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE))
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd packages/gecode; $(MAKE))
@INSTALL_MPI@ (cd library/lammpi; $(MAKE))
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE))
@INSTALL_DLLS@ (cd library/matrix; $(MAKE))
@ -782,7 +782,7 @@ install_unix: startup.yss libYap.a
@INSTALL_DLLS@ (cd packages/yap-lbfgs; $(MAKE) install)
@INSTALL_DLLS@ (cd library/system; $(MAKE) install)
@INSTALL_DLLS@ (cd library/tries; $(MAKE) install)
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) install)
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd packages/gecode; $(MAKE) install)
@ENABLE_CLIB@ @INSTALL_DLLS@ (cd packages/clib; $(MAKE) install)
@ENABLE_HTTP@ @INSTALL_DLLS@ (cd packages/http; $(MAKE) install)
@ENABLE_HTTP@ @INSTALL_DLLS@ (cd packages/http; $(MAKE) install-examples)
@ -795,7 +795,7 @@ install_unix: startup.yss libYap.a
@ENABLE_RDF@ @INSTALL_DLLS@ (cd packages/RDF; $(MAKE) install)
@ENABLE_SEMWEB@ @INSTALL_DLLS@ (cd packages/semweb; $(MAKE) install)
@ENABLE_SGML@ @INSTALL_DLLS@ (cd packages/sgml; $(MAKE) install)
@ENABLE_ZLIB@ @INSTALL_DLLS@ (cd packages/zlib; $(MAKE) @ZLIB_INSTALL@)
@ENABLE_ZLIB@ @INSTALL_DLLS@ (cd packages/zlib; $(MAKE) install)
@ENABLE_LIBARCHIVE@ @INSTALL_DLLS@ (cd packages/archive; $(MAKE) install)
@ENABLE_ODBC@ @INSTALL_DLLS@ (cd packages/odbc; $(MAKE) install)
@ENABLE_CLPBN_BP@ @INSTALL_DLLS@ (cd packages/CLPBN/horus; $(MAKE) install)
@ -916,7 +916,7 @@ depend: $(HEADERS) $(C_SOURCES)
clean: clean_docs
rm -f *.o *~ *.BAK *.a
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) clean)
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd packages/gecode; $(MAKE) clean)
@INSTALL_MPI@ (cd library/lammpi; $(MAKE) clean)
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean)

View File

@ -122,6 +122,8 @@
#undef HAVE_WINSOCK2_H
#undef HAVE_LIBLOADERAPI_H
#undef UUID_H
#if __MINGW32__
#define __WINDOWS__ 1
#endif

7072
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,8 @@ AC_CANONICAL_SYSTEM
AC_DEFINE_UNQUOTED(HOST_ALIAS,"${target}")
m4_define([HAS_TOP])
case "$target_cpu" in
i*86*)
YAP_TARGET=i386
@ -78,64 +80,6 @@ case "$target_cpu" in
;;
esac
dnl Gecode support
AC_CHECK_HEADER(gecode/support/config.hpp,
have_gecode=yes, have_gecode=no)
AC_ARG_ENABLE(gecode,
[ --enable-gecode install gecode library],
[use_gecode="$enableval"
if test "$use_gecode" = yes; then
if test "$have_gecode" = no; then
AC_MSG_ERROR([cannot enable gecode: gecode library not found])
fi
fi], use_gecode=$have_gecode)
AC_MSG_CHECKING([if dynamic arrays are supported])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[void foo(int n) { int a[n]; a[1]=0; }]],[[foo(3);]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DYNARRAY],[1],[Define if dynamic arrays are supported])
],[
AC_MSG_RESULT([no])
])
GECODE_VERSION=unknown-gecode-version
GECODE_EXTRALIBS="-lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch"
AC_SUBST(GECODE_VERSION)
AC_SUBST(GECODE_EXTRALIBS)
if test "$use_gecode" = yes; then
AC_MSG_CHECKING([gecode version])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include "gecode/support/config.hpp"
#include <stdio.h>
]],[[
FILE* out = fopen("conftest.out","w");
fprintf(out,"%s\n",GECODE_VERSION);
fclose(out);
return 0;
]])],[GECODE_VERSION=$(cat conftest.out)
AC_MSG_RESULT([$GECODE_VERSION])],
[AC_MSG_ERROR([cannot determine gecode version])])
case "$target_os" in
*darwin*)
AC_MSG_CHECKING([if -framework gecode is required])
AC_LANG_PUSH([C++])
saved_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -framework gecode"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "gecode/int.hh"
]],[[
Gecode::Exception e("","");
return 0;
]])],[GECODE_EXTRALIBS="-framework gecode"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_LANG_POP()
CXXFLAGS="$saved_CXXFLAGS"
;;
esac
fi
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
AC_SUBST(GECODE_MAJOR)
AC_ARG_ENABLE(tabling,
[ --enable-tabling support tabling ],
@ -234,7 +178,7 @@ AC_ARG_WITH(gmp,
LDFLAGS="$LDFLAGS -L${yap_cv_gmp}/lib"
LIBS="$LIBS -L${yap_cv_gmp}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_gmp}/include"
CFLAGS="$CFLAGS -I${yap_cv_gmp}/include"
CFLAGS="$CFLAGS -I${yap_cv_gmp}/include"
fi,
[yap_cv_gmp=yes])
AC_ARG_WITH(R,
@ -247,16 +191,6 @@ AC_ARG_WITH(R,
yap_cv_R=$withval
fi,
[yap_cv_R=no])
AC_ARG_WITH(python,
[ --with-python[=DIR] interface to R language],
if test "$withval" = yes; then
yap_cv_python=yes
elif test "$withval" = no; then
yap_cv_python=no
else
yap_cv_python=$withval
fi,
[yap_cv_python=no])
AC_ARG_WITH(judy,
[ --with-judy[=DIR] UDI needs judy library],
@ -280,53 +214,6 @@ AC_ARG_WITH(minisat,
fi,
[yap_cv_minisat=yes])
AC_ARG_WITH(cuda,
[ --enable-cuda use minisat interface],
if test "$withval" = yes; then
yap_cv_cuda=/usr
elif test "$withval" = no; then
yap_cv_cuda=no
else
yap_cv_cuda="$withval"
fi,
[yap_cv_cuda=no])
AC_ARG_WITH(cudd,
[ --with-cudd[=DIR] use CUDD package in DIR],
yap_cv_cudd="$withval",
[yap_cv_cudd=no])
AC_ARG_ENABLE(myddas,
[ --enable-myddas[[=DIR]] enable the MYDDAS library],
if test "$enableval" = yes; then
yap_cv_myddas=/usr
elif test "$enableval" = no; then
yap_cv_myddas=no
else
yap_cv_myddas=$enable_myddas
LDFLAGS="$LDFLAGS -L${yap_cv_myddas}/lib "
CPPFLAGS="$CPPFLAGS -I${yap_cv_myddas}/include "
ODBC_LDFLAGS="-L${yap_cv_myddas}/lib "
ODBC_CFLAGS="-I${yap_cv_myddas}/include "
fi,
[yap_cv_myddas=/usr])
AC_ARG_ENABLE(myddas-stats,
[ --enable-myddas-stats enable the MYDDAS library statistics support],
if test "$yap_cv_myddas" = no; then
myddasstats=no
else
myddasstats="$enableval"
fi, myddasstats=no)
AC_ARG_ENABLE(myddas-top-level,
[ --enable-myddas-top-level enable the MYDDAS top-level support to MySQL],
if test "$yap_cv_myddas" = no; then
myddastoplevel=no
else
myddastoplevel="$enableval"
fi, myddastoplevel=no)
AC_ARG_WITH(java,
[ --with-java=JAVA_HOME use Java instalation in JAVA_HOME],
if test "$withval" = yes; then
@ -542,22 +429,6 @@ fi
if test "$yap_cv_cudd" = no
then
ENABLE_CUDD="@# "
ENABLE_BDDLIB="@# "
else
if test "$dynamic_bdd" = yes
then
ENABLE_BDDLIB=""
else
ENABLE_BDDLIB="@# "
fi
ENABLE_CUDD=""
fi
dnl condor universe does not like dynamic linking on Linux, DEC, and HP-UX platforms.
if test "$use_condor" = yes
then
@ -715,13 +586,11 @@ then
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll $EXTRA_LIBS_FOR_DLLS"
AC_CHECK_LIB(psapi,main)
yap_cv_readline=no
CLIB_NETLIBS="-lws2_32 -lpsapi -lgdi32"
if test "$prefix" = "NONE"
then
if test "$target_win64" = yes
then
prefix="\${SYSTEMDRIVE}/Yap64"
CLIB_NETLIBS="-lws2_32 -lwsock32 -lpsapi -lgdi32"
else
prefix="\${SYSTEMDRIVE}/Yap"
fi
@ -785,236 +654,10 @@ then
AC_CHECK_LIB(gmp,main)
fi
if test "$yap_cv_R" = "no"; then
REAL_TARGET="dummy"
ENABLE_REAL="@# "
elif test -e "$srcdir"/packages/real/Makefile.in ; then
REAL_TARGET="ritf"
ENABLE_REAL=""
AC_CHECK_PROGS(REXE, R, "none")
if test "$yap_cv_R" = "yes"
then
case "$target_os" in
*darwin*)
REAL_INCLUDES="-I/Library/Frameworks/R.framework/Headers"
REAL_LIBS="-framework R -L /Library/Frameworks/R.framework/Libraries -lR"
;;
*cygwin*|*mingw*)
REAL_INCLUDES="$($REXE CMD config --cppflags | grep -v ^WARNING)"
REAL_LIBS="$($REXE CMD config --ldflags | grep -v ^WARNING)"
;;
**)
dnl R is spread all over the place
dnl one of the two may work (Fedora/Ubuntu)
if test -n "$R_HOME" ; then
REAL_INCLUDES="-I$R_HOME/include"
elif test "$YAP_TARGET" = amd64 -a -d /usr/lib64/R/include ; then
REAL_INCLUDES="-I/usr/lib64/R/include"
elif test -d /usr/include/R; then
REAL_INCLUDES="-I/usr/include/R"
elif test -d /usr/share/R/include; then
REAL_INCLUDES="-I/usr/share/R/include"
else
REAL_INCLUDES="$($REXE CMD config --cppflags | grep -v ^WARNING)"
fi
if test -n "$R_HOME" ; then
REAL_LIBS="-L $R_HOME/lib -lR"
elif test "$YAP_TARGET" = amd64 -a -d /usr/lib64/R/lib; then
REAL_LIBS="-L /usr/lib64/R/lib -lR"
elif test -d /usr/lib/R; then
REAL_LIBS="-L /usr/lib/R/lib -lR"
else
REAL_LIBS="$($REXE CMD config --ldflags | grep -v ^WARNING)"
fi
;;
esac
else
case "$target_os" in
*cygwin*|*mingw*)
REAL_INCLUDES="-I\"$yap_cv_R/include\""
if test "$YAP_TARGET" = i386; then
REAL_LIBS="\"$yap_cv_R/bin/i386/R.dll\""
else
REAL_LIBS="\"$yap_cv_R/bin/x64/R.dll\""
fi
;;
*)
REAL_INCLUDES="-I$yap_cv_R/include"
REAL_LIBS="-L $yap_cv_R/lib -lR"
;;
esac
fi
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $REAL_INCLUDES"
AC_CHECK_HEADERS(Rinterface.h)
CFLAGS="$OLD_CFLAGS"
else
REAL_TARGET="dummy"
ENABLE_REAL="@# "
fi
if test "$yap_cv_python" = "no"; then
PYTHON_TARGET="dummy"
ENABLE_PYTHON="@# "
elif test -e "$srcdir"/packages/python/Makefile.in ; then
PYTHON_TARGET="pitf"
ENABLE_PYTHON=""
if test "$yap_cv_python" = "yes"
then
AC_CHECK_PROGS(PYTHON, python, "none")
else
PYTHON="$yap_cv_python"
fi
PYTHONHOME=`$PYTHON -c'import sys; print sys.prefix'`
PYTHONVERSION=`"$PYTHON" -c "import sys; print sys.version[[:3]]"`
PYTHON_LIBS="-L $PYTHONHOME/lib -lpython$PYTHONVERSION"
PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"
else
PYTHON_TARGET="dummy"
ENABLE_PYTHON="@# "
fi
if test "$yap_cv_judy" != "no"; then
AC_CHECK_LIB(Judy, Judy1Set,,[AC_MSG_RESULT([libJudy not found, UDI will only work with one Index at a time])])
fi
CUDA_LDFLAGS=""
CUDA_CPPFLAGS=""
if test "$yap_cv_cuda" = no
then
ENABLE_CUDA="@# "
else
AC_PATH_PROG(NVCC, [nvcc], [no], [$yap_cv_cuda/bin])
if test "$yap_cv_cuda" = no
then
ENABLE_CUDA="@# "
else
ENABLE_CUDA=""
case "$target_os" in
*darwin*)
CUDA_LDFLAGS="$LDFLAGS"
CUDA_CPPFLAGS="-shared -arch=sm_20 -Xcompiler -fPIC -O3 "
CUDA_SHLIB_LD="$NVCC -Xcompiler -dynamiclib -L../.. -lYap "
;;
**)
CUDA_LDFLAGS="$LDFLAGS $LIBS"
CUDA_CPPFLAGS="-shared -arch=sm_20 -Xcompiler -fPIC -O3 "
CUDA_SHLIB_LD="$NVCC -shared -Xcompiler -export-dynamic"
;;
esac
fi
fi
dnl if test "$yap_cv_cudd" != "no"
dnl then
dnl AC_CHECK_LIB(cudd,Cudd_Init)
dnl fi
if test "$yap_cv_myddas" != "no"
then
dnl check for mysql
AC_SEARCH_LIBS(mysql_init, [mysqlclient], [yap_cv_mysql="yes"], [yap_cv_mysql="no"])
if test "$yap_cv_mysql" = yes
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_MYSQL"
fi
dnl check for odbc
case "$target_os" in
*darwin*)
LIBS="$LIBS -framework CoreFoundation"
;;
**)
;;
esac
AC_SEARCH_LIBS(SQLAllocHandle, [odbc], [yap_cv_odbc="yes"], [yap_cv_odbc="no"])
if test "$yap_cv_odbc" = yes
then
ODBC_LIBS="$ODBC_LIBS -lodbc"
else
AC_SEARCH_LIBS(SQLAllocHandle, [iodbc], [yap_cv_odbc="yes"], [yap_cv_odbc="no"])
if test "$yap_cv_odbc" = yes
then
ODBC_LIBS="$ODBC_LIBS -liodbc"
fi
fi
if test "$yap_cv_odbc" = yes
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_ODBC"
fi
if test "$myddasstats" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_STATS"
fi
if test "$myddastoplevel" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_TOP_LEVEL"
fi
fi
if test "$yap_cv_cudd" != no; then
oldlibs="$LIBS"
if test "$yap_cv_cudd" != "NONE" -a "$yap_cv_cudd" != "yes"; then
CUDD_CPPFLAGS="-I $yap_cv_cudd/include"
cudd_dir="$yap_cv_cudd"
elif test "$prefix" != "NONE"; then
CUDD_CPPFLAGS="-I $prefix/include"
cudd_dir="$prefix"
else
CUDD_CPPFLAGS="-I /usr/local/include"
cudd_dir=/usr/local
fi
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $CUDD_CPPFLAGS"
AC_CHECK_HEADERS(util.h cudd/util.h cudd.h cudd/cudd.h)
AC_CHECK_HEADERS(cuddInt.h cudd/cuddInt.h)
dnl cudd can be most everywhere
if test -d "$cudd_dir/lib64/cudd" -a "$YAP_TARGET" = amd64; then
LIBS="$LIBS -L $cudd_dir/lib64/cudd"
elif test -d "$cudd_dir/lib64" -a "$YAP_TARGET" = amd64; then
LIBS="$LIBS -L $cudd_dir/lib64 -L $cudd_dir/lib"
elif test -d "$cudd_dir/lib/cudd"; then
LIBS="$LIBS -L $cudd_dir/lib/cudd"
elif test -d "$cudd_dir/lib"; then
LIBS="$LIBS -L $cudd_dir/lib"
fi
if test -d "$cudd_dir/util"; then
LIBS="$LIBS -L $cudd_dir/util"
fi
AC_SEARCH_LIBS(util_print_cpu_stats, [cuddutil util])
if test -d "$cudd_dir/st"; then
LIBS="$LIBS -L $cudd_dir/st"
fi
AC_SEARCH_LIBS(st_insert, [cuddst st])
if test -d "$cudd_dir/epd"; then
LIBS="$LIBS -L $cudd_dir/epd"
fi
AC_SEARCH_LIBS(EpdAdd, [epd])
if test -d "$cudd_dir/mtr"; then
LIBS="$LIBS -L $cudd_dir/mtr"
fi
AC_SEARCH_LIBS(Mtr_InitTree, [mtr])
if test -d "$cudd_dir/cudd"; then
LIBS="$LIBS -L $cudd_dir/cudd"
fi
AC_SEARCH_LIBS(Cudd_Init, [cudd], [cudd_installed="yes"], [cudd_installed="no"])
CPPFLAGS="$OLD_CPPFLAGS"
if test "$cudd_installed" = yes; then
CUDD_LDFLAGS="$LIBS"
else
cat << EOF
##################################################################
# ERROR: Could not find cudd library. Either I don't have the
# correct path, or CUDD is installed in some strange way
##################################################################
EOF
fi
LIBS="$oldlibs"
fi
if test "$threads" = yes
then
AC_CHECK_LIB(pthread,pthread_create)
@ -1037,13 +680,6 @@ fi
CMFLAGS=-fpic
CIFLAGS=-I.
if test "$use_gecode" = no; then
ENABLE_GECODE="@# "
else
ENABLE_GECODE=""
fi
AC_SUBST(ENABLE_GECODE)
if test "$use_prism" = no; then
ENABLE_PRISM="@# "
else
@ -1133,149 +769,6 @@ else
ENABLE_ZLIB="@# "
fi
dnl
dnl java is hard
dnl
if test "$yap_cv_java" = no; then
ENABLE_JPL="@#"
elif test -e "$srcdir"/packages/jpl/Makefile.in; then
ENABLE_JPL=""
if test "$yap_cv_java" != "yes"; then
JAVA_HOME=$yap_cv_java
JAVAPREFIX="$JAVA_HOME"/bin
elif test -n "$JAVA_HOME"; then
JAVAPREFIX="$JAVA_HOME"/bin
fi
AC_SUBST(JAVA_HOME)
AC_SUBST(JAVACFLAGS)
AC_SUBST(JAVALIBS)
AC_SUBST(JUNIT)
AC_SUBST(JPLCFLAGS)
AC_SUBST(JPLLDFLAGS)
AC_SUBST(LIBJPL)
AC_SUBST(JAVA_PRELOAD)
AC_SUBST(CMDEXT)
CMDEXT=sh
if test "x$JAVALIBS" = "x"; then
case "$target_os" in
*darwin*)
JAVALIBS="-Wl,-framework,JavaVM"
;;
*powerpc-linux*)
JAVALIBS="-ljava -ljvm"
;;
*win32*|*win64*)
JAVALIBS="-ljvm"
CMDEXT=bat
;;
*)
JAVALIBS="-ljava -lverify -ljvm"
;;
esac
fi
case "$target_os" in
*win32*)
JPLLDFLAGS="$JPLLDFLAGS -Wl,--kill-at"
LIBJPL=jpl
;;
*win64*)
LIBJPL=jpl
;;
*)
LIBJPL=libjpl
;;
esac
dnl ================================================================
dnl Java stuff
dnl ================================================================
if test "x$JAVACFLAGS" = x; then
JAVACFLAGS="-source 1.4 -target 1.4"
fi
m4_include([packages/jpl/ac/ac_prog_java.m4])
m4_include([packages/jpl/ac/ac_prog_java_works.m4])
m4_include([packages/jpl/ac/ac_prog_javac.m4])
m4_include([packages/jpl/ac/ac_prog_javac_works.m4])
m4_include([packages/jpl/ac/ac_prog_javadoc.m4])
m4_include([packages/jpl/ac/ac_jni_include_dirs.m4])
m4_include([packages/jpl/ac/ac_prog_jar.m4])
java_abs_paths=no
AC_CHECKING(Java configuration)
if test -r /etc/java/java2.conf; then
AC_MSG_RESULT(Using /etc/java/java2.conf)
eval `grep '\(JAVA\|JRE\|JDK\|SDK\).*=' /etc/java/java2.conf | sed 's/ *= */=/'`
if test ! -z "$JAVA_BINDIR"; then
PATH="$PATH:$JAVA_BINDIR"
java_abs_paths=yes
fi
fi
AC_PROG_JAVAC(javac)
AC_PROG_JAVA(java)
AC_PROG_JAR(jar)
AC_PROG_JAVADOC(javadoc)
escape_space()
{ sed -e "s/Program Files/Program-SPACE-Files/g" -e "s/ (x86)/SPACEX86/g"
}
unescape_space()
{ sed -e "s/-SPACE-/ /g" -e "s/SPACEX86/ (x86)/g"
}
AC_JNI_INCLUDE_DIR
for d in $(echo $JNI_INCLUDE_DIRS | escape_space); do
JPLCFLAGS="$JPLCFLAGS -I'$d'"
done
JPLCFLAGS="$(echo $JPLCFLAGS | unescape_space)"
for d in $(echo $JNI_CLIENT_DIRS | escape_space); do
JPLLDFLAGS="$JPLLDFLAGS -L'$d'"
done
JPLLDFLAGS="$(echo $JPLLDFLAGS | unescape_space)"
for d in $(echo $JNI_CLIENT_DIRS | escape_space); do
if test -f "$d/libjsig.$SO"; then
JAVALIBS="-ljsig $JAVALIBS"
JAVA_PRELOAD=$d/libjsig.$SO
break
fi
done
JAVA_PRELOAD="$(echo $JAVA_PRELOAD | unescape_space)"
if test "$java_abs_paths" = yes; then
JAVA_CC="$JAVA_BINDIR/$JAVA_CC"
fi
AC_ARG_WITH(junit, [ --with-junit=PATH Specify location of the junit JAR file],
[case "$withval" in
yes) JUNIT=/usr/share/java/junit.jar
;;
no) JUNIT=""
;;
*) JUNIT="$withval"
;;
esac
],
[ if test "x$JUNIT" = "x" -a -r /usr/share/java/junit.jar; then
JUNIT=/usr/share/java/junit.jar
fi
]
)
JAVA_HOME=$_JTOPDIR
fi
if test "$cross_compiling" = "yes"
then
YAP_EXTRAS=
@ -1806,10 +1299,7 @@ fi
if test "$yap_cv_judy" != "no"; then
AC_CHECK_HEADERS(Judy.h)
fi
if test "$yap_cv_myddas" != "no"
then
AC_CHECK_HEADERS(mysql/mysql.h)
fi
if test "$yap_cv_readline" != "no"
then
AC_CHECK_HEADERS( readline/readline.h)
@ -1922,11 +1412,6 @@ AC_SUBST(INSTALL_INFO)
dnl let YAP_EXTRAS fall through configure, from the env into Makefile
AC_SUBST(YAP_EXTRAS)
AC_SUBST(NO_BUILTIN_REGEXP)
AC_SUBST(ENABLE_CUDA)
AC_SUBST(NVCC)
AC_SUBST(CUDA_SHLIB_LD)
AC_SUBST(CUDA_CPPFLAGS)
AC_SUBST(CUDA_LDFLAGS)
AC_SUBST(ENABLE_CHR)
AC_SUBST(ENABLE_CLIB)
AC_SUBST(ENABLE_CLPQR)
@ -1954,10 +1439,6 @@ AC_SUBST(STATIC_MODE)
AC_SUBST(ENABLE_WINCONSOLE)
AC_SUBST(EXTRA_INCLUDES_FOR_WIN32)
AC_SUBST(ENABLE_CUDD)
AC_SUBST(ENABLE_BDDLIB)
AC_SUBST(CUDD_LDFLAGS)
AC_SUBST(CUDD_CPPFLAGS)
AC_SUBST(ENABLE_MINISAT)
AC_SUBST(ENABLE_REAL)
AC_SUBST(REAL_TARGET)
@ -1966,10 +1447,6 @@ AC_SUBST(REAL_LIBS)
AC_SUBST(INSTALL_MATLAB)
AC_SUBST(MATLAB_INCLUDE)
AC_SUBST(INSTALL_PRISM)
AC_SUBST(PYTHON_TARGET)
AC_SUBST(ENABLE_PYTHON)
AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(PYTHON_LIBS)
dnl check for threaded code
AC_MSG_CHECKING(for gcc threaded code)
@ -2292,51 +1769,11 @@ AC_SUBST(TARGETS)
AC_SUBST(PLTARGETS)
AC_SUBST(CHR_TARGETS)
dnl clib
if test "$ENABLE_CLIB" = ""; then
CLIB_TARGETS="socket.$SO cgi.$SO memfile.$SO files.$SO mime.$SO $CRYPT_TARGETS"
CLIB_PLTARGETS="socket.pl cgi.pl memfile.pl filesex.pl mime.pl $CRYPT_TARGETS"
if test "$ac_cv_func_setitimer" = "yes"; then
CLIB_TARGETS="$CLIB_TARGETS time.$SO"
CLIB_PLTARGETS="$CLIB_PLTARGETS time.pl"
else
echo "WARNING: no setitimer(); dropping time.pl from targets"
fi
if test "$IN_UNIX" = ""; then
CLIB_TARGETS="uid.$SO unix.$SO $CLIB_TARGETS"
CLIB_PLTARGETS="uid.pl unix.pl $CLIB_PLTARGETS"
CLIB_NETLIBS=
else
AC_CHECK_FUNC(socket, [], [
AC_CHECK_LIB(socket, socket,
[CLIB_NETLIBS="$CLIB_NETLIBS -lsocket"]
AC_DEFINE(HAVE_LIBSOCKET, 1,
"Define if you have the socket library (-lsocket)."))])
AC_CHECK_FUNC(gethostent, [], [
AC_CHECK_LIB(nsl, gethostent,
[CLIB_NETLIBS="$CLIB_NETLIBS -lnsl"]
AC_DEFINE(HAVE_LIBNSL, 1,
"Define if you have the nsl library (-lnsl)."))])
fi
AC_CHECK_LIB(pthread, pthread_create,
[CLIB_PTHREADS="-lpthread"],[CLIB_PTHREADS=""])
oldlibs="$LIBS"
AC_CHECK_LIB(crypt, crypt, CRYPT_TARGET=crypt.\$SO, CRYPT_TARGET="")
CLIB_CRYPTLIBS="$LIBS"
AC_CHECK_FUNCS(crypt)
LIBS="$oldlibs"
AC_SUBST(CLIB_PTHREADS)
AC_SUBST(CLIB_TARGETS)
AC_SUBST(CLIB_PLTARGETS)
AC_SUBST(CLIB_NETLIBS)
AC_SUBST(CLIB_CRYPTLIBS)
fi
AC_CHECK_TYPES(socklen_t, [], [],
[
@ -2398,29 +1835,6 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
if test "$with_time" = yes; then
if test "$ac_cv_func_setitimer" = "yes"; then
TARGETS="$TARGETS time.$SO"
else
echo "WARNING: no setitimer(); dropping time.pl from targets"
fi
fi
if test "$ac_cv_func_getrlimit" = "yes"; then
TARGETS="$TARGETS rlimit.$SO"
else
echo "WARNING: no getrlimit(); dropping rlimit.pl from targets"
fi
AC_ARG_ENABLE(mimecharset,
[ --enable-mimecharset=charset Default MIME charset to set on new messages],
RFC2045CHARSET="$enableval", RFC2045CHARSET="us-ascii")
AC_SUBST(RFC2045CHARSET)
MAILDROP_CFLAGS="$SHLIB_CFLAGS -I. -I\$(srcdir) -I\$(srcdir)/.. -I../../../.."
AC_SUBST(MAILDROP_CFLAGS)
if test "$yap_cv_minisat" = no
then
ENABLE_MINISAT="@# "
@ -2431,127 +1845,102 @@ else
ENABLE_MINISAT=""
fi
dnl zlib
if test "$ENABLE_ZLIB" = ""
if test "x$PLARCH" = "x"; then
case "$host" in
*linux*)
PLARCH=`echo $host | sed 's/-.*/-linux/'`
;;
i?86-*mingw32*)
# Make PLARCH match the definition in src/config/win32.h
PLARCH=i386-win32
;;
x86_64-*mingw32*)
# Make PLARCH match the definition in src/config/win64.h
PLARCH=x64-win64
;;
*-gnu)
PLARCH=`echo $host | sed 's/\([^-]*\)-[^-]*-\([^-]*\)-gnu/\1-\2/'`
;;
*)
PLARCH=`echo $host | sed 's/\([^-]*\)-[^-]*-\([^-]*\)/\1-\2/'`
;;
esac
fi
m4_include([library/MYDDAS/configure.in])
if test "$yap_cv_R" != "no" -a -e "$srcdir"/packages/real/Makefile.in; then
ENABLE_REAL=""
m4_include([packages/real/configure.in])
else
REAL_TARGET="dummy"
ENABLE_REAL="@# "
fi
dnl
dnl java is hard
dnl
if test "$yap_cv_java" = no; then
ENABLE_JPL="@#"
elif test -e "$srcdir"/packages/jpl/Makefile.in; then
ENABLE_JPL=""
if test "$yap_cv_java" != "yes"; then
JAVA_HOME=$yap_cv_java
JAVAPREFIX="$JAVA_HOME"/bin
elif test -n "$JAVA_HOME"; then
JAVAPREFIX="$JAVA_HOME"/bin
fi
m4_include([packages/jpl/configure.in])
fi
if test "$ENABLE_CLIB" = ""
then
AC_CHECK_LIB(z, zlibVersion,
ZLIBS="-lz"
ZLIB=yes,
ZLIB=no)
m4_include([packages/clib/configure.in])
if test "$ZLIB" = yes; then
ZLIB_TARGETS="zlib4pl.$SO"
ZLIB_PLTARGETS='zlib.pl'
ZLIB_INSTALL=install
else
ZLIB_TARGETS=nolib
ZLIB_INSTALL=nolib
cat << EOF
##################################################################
# ERROR: Could not find library zlib (-lz). Dropped library(zlib)
# Library zlib is available from http://www.zlib.net/
# Most Unix/Linux distributions are shipped with binaries. Make
# sure to have the development library installed.
##################################################################
EOF
fi
if test "$ENABLE_LIBARCHIVE" = ""
then
m4_include([packages/archive/configure.in])
AC_SUBST(ZLIBS)
AC_SUBST(ZLIB_TARGETS)
AC_SUBST(ZLIB_PLTARGETS)
AC_SUBST(ZLIB_INSTALL)
fi
dnl archive
if test "$ENABLE_ODBC" = ""; then
m4_include([packages/odbc/configure.in])
if test "$yap_cv_odbc" = yes; then
ODBC_TARGETS="odbc4pl.$SO"
ODBC_PLTARGETS=odbc.pl
AC_CHECK_HEADERS(sql.h)
AC_CHECK_FUNCS(localtime mktime gmtime timegm)
AC_CHECK_TYPES([SQLLEN, SQLULEN],,,
[#include <sql.h>
])
else
ODBC_TARGETS=nolib
ODBC_PLTARGETS=odbc.pl
fi
if test "$ENABLE_LIBARCHIVE" = ""
m4_include([packages/bdd/configure.in])
dnl zlib
if test "$ENABLE_ZLIB" = ""
then
OLD_LIBS=$LIBS
AC_CHECK_HEADER(archive.h,
[ AC_DEFINE([HAVE_ARCHIVE_H], 1,
[Define to 1 if you have <archive.h>.])
ARCHIVEH=yes
],
ARCHIVEH=no)
if test "$ARCHIVEH" = yes; then
AC_CHECK_LIB(archive, archive_read_new,
ARCHIVE_LIBS="-larchive"
ARCHIVELIB=yes,
ARCHIVELIB=no)
fi
LIBS="$LIBS -larchive"
AC_CHECK_FUNCS(archive_read_support_compression_bzip2 \
archive_read_support_compression_compress \
archive_read_support_compression_gzip \
archive_read_support_compression_lzma \
archive_read_support_compression_none \
archive_read_support_compression_xz)
AC_CHECK_FUNCS(archive_read_support_format_ar \
archive_read_support_format_cpio \
archive_read_support_format_empty \
archive_read_support_format_iso9660 \
archive_read_support_format_mtree \
archive_read_support_format_raw \
archive_read_support_format_tar \
archive_read_support_format_zip)
if test "$ARCHIVELIB" = yes; then
ARCHIVE_TARGETS="archive4pl.$SO"
ARCHIVE_PLTARGETS=archive.pl
else
ARCHIVE_TARGETS=nolib
cat << EOF
##################################################################
# ERROR: Could not find library archive (-larchive). Dropped
# library(archive). Library archive is available from
# http://code.google.com/p/libarchive/
#
# Most Unix/Linux distributions are shipped with binaries. Make
# sure to have the development library installed. E.g.
#
# Debian/Ubuntu/Mint: aptitude install libarchive-dev
# Fedora/... yum install libarchive-devel
# MacOS (Macports): port install libarchive
##################################################################
EOF
m4_include([packages/zlib/configure.in])
fi
AC_SUBST(ARCHIVE_LIBS)
AC_SUBST(ARCHIVE_TARGETS)
AC_SUBST(ARCHIVE_PLTARGETS)
m4_include([packages/gecode/configure.in])
m4_include([packages/python/configure.in])
m4_include([packages/cuda/configure.in])
LIBS="$OLD_LIBS"
fi
AC_SUBST(ENABLE_LIBARCHIVE)
AC_SUBST(ODBC_CFLAGS)
AC_SUBST(ODBC_LDFLAGS)
AC_SUBST(ODBC_LIBS)
AC_SUBST(ODBC_TARGETS)
AC_SUBST(ODBC_PLTARGETS)
AC_SUBST(ENABLE_ODBC)
mkdir -p library/lammpi
@ -2649,9 +2038,6 @@ fi
if test "$ENABLE_CLIB" = ""; then
AC_CONFIG_FILES([packages/clib/Makefile])
AC_CONFIG_FILES([packages/clib/maildrop/rfc822/Makefile])
AC_CONFIG_FILES([packages/clib/maildrop/rfc2045/Makefile])
AC_CONFIG_FILES([packages/clib/maildrop/rfc2045/rfc2045charset.h])
fi
if test "$ENABLE_CLPQR" = ""; then
@ -2666,10 +2052,6 @@ if test "$ENABLE_JPL" = ""; then
AC_CONFIG_FILES([packages/jpl/Makefile packages/jpl/jpl_paths.yap packages/jpl/src/java/Makefile ])
fi
if test "$ENABLE_PYTHON" = ""; then
AC_CONFIG_FILES([ packages/python/Makefile ])
fi
if test "$ENABLE_PLDOC" = ""; then
AC_CONFIG_FILES([packages/pldoc/Makefile])
AC_CONFIG_FILES([packages/pldoc/server/man_server.pl])
@ -2728,7 +2110,7 @@ AC_CONFIG_FILES([packages/CLPBN/horus/Makefile])
fi
if test "$ENABLE_GECODE" = ""; then
AC_CONFIG_FILES([library/gecode/Makefile])
AC_CONFIG_FILES([packages/gecode/Makefile])
fi
if test "$ENABLE_PRISM" = ""; then
@ -2738,7 +2120,5 @@ fi
AC_CONFIG_FILES([packages/yap-lbfgs/Makefile])
AC_CONFIG_FILES([packages/cuda/Makefile])
AC_OUTPUT()

View File

@ -0,0 +1,81 @@
AC_ARG_ENABLE(myddas,
[ --enable-myddas[[=DIR]] enable the MYDDAS library],
if test "$enableval" = yes; then
yap_cv_myddas=/usr
elif test "$enableval" = no; then
yap_cv_myddas=no
else
yap_cv_myddas=$enable_myddas
LDFLAGS="$LDFLAGS -L${yap_cv_myddas}/lib "
CPPFLAGS="$CPPFLAGS -I${yap_cv_myddas}/include "
ODBC_LDFLAGS="-L${yap_cv_myddas}/lib "
ODBC_CFLAGS="-I${yap_cv_myddas}/include "
fi,
[yap_cv_myddas=/usr])
AC_ARG_ENABLE(myddas-stats,
[ --enable-myddas-stats enable the MYDDAS library statistics support],
if test "$yap_cv_myddas" = no; then
myddasstats=no
else
myddasstats="$enableval"
fi, myddasstats=no)
AC_ARG_ENABLE(myddas-top-level,
[ --enable-myddas-top-level enable the MYDDAS top-level support to MySQL],
if test "$yap_cv_myddas" = no; then
myddastoplevel=no
else
myddastoplevel="$enableval"
fi, myddastoplevel=no)
if test "$yap_cv_myddas" != "no"
then
dnl check for mysql
AC_SEARCH_LIBS(mysql_init, [mysqlclient], [yap_cv_mysql="yes"], [yap_cv_mysql="no"])
if test "$yap_cv_mysql" = yes
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_MYSQL"
fi
dnl check for odbc
case "$target_os" in
*darwin*)
LIBS="$LIBS -framework CoreFoundation"
;;
**)
;;
esac
AC_SEARCH_LIBS(SQLAllocHandle, [odbc], [yap_cv_odbc="yes"], [yap_cv_odbc="no"])
if test "$yap_cv_odbc" = yes
then
ODBC_LIBS="$ODBC_LIBS -lodbc"
else
AC_SEARCH_LIBS(SQLAllocHandle, [iodbc], [yap_cv_odbc="yes"], [yap_cv_odbc="no"])
if test "$yap_cv_odbc" = yes
then
ODBC_LIBS="$ODBC_LIBS -liodbc"
fi
fi
if test "$yap_cv_odbc" = yes
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_ODBC"
fi
if test "$myddasstats" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_STATS"
fi
if test "$myddastoplevel" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_TOP_LEVEL"
fi
fi
if test "$yap_cv_myddas" != "no"
then
AC_CHECK_HEADERS(mysql/mysql.h)
fi

View File

@ -37,7 +37,7 @@ SO=@SO@
CWD=$(PWD)
#
OBJS=core_tries.o base_tries.o tries.o base_itries.o itries.o
OBJS=core_tries.o base_tries.o base_dbtries.o tries.o base_itries.o itries.o
SOBJS=tries.@SO@ itries.@SO@
#in some systems we just create a single object, in others we need to

View File

@ -210,10 +210,10 @@
static TrNode depth_reduction(TrEntry trie, TrNode depth_node, YAP_Int opt_level);
static TrNode breadth_reduction(TrEntry trie, TrNode breadth_node, YAP_Int opt_level);
inline int compare_label_nodes(TrData data1, TrData data2);
inline void move_after(TrData data_source, TrData data_dest);
inline void move_last_data_after(TrData moveto_data);
inline void set_depth_breadth_reduction_current_data(TrData data);
static inline int compare_label_nodes(TrData data1, TrData data2);
static inline void move_after(TrData data_source, TrData data_dest);
static inline void move_last_data_after(TrData moveto_data);
static inline void set_depth_breadth_reduction_current_data(TrData data);
/* -------------------------- */
@ -227,7 +227,7 @@ static TrData CURRENT_DEPTH_BREADTH_DATA;
/* API */
/* -------------------------- */
inline
YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YAP_Int start_counter, YAP_Int *end_counter) {
TrNode depth_node, breadth_node, nested_trie;
core_set_label_counter(start_counter);
@ -257,32 +257,32 @@ YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YA
}
inline
YAP_Int trie_get_db_opt_level_count(YAP_Int opt_level) {
return core_db_trie_get_optimization_level_count(opt_level);
}
inline
TrData trie_get_depth_breadth_reduction_current_data(void) {
return CURRENT_DEPTH_BREADTH_DATA;
}
inline
void trie_replace_nested_trie(TrEntry trie, YAP_Int nested_trie_id, YAP_Term new_term) {
core_depth_breadth_trie_replace_nested_trie(TrNode_child(TrEntry_trie(trie)), nested_trie_id, new_term);
return;
}
inline
YAP_Int trie_get_db_opt_min_prefix(void) {
return core_get_trie_db_opt_min_prefix();
}
inline
void trie_set_db_opt_min_prefix(YAP_Int min_prefix) {
core_set_trie_db_opt_min_prefix(min_prefix);
return;
@ -294,7 +294,7 @@ void trie_set_db_opt_min_prefix(YAP_Int min_prefix) {
/* -------------------------- */
inline
static inline
void set_depth_breadth_reduction_current_data(TrData data) {
CURRENT_DEPTH_BREADTH_DATA = data;
return;
@ -359,7 +359,7 @@ TrNode breadth_reduction(TrEntry trie, TrNode breadth_node, YAP_Int opt_level) {
}
inline
static inline
void move_last_data_after(TrData moveto_data) {
TrEntry trie = CURRENT_TRIE;
TrData last_data = TrEntry_last_data(trie);
@ -378,7 +378,7 @@ void move_last_data_after(TrData moveto_data) {
}
inline
static inline
void move_after(TrData data_source, TrData data_dest) {
TrEntry trie = CURRENT_TRIE;
if (data_source == TrEntry_first_data(trie))
@ -407,7 +407,6 @@ void move_after(TrData data_source, TrData data_dest) {
}
inline
void trie_data_order_correction(void) {
TrEntry trie = CURRENT_TRIE;
TrData inserted_data = TrEntry_last_data(trie);
@ -434,7 +433,7 @@ void trie_data_order_correction(void) {
}
inline
static inline
int compare_label_nodes(TrData data1, TrData data2) {
YAP_Term t1 = TrNode_entry(TrData_leaf(data1)), t2 = TrNode_entry(TrData_leaf(data2));
YAP_Int i1 = atol(YAP_AtomName(YAP_AtomOfTerm(t1)) + 1), i2 = atol(YAP_AtomName(YAP_AtomOfTerm(t2)) + 1);

View File

@ -207,10 +207,10 @@
/* API */
/* --------------------------- */
inline YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YAP_Int start_counter, YAP_Int *end_counter);
inline void trie_data_order_correction(void);
inline TrData trie_get_depth_breadth_reduction_current_data(void);
inline YAP_Int trie_get_db_opt_level_count(YAP_Int opt_level);
inline void trie_replace_nested_trie(TrEntry trie, YAP_Int nested_trie_id, YAP_Term new_term);
inline YAP_Int trie_get_db_opt_min_prefix(void);
inline void trie_set_db_opt_min_prefix(YAP_Int min_prefix);
YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YAP_Int start_counter, YAP_Int *end_counter);
void trie_data_order_correction(void);
TrData trie_get_depth_breadth_reduction_current_data(void);
YAP_Int trie_get_db_opt_level_count(YAP_Int opt_level);
void trie_replace_nested_trie(TrEntry trie, YAP_Int nested_trie_id, YAP_Term new_term);
YAP_Int trie_get_db_opt_min_prefix(void);
void trie_set_db_opt_min_prefix(YAP_Int min_prefix);

View File

@ -32,7 +32,7 @@ static TrEntry FIRST_ITRIE, CURRENT_ITRIE;
/* API */
/* -------------------------- */
inline
void itrie_init_module(void) {
ITRIE_ENGINE = core_trie_init_module();
FIRST_ITRIE = NULL;
@ -40,7 +40,7 @@ void itrie_init_module(void) {
}
inline
void itrie_data_save(TrNode node, FILE *file) {
TrData data;
@ -50,7 +50,7 @@ void itrie_data_save(TrNode node, FILE *file) {
}
inline
void itrie_data_load(TrNode node, YAP_Int depth, FILE *file) {
TrData data;
YAP_Int pos, neg, timestamp;
@ -62,7 +62,7 @@ void itrie_data_load(TrNode node, YAP_Int depth, FILE *file) {
}
inline
void itrie_data_print(TrNode node) {
TrData data;
@ -72,7 +72,7 @@ void itrie_data_print(TrNode node) {
}
inline
void itrie_data_copy(TrNode node_dest, TrNode node_source) {
TrData data_dest, data_source;
@ -83,7 +83,7 @@ void itrie_data_copy(TrNode node_dest, TrNode node_source) {
}
inline
void itrie_data_destruct(TrNode node) {
TrEntry itrie;
TrData data;
@ -102,7 +102,7 @@ void itrie_data_destruct(TrNode node) {
}
inline
void itrie_data_add(TrNode node_dest, TrNode node_source) {
TrData data_dest, data_source;
@ -116,7 +116,7 @@ void itrie_data_add(TrNode node_dest, TrNode node_source) {
}
inline
void itrie_data_subtract(TrNode node_dest, TrNode node_source) {
TrData data_dest, data_source;
@ -130,7 +130,7 @@ void itrie_data_subtract(TrNode node_dest, TrNode node_source) {
}
inline
TrEntry itrie_open(void) {
TrEntry itrie;
TrNode node;
@ -144,7 +144,7 @@ TrEntry itrie_open(void) {
}
inline
void itrie_close(TrEntry itrie) {
core_trie_close(ITRIE_ENGINE, TrEntry_trie(itrie), &itrie_data_destruct);
if (TrEntry_next(itrie)) {
@ -157,7 +157,7 @@ void itrie_close(TrEntry itrie) {
}
inline
void itrie_close_all(void) {
TrEntry itrie;
@ -171,33 +171,33 @@ void itrie_close_all(void) {
}
inline
void itrie_set_mode(TrEntry itrie, YAP_Int mode) {
TrEntry_mode(itrie) = mode;
return;
}
inline
YAP_Int itrie_get_mode(TrEntry itrie) {
return TrEntry_mode(itrie);
}
inline
void itrie_set_timestamp(TrEntry itrie, YAP_Int timestamp) {
TrEntry_timestamp(itrie) = timestamp;
return;
}
inline
YAP_Int itrie_get_timestamp(TrEntry itrie) {
return TrEntry_timestamp(itrie);
}
inline
void itrie_put_entry(TrEntry itrie, YAP_Term entry) {
TrData data;
TrNode node;
@ -213,7 +213,7 @@ void itrie_put_entry(TrEntry itrie, YAP_Term entry) {
}
inline
void itrie_update_entry(TrEntry itrie, YAP_Term entry) {
TrData data;
TrNode node;
@ -226,7 +226,7 @@ void itrie_update_entry(TrEntry itrie, YAP_Term entry) {
}
inline
TrData itrie_check_entry(TrEntry itrie, YAP_Term entry) {
TrNode node;
@ -236,13 +236,13 @@ TrData itrie_check_entry(TrEntry itrie, YAP_Term entry) {
}
inline
YAP_Term itrie_get_entry(TrData data) {
return core_trie_get_entry(TrData_leaf(data));
}
inline
void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp) {
*pos = TrData_pos(data);
*neg = TrData_neg(data);
@ -251,7 +251,7 @@ void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp)
}
inline
TrData itrie_traverse_init(TrEntry itrie) {
TrData data, *bucket;
YAP_Int traverse_bucket = 0;
@ -269,7 +269,7 @@ TrData itrie_traverse_init(TrEntry itrie) {
}
inline
TrData itrie_traverse_cont(TrEntry itrie) {
TrData data, *bucket;
YAP_Int traverse_bucket;
@ -294,35 +294,35 @@ TrData itrie_traverse_cont(TrEntry itrie) {
}
inline
void itrie_remove_entry(TrData data) {
core_trie_remove_entry(ITRIE_ENGINE, TrData_leaf(data), &itrie_data_destruct);
return;
}
inline
void itrie_remove_subtree(TrData data) {
core_trie_remove_subtree(ITRIE_ENGINE, TrData_leaf(data), &itrie_data_destruct);
return;
}
inline
void itrie_add(TrEntry itrie_dest, TrEntry itrie_source) {
core_trie_add(TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_add);
return;
}
inline
void itrie_subtract(TrEntry itrie_dest, TrEntry itrie_source) {
core_trie_add(TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_subtract);
return;
}
inline
void itrie_join(TrEntry itrie_dest, TrEntry itrie_source) {
CURRENT_ITRIE = itrie_dest;
core_trie_join(ITRIE_ENGINE, TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_add, &itrie_data_copy);
@ -330,40 +330,40 @@ void itrie_join(TrEntry itrie_dest, TrEntry itrie_source) {
}
inline
void itrie_intersect(TrEntry itrie_dest, TrEntry itrie_source) {
core_trie_intersect(ITRIE_ENGINE, TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_add, &itrie_data_destruct);
return;
}
inline
YAP_Int itrie_count_join(TrEntry itrie1, TrEntry itrie2) {
return core_trie_count_join(TrEntry_trie(itrie1), TrEntry_trie(itrie2));
}
inline
YAP_Int itrie_count_intersect(TrEntry itrie1, TrEntry itrie2) {
return core_trie_count_intersect(TrEntry_trie(itrie1), TrEntry_trie(itrie2));
}
inline
void itrie_save(TrEntry itrie, FILE *file) {
core_trie_save(TrEntry_trie(itrie), file, &itrie_data_save);
return;
}
inline
void itrie_save_as_trie(TrEntry itrie, FILE *file) {
core_trie_save(TrEntry_trie(itrie), file, NULL);
return;
}
inline
TrEntry itrie_load(FILE *file) {
TrEntry itrie;
TrNode node;
@ -382,28 +382,28 @@ TrEntry itrie_load(FILE *file) {
}
inline
void itrie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
core_trie_stats(ITRIE_ENGINE, memory, tries, entries, nodes);
return;
}
inline
void itrie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
core_trie_max_stats(ITRIE_ENGINE, memory, tries, entries, nodes);
return;
}
inline
void itrie_usage(TrEntry itrie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes) {
core_trie_usage(TrEntry_trie(itrie), entries, nodes, virtual_nodes);
return;
}
inline
void itrie_print(TrEntry itrie) {
core_trie_print(TrEntry_trie(itrie), &itrie_data_print);
return;

View File

@ -168,40 +168,40 @@ typedef struct itrie_data {
/* API */
/* --------------------------- */
inline void itrie_init_module(void);
inline void itrie_data_save(TrNode node, FILE *file);
inline void itrie_data_load(TrNode node, YAP_Int depth, FILE *file);
inline void itrie_data_print(TrNode node);
inline void itrie_data_copy(TrNode node_dest, TrNode node_source);
inline void itrie_data_destruct(TrNode node);
inline void itrie_data_add(TrNode node_dest, TrNode node_source);
inline void itrie_data_subtract(TrNode node_dest, TrNode node_source);
inline TrEntry itrie_open(void);
inline void itrie_close(TrEntry itrie);
inline void itrie_close_all(void);
inline void itrie_set_mode(TrEntry itrie, YAP_Int mode);
inline YAP_Int itrie_get_mode(TrEntry itrie);
inline void itrie_set_timestamp(TrEntry itrie, YAP_Int timestamp);
inline YAP_Int itrie_get_timestamp(TrEntry itrie);
inline void itrie_put_entry(TrEntry itrie, YAP_Term entry);
inline void itrie_update_entry(TrEntry itrie, YAP_Term entry);
inline TrData itrie_check_entry(TrEntry itrie, YAP_Term entry);
inline YAP_Term itrie_get_entry(TrData data);
inline void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp);
inline TrData itrie_traverse_init(TrEntry itrie);
inline TrData itrie_traverse_cont(TrEntry itrie);
inline void itrie_remove_entry(TrData data);
inline void itrie_remove_subtree(TrData data);
inline void itrie_add(TrEntry itrie_dest, TrEntry itrie_source);
inline void itrie_subtract(TrEntry itrie_dest, TrEntry itrie_source);
inline void itrie_join(TrEntry itrie_dest, TrEntry itrie_source);
inline void itrie_intersect(TrEntry itrie_dest, TrEntry itrie_source);
inline YAP_Int itrie_count_join(TrEntry itrie1, TrEntry itrie2);
inline YAP_Int itrie_count_intersect(TrEntry itrie1, TrEntry itrie2);
inline void itrie_save(TrEntry itrie, FILE *file);
inline void itrie_save_as_trie(TrEntry itrie, FILE *file);
inline TrEntry itrie_load(FILE *file);
inline void itrie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
inline void itrie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
inline void itrie_usage(TrEntry itrie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
inline void itrie_print(TrEntry itrie);
void itrie_init_module(void);
void itrie_data_save(TrNode node, FILE *file);
void itrie_data_load(TrNode node, YAP_Int depth, FILE *file);
void itrie_data_print(TrNode node);
void itrie_data_copy(TrNode node_dest, TrNode node_source);
void itrie_data_destruct(TrNode node);
void itrie_data_add(TrNode node_dest, TrNode node_source);
void itrie_data_subtract(TrNode node_dest, TrNode node_source);
TrEntry itrie_open(void);
void itrie_close(TrEntry itrie);
void itrie_close_all(void);
void itrie_set_mode(TrEntry itrie, YAP_Int mode);
YAP_Int itrie_get_mode(TrEntry itrie);
void itrie_set_timestamp(TrEntry itrie, YAP_Int timestamp);
YAP_Int itrie_get_timestamp(TrEntry itrie);
void itrie_put_entry(TrEntry itrie, YAP_Term entry);
void itrie_update_entry(TrEntry itrie, YAP_Term entry);
TrData itrie_check_entry(TrEntry itrie, YAP_Term entry);
YAP_Term itrie_get_entry(TrData data);
void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp);
TrData itrie_traverse_init(TrEntry itrie);
TrData itrie_traverse_cont(TrEntry itrie);
void itrie_remove_entry(TrData data);
void itrie_remove_subtree(TrData data);
void itrie_add(TrEntry itrie_dest, TrEntry itrie_source);
void itrie_subtract(TrEntry itrie_dest, TrEntry itrie_source);
void itrie_join(TrEntry itrie_dest, TrEntry itrie_source);
void itrie_intersect(TrEntry itrie_dest, TrEntry itrie_source);
YAP_Int itrie_count_join(TrEntry itrie1, TrEntry itrie2);
YAP_Int itrie_count_intersect(TrEntry itrie1, TrEntry itrie2);
void itrie_save(TrEntry itrie, FILE *file);
void itrie_save_as_trie(TrEntry itrie, FILE *file);
TrEntry itrie_load(FILE *file);
void itrie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
void itrie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
void itrie_usage(TrEntry itrie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
void itrie_print(TrEntry itrie);

View File

@ -39,7 +39,6 @@ static YAP_Int CURRENT_TRAVERSE_MODE;
/* API */
/* -------------------------- */
inline
void trie_init_module(void) {
TRIE_ENGINE = core_trie_init_module();
FIRST_TRIE = NULL;
@ -48,7 +47,7 @@ void trie_init_module(void) {
}
inline
void trie_data_load(TrNode node, YAP_Int depth, FILE *file) {
TrData data;
@ -58,7 +57,7 @@ void trie_data_load(TrNode node, YAP_Int depth, FILE *file) {
}
inline
void trie_data_copy(TrNode node_dest, TrNode node_source) {
TrData data_dest;
@ -68,7 +67,7 @@ void trie_data_copy(TrNode node_dest, TrNode node_source) {
}
inline
void trie_data_destruct(TrNode node) {
TrEntry trie;
TrData data;
@ -89,7 +88,7 @@ void trie_data_destruct(TrNode node) {
}
inline
TrEntry trie_open(void) {
TrEntry trie;
TrNode node;
@ -103,7 +102,7 @@ TrEntry trie_open(void) {
}
inline
void trie_close(TrEntry trie) {
core_trie_close(TRIE_ENGINE, TrEntry_trie(trie), &trie_data_destruct);
if (TrEntry_next(trie)) {
@ -116,7 +115,7 @@ void trie_close(TrEntry trie) {
}
inline
void trie_close_all(void) {
TrEntry trie;
@ -130,20 +129,20 @@ void trie_close_all(void) {
}
inline
void trie_set_mode(YAP_Int mode) {
core_trie_set_mode(mode);
return;
}
inline
YAP_Int trie_get_mode(void) {
return core_trie_get_mode();
}
inline
TrData trie_put_entry(TrEntry trie, YAP_Term entry) {
TrData data;
TrNode node;
@ -157,7 +156,7 @@ TrData trie_put_entry(TrEntry trie, YAP_Term entry) {
}
inline
TrData trie_check_entry(TrEntry trie, YAP_Term entry) {
TrNode node;
@ -167,13 +166,13 @@ TrData trie_check_entry(TrEntry trie, YAP_Term entry) {
}
inline
YAP_Term trie_get_entry(TrData data) {
return core_trie_get_entry(TrData_leaf(data));
}
inline
TrData trie_get_first_entry(TrEntry trie) {
TrData data;
@ -182,7 +181,7 @@ TrData trie_get_first_entry(TrEntry trie) {
}
inline
TrData trie_get_last_entry(TrEntry trie) {
TrData data;
@ -193,7 +192,7 @@ TrData trie_get_last_entry(TrEntry trie) {
}
inline
TrData trie_traverse_init(TrEntry trie, TrData init_data) {
TrData data;
@ -210,7 +209,7 @@ TrData trie_traverse_init(TrEntry trie, TrData init_data) {
}
inline
TrData trie_traverse_cont(TrEntry trie) {
TrData data;
@ -229,21 +228,21 @@ TrData trie_traverse_cont(TrEntry trie) {
}
inline
void trie_remove_entry(TrData data) {
core_trie_remove_entry(TRIE_ENGINE, TrData_leaf(data), &trie_data_destruct);
return;
}
inline
void trie_remove_subtree(TrData data) {
core_trie_remove_subtree(TRIE_ENGINE, TrData_leaf(data), &trie_data_destruct);
return;
}
inline
void trie_join(TrEntry trie_dest, TrEntry trie_source) {
CURRENT_TRIE = trie_dest;
core_trie_join(TRIE_ENGINE, TrEntry_trie(trie_dest), TrEntry_trie(trie_source), NULL, &trie_data_copy);
@ -251,33 +250,33 @@ void trie_join(TrEntry trie_dest, TrEntry trie_source) {
}
inline
void trie_intersect(TrEntry trie_dest, TrEntry trie_source) {
core_trie_intersect(TRIE_ENGINE, TrEntry_trie(trie_dest), TrEntry_trie(trie_source), NULL, &trie_data_destruct);
return;
}
inline
YAP_Int trie_count_join(TrEntry trie1, TrEntry trie2) {
return core_trie_count_join(TrEntry_trie(trie1), TrEntry_trie(trie2));
}
inline
YAP_Int trie_count_intersect(TrEntry trie1, TrEntry trie2) {
return core_trie_count_intersect(TrEntry_trie(trie1), TrEntry_trie(trie2));
}
inline
void trie_save(TrEntry trie, FILE *file) {
core_trie_save(TrEntry_trie(trie), file, NULL);
return;
}
inline
TrEntry trie_load(FILE *file) {
TrEntry trie;
TrNode node;
@ -296,35 +295,34 @@ TrEntry trie_load(FILE *file) {
}
inline
void trie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
core_trie_stats(TRIE_ENGINE, memory, tries, entries, nodes);
return;
}
inline
void trie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
core_trie_max_stats(TRIE_ENGINE, memory, tries, entries, nodes);
return;
}
inline
void trie_usage(TrEntry trie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes) {
core_trie_usage(TrEntry_trie(trie), entries, nodes, virtual_nodes);
return;
}
inline
void trie_print(TrEntry trie) {
core_trie_print(TrEntry_trie(trie), NULL);
return;
}
inline
void trie_data_construct(TrNode node) {
TrData data;
@ -334,20 +332,20 @@ void trie_data_construct(TrNode node) {
}
inline
void trie_set_traverse_mode(YAP_Int mode) {
CURRENT_TRAVERSE_MODE = mode;
return;
}
inline
YAP_Int trie_get_traverse_mode(void) {
return CURRENT_TRAVERSE_MODE;
}
inline
TrData trie_traverse_first(TrEntry trie) {
TrData data;
if (CURRENT_TRAVERSE_MODE == TRAVERSE_MODE_FORWARD)
@ -358,7 +356,7 @@ TrData trie_traverse_first(TrEntry trie) {
}
inline
TrData trie_traverse_next(TrData cur) {
TrData data = NULL;
if (cur) {
@ -374,14 +372,14 @@ TrData trie_traverse_next(TrData cur) {
}
inline
void trie_disable_hash_table(void) {
core_disable_hash_table();
return;
}
inline
void trie_enable_hash_table(void) {
core_enable_hash_table();
return;
@ -400,7 +398,7 @@ TrData get_data_from_trie_node(TrNode node) {
}
inline
YAP_Term trie_to_list(TrEntry trie) {
return core_trie_to_list(TrEntry_trie(trie));
}

View File

@ -106,43 +106,43 @@ typedef struct trie_data {
/* API */
/* --------------------------- */
inline void trie_init_module(void);
inline void trie_data_load(TrNode node, YAP_Int depth, FILE *file);
inline void trie_data_copy(TrNode node_dest, TrNode node_source);
inline void trie_data_destruct(TrNode node);
inline TrEntry trie_open(void);
inline void trie_close(TrEntry trie);
inline void trie_close_all(void);
inline void trie_set_mode(YAP_Int mode);
inline YAP_Int trie_get_mode(void);
inline TrData trie_put_entry(TrEntry trie, YAP_Term entry);
inline TrData trie_check_entry(TrEntry trie, YAP_Term entry);
inline YAP_Term trie_get_entry(TrData data);
inline TrData trie_get_first_entry(TrEntry trie);
inline TrData trie_get_last_entry(TrEntry trie);
inline TrData trie_traverse_init(TrEntry trie, TrData init_data);
inline TrData trie_traverse_cont(TrEntry trie);
inline void trie_remove_entry(TrData data);
inline void trie_remove_subtree(TrData data);
inline void trie_join(TrEntry trie_dest, TrEntry trie_source);
inline void trie_intersect(TrEntry trie_dest, TrEntry trie_source);
inline YAP_Int trie_count_join(TrEntry trie1, TrEntry trie2);
inline YAP_Int trie_count_intersect(TrEntry trie1, TrEntry trie2);
inline void trie_save(TrEntry trie, FILE *file);
inline TrEntry trie_load(FILE *file);
inline void trie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
inline void trie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
inline void trie_usage(TrEntry trie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
inline void trie_print(TrEntry trie);
void trie_init_module(void);
void trie_data_load(TrNode node, YAP_Int depth, FILE *file);
void trie_data_copy(TrNode node_dest, TrNode node_source);
void trie_data_destruct(TrNode node);
TrEntry trie_open(void);
void trie_close(TrEntry trie);
void trie_close_all(void);
void trie_set_mode(YAP_Int mode);
YAP_Int trie_get_mode(void);
TrData trie_put_entry(TrEntry trie, YAP_Term entry);
TrData trie_check_entry(TrEntry trie, YAP_Term entry);
YAP_Term trie_get_entry(TrData data);
TrData trie_get_first_entry(TrEntry trie);
TrData trie_get_last_entry(TrEntry trie);
TrData trie_traverse_init(TrEntry trie, TrData init_data);
TrData trie_traverse_cont(TrEntry trie);
void trie_remove_entry(TrData data);
void trie_remove_subtree(TrData data);
void trie_join(TrEntry trie_dest, TrEntry trie_source);
void trie_intersect(TrEntry trie_dest, TrEntry trie_source);
YAP_Int trie_count_join(TrEntry trie1, TrEntry trie2);
YAP_Int trie_count_intersect(TrEntry trie1, TrEntry trie2);
void trie_save(TrEntry trie, FILE *file);
TrEntry trie_load(FILE *file);
void trie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
void trie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
void trie_usage(TrEntry trie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
void trie_print(TrEntry trie);
inline void trie_data_construct(TrNode node);
inline void trie_set_traverse_mode(YAP_Int mode);
inline YAP_Int trie_get_traverse_mode(void);
inline TrData trie_traverse_first(TrEntry trie);
inline TrData trie_traverse_next(TrData data);
inline void trie_disable_hash_table(void);
inline void trie_enable_hash_table(void);
void trie_data_construct(TrNode node);
void trie_set_traverse_mode(YAP_Int mode);
YAP_Int trie_get_traverse_mode(void);
TrData trie_traverse_first(TrEntry trie);
TrData trie_traverse_next(TrData data);
void trie_disable_hash_table(void);
void trie_enable_hash_table(void);
inline YAP_Term trie_to_list(TrEntry trie);
YAP_Term trie_to_list(TrEntry trie);
#include "base_dbtries.h"

View File

@ -209,10 +209,10 @@
inline void displaynode(TrNode node);
inline int traverse_get_counter(TrNode node);
inline YAP_Term generate_label(YAP_Int Index);
inline YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
inline YAP_Term get_return_node_term(TrNode node);
inline void traverse_and_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
inline TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term);
YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
YAP_Term get_return_node_term(TrNode node);
void traverse_and_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term);
/* -------------------------- */
@ -229,20 +229,20 @@ static YAP_Int TRIE_DEPTH_BREADTH_OPT_COUNT[3];
/* depth-breadth Trie */
/* -------------------------- */
inline
YAP_Int core_get_trie_db_opt_min_prefix(void) {
return TRIE_DEPTH_BREADTH_MIN_PREFIX;
}
inline
void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix) {
TRIE_DEPTH_BREADTH_MIN_PREFIX = min_prefix;
return;
}
inline
void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term) {
traverse_and_replace_nested_trie(node, nested_trie_id, new_term);
return;
@ -350,7 +350,6 @@ void traverse_and_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_T
}
/* fixmeeee */
inline
TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term) {
TrNode newnode, temp, newnodef = NULL;
if (YAP_IsApplTerm(new_term)) {
@ -409,31 +408,31 @@ TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term) {
}
inline
YAP_Term core_get_trie_db_return_term(void) {
return TRIE_DEPTH_BREADTH_RETURN_TERM;
}
inline
void core_set_trie_db_return_term(YAP_Term return_value){
TRIE_DEPTH_BREADTH_RETURN_TERM = return_value;
return;
}
inline
void core_set_label_counter(YAP_Int value) {
LABEL_COUNTER = value; // Initialize the counter
return;
}
inline
YAP_Int core_get_label_counter(void) {
return LABEL_COUNTER;
}
inline
void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node) {
TrNode root = node;
YAP_Functor f;
@ -450,7 +449,7 @@ void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode
}
inline
void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node) {
depth_node = trie_node_check_insert(depth_node, YAP_MkIntTerm(1));
depth_node = trie_node_check_insert(depth_node, PairEndTag);
@ -464,7 +463,7 @@ void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node) {
}
inline
TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void)) {
TrNode leaf = node;
YAP_Term t, *stack_top;
@ -530,7 +529,7 @@ TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP
}
inline
TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void)) {
YAP_Term t, *stack_top;
int count = -1;
@ -760,7 +759,7 @@ YAP_Term generate_label(YAP_Int Index) {
}
inline
YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void)) {
TrNode node = root, remember = NULL;
int count = -1, cnt = -1, c_cnt = 0, f_cnt = 0;
@ -903,7 +902,7 @@ YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_lev
}
inline
YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level) {
return TRIE_DEPTH_BREADTH_OPT_COUNT[opt_level - 1];
}

View File

@ -215,15 +215,15 @@
/* API */
/* --------------------------- */
inline void core_set_label_counter(YAP_Int value);
inline YAP_Int core_get_label_counter(void);
inline void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node);
inline void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node);
inline TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
inline TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
inline YAP_Term core_get_trie_db_return_term(void);
inline void core_set_trie_db_return_term(YAP_Term return_value);
inline YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level);
inline void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
inline YAP_Int core_get_trie_db_opt_min_prefix(void);
inline void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix);
void core_set_label_counter(YAP_Int value);
YAP_Int core_get_label_counter(void);
void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node);
void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node);
TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
YAP_Term core_get_trie_db_return_term(void);
void core_set_trie_db_return_term(YAP_Term return_value);
YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level);
void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
YAP_Int core_get_trie_db_opt_min_prefix(void);
void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix);

View File

@ -49,10 +49,11 @@ static YAP_Term trie_to_list_floats(TrNode node);
/* -------------------------- */
static TrEngine CURRENT_TRIE_ENGINE;
static YAP_Int USAGE_ENTRIES, USAGE_NODES, USAGE_VIRTUAL_NODES;
static YAP_Int CURRENT_AUXILIARY_TERM_STACK_SIZE, CURRENT_TRIE_MODE, CURRENT_LOAD_VERSION, CURRENT_DEPTH, CURRENT_INDEX;
static YAP_Term *AUXILIARY_TERM_STACK;
static YAP_Term *stack_args, *stack_args_base, *stack_vars, *stack_vars_base;
YAP_Term *stack_args, *stack_args_base, *stack_vars, *stack_vars_base;
static YAP_Functor FunctorComma;
static void (*DATA_SAVE_FUNCTION)(TrNode, FILE *);
static void (*DATA_LOAD_FUNCTION)(TrNode, YAP_Int, FILE *);
@ -68,7 +69,7 @@ static YAP_Int TRIE_DISABLE_HASH_TABLE = 0;
/* Inline Procedures */
/* -------------------------- */
static inline
static
TrNode trie_node_check_insert(TrNode parent, YAP_Term t) {
TrNode child;
@ -156,7 +157,7 @@ TrNode trie_node_check_insert(TrNode parent, YAP_Term t) {
}
static inline
static
TrNode trie_node_insert(TrNode parent, YAP_Term t, TrHash hash) {
TrNode child;
@ -180,7 +181,7 @@ TrNode trie_node_insert(TrNode parent, YAP_Term t, TrHash hash) {
}
static inline
static
TrNode trie_node_check(TrNode parent, YAP_Term t) {
TrNode child;
@ -203,7 +204,7 @@ TrNode trie_node_check(TrNode parent, YAP_Term t) {
}
static inline
static
YAP_Term trie_to_list_create_simple(const char *atom_name, TrNode node) {
YAP_Functor f = YAP_MkFunctor(YAP_LookupAtom(atom_name), 1);
YAP_Term child = trie_to_list(TrNode_child(node));
@ -212,7 +213,7 @@ YAP_Term trie_to_list_create_simple(const char *atom_name, TrNode node) {
}
static inline
static
YAP_Term trie_to_list_create_simple_end(const char *atom_name, TrNode node) {
YAP_Atom atom = YAP_LookupAtom(atom_name);
@ -226,7 +227,7 @@ YAP_Term trie_to_list_create_simple_end(const char *atom_name, TrNode node) {
}
static inline
static
YAP_Term trie_to_list_create_two(const char *atom_name, TrNode node, YAP_Term operand) {
YAP_Atom atom = YAP_LookupAtom(atom_name);
@ -247,7 +248,6 @@ YAP_Term trie_to_list_create_two(const char *atom_name, TrNode node, YAP_Term op
/* API */
/* -------------------------- */
inline
TrEngine core_trie_init_module(void) {
static int init_once = 1;
TrEngine engine;
@ -264,7 +264,7 @@ TrEngine core_trie_init_module(void) {
}
inline
TrNode core_trie_open(TrEngine engine) {
TrNode node;
@ -278,7 +278,7 @@ TrNode core_trie_open(TrEngine engine) {
}
inline
void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrNode)) {
CURRENT_TRIE_ENGINE = engine;
DATA_DESTRUCT_FUNCTION = destruct_function;
@ -295,7 +295,7 @@ void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrN
}
inline
void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode)) {
while (TrEngine_trie(engine))
core_trie_close(engine, TrEngine_trie(engine), destruct_function);
@ -303,20 +303,20 @@ void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode)) {
}
inline
void core_trie_set_mode(YAP_Int mode) {
CURRENT_TRIE_MODE = mode;
return;
}
inline
YAP_Int core_trie_get_mode(void) {
return CURRENT_TRIE_MODE;
}
inline
TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int *depth) {
CURRENT_TRIE_ENGINE = engine;
CURRENT_DEPTH = 0;
@ -338,7 +338,7 @@ TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int
}
inline
TrNode core_trie_check_entry(TrNode node, YAP_Term entry) {
if (!TrNode_child(node))
return NULL;
@ -354,7 +354,7 @@ TrNode core_trie_check_entry(TrNode node, YAP_Term entry) {
}
inline
YAP_Term core_trie_get_entry(TrNode node) {
CURRENT_INDEX = -1;
stack_vars_base = stack_vars = AUXILIARY_TERM_STACK;
@ -363,7 +363,7 @@ YAP_Term core_trie_get_entry(TrNode node) {
}
inline
void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_function)(TrNode)) {
CURRENT_TRIE_ENGINE = engine;
DATA_DESTRUCT_FUNCTION = destruct_function;
@ -375,7 +375,7 @@ void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_functi
}
inline
void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_function)(TrNode)) {
TrNode parent;
@ -388,7 +388,7 @@ void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_func
}
inline
void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode)) {
DATA_ADD_FUNCTION = add_function;
if (TrNode_child(node_dest) && TrNode_child(node_source))
@ -397,7 +397,7 @@ void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(Tr
}
inline
void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*copy_function)(TrNode, TrNode)) {
CURRENT_TRIE_ENGINE = engine;
DATA_ADD_FUNCTION = add_function;
@ -411,7 +411,7 @@ void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void
}
inline
void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*destruct_function)(TrNode)) {
CURRENT_TRIE_ENGINE = engine;
DATA_ADD_FUNCTION = add_function;
@ -428,7 +428,7 @@ void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source,
}
inline
YAP_Int core_trie_count_join(TrNode node1, TrNode node2) {
YAP_Int count = 0;
@ -444,7 +444,7 @@ YAP_Int core_trie_count_join(TrNode node1, TrNode node2) {
}
inline
YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2) {
YAP_Int count = 0;
@ -455,7 +455,7 @@ YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2) {
}
inline
void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE *)) {
CURRENT_INDEX = -1;
DATA_SAVE_FUNCTION = save_function;
@ -469,7 +469,7 @@ void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE
}
inline
TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode, YAP_Int, FILE *)) {
TrNode node;
char version[15];
@ -523,7 +523,7 @@ TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode,
}
inline
void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
*memory = TrEngine_memory(engine);
*tries = TrEngine_tries(engine);
@ -533,7 +533,7 @@ void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *
}
inline
void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
*memory = TrEngine_memory_max(engine);
*tries = TrEngine_tries_max(engine);
@ -543,7 +543,7 @@ void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_I
}
inline
void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes) {
USAGE_ENTRIES = 0;
USAGE_NODES = 0;
@ -557,7 +557,7 @@ void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *vir
}
inline
void core_trie_print(TrNode node, void (*print_function)(TrNode)) {
DATA_PRINT_FUNCTION = print_function;
if (TrNode_child(node)) {
@ -572,19 +572,19 @@ void core_trie_print(TrNode node, void (*print_function)(TrNode)) {
}
inline
void core_disable_hash_table(void) {
TRIE_DISABLE_HASH_TABLE = 1;
}
inline
void core_enable_hash_table(void) {
TRIE_DISABLE_HASH_TABLE = 0;
}
inline
YAP_Term core_trie_to_list(TrNode node) {
TrNode root = TrNode_child(node);
@ -1724,7 +1724,7 @@ YAP_Term trie_to_list_node(TrNode node) {
#ifdef TAG_LOW_BITS_32
static inline
YAP_Term trie_to_list_floats_tag_low_32(YAP_Term result, TrNode node, volatile YAP_Term *p, volatile double *f) {
if(IS_HASH_NODE(node)) {
TrNode *first_bucket, *bucket;

View File

@ -287,32 +287,32 @@ typedef struct trie_hash {
/* API */
/* --------------------------- */
inline TrEngine core_trie_init_module(void);
inline TrNode core_trie_open(TrEngine engine);
inline void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
inline void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode));
inline void core_trie_set_mode(YAP_Int mode);
inline YAP_Int core_trie_get_mode(void);
inline TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int *depth);
inline TrNode core_trie_check_entry(TrNode node, YAP_Term entry);
inline YAP_Term core_trie_get_entry(TrNode node);
inline void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
inline void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
inline void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode));
inline void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*copy_function)(TrNode, TrNode));
inline void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*destruct_function)(TrNode));
inline YAP_Int core_trie_count_join(TrNode node1, TrNode node2);
inline YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2);
inline void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE *));
inline TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode, YAP_Int, FILE *));
inline void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
inline void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
inline void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
inline void core_trie_print(TrNode node, void (*print_function)(TrNode));
TrEngine core_trie_init_module(void);
TrNode core_trie_open(TrEngine engine);
void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode));
void core_trie_set_mode(YAP_Int mode);
YAP_Int core_trie_get_mode(void);
TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int *depth);
TrNode core_trie_check_entry(TrNode node, YAP_Term entry);
YAP_Term core_trie_get_entry(TrNode node);
void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode));
void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*copy_function)(TrNode, TrNode));
void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*destruct_function)(TrNode));
YAP_Int core_trie_count_join(TrNode node1, TrNode node2);
YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2);
void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE *));
TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode, YAP_Int, FILE *));
void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
void core_trie_print(TrNode node, void (*print_function)(TrNode));
inline void core_disable_hash_table(void);
inline void core_enable_hash_table(void);
void core_disable_hash_table(void);
void core_enable_hash_table(void);
inline YAP_Term core_trie_to_list(TrNode node);
YAP_Term core_trie_to_list(TrNode node);
#include "core_dbtries.h"

View File

@ -903,7 +903,7 @@ static int p_trie_get_db_opt_level_count_cont(void) {
YAP_PRESERVED_DATA(opt_level, db_trie_opt_level);
opt_level->value = YAP_MkIntTerm(YAP_IntOfTerm(opt_level->value) + 1);
if (YAP_IntOfTerm(opt_level->value) < 4) {
if (YAP_Unify(arg_opt_level, opt_level->value));
if (YAP_Unify(arg_opt_level, opt_level->value))
return YAP_Unify(arg_count, YAP_MkIntTerm(trie_get_db_opt_level_count(YAP_IntOfTerm(arg_opt_level))));
YAP_cut_fail();
return FALSE;

View File

@ -242,6 +242,7 @@ rewritable_field(0't).
get_op(0'a,"Arity").
get_op(0'A,"Atom").
get_op(0'b,"CellPtoHeap").
get_op(0'c,"ConstantTerm").
get_op(0'd,"DoubleInCode").

View File

@ -347,8 +347,7 @@ void
Yap_setCurrentSourceLocation(IOSTREAM **s)
{
GET_LD
if (!*s)
*s = Suser_input;
if (*s)
setCurrentSourceLocation(*s PASS_LD);
}
#endif

@ -1 +1 @@
Subproject commit 7984859c5739a7af6564fb890a28c32a98aa727e
Subproject commit 9e22ca88f2fc1e0bd32cad5ac5a904e973f394b5

104
packages/bdd/configure.in Normal file
View File

@ -0,0 +1,104 @@
AC_ARG_WITH(cudd,
[ --with-cudd[=DIR] use CUDD package in DIR],
yap_cv_cudd="$withval",
[yap_cv_cudd=no])
if test "$yap_cv_cudd" = no
then
ENABLE_CUDD="@# "
ENABLE_BDDLIB="@# "
else
if test "$dynamic_bdd" = yes
then
ENABLE_BDDLIB=""
else
ENABLE_BDDLIB="@# "
fi
ENABLE_CUDD=""
fi
if test "$yap_cv_cudd" != no; then
oldlibs="$LIBS"
if test "$yap_cv_cudd" != "NONE" -a "$yap_cv_cudd" != "yes"; then
CUDD_CPPFLAGS="-I $yap_cv_cudd/include"
cudd_dir="$yap_cv_cudd"
elif test "$prefix" != "NONE"; then
CUDD_CPPFLAGS="-I $prefix/include"
cudd_dir="$prefix"
else
CUDD_CPPFLAGS="-I /usr/local/include"
cudd_dir=/usr/local
fi
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $CUDD_CPPFLAGS"
AC_CHECK_HEADERS(util.h cudd/util.h cudd.h cudd/cudd.h)
AC_CHECK_HEADERS(cuddInt.h cudd/cuddInt.h)
dnl cudd can be most everywhere
if test -d "$cudd_dir/lib64/cudd" -a "$YAP_TARGET" = amd64; then
LIBS="$LIBS -L $cudd_dir/lib64/cudd"
elif test -d "$cudd_dir/lib64" -a "$YAP_TARGET" = amd64; then
LIBS="$LIBS -L $cudd_dir/lib64 -L $cudd_dir/lib"
elif test -d "$cudd_dir/lib/cudd"; then
LIBS="$LIBS -L $cudd_dir/lib/cudd"
elif test -d "$cudd_dir/lib"; then
LIBS="$LIBS -L $cudd_dir/lib"
fi
if test -d "$cudd_dir/util"; then
LIBS="$LIBS -L $cudd_dir/util"
fi
AC_SEARCH_LIBS(util_print_cpu_stats, [cuddutil util])
if test -d "$cudd_dir/st"; then
LIBS="$LIBS -L $cudd_dir/st"
fi
AC_SEARCH_LIBS(st_insert, [cuddst st])
if test -d "$cudd_dir/epd"; then
LIBS="$LIBS -L $cudd_dir/epd"
fi
AC_SEARCH_LIBS(EpdAdd, [epd])
if test -d "$cudd_dir/mtr"; then
LIBS="$LIBS -L $cudd_dir/mtr"
fi
AC_SEARCH_LIBS(Mtr_InitTree, [mtr])
if test -d "$cudd_dir/cudd"; then
LIBS="$LIBS -L $cudd_dir/cudd"
fi
AC_SEARCH_LIBS(Cudd_Init, [cudd], [cudd_installed="yes"], [cudd_installed="no"])
CPPFLAGS="$OLD_CPPFLAGS"
if test "$cudd_installed" = yes; then
CUDD_LDFLAGS="$LIBS"
else
cat << EOF
##################################################################
# ERROR: Could not find cudd library. Either I don't have the
# correct path, or CUDD is installed in some strange way
##################################################################
EOF
fi
LIBS="$oldlibs"
fi
AC_SUBST(ENABLE_CUDD)
AC_SUBST(ENABLE_BDDLIB)
AC_SUBST(CUDD_LDFLAGS)
AC_SUBST(CUDD_CPPFLAGS)

@ -1 +1 @@
Subproject commit bd7973d4bff21af39e5f8efdc377c0a2eb2d594f
Subproject commit fe49dc72a077b8f853fa2fb42661bd79a8c6aa00

@ -1 +1 @@
Subproject commit b813923455e5efb2b55770699b84411c6dd37952
Subproject commit 759a537c5937e7ca5eccc4f786b5e2eaf516a91a

View File

@ -0,0 +1,47 @@
AC_ARG_WITH(cuda,
[ --enable-cuda use minisat interface],
if test "$withval" = yes; then
yap_cv_cuda=/usr
elif test "$withval" = no; then
yap_cv_cuda=no
else
yap_cv_cuda="$withval"
fi,
[yap_cv_cuda=no])
CUDA_LDFLAGS=""
CUDA_CPPFLAGS=""
if test "$yap_cv_cuda" = no
then
ENABLE_CUDA="@# "
else
AC_PATH_PROG(NVCC, [nvcc], [no], [$yap_cv_cuda/bin])
if test "$yap_cv_cuda" = no
then
ENABLE_CUDA="@# "
else
ENABLE_CUDA=""
case "$target_os" in
*darwin*)
CUDA_LDFLAGS="$LDFLAGS"
CUDA_CPPFLAGS="-arch=sm_20 -Xcompiler -fPIC -O3 "
CUDA_SHLIB_LD="$NVCC -Xcompiler -dynamiclib -L../.. -lYap "
;;
**)
CUDA_LDFLAGS="$LDFLAGS $LIBS"
CUDA_CPPFLAGS=" -arch=sm_20 -Xcompiler -fPIC -O3 "
CUDA_SHLIB_LD="$NVCC -Xcompiler -export-dynamic"
;;
esac
fi
fi
AC_SUBST(ENABLE_CUDA)
AC_SUBST(NVCC)
AC_SUBST(CUDA_SHLIB_LD)
AC_SUBST(CUDA_CPPFLAGS)
AC_SUBST(CUDA_LDFLAGS)
AC_CONFIG_FILES([packages/cuda/Makefile])

View File

@ -926,7 +926,7 @@ int Cuda_Eval(predicate **inpfacts, int ninpf, predicate **inprules, int ninpr,
fin = rules.end();
nombres(rul_str, fin); /*preprocessing*/
movebpreds(rul_str, fin);
//movebpreds(rul_str, fin);
referencias(L.begin(), L.end(), rul_str, fin);
seleccion(rul_str, fin);
selfjoin(rul_str, fin);
@ -984,7 +984,7 @@ int Cuda_Eval(predicate **inpfacts, int ninpf, predicate **inprules, int ninpr,
rows1 = cargar(name1, filas1, cols1, isfact1, table1, &dop1, itr);
//cout << "rows1 = " << rows1 << endl;
// cout << "rows1 = " << rows1 << endl;
if(rows1 == 0)
{
@ -1012,7 +1012,6 @@ int Cuda_Eval(predicate **inpfacts, int ninpf, predicate **inprules, int ninpr,
{
/*int x, y;
cout << "antes = " << cols1 << " " << rows1 << endl;
int *hop1 = (int *)malloc(cols1 * rows1 * sizeof(int));
cudaMemcpy(hop1, dop1, cols1 * rows1 * sizeof(int), cudaMemcpyDeviceToHost);
for(x = 0; x < rows1; x++)
@ -1086,6 +1085,27 @@ int Cuda_Eval(predicate **inpfacts, int ninpf, predicate **inprules, int ninpr,
num_refs = rul_act->num_rows - 1;
for(x = 2; x < num_refs; x++)
{
if (rul_act->address_host_table[x] < 0) {
#ifdef TIMER
cudaEvent_t start3, stop3;
cudaEventCreate(&start3);
cudaEventCreate(&stop3);
cudaEventRecord(start3, 0);
#endif
res_rows = bpreds(res, res_rows, rul_act->projpos[x-2].y, rul_act->builtin, rul_act->num_bpreds, &res);
#ifdef TIMER
cudaEventRecord(stop3, 0);
cudaEventSynchronize(stop3);
cudaEventElapsedTime(&time, start3, stop3);
cudaEventDestroy(start3);
cudaEventDestroy(stop3);
//cout << "Predicados = " << time << endl;
cuda_stats.pred_time += time;
#endif
continue;
}
tipo = rul_act->referencias[x];
if(tipo < 0)
{
@ -1108,42 +1128,43 @@ int Cuda_Eval(predicate **inpfacts, int ninpf, predicate **inprules, int ninpr,
rows2 = cargar(name2, filas2, cols2, isfact2, table2, &dop2, itr);
//cout << "rows = " << x << " " << rows2 << endl;
//out << "rows = " << x << " " << rows2 << endl;
if(rows2 == 0)
break;
cout << x << ": join = " << res_rows << "/" << rul_act->projpos[x-2].y << " " << rows2 << "/" << cols2 << endl;
res_rows = join(res, dop2, res_rows, rows2, rul_act->projpos[x-2].y, cols2, rul_act, x-1, 0, &res);
if(res_rows == 0)
break;
//cout << "resrows = " << res_rows << endl;
cout << x << ": resrows before = " << res_rows << " cols = " << rul_act->projpos[x-1].y << endl;
if (x < num_refs-1 && res_rows > 32) {
#ifdef TIMER
cudaEvent_t start2, stop2;
cudaEventCreate(&start2);
cudaEventCreate(&stop2);
cudaEventRecord(start2, 0);
#endif
res_rows = unir(res, res_rows, rul_act->projpos[x-1].y); /*Duplicate Elimination*/
#ifdef TIMER
cudaEventRecord(stop2, 0);
cudaEventSynchronize(stop2);
cudaEventElapsedTime(&time, start2, stop2);
cudaEventDestroy(start2);
cudaEventDestroy(stop2);
//cout << "Union = " << time << endl;
cuda_stats.union_time += time;
#endif
cout << "resrows after = " << res_rows << endl;
}
}
if(x == num_refs)
{
if(rul_act->num_bpreds.x > 0) /*Built-in predicates*/
{
#ifdef TIMER
cudaEvent_t start3, stop3;
cudaEventCreate(&start3);
cudaEventCreate(&stop3);
cudaEventRecord(start3, 0);
#endif
res_rows = bpreds(res, res_rows, rul_act->num_columns, rul_act->builtin, rul_act->num_bpreds, &res);
#ifdef TIMER
cudaEventRecord(stop3, 0);
cudaEventSynchronize(stop3);
cudaEventElapsedTime(&time, start3, stop3);
cudaEventDestroy(start3);
cudaEventDestroy(stop3);
//cout << "Predicados = " << time << endl;
cuda_stats.pred_time += time;
#endif
}
//cout << "antes de unir = " << res_rows << endl;
#ifdef TIMER

View File

@ -861,11 +861,11 @@ int join(int *p1, int *p2, int rLen, int sLen, int of1, int of2, list<rulenode>:
memSizeS = newLen * sizeof(int);
reservar(&d_S, memSizeS);
#ifdef DEBUG_MEM
#if DEBUG_MEM
cerr << "+ " << d_S << " d_S " << memSizeS << endl;
#endif
reservar(&posS, memSizeS);
#ifdef DEBUG_MEM
#if DEBUG_MEM
cerr << "+ " << posS << " posS " << memSizeS << endl;
#endif
llenar<<<blockllen, numthreads>>>(p2, d_S, sLen, of2, wherej[1], temp, posS);

View File

@ -13,6 +13,26 @@ typedef struct n3
int v[3];
}s3;
typedef struct n4
{
int v[4];
}s4;
typedef struct n5
{
int v[5];
}s5;
typedef struct n6
{
int v[6];
}s6;
typedef struct n7
{
int v[7];
}s7;
struct p2
{
__host__ __device__
@ -77,13 +97,136 @@ struct o3
}
};
struct p4
{
__host__ __device__
bool operator()(const s4 &r1, const s4 &r2)
{
int x;
for(x = 0; x < 4; x++)
{
if(r1.v[x] != r2.v[x])
return false;
}
return true;
}
};
struct o4
{
__host__ __device__
bool operator()(const s4 &r1, const s4 &r2)
{
int x;
for(x = 0; x < 4; x++)
{
if(r1.v[x] > r2.v[x])
return true;
if(r1.v[x] < r2.v[x])
return false;
}
return false;
}
};
struct p5
{
__host__ __device__
bool operator()(const s5 &r1, const s5 &r2)
{
int x;
for(x = 0; x < 5; x++)
{
if(r1.v[x] != r2.v[x])
return false;
}
return true;
}
};
struct o5
{
__host__ __device__
bool operator()(const s5 &r1, const s5 &r2)
{
int x;
for(x = 0; x < 5; x++)
{
if(r1.v[x] > r2.v[x])
return true;
if(r1.v[x] < r2.v[x])
return false;
}
return false;
}
};
struct p6
{
__host__ __device__
bool operator()(const s6 &r1, const s6 &r2)
{
int x;
for(x = 0; x < 6; x++)
{
if(r1.v[x] != r2.v[x])
return false;
}
return true;
}
};
struct o6
{
__host__ __device__
bool operator()(const s6 &r1, const s6 &r2)
{
int x;
for(x = 0; x < 6; x++)
{
if(r1.v[x] > r2.v[x])
return true;
if(r1.v[x] < r2.v[x])
return false;
}
return false;
}
};
struct p7
{
__host__ __device__
bool operator()(const s7 &r1, const s7 &r2)
{
int x;
for(x = 0; x < 7; x++)
{
if(r1.v[x] != r2.v[x])
return false;
}
return true;
}
};
struct o7
{
__host__ __device__
bool operator()(const s7 &r1, const s7 &r2)
{
int x;
for(x = 0; x < 7; x++)
{
if(r1.v[x] > r2.v[x])
return true;
if(r1.v[x] < r2.v[x])
return false;
}
return false;
}
};
int unir(int *res, int rows, int tipo)
{
thrust::device_ptr<int> pt, re;
thrust::device_ptr<s2> pt2, re2;
thrust::device_ptr<s3> pt3, re3;
s2 *t2;
s3 *t3;
int flag, nrows;
#if TIMER
@ -93,6 +236,8 @@ int unir(int *res, int rows, int tipo)
{
case 1:
{
thrust::device_ptr<int> pt, re;
pt = thrust::device_pointer_cast(res);
flag = 0;
while(flag != 1)
@ -116,6 +261,8 @@ int unir(int *res, int rows, int tipo)
}
case 2:
{
thrust::device_ptr<s2> pt2, re2;
s2 *t2;
t2 = (s2*)res;
/*int *a, x, y;
@ -169,6 +316,8 @@ int unir(int *res, int rows, int tipo)
}
case 3:
{
thrust::device_ptr<s3> pt3, re3;
s3 *t3;
t3 = (s3*)res;
pt3 = thrust::device_pointer_cast(t3);
flag = 0;
@ -191,6 +340,113 @@ int unir(int *res, int rows, int tipo)
iVec.shrink_to_fit();
return nrows;
}
case 4:
{
thrust::device_ptr<s4> pt4, re4;
s4 *t4;
t4 = (s4*)res;
pt4 = thrust::device_pointer_cast(t4);
flag = 0;
while(flag != 1)
{
try
{
thrust::sort(pt4, pt4 + rows, o4());
re4 = thrust::unique(pt4, pt4 + rows, p4());
flag = 1;
}
catch(std::bad_alloc &e)
{
limpiar("sort/unique in unir", 0);
}
}
nrows = thrust::distance(pt4, re4);
thrust::device_vector<s4> iVec(pt4, pt4 + rows);
iVec.resize(nrows);
iVec.shrink_to_fit();
return nrows;
}
case 5:
{
thrust::device_ptr<s5> pt5, re5;
s5 *t5;
t5 = (s5*)res;
pt5 = thrust::device_pointer_cast(t5);
flag = 0;
while(flag != 1)
{
try
{
thrust::sort(pt5, pt5 + rows, o5());
re5 = thrust::unique(pt5, pt5 + rows, p5());
flag = 1;
}
catch(std::bad_alloc &e)
{
limpiar("sort/unique in unir", 0);
}
}
nrows = thrust::distance(pt5, re5);
thrust::device_vector<s5> iVec(pt5, pt5 + rows);
iVec.resize(nrows);
iVec.shrink_to_fit();
return nrows;
}
case 6:
{
thrust::device_ptr<s6> pt6, re6;
s6 *t6;
t6 = (s6*)res;
pt6 = thrust::device_pointer_cast(t6);
flag = 0;
while(flag != 1)
{
try
{
thrust::sort(pt6, pt6 + rows, o6());
re6 = thrust::unique(pt6, pt6 + rows, p6());
flag = 1;
}
catch(std::bad_alloc &e)
{
limpiar("sort/unique in unir", 0);
}
}
nrows = thrust::distance(pt6, re6);
thrust::device_vector<s6> iVec(pt6, pt6 + rows);
iVec.resize(nrows);
iVec.shrink_to_fit();
return nrows;
}
case 7:
{
thrust::device_ptr<s7> pt7, re7;
s7 *t7;
t7 = (s7*)res;
pt7 = thrust::device_pointer_cast(t7);
flag = 0;
while(flag != 1)
{
try
{
thrust::sort(pt7, pt7 + rows, o7());
re7 = thrust::unique(pt7, pt7 + rows, p7());
flag = 1;
}
catch(std::bad_alloc &e)
{
limpiar("sort/unique in unir", 0);
}
}
nrows = thrust::distance(pt7, re7);
thrust::device_vector<s7> iVec(pt7, pt7 + rows);
iVec.resize(nrows);
iVec.shrink_to_fit();
return nrows;
}
default:
cerr << "Union: " << tipo << " columns are too many." << endl;
exit(1);
}
return 0;
}

View File

@ -0,0 +1,87 @@
dnl Gecode support
dnl gecode is usually in /usr/local
if test -d /usr/local/include/gecode; then
CFLAGS="$CFLAGS -I/usr/local/include"
SHLIB_CXXFLAGS="$SHLIB_CXXFLAGS -I/usr/local/include"
GECODE_EXTRALIBS="-L/usr/local/lib"
fi
AC_CHECK_HEADER(gecode/support/config.hpp,
have_gecode=yes, have_gecode=no)
AC_ARG_ENABLE(gecode,
[ --enable-gecode install gecode library],
[use_gecode="$enableval"
if test "$use_gecode" = yes; then
if test "$have_gecode" = no; then
AC_MSG_ERROR([cannot enable gecode: gecode library not found])
fi
fi], use_gecode=$have_gecode)
if test "$use_gecode" = no; then
ENABLE_GECODE="@# "
else
ENABLE_GECODE=""
fi
AC_SUBST(ENABLE_GECODE)
AC_MSG_CHECKING([if dynamic arrays are supported])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[void foo(int n) { int a[n]; a[1]=0; }]],[[foo(3);]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DYNARRAY],[1],[Define if dynamic arrays are supported])
],[
AC_MSG_RESULT([no])
])
GECODE_VERSION=unknown-gecode-version
if test "$use_gecode" = yes; then
AC_MSG_CHECKING([gecode version])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include "gecode/support/config.hpp"
#include <stdio.h>
]],[[
FILE* out = fopen("conftest.out","w");
fprintf(out,"%s\n",GECODE_VERSION);
fclose(out);
return 0;
]])],[GECODE_VERSION=$(cat conftest.out)
AC_MSG_RESULT([$GECODE_VERSION])],
[AC_MSG_ERROR([cannot determine gecode version])])
case "$target_os" in
*darwin*)
AC_MSG_CHECKING([if -framework gecode is required])
AC_LANG_PUSH([C++])
saved_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -framework gecode"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "gecode/int.hh"
]],[[
Gecode::Exception e("","");
return 0;
]])],[GECODE_EXTRALIBS="-framework gecode"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_LANG_POP()
CXXFLAGS="$saved_CXXFLAGS"
;;
esac
fi
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
AC_SUBST(GECODE_MAJOR)
if test "$GECODE_MAJOR" = "3"; then
GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch"
else
GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodefloat -lgecodeint -lgecodeset -lgecodesearch"
fi
AC_SUBST(GECODE_VERSION)
AC_SUBST(GECODE_EXTRALIBS)

Some files were not shown because too many files have changed in this diff Show More