more android support changes.

This commit is contained in:
Vítor Santos Costa 2014-07-16 11:56:09 -05:00
parent f37806d7cc
commit 2becb15578
6 changed files with 72 additions and 7 deletions

View File

@ -263,6 +263,62 @@ p_strip_module( USES_REGS1 )
Yap_unify(ARG2, tmod); 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 static Int
p_context_module( USES_REGS1 ) p_context_module( USES_REGS1 )
{ {
@ -335,6 +391,7 @@ Yap_InitModulesC(void)
Yap_InitCPred("$current_module", 1, p_current_module1, SafePredFlag|SyncPredFlag); Yap_InitCPred("$current_module", 1, p_current_module1, SafePredFlag|SyncPredFlag);
Yap_InitCPred("$change_module", 1, p_change_module, SafePredFlag|SyncPredFlag); Yap_InitCPred("$change_module", 1, p_change_module, SafePredFlag|SyncPredFlag);
Yap_InitCPred("strip_module", 3, p_strip_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_InitCPred("context_module", 1, p_context_module, 0);
Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module, cont_current_module, Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module, cont_current_module,
SafePredFlag|SyncPredFlag); SafePredFlag|SyncPredFlag);

View File

@ -673,6 +673,9 @@
/* Define to 1 if the system has the type `socklen_t'. */ /* Define to 1 if the system has the type `socklen_t'. */
#undef HAVE_SOCKLEN_T #undef HAVE_SOCKLEN_T
/* Define to 1 if you have the <sqlite3.h> header file. */
#undef HAVE_SQLITE3_H
/* Define to 1 if the system has the type `SQLLEN'. */ /* Define to 1 if the system has the type `SQLLEN'. */
#undef HAVE_SQLLEN #undef HAVE_SQLLEN

View File

@ -145,7 +145,7 @@ typedef struct pred_entry *predicate_t;
typedef struct open_query_struct *qid_t; typedef struct open_query_struct *qid_t;
typedef uintptr_t functor_t; typedef uintptr_t functor_t;
typedef int (*PL_agc_hook_t)(atom_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 */ typedef wchar_t pl_wchar_t; /* wide character support */
#include <inttypes.h> /* more portable than stdint.h */ #include <inttypes.h> /* more portable than stdint.h */
#if !defined(_MSC_VER) #if !defined(_MSC_VER)

View File

@ -244,9 +244,11 @@ Int Yap_InitDefaults( YAP_init_args *init_args, char saved_state[] );
/* this should be opaque to the user */ /* this should be opaque to the user */
typedef struct { typedef struct {
unsigned long b; unsigned long b; //> choice-point at entry
YAP_Int CurSlot; YAP_Int CurSlot; //> variables at entry
struct yami *p, *cp; YAP_Int EndSlot; //> variables at successful execution
struct yami *p; //> Program Counter at entry
struct yami *cp; //> Continuation PC at entry
} YAP_dogoalinfo; } YAP_dogoalinfo;

View File

@ -119,6 +119,7 @@ cd $BUILDDROID
if test x$1 = xmake if test x$1 = xmake
then then
./config.status
make -j install make -j install
rm -r packages/swig/android rm -r packages/swig/android
elif test x$1 = xenv elif test x$1 = xenv
@ -133,7 +134,7 @@ else
startemulator startemulator
rm -rf "$BUILDDROID"/* rm -rf "$BUILDDROID"/*
cd "$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 depend
make -j install make -j install
fi fi

View File

@ -847,6 +847,8 @@ predicate_property(Pred,Prop) :-
'$is_multifile'(P,M). '$is_multifile'(P,M).
'$predicate_property'(P,M,_,public) :- '$predicate_property'(P,M,_,public) :-
'$is_public'(P,M). '$is_public'(P,M).
'$predicate_property'(P,M,_,thread_local) :-
'$is_thread_local'(P,M).
'$predicate_property'(P,M,M,exported) :- '$predicate_property'(P,M,M,exported) :-
functor(P,N,A), functor(P,N,A),
once(recorded('$module','$module'(_TFN,M,Publics,_L),_)), once(recorded('$module','$module'(_TFN,M,Publics,_L),_)),
@ -931,12 +933,12 @@ system_predicate(P) :-
'$pred_exists'(T,M). '$pred_exists'(T,M).
current_predicate(F0) :- current_predicate(F0) :-
strip_module(F0, M, F), '$yap_strip_module'(F0, M, F),
'$$current_predicate'(F, M). '$$current_predicate'(F, M).
'$$current_predicate'(F, M) :- '$$current_predicate'(F, M) :-
( var(M) -> % only for the predicate ( var(M) -> % only for the predicate
'$current_module'(M) '$all_current_modules'(M)
; true), ; true),
M \= prolog, M \= prolog,
'$current_predicate3'(F,M). '$current_predicate3'(F,M).