diff --git a/C/errors.c b/C/errors.c index bbf42d4da..53c53bd7f 100755 --- a/C/errors.c +++ b/C/errors.c @@ -332,7 +332,7 @@ bool Yap_PrintWarning(Term twarning) { PredEntry *pred = RepPredProp(PredPropByFunc( FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2; __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " warning(%s)", - Yap_TermToBuffer(twarning, Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f)); + Yap_TermToBuffer(twarning, Quote_illegal_f | Ignore_ops_f | Ignore_cyclics_f)); Term cmod = (CurrentModule == PROLOG_MODULE ? TermProlog : CurrentModule); bool rc; Term ts[2], err; diff --git a/CMakeLists.txt b/CMakeLists.txt index 08ba15522..aca18eb92 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,14 +351,10 @@ list(APPEND YAP_SYSTEM_OPTIONS big_numbers) -if (GMP_FOUND) +if (GMP_INCLUDE_DIRS) #config.h needs this (TODO: change in code latter) include_directories(${GMP_INCLUDE_DIRS}) - check_include_file(gmp.h HAVE_GMP_H) - check_include_file_cxx(gmpxx.h HAVE_GMPXX_H) - - -endif (GMP_FOUND) + endif () if (WITH_READLINE) diff --git a/CXX/yapi.hh b/CXX/yapi.hh index ab84a424b..599ae7cf1 100755 --- a/CXX/yapi.hh +++ b/CXX/yapi.hh @@ -16,7 +16,7 @@ extern "C" { #include "YapConfig.h" } -#if HAVE_GMPXX_H +#if HAVE_GMPXX_H || defined(__ANDROID__) #include #elif HAVE_GMP_H #include diff --git a/H/CMakeLists.txt b/H/CMakeLists.txt index be369505c..546484dea 100644 --- a/H/CMakeLists.txt +++ b/H/CMakeLists.txt @@ -19,3 +19,5 @@ add_custom_command( OUTPUT ${CMAKE_TOP_BINARY_DIR}/dlocals.h DEPENDS locals.h ) + +install(FILES ${INCLUDE_HEADERS} ${CORE_HEADERS} ${OPTYap_HEADERS} ${YAPOS_HEADERS} ${CONFIGURATION_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Yap ) diff --git a/H/Yap.h b/H/Yap.h index ec1d39ba2..0fd88ef99 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -776,7 +776,7 @@ extern struct worker_local Yap_local; #define REMOTE(wid) (&Yap_local) #endif -#include "encoding.h" +#include "YapEncoding.h" #include #define YP_FILE FILE diff --git a/H/Yapproto.h b/H/Yapproto.h index 9c7fc5bfe..e7f0867ed 100755 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -470,7 +470,7 @@ extern void Yap_InitAbsmi(void); extern void Yap_InitUnify(void); extern void Yap_TrimTrail(void); extern int Yap_Unifiable(Term d0, Term d1); -extern int Yap_IUnify(register CELL d0, register CELL d1); +extern int Yap_IUnify( CELL d0, CELL d1); /* userpreds.c */ extern void Yap_InitUserCPreds(void); diff --git a/cmake/Sources.cmake b/cmake/Sources.cmake index dcaea42c8..822c5e958 100644 --- a/cmake/Sources.cmake +++ b/cmake/Sources.cmake @@ -253,8 +253,6 @@ set (OPTYap_HEADERS ) set (YAPOS_HEADERS - ${CMAKE_SOURCE_DIR}/os/encoding.h - ${CMAKE_SOURCE_DIR}/os/fmemopen.h ${CMAKE_SOURCE_DIR}/os/format.h ${CMAKE_SOURCE_DIR}/os/getw.h ${CMAKE_SOURCE_DIR}/os/iopreds.h diff --git a/config.h.cmake b/config.h.cmake index c72a3dc99..f24df26d4 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1884,7 +1884,9 @@ signal. */ #endif /* use bignums/rationals in YAP code. */ -#ifndef USE_GMP +#if defined( __ANDROID__ ) && !defined(USE_GMP) +#define USE_GMP 1 +#elif !defined(USE_GMP) #define USE_GMP ${GMP_FOUND} #endif diff --git a/include/VFS.h b/include/VFS.h index 624d5d6ce..ef30276e4 100644 --- a/include/VFS.h +++ b/include/VFS.h @@ -31,7 +31,7 @@ #endif #endif -#include +#include typedef struct { dev_t st_dev; /* ID of device containing file */ diff --git a/include/YapDefs.h b/include/YapDefs.h index 58aa5a749..351139742 100755 --- a/include/YapDefs.h +++ b/include/YapDefs.h @@ -69,7 +69,7 @@ typedef int (*YAP_agc_hook)(void *_Atom); #include "YapError.h" -#include "../os/encoding.h" +#include "YapEncoding.h" typedef encoding_t YAP_encoding_t; diff --git a/os/encoding.h b/include/YapEncoding.h similarity index 100% rename from os/encoding.h rename to include/YapEncoding.h diff --git a/include/YapTerm.h b/include/YapTerm.h index 3efc37a77..f67647556 100644 --- a/include/YapTerm.h +++ b/include/YapTerm.h @@ -116,7 +116,7 @@ typedef void *YAP_Functor; #include "YapError.h" -#include "../os/encoding.h" +#include "YapEncoding.h" typedef encoding_t YAP_encoding_t; diff --git a/os/CMakeLists.txt b/os/CMakeLists.txt index b3b12e1f2..03b8fba72 100644 --- a/os/CMakeLists.txt +++ b/os/CMakeLists.txt @@ -2,7 +2,7 @@ set (YAPOS_HEADERS getw.h iopreds.h yapio.h - encoding.h + YapEncoding.h ) set (YAPOS_SOURCES diff --git a/os/readutil.c b/os/readutil.c index 4c5059d19..05762b4e1 100644 --- a/os/readutil.c +++ b/os/readutil.c @@ -22,7 +22,7 @@ static char SccsId[] = "%W% %G%"; #include "YapHeap.h" #include "YapText.h" #include "Yatom.h" -#include "encoding.h" +#include "YapEncoding.h" #include "iopreds.h" #include "yapio.h" diff --git a/packages/swig/android/CMakeLists.txt b/packages/swig/android/CMakeLists.txt index 7a546de3f..868d7fed2 100644 --- a/packages/swig/android/CMakeLists.txt +++ b/packages/swig/android/CMakeLists.txt @@ -1,6 +1,7 @@ # This is a CMake file for SWIG and Android + set (SWIG_CXX_DIR ${YAP_APP_DIR}/src/generated/jni) FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/java/pt/up/yap/lib ) FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/assets) FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/jni) @@ -16,42 +17,43 @@ FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/jni) set (GMP_INCLUDE_DIRS ${GMP_ROOT}) set (GMP_LIBRARIES ${GMP_ROOT}/libgmp.so) - - add_custom_target (pllib - COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR} - COMMAND ${CMAKE_COMMAND} -E copy ${pl_library} ${YAP_INSTALL_DATADIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/android.yap ${YAP_INSTALL_DATADIR} - DEPENDS ${pl_library} -) - - add_custom_target (pllibpl - COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}/pl - COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} ${YAP_INSTALL_DATADIR}/pl -DEPENDS pllib ${pl_boot_library} - ) - add_custom_target (pllibos ALL - COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}/os - COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} ${YAP_INSTALL_DATADIR}/os -DEPENDS pllibpl ${pl_os_library} - ) - - add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp - COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp -oh ${CMAKE_SWIG_OUTPUT}/swig_streamer.hh streamer.i - DEPENDS streamer.i - ) - - add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp - COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp -oh ${CMAKE_SWIG_OUTPUT}/yap_swig.hh ${SWIG_SOURCES} - DEPENDS pllibos ${SWIG_SOURCES} YAP++) - +# +# add_custom_target (pllib +# COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR} +# COMMAND ${CMAKE_COMMAND} -E copy ${pl_library} ${YAP_INSTALL_DATADIR} +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/android.yap ${YAP_INSTALL_DATADIR} +# DEPENDS ${pl_library} +#) +# +# add_custom_target (pllibpl +# COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}/pl +# COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} ${YAP_INSTALL_DATADIR}/pl +#DEPENDS pllib ${pl_boot_library} +# ) +# add_custom_target (pllibos ALL +# COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}/os +# COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} ${YAP_INSTALL_DATADIR}/os +#DEPENDS pllibpl ${pl_os_library} +# ) +# +# add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp +# COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp -oh ${CMAKE_SWIG_OUTPUT}/swig_streamer.hh streamer.i +# DEPENDS streamer.i +# ) +# +# add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp +# COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp -oh ${CMAKE_SWIG_OUTPUT}/yap_swig.hh ${SWIG_SOURCES} +# DEPENDS pllibos ${SWIG_SOURCES} YAP++) +# add_library(YAPJava OBJECT - ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp - ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp + ${SWIG_CXX_DIR}/streamer_swig.cxx + ${SWIG_CXX_DIR}/yapi_swig.cxx streamer.cpp - ) + ) + set_target_properties(YAPJava PROPERTIES LINKER_LANGUAGE CXX) # GMP_FOUND - true if GMP/MPIR was found # GMP_INCLUDE_DIRS - include search path diff --git a/packages/swig/android/streamer.cpp b/packages/swig/android/streamer.cpp index ebbd789e3..39c458202 100644 --- a/packages/swig/android/streamer.cpp +++ b/packages/swig/android/streamer.cpp @@ -77,15 +77,6 @@ static int64_t and_seek(int sno, int64_t where, int how) { static void and_flush(int sno) { -buff0 += '\0'; -streamerInstance->display(buff0); - - - -// -// Created by vsc on 11-07-2017. -// - } diff --git a/pl/consult.yap b/pl/consult.yap index 5d0f57c65..4609bfbd2 100644 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -704,6 +704,9 @@ db_files(Fs) :- '$csult'(Fs, M) :- load_files(M:Fs,[consult(consult)]). + '$csult_in_mod'(M, -F ) :- $load_files'(M:F,[],[M:F]) + '$csult_in_mod'(M, F ) :- $load_files'(M:F,[consult(consult)],[M:F]) + '$extract_minus'([], []). '$extract_minus'([-F|Fs], [F|MFs]) :- '$extract_minus'(Fs, MFs). diff --git a/pl/top.yap b/pl/top.yap index becde72e6..adee8ae20 100644 --- a/pl/top.yap +++ b/pl/top.yap @@ -712,11 +712,15 @@ write_query_answer( Bindings ) :- '$call'(not(X), _CP, G0, M) :- !, \+ ('$current_choice_point'(CP), '$call'(X,CP,G0,M) ). -'$call'(!, CP, _,_) :- !, +'$call'(!, CP, CP,G0) :- !, '$$cut_by'(CP). -'$call'([A|B], _, _, M) :- !, - '$csult'([A|B], M). -'$call'(G, _CP, _G0, CurMod) :- +'$call'([X|Y], _, _, M) :- + (Y == [] -> + consult(M:X) + ; + '$csult'([X|Y] ,M) + ), + $call'(G, _CP, _G0, CurMod) :- % /* % ( % '$is_metapredicate'(G,CurMod) diff --git a/swi/library/predicate_options.pl b/swi/library/predicate_options.pl index aa1b597e3..a1a8fe018 100644 --- a/swi/library/predicate_options.pl +++ b/swi/library/predicate_options.pl @@ -2811,7 +2811,7 @@ erroris supported:a 781 ^ : -#include "encoding.h" +#include "YapEncoding.h" #includeIn file included from /Users/vsc/github/yap-6.3/H/YapHandles.h ^ :