Merge branch 'master' of github.com:vscosta/yap-6.3

This commit is contained in:
Vitor Santos Costa 2017-11-18 00:27:26 +00:00
commit 484213efb6
21 changed files with 229 additions and 149 deletions

View File

@ -88,6 +88,7 @@ struct foreign_context {
struct PL_local_data *engine; /* invoking engine */ struct PL_local_data *engine; /* invoking engine */
}; };
X_API bool python_in_python; X_API bool python_in_python;
X_API int YAP_Reset(yap_reset_t mode); X_API int YAP_Reset(yap_reset_t mode);
@ -2426,7 +2427,6 @@ static void do_bootfile(const char *bootfilename USES_REGS) {
/* ignore repeated calls to YAP_Init */ /* ignore repeated calls to YAP_Init */
if (YAP_initialized) if (YAP_initialized)
return YAP_FOUND_BOOT_ERROR; return YAP_FOUND_BOOT_ERROR;
Yap_embedded = yap_init->Embedded; Yap_embedded = yap_init->Embedded;
Yap_page_size = Yap_InitPageSize(); /* init memory page size, required by Yap_page_size = Yap_InitPageSize(); /* init memory page size, required by
later functions */ later functions */

View File

@ -79,9 +79,8 @@ char *Yap_FindExecutable(void) {
} }
return "yap"; return "yap";
#elif defined(__linux__) #elif defined(__linux__)
enum { BUFFERSIZE = 1024 }; char *buf = malloc(YAP_FILENAME_MAX);
char *buf = malloc(BUFFERSIZE); ssize_t len = readlink("/proc/self/exe", buf, YAP_FILENAME_MAX - 1);
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
if (len != -1) { if (len != -1) {
buf[len] = '\0'; buf[len] = '\0';
@ -194,7 +193,6 @@ static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
/* load libraries first so that their symbols are available to /* load libraries first so that their symbols are available to
other routines */ other routines */
/* dlopen wants to follow the LD_CONFIG_PATH */
const char *file = AtomName(ofiles->name); const char *file = AtomName(ofiles->name);
if (!Yap_findFile(file, NULL, NULL, LOCAL_FileNameBuf, true, YAP_OBJ, true, if (!Yap_findFile(file, NULL, NULL, LOCAL_FileNameBuf, true, YAP_OBJ, true,
true)) { true)) {

View File

@ -79,11 +79,18 @@ static char *Yap_AlwaysAllocCodeSpace(UInt size) {
return out; return out;
} }
static void QLYR_ERROR(qlfr_err_t my_err) {
#define QLYR_ERROR(err) \
QLYR_ERROR__(__FILE__, __FUNCTION__, __LINE__, err)
static void QLYR_ERROR__(const char *file, const char *function, int lineno,
qlfr_err_t my_err) {
// __android_log_print(ANDROID_LOG_INFO, "YAP ", "error %s in saved state // __android_log_print(ANDROID_LOG_INFO, "YAP ", "error %s in saved state
// %s",GLOBAL_RestoreFile, qlyr_error[my_err]); // %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
Yap_Error(SYSTEM_ERROR_SAVED_STATE, TermNil, "error %s in saved state %s", Yap_Error__(file, function, lineno, SYSTEM_ERROR_SAVED_STATE, TermNil, "error %s in saved state %s",
GLOBAL_RestoreFile, qlyr_error[my_err]); GLOBAL_RestoreFile, qlyr_error[my_err]);
Yap_exit(1); Yap_exit(1);
} }
@ -638,7 +645,7 @@ static bool checkChars(FILE *stream, char s[]) {
} }
static Atom do_header(FILE *stream) { static Atom do_header(FILE *stream) {
char s[2560], *p = s, ch; char s[2048], *p = s, ch;
Atom at; Atom at;
if (!checkChars(stream, "#!/bin/sh\nexec_dir=${YAPBINDIR:-")) if (!checkChars(stream, "#!/bin/sh\nexec_dir=${YAPBINDIR:-"))
@ -1044,6 +1051,8 @@ static void ReInitProlog(void) {
static Int qload_program(USES_REGS1) { static Int qload_program(USES_REGS1) {
FILE *stream; FILE *stream;
Term t1 = Deref(ARG1); Term t1 = Deref(ARG1);
if (IsVarTerm(t1)) { if (IsVarTerm(t1)) {

View File

@ -727,14 +727,15 @@ static size_t save_ops(FILE *stream, Term mod) {
return 1; return 1;
} }
static int save_header(FILE *stream, char type[]) { static size_t save_header(FILE *stream, char type[]) {
char msg[256 * 16]; char msg[2048];
memset(msg, 0, 2048);
sprintf(msg, sprintf(msg,
"#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 " "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 "
"\"$@\"\n%s %s\n", "\"$@\"\n%s %s\n",
YAP_BINDIR, type, YAP_FULL_VERSION); YAP_BINDIR, type, YAP_FULL_VERSION);
return save_bytes(stream, msg, strlen(msg) + 1); return save_bytes(stream, msg, 2048);
} }
static size_t save_module(FILE *stream, Term mod) { static size_t save_module(FILE *stream, Term mod) {

View File

@ -45,6 +45,18 @@
#include <direct.h> #include <direct.h>
#endif #endif
#ifndef YAP_ROOTDIR
#include <libgen.h>
char
*YAP_BINDIR,
*YAP_ROOTDIR,
*YAP_SHAREDIR,
*YAP_LIBDIR,
*YAP_YAPLIB;
#endif
static void print_usage(void) { static void print_usage(void) {
fprintf(stderr, "\n[ Valid switches for command line arguments: ]\n"); fprintf(stderr, "\n[ Valid switches for command line arguments: ]\n");
fprintf(stderr, " -? Shows this screen\n"); fprintf(stderr, " -? Shows this screen\n");
@ -147,6 +159,7 @@ YAP_file_type_t Yap_InitDefaults(YAP_init_args *iap, char saved_state[],
#endif #endif
iap->Argc = argc; iap->Argc = argc;
iap->Argv = argv; iap->Argv = argv;
iap->YapLibDir = YAP_YAPLIB;
return iap->boot_file_type; return iap->boot_file_type;
} }
@ -155,6 +168,33 @@ X_API YAP_file_type_t YAP_parse_yap_arguments(int argc, char *argv[],
char *p; char *p;
size_t *ssize; size_t *ssize;
#ifndef YAP_ROOTDIR
{
char *b0=Yap_FindExecutable(), *b1, *b2;
char b[YAP_FILENAME_MAX + 1];
strncpy(b, b0, YAP_FILENAME_MAX);
b1 = dirname(b);
YAP_BINDIR = malloc(strlen(b1)+1);
strcpy(YAP_BINDIR, b1);
b2 = dirname(b1);
YAP_ROOTDIR = malloc(strlen(b2)+1);
strcpy(YAP_ROOTDIR, b2);
strncpy(b, YAP_ROOTDIR, YAP_FILENAME_MAX);
strncat( b, "/share", YAP_FILENAME_MAX);
YAP_SHAREDIR= malloc(strlen(b)+1);
strcpy(YAP_SHAREDIR, b);
strncpy(b, YAP_ROOTDIR, YAP_FILENAME_MAX);
strncat( b, "/lib", YAP_FILENAME_MAX);
YAP_LIBDIR= malloc(strlen(b)+1);
strcpy(YAP_LIBDIR, b);
strncpy(b, YAP_ROOTDIR, YAP_FILENAME_MAX);
strncat( b, "/lib/Yap", YAP_FILENAME_MAX);
YAP_YAPLIB= malloc(strlen(b)+1);
strcpy(YAP_YAPLIB, b);
};
#endif
Yap_InitDefaults(iap, NULL, argc, argv); Yap_InitDefaults(iap, NULL, argc, argv);
while (--argc > 0) { while (--argc > 0) {
p = *++argv; p = *++argv;

View File

@ -222,7 +222,7 @@ if (ANACONDA)
#set( CMAKE_INSTALL_PREFIX $ENV{PREFIX} ) #set( CMAKE_INSTALL_PREFIX $ENV{PREFIX} )
set( PYTHON_LIBRARY $ENV{PREFIX}/lib/libpython$ENV{PY_VER}m$ENV{SHLIB_EXT}) set( PYTHON_LIBRARY $ENV{PREFIX}/lib/libpython$ENV{PY_VER}m$ENV{SHLIB_EXT})
set( PYTHON_INCLUDE_DIR $ENV{PREFIX}/include/python$ENV{PY_VER}m) set( PYTHON_INCLUDE_DIR $ENV{PREFIX}/include/python$ENV{PY_VER}m)
set(YAP_IS_MOVABLE 1)
endif() endif()
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install) ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)
@ -504,12 +504,13 @@ add_corelib( # Sets the name of the library.
) )
if (WIN32) if (WIN32)
target_link_libraries(libYap ${WINDLLS}) target_link_libraries(libYap ${WINDLLS})
if (PYTHON_INCLUDE_DIRS AND PYTHON_LIBRARIES) if (PYTHON_INCLUDE_DIRS AND PYTHON_LIBRARIES)
target_link_libraries(libYap ${PYTHON_LIBRARIES}) target_link_libraries(libYap ${PYTHON_LIBRARIES})
endif () endif ()
endif (WIN32) endif (WIN32)
target_link_libraries(libYap m)
if (GMP_FOUND) if (GMP_FOUND)
#config.h needs this (TODO: change in code latter) #config.h needs this (TODO: change in code latter)
@ -546,31 +547,25 @@ set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
# rpath stuff, hopefully it works # rpath stuff, hopefully it works
# use, i.e. don't skip the full RPATH for the build tree # use, i.e. don't skip the full RPATH for the build tree
# SET(CMAKE_SKIP_BUILD_RPATH FALSE) #SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already # when building, don't use the install RPATH already
# (but later on when installing) # (but later on when installing)
# SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# SET(CMAKE_INSTALL_RPATH ${CMAKE_CURRENT_BUILD_PATH}) # SET(CMAKE_INSTALL_RPATH ${CMAKE_TOP_BINARY_DIR})
# add the automatically determined parts of the RPATH # add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH # which point to directories outside the build tree to the install RPATH
# SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) # SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory#LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${libdir}" isSystemDir) # the RPATH to be used when installing, but only if it's not a system directory
# IF("${isSystemDir}" STREQUAL "-1") LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${libdir}" isSystemDir)
if (ANACONDA) IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) SET(CMAKE_INSTALL_RPATH ${libdir})
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) ENDIF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH ${CMAKE_BINARY_DIR})
else ()
SET(CMAKE_INSTALL_RPATH "${libdir}")
endif ()
# ENDIF("${isSystemDir}" STREQUAL "-1")
include_directories(H include_directories(H
H/generated H/generated

View File

@ -193,6 +193,10 @@ static inline Term options(Term inp) {
return Yap_IsGroundTerm(inp) ? inp : TermZERO; return Yap_IsGroundTerm(inp) ? inp : TermZERO;
} }
static inline Term rootdir(Term inp) {
return MkAtomTerm(Yap_LookupAtom(YAP_ROOTDIR));
}
// INLINE_ONLY inline EXTERN Term ok( Term inp ); // INLINE_ONLY inline EXTERN Term ok( Term inp );
static inline Term ok(Term inp) { return inp; } static inline Term ok(Term inp) { return inp; }

View File

@ -236,7 +236,7 @@ process, namely, on choice-points.
YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL), YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL),
YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag, YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag,
"false", NULL), "false", NULL),
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL), /**< home ` /* YAP_FLAG(HOME_FLAG, "home", false, isatom, rootdir, NULL),*/ /**< home `
the root of the YAP installation, by default `/usr/local` in Unix or the root of the YAP installation, by default `/usr/local` in Unix or
`c:\Yap` in Windows system. Can only be set at configure time `c:\Yap` in Windows system. Can only be set at configure time

View File

@ -1932,8 +1932,10 @@ significant byte first (like Motorola and SPARC, unlike Intel). */
#define YAP_PL_SRCDIR "${PROJECT_SOURCE_DIR}/pl" #define YAP_PL_SRCDIR "${PROJECT_SOURCE_DIR}/pl"
#endif #endif
#ifndef YAP_SHAREDIR
#define YAP_SHAREDIR "${YAP_SHAREDIR}" /* YAP_IS_MOVABLE */
#ifndef YAP_IS_MOVABLE
#cmakedefine YAP_IS_MOVABLE "${YAP_IS_MOVABLE}"
#endif #endif
/* saved state file */ /* saved state file */
@ -1961,24 +1963,26 @@ significant byte first (like Motorola and SPARC, unlike Intel). */
#define YAP_COMPILED_AT "${YAP_TIMESTAMP}@${YAP_SITE}" #define YAP_COMPILED_AT "${YAP_TIMESTAMP}@${YAP_SITE}"
#endif #endif
/* name of YAP library */
#ifndef YAP_YAPLIB
#define YAP_YAPLIB "${YAP_YAPLIB}"
#endif
/* name of YAP library */ #ifndef YAP_IS_MOVABLE
#ifndef YAP_BINDIR /* name of YAP instaii */
#define YAP_BINDIR "${bindir}"
#endif
/* name of YAP library */
#ifndef YAP_ROOTDIR #ifndef YAP_ROOTDIR
#define YAP_ROOTDIR "${YAP_ROOTDIR}" #define YAP_ROOTDIR "${YAP_ROOTDIR}"
#endif #endif
/* name of YAP binaries */
#ifndef YAP_BINDIR
#define YAP_BINDIR "${YAP_ROOTDIR}/bin"
#endif
/* name of YAP library */ /* name of YAP library */
#ifndef YAP_LIBDIR #ifndef YAP_LIBDIR
#define YAP_LIBDIR "${YAP_LIBDIR}" #define YAP_LIBDIR "${YAP_ROOTDIR}/lib"
#endif
/* name of YAP DLL library */
#ifndef YAP_YAPLIB
#define YAP_YAPLIB "${YAP_LIBDIR}/Yap"
#endif #endif
/* name of YAP JIT library */ /* name of YAP JIT library */
@ -1986,6 +1990,21 @@ significant byte first (like Motorola and SPARC, unlike Intel). */
#define YAP_YAPJITLIB "${YAP_YAPJITLIB}" #define YAP_YAPJITLIB "${YAP_YAPJITLIB}"
#endif #endif
#ifndef YAP_SHAREDIR
#define YAP_SHAREDIR "${YAP_ROOTDIR}/share"
#endif
#else
extern char
*YAP_BINDIR,
*YAP_ROOTDIR,
*YAP_SHAREDIR,
*YAP_LIBDIR,
*YAP_YAPLIB;
#endif
/* HP-UX old socket stuff */ /* HP-UX old socket stuff */
#ifndef _XOPEN_SOURCE #ifndef _XOPEN_SOURCE
#cmakedefine _XOPEN_SOURCE "${_XOPEN_SOURCE}" #cmakedefine _XOPEN_SOURCE "${_XOPEN_SOURCE}"

View File

@ -1,31 +1,22 @@
#!/bin/bash #!/bin/bash
export MACOSX_DEPLOYMENT_TARGET=10.9 export MACOSX_DEPLOYMENT_TARGET=10.9
# export CC=$SYS_PREFIX/bin/clang
# export CXX=$SYS_PREFIX/bin/clang++
export CMAKE_BUILD_TYPE=Debug export CMAKE_BUILD_TYPE=Debug
export CMAKE=$PREFIX/bin/cmake export CMAKE=$PREFIX/bin/cmake
export MAKE=$PREFIX/bin/make export MAKE=$PREFIX/bin/make
export GENERATOR="-GNinja" export GENERATOR="-GNinja"
#export CMAKE_INCLUDE_PATH=$PREFIX/include
#export CMAKE_LIBRARY_PATH=$PREFIX/lib
#export CMAKE_INSTALL_PREFIX=$PREFIX
#export PYTHON_EXECUTABLE="$PYTHON"
#export PYTHON_LIBRARY="$CMAKE_LIBRARY_PATH/libpython${PY_VER}m$SHLIB_EXT"
#export PYTHON_INCLUDE_DIR="$CMAKE_INCLUDE_PATH/python$PY_VER"m
#export R_COMMAND=$R
export PATH=$PREFIX/bin:$SYS_PREFIX/bin:$PATH export PATH=$PREFIX/bin:$SYS_PREFIX/bin:$PATH
mkdir $PREFIX/conda mkdir $PREFIX/conda
cd $PREFIX/conda cd $PREFIX/conda
# The datarootdir option places the docs into a temp folder that won't # The datarootdir option places the docs into a temp folder that won't
$CMAKE --build=. --target=install --DPATH=$PATH\ $CMAKE --build=. --target=install \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \ -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
$RECIPE_DIR/.. $RECIPE_DIR/..
make -j install CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" make -j install
#./yap -B
#
# Remove the created lib64 directory # Remove the created lib64 directory
rm -rf $PREFIX/conda rm -rf $PREFIX/conda

View File

@ -3,6 +3,8 @@ package:
version: 1.8.0 version: 1.8.0
requirements: requirements:
ignore_prefix_files:
- startup.yss
build: build:
- cmake - cmake
- swig - swig

View File

@ -1242,7 +1242,8 @@ const char *Yap_findFile(const char *isource, const char *idef,
if (ftype == YAP_PL) { if (ftype == YAP_PL) {
root = YAP_SHAREDIR; root = YAP_SHAREDIR;
} else if (ftype == YAP_BOOT_PL) { } else if (ftype == YAP_BOOT_PL) {
root = YAP_SHAREDIR "/pl"; root = YAP_SHAREDIR;
strcat(root,"/pl");
} else { } else {
root = YAP_LIBDIR; root = YAP_LIBDIR;
} }
@ -1761,21 +1762,24 @@ static Int p_yap_paths(USES_REGS1) {
if (env_destdir) { if (env_destdir) {
strncat(destdir, env_destdir, YAP_FILENAME_MAX); strncat(destdir, env_destdir, YAP_FILENAME_MAX);
strncat(destdir, "/" YAP_LIBDIR, YAP_FILENAME_MAX); strncat(destdir, "/", YAP_FILENAME_MAX);
strncat(destdir, YAP_LIBDIR, YAP_FILENAME_MAX);
out1 = MkAtomTerm(Yap_LookupAtom(destdir)); out1 = MkAtomTerm(Yap_LookupAtom(destdir));
} else { } else {
out1 = MkAtomTerm(Yap_LookupAtom(YAP_LIBDIR)); out1 = MkAtomTerm(Yap_LookupAtom(YAP_LIBDIR));
} }
if (env_destdir) { if (env_destdir) {
strncat(destdir, env_destdir, YAP_FILENAME_MAX); strncat(destdir, env_destdir, YAP_FILENAME_MAX);
strncat(destdir, "/" YAP_SHAREDIR, YAP_FILENAME_MAX); strncat(destdir, "/", YAP_FILENAME_MAX);
strncat(destdir, YAP_SHAREDIR, YAP_FILENAME_MAX);
out2 = MkAtomTerm(Yap_LookupAtom(destdir)); out2 = MkAtomTerm(Yap_LookupAtom(destdir));
} else { } else {
out2 = MkAtomTerm(Yap_LookupAtom(YAP_SHAREDIR)); out2 = MkAtomTerm(Yap_LookupAtom(YAP_SHAREDIR));
} }
if (env_destdir) { if (env_destdir) {
strncat(destdir, env_destdir, YAP_FILENAME_MAX); strncat(destdir, env_destdir, YAP_FILENAME_MAX);
strncat(destdir, "/" YAP_BINDIR, YAP_FILENAME_MAX); strncat(destdir, "/", YAP_FILENAME_MAX);
strncat(destdir, YAP_BINDIR, YAP_FILENAME_MAX);
out3 = MkAtomTerm(Yap_LookupAtom(destdir)); out3 = MkAtomTerm(Yap_LookupAtom(destdir));
} else { } else {
out3 = MkAtomTerm(Yap_LookupAtom(YAP_BINDIR)); out3 = MkAtomTerm(Yap_LookupAtom(YAP_BINDIR));

View File

@ -64,7 +64,7 @@ if (CMAKE_MAJOR_VERSION GREATER 2)
set_target_properties (HorusCli PROPERTIES OUTPUT_NAME hcli CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) set_target_properties (HorusCli PROPERTIES OUTPUT_NAME hcli CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
target_link_libraries(HorusCli horus ) target_link_libraries(HorusCli m horus )
install(TARGETS horus HorusCli install(TARGETS horus HorusCli

View File

@ -35,11 +35,13 @@ IF (CUDD_FOUND)
if(DEFINED YAP_MAJOR_VERSION) if(DEFINED YAP_MAJOR_VERSION)
TARGET_LINK_LIBRARIES(cudd TARGET_LINK_LIBRARIES(cudd
${CUDD_LIBRARIES} ${CUDD_LIBRARIES}
m
libYap libYap
) )
else() else()
TARGET_LINK_LIBRARIES(cudd TARGET_LINK_LIBRARIES(cudd
${CUDD_LIBRARIES} ${CUDD_LIBRARIES}
m
${YAP_LIBRARY} ${YAP_LIBRARY}
) )
endif() endif()

View File

@ -14,7 +14,8 @@ set_target_properties (Problogbdd PROPERTIES
) )
target_link_libraries(Problogbdd target_link_libraries(Problogbdd
${CUDD_LIBRARIES} ${CUDD_LIBRARIES}
m
libYap libYap
) )

View File

@ -18,7 +18,8 @@ set_target_properties (Problogbdd-Lfi PROPERTIES
) )
target_link_libraries(Problogbdd-Lfi target_link_libraries(Problogbdd-Lfi
${CUDD_LIBRARIES} ${CUDD_LIBRARIES}
m
libYap libYap
) )

View File

@ -139,6 +139,7 @@ IF (CUDD_FOUND)
TARGET_LINK_LIBRARIES(bddem TARGET_LINK_LIBRARIES(bddem
${CUDD_LIBRARIES} ${CUDD_LIBRARIES}
libYap libYap
m
) )
set_target_properties (bddem PROPERTIES set_target_properties (bddem PROPERTIES

View File

@ -15,6 +15,7 @@ set_target_properties (LPADbdd PROPERTIES
) )
target_link_libraries(LPADbdd target_link_libraries(LPADbdd
m
${CUDD_LIBRARIES} ${CUDD_LIBRARIES}
libYap libYap
) )

View File

@ -4,9 +4,22 @@
YAP_KERNEL.md YAP_KERNEL.md
) )
set (PL_SOURCES
yap_ipython/prolog/jupyter.yap
)
set (PYTHON_SOURCES set (PYTHON_SOURCES
yap_ipython/core/getipython.py
yap_ipython/core/__init__.py
yap_ipython/core/interactiveshell.py
yap_ipython/core/modulefind.py
yap_ipython/core/oinspect.py
yap_ipython/core/release.py
yap_ipython/core/shellapp.py
yap_ipython/display.py
yap_ipython/__init__.py
yap_ipython/shellapp.py
yap_kernel_launcher.py yap_kernel_launcher.py
data_kernelspec/kernel.json
yap_kernel/__init__.py yap_kernel/__init__.py
yap_kernel/__main__.py yap_kernel/__main__.py
yap_kernel/_version.py yap_kernel/_version.py
@ -69,5 +82,5 @@
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed --no-deps . install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed --no-deps .
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})") WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
# install(FILES jupyter.yap install(FILES ${PL_FILES} DESTINATION ${libpl} )
# DESTINATION ${libpl} )

View File

@ -106,9 +106,8 @@ class YAPInteractive(InteractiveShell):
super(YAPInteractive, self).__init__(**kwargs) super(YAPInteractive, self).__init__(**kwargs)
# type: (object, object) -> object # type: (object, object) -> object
pjoin = os.path.join pjoin = os.path.join
here = os.path.dirname(__file__)
self.yapeng = yap4py.yapi.Engine() self.yapeng = yap4py.yapi.Engine()
self.yapeng.goal(use_module(pjoin(here, '../prolog/jupyter.yap'))) self.yapeng.goal(use_module(library("jupyter")))
self.q = None self.q = None
self.run = False self.run = False
self.os = "" self.os = ""

View File

@ -1,86 +1,85 @@
set(PL_BOOT_SOURCES set(PL_BOOT_SOURCES
absf.yap absf.yap
arith.yap arith.yap
arithpreds.yap arithpreds.yap
arrays.yap arrays.yap
atoms.yap atoms.yap
attributes.yap attributes.yap
boot.yap boot.yap
bootlists.yap bootlists.yap
callcount.yap callcount.yap
checker.yap checker.yap
consult.yap consult.yap
control.yap control.yap
corout.yap corout.yap
dbload.yap dbload.yap
debug.yap debug.yap
depth_bound.yap depth_bound.yap
dialect.yap dialect.yap
directives.yap directives.yap
eam.yap eam.yap
error.yap error.yap
errors.yap errors.yap
eval.yap eval.yap
flags.yap flags.yap
grammar.yap grammar.yap
ground.yap ground.yap
hacks.yap hacks.yap
init.yap init.yap
listing.yap listing.yap
load_foreign.yap load_foreign.yap
messages.yap messages.yap
meta.yap meta.yap
modules.yap modules.yap
newmod.yap newmod.yap
os.yap os.yap
pathconf.yap pathconf.yap
preddecls.yap preddecls.yap
preddyns.yap preddyns.yap
preds.yap preds.yap
profile.yap profile.yap
protect.yap protect.yap
qly.yap qly.yap
save.yap save.yap
setof.yap setof.yap
signals.yap signals.yap
sort.yap sort.yap
spy.yap spy.yap
statistics.yap statistics.yap
strict_iso.yap strict_iso.yap
swi.yap swi.yap
tabling.yap tabling.yap
threads.yap threads.yap
udi.yap udi.yap
undefined.yap undefined.yap
utils.yap utils.yap
yapor.yap yapor.yap
) )
add_to_group( PL_BOOT_SOURCES pl_boot_library ) add_to_group(PL_BOOT_SOURCES pl_boot_library)
if (CMAKE_CROSSCOMPILING) if (CMAKE_CROSSCOMPILING)
add_custom_target (STARTUP ALL SOURCES add_custom_target(STARTUP ALL SOURCES
DEPENDS ${PL_BOOT_SOURCES} DEPENDS ${PL_BOOT_SOURCES}
) )
else() else ()
add_custom_target (STARTUP ALL add_custom_target(STARTUP ALL
DEPENDS ${YAP_STARTUP} DEPENDS ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
WORKING_DIRECTORY ${CMAKE_TOP_BINARY_DIR} )
) add_custom_command(OUTPUT ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
COMMAND ldd yap
add_custom_command (OUTPUT ${YAP_STARTUP} COMMAND ./yap -B
COMMAND yap-bin -B VERBATIM
VERBATIM WORKING_DIRECTORY ${CMAKE_TOP_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} DEPENDS ${PL_BOOT_SOURCES} yap-bin
DEPENDS yap-bin ${PL_SOURCES} )
)
install (FILES ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
DESTINATION ${dlls}
)
install(FILES ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
DESTINATION ${dlls}
)
endif() endif()
install (FILES ${PL_SOURCES} install(FILES ${PL_SOURCES}
DESTINATION ${libpl}/pl DESTINATION ${libpl}/pl
) )