From 6ec69aa3c881f547dc7ed8c278be19ffde1f8e72 Mon Sep 17 00:00:00 2001 From: vscosta Date: Wed, 22 Feb 2017 00:56:20 -0800 Subject: [PATCH] win64 fixes --- C/text.c | 2 +- CXX/yapi.cpp | 25 +++++++++++++++---------- cmake/python.cmake | 24 ++++++++++++------------ packages/python/CMakeLists.txt | 2 +- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/C/text.c b/C/text.c index b1bb75a55..038abf6c5 100644 --- a/C/text.c +++ b/C/text.c @@ -936,7 +936,7 @@ static unsigned char *concat(int n, void *sv[] USES_REGS) { buf0 = buf; for (i = 0; i < n; i++) { #if _WIN32 || defined(__ANDROID__) - strcpy(buf, sv[lvl]); + strcpy(buf, sv[i]); buf = (char *)buf + strlen(buf); #else buf = stpcpy(buf, sv[i]); diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index f9868118e..927b59adb 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -495,16 +495,21 @@ bool YAPEngine::mgoal(Term t, Term tmod) bool result; sigjmp_buf q_env; - if (IsApplTerm(t)) - { - ts = RepAppl(t) + 1; + + if (arity) { + if (IsApplTerm(t)) + { + ts = RepAppl(t) + 1; + } + else + { + ts = RepPair(t); + } + for (arity_t i = 0; i < arity; i++) + XREGS[i + 1] = ts[i]; + } else if ( IsAtomTerm(t)) { + ts = nullptr; } - else - { - ts = RepPair(t); - } - for (arity_t i = 0; i < arity; i++) - XREGS[i + 1] = ts[i]; q.CurSlot = Yap_StartSlots(); q.p = P; q.cp = CP; @@ -729,7 +734,7 @@ bool YAPQuery::next() { q_open = false; Yap_PopTermFromDB(LOCAL_ActiveError->errorTerm); - bzero(LOCAL_ActiveError, sizeof(*LOCAL_ActiveError)); + memset(LOCAL_ActiveError, 0, sizeof(*LOCAL_ActiveError)); YAP_LeaveGoal(false, &q_h); Yap_CloseHandles(q_handles); q_open = false; diff --git a/cmake/python.cmake b/cmake/python.cmake index a61d9d3c4..9f6776f68 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -37,11 +37,10 @@ get_filename_component ( ABS_PYTHON_INCLUDE_PATH ${_ABS_PYTHON_INCLUDE_PATH} ABS OUTPUT_VARIABLE _ABS_PYTHON_SYSLIB_PATH OUTPUT_STRIP_TRAILING_WHITESPACE ) - set( _ABS_PYTHON_SYSLIB_PATH - ${_ABS_PYTHON_SYSLIB_PATH}/../${CMAKE_SHARED_LIBRARY_PREFIX}python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}m${CMAKE_SHARED_LIBRARY_SUFFIX} ) - message("${_ABS_PYTHON_SYSLIB_PATH}") - get_filename_component ( ABS_PYTHON_SYSLIB_PATH ${_ABS_PYTHON_SYSLIB_PATH} ABSOLUTE ) - + find_library(ABS_PYTHON_SYSLIB_PATH + NAMES python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}m + PATHS _ABS_PYTHON_SYSLIB_PATH + ) set ( PYTHON_LIBRARY ${ABS_PYTHON_SYSLIB_PATH} @@ -51,23 +50,24 @@ get_filename_component ( ABS_PYTHON_INCLUDE_PATH ${_ABS_PYTHON_INCLUDE_PATH} ABS ${PYTHON_LIBRARY} CACHE "FILEPATH" "Python Library (Deprecated)" ) - if ( (EXISTS PYTHON_LIBRARY) AND ( EXISTS ${PYTHON_INCLUDE_DIR}) ) - set ( PYTHONLIBS_FOUND ON) -else() -find_package(PythonLibs) + if ( (EXISTS ${PYTHON_LIBRARY}) AND ( EXISTS ${PYTHON_INCLUDE_DIR}) ) + set ( PYTHONLIBS_FOUND ON ) +# else() + +#find_package(PythonLibs) endif() macro_log_feature (PYTHONLIBS_FOUND "Python" "Use Python System" - "http://www.python.org" FALSE) + "http://www.python.org" FALSE ) include_directories( BEFORE ${PYTHON_INCLUDE_DIR} ) LIST( APPEND - CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_DIR} ${CMAKE_REQUIRED_INCLUDES} ) + CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_DIR} ${CMAKE_REQUIRED_INCLUDES}) check_include_file(Python.h HAVE_PYTHON_H) -endif(WITH_PYTHON) +endif(WITH_PYTHON) \ No newline at end of file diff --git a/packages/python/CMakeLists.txt b/packages/python/CMakeLists.txt index 893a2dee2..99e87025b 100644 --- a/packages/python/CMakeLists.txt +++ b/packages/python/CMakeLists.txt @@ -15,7 +15,7 @@ set (CMAKE_POSITION_INDEPENDENT_CODE TRUE) add_library (YAPPython SHARED ${PYTHON_SOURCES}) - target_link_libraries(YAPPython libYap ${PYTHON_LIBRARIES} + target_link_libraries(YAPPython libYap ${PYTHON_LIBRARY} ${WINDLLS} ${GMP_LIBRARIES})