fix warnings

This commit is contained in:
Vitor Santos Costa 2017-10-06 13:05:12 +01:00
parent dd48ba6f91
commit da94db80cf
20 changed files with 213 additions and 154 deletions

View File

@ -68,7 +68,7 @@ static void print_usage(void) {
fprintf(stderr, " -GSize Max Area for Global Stack\n");
fprintf(stderr,
" -LSize Max Area for Local Stack (number must follow L)\n");
fprintf(stderr, " -TSize Max Area for Trail (number must follow L)\n");
fprintf(stderr, " -TSize Max Area for Trail (number must follow T)\n");
fprintf(stderr, " -nosignals disable signal handling from Prolog\n");
fprintf(stderr, "\n[Execution Modes]\n");
fprintf(stderr, " -J0 Interpreted mode (default)\n");

View File

@ -5,18 +5,8 @@ set(SO_MINOR 0)
set(SO_PATCH 0)
set (CXX_SOURCES
yapi.cpp
yapi.cpp
)
set (CXX_HEADERS
yapa.hh
yapdb.hh
yapi.h
yapie.hh
yapq.hh
- yapt.hh
-)
list(APPEND LIBYAP_SOURCES ${CXX_SOURCES} PARENT_SCOPE)
if ( WIN32)

View File

@ -326,7 +326,7 @@ Atom EmptyWakeups[MAX_EMPTY_WAKEUPS] InitEmptyWakeups() RestoreEmptyWakeups()
int MaxEmptyWakeups =0
/* SWI blobs */
struct YAP_blob_t *BlobTypes =NULL RestoreBlobTypes()
struct _PL_blob_t *BlobTypes =NULL RestoreBlobTypes()
struct AtomEntryStruct *Blobs =NULL RestoreBlobs()
UInt NOfBlobs =0
UInt NOfBlobsMax =256

View File

@ -287,7 +287,7 @@ EXTERNAL struct record_list *Yap_Records;
EXTERNAL Atom EmptyWakeups[MAX_EMPTY_WAKEUPS];
EXTERNAL int MaxEmptyWakeups;
/* SWI blobs */
EXTERNAL struct YAP_blob_t *BlobTypes;
EXTERNAL struct _PL_blob_t *BlobTypes;
EXTERNAL struct AtomEntryStruct *Blobs;
EXTERNAL UInt NOfBlobs;
EXTERNAL UInt NOfBlobsMax;

View File

@ -287,7 +287,7 @@
Atom EmptyWakeups_[MAX_EMPTY_WAKEUPS];
int MaxEmptyWakeups_;
/* SWI blobs */
struct YAP_blob_t *BlobTypes_;
struct _PL_blob_t *BlobTypes_;
struct AtomEntryStruct *Blobs_;
UInt NOfBlobs_;
UInt NOfBlobsMax_;

View File

@ -18,6 +18,6 @@
static void InitWorker(int wid){
#include "locals.h"
} w_local;
} ;
#endif

View File

@ -15,9 +15,13 @@
* *
*************************************************************************/
#ifndef SSHIFT_H
#define SSHIFT_H
#define REINIT_LOCK(P) INIT_LOCK(P)
#define REINIT_RWLOCK(P) INIT_RWLOCK(P)
#include <blobs.h>
#define CharP(ptr) ((char *) (ptr))
@ -461,8 +465,6 @@ NoAGCAtomAdjust__ (Atom at USES_REGS)
return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + LOCAL_HDiff)));
}
INLINE_ONLY inline EXTERN Prop PropAdjust__ (Prop CACHE_TYPE);
INLINE_ONLY inline EXTERN Prop
@ -474,12 +476,12 @@ PropAdjust__ (Prop p USES_REGS)
#endif
INLINE_ONLY inline EXTERN struct YAP_blob_t *BlobTypeAdjust__ (struct YAP_blob_t *CACHE_TYPE);
INLINE_ONLY inline EXTERN YAP_blob_t *BlobTypeAdjust__ (YAP_blob_t *CACHE_TYPE);
INLINE_ONLY inline EXTERN struct YAP_blob_t *
BlobTypeAdjust__ (struct YAP_blob_t *at USES_REGS)
INLINE_ONLY inline EXTERN YAP_blob_t *
BlobTypeAdjust__ ( YAP_blob_t *at USES_REGS)
{
return (struct YAP_blob_t *) ((at == NULL ? (at) : (struct YAP_blob_t *) (CharP (at) + LOCAL_HDiff)));
return ( YAP_blob_t *) ((at == NULL ? (at) : ( YAP_blob_t *) (CharP (at) + LOCAL_HDiff)));
}
INLINE_ONLY inline EXTERN PredEntry *PredEntryAdjust__ (PredEntry * CACHE_TYPE);
@ -1138,3 +1140,4 @@ IsGlobal__ (CELL reg USES_REGS)
void Yap_AdjustStacksAndTrail(void);
void Yap_AdjustRegs(int);
#endif

View File

@ -1,22 +1,5 @@
set (OPTYap_HEADERS
opt.config.h
opt.proto.h
opt.structs.h
opt.macros.h
or.macros.h
or.sba_amiops.h
or.sba_unify.h
tab.structs.h
locks_x86.h
locks_sparc.h
locks_mips.h
locks_mips_funcs.h
locks_alpha.h
locks_alpha_funcs.h
locks_pthread.h
)
set (OPTYap_SOURCES
or.memory.c
opt.init.c
@ -82,7 +65,7 @@ endif ()
set (POSITION_INDEPENDENT_CODE TRUE)
SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 )
add_component (libOPTYap
add_component (libOPTYap
${OPTYap_SOURCES} )

View File

@ -407,5 +407,5 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/../YapTermConfig.h.cmake
configure_file(${CMAKE_CURRENT_LIST_DIR}/../config.h.cmake
${CMAKE_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_LIST_DIR}/../GitSHA1.c.in GitSHA1.c @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/../os/YapIOConfig.h.cmake ${CMAKE_BINARY_DIR}/os/YapIOConfig.h)
configure_file(${CMAKE_CURRENT_LIST_DIR}/../os/YapIOConfig.h.cmake ${CMAKE_BINARY_DIR}/YapIOConfig.h)

View File

@ -104,65 +104,173 @@ set(C_INTERFACE_SOURCES
list(APPEND LIBYAP_SOURCES ${C_INTERFACE_SOURCES} ${ENGINE_SOURCES})
set (HEADERS
H/Atoms.h
H/sshift.h
H/Yap.h
H/Yatom.h
H/YapHeap.h
H/Regs.h
H/Yapproto.h
H/absmi.h
H/absmi-switch.h
H/absmi-threaded.h
H/absmi-traced.h
H/alloc.h
H/amidefs.h
H/amiops.h
H/arrays.h
H/arith2.h
H/attvar.h
H/blobs.h
H/clause.h
H/YapCompile.h
H/corout.h
H/dlmalloc.h
H/generated/dglobals.h
H/generated/dlocals.h
H/generated/dhstruct.h
H/YapEval.h
H/heapgc.h
H/generated/hglobals.h
H/generated/hlocals.h
H/generated/hstruct.h
H/generated/iglobals.h
H/generated/ihstruct.h
H/generated/ilocals.h
H/index.h
H/inline-only.h
H/qly.h
H/rclause.h
H/generated/rglobals.h
H/generated/rlocals.h
H/rheap.h
H/generated/rhstruct.h
H/threads.h
H/tracer.h
H/trim_trail.h
H/YapSignals.h
H/YapGFlagInfo.h
H/YapFlags.h
H/YapLFlagInfo.h
H/YapText.h
H/cut_c.h
H/generated/iatoms.h
H/generated/ratoms.h
H/generated/tatoms.h
CXX/yapdb.hh
CXX/yapi.hh
BEAM/eam.h BEAM/eamamasm.h
set( BEAM_HEADERS
BEAM/beam.h
)
set (CORE_HEADERS
${CMAKE_SOURCE_DIR}/H/Atoms.h
${CMAKE_SOURCE_DIR}/H/Foreign.h
${CMAKE_SOURCE_DIR}/H/Regs.h
${CMAKE_SOURCE_DIR}/H/ScannerTypes.h
${CMAKE_SOURCE_DIR}/H/Tags_24bits.h
${CMAKE_SOURCE_DIR}/H/Tags_32LowTag.h
${CMAKE_SOURCE_DIR}/H/Tags_32Ops.h
${CMAKE_SOURCE_DIR}/H/Tags_32bits.h
${CMAKE_SOURCE_DIR}/H/Tags_64bits.h
${CMAKE_SOURCE_DIR}/H/TermExt.h
${CMAKE_SOURCE_DIR}/H/Yap.h
${CMAKE_SOURCE_DIR}/H/YapAppliedOpcodes.h
${CMAKE_SOURCE_DIR}/H/YapCompile.h
${CMAKE_SOURCE_DIR}/H/YapCompoundTerm.h
${CMAKE_SOURCE_DIR}/H/YapEval.h
${CMAKE_SOURCE_DIR}/H/YapFlags.h
${CMAKE_SOURCE_DIR}/H/YapGFlagInfo.h
${CMAKE_SOURCE_DIR}/H/YapHandles.h
${CMAKE_SOURCE_DIR}/H/YapHeap.h
${CMAKE_SOURCE_DIR}/H/YapLFlagInfo.h
${CMAKE_SOURCE_DIR}/H/YapOpcodes.h
${CMAKE_SOURCE_DIR}/H/YapSignals.h
${CMAKE_SOURCE_DIR}/H/YapTags.h
${CMAKE_SOURCE_DIR}/H/YapTerm.h
${CMAKE_SOURCE_DIR}/H/YapText.h
${CMAKE_SOURCE_DIR}/H/Yapproto.h
${CMAKE_SOURCE_DIR}/H/Yatom.h
${CMAKE_SOURCE_DIR}/H/absmi-interpretrer.h
${CMAKE_SOURCE_DIR}/H/absmi-switch.h
${CMAKE_SOURCE_DIR}/H/absmi-threaded.h
${CMAKE_SOURCE_DIR}/H/absmi-traced.h
${CMAKE_SOURCE_DIR}/H/absmi.h
${CMAKE_SOURCE_DIR}/H/alloc.h
${CMAKE_SOURCE_DIR}/H/amidefs.h
${CMAKE_SOURCE_DIR}/H/amijit.h
${CMAKE_SOURCE_DIR}/H/amiops.h
${CMAKE_SOURCE_DIR}/H/arith2.h
${CMAKE_SOURCE_DIR}/H/arrays.h
${CMAKE_SOURCE_DIR}/H/attvar.h
${CMAKE_SOURCE_DIR}/H/clause.h
${CMAKE_SOURCE_DIR}/H/corout.h
${CMAKE_SOURCE_DIR}/H/cut_c.h
${CMAKE_SOURCE_DIR}/H/dlmalloc.h
${CMAKE_SOURCE_DIR}/H/fields.h
${CMAKE_SOURCE_DIR}/H/findclause.h
${CMAKE_SOURCE_DIR}/H/generated/dglobals.h
${CMAKE_SOURCE_DIR}/H/generated/dhstruct.h
${CMAKE_SOURCE_DIR}/H/generated/h0globals.h
${CMAKE_SOURCE_DIR}/H/generated/h0struct.h
${CMAKE_SOURCE_DIR}/H/generated/hglobals.h
${CMAKE_SOURCE_DIR}/H/generated/hlocals.h
${CMAKE_SOURCE_DIR}/H/generated/hstruct.h
${CMAKE_SOURCE_DIR}/H/generated/i0globals.h
${CMAKE_SOURCE_DIR}/H/generated/iatoms.h
${CMAKE_SOURCE_DIR}/H/generated/iglobals.h
${CMAKE_SOURCE_DIR}/H/generated/ihstruct.h
${CMAKE_SOURCE_DIR}/H/generated/ilocals.h
${CMAKE_SOURCE_DIR}/H/generated/ratoms.h
${CMAKE_SOURCE_DIR}/H/generated/rglobals.h
${CMAKE_SOURCE_DIR}/H/generated/rhstruct.h
${CMAKE_SOURCE_DIR}/H/generated/rlocals.h
${CMAKE_SOURCE_DIR}/H/generated/tatoms.h
${CMAKE_SOURCE_DIR}/H/globals.h
${CMAKE_SOURCE_DIR}/H/headclause.h
${CMAKE_SOURCE_DIR}/H/heap.h
${CMAKE_SOURCE_DIR}/H/heapgc.h
${CMAKE_SOURCE_DIR}/H/index.h
${CMAKE_SOURCE_DIR}/H/inline-only.h
${CMAKE_SOURCE_DIR}/H/iswiatoms.h
${CMAKE_SOURCE_DIR}/H/locals.h
${CMAKE_SOURCE_DIR}/H/nolocks.h
${CMAKE_SOURCE_DIR}/H/qly.h
${CMAKE_SOURCE_DIR}/H/rclause.h
${CMAKE_SOURCE_DIR}/H/rheap.h
${CMAKE_SOURCE_DIR}/H/saveclause.h
${CMAKE_SOURCE_DIR}/H/sig.h
${CMAKE_SOURCE_DIR}/H/sshift.h
${CMAKE_SOURCE_DIR}/H/threads.h
${CMAKE_SOURCE_DIR}/H/tracer.h
${CMAKE_SOURCE_DIR}/H/trim_trail.h
${CMAKE_SOURCE_DIR}/H/udi_private.h
${CMAKE_SOURCE_DIR}/H/utarray.h
${CMAKE_SOURCE_DIR}/H/uthash.h
${CMAKE_SOURCE_DIR}/H/walkclause.h
${CMAKE_SOURCE_DIR}/H/yerror.h
)
set (INCLUDE_HEADERS
${CMAKE_SOURCE_DIR}/include/GitSHA1.h
${CMAKE_SOURCE_DIR}/include/SWI-Prolog.h
${CMAKE_SOURCE_DIR}/include/VFS.h
${CMAKE_SOURCE_DIR}/include/YapDefs.h
${CMAKE_SOURCE_DIR}/include/YapError.h
${CMAKE_SOURCE_DIR}/include/YapErrors.h
${CMAKE_SOURCE_DIR}/include/YapFormat.h
${CMAKE_SOURCE_DIR}/include/YapInterface.h
${CMAKE_SOURCE_DIR}/include/YapRegs.h
${CMAKE_SOURCE_DIR}/include/YapStreams.h
${CMAKE_SOURCE_DIR}/include/blobs.h
${CMAKE_SOURCE_DIR}/include/c_interface.h
${CMAKE_SOURCE_DIR}/include/clause_list.h
${CMAKE_SOURCE_DIR}/include/pl-types.h
${CMAKE_SOURCE_DIR}/include/udi.h
)
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
)
set (CXX_HEADERS
${CMAKE_SOURCE_DIR}/CXX/yapa.hh
${CMAKE_SOURCE_DIR}/CXX/yapdb.hh
${CMAKE_SOURCE_DIR}/CXX/yapi.hh
${CMAKE_SOURCE_DIR}/CXX/yapie.hh
${CMAKE_SOURCE_DIR}/CXX/yapq.hh
${CMAKE_SOURCE_DIR}/CXX/yapt.hh
)
set (PYTHON_HEADERS ${CMAKE_SOURCE_DIR}/packages/python/py4yap.h)
set (OPTYap_HEADERS
${CMAKE_SOURCE_DIR}/OPTYap/opt.config.h
${CMAKE_SOURCE_DIR}/OPTYap/opt.proto.h
${CMAKE_SOURCE_DIR}/OPTYap/opt.structs.h
${CMAKE_SOURCE_DIR}/OPTYap/opt.macros.h
${CMAKE_SOURCE_DIR}/OPTYap/or.macros.h
${CMAKE_SOURCE_DIR}/OPTYap/or.sba_amiops.h
${CMAKE_SOURCE_DIR}/OPTYap/or.sba_unify.h
${CMAKE_SOURCE_DIR}/OPTYap/tab.structs.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_x86.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_sparc.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_mips.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_mips_funcs.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_alpha.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_alpha_funcs.h
${CMAKE_SOURCE_DIR}/OPTYap/locks_pthread.h
)
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
${CMAKE_SOURCE_DIR}/os/sysbits.h
${CMAKE_SOURCE_DIR}/os/yapio.h
)
list( APPEND c_headers ${CMAKE_SOURCE_DIR}/utf8proc/utf8proc.h )
list( APPEND c_headers ${YAPOS_HEADERS} )
list( APPEND c_headers ${OPTYap_HEADERS} )
list( APPEND c_headers ${INCLUDE_HEADERS} )
list( APPEND c_headers ${CORE_HEADERS} )
list (APPEND c_headers ${PYTHON_HEADERS})
#list( APPEND c_headers ${CONFIGURATION_HEADERS} )
list( APPEND cxx_headers ${CXX_HEADERS} )
set(STATIC_SOURCES

View File

@ -223,13 +223,13 @@ X_API int PL_get_nchars(term_t l, size_t *lengthp, char **s, unsigned flags) {
out.type |= YAP_STRING_NCHARS;
out.max = *lengthp;
}
char *sf = malloc(strlen(out.val.c)+1);
strcpy(sf, out.val.c);
if (!Yap_CVT_Text(&inp, &out PASS_REGS)) {
pop_text_stack(lvl);
return false;
}
*s = out.val.c = sf;
if (*s) {
*s = out.val.c;
}
return true;
}

View File

@ -29,12 +29,12 @@ main :-
file_filter_with_initialization('H/GLOBALS','H/generated/h0globals.h',gen_0struct,Warning,['hglobals.h','GLOBALS']),
file_filter_with_initialization('H/GLOBALS','H/generated/hglobals.h',gen_struct,Warning,['hglobals.h','GLOBALS']),
file_filter_with_initialization('H/GLOBALS','H/generated/dglobals.h',gen_dstruct,Warning,['dglobals.h','GLOBALS']),
file_filter_with_initialization('H/GLOBALS','H/generated/iglobals.h',gen_init,Warning,['iglobals.h','GLOBALS']),
file_filter_with_initialization('H/GLOBALS','H/generated/iglobals.h',gen_init,Warning,['iglobals.h','GLOBALS']).
%% file_filter_with_initialization('H/GLOBALS','H/generated/i0globals.h',gen_0init,Warning,['iglobals.h','GLOBALS']),
file_filter_with_initialization('H/LOCALS','H/generated/hlocals.h',gen_struct,Warning,['hlocals.h','LOCALS']),
file_filter_with_initialization('H/LOCALS','H/generated/dlocals.h',gen_dstruct,Warning,['dlocals.h','LOCALS']),
file_filter_with_initialization('H/LOCALS','H/generated/rlocals.h',gen_hstruct,Warning,['rlocals.h','LOCALS']),
file_filter_with_initialization('H/LOCALS','H/generated/ilocals.h',gen_init,Warning,['ilocals.h','LOCALS']).
% file_filter_with_initialization('H/LOCALS','H/generated/hlocals.h',gen_struct,Warning,['hlocals.h','LOCALS']),
% file_filter_with_initialization('H/LOCALS','H/generated/dlocals.h',gen_dstruct,Warning,['dlocals.h','LOCALS']),
% file_filter_with_initialization('H/LOCALS','H/generated/rlocals.h',gen_hstruct,Warning,['rlocals.h','LOCALS']),
% file_filter_with_initialization('H/LOCALS','H/generated/ilocals.h',gen_init,Warning,['ilocals.h','LOCALS']).
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildlocalglobal\"~n please do not update, update H/~a instead */~n~n').

View File

@ -27,16 +27,7 @@ set (YAPOS_SOURCES
ypstdio.c
)
set (YAPOS_HEADERS
encoding.h
iopreds.h
fmemopen.h
yapio.h
sysbits.h
VFS.h
)
include_directories (../H ../include ../OPTYap . ${GMP_INCLUDE_DIR} ${PROJECT_BINARY_DIR})
include_directories (../H ../include ../OPTYap . ${GMP_INCLUDE_DIR} ${PROJECT_BINARY_DIR} PARENT_SCOPE)
SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 )
@ -84,7 +75,7 @@ include(CheckVariableExists)
if (WITH_READLINE)
macro_optional_find_package (Readline ON)
if (READLINE_FOUND)
# - Find the readline library
# This module defines

View File

@ -168,7 +168,7 @@ open_mem_read_stream(USES_REGS1) /* $open_mem_read_stream(+List,-Stream) */
if (!buf) {
return false;
}
buf = export_block( buf );
buf = export_block( (char *)buf );
pop_text_stack(l);
sno = Yap_open_buf_read_stream(buf, strlen(buf) + 1, &LOCAL_encoding,
MEM_BUF_MALLOC);

View File

@ -25,7 +25,7 @@
#include <stdio.h>
#include <wchar.h>
#include "os/YapIOConfig.h"
#include "YapIOConfig.h"
#include <Yatom.h>
#ifndef _PL_WRITE_

View File

@ -3,9 +3,6 @@
set (PYTHON_SOURCES python.c pl2py.c pybips.c py2pl.c pl2pl.c pypreds.c)
set (PYTHON_HEADERS py4yap.h)
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
include_directories( ${CMAKE_BINARY_DIR}

View File

@ -11,13 +11,11 @@ set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/yapi.py ${CMAKE_CURRENT_S
configure_file("setup.py.in" ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
configure_file("MANIFEST.in" ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.in)
configure_file(../../swig/yap.i ${CMAKE_CURRENT_BINARY_DIR}/yap.i)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/YAP4PY.md" ${CMAKE_CURRENT_BINARY_DIR}/README)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/packages/python" "${CMAKE_SOURCE_DIR}/CXX")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/yap4py/include")
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_FLAGS "-O;-py3")
@ -33,7 +31,7 @@ else()
set_target_properties ( ${SWIG_MODULE_Py2YAP_REAL_NAME}
PROPERTIES
NO_SONAME ON
OUTPUT_NAME _yap
OUTPUT_NAME yapc
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS YAPPython YAPPython YAP++
)
@ -54,9 +52,16 @@ else()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl)
file(COPY ../../swig/yap.i DESTINATION .)
file(COPY ${CMAKE_SOURCE_DIR}/CXX/yapi.cpp DESTINATION .)
file(COPY ${pl_library} DESTINATION yap4py/prolog)
file(COPY ${pl_os_library} DESTINATION yap4py/prolog/os)
file(COPY ${c_headers} DESTINATION yap4py/include)
file(COPY ${cxx_headers} DESTINATION yap4py/include)
add_custom_target( YAP4PY ALL
# COMMAND ${CMAKE_COMMAND} -E copy ${YAP_DLLS} ${CMAKE_BINARY_DIR}/startup.yss ${CMAKE_CURRENT_BINARY_DIR}/yap4py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/startup.yss ${CMAKE_CURRENT_BINARY_DIR}/yap4py
COMMAND ${CMAKE_COMMAND} -E copy ${CONFIGURATION_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/include
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_wheel
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS STARTUP ${PYTHON_SOURCES} ${PROLOG_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/setup.py ${SWIG_MODULE_Py2YAP_REAL_NAME} )

View File

@ -56,6 +56,7 @@ libpyauxdir = abspath(os.path.dirname('stdlib'))
sys.path.insert(0, "${CMAKE_CURRENT_SOURCE_DIR}")
if 'conda' in sys.version or 'Continuum' in sys.version:\
my_extra_link_args = []
if platform.system() == 'Windows':
local_libs = []
@ -63,7 +64,7 @@ if platform.system() == 'Windows':
my_extra_link_args = ['-Wl,-export-all-symbols']
else:
# if platform.system() == 'Darwin':
my_extra_link_args = ['-Wl,-rpath', '-Wl,'+libpydir,'-Wl,-rpath', '-Wl,'+libpyauxdir, ]
my_extra_link_args = []
win_libs = []
local_libs = ['Py4YAP']
# or dll in glob('yap/dlls/*'):
@ -73,28 +74,12 @@ native_sources = ["yap.i",'yapi.cpp']
for i in '${PYTHON_SOURCES}'.split(";"):
copy2(i, 'yap4py')
for i in '${pl_library}'.split(";") + '${pl_swi_library}'.split(";") :
copy2(i, 'yap4py/prolog')
for i in '${pl_os_library}'.split(";") :
copy2(i, 'yap4py/prolog/os')
for i in '${pl_boot_library}'.split(";") :
copy2(i, 'yap4py/prolog/pl')
my_libs0 = '${YAP_DLLS}'.split(";")+['${CMAKE_BINARY_DIR}/startup.yss']
my_libs0 = '${YAP_DLLS}'.split(";")
my_libs = []
for i in my_libs0:
my_libs = glob(i) + my_libs
for i in my_libs:
copy2(i, 'yap4py')
my_includes = ['${CMAKE_SOURCE_DIR}/CXX', '${CMAKE_SOURCE_DIR}/include',
'${CMAKE_SOURCE_DIR}/H', '${CMAKE_SOURCE_DIR}/H/generated',
'${CMAKE_SOURCE_DIR}/os', '${CMAKE_SOURCE_DIR}/OPTYap',
'${CMAKE_SOURCE_DIR}/utf8proc',
'${CMAKE_SOURCE_DIR}/packages/python',
'${CMAKE_BINARY_DIR}']
for i in my_includes:
includes = glob(i+"/*.??h")
for j in includes:
copy2(j, 'yap4py/include')
here = path.abspath(path.dirname(__file__))
#gmp_dir = path.abspath(path.dirname("${GMP_LIBRARIES}"))
#python_libdir = path.abspath(path.dirname("${PYTHON_LIBRARIES}")
@ -108,12 +93,12 @@ extensions = [Extension('_yap', native_sources,
('_YAP_NOT_INSTALLED_', '1'),
('YAP_PYTHON', '1'),
('_GNU_SOURCE', '1')],
runtime_library_dirs=['yap4py', '${libdir}', '${bindir}', '${gmp_dir}', '${python_libdir}'],
runtime_library_dirs=['yap4py'],
swig_opts=['-modern', '-c++', '-py3',
'-DX_API', '-Iyap4py/include' ],
library_dirs=['../../..', '../../../CXX', 'yap4py/include', '..', "${bindir}"],
library_dirs=["yap4py"],
extra_link_args=my_extra_link_args,
libraries=['Yap','gmp']+win_libs+local_libs,
libraries=['Yap','Py4YAP','gmp']+win_libs+local_libs,
include_dirs=['yap4py/include']
)]

View File

@ -20,8 +20,5 @@ else:
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
ctypes.CDLL(dll, mode=ctypes.RTLD_GLOBAL)
load('libYap*')
if platform.system() == 'Apple':
load('libYAP+*')
load('libPy4YAP*')
load('libPy4YAP*')

View File

@ -1,4 +1,4 @@
"""The main routine of the yap python project."""
"""The main routine of the yap python project."""
import sys
import yap4py.yapi
@ -11,4 +11,4 @@ def main(**args):
if __name__ == "__main__":
main()
yap4py.yapi.live()
yap4py.yapi.main()