droid
This commit is contained in:
parent
31fd3eb344
commit
2e9be3d0d4
@ -1452,11 +1452,10 @@ X_API Term YAP_ReadBuffer(const char *s, Term *tp) {
|
||||
if (*tp)
|
||||
tv = *tp;
|
||||
else
|
||||
tv = 0;
|
||||
tv = (Term)0;
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
const unsigned char *us = (const unsigned char *)s;
|
||||
while (!(t = Yap_BufferToTermWithPrioBindings(us, strlen(s) + 1, TermNil,
|
||||
GLOBAL_MaxPriority, tv))) {
|
||||
while (!(t = Yap_BufferToTermWithPrioBindings(us, TermNil, tv, strlen(s) + 1, GLOBAL_MaxPriority))) {
|
||||
if (LOCAL_ErrorMessage) {
|
||||
if (!strcmp(LOCAL_ErrorMessage, "Stack Overflow")) {
|
||||
if (!Yap_dogc(0, NULL PASS_REGS)) {
|
||||
|
@ -36,6 +36,7 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
|
||||
#include <assert.h>
|
||||
#include <heapgc.h>
|
||||
#include <iopreds.h>
|
||||
#include <Yatom.h>
|
||||
|
||||
static void retract_all(PredEntry *, int);
|
||||
static void add_first_static(PredEntry *, yamop *, int);
|
||||
@ -1741,7 +1742,7 @@ bool Yap_addclause(Term t, yamop *cp, Term tmode, Term mod, Term *t4ref)
|
||||
/* The only problem we have now is when we need to throw away
|
||||
Indexing blocks
|
||||
*/
|
||||
if (pflags & IndexedPredFlag) {
|
||||
if (pflags & IndexedPredFlag && p->cs.p_code.NOfClauses > 1) {
|
||||
Yap_AddClauseToIndex(p, cp, mode == asserta);
|
||||
}
|
||||
if (pflags & (SpiedPredFlag | CountPredFlag | ProfiledPredFlag)) {
|
||||
|
@ -1319,8 +1319,7 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
||||
}
|
||||
CACHE_REGS
|
||||
const unsigned char *us = (const unsigned char *)s;
|
||||
t0 = Yap_BufferToTermWithPrioBindings(us, strlen(s) + 1, TermNil,
|
||||
GLOBAL_MaxPriority, 0L);
|
||||
t0 = Yap_BufferToTermWithPrioBindings(us, TermNil, 0L, strlen(s) + 1, GLOBAL_MaxPriority);
|
||||
if (!t0)
|
||||
return false;
|
||||
if (IsAtomTerm(t0) || IsIntTerm(t0)) {
|
||||
|
@ -45,6 +45,9 @@ Int p_load_foreign(USES_REGS1) {
|
||||
StringList new;
|
||||
bool returncode = FALSE;
|
||||
yhandle_t CurSlot = Yap_StartSlots();
|
||||
#if __ANDROID__
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// Yap_DebugPlWrite(ARG1); printf("%s\n", " \n");
|
||||
// Yap_DebugPlWrite(ARG2); printf("%s\n", " \n");
|
||||
|
@ -455,7 +455,7 @@ bool low_level_trace__(yap_low_level_port port, PredEntry *pred, CELL *args) {
|
||||
}
|
||||
UNLOCK(Yap_low_level_trace_lock);
|
||||
#if __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "YAPDroid", "%s\n", buf);
|
||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid", "%s\n", buf);
|
||||
#else
|
||||
*b++ = '\n';
|
||||
*b = '\0';
|
||||
@ -510,7 +510,7 @@ not being output.
|
||||
static Int stop_low_level_trace(USES_REGS1) {
|
||||
Yap_do_low_level_trace = FALSE;
|
||||
LOCAL_do_trace_primitives = TRUE;
|
||||
#if DEBUG_LOCKS
|
||||
#if DEBUG_LOCKS////
|
||||
debug_locks = TRUE;
|
||||
#endif
|
||||
return (TRUE);
|
||||
|
13
C/yap-args.c
13
C/yap-args.c
@ -146,7 +146,7 @@ static void init_globals(YAP_init_args *yap_init) {
|
||||
}
|
||||
|
||||
const char *Yap_BINDIR, *Yap_ROOTDIR, *Yap_SHAREDIR, *Yap_LIBDIR, *Yap_DLLDIR,
|
||||
*Yap_PLDIR, *Yap_BOOTSTRAP, *Yap_COMMONSDIR, *Yap_STARTUP,
|
||||
*Yap_PLDIR, *Yap_BOOTSTRAP, *Yap_COMMONSDIR,
|
||||
*Yap_INPUT_STARTUP, *Yap_OUTPUT_STARTUP, *Yap_BOOTFILE, *Yap_INCLUDEDIR;
|
||||
|
||||
/* do initial boot by consulting the file boot.yap */
|
||||
@ -272,7 +272,7 @@ static void Yap_set_locations(YAP_init_args *iap) {
|
||||
/// DLLDIR: where libraries can find expicitely loaded DLLs
|
||||
Yap_DLLDIR = sel(true, iap->DLLDIR != NULL, iap->DLLDIR, true,
|
||||
#if __ANDROID__
|
||||
NULL
|
||||
NULL,
|
||||
#else
|
||||
join(getenv("DESTDIR"), YAP_DLLDIR),
|
||||
#endif
|
||||
@ -312,12 +312,12 @@ static void Yap_set_locations(YAP_init_args *iap) {
|
||||
/// BOOTPLDIR: where we can find Prolog bootstrap files
|
||||
Yap_BOOTSTRAP = sel(true, iap->BOOTSTRAP != NULL, iap->BOOTSTRAP, true,
|
||||
#if __ANDROID__
|
||||
"/assets/Yap/pl",
|
||||
"/assets/Yap/pl/boot,yap",
|
||||
#else
|
||||
join(getenv("DESTDIR"), YAP_BOOTSTRAP),
|
||||
#endif
|
||||
false);
|
||||
/// BOOTFILE: where we can find the core Prolog bootstrap file
|
||||
/// BOOTFILE: where we can find the core Prolog boot file
|
||||
Yap_BOOTFILE = sel(false, iap->BOOTFILE != NULL, iap->BOOTFILE, true,
|
||||
#if __ANDROID__
|
||||
"/assets/Yap/pl/boot.yap",
|
||||
@ -453,7 +453,7 @@ X_API YAP_file_type_t Yap_InitDefaults(void *x, char *saved_state, int argc,
|
||||
memset(iap, 0, sizeof(YAP_init_args));
|
||||
#if __ANDROID__
|
||||
iap->boot_file_type = YAP_BOOT_PL;
|
||||
iap->SavedState = NULL;
|
||||
iap->INPUT_STARTUP = NULL;
|
||||
iap->assetManager = NULL;
|
||||
#else
|
||||
iap->boot_file_type = YAP_QLY;
|
||||
@ -970,6 +970,7 @@ static void init_hw(YAP_init_args *yap_init, struct ssz_t *spt) {
|
||||
static YAP_file_type_t end_init(YAP_init_args *yap_init, YAP_file_type_t rc) {
|
||||
YAP_initialized = true;
|
||||
LOCAL_PrologMode &= ~BootMode;
|
||||
CurrentModule = USER_MODULE;
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1039,7 +1040,7 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
|
||||
init_globals(yap_init);
|
||||
|
||||
start_modules();
|
||||
consult(Yap_BOOTSTRAP PASS_REGS);
|
||||
consult(Yap_BOOTFILE PASS_REGS);
|
||||
if (yap_init->install && Yap_OUTPUT_STARTUP) {
|
||||
Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP));
|
||||
Term g = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("qsave_program"), 1),
|
||||
|
@ -706,9 +706,8 @@ IF ( ANDROID)
|
||||
|
||||
|
||||
|
||||
#target_link_libraries(libYap ${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${ANDROID_ABI}/libsqliteX.so android log )
|
||||
target_link_libraries(libYap ${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${ANDROID_ABI}/libsqliteX.so android log )
|
||||
|
||||
target_link_libraries(libYap android log )
|
||||
ENDIF ()
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ protected:
|
||||
const unsigned char *us = (const unsigned char *)s0;
|
||||
tnames = MkVarTerm();
|
||||
tout =
|
||||
Yap_BufferToTermWithPrioBindings(us, strlen(s0), TermNil, 1200, tnames);
|
||||
Yap_BufferToTermWithPrioBindings(us, TermNil, tnames, strlen(s0), 1200);
|
||||
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
|
||||
// Yap_DebugPlWrite(out);
|
||||
if (tout == 0L) {
|
||||
|
@ -338,7 +338,7 @@ public:
|
||||
/// current directory for the engine
|
||||
bool call(YAPPredicate ap, YAPTerm ts[]);
|
||||
/// current directory for the engine
|
||||
bool goalt(YAPTerm Yt) { return Yt.term(); };
|
||||
bool goal(YAPTerm Yt, YAPModule module) { return mgoal(Yt.term(),module.term()); };
|
||||
/// current directory for the engine
|
||||
bool mgoal(Term t, Term tmod);
|
||||
/// current directory for the engine
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
YAPTerm(void *ptr);
|
||||
/// parse string s and construct a term.
|
||||
YAPTerm(char *s) {
|
||||
Term tp;
|
||||
Term tp = 0;
|
||||
mk(YAP_ReadBuffer(s, &tp));
|
||||
}
|
||||
|
||||
@ -322,6 +322,7 @@ public:
|
||||
RECOVER_MACHINE_REGS();
|
||||
};
|
||||
YAPApplTerm(YAPFunctor f, YAPTerm ts[]);
|
||||
YAPApplTerm(const std::string s, unsigned int arity) { mk(Yap_MkNewApplTerm(Yap_MkFunctor(Yap_LookupAtom(s.c_str()), arity), arity)); };
|
||||
YAPApplTerm(const std::string s, std::vector<YAPTerm> ts);
|
||||
YAPApplTerm(YAPFunctor f);
|
||||
inline Functor functor() { return FunctorOfTerm(gt()); }
|
||||
@ -335,6 +336,12 @@ public:
|
||||
RECOVER_MACHINE_REGS();
|
||||
return tf;
|
||||
};
|
||||
void putArg(int i, YAPTerm t) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term t0 = gt();
|
||||
RepAppl(t0)[i] = t.term();
|
||||
RECOVER_MACHINE_REGS();
|
||||
};
|
||||
virtual bool isVar() { return false; } /// type check for unbound
|
||||
virtual bool isAtom() { return false; } /// type check for atom
|
||||
virtual bool isInteger() { return false; } /// type check for integer
|
||||
|
1
H/Yap.h
1
H/Yap.h
@ -263,6 +263,7 @@ extern size_t Yap_page_size;
|
||||
#define M1 ((CELL)(1024 * 1024))
|
||||
#define M2 ((CELL)(2048 * 1024))
|
||||
|
||||
typedef YAP_UInt CELL;
|
||||
#if ALIGN_LONGS
|
||||
typedef CELL SFLAGS;
|
||||
#else
|
||||
|
@ -226,8 +226,4 @@ atom_t ATOM_;
|
||||
intptr_t system_thread_id(void);
|
||||
#endif
|
||||
|
||||
extern Term Yap_BufferToTermWithPrioBindings(const char *s, size_t len,
|
||||
encoding_t enc, int prio,
|
||||
Term *bindingsp);
|
||||
|
||||
#endif /* PL_YAP_H */
|
||||
|
@ -41,8 +41,8 @@ static char SccsId[] = "%W% %G%";
|
||||
#include <android/native_activity.h>
|
||||
|
||||
|
||||
extern void
|
||||
Java_pt_up_yap_YAPIO_setAssetManager(JNIEnv *env, jclass clazz, jobject assetManager);
|
||||
extern X_API void
|
||||
Java_pt_up_yap_yapdroid_YAPDroid_loadAssetManager(JNIEnv *env, jclass clazz, jobject assetManager);
|
||||
|
||||
jobject *Yap_aref;
|
||||
JNIEnv *Yap_env;
|
||||
@ -52,8 +52,8 @@ AAssetManager *Yap_assetManager(void)
|
||||
return AAssetManager_fromJava(Yap_env, Yap_aref);
|
||||
}
|
||||
|
||||
void
|
||||
Java_pt_up_yap_YAPIO_setAssetManager(JNIEnv *env, jclass clazz, jobject assetManager) {
|
||||
X_API void
|
||||
Java_pt_up_yap_yapdroid_YAPDroid_loadAssetManager(JNIEnv *env, jclass clazz, jobject assetManager) {
|
||||
Yap_aref = (*env)->NewGlobalRef(env,assetManager);
|
||||
Yap_env = env;
|
||||
}
|
||||
|
@ -1385,9 +1385,8 @@ Term Yap_BufferToTerm(const unsigned char *s, Term opts) {
|
||||
return rval;
|
||||
}
|
||||
|
||||
X_API Term Yap_BufferToTermWithPrioBindings(const unsigned char *s, size_t len,
|
||||
Term opts, int prio,
|
||||
Term bindings) {
|
||||
X_API Term Yap_BufferToTermWithPrioBindings(const unsigned char *s, Term opts, Term bindings, size_t len,
|
||||
int prio) {
|
||||
CACHE_REGS
|
||||
Term ctl;
|
||||
|
||||
|
@ -117,9 +117,9 @@ extern int Yap_open_buf_read_stream(const char *buf, size_t nchars,
|
||||
encoding_t *encp, memBufSource src);
|
||||
extern int Yap_open_buf_write_stream(encoding_t enc, memBufSource src);
|
||||
extern Term Yap_BufferToTerm(const unsigned char *s, Term opts);
|
||||
extern X_API Term Yap_BufferToTermWithPrioBindings(const unsigned char *s,
|
||||
size_t sz, Term opts,
|
||||
int prio, Term bindings);
|
||||
extern X_API Term
|
||||
Yap_BufferToTermWithPrioBindings(const unsigned char *s, Term opts, Term bindings, size_t sz,
|
||||
int prio);
|
||||
extern FILE *Yap_GetInputStream(Term t, const char *m);
|
||||
extern FILE *Yap_GetOutputStream(Term t, const char *m);
|
||||
extern char *Yap_guessFileName(FILE *f, int sno, char *nameb, size_t max);
|
||||
|
@ -15,6 +15,7 @@
|
||||
typedef struct myddas_global *MYDDAS_GLOBAL;
|
||||
#include "myddas_util.h"
|
||||
|
||||
|
||||
#ifdef MYDDAS_STATS
|
||||
typedef struct myddas_stats_time_struct *MYDDAS_STATS_TIME;
|
||||
typedef struct myddas_global_stats *MYDDAS_GLOBAL_STATS;
|
||||
|
@ -681,25 +681,15 @@ void init_myddas(void) {
|
||||
CACHE_REGS
|
||||
if (myddas_initialised)
|
||||
return;
|
||||
init_sqlite3();
|
||||
myddas_initialised = TRUE;
|
||||
#if defined MYDDAS_ODBC
|
||||
Yap_InitBackMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
#if WIN32
|
||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
#endif
|
||||
#if defined USE_MYDDAS
|
||||
Yap_InitBackMYDDAS_SharedPreds();
|
||||
#endif
|
||||
#if defined MYDDAS_MYSQL
|
||||
Yap_InitMYDDAS_MySQLPreds();
|
||||
#endif
|
||||
#if defined MYDDAS_ODBC
|
||||
Yap_InitMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
#if WIN32
|
||||
Yap_InitMYDDAS_SQLITE3Preds();
|
||||
#endif
|
||||
#if defined USE_MYDDAS
|
||||
Yap_InitMYDDAS_SharedPreds();
|
||||
#endif
|
||||
@ -743,4 +733,3 @@ int WINAPI win_myddas(HANDLE hinst, DWORD reason, LPVOID reserved) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* USE_MYDDAS*/
|
||||
|
@ -72,6 +72,7 @@ foreach (driver ${MYDDAS_DBMS})
|
||||
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
||||
endforeach ()
|
||||
|
||||
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/test.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||
add_to_group(MYDDAS_YAP pl_library )
|
||||
|
||||
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||
@ -79,4 +80,3 @@ add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||
install(FILES ${MYDDAS_YAP}
|
||||
DESTINATION ${libpl}
|
||||
)
|
||||
|
||||
|
@ -243,8 +243,7 @@ db_open(odbc,Connection,ODBCEntry,User,Password) :-
|
||||
%% sqlite3
|
||||
db_open(sqlite3,Connection,File,User,Password) :-
|
||||
'$error_checks'(db_open(sqlite3,Connection,File,User,Password)),
|
||||
absolute_file_name(File,FullFile,[access(exist),file_errors(error),expand(true)]),
|
||||
c_sqlite3_connect(FullFile,User,Password,Con),
|
||||
c_sqlite3_connect(File,User,Password,Con),
|
||||
set_value(Connection,Con).
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
@ -53,3 +53,6 @@ install(TARGETS sqlite4YAP
|
||||
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
file (INSTALL chinook.db test.yap DESTINATION ${libpl})
|
||||
|
||||
|
@ -77,7 +77,7 @@ static Int c_sqlite3_get_database(USES_REGS1);
|
||||
static Int c_sqlite3_change_database(USES_REGS1);
|
||||
|
||||
static Int c_sqlite3_connect(USES_REGS1) {
|
||||
|
||||
printf("hello darkness\n");
|
||||
Term arg_file = Deref(ARG1);
|
||||
Term arg_db = ARG4;
|
||||
|
||||
@ -96,7 +96,56 @@ static Int c_sqlite3_connect(USES_REGS1) {
|
||||
|
||||
if (new == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "ERROR: ** c_db_my_connect ** Error allocating memory\n");
|
||||
fprintf(stderr, "ERROR: ** c_db_my_connect ** Error allocating memory\n");135761 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4011d 240 0 FAIL RETRY: prolog:$user_expansion(user:main, _135757:_135758 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4012d 173 0 CALL: prolog:$import_expansion(user:main, _135760:_135761 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4013d 239 0 CALL: prolog:$imported_predicate(main, user, _135761, _135760 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4014d 255 0 CALL: prolog:$is_system_predicate(main, prolog )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4015d 255 0 FAIL RETRY: prolog:$imported_predicate(main, user, _135761, _135760 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4016d 239 0 CALL: prolog:$undefined(main, user )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4017d 239 0 FAIL RETRY: prolog:$import_expansion(user:main, _135760:_135761 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4018d 173 0 CALL: prolog:$meta_expansion(user:main, user, [], _1048348 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4019d 238 0 CALL: prolog:$yap_strip_module(user:main, _135763, _1048327 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4020d 238 0 CALL: prolog:functor(main, _135766, _135767 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4021d 238 0 CALL: prolog:$meta_predicate(main, user, 0, _1048328 )
|
||||
03-16 17:31:30.590 25588-25588/? E/YAPDroid: 4022d 238 0 FAIL RETRY: prolog:$meta_expansion(user:main, user, [], _1048348 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4023d 173 0 CALL: prolog:$yap_strip_module(user:main, _135763, _135764 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4024d 173 0 CALL: prolog:$yap_strip_module(user:main, _135765, _135766 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4025d 173 0 CALL: prolog:$end_goal_expansion(main, _135738, _135740, user, user, user, :-user:main )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4026d 173 0 CALL: prolog:$match_mod(main, user, user, user, _135738 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4027d 173 0 CALL: prolog:$is_system_predicate(main, user )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4028d 173 0 TRY_OR
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4029d 216 0 CALL: prolog:==(user, user )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4030d 216 0 CALL: prolog:==(user, user )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4031d 173 0 CALL: prolog:$c_built_in(main, user, :-user:main, _1048378 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4032d 209 0 CALL: prolog:get_value('$c_arith', true )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4033d 173 0 CALL: prolog:do_c_built_in(main, user, :-user:main, _1048378 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4034d 220 0 CALL: prolog:$compop(main, _1048340, _1048341, _1048343 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4035d 220 0 FAIL RETRY: prolog:do_c_built_in(main, user, :-user:main, _1048378 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4036d 220 0 CALL: prolog:$yap_strip_module(user:main, _135770, _135771 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4037d 220 0 CALL: prolog:$match_mod(main, user, user, user, _135740 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4038d 220 0 CALL: prolog:$is_system_predicate(main, user )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4039d 220 0 TRY_OR
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4040d 236 0 CALL: prolog:==(user, user )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4041d 236 0 CALL: prolog:==(user, user )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4042d 220 0 CALL: prolog:$yap_strip_module(user: (:-main), _135727, _135728 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4043d 158 0 TRY_OR
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4044d 172 0 CALL: prolog:==(158, 158 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4045d 105 0 CALL: prolog:$yap_strip_module(user: (:-main), _1048434, _135775 )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4046d 105 0 TRY_OR
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4047d 105 0 CALL: prolog:$process_directive(main, reconsult, user, [], '$stream_position'(1342,80,1,0) )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4048d 130 0 FAIL RETRY: prolog:$process_directive(main, reconsult, user, [], '$stream_position'(1342,80,1,0) )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4049d 130 0 FAIL RETRY: prolog:$process_directive(main, reconsult, user, [], '$stream_position'(1342,80,1,0) )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4050d 130 0 CALL: prolog:$all_directives(main )
|
||||
03-16 17:31:30.591 25588-25588/? E/YAPDroid: 4051d 130 0 CALL: prolog:$directive(main )
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4052d 130 0 FAIL RETRY: prolog:$process_directive(main, reconsult, user, [], '$stream_position'(1342,80,1,0) )
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4053d 130 0 CALL: prolog:current_prolog_flag(language_mode, iso )
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4054d 130 0 FAIL RETRY: prolog:$process_directive(main, reconsult, user, [], '$stream_position'(1342,80,1,0) )
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4055d 130 0 CALL: prolog:$execute(user:main )
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4056d 130 0 CALL: user:main
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4057d 130 0 CALL: user:init
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4058d 130 0 CALL: user:db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _1048428, _1048429 )
|
||||
03-16 17:31:30.592 25588-25588/? E/YAPDroid: 4059d 130 0 CALL: user:db_open(sqlite3, myddas, '/data/user/0/pt.up.yap.yapdr
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
@ -664,15 +713,18 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
||||
}
|
||||
|
||||
X_API void init_sqlite3(void) {
|
||||
// Yap_InitMYDDAS_SQLITE3Preds();
|
||||
// Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
Term cm = CurrentModule;
|
||||
CurrentModule = PROLOG_MODULE;
|
||||
Yap_InitMYDDAS_SQLITE3Preds();
|
||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
||||
#if _ANDROID_
|
||||
//JNIEXPORT void JNICALL lib_yap_up_pt_init_sqlite(JNIEnv *env);
|
||||
|
||||
// JNIEXPORT void JNICALL lib_yap_up_pt_init_sqlite(JNIEnv *env) {
|
||||
// init_sqlite3();
|
||||
init_sqlite3();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,18 @@
|
||||
|
||||
:- [library(myddas)].
|
||||
|
||||
:- initialization(main).
|
||||
:- compile(library(myddas)).
|
||||
|
||||
main :-
|
||||
setup_call_cleanup(
|
||||
init,
|
||||
main_,
|
||||
(trace,
|
||||
close)).
|
||||
close.
|
||||
main_ :-
|
||||
go,
|
||||
fail.
|
||||
main_ .
|
||||
|
||||
init :-
|
||||
db_open(sqlite3, '~/Yap/Chinook/Chinook_Sqlite.sqlite', _, _),
|
||||
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
||||
writeln('chinook has landed'),
|
||||
db_import('Artist', artist),
|
||||
db_import('Album', album),
|
||||
db_import('Track', track).
|
||||
@ -25,7 +22,6 @@ init :-
|
||||
db_get_attributes_types(track,Ts),
|
||||
db_get_attributes_types(artist,As),
|
||||
writeln(As:Als:Ts).
|
||||
|
||||
go :-
|
||||
db_number_of_fields(album,Als),
|
||||
db_number_of_fields(track,Ts),
|
||||
@ -36,7 +32,6 @@ go :-
|
||||
db_describe(album, Desc), writeln(Desc) ;
|
||||
db_describe(track, Desc), writeln(Desc) ;
|
||||
db_describe(artist, Desc), writeln(Desc).
|
||||
|
||||
go :-
|
||||
db_show_tables(Desc), writeln(Desc).
|
||||
go :-
|
||||
@ -79,3 +74,6 @@ go_cut1 :-
|
||||
|
||||
close :-
|
||||
db_close.
|
||||
|
||||
:- main.
|
||||
|
||||
|
@ -20,6 +20,7 @@ FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/jni)
|
||||
add_custom_target (pllib
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${pllib}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${pl_library} ${pllib}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/android.yap ${pllib}
|
||||
DEPENDS ${pl_library}
|
||||
)
|
||||
|
||||
|
@ -1,15 +1,21 @@
|
||||
//
|
||||
// Created by vsc on 7/6/17.
|
||||
// Created by vsc on 7/6/17->
|
||||
//
|
||||
/* File : example.cxx */
|
||||
/* File : example->cxx */
|
||||
|
||||
#include "streamer.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern void Java_pt_up_yap_streamerJNI_swig_1module_1init(void);
|
||||
|
||||
}
|
||||
|
||||
static AndroidStreamer * streamerInstance = 0;
|
||||
|
||||
void setStreamer(AndroidStreamer* streamer) {
|
||||
streamerInstance = streamer;
|
||||
Java_pt_up_yap_streamerJNI_swig_1module_1init();
|
||||
}
|
||||
|
||||
AndroidStreamer& getStreamer() {
|
||||
@ -25,13 +31,11 @@ extern "C" {
|
||||
#include <yapio.h>
|
||||
#include <iopreds.h>
|
||||
|
||||
extern void Java_pt_up_yap_streamerJNI_swig_1module_1init__(void);
|
||||
|
||||
static VFS_t andstream;
|
||||
|
||||
void Java_pt_up_yap_streamerJNI_swig_1module_1init__(void) {
|
||||
// streamerInstance = 0;
|
||||
} ;
|
||||
|
||||
static VFS_t *andstream;
|
||||
|
||||
|
||||
static std::string buff0;
|
||||
|
||||
@ -83,21 +87,34 @@ streamerInstance->display(buff0);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
AndroidStreamer::bind() {
|
||||
buff0 = *new std::string[256];
|
||||
andstream.name = "/android/user_error";
|
||||
andstream.vflags = VFS_CAN_WRITE | VFS_HAS_PREFIX;
|
||||
andstream.prefix = "/android";
|
||||
andstream.suffix = NULL;
|
||||
andstream.open = and_open;
|
||||
andstream.close = and_close;
|
||||
andstream.get_char = and_get;
|
||||
andstream.put_char = and_put;
|
||||
andstream.flush = and_flush;
|
||||
andstream.seek = and_seek;
|
||||
andstream.next = GLOBAL_VFS;
|
||||
GLOBAL_VFS = &andstream;
|
||||
Yap_InitStdStream(StdOutStream, Output_Stream_f | Append_Stream_f, NULL, &andstream);
|
||||
Yap_InitStdStream(StdErrStream, Output_Stream_f | Append_Stream_f, NULL, &andstream);
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
void Java_pt_up_yap_streamerJNI_swig_1module_1init(void) {
|
||||
if (andstream)
|
||||
return;
|
||||
andstream = new VFS_t();
|
||||
|
||||
andstream->name = "android output window";
|
||||
andstream->vflags = VFS_CAN_WRITE | VFS_HAS_PREFIX;
|
||||
andstream->prefix = "/android";
|
||||
andstream->suffix = NULL;
|
||||
andstream->open = and_open;
|
||||
andstream->close = and_close;
|
||||
andstream->get_char = and_get;
|
||||
andstream->put_char = and_put;
|
||||
andstream->flush = and_flush;
|
||||
andstream->seek = and_seek;
|
||||
andstream->next = GLOBAL_VFS;
|
||||
GLOBAL_VFS = andstream;
|
||||
|
||||
YAP_Term ts[1], args[1], goal;
|
||||
ts[0] = MkAtomTerm(Yap_LookupAtom("android"));
|
||||
args[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("library"),1), 1, ts);
|
||||
goal = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("compile"),1), 1, args);
|
||||
YAP_RunGoalOnce(goal);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -9,10 +9,14 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
struct AndroidStreamer {
|
||||
std::string *buff0;
|
||||
|
||||
virtual void display(std::string text) const = 0;
|
||||
virtual ~AndroidStreamer() {}
|
||||
void bind();
|
||||
AndroidStreamer() { buff0 = new std::string[256];
|
||||
};
|
||||
};
|
||||
void setStreamer(AndroidStreamer* streamer);
|
||||
AndroidStreamer& getStreamer();
|
||||
|
@ -59,6 +59,10 @@ class YAPEngine;
|
||||
// no way to translate
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#ifdef SWIGJAVA0
|
||||
%typemap(javapackage) std::vector<YAPTerm> "pt.up.yap.YAPTerm"
|
||||
%template(VectorOfTerm) std::vector<YAPTerm>;
|
||||
#endif
|
||||
}
|
||||
%}
|
||||
|
@ -8,6 +8,7 @@ set(PL_BOOT_SOURCES
|
||||
boot.yap
|
||||
bootlists.yap
|
||||
bootutils.yap
|
||||
builtins.yap
|
||||
callcount.yap
|
||||
checker.yap
|
||||
consult.yap
|
||||
@ -26,6 +27,7 @@ set(PL_BOOT_SOURCES
|
||||
grammar.yap
|
||||
ground.yap
|
||||
hacks.yap
|
||||
imports.yap
|
||||
init.yap
|
||||
listing.yap
|
||||
load_foreign.yap
|
||||
|
@ -342,7 +342,7 @@ expand_expr(Op, X, Y, O, Q, P) :-
|
||||
%% contains_illegal_dcgnt(+Term) is semidet.
|
||||
%
|
||||
% True if Term contains a non-terminal we cannot deal with using
|
||||
% goal-expansion. The test is too general approximation, but safe.
|
||||
% goal-expansion. The test is too general an approximation, but safe.
|
||||
|
||||
'$contains_illegal_dcgnt'(NT) :-
|
||||
functor(NT, _, A),
|
||||
@ -356,7 +356,6 @@ expand_expr(Op, X, Y, O, Q, P) :-
|
||||
'$harmless_dcgexception'(instantiation_error). % ex: phrase(([1],x:X,[3]),L)
|
||||
'$harmless_dcgexception'(type_error(callable,_)). % ex: phrase(27,L)
|
||||
|
||||
|
||||
:- set_value('$c_arith',true).
|
||||
/**
|
||||
@}
|
||||
|
11
pl/boot.yap
11
pl/boot.yap
@ -293,7 +293,7 @@ initialize_prolog :-
|
||||
'qly.yap',
|
||||
'spy.yap',
|
||||
'udi.yap'].
|
||||
:- stop_low_level_trace.
|
||||
%:- stop_low_level_trace.
|
||||
|
||||
|
||||
:- meta_predicate(log_event(+,:)).
|
||||
@ -461,3 +461,12 @@ If this hook predicate succeeds it must instantiate the _Action_ argument to th
|
||||
:- ensure_loaded('../pl/pathconf.yap').
|
||||
|
||||
:- yap_flag(user:unknown,error).
|
||||
|
||||
|
||||
:- compile('../myddas').
|
||||
|
||||
:- start_low_level_trace.
|
||||
|
||||
%:- db_open(sqlite3, '/asssets/Yap/chinook.db', _, _).
|
||||
|
||||
:- compile('../test').
|
||||
|
@ -1,5 +1,6 @@
|
||||
:- '$mk_dynamic'('$parent_module'(_,_),prolog).
|
||||
|
||||
|
||||
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
|
||||
recorded('$import','$import'(ExportingModI,ImportingMod,G0I,G,_,_),_),
|
||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G0I).
|
||||
|
Reference in New Issue
Block a user