This commit is contained in:
Vitor Santos Costa 2017-12-05 15:14:57 +00:00
parent b645f60405
commit 645b2c7d93
67 changed files with 1339 additions and 273977 deletions

View File

@ -106,7 +106,6 @@ X_API int YAP_Reset(yap_reset_t mode);
#if __ANDROID__
#define BOOT_FROM_SAVED_STATE true
#endif
static char BootFile[] = "boot.yap";
/**
@defgroup slotInterface Term Handles or Slots
@ -2123,7 +2122,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char *full,
}
char *bfp = Malloc(YAP_FILENAME_MAX + 1);
bfp[0] = '\0';
if (fname != NULL && fname[0] != 0)
if (fname != NULL && fname[0] != '\0')
strcpy(bfp, fname);
bool consulted = (mode == YAP_CONSULT_MODE);
const char *fl = Yap_findFile(bfp, NULL, NULL, full, true,
@ -2133,7 +2132,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char *full,
return -1;
}
Yap_init_consult(consulted, bfp);
sno = Yap_OpenStream(fl,"r");
sno = Yap_OpenStream(fl,"r", MkAtomTerm(Yap_LookupAtom(fname)));
*osnop = Yap_CheckAlias(AtomLoopStream);
if (!Yap_AddAlias(AtomLoopStream, sno)) {
Yap_CloseStream(sno);
@ -2321,6 +2320,9 @@ static void do_bootfile(const char *b_file USES_REGS) {
exit(1);
}
free(full);
setAtomicGlobalPrologFlag(
RESOURCE_DATABASE_FLAG,
MkAtomTerm(GLOBAL_Stream[boot_stream].name));
do {
CACHE_REGS
YAP_Reset(YAP_FULL_RESET);
@ -2422,7 +2424,7 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
YAP_file_type_t restore_result = yap_init->boot_file_type;
bool do_bootstrap = (restore_result & YAP_CONSULT_MODE);
CELL Trail = 0, Stack = 0, Heap = 0, Atts = 0;
char *boot_file;
char *boot_file, *restore_file;
Int rc;
char *yroot;
if (YAP_initialized)
@ -2430,8 +2432,9 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
if (!LOCAL_TextBuffer)
LOCAL_TextBuffer = Yap_InitTextAllocator();
yroot = malloc(YAP_FILENAME_MAX + 1);
boot_file = malloc(YAP_FILENAME_MAX + 1);
yroot = Malloc(YAP_FILENAME_MAX + 1);
boot_file = Malloc(YAP_FILENAME_MAX + 1);
restore_file = Malloc(YAP_FILENAME_MAX + 1);
/* ignore repeated calls to YAP_Init */
Yap_embedded = yap_init->Embedded;
Yap_page_size = Yap_InitPageSize(); /* init memory page size, required by
@ -2446,51 +2449,63 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
functions */
GLOBAL_argv = yap_init->Argv;
GLOBAL_argc = yap_init->Argc;
if (0 && ((YAP_QLY && yap_init->SavedState) ||
(YAP_BOOT_PL && (yap_init->YapPrologBootFile)))) {
strcpy(yroot, ".");
} else {
strcpy(yroot, BootFile);
}
}
char *tmp = NULL;
if (yap_init->SavedState == NULL) {
tmp = Malloc(strlen(YAP_STARTUP) + 1);
strncpy(tmp, YAP_STARTUP, strlen(YAP_STARTUP) + 1);;
char *tmp = NULL, *root;
if (yap_init->bootstrapping) {
restore_result = YAP_BOOT_PL;
} else if (restore_result == YAP_QLY){
if (yap_init->SavedState == NULL) {
tmp = Malloc(strlen(YAP_STARTUP) + 1);
strncpy(tmp, YAP_STARTUP, strlen(YAP_STARTUP) + 1);
root = Malloc(YAP_FILENAME_MAX+1);
if (yap_init->YapLibDir)
strncpy( root, yap_init->YapLibDir,YAP_FILENAME_MAX );
else
strncpy( root, YAP_LIBDIR, YAP_FILENAME_MAX );
} else {
root = Malloc(YAP_FILENAME_MAX);
Yap_getcwd(root, YAP_FILENAME_MAX);
tmp = yap_init->SavedState;
}
}
#if __ANDROID__
//if (yap_init->assetManager)
Yap_InitAssetManager();
//if (yap_init->assetManager)
Yap_InitAssetManager();
#endif
#if USE_DL_MALLOC
if (yap_init->SavedState == NULL)
yap_init->SavedState = YAP_STARTUP;
if (yap_init->SavedState == NULL)
yap_init->SavedState = YAP_STARTUP;
#else
yap_init->SavedState = Yap_findFile(tmp, YAP_STARTUP, yap_init->YapLibDir,
boot_file, true, YAP_QLY, true, true);
yap_init->SavedState = Yap_findFile(tmp, YAP_STARTUP, root,
restore_file, true, YAP_QLY, true, true);
#endif
if (yap_init->SavedState == NULL) {
restore_result = YAP_BOOT_PL;
}
if (restore_result == YAP_BOOT_PL) {
#if USE_DL_MALLOC
if (yap_init->YapPrologBootFile == NULL ||
yap_init->YapPrologBootFile[0] == 0)
yap_init->YapPrologBootFile = BootFile;
strcpy(boot_file, BootFile);
{
yap_init->YapPrologBootFile = YAP_BOOTFILE;
strcpy(boot_file, YAP_BOOTFILE);
}
#else
strcpy(boot_file, BootFile);
const char *s = Yap_findFile(yap_init->YapPrologBootFile,
BootFile, yroot, boot_file,
true, YAP_BOOT_PL, true, true);
if (s && s[0] != '\0') {
strcpy(boot_file, s);
if (yap_init->YapPrologBootFile == NULL) {
tmp = Malloc(strlen(YAP_BOOTFILE) + 1);
strncpy(tmp,YAP_BOOTFILE, strlen(YAP_BOOTFILE) + 1);
} else {
tmp = (char*)yap_init->YapPrologBootFile;
}
const char *bpath;
if (yap_init->bootstrapping)
bpath = YAP_PL_SRCDIR;
else
bpath = yap_init->YapShareDir;
yap_init->YapPrologBootFile = Yap_findFile(tmp, yap_init->YapPrologBootFile,
bpath, boot_file,
true, YAP_BOOT_PL, true, true);
#endif
}
@ -2543,7 +2558,7 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
YAP_BOOT_PL;
} else { // try always to boot from the saved state.
if (restore_result == YAP_QLY) {
if (!
if (DO_ONLY_CODE !=
Yap_SavedInfo(yap_init
->SavedState, yap_init->YapLibDir, &Trail,
&Stack, &Heap)) {
@ -2633,23 +2648,20 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
MkAtomTerm(Yap_LookupAtom(yap_init->YapPrologAddPath))
);
}
if (yap_init->YapShareDir) {
if (yap_init->YapPlDir) {
setAtomicGlobalPrologFlag(PROLOG_LIBRARY_DIRECTORY_FLAG,
MkAtomTerm(Yap_LookupAtom(yap_init->YapShareDir))
MkAtomTerm(Yap_LookupAtom(yap_init->YapPlDir))
);
}
if (yap_init->YapLibDir) {
if (yap_init->YapDLLDir) {
setAtomicGlobalPrologFlag(PROLOG_FOREIGN_DIRECTORY_FLAG,
MkAtomTerm(Yap_LookupAtom(yap_init->YapLibDir))
MkAtomTerm(Yap_LookupAtom(yap_init->YapDLLDir))
);
}
if (yap_init->QuietMode) {
setVerbosity(TermSilent);
}
if (restore_result == YAP_QLY) {
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
MkAtomTerm(Yap_LookupAtom(yap_init->SavedState))
);
LOCAL_PrologMode &=
~BootMode;
CurrentModule = LOCAL_SourceModule = USER_MODULE;
@ -2658,22 +2670,18 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
rc = YAP_QLY;
} else {
if (boot_file[0] == '\0')
strcpy(boot_file, BootFile
strcpy(boot_file, YAP_BOOTFILE
);
do_bootfile(boot_file PASS_REGS);
setAtomicGlobalPrologFlag(
RESOURCE_DATABASE_FLAG,
MkAtomTerm(Yap_LookupAtom(boot_file))
);
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG,
false);
rc = YAP_BOOT_PL;
}
start_modules();
YAP_initialized = true;
return
YAP_BOOT_PL;
return rc;
}
#if (DefTrailSpace < MinTrailSpace)
@ -2736,6 +2744,13 @@ X_API void YAP_SetOutputMessage(void) {
X_API int YAP_StreamToFileNo(Term t) { return (Yap_StreamToFileNo(t)); }
/**
* Obtain a pointer to the YAP representation of a stream.
* @param sno Stream Id
* @return data structure for stream
*/
X_API void *YAP_RepStreamFromId(int sno) { return GLOBAL_Stream+sno; }
X_API void YAP_CloseAllOpenStreams(void) {
BACKUP_H();

View File

@ -303,14 +303,14 @@ static char tmpbuf[YAP_BUF_SIZE];
}
#include "YapErrors.h"
//
void Yap_pushErrorContext(yap_error_descriptor_t *new_error) {
new_error->top_error = LOCAL_ActiveError;
LOCAL_ActiveError = new_error;
}
yap_error_descriptor_t *Yap_popErrorContext(void) {
yap_error_descriptor_t *new_error = LOCAL_ActiveError;
struct yap_error_descriptor_t *new_error = LOCAL_ActiveError;
LOCAL_ActiveError = LOCAL_ActiveError->top_error;
return new_error;
}

View File

@ -159,7 +159,8 @@ int Yap_CloseForeignFile(void *handle) {
* LoadForeign(ofiles,libs,proc_name,init_proc) dynamically loads foreign
* code files and libraries and locates an initialization routine
*/
static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
static Int LoadForeign(StringList
ofiles, StringList libs, char *proc_name,
YapInitProc *init_proc) {
CACHE_REGS
LOCAL_ErrorMessage = NULL;

View File

@ -597,8 +597,32 @@ static void RestoreHashPreds(USES_REGS1) {}
static void RestoreAtomList(Atom atm USES_REGS) {}
static bool maybe_read_bytes(FILE *stream, void *ptr, size_t sz) {
do {
size_t count;
if ((count = fread(ptr, 1, sz, stream)) == sz)
return true;
if (feof(stream) || ferror(stream))
return false;
sz -= count;
ptr += count;
} while (true);
}
static size_t read_bytes(FILE *stream, void *ptr, size_t sz) {
return fread(ptr, sz, 1, stream);
do {
size_t count = fread(ptr, 1, sz, stream);
if (count == sz)
return sz;
if (feof(stream)) {
PlIOError(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM, TermNil, "read_qly/3: expected %ld bytes got %ld", sz, count);
return 0;
} else if (ferror(stream)) {
PlIOError(PERMISSION_ERROR_INPUT_STREAM, TermNil, "read_qly/3: expected %ld bytes got error %s", sz, strerror(errno));
return 0;
}
sz -= count;
} while(true);
}
static unsigned char read_byte(FILE *stream) { return getc(stream); }
@ -632,34 +656,26 @@ static pred_flags_t read_predFlags(FILE *stream) {
return v;
}
static bool checkChars(FILE *stream, char s[]) {
int ch, c;
char *p = s;
while ((ch = *p++)) {
if ((c = read_byte(stream)) != ch) {
return false;
}
}
return TRUE;
}
static Atom do_header(FILE *stream) {
char s[2048], *p = s, ch;
char s[2049], *p = s, *q;
char h0[] = "#!/bin/sh\nexec_dir=${YAPBINDIR:-";
char h1[] = "exec $exec_dir/yap $0 \"$@\"\nsaved ";
Atom at;
if (!checkChars(stream, "#!/bin/sh\nexec_dir=${YAPBINDIR:-"))
if (!maybe_read_bytes( stream, s, 2048) )
return NIL;
while ((ch = read_byte(stream)) != '\n')
;
if (!checkChars(stream, "exec $exec_dir/yap $0 \"$@\"\nsaved "))
if (strstr(s, h0)!= s)
return NIL;
while ((ch = read_byte(stream)) != ',')
*p++ = ch;
*p++ = '\0';
at = Yap_LookupAtom(s);
while ((ch = read_byte(stream)))
;
if ((p=strstr(s, h1)) == NULL) {
return NIL;
}
p += strlen(h1);
q = strchr(p,',');
if (!q)
return NIL;
q[0] = '\0';
at = Yap_LookupAtom(p);
return at;
}
@ -674,13 +690,22 @@ static Int get_header(USES_REGS1) {
return FALSE;
}
if (!(stream = Yap_GetInputStream(t1, "header scanning in qload"))) {
return FALSE;
return false;
}
if ((at = do_header(stream)) == NIL)
rc = FALSE;
else
sigjmp_buf signew, *sighold = LOCAL_RestartEnv;
LOCAL_RestartEnv = &signew;
if (sigsetjmp(signew, 1) != 0) {
LOCAL_RestartEnv = sighold;
return false;
}
if ((at = do_header(stream)) == NIL)
rc = false;
else {
rc = Yap_unify(ARG2, MkAtomTerm(at));
return rc;
}
LOCAL_RestartEnv = sighold;
return rc;
}
static void ReadHash(FILE *stream) {

View File

@ -1363,7 +1363,7 @@ static int OpenRestore(const char *inpf, const char *YapLibDir, CELL *Astate,
int mode;
char fname[YAP_FILENAME_MAX + 1];
if (!Yap_findFile(inpf, YAP_STARTUP, YapLibDir, fname, true, YAP_SAVED_STATE,
if (!Yap_findFile(inpf, YAP_STARTUP, YapLibDir, fname, true, YAP_QLY,
true, true))
return FAIL_RESTORE;
if (fname[0] && (mode = try_open(fname, Astate, ATrail, AStack, AHeap,

View File

@ -1091,15 +1091,15 @@ bool set_clause_info(yamop *codeptr, PredEntry *pp) {
Term ts[2];
void *begin;
if (pp->ArityOfPE == 0) {
LOCAL_ActiveError->prologPredName = (Atom) pp->FunctorOfPred;
LOCAL_ActiveError->prologPredName = RepAtom((Atom) pp->FunctorOfPred)->StrOfAE;
LOCAL_ActiveError->prologPredArity = 0;
} else {
LOCAL_ActiveError->prologPredName = NameOfFunctor(pp->FunctorOfPred);
LOCAL_ActiveError->prologPredName = RepAtom(NameOfFunctor(pp->FunctorOfPred))->StrOfAE;
LOCAL_ActiveError->prologPredArity = pp->ArityOfPE;
}
LOCAL_ActiveError->prologPredModule =
(pp->ModuleOfPred ? pp->ModuleOfPred : "prolog");
LOCAL_ActiveError->prologPredFile = pp->src.OwnerFile;
(pp->ModuleOfPred ? RepAtom(AtomOfTerm(pp->ModuleOfPred))->StrOfAE : "prolog");
LOCAL_ActiveError->prologPredFile = RepAtom(pp->src.OwnerFile->StrOfAE);
if (codeptr->opc == UNDEF_OPCODE) {
LOCAL_ActiveError->prologPredFirstLine = 0;
LOCAL_ActiveError->prologPredLine = 0;

View File

@ -102,7 +102,7 @@ void *pop_output_text_stack__(int i, const void *export) {
lvl--;
}
LOCAL_TextBuffer->lvl = lvl;
return export;
return (void *)export;
}
// void pop_text_stack(int i) { LOCAL_TextBuffer->lvl = i; }

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 3.4)
# value of 3.4.0 or lower.
include(CMakeToolsHelpers OPTIONAL)
project(YAP)
include(FeatureSummary)
include(GNUInstallDirs)
project(YAP)
set(YAP_APP_DIR "${CMAKE_SOURCE_DIR}/../..")
cmake_policy(VERSION 3.4)
@ -219,7 +219,7 @@ if (ANACONDA)
#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_PREFIX $ENV{PREFIX} )
#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(YAP_IS_MOVABLE 1)
@ -249,42 +249,28 @@ if (APPLE)
endif ()
endif ()
set(prefix ${CMAKE_INSTALL_PREFIX}) #BINDIR})
set(bindir ${CMAKE_INSTALL_PREFIX}/bin) #BINDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include) #INCLUDEDIR})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib) #LIBDIR})
set(exec_prefix ${CMAKE_INSTALL_PREFIX}/libexec) #LIBEXECDIR})
set(datarootdir ${CMAKE_INSTALL_PREFIX}/share) #DATAROOTDIR})
set(datadir ${CMAKE_INSTALL_PREFIX}/share) #DATADIR})
if (ANDROID)
set(datarootdir ${YAP_APP_DIR}/src/generated/assets)
set(datadir ${YAP_APP_DIR}/src/generated/assets)
endif ()
set(mandir ${CMAKE_INSTALL_PREFIX}/share/man) #MANDIR})
set(docdir ${CMAKE_INSTALL_PREFIX}/share/docs) #MANDIR})
set(libpl ${datarootdir}/Yap)
set(dlls ${libdir}/Yap)
set(YAP_ROOTDIR ${prefix})
set(YAP_ROOTDIR ${CMAKE_INSTALL_PREFIX})
# erootdir -> rootdir
# bindir defined above
# libdir defined above
set(YAP_SHAREDIR ${datarootdir})
set(YAP_BINDIR ${bindir})
set(YAP_INCLUDEDIR ${includedir})
set(YAP_ROOTDIR ${prefix})
set(YAP_LIBDIR ${dlls})
set(YAP_DATADIR ${CMAKE_INSTALL_FULL_DATADIR})
set(YAP_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR}/Yap)
set(YAP_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR})
set(YAP_DLLDIR ${CMAKE_INSTALL_FULL_LIBDIR}/Yap)
set(YAP_PLDIR ${CMAKE_INSTALL_FULL_DATADIR}/Yap)
set(YAP_INSTALL_DLLDIR ${CMAKE_INSTALL_LIBDIR}/Yap)
set(YAP_INSTALL_PLDIR ${CMAKE_INSTALL_DATADIR}/Yap)
set(libpl ${YAP_INSTALL_PLDIR})
#
#
# include( Sources NO_POLICY_SCOPE )
# include( Sources )
#
# include( Model NO_POLICY_SCOPE )
# include( Model )
include(cudd NO-POLICY-SCOPE)
include(java NO-POLICY-SCOPE)
include(cudd )
include(java )
set(pl_library "" CACHE INTERNAL "prolog library files")
set(pl_os_library "" CACHE INTERNAL "prolog os files")
@ -471,7 +457,7 @@ option(WITH_PYTHON
"Allow Python->YAP and YAP->Python" ON)
IF (WITH_PYTHON)
include(python NO_POLICY_SCOPE)
include(python )
ENDIF (WITH_PYTHON)
@ -529,6 +515,7 @@ endif ()
set(YAP_STARTUP startup.yss)
set(YAP_BOOTFILE boot.yap )
## define system
# Optional libraries that affect compilation
@ -555,7 +542,7 @@ set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
# (but later on when installing)
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# SET(CMAKE_INSTALL_RPATH ${CMAKE_TOP_BINARY_DIR})
# SET(CMAKE_INSTALL_FULL_RPATH ${CMAKE_TOP_BINARY_DIR})
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
@ -786,9 +773,9 @@ set_target_properties(yap-bin PROPERTIES OUTPUT_NAME yap)
target_link_libraries(yap-bin libYap)
install(TARGETS libYap yap-bin
RUNTIME DESTINATION ${bindir}
LIBRARY DESTINATION ${libdir}
ARCHIVE DESTINATION ${libdir}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
@ -802,7 +789,7 @@ if (NOT ANDROID)
add_subDIRECTORY(library/lammpi)
if (MPI_C_FOUND\D)
if (MPI_C_FOUND)
CMAKE_DEPENDENT_OPTION(WITH_MPI ON "Interface to OpenMPI/MPICH"
"MPI_C_FOUND" OFF)
@ -827,15 +814,20 @@ endif(NOT ANDROID)
#
install(FILES ${INCLUDE_HEADERS} ${CONFIGURATION_HEADERS} DESTINATION ${YAP_INCLUDEDIR} )
macro_display_feature_log()
if (POLICY CMP0058)
cmake_policy(SET CMP0058 NEW)
endif (POLICY CMP0058)
include(Config NO_POLICY_SCOPE)
include(Config )
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
INCLUDE_QUIET_PACKAGES
)

View File

@ -18,9 +18,9 @@ else()
MY_target_link_libraries(YAP++ ${CMAKE_DL_LIBS} libYap)
MY_install(TARGETS YAP++
LIBRARY DESTINATION ${libdir}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${libdir}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()

View File

@ -938,7 +938,8 @@ void YAPEngine::doInit(YAP_file_type_t BootMode)
#if YAP_PYTHON
do_init_python();
#endif
YAPPredicate p = YAPPredicate( YAPAtomTerm("initialize_prolog") );
std::string s = "initialize_prolog";
YAPPredicate p = YAPPredicate( YAPAtomTerm(s) );
YAPQuery initq = YAPQuery(YAPPredicate(p), nullptr);
if (initq.next())
{

View File

@ -194,7 +194,7 @@ public:
virtual bool isGround() { return Yap_IsGroundTerm(gt()); } /// term is ground
virtual bool isList() { return Yap_IsListTerm(gt()); } /// term is a list
/// extract the argument i of the term, where i in 1...arity
/// extract the argument i of the term, where i in 1...arityvoid *Yap_RepStreamFromId(int sno)
virtual Term getArg(arity_t i) {
BACKUP_MACHINE_REGS();
Term tf = 0;
@ -493,7 +493,7 @@ public:
* Term Representation of an Atom
*/
class X_API YAPAtomTerm : public YAPTerm {
friend class YAPModule;
friend class YAPModule;
// Constructor: receives a C-atom;
YAPAtomTerm(Term t) : YAPTerm(t) { IsAtomTerm(t); }
@ -501,15 +501,17 @@ public:
YAPAtomTerm(Atom a) { mk(MkAtomTerm(a)); }
// Constructor: receives an atom;
YAPAtomTerm(YAPAtom a) : YAPTerm() { mk(MkAtomTerm(a.a)); }
// Constructor: receives a sequence of ISO-LATIN1 codes;
// Constructor: receives a sequence of UTF-8 codes;
YAPAtomTerm(char s[]);
// Constructor: receives a sequence of up to n ISO-LATIN1 codes;
// Constructor: receives a sequence of up to n UTF-8 codes;
YAPAtomTerm(char *s, size_t len);
// Constructor: receives a sequence of wchar_ts, whatever they may be;
YAPAtomTerm(wchar_t *s);
// Constructor: receives a sequence of n wchar_ts, whatever they may be;
YAPAtomTerm(wchar_t *s, size_t len);
bool isVar() { return false; } /// type check for unbound
// Constructor: receives a sequence of n wchar_ts, whatever they may be;
YAPAtomTerm(wchar_t *s, size_t len);
// Constructor: receives a std::string;
YAPAtomTerm(std::string s) { mk(MkAtomTerm(Yap_LookupAtom(s.c_str()))); };
bool isVar() { return false; } /// type check for unbound
bool isAtom() { return true; } /// type check for atom
bool isInteger() { return false; } /// type check for integer
bool isFloat() { return false; } /// type check for floating-point

View File

@ -96,7 +96,7 @@ typedef struct ExtraAtomEntryStruct {
#define USE_OFFSETS_IN_PROPS 0
#endif
typedef u_short PropFlags;
typedef CELL PropFlags;
/* basic property entry structure */
typedef struct PropEntryStruct {

View File

@ -151,6 +151,8 @@ typedef void *(*fptr_t)(void);
main exports in YapInterface.h
*************************************************************************************************/
extern const char *Yap_BINDIR, *Yap_ROOTDIR, *Yap_SHAREDIR, *Yap_LIBDIR, *Yap_DLLDIR, *Yap_PLDIR;
/* Basic exports */
#include "YapDefs.h"

View File

@ -194,7 +194,7 @@ static inline Term options(Term inp) {
}
static inline Term rootdir(Term inp) {
return MkAtomTerm(Yap_LookupAtom(YAP_ROOTDIR));
return MkAtomTerm(Yap_LookupAtom(Yap_ROOTDIR));
}
// INLINE_ONLY inline EXTERN Term ok( Term inp );

View File

@ -435,7 +435,7 @@ extern const char *Yap_AbsoluteFileInBuffer(const char *spec, char *outp, size_t
extern const char *Yap_findFile(const char *isource, const char *idef,
const char *root, char *result, bool access,
YAP_file_type_t ftype, bool expand_root, bool in_lib);
extern bool ChDir(const char *path);
extern bool Yap_ChDir(const char *path);
/* threads.c */
extern void Yap_InitThreadPreds(void);
@ -498,6 +498,7 @@ extern int Yap_get_stream_handle(Term, int, int, void *);
extern Term Yap_get_stream_position(void *);
extern struct AtomEntryStruct *Yap_lookupBlob(void *blob, size_t len, void *type,
int *newp);
extern void *Yap_RepStreamFromId(int sno);
/* opt.preds.c */
extern void Yap_init_optyap_preds(void);

273190
TAGS

File diff suppressed because one or more lines are too long

View File

@ -131,7 +131,6 @@ BEAM/beam.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
@ -206,6 +205,7 @@ set (INCLUDE_HEADERS
${CMAKE_SOURCE_DIR}/include/YapInterface.h
${CMAKE_SOURCE_DIR}/include/YapRegs.h
${CMAKE_SOURCE_DIR}/include/YapStreams.h
${CMAKE_SOURCE_DIR}/include/YapTerm.h
${CMAKE_SOURCE_DIR}/include/blobs.h
${CMAKE_SOURCE_DIR}/include/c_interface.h
${CMAKE_SOURCE_DIR}/include/clause_list.h

View File

@ -1,4 +1,5 @@
/*--------------------------------------------------------------------------
* This file is autogenerated from config.h.in
* during the cmake configuration of your project. If you need to make changes
@ -1943,6 +1944,11 @@ significant byte first (like Motorola and SPARC, unlike Intel). */
#define YAP_STARTUP "${YAP_STARTUP}"
#endif
/* saved state file */
#ifndef YAP_BOOTFILE
#define YAP_BOOTFILE "${YAP_BOOTFILE}"
#endif
/* date of compilation */
#ifndef YAP_TIMESTAMP
#define YAP_TIMESTAMP ${YAP_TIMESTAMP}
@ -1964,6 +1970,7 @@ significant byte first (like Motorola and SPARC, unlike Intel). */
#endif
#ifndef YAP_IS_MOVABLE
/* name of YAP instaii */
#ifndef YAP_ROOTDIR
@ -1972,17 +1979,17 @@ significant byte first (like Motorola and SPARC, unlike Intel). */
/* name of YAP binaries */
#ifndef YAP_BINDIR
#define YAP_BINDIR "${YAP_ROOTDIR}/bin"
#define YAP_BINDIR "${YAP_BINDIR}"
#endif
/* name of YAP library */
#ifndef YAP_LIBDIR
#define YAP_LIBDIR "${YAP_ROOTDIR}/lib"
#define YAP_LIBDIR "${YAP_LIBDIR}"
#endif
/* name of YAP DLL library */
#ifndef YAP_YAPLIB
#define YAP_YAPLIB "${YAP_LIBDIR}/Yap"
#ifndef YAP_DLLDIR
#define YAP_DLLDIR "${YAP_LIBDIR}/Yap"
#endif
/* name of YAP JIT library */

View File

@ -58,7 +58,7 @@ include_directories(../../CXX)
install(TARGETS qtyap
RUNTIME DESTINATION ${bindir}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BIINDIR}
)
ENDIF(Qt5Widgets_FOUND)

View File

@ -105,13 +105,15 @@ static void exec_top_level(int BootMode, YAP_init_args *iap) {
YAP_Reset(YAP_FULL_RESET);
do_top_goal(YAP_MkAtomTerm(livegoal));
livegoal = YAP_FullLookupAtom("$live");
}
YAP_Exit(EXIT_SUCCESS);
}
YAP_Exit(EXIT_SUCCESS);
}
// FILE *debugf;
#ifdef LIGHT
int _main(int argc, char **argv)
#else
int main(int argc, char **argv)
@ -121,6 +123,7 @@ int main(int argc, char **argv)
int i;
YAP_init_args init_args;
BootMode = init_standard_system(argc, argv, &init_args);
if (BootMode == YAP_BOOT_ERROR) {
fprintf(stderr, "[ FATAL ERROR: could not find saved state ]\n");
exit(1);

View File

@ -1,45 +0,0 @@
#
# Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2010, 2011, 2013,
# 2015, 2016
# Tama Communications Corporation
#
# This file is part of GNU GLOBAL.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# *
# Configuration file for GNU GLOBAL source code tag system.
#
# Basically, GLOBAL doesn't need this file ('gtags.conf'), because it has
# default values in itsself. If you have the file as '/etc/gtags.conf' or
# "$HOME/.globalrc" in your system then GLOBAL overwrite the default values
# with the values in the file.
#
# The format is similar to termcap(5). You can specify a target with
# GTAGSLABEL environment variable. Default target is 'default'.
#
# If you want to have a common record for yourself, it is recommended to
# use the following method:
#
default:\
:tc=yap@~/github/yap-6.3/gtags.conf:\
:tc=native:
#tc=user:tc=user:tc=new-ctags:tc=ctags:tc=pygments:
#
yap:\
:skip=Debug/,Release/,Threads/,mxe/,xcode/,codeblocks/,Qt/,xcode/,android/,compile_commands.json,xml/,YAPDroid/app/build/,YAPDroid/lib/build/: \
:tc=user-ctags-maps:
#
# A common map for both Exuberant Ctags and Universal Ctags.
# Don't include definitions of ctagscom and ctagslib in this entry.
#
user-ctags-maps:\
:langmap=Prolog\:.pl.yap.ypp.P.prolog:

View File

@ -129,10 +129,11 @@ typedef enum {
YAP_SAVED_STATE = 0x0004,
YAP_OBJ = 0x0008,
YAP_PL = 0x0010,
YAP_BOOT_PL = 0x0030,
YAP_BOOT_PL = 0x0030,
YAP_QLY = 0x0040,
YAP_EXE = 0x0080,
YAP_FOUND_BOOT_ERROR = 0x0100
YAP_FOUND_BOOT_ERROR = 0x0100,
YAP_DIR = 0x0200
} YAP_file_type_t;
#define YAP_ANY_FILE (0x00ff)
@ -179,8 +180,10 @@ X_API YAP_file_type_t Yap_InitDefaults(void *init_args, char saved_state[],
int Argc, char *Argv[]);
typedef struct yap_boot_params {
//> boot type as suggested by the user
YAP_file_type_t boot_file_type;
//> boot type as suggested by the user
YAP_file_type_t boot_file_type;
//> bootstrapping mode: YAP is not properly installed
bool bootstrapping;
//> if NON-NULL, path where we can find the saved state
const char *SavedState;
//> if NON-0, minimal size for Heap or Code Area
@ -201,10 +204,16 @@ typedef struct yap_boot_params {
size_t AttsSize;
//> if NON-0, maximal size for AttributeVarStack
size_t MaxAttsSize;
//> if NON-NULL, value for YAPLIBDIR
const char *YapLibDir;
//> if NON-NULL, value for YAPSSHAREDIR, that is, default value for libraries
const char *YapShareDir;
//> if NON-NULL, value for YAPROOTDIR
const char *YapRootDir;
//> if NON-NULL, value for YAPLIBDIR
const char *YapLibDir;
//> if NON-NULL, value for YAPSHAREDIR, that is, default value for libraries
const char *YapShareDir;
//> if NON-NULL, value for YAPDLLDIR, that is, default value for libraries
const char *YapDLLDir;
//> if NON-NULL, value for YAPPLDIR, that is, default value for libraries
const char *YapPlDir;
//> if NON-NULL, name for a Prolog file to use when booting
const char *YapPrologBootFile;
//> if NON-NULL, name for a Prolog file to use when initializing

View File

@ -475,6 +475,16 @@ extern X_API void YAP_SetOutputMessage(void);
extern X_API int YAP_StreamToFileNo(YAP_Term);
/**
* Utility routine to Obtain a pointer to the YAP representation of a stream.
*
* @param sno Stream Id
* @return data structure for stream
*/
extern X_API void *YAP_RepStreamFromId(int sno);
extern X_API void YAP_CloseAllOpenStreams(void);
extern X_API void YAP_FlushAllStreams(void);

169
include/YapTerm.h Normal file
View File

@ -0,0 +1,169 @@
/*************************************************************************
* *
* YAP Prolog %W% %G% *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: Yap.h *
* mods: *
* comments: abstract type definitions for YAP *
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
*************************************************************************/
#ifndef YAP_H
#include "YapTermConfig.h"
#include "config.h"
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
/* truth-values */
/* stdbool defines the booleam type, bool,
and the constants false and true */
#if HAVE_STDBOOL_H
#include <stdbool.h>
#else
#ifndef true
typedef int _Bool;
#define bool _Bool;
#define false 0
#define true 1
#endif
#endif /* HAVE_STDBOOL_H */
#define ALIGN_BY_TYPE(X, TYPE) \
(((CELL)(X) + (sizeof(TYPE) - 1)) & ~(sizeof(TYPE) - 1))
#ifndef EXTERN
#ifdef MSC_VER
#define EXTERN
#else
#define EXTERN extern
#endif
#endif
/* defines integer types Int and UInt (unsigned) with the same size as a ptr
** and integer types Short and UShort with half the size of a ptr */
#if defined(PRIdPTR)
typedef intptr_t YAP_Int;
typedef uintptr_t YAP_UInt;
#elif defined(_WIN64)
typedef int64_t YAP_Int;
typedef uint64_t YAP_UInt;
#elif defined(_WIN32)
typedef int32_t YAP_Int;
typedef uint32_t YAP_UInt;
#elif SIZEOF_LONG_INT == SIZEOF_INT_P
typedef long int YAP_Int;
typedef unsigned long int YAP_UInt;
#elif SIZEOF_INT == SIZEOF_INT_P
typedef int YAP_Int;
typedef unsigned int YAP_UInt;
#else
#error Yap require integer types of the same size as a pointer
#endif
/* */ typedef short int YAP_Short;
/* */ typedef unsigned short int YAP_UShort;
typedef YAP_UInt YAP_CELL;
typedef YAP_UInt YAP_Term;
/* Type definitions */
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#endif
typedef bool YAP_Bool;
#define FALSE false
typedef YAP_Int YAP_handle_t;
typedef double YAP_Float;
typedef void *YAP_Atom;
typedef void *YAP_Functor;
#ifdef YAP_H
typedef YAP_Int Int;
typedef YAP_UInt UInt;
typedef YAP_Short Short;
typedef YAP_UShort UShort;
typedef uint16_t BITS16;
typedef int16_t SBITS16;
typedef uint32_t BITS32;
typedef YAP_CELL CELL;
typedef YAP_Term Term;
#define WordSize sizeof(BITS16)
#define CellSize sizeof(CELL)
#define SmallSize sizeof(SMALLUNSGN)
typedef YAP_Int Int;
typedef YAP_Float Float;
typedef YAP_handle_t yhandle_t;
#endif
#include "YapError.h"
#include "../os/encoding.h"
typedef encoding_t YAP_encoding_t;
#include "YapFormat.h"
/*************************************************************************************************
type casting macros
*************************************************************************************************/
#if SIZEOF_INT < SIZEOF_INT_P
#define SHORT_INTS 1
#else
#define SHORT_INTS 0
#endif
#ifdef __GNUC__
typedef long long int YAP_LONG_LONG;
typedef unsigned long long int YAP_ULONG_LONG;
#else
typedef long int YAP_LONG_LONG;
typedef unsigned long int YAP_ULONG_LONG;
#endif
#define Unsigned(V) ((CELL)(V))
#define Signed(V) ((Int)(V))

View File

@ -19,4 +19,4 @@ cd $PREFIX/conda
# Remove the created lib64 directory
rm -rf $PREFIX/conda
rm -rf $PREFIX/conda

View File

@ -9,6 +9,7 @@ requirements:
- cmake
- swig
- gmp
- ninja
- readline
- python
- r
@ -16,8 +17,7 @@ requirements:
- pkgconfig
- make
run:
- python
- pythonlab
- jupyterlab
- readline
- gmp
- r

View File

@ -3142,7 +3142,7 @@ term_t Yap_CvtTerm(term_t ts) {
}
char *PL_cwd(char *cwd, size_t cwdlen) {
return (char *)Yap_getcwd((const char *)cwd, cwdlen);
return (char *)Yap_getcwd(cwd, cwdlen);
}
/**

View File

@ -78,9 +78,9 @@ if (MPI_C_FOUND)
add_definitions (-DHAVE_MPI_H=1)
install(TARGETS yap_mpi
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
endif (MPI_C_FOUND)

View File

@ -15,8 +15,8 @@ if (MATLAB_FOUND)
target_link_libraries(matlab libYap $(MATLAB_LIBRARIES) )
install(TARGETS matlab
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )
endif (MATLAB_FOUND)

View File

@ -6,8 +6,8 @@ target_link_libraries(matrix libYap)
set_target_properties (matrix PROPERTIES PREFIX "")
install(TARGETS matrix
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -10,5 +10,5 @@ set_target_properties (yap_random PROPERTIES PREFIX "")
endif()
MY_install(TARGETS yap_random
LIBRARY DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )

View File

@ -26,6 +26,6 @@ TARGET_INCLUDE_DIRECTORIES (regexp PUBLIC BEFORE
${CMAKE_TOP_SOURCE_DIR}/include;${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR} )
install(TARGETS regexp
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )

View File

@ -11,6 +11,6 @@ target_link_libraries(yap_rl libYap)
set_target_properties (yap_rl PROPERTIES PREFIX "")
install(TARGETS yap_rl
LIBRARY DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )

View File

@ -39,8 +39,8 @@ set_target_properties (sys PROPERTIES PREFIX "")
endif()
MY_install(TARGETS sys
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )
configure_file ("sys_config.h.cmake" "sys_config.h" )

View File

@ -13,9 +13,9 @@ target_link_libraries(tries libYap)
set_target_properties (tries PROPERTIES PREFIX "")
install(TARGETS tries
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls})
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR})
set ( ITRIES_SOURCES
@ -34,7 +34,7 @@ target_link_libraries(itries libYap)
set_target_properties (itries PROPERTIES PREFIX "")
install(TARGETS itries
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )

View File

@ -687,6 +687,8 @@ int post_process_weof(StreamDesc *s) {
return EOFCHAR;
}
void *Yap_RepStreamFromId(int sno) { return GLOBAL_Stream+(sno); }
/**
* caled after EOF found a peek, it just calls console_post_process to
*conclude
@ -705,7 +707,7 @@ int EOFWPeek(int sno) { return EOFCHAR; }
post_process_read_char, something to think about */
int PlGetc(int sno) {
StreamDesc *s = &GLOBAL_Stream[sno];
return fgetc(s->file);
return fgetc(s->file);
}
// layered version
@ -928,7 +930,7 @@ static int binary_file(const char *file_name) {
#endif
{
/* ignore errors while checking a file */
return (FALSE);
return false;
}
return (S_ISDIR(ss.st_mode));
#else
@ -993,24 +995,26 @@ static int write_bom(int sno, StreamDesc *st) {
static void check_bom(int sno, StreamDesc *st) {
int ch1, ch2, ch3, ch4;
ch1 = fgetc(st->file);
if (st-> file == NULL) {
PlIOError(SYSTEM_ERROR_INTERNAL, Yap_MkStream(sno), "YAP does not support BOM n %x type of files", st->status); return;
}
ch1 = st->stream_getc(sno);
switch (ch1) {
case 0x00: {
ch2 = fgetc(st->file);
ch2 = st->stream_getc(sno);
if (ch2 != 0x00) {
ungetc(ch1, st->file);
ungetc(ch2, st->file);
return;
} else {
ch3 = fgetc(st->file);
ch3 = st->stream_getc(sno);
if (ch3 == EOFCHAR || ch3 != 0xFE) {
ungetc(ch1, st->file);
ungetc(ch2, st->file);
ungetc(ch3, st->file);
return;
} else {
ch4 = fgetc(st->file);
ch4 = st->stream_getc(sno);
if (ch4 == EOFCHAR || ch3 != 0xFF) {
ungetc(ch1, st->file);
ungetc(ch2, st->file);
@ -1228,22 +1232,7 @@ do_open(Term file_name, Term t2,
return false;
}
/* done */
sno = GetFreeStreamD();
if (sno < 0) {
free(args);
return PlIOError(RESOURCE_ERROR_MAX_STREAMS, TermNil, "open/3");
}
st = &GLOBAL_Stream[sno];
st->user_name = file_name;
flags = 0;
// user requested encoding?
if (args[OPEN_ALIAS].used) {
Atom al = AtomOfTerm(args[OPEN_ALIAS].tvalue);
if (!Yap_AddAlias(al, sno)) {
free(args);
return false;
}
}
if (args[OPEN_ENCODING].used) {
tenc = args[OPEN_ENCODING].tvalue;
s_encoding = RepAtom(AtomOfTerm(tenc))->StrOfAE;
@ -1259,9 +1248,8 @@ do_open(Term file_name, Term t2,
trueGlobalPrologFlag(OPEN_EXPANDS_FILENAME_FLAG);
// expand file name?
fname = Yap_AbsoluteFile(fname, fbuf, ok);
if (fname) {
st->name = Yap_LookupAtom(fname);
} else {
if (!fname) {
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, ARG1, NULL);
}
@ -1305,29 +1293,39 @@ do_open(Term file_name, Term t2,
needs_bom = false;
}
}
if (st - GLOBAL_Stream < 3) {
flags |= RepError_Prolog_f;
}
if (open_mode == AtomRead) {
strncpy(io_mode, "rb", 8);
strncpy(io_mode, "r", 8);
} else if (open_mode == AtomWrite) {
strncpy(io_mode, "w", 8);
} else if (open_mode == AtomAppend) {
strncpy(io_mode, "a", 8);
} else {
Yap_Error(DOMAIN_ERROR_IO_MODE, MkAtomTerm(open_mode), "open/3");
return -2;
return false;
}
if (Yap_OpenStream(RepAtom(AtomOfTerm(file_name))->StrOfAE, io_mode) < 0) {
if ((sno = Yap_OpenStream(fname, io_mode, file_name)) < 0) {
return false;
}
st = &GLOBAL_Stream[sno];
st->user_name = file_name;
// user requested encoding?
if (args[OPEN_ALIAS].used) {
Atom al = AtomOfTerm(args[OPEN_ALIAS].tvalue);
if (!Yap_AddAlias(al, sno)) {
free(args);
return false;
}
}
st->name = Yap_LookupAtom(fname);
if (st - GLOBAL_Stream < 3) {
flags |= RepError_Prolog_f;
}
#if MAC
if (open_mode == AtomWrite) {
Yap_SetTextFile(RepAtom(AtomOfTerm(file_name))->StrOfAE);
}
#endif
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s", fname);
flags &= ~(Free_Stream_f);
Yap_DefaultStreamOps(st);
if (needs_bom && !write_bom(sno, st)) {
return false;
@ -1372,7 +1370,8 @@ writable.
*/
static Int open3(USES_REGS1) { /* '$open'(+File,+Mode,?Stream,-ReturnCode) */
static Int open3(USES_REGS1) {
/* '$open'(+File,+Mode,?Stream,-ReturnCode) */
return do_open(Deref(ARG1), Deref(ARG2), TermNil PASS_REGS);
}
@ -1506,7 +1505,7 @@ static Int p_open_null_stream(USES_REGS1) {
return (Yap_unify(ARG1, t));
}
int Yap_OpenStream(const char *fname, const char *io_mode) {
int Yap_OpenStream(const char *fname, const char *io_mode, Term user_name) {
CACHE_REGS
int sno;
StreamDesc *st;
@ -1532,19 +1531,23 @@ int Yap_OpenStream(const char *fname, const char *io_mode) {
MkAtomTerm(Yap_LookupAtom(fname)), "%s", fname);
return -1;
}
} else if ((fd = fopen(fname, io_mode)) == NULL ||
(!strchr(io_mode, 'b') && binary_file(fname))) {
UNLOCK(st->streamlock);
if (errno == ENOENT && !strchr(io_mode, 'r')) {
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, MkAtomTerm(Yap_LookupAtom(fname)), "%s: %s",
fname,
strerror(errno));
} else {
PlIOError(PERMISSION_ERROR_OPEN_SOURCE_SINK, MkAtomTerm(Yap_LookupAtom(fname)),
"%s: %s",
fname, strerror(errno));
} else {
fd = st->file = fopen(fname, io_mode);
if (fd == NULL) {
if (!strchr(io_mode, 'b') && binary_file(fname)) {
UNLOCK(st->streamlock);
if (errno == ENOENT && !strchr(io_mode, 'r')) {
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, MkAtomTerm(Yap_LookupAtom(fname)), "%s: %s",
fname,
strerror(errno));
} else {
PlIOError(PERMISSION_ERROR_OPEN_SOURCE_SINK, MkAtomTerm(Yap_LookupAtom(fname)),
"%s: %s",
fname, strerror(errno));
}
}
return -1;
}
return -1;
}
flags = st->status;
if (strchr(io_mode, 'w')) {
@ -1559,12 +1562,13 @@ int Yap_OpenStream(const char *fname, const char *io_mode) {
at = AtomRead;
flags |= Input_Stream_f;
}
Atom name = Yap_LookupAtom(fname);
Yap_initStream(sno, st->file, name, MkAtomTerm( name ), LOCAL_encoding, st->status, at, NULL);
if (strchr(io_mode, 'b')) {
flags |= Binary_Stream_f;
}
Yap_initStream(sno, st->file, fname, user_name, LOCAL_encoding, flags, at, NULL);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid",
"exists %s <%d>", fname, sno);
return sno
;
return sno;
}
int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags) {

View File

@ -144,6 +144,7 @@ int GetFreeStreamD(void) {
return -1;
}
LOCK(GLOBAL_Stream[sno].streamlock);
GLOBAL_Stream[sno].status &= ~Free_Stream_f;
UNLOCK(GLOBAL_StreamDescLock);
GLOBAL_Stream[sno].encoding = LOCAL_encoding;
return sno;
@ -958,7 +959,7 @@ void Yap_CloseStreams(int loud) {
static void CloseStream(int sno) {
CACHE_REGS
fflush(NULL);
//fflush(NULL);
if (GLOBAL_Stream[sno].file &&
!(GLOBAL_Stream[sno].status &
(Null_Stream_f | Socket_Stream_f | InMemory_Stream_f | Pipe_Stream_f)))

View File

@ -957,10 +957,10 @@ static bool initSysPath(Term tlib, Term tcommons, bool dir_done,
bool commons_done) {
CACHE_REGS
int len;
char *dir;
#if __WINDOWS__
{
char *dir;
if ((dir = Yap_RegistryGetString("library")) && is_directory(dir)) {
dir_done = true;
if (!Yap_unify(tlib, MkAtomTerm(Yap_LookupAtom(dir))))
@ -975,17 +975,9 @@ static bool initSysPath(Term tlib, Term tcommons, bool dir_done,
if (dir_done && commons_done)
return true;
#endif
strncpy(LOCAL_FileNameBuf, YAP_SHAREDIR, YAP_FILENAME_MAX);
strncat(LOCAL_FileNameBuf, "/", YAP_FILENAME_MAX);
len = strlen(LOCAL_FileNameBuf);
if (!dir_done) {
strncat(LOCAL_FileNameBuf, "Yap", YAP_FILENAME_MAX);
if (is_directory(LOCAL_FileNameBuf)) {
if (!Yap_unify(tlib, MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf))))
if (!Yap_unify(tlib, MkAtomTerm(Yap_LookupAtom(Yap_PLDIR))))
return false;
dir_done = true;
}
}
if (!commons_done) {
LOCAL_FileNameBuf[len] = '\0';
strncat(LOCAL_FileNameBuf, "PrologCommons", YAP_FILENAME_MAX);
@ -1202,6 +1194,7 @@ const char *Yap_findFile(const char *isource, const char *idef,
int rc = FAIL_RESTORE;
int try = 0;
bool abspath = false;
int lvl = push_text_stack();
root = Malloc(YAP_FILENAME_MAX+1);
source= Malloc(YAP_FILENAME_MAX+1);
@ -1247,32 +1240,6 @@ const char *Yap_findFile(const char *isource, const char *idef,
done = true;
}
break;
case 2: // use environment variable YAPLIBDIR
#if HAVE_GETENV
if (in_lib) {
const char *eroot;
if (ftype == YAP_SAVED_STATE || ftype == YAP_OBJ) {
eroot = getenv("YAPLIBDIR");
} else if (ftype == YAP_BOOT_PL) {
eroot = getenv("YAPSHAREDIR");
if (eroot == NULL) {
continue;
} else {
strncpy(root, eroot, YAP_FILENAME_MAX);
strncat(root, "/pl", YAP_FILENAME_MAX);
}
}
if (isource && isource[0])
strcpy(source, isource);
else if (idef && idef[0])
strcpy(source, idef);
else
source[0] = 0;
} else
#endif
done = true;
break;
case 3: // use compilation variable YAPLIBDIR
if (in_lib) {
if (isource && isource[0])
@ -1804,39 +1771,19 @@ static Int p_host_type(USES_REGS1) {
}
static Int p_yap_home(USES_REGS1) {
Term out = MkAtomTerm(Yap_LookupAtom(YAP_ROOTDIR));
return (Yap_unify(out, ARG1));
Term out;
out = MkAtomTerm(Yap_LookupAtom(Yap_ROOTDIR));
return Yap_unify(out, ARG1);
}
static Int p_yap_paths(USES_REGS1) {
Term out1, out2, out3;
const char *env_destdir = getenv("DESTDIR");
char destdir[YAP_FILENAME_MAX + 1];
if (env_destdir) {
strncat(destdir, env_destdir, YAP_FILENAME_MAX);
strncat(destdir, "/", YAP_FILENAME_MAX);
strncat(destdir, YAP_LIBDIR, YAP_FILENAME_MAX);
out1 = MkAtomTerm(Yap_LookupAtom(destdir));
} else {
out1 = MkAtomTerm(Yap_LookupAtom(YAP_LIBDIR));
}
if (env_destdir) {
strncat(destdir, env_destdir, YAP_FILENAME_MAX);
strncat(destdir, "/", YAP_FILENAME_MAX);
strncat(destdir, YAP_SHAREDIR, YAP_FILENAME_MAX);
out2 = MkAtomTerm(Yap_LookupAtom(destdir));
} else {
out2 = MkAtomTerm(Yap_LookupAtom(YAP_SHAREDIR));
}
if (env_destdir) {
strncat(destdir, env_destdir, YAP_FILENAME_MAX);
strncat(destdir, "/", YAP_FILENAME_MAX);
strncat(destdir, YAP_BINDIR, YAP_FILENAME_MAX);
out3 = MkAtomTerm(Yap_LookupAtom(destdir));
} else {
out3 = MkAtomTerm(Yap_LookupAtom(YAP_BINDIR));
}
out1 = MkAtomTerm(Yap_LookupAtom(Yap_LIBDIR));
out2 = MkAtomTerm(Yap_LookupAtom(Yap_SHAREDIR));
out3 = MkAtomTerm(Yap_LookupAtom(Yap_BINDIR));
return (Yap_unify(out1, ARG1) && Yap_unify(out2, ARG2) &&
Yap_unify(out3, ARG3));
}
@ -1917,7 +1864,7 @@ static Int p_win32(USES_REGS1) {
}
static Int p_ld_path(USES_REGS1) {
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom(YAP_LIBDIR)));
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom(YAP_DLLDIR)));
}
static Int p_address_bits(USES_REGS1) {

View File

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

View File

@ -68,8 +68,8 @@ if (CMAKE_MAJOR_VERSION GREATER 2)
install(TARGETS horus HorusCli
RUNTIME DESTINATION ${bindir}
LIBRARY DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
endif()

View File

@ -42,9 +42,9 @@ if (GECODE_FOUND)
include_directories (${GECODE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${GECODE_VERSION})
install(TARGETS gecode_yap
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gecode.yap

View File

@ -51,9 +51,9 @@ IF (CUDD_FOUND)
set(YAP_SYSTEM_OPTIONS "cudd " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
install(TARGETS cudd
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -7,7 +7,7 @@ if (YAP_ROOT)
set( YAP_INCLUDE_DIR ../../include )
set( YAP_PL_LIBRARY_DIR ${libpl} )
set( YAP_LIBRARY libYap )
set( YAP_DLLS ${dlls} )
set( YAP_DLLS ${YAP_INSTALL_DLLDIR} )
else()

View File

@ -25,7 +25,7 @@ target_link_libraries(Problogbdd
)
install(TARGETS Problogbdd
RUNTIME DESTINATION ${bindir}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -29,7 +29,7 @@ target_link_libraries(Problogbdd-Lfi
)
install(TARGETS Problogbdd-Lfi
RUNTIME DESTINATION ${bindir}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -148,9 +148,9 @@ IF (CUDD_FOUND)
)
install(TARGETS bddem
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
@ -171,9 +171,9 @@ IF (CUDD_FOUND)
add_subDIRECTORY ( approx/simplecuddLPADs )
install(TARGETS cplint
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
INSTALL(FILES ${CPLINT_PROGRAMS} DESTINATION ${libpl})

View File

@ -26,7 +26,7 @@ target_link_libraries(LPADbdd
)
install(TARGETS LPADbdd
RUNTIME DESTINATION ${bindir}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -103,8 +103,8 @@ endif( THRUST_INCLUDE_DIR )
)
install(TARGETS libcuda
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
install(FILES ${PL_SOURCES}

View File

@ -42,9 +42,9 @@ if (GECODE_FOUND)
include_directories (${GECODE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${GECODE_VERSION})
install(TARGETS gecode_yap
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gecode.yap

View File

@ -11,7 +11,7 @@ include_directories (${JAVA_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS} )
# set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
install(TARGETS jplYap
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -1,21 +1,22 @@
p#include <string.h>
p #include<string.h>
#include <stdlib.h>
#include "Yap.h"
#include "cut_c.h"
MYDDAS_UTIL_CONNECTION
myddas_init_initialize_connection(void *conn, void *enviromment, MYDDAS_API api,
MYDDAS_UTIL_CONNECTION next);
extern MYDDAS_UTIL_CONNECTION
myddas_init_initialize_connection(void *conn, void *enviromment,
MYDDAS_API api,
MYDDAS_UTIL_CONNECTION next);
MYDDAS_UTIL_CONNECTION
extern MYDDAS_UTIL_CONNECTION
myddas_util_add_connection(void *conn, void *enviromment, MYDDAS_API api);
MYDDAS_UTIL_PREDICATE
extern MYDDAS_UTIL_PREDICATE
myddas_init_initialize_predicate(const char *pred_name, int pred_arity,
const char *pred_module,
MYDDAS_UTIL_PREDICATE next);
MYDDAS_UTIL_PREDICATE
extern MYDDAS_UTIL_PREDICATE
myddas_util_find_predicate(const char *pred_name, Int pred_arity,
const char *pred_module, MYDDAS_UTIL_PREDICATE list);

View File

@ -25,9 +25,9 @@
add_lib(Yapmysql ${MYSQL_SOURCES})
target_link_libraries(Yapmysql ${MYSQL_LIBRARIES} libYap)
install(TARGETS Yapmysql
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)
endif()
include_directories(${MYSQL_INCLUDE_DIR} ..)

View File

@ -29,9 +29,9 @@ set_target_properties (Yapodbc PROPERTIES
install(TARGETS Yapodbc
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
else()

View File

@ -28,8 +28,8 @@ set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS
-DMYDDAS_POSTGRES=1)
install(TARGETS Yappostgres
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
)
endif (PostgreSQL_FOUND)

View File

@ -70,7 +70,7 @@ if (ANDROID)
endif ()
install(TARGETS Yapsqlite3
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -29,9 +29,9 @@ target_link_libraries(Py4YAP libYap ${PYTHON_LIBRARIES})
install(TARGETS Py4YAP
RUNTIME DESTINATION ${bindir}
LIBRARY DESTINATION ${libdir}
ARCHIVE DESTINATION ${libdir}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
@ -54,6 +54,6 @@ add_to_group( PYTHON_PL pl_library )
set_target_properties (YAPPython PROPERTIES PREFIX "")
install(TARGETS YAPPython
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR} )

View File

@ -27,7 +27,7 @@ PyObject *py_ModDict;
VFS_t pystream;
static void *py_open(const char *name, const char *io_mode) {
static void *py_open(VFS_t *me, int sno, const char *name, const char *io_mode) {
#if HAVE_STRCASESTR
if (strcasestr(name, "//python/") == name)
name += strlen("//python/");
@ -35,12 +35,16 @@ static void *py_open(const char *name, const char *io_mode) {
if (strstr(name, "//python/") == name)
name += strlen("//python/");
#endif
StreamDesc *st = YAP_RepStreamFromId(sno);
// we assume object is already open, so there is no need to open it.
PyObject *stream = string_to_python(name, true, NULL);
if (stream == Py_None)
return NULL;
Py_INCREF(stream);
return stream;
st->vfs_handle = stream;
st->vfs = me;
st->status = Append_Stream_f | Output_Stream_f;
return stream;
}
static bool py_close(int sno) {

View File

@ -71,7 +71,7 @@ endif()
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed .
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${YAP_INSTALL_DLLDIR} )
install(FILES ${YAP4PY_PL} DESTINATION ${libpl} )

View File

@ -81,9 +81,9 @@ extensions=[Extension('_yap', native_sources,
('MINOR_VERSION', '0'),
('_YAP_NOT_INSTALLED_', '1'),
('YAP_PYTHON', '1')],
runtime_library_dirs=['yap4py','${RCMAKE_INSTALL_LIBDIR}','${CMAKE_INSTALL_BINDIR}'],
runtime_library_dirs=['yap4py','${RCMAKE_INSTALL_FULL_LIBDIR}','${CMAKE_INSTALL_FULL_BINDIR}'],
swig_opts=['-modern', '-c++', '-py3','-I${RELATIVE_SOURCE}/CXX'],
library_dirs=['../../..','../../../CXX','../../packages/python',"${dlls}","${CMAKE_INSTALL_BINDIR}", '.'],
library_dirs=['../../..','../../../CXX','../../packages/python',"${YAP_INSTALL_FULL_DLLDIR}","${CMAKE_INSTALL_FULL_BINDIR}", '.'],
extra_link_args=my_extra_link_args,
extra_compile_args=['-g3','-O0'],
libraries=['Yap','${GMP_LIBRARIES}'],

View File

@ -54,8 +54,8 @@ else (WIN32)
endif()
install(TARGETS libxml2
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${libdir}
)
endif(WIN32)
@ -109,8 +109,8 @@ IF (RAPTOR_FOUND)
set_target_properties (raptor PROPERTIES PREFIX "")
install(TARGETS raptor
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${libdir}
)

View File

@ -7,7 +7,7 @@ if (YAP_ROOT)
set( YAP_INCLUDE_DIR ../../include )
set( YAP_PL_LIBRARY_DIR ${libpl} )
set( YAP_LIBRARY libYap )
set( YAP_DLLS ${dlls} )
set( YAP_DLLS ${YAP_INSTALL_DLLDIR} )
else()

View File

@ -62,9 +62,9 @@ include_directories (
configure_file ("rconfig.h.cmake" "rconfig.h" )
install(TARGETS real
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)
install(FILES real.pl

View File

@ -43,9 +43,9 @@ pl-minisat.C
install (
TARGETS minisat2
RUNTIME DESTINATION ${bindir}
ARCHIVE DESTINATION ${dlls}
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${CMAKE_INSTALL_BIINDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)

View File

@ -64,7 +64,7 @@ if (JNI_FOUND)
INCLUDE_JARS NativeJar )
SET(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.8" "-target" "1.8")
install( TARGETS Native
RUNTIME DESTINATION ${bindir}
RUNTIME DESTINATION ${CMAKE_INSTALL_BIINDIR}
ARCHIVE DESTINATION ${libdir}
LIBRARY DESTINATION ${libdir}
)

View File

@ -75,7 +75,7 @@ if (Java_Development_FOUND)
INCLUDE_JARS NativeJar )
SET(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.8" "-target" "1.8")
install( TARGETS Native
RUNTIME DESTINATION ${bindir}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${libdir}
LIBRARY DESTINATION ${libdir}
)

View File

@ -79,7 +79,7 @@ else ()
)
install(FILES ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
DESTINATION ${dlls}
DESTINATION ${YAP_INSTALL_DLLDIR}
)
endif()