From d6aaa8a03ee46cb2f8fdbc75adb0ac03e77e9e07 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 23 Feb 2018 14:09:58 +0000 Subject: [PATCH] blobs --- C/blobs.c | 2 +- C/threads.c | 2 +- CMakeLists.txt | 5 ++- CXX/yapi.cpp | 2 +- H/YapBlobs.h | 81 ----------------------------------- H/sshift.h | 2 +- cmake/Sources.cmake | 2 - include/SWI-Prolog.h | 2 +- library/dialect/swi/fli/swi.h | 1 + os/files.c | 3 +- packages/bdd/CMakeLists.txt | 4 +- 11 files changed, 14 insertions(+), 92 deletions(-) delete mode 100644 H/YapBlobs.h diff --git a/C/blobs.c b/C/blobs.c index 2223478cc..be3eb8486 100644 --- a/C/blobs.c +++ b/C/blobs.c @@ -17,7 +17,7 @@ /* for freeBSD9.1 */ #define _WITH_DPRINTF -#include "blobs.h" +#include "YapBlobs.h" static blob_type_t unregistered_blob_atom = { YAP_BLOB_MAGIC_B, PL_BLOB_NOCOPY | PL_BLOB_TEXT, "unregistered"}; diff --git a/C/threads.c b/C/threads.c index 2101f2642..cbe9b992b 100644 --- a/C/threads.c +++ b/C/threads.c @@ -28,7 +28,7 @@ static char SccsId[] = "%W% %G%"; #include "YapHeap.h" #include "YapEval.h" #include "yapio.h" -#include "blobs.h" +#include "YapBlobs.h" #include #if HAVE_UNISTD_H #include diff --git a/CMakeLists.txt b/CMakeLists.txt index be9d33482..30f0d0d97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -686,8 +686,11 @@ if (PYTHONLIBS_FOUND AND SWIG_FOUND) include(FindPythonModule) find_python_module(jupyter) + find_python_module(wheel) + find_python_module(setuptools) + find_python_module(backcall) - if (PY_JUPYTER) + if (PY_JUPYTER AND PY_WHEEL AND PY_SETUPTOOLS AND PY_BACKCALL) add_subdirectory(packages/python/yap_kernel) ENDIF () endif () diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index 13976105d..a8c46546b 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -11,7 +11,7 @@ extern "C" { #endif #include "YapInterface.h" -#include "blobs.h" +#include "YapBlobs.h" #include "iopreds.h" X_API char *Yap_TermToBuffer(Term t, encoding_t encodingp, int flags); diff --git a/H/YapBlobs.h b/H/YapBlobs.h deleted file mode 100644 index 0e0f73803..000000000 --- a/H/YapBlobs.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// blobs.h -// yap -// -// Created by VITOR SANTOS COSTA on 09/05/15. -// Copyright (c) 2015 VITOR SANTOS COSTA. All rights reserved. -// - -// based on the SWI Blob implementation, an extension of atoms for SWI-Prolog - -#ifndef BLOBS_H -#define BLOBS_H - -#if !defined(X_API) && !defined(SWIGYAP) -#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(PL_KERNEL) -#define X_API __declspec(dllexport) -#else -#define X_API -#endif -#endif - -/******************************* - * BLOBS * - *******************************/ - -#define YAP_BLOB_MAGIC_B 0x75293a00 /* Magic to validate a blob-type */ -#define PL_BLOB_VERSION (YAP_BLOB_MAGIC_B|PL_BLOB_VERSION) - -#define PL_BLOB_UNIQUE 0x01 /* Blob content is unique */ -#define PL_BLOB_TEXT 0x02 /* blob contains text */ -#define PL_BLOB_NOCOPY 0x04 /* do not copy the data */ -#define PL_BLOB_WCHAR 0x08 /* wide character string */ - -typedef struct YAP_blob_t -{ uintptr_t magic; /* YAP_BLOB_MAGIC */ - uintptr_t flags; /* YAP_BLOB_* */ - char * name; /* name of the type */ - int (*release)(Atom a); - int (*compare)(Atom a, Atom b); -#ifdef SIO_MAGIC - int (*write)(FILE *s, Atom a, int flags); -#else - int (*write)(void *s, Atom a, int flags); -#endif - void (*acquire)(Atom a); -#ifdef SIO_MAGIC - int (*save)(Atom a, FILE *s); - Atom (*load)(FILE *s); -#else - int (*save)(Atom a, void*); - Atom (*load)(void *s); -#endif - /* private */ - void * reserved[10]; /* for future extension */ - int registered; /* Already registered? */ - int rank; /* Rank for ordering atoms */ - struct YAP_blob_t * next; /* next in registered type-chain */ - Atom atom_name; /* Name as atom */ -} blob_type_t; - -int Yap_write_blob(AtomEntry *ref, FILE *stream); -char * Yap_blob_to_string(AtomEntry *ref, const char *s, size_t sz); -X_API bool YAP_is_blob(YAP_Term t, blob_type_t **type); -X_API bool YAP_unify_blob(YAP_Term *t, void *blob, size_t len, - blob_type_t *type); -X_API bool YAP_put_blob(YAP_Term *t, void *blob, size_t len, - blob_type_t *type); -X_API bool YAP_get_blob(YAP_Term t, void **blob, size_t *len, - blob_type_t **type); - -X_API void* YAP_blob_data(Atom a, - size_t *len, - struct YAP_blob_t **type); - -X_API void YAP_register_blob_type(blob_type_t *type); -X_API blob_type_t* YAP_find_blob_type(const char* name); -//YAP_blob_type_t* YAP_find_blob_type(Atom at); -X_API bool YAP_unregister_blob_type(blob_type_t *type); - - -#endif diff --git a/H/sshift.h b/H/sshift.h index c21bb4f85..12e647431 100644 --- a/H/sshift.h +++ b/H/sshift.h @@ -21,7 +21,7 @@ #define REINIT_LOCK(P) INIT_LOCK(P) #define REINIT_RWLOCK(P) INIT_RWLOCK(P) -#include +#include #define CharP(ptr) ((char *) (ptr)) diff --git a/cmake/Sources.cmake b/cmake/Sources.cmake index 6588c25c0..8346ffc9d 100644 --- a/cmake/Sources.cmake +++ b/cmake/Sources.cmake @@ -216,8 +216,6 @@ set (INCLUDE_HEADERS set (CONFIGURATION_HEADERS ${CMAKE_BINARY_DIR}/YapConfig.h ${CMAKE_BINARY_DIR}/YapTermConfig.h - ${CMAKE_BINARY_DIR}/config.h - ${CMAKE_BINARY_DIR}/cudd_config.h ${CMAKE_BINARY_DIR}/dlocals.h ${CMAKE_BINARY_DIR}/YapIOConfig.h ) diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index d66d34a2a..a66e3e727 100755 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -692,7 +692,7 @@ PL_EXPORT(int) PL_resource_error(const char *resource); #define PL_set_feature PL_set_prolog_flag /* compatibility */ PL_EXPORT(int) PL_set_prolog_flag(const char *name, int type, ...); -#include +#include "YapBlobs.h" #if USE_GMP && !defined(__cplusplus) diff --git a/library/dialect/swi/fli/swi.h b/library/dialect/swi/fli/swi.h index 26cc9673a..a6a90916b 100644 --- a/library/dialect/swi/fli/swi.h +++ b/library/dialect/swi/fli/swi.h @@ -43,6 +43,7 @@ void Yap_swi_install(void); void Yap_install_blobs(void); + static inline Term SWIModuleToModule(module_t m) { diff --git a/os/files.c b/os/files.c index 75cf0e3bd..6fd7f4bf5 100644 --- a/os/files.c +++ b/os/files.c @@ -408,7 +408,6 @@ static Int access_file(USES_REGS1) { } VFS_t *vfs; if ((vfs = vfs_owner(ares))) { - bool rc = true; vfs_stat o; if (vfs->stat(vfs, ares, &o)) { if (atmode == AtomExist) @@ -430,7 +429,7 @@ static Int access_file(USES_REGS1) { return FALSE; } } else { - rc = false; + return true; } } #if HAVE_ACCESS diff --git a/packages/bdd/CMakeLists.txt b/packages/bdd/CMakeLists.txt index f8b608d77..88b7de0b5 100644 --- a/packages/bdd/CMakeLists.txt +++ b/packages/bdd/CMakeLists.txt @@ -50,7 +50,9 @@ IF (CUDD_FOUND) add_subdirectory(simplecudd_lfi) set(YAP_SYSTEM_OPTIONS "cudd " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE) - install(TARGETS cudd + INSTALL(FILES ${CMAKE_BINARY_DIR}/cudd_config.h DESTINATION ${includedir}) + +install(TARGETS cudd LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR} RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR} ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}