blobs
This commit is contained in:
parent
1066ded7d9
commit
d6aaa8a03e
@ -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"};
|
||||
|
@ -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 <stdio.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -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 ()
|
||||
|
@ -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);
|
||||
|
81
H/YapBlobs.h
81
H/YapBlobs.h
@ -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
|
@ -21,7 +21,7 @@
|
||||
#define REINIT_LOCK(P) INIT_LOCK(P)
|
||||
#define REINIT_RWLOCK(P) INIT_RWLOCK(P)
|
||||
|
||||
#include <blobs.h>
|
||||
#include <YapBlobs.h>
|
||||
|
||||
#define CharP(ptr) ((char *) (ptr))
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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 <blobs.h>
|
||||
#include "YapBlobs.h"
|
||||
|
||||
#if USE_GMP && !defined(__cplusplus)
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
void Yap_swi_install(void);
|
||||
void Yap_install_blobs(void);
|
||||
|
||||
|
||||
static inline Term
|
||||
SWIModuleToModule(module_t m)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
Reference in New Issue
Block a user