diff --git a/C/modules.c b/C/modules.c index 27d16502e..6cc697c4a 100644 --- a/C/modules.c +++ b/C/modules.c @@ -263,6 +263,62 @@ p_strip_module( USES_REGS1 ) Yap_unify(ARG2, tmod); } +static Term +Yap_YapStripModule(Term t, Term *modp) +{ + CACHE_REGS + Term tmod; + + if (modp) + tmod = *modp; + else { + tmod = CurrentModule; + if (tmod == PROLOG_MODULE) { + tmod = TermProlog; + } + } + restart: + if (IsVarTerm(t) || !IsApplTerm(t)) { + if (modp) + *modp = tmod; + return t; + } else { + Functor fun = FunctorOfTerm(t); + if (fun == FunctorModule) { + Term t1 = ArgOfTerm(1, t); + tmod = t1; + if (!IsVarTerm(tmod) && !IsAtomTerm(tmod) ) { + return 0L; + } + t = ArgOfTerm(2, t); + goto restart; + } + if (modp) + *modp = tmod; + return t; + } + return 0L; +} + + + + +static Int +p_yap_strip_module( USES_REGS1 ) +{ + Term t1 = Deref(ARG1), tmod = CurrentModule; + if (tmod == PROLOG_MODULE) { + tmod = TermProlog; + } + t1 = Yap_YapStripModule( t1, &tmod ); + if (!t1) { + Yap_Error(TYPE_ERROR_CALLABLE,ARG1,"trying to obtain module"); + return FALSE; + } + return Yap_unify(ARG3, t1) && + Yap_unify(ARG2, tmod); +} + static Int p_context_module( USES_REGS1 ) { @@ -335,6 +391,7 @@ Yap_InitModulesC(void) Yap_InitCPred("$current_module", 1, p_current_module1, SafePredFlag|SyncPredFlag); Yap_InitCPred("$change_module", 1, p_change_module, SafePredFlag|SyncPredFlag); Yap_InitCPred("strip_module", 3, p_strip_module, SafePredFlag|SyncPredFlag); + Yap_InitCPred("$yap_strip_module", 3, p_yap_strip_module, SafePredFlag|SyncPredFlag); Yap_InitCPred("context_module", 1, p_context_module, 0); Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module, cont_current_module, SafePredFlag|SyncPredFlag); diff --git a/config.h.in b/config.h.in index cfb3113f7..3dc2b2005 100644 --- a/config.h.in +++ b/config.h.in @@ -673,6 +673,9 @@ /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T +/* Define to 1 if you have the header file. */ +#undef HAVE_SQLITE3_H + /* Define to 1 if the system has the type `SQLLEN'. */ #undef HAVE_SQLLEN diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index 8336747f9..e302b2e4c 100755 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -145,7 +145,7 @@ typedef struct pred_entry *predicate_t; typedef struct open_query_struct *qid_t; typedef uintptr_t functor_t; typedef int (*PL_agc_hook_t)(atom_t); -typedef unsigned long foreign_t; /* return type of foreign functions */ +typedef uintptr_t foreign_t; /* return type of foreign functions */ typedef wchar_t pl_wchar_t; /* wide character support */ #include /* more portable than stdint.h */ #if !defined(_MSC_VER) diff --git a/include/YapDefs.h b/include/YapDefs.h index 47f50f866..2e94e9512 100755 --- a/include/YapDefs.h +++ b/include/YapDefs.h @@ -244,9 +244,11 @@ Int Yap_InitDefaults( YAP_init_args *init_args, char saved_state[] ); /* this should be opaque to the user */ typedef struct { - unsigned long b; - YAP_Int CurSlot; - struct yami *p, *cp; + unsigned long b; //> choice-point at entry + YAP_Int CurSlot; //> variables at entry + YAP_Int EndSlot; //> variables at successful execution + struct yami *p; //> Program Counter at entry + struct yami *cp; //> Continuation PC at entry } YAP_dogoalinfo; diff --git a/misc/mkandroid b/misc/mkandroid index 221a9ae1d..3071a45dd 100755 --- a/misc/mkandroid +++ b/misc/mkandroid @@ -119,6 +119,7 @@ cd $BUILDDROID if test x$1 = xmake then + ./config.status make -j install rm -r packages/swig/android elif test x$1 = xenv @@ -133,7 +134,7 @@ else startemulator rm -rf "$BUILDDROID"/* cd "$BUILDDROID" - "$YAP_SRC"/configure --host="$ANDROID_ARCH"-linux-androideabi --prefix=`pwd` --enable-low-level-tracer --enable-debug-yap --enable-dynamic-loading --with-swig --with-gmp=$GMPDIR --disable-chr #--enable-threads + "$YAP_SRC"/configure --host="$ANDROID_ARCH"-linux-androideabi --prefix=`pwd` --enable-low-level-tracer --enable-debug-yap --enable-dynamic-loading --with-swig --with-gmp=$GMPDIR --with-sqlite=no --disable-chr #--enable-threads make depend make -j install fi diff --git a/pl/preds.yap b/pl/preds.yap index 596f48af2..95ba83944 100644 --- a/pl/preds.yap +++ b/pl/preds.yap @@ -847,6 +847,8 @@ predicate_property(Pred,Prop) :- '$is_multifile'(P,M). '$predicate_property'(P,M,_,public) :- '$is_public'(P,M). +'$predicate_property'(P,M,_,thread_local) :- + '$is_thread_local'(P,M). '$predicate_property'(P,M,M,exported) :- functor(P,N,A), once(recorded('$module','$module'(_TFN,M,Publics,_L),_)), @@ -931,12 +933,12 @@ system_predicate(P) :- '$pred_exists'(T,M). current_predicate(F0) :- - strip_module(F0, M, F), + '$yap_strip_module'(F0, M, F), '$$current_predicate'(F, M). '$$current_predicate'(F, M) :- ( var(M) -> % only for the predicate - '$current_module'(M) + '$all_current_modules'(M) ; true), M \= prolog, '$current_predicate3'(F,M).