From 644a9ad852d633ee1d79c82896c6e210f8ee3178 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 2 Apr 2019 11:22:01 +0100 Subject: [PATCH 1/3] bug fixes --- C/cdmgr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index f9f7cdcef..3b667e930 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -785,6 +785,10 @@ static void kill_children(LogUpdIndex *c, PredEntry *ap) { ncl = c->ChildIndex; /* kill children */ while (ncl) { + if (ncl->ClRefCount>0) { + c->ClRefCount--; +}return; + } kill_first_log_iblock(ncl, c, ap); ncl = c->ChildIndex; } @@ -860,7 +864,7 @@ static void kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *parent, if (DBErasedIList) DBErasedIList->PrevSiblingIndex = c; DBErasedIList = c; - if (!((c->ClFlags & InUseMask) || c->ClRefCount)) { + if (!(c->ClFlags & InUseMask || c->ClRefCount)) { kill_off_lu_block(c, parent, ap); } else { if (c->ClFlags & ErasedMask) From b5205f1193181d366519c4dc2be97bc9736650c4 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Wed, 3 Apr 2019 15:46:47 +0100 Subject: [PATCH 2/3] droid --- C/cdmgr.c | 2 +- C/errors.c | 2 +- CMakeLists.txt | 6 ++++-- console/yap.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index ee7d1510f..7feda492c 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -789,7 +789,7 @@ static void kill_children(LogUpdIndex *c, PredEntry *ap) { while (ncl) { if (ncl->ClRefCount>0) { c->ClRefCount--; -}return; +return; } kill_first_log_iblock(ncl, c, ap); ncl = c->ChildIndex; diff --git a/C/errors.c b/C/errors.c index 34b4512c2..791113072 100755 --- a/C/errors.c +++ b/C/errors.c @@ -337,7 +337,7 @@ bool Yap_PrintWarning(Term twarning) { FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2; if (twarning) __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " warning(%s)", - Yap_TermToBuffer(twarning, Quote_illegal_f | Ignore_ops_f | Ignore_cyclics_f)); + Yap_TermToBuffer(twarning, Quote_illegal_f | Ignore_ops_f | Handle_cyclics_f)); Term cmod = (CurrentModule == PROLOG_MODULE ? TermProlog : CurrentModule); bool rc; Term ts[2], err; diff --git a/CMakeLists.txt b/CMakeLists.txt index f81f79b5e..5e30b9ef5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -616,7 +616,6 @@ add_subDIRECTORY(utf8proc ) set(CXX_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/packages/swig/android) add_subdirectory(packages/swig/android) add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 -DEMBEDDED_SQLITE3=1) - link_directories(${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${CMAKE_ANDROID_ARCH_ABI}) else() add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 ) @@ -656,7 +655,8 @@ if (WIN32 OR ANDROID) if (ANDROID) List(APPEND YLIBS $) List(APPEND YLIBS $) - set(ANDROID_LIBRARIES sqliteX android log) + set(ANDROID_LIBRARIES ${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${ANDROID_ABI}/libsqliteX.so android log) + link_directories(${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${ANDROID_ABI}) endif () endif () @@ -967,6 +967,7 @@ if (WIN32) endif (WIN32) +if (NOT ANDROID) add_executable(yap-bin ${CONSOLE_SOURCES}) set_target_properties(yap-bin PROPERTIES OUTPUT_NAME yap) @@ -980,6 +981,7 @@ install(TARGETS libYap yap-bin ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +endif() if (WITH_MPI) diff --git a/console/yap.c b/console/yap.c index 3bcda15ea..a335b59b4 100755 --- a/console/yap.c +++ b/console/yap.c @@ -147,7 +147,7 @@ int main(int argc, char **argv) YAP_Reset(YAP_FULL_RESET, false); /* End preprocessor code */ - mtrace(); + //mtrace(); bool rc = exec_top_level(BootMode, &init_args); if (!rc) return 1; From a23759673680a5e28f1ebce18f51a0126e26c81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 3 Apr 2019 17:08:12 +0100 Subject: [PATCH 3/3] fixes --- C/errors.c | 2 +- CMakeLists.txt | 2 +- CXX/yapq.hh | 2 +- os/streams.c | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/C/errors.c b/C/errors.c index 34b4512c2..791113072 100755 --- a/C/errors.c +++ b/C/errors.c @@ -337,7 +337,7 @@ bool Yap_PrintWarning(Term twarning) { FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2; if (twarning) __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " warning(%s)", - Yap_TermToBuffer(twarning, Quote_illegal_f | Ignore_ops_f | Ignore_cyclics_f)); + Yap_TermToBuffer(twarning, Quote_illegal_f | Ignore_ops_f | Handle_cyclics_f)); Term cmod = (CurrentModule == PROLOG_MODULE ? TermProlog : CurrentModule); bool rc; Term ts[2], err; diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d7fbeed1..45fb287c7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -616,7 +616,7 @@ add_subDIRECTORY(utf8proc ) set(CXX_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/packages/swig/android) add_subdirectory(packages/swig/android) add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 -DEMBEDDED_SQLITE3=1) - link_directories(${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${CMAKE_ANDROID_ARCH_ABI}) + link_directories(${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${ANDROID_ABI}) else() add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 ) diff --git a/CXX/yapq.hh b/CXX/yapq.hh index 35474603b..5296a6dcc 100644 --- a/CXX/yapq.hh +++ b/CXX/yapq.hh @@ -94,7 +94,7 @@ public: /// should be a callable /// goal. inline YAPQuery(const char *s) : YAPPredicate(s, goal, names, (nts = &ARG1)) { - __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "got game %d", + __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "got game %ld", LOCAL_CurSlot); openQuery(); diff --git a/os/streams.c b/os/streams.c index 051d9d7c1..60120570a 100644 --- a/os/streams.c +++ b/os/streams.c @@ -131,7 +131,6 @@ FILE *Yap_GetOutputStream(Term t, const char *msg) { return rc; } -cmax =7; int GetFreeStreamD(void) { CACHE_REGS LOCK(GLOBAL_StreamDescLock);