anaconda, no goal expansion within call

This commit is contained in:
Vitor Santos Costa 2017-12-13 16:56:10 +00:00
parent 85f444cc94
commit 6b03c96a78
27 changed files with 134 additions and 206 deletions

View File

@ -17,14 +17,6 @@
/* for freeBSD9.1 */
#define _WITH_DPRINTF
#ifdef CONDA_BUILD
#undef HAVE_FMEMOPEN
#endif
#ifdef __APPLE__
#include "fmemopen.h"
#endif
#include "blobs.h"
static blob_type_t unregistered_blob_atom = {

View File

@ -2171,7 +2171,7 @@ X_API void YAP_EndConsult(int sno, int *osnop) {
X_API Term YAP_Read(FILE *f) {
Term o;
int sno = Yap_FileStream(f, NULL, TermNil, Input_Stream_f);
int sno = Yap_FileStream(f, NULL, TermNil, Input_Stream_f, NULL);
BACKUP_MACHINE_REGS();
o = Yap_read_term(sno, TermNil, 1);
@ -2199,7 +2199,7 @@ X_API Term YAP_ReadClauseFromStream(int sno) {
X_API void YAP_Write(Term t, FILE *f, int flags) {
BACKUP_MACHINE_REGS();
int sno = Yap_FileStream(f, NULL, TermNil, Output_Stream_f);
int sno = Yap_FileStream(f, NULL, TermNil, Output_Stream_f, NULL);
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority);
Yap_ReleaseStream(sno);

View File

@ -319,6 +319,7 @@ static const char *find_directory(YAP_init_args *iap, const char *paths[],
}
int i = 0;
while ((inp = paths[i++]) != NULL) {
printf("%s\n", inp);
out[0] = '\0';
char *o = location(iap, inp, out), *no;
if (o && o[0] && Yap_isDirectory(o)) {
@ -329,11 +330,14 @@ static const char *find_directory(YAP_init_args *iap, const char *paths[],
int j = 0;
while ((p = names[j++])) {
char *io = o + s;
printf("-> %s\n", o);
if ((no = location(iap, p, io)) && io[0] != '\0' && Yap_Exists(o))
return pop_output_text_stack(lvl, realpath(o, full));
}
} else
} else {
printf("-> %s\n", o);
return pop_output_text_stack(lvl, o);
}
}
}
pop_text_stack(lvl);

View File

@ -209,21 +209,17 @@ disallow_intree_builds()
# set(CMAKE_BUILD_TYPE Debug)
if (ANACONDA)
if ($ENV{CONDA_BUILD}x STREQUAL "1x" )
set(CMAKE_LIBRARY_ARCHITECTURE $ENV{PREFIX})
set(CMAKE_PREFIX_PATH $ENV{PREFIX} $ENV{SYS_PREFIX})
set( PATH $ENV{PREFIX}/bin $ENV{SYS_PREFIX}/bin ${PATH} )
set( PYTHON_EXECUTABLE "$ENV{PYTHON}")
set(CMAKE_PREFIX_PATH $ENV{PREFIX})
set( R_COMMAND "$ENV{R}")
# set(CMAKE_INCLUDE_PATH $ENV{SYS_PREFIX}/include ${CMAKE_INCLUDE_PATH} )
#set(CMAKE_LIBRARY_PATH $ENV{SYS_PREFIX}/lib $ENV{SYS_PREFIX}/lib ${CMAKE_LIBRARY_PATH})
# set(ENV{PATH} PATH $ENV{PREFIX}/bin $ENV{SYS_PREFIX}/bin $ENV{PATH})
# set(PATH $ENV{PATH} ${PATH})
#set( CMAKE_INSTALL_FULL_PREFIX $ENV{PREFIX} )
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_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS CONDA_BUILD=1)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS CONDA_BUILD=1)
list (APPEND CMAKE_REQUIRED_INCLUDES
${PREFIX}/include
${SYS_PREFIX}/include
)
set(YAP_IS_MOVABLE 1)
endif()
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)
@ -304,6 +300,12 @@ find_package(GMP)
list(APPEND YAP_SYSTEM_OPTIONS big_numbers)
if (GMP_FOUND)
#config.h needs this (TODO: change in code latter)
include_directories(${GMP_INCLUDE_DIRS})
endif (GMP_FOUND)
include(FindReadline)
List(APPEND YAP_SYSTEM_OPTIONS readline)
@ -312,6 +314,13 @@ List(APPEND YAP_SYSTEM_OPTIONS readline)
#
# ADD_SUBDIRECTORY(console/terminal)
if (READLINE_FOUND)
include_directories(${READLINE_INCLUDE_DIR})
# required for configure
list(APPEND CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR})
endif ()
#MPI STUFF
# library/mpi/mpi.c library/mpi/mpe.c
@ -539,6 +548,16 @@ add_corelib( # Sets the name of the library.
${YLIBS}
)
if (GMP_FOUND)
target_link_libraries(libYap ${GMP_LIBRARIES})
endif (GMP_FOUND)
if (READLINE_FOUND)
target_link_libraries(libYap ${READLINE_LIBRARIES})
# required for configure
endif ()
if (WIN32)
target_link_libraries(libYap ${WINDLLS})
if (PYTHON_INCLUDE_DIRS AND PYTHON_LIBRARIES)
@ -548,20 +567,6 @@ endif (WIN32)
target_link_libraries(libYap m)
if (GMP_FOUND)
#config.h needs this (TODO: change in code latter)
include_directories(${GMP_INCLUDE_DIRS})
target_link_libraries(libYap ${GMP_LIBRARIES})
endif (GMP_FOUND)
if (READLINE_FOUND)
include_directories(${READLINE_INCLUDE_DIR})
target_link_libraries(libYap ${READLINE_LIBRARIES})
# required for configure
list(APPEND CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR})
endif ()
set(YAP_STARTUP startup.yss)
set(YAP_BOOTFILE boot.yap )

View File

@ -403,6 +403,7 @@ check_function_exists( rl_insert_close HAVE_RL_INSERT_CLOSE )
check_function_exists( rl_reset_after_signal HAVE_RL_RESET_AFTER_SIGNAL )
check_function_exists( rl_set_keyboard_input_timeout HAVE_RL_SET_KEYBOARD_INPUT_TIMEOUT )
check_function_exists( rl_set_prompt HAVE_RL_SET_PROMPT)
check_function_exists( rl_set_signals HAVE_RL_SET_SIGNALS)
check_symbol_exists( rl_catch_signals "stdio.h;readline/readline.h" HAVE_DECL_RL_CATCH_SIGNALS )
check_type_size( rl_completion_func_t RL_COMPLETION_FUNC_T )
check_symbol_exists( rl_done stdio.h;readline/readline.h HAVE_DECL_RL_DONE )

View File

@ -1,4 +1,4 @@
#get package NAME
#get package NAME
get_filename_component( TMPD ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY )

View File

@ -9,7 +9,9 @@ set (Python_ADDITIONAL_VERSIONS 3.7 3.6 ) #3.5 3.6 3.4 )
# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
##
#
if (WIN320)
# ensure the script is in your cmake module path
if (WIN32)
set (PYTHONLIBS_FOUND YES CACHE BOOL "MINGW/MSYS2" FORCE )
set (PYTHON_LIBRARY C:/msys64/mingw64/lib/libpython3.6m.dll.a CACHE FILEPATH "MINGW/MSYS2" FORCE )
set (PYTHON_LIBRARIES C:/msys64/mingw64/lib/libpython3.5m.dll.a CACHE FILEPATH "MINGW/MSYS2" FORCE )
@ -18,21 +20,25 @@ if (WIN320)
set (PYTHON_EXECUTABLE C:/msys64/mingw64/bin/python3.exe CACHE FILEPATH "MINGW/MSYS2" FORCE )
set (PYTHONLIBS_VERSION_STRING 3.5 CACHE STRING "MINGW/MSYS2" FORCE )
elseif ($ENV{CONDA_BUILD}x STREQUAL "1x")
set (PYTHONLIBS_FOUND YES CACHE BOOL "MINGW/MSYS2" FORCE )
set( PYTHON_EXECUTABLE $ENV{PYTHON} CACHE FILEPATH "MINGW/MSYS2" FORCE )
set( PYTHON_LIBRARIES $ENV{PYTHON_LIBRARIES} CACHE FILEPATH "MINGW/MSYS2" FORCE )
set( PYTHON_INCLUDE_PATH $ENV{PYTHON_INCLUDE_DIRS} CACHE PATH "MINGW/MSYS2" FORCE )
set( PYTHON_INCLUDE_DIRS $ENV{PYTHON_INCLUDE_DIRS} CACHE PATH "MINGW/MSYS2" FORCE )
set (PYTHONLIBS_VERSION_STRING $ENV{PY_VER} CACHE STRING "MINGW/MSYS2" FORCE )
list (APPEND CMAKE_REQUIRED_INCLUDES
${PYTHON_INCLUDE_PATH})
else()
find_package(PythonInterp)
find_package(PythonLibs)
endif()
include_directories( BEFORE ${PYTHON_INCLUDE_DIRS} )
LIST( APPEND
CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_DIRS} ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIRS})
check_include_file(Python.h HAVE_PYTHON_H)
IF (PYTHONLIBS_FOUND)
add_subDIRECTORY (packages/python)
ENDIF()
ENDIF()

View File

@ -416,6 +416,9 @@ function. */
#ifndef HAVE_FMEMOPEN
#cmakedefine HAVE_FMEMOPEN ${HAVE_FMEMOPEN}
#endif
#if CONDA_BUILD
#undef HAVE_FMEMOPEN
#endif
/* Define to 1 if you have the `fpclass' function. */
#ifndef HAVE_FPCLASS
@ -978,6 +981,10 @@ function. */
#ifndef HAVE_OPEN_MEMSTREAM
#cmakedefine HAVE_OPEN_MEMSTREAM ${HAVE_OPEN_MEMSTREAM}
#endif
#if CONDA_BUILD
#undef HAVE_OPEN_MEMSTREAM
#endif
/* Define to 1 if you have the `opendir' function. */
#ifndef HAVE_OPENDIR

View File

@ -1,11 +1,13 @@
#!/bin/bash
export MACOSX_DEPLOYMENT_TARGET=10.9
export MACOSX_DEPLOYMENT_TARGET=10.12
export CMAKE_BUILD_TYPE=Debug
export CMAKE=$PREFIX/bin/cmake
export MAKE=$PREFIX/bin/make
export GENERATOR="-GNinja"
export PATH=$PREFIX/bin:$SYS_PREFIX/bin:$PATH
export PYTHON_INCLUDE_DIRS=$($PYTHON -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
export PYTHON_LIBRARIES=$($PYTHON -c "import sysconfig, os.path; print(os.path.join(sysconfig.get_config_var('LIBDIR'),sysconfig.get_config_var('LDLIBRARY')))")
mkdir $PREFIX/conda
cd $PREFIX/conda
@ -13,7 +15,7 @@ cd $PREFIX/conda
$CMAKE --build=. --target=install \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
$RECIPE_DIR/..
$RECIPE_DIR/..
make -j install

View File

@ -1,6 +1,6 @@
package:
name: yap4py
version: 1.8.0
version: 6.4.0
requirements:
ignore_prefix_files:
@ -16,12 +16,15 @@ requirements:
- notebook
- pkgconfig
- make
- libxml2
run:
- jupyterlab
- python
- readline
- gmp
- r
- notebook
- libxml2
about:
home: http://www.github.com/vscosta/yap-6.3.git
license: LGPL2

View File

@ -110,3 +110,8 @@ you don't. */
#ifndef HAVE_RL_SET_PROMPT
#cmakedefine HAVE_RL_SET_PROMPT ${HAVE_RL_SET_PROMPT}
#endif
/* Define to 1 if you have the `rl_set_signals' function. */
#ifndef HAVE_RL_SET_SIGNALS
#cmakedefine HAVE_RL_SET_SIGNALS ${HAVE_RL_SET_SIGNALS}
#endif

View File

@ -224,28 +224,7 @@ Yap_SetAlias (Atom arg, int sno)
while (aliasp < aliasp_max) {
// replace alias
if (aliasp->name == arg) {
Int alno = aliasp-GLOBAL_FileAliases;
aliasp->alias_stream = sno;
if (!(GLOBAL_Stream[sno].status &
(Null_Stream_f|InMemory_Stream_f|Socket_Stream_f)) &&
!GLOBAL_Stream[sno].vfs) {
switch(alno) {
case 0:
Yap_stdin = GLOBAL_Stream[sno].file;
break;
case 1:
Yap_stdout = GLOBAL_Stream[sno].file;
break;
case 2:
Yap_stderr = GLOBAL_Stream[sno].file;
#if HAVE_SETBUF
setvbuf (GLOBAL_Stream[sno].file, NULL, _IONBF, 0);
#endif /* HAVE_SETBUF */
break;
default:
break;
}
}
return;
}
aliasp++;
@ -272,17 +251,6 @@ Yap_DeleteAliases (int sno)
/* get back to std streams, but keep alias around */
Int alno = aliasp-GLOBAL_FileAliases;
new_aliasp->alias_stream = alno;
switch(alno) {
case 0:
Yap_stdin = stdin;
break;
case 1:
Yap_stdout = stdout;
break;
case 2:
Yap_stderr = stderr;
break; /* just put something here */
}
new_aliasp++;
} else {
GLOBAL_NOfFileAliases--;

View File

@ -1091,7 +1091,7 @@ if (st-> file == NULL) {
}
}
bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name,
bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name,
encoding_t encoding, stream_flags_t flags, Atom open_mode,
void *vfs) {
StreamDesc *st = &GLOBAL_Stream[sno];
@ -1326,7 +1326,6 @@ return false;
}
#endif
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s", fname);
Yap_DefaultStreamOps(st);
if (needs_bom && !write_bom(sno, st)) {
return false;
} else if (open_mode == AtomRead && !avoid_bom) {
@ -1523,6 +1522,7 @@ int Yap_OpenStream(const char *fname, const char *io_mode, Term user_name) {
st = GLOBAL_Stream + sno;
// read, write, append
st->file = NULL;
st->status = 0;
fname = Yap_VF(fname);
if ((vfsp = vfs_owner(fname)) != NULL ) {
if (!vfsp->open(vfsp, sno, fname, io_mode)) {
@ -1558,20 +1558,21 @@ int Yap_OpenStream(const char *fname, const char *io_mode, Term user_name) {
at = AtomWrite;
flags |= Output_Stream_f;
}
} else {
}
if (strchr(io_mode, 'r')) {
at = AtomRead;
flags |= Input_Stream_f;
}
if (strchr(io_mode, 'b')) {
flags |= Binary_Stream_f;
}
Yap_initStream(sno, st->file, fname, user_name, LOCAL_encoding, flags, at, NULL);
Yap_initStream(sno, st->file, fname, user_name, LOCAL_encoding, flags, at, vfsp);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid",
"exists %s <%d>", fname, sno);
return sno;
}
int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags) {
int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags, VFS_t *vfsp) {
CACHE_REGS
int sno;
Atom at;
@ -1587,28 +1588,10 @@ int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags) {
at = AtomWrite;
} else
at = AtomRead;
Yap_initStream(sno, fd, name, file_name, LOCAL_encoding, flags, at, NULL);
Yap_initStream(sno, fd, name, file_name, LOCAL_encoding, flags, at, vfsp);
return sno;
}
int FileStream(FILE *fd, char *name, Term file_name, int flags) {
int sno;
Atom at;
sno = GetFreeStreamD();
if (sno < 0)
return (PlIOError(RESOURCE_ERROR_MAX_STREAMS, MkAtomTerm(Yap_LookupAtom(name)),
"new stream not available for opening"));
if (flags & Output_Stream_f) {
if (flags & Append_Stream_f)
at = AtomAppend;
else
at = AtomWrite;
} else
at = AtomRead;
Yap_initStream(sno, fd, name, file_name, LOCAL_encoding, flags, at, NULL);
return sno;
}
#define CheckStream(arg, kind, msg) \
CheckStream__(__FILE__, __FUNCTION__, __LINE__, arg, kind, msg)
@ -1754,13 +1737,13 @@ static Int close1 /** @pred close(+ _S_) is iso
*/
(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
Int sno = CheckStream(
int sno = CheckStream(
ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2");
if (sno < 0)
return (FALSE);
return false;
if (sno <= StdErrStream) {
UNLOCK(GLOBAL_Stream[sno].streamlock);
return TRUE;
return true;
}
Yap_CloseStream(sno);
UNLOCK(GLOBAL_Stream[sno].streamlock);

View File

@ -267,10 +267,6 @@ inline static Term CurrentPositionToTerm(void) {
return Yap_MkApplTerm(FunctorStreamPos, 5, sargs);
}
extern FILE *Yap_stdin;
extern FILE *Yap_stdout;
extern FILE *Yap_stderr;
char *Yap_MemExportStreamPtr(int sno);

View File

@ -253,8 +253,10 @@ void Yap_ReadlineFlush(int sno) {
}
}
bool Yap_readline_clear_pending_input(StreamDesc *s) {
bool Yap_readline_clear_pending_input(StreamDesc *s) {
#if HAVE_RL_CLEAR_PENDING_INPUT
rl_clear_pending_input();
#endif
if (s->u.irl.buf) {
free((void *)s->u.irl.buf);
}
@ -307,6 +309,11 @@ bool Yap_InitReadline(Term enable) {
return Yap_ReadlineOps(GLOBAL_Stream + StdInStream);
}
#if !HAVE_RL_SET_SIGNALS
#define rl_clear_signals()
#define rl_set_signals()
#endif
static bool getLine(int inp) {
CACHE_REGS
rl_instream = GLOBAL_Stream[inp].file;

View File

@ -960,10 +960,16 @@ static void CloseStream(int sno) {
CACHE_REGS
//fflush(NULL);
if (GLOBAL_Stream[sno].file &&
!(GLOBAL_Stream[sno].status &
(Null_Stream_f | Socket_Stream_f | InMemory_Stream_f | Pipe_Stream_f)))
fclose(GLOBAL_Stream[sno].file);
VFS_t *me;
if ((me = GLOBAL_Stream[sno].vfs) != NULL) {
if (me->close) {
me->close(sno);
}
GLOBAL_Stream[sno].vfs = NULL;
} else if (GLOBAL_Stream[sno].file &&
!(GLOBAL_Stream[sno].status &
(Null_Stream_f | Socket_Stream_f | InMemory_Stream_f | Pipe_Stream_f)))
fclose(GLOBAL_Stream[sno].file);
#if HAVE_SOCKET
else if (GLOBAL_Stream[sno].status & (Socket_Stream_f)) {
Yap_CloseSocket(GLOBAL_Stream[sno].u.socket.fd,
@ -1001,7 +1007,8 @@ void Yap_ReleaseStream(int sno) {
CACHE_REGS
GLOBAL_Stream[sno].status = Free_Stream_f;
GLOBAL_Stream[sno].user_name = 0;
GLOBAL_Stream[sno].vfs = NULL;
GLOBAL_Stream[sno].vfs = NULL;
GLOBAL_Stream[sno].file = NULL;
Yap_DeleteAliases(sno);
if (LOCAL_c_input_stream == sno) {

View File

@ -87,7 +87,7 @@ extern int Yap_PlFGetchar(void);
extern int Yap_GetCharForSIGINT(void);
extern Int Yap_StreamToFileNo(Term);
extern int Yap_OpenStream(const char*, const char*, Term);
extern int Yap_FileStream(FILE*, char *, Term, int);
extern int Yap_FileStream(FILE*, char *, Term, int, VFS_t *);
extern char *Yap_TermToBuffer(Term t, encoding_t encoding, int flags);
extern char *Yap_HandleToString(yhandle_t l, size_t sz, size_t *length,
encoding_t *encoding, int flags);

View File

@ -2,12 +2,11 @@
#CHECK: PythonLibs, changed to work in WIN32
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)
message( ${GMP_INCLUDE_DIRS} )
include_directories( ${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/os ${GMP_INCLUDE_DIRS} )
include_directories( ${CMAKE_BINARY_DIR} ${PYTHON_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/os )
#talk to python.pl
add_lib(YAPPython pyload.c ${PYTHON_HEADERS} )

View File

@ -41,13 +41,15 @@ StreamDesc *st = YAP_RepStreamFromId(sno);
if (stream == Py_None)
return NULL;
Py_INCREF(stream);
st->vfs_handle = stream;
st->u.private_data = stream;
st->vfs = me;
st->status = Append_Stream_f | Output_Stream_f;
Yap_DefaultStreamOps(st);
return stream;
}
static bool py_close(int sno) {
return true;
StreamDesc *s = YAP_GetStreamFromId(sno);
PyObject *fclose = PyObject_GetAttrString(s->u.private_data, "close");
PyObject *rc = PyObject_CallObject(fclose, NULL);
@ -67,7 +69,7 @@ static int py_put(int sno, int ch) {
PyObject *fput = PyObject_GetAttrString(st->u.private_data, "write");
s[0] = ch;
s[1] = '\0';
PyObject_CallFunctionObjArgs(fput, PyBytes_FromString(s), NULL);
PyObject_CallFunctionObjArgs(fput, PyUnicode_FromString(s), NULL);
return ch;
}

View File

@ -1,31 +0,0 @@
import imp
import os
import ctypes
import glob
import os.path
import sys
import platform
global yap_lib_path
yap_lib_path = os.path.dirname(__file__)
if @CONDA_BUILD@ == "1":
# do not do nothing
if platform.system() == 'Windows':
def load( dll ):
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
ctypes.WinDLL(dll)
load('libYap*')
else:
def load( dll ):
dll = os.path.join(yap_lib_path,dll)
dll = os.path.abspath(dll)
ctypes.CDLL(dll, mode=ctypes.RTLD_GLOBAL)
if platform.system() == 'Apple':
load('libYap.dylib')
load('libPy4YAP.dylib' )
else:
load('libYap.os')
load('libPy4YAP.os' )

View File

@ -1,31 +0,0 @@
import imp
import os
import ctypes
import glob
import os.path
import platform
import sys
global yap_lib_path
yap_lib_path = os.path.dirname(__file__)
if platform.system() == 'Windows':
def load( dll ):
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
ctypes.WinDLL(dll)
elseif platform.system() == 'Apple':
def load( dll ):
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
ctypes.CDLL(dll)
load('libYap.dylib')
load('libPy4YAP.dylib')
else:
def load( dll ):
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
ctypes.CDLL(dll)
load('libYap.so')
load('libPy4YAP.so')

View File

@ -14,7 +14,7 @@ if platform.system() == 'Windows':
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
ctypes.WinDLL(dll)
elif platform.system() == 'Apple':
elif platform.system() == 'Darwin':
def load( dll ):
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
dll = os.path.abspath(dll)
@ -28,4 +28,4 @@ else:
ctypes.CDLL(dll)
load('libYap.so')
load('libPy4YAP.so')

View File

@ -183,6 +183,7 @@ class YAPShell:
self.port = "call"
# launch the query
while self.answer(q):
print( self.port )
if self.port == "exit":
# done
q.close()

View File

@ -15,13 +15,13 @@ jupyter_query(Self, Cell) :-
enter_cell(_Self) :-
open('//python/sys.stdout', append, _Output, [alias(jupo)]),
open('//python/sys.stdout', append, _, [alias(jupe)]),
set_prolog_flag(user_output, jupo),
set_prolog_flag(user_error, jupe).
open('//python/sys.stdout', append, _Error, [alias(jupe)]),
set_prolog_flag(user_output, _Output),
set_prolog_flag(user_error, _Error).
exit_cell(_Self) :-
close( jupo),
close( jupe).
close( user_output),
close( user_error).
completions(S, Self) :-
@ -83,20 +83,20 @@ arg([l|_]).
file_or_library(F,C) :-
libsym(C0),
atom_cooncat(F,C,Co).
atom_cooncat(F,C,C0).
file_or_library(F,C) :-
check_file(F0,C).
check_file(F,C).
check_file(F0,C) :-
atom_concat('\'',F,F0),
!,
absolute_file_name( F, FF, [access(none)] ),
atom_concat( F, '*' , Pat),
atom_concat( FF, '*' , Pat),
absolute_file_name( Pat, C0, [glob(true)] ),
atom_concat(Pat,C00,C0),
atom_conct(C00,'\'',C).
check_file(F0,C) :-
atom_concat( F, '*' , Pat),
atom_concat( F0, '*' , Pat),
absolute_file_name( Pat, C0, [glob(true)] ),
atom_concat(Pat,C,C0).
@ -117,7 +117,7 @@ predicate(N,P,A) :-
current_predicate(P0/A),
atom_concat(N,P,P0).
cont(0, F, P, P0)- :-
cont(0, F, P, P0) :-
atom_concat( F, P, P0 ).
cont( _, F, P, PB ):-
atom_concat( [F, P, '('], PB ).

View File

@ -46,9 +46,9 @@ include_directories (
${R_INCLUDE_DIR}
)
set (CMAKE_REQUIRED_INCLUDES
list (APPEND CMAKE_REQUIRED_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}
${LIBR_INCLUDE_DIRS}
${R_INCLUDE_DIR}
)
add_lib(real ${REAL_SOURCES})

View File

@ -1279,6 +1279,7 @@ not(G) :- \+ '$execute'(G).
'$call'([A|B], _, _, M) :- !,
'$csult'([A|B], M).
'$call'(G, _CP, _G0, CurMod) :-
/*
(
'$is_metapredicate'(G,CurMod)
->
@ -1288,7 +1289,8 @@ not(G) :- \+ '$execute'(G).
;
NG = G
),
'$execute0'(NG, CurMod).
*/
'$execute0'(G, CurMod).
'$check_callable'(V,G) :- var(V), !,
'$do_error'(instantiation_error,G).

View File

@ -593,7 +593,7 @@ be lost.
!,
fail.
'$re_trace_query'(forward(redo,G0), G, M, GoalNumber, H) :-
GoalNumber >= G0,
GoalNumber > G0,
!,
catch(
'$trace_goal'(G, M, GoalNumber, H),