fix WIN stuff
This commit is contained in:
parent
49699f52e9
commit
96f03e26e8
@ -124,7 +124,21 @@ endif()
|
|||||||
set(WITH_CUDD YES CACHE FILEPATH "Try to use Cudd (currently Cudd 3)")
|
set(WITH_CUDD YES CACHE FILEPATH "Try to use Cudd (currently Cudd 3)")
|
||||||
|
|
||||||
if (WITH_CUDD)
|
if (WITH_CUDD)
|
||||||
include(cudd)
|
#detect cudd setup, as it is shared between different installations.
|
||||||
|
|
||||||
|
find_package(CUDD)
|
||||||
|
# CUDD_FOUND - system has CUDD
|
||||||
|
# CUDD_LIBRARIES - Link these to use CUDD
|
||||||
|
# CUDD_INCLUDE_DIR - Include directory for using CUDD
|
||||||
|
#
|
||||||
|
|
||||||
|
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CUDD_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
check_include_files( cudd.h HAVE_CUDD_H )
|
||||||
|
check_include_files( "stdio.h;cudd/cudd.h" HAVE_CUDD_CUDD_H )
|
||||||
|
check_include_files( cuddInt.h HAVE_CUDDINT_H )
|
||||||
|
check_include_files( "stdio.h;cudd/cudd.h;cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
|
||||||
|
|
||||||
endif(WITH_CUDD)
|
endif(WITH_CUDD)
|
||||||
|
|
||||||
set(WITH_JAVA YES CACHE FILEPATH "Try to use Java (currently Java 6,7,8)")
|
set(WITH_JAVA YES CACHE FILEPATH "Try to use Java (currently Java 6,7,8)")
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
#ifndef YAPT_HH
|
#ifndef YAPT_HH
|
||||||
#define YAPT_HH 1
|
#define YAPT_HH 1
|
||||||
|
|
||||||
class YAPAtomTerm;
|
extern "C" Term YAP_ReadBuffer(const char *s, Term *tp);
|
||||||
|
|
||||||
extern "C" X_API Term YAP_ReadBuffer(const char *s, Term *tp);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generic Prolog Term
|
* @brief Generic Prolog Term
|
||||||
|
@ -115,11 +115,18 @@ find_library(CUDD_EPD_LIBRARY
|
|||||||
|
|
||||||
set(CUDD_LIBRARIES
|
set(CUDD_LIBRARIES
|
||||||
${CUDD_LIBRARIES} ${CUDD_ST_LIBRARY} ${CUDD_UTIL_LIBRARY}
|
${CUDD_LIBRARIES} ${CUDD_ST_LIBRARY} ${CUDD_UTIL_LIBRARY}
|
||||||
${CUDD_MTR_LIBRARY} ${CUDD_EPD_LIBRARY} ${CUDD_DDDMP_LIBRARY} )
|
${CUDD_MTR_LIBRARY} ${CUDD_EPD_LIBRARY} ${CUDD_DDDMP_LIBRARY} PARENT_SCOPE )
|
||||||
|
|
||||||
endif () # Check for cudd 2.
|
endif () # Check for cudd 2.
|
||||||
|
|
||||||
|
|
||||||
|
SET( CUDD_FOUND "NO" )
|
||||||
|
IF(CUDD_INCLUDE_DIR AND CUDD_LIBRARIES)
|
||||||
|
SET( CUDD_FOUND "YES" )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
mark_as_advanced (CUDD_FOUND)
|
mark_as_advanced (CUDD_FOUND)
|
||||||
|
|
||||||
|
|
||||||
find_package_handle_standard_args(R DEFAULT_MSG CUDD_LIBRARIES CUDD_INCLUDE_DIR )
|
find_package_handle_standard_args(R DEFAULT_MSG CUDD_LIBRARIES CUDD_INCLUDE_DIR )
|
||||||
|
|
||||||
|
@ -10,9 +10,5 @@ macro_log_feature (CUDD_FOUND "CUDD"
|
|||||||
"Use CUDD Library"
|
"Use CUDD Library"
|
||||||
"http://vlsi.colorado.edu/~fabio/CUDD/" FALSE)
|
"http://vlsi.colorado.edu/~fabio/CUDD/" FALSE)
|
||||||
|
|
||||||
check_include_files( cudd.h HAVE_CUDD_H )
|
|
||||||
check_include_files( "stdio.h;cudd/cudd.h" HAVE_CUDD_CUDD_H )
|
|
||||||
check_include_files( cuddInt.h HAVE_CUDDINT_H )
|
|
||||||
check_include_files( "stdio.h;cudd/cudd.h;cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,20 +72,14 @@ long _stksize = 32000;
|
|||||||
static void do_top_goal(YAP_Term Goal) { YAP_RunGoalOnce(Goal); }
|
static void do_top_goal(YAP_Term Goal) { YAP_RunGoalOnce(Goal); }
|
||||||
|
|
||||||
static int init_standard_system(int argc, char *argv[], YAP_init_args *iap) {
|
static int init_standard_system(int argc, char *argv[], YAP_init_args *iap) {
|
||||||
int BootMode;
|
int
|
||||||
|
|
||||||
BootMode = YAP_parse_yap_arguments(argc, argv, iap);
|
Mode;
|
||||||
|
|
||||||
|
int BootMode = YAP_parse_yap_arguments(argc, argv, iap);
|
||||||
|
|
||||||
/* init memory */
|
/* init memory */
|
||||||
if (BootMode == YAP_BOOT_FROM_PROLOG ||
|
BootMode = YAP_Init(iap);
|
||||||
BootMode == YAP_FULL_BOOT_FROM_PROLOG) {
|
|
||||||
int NewBootMode = YAP_Init(iap);
|
|
||||||
if (NewBootMode != YAP_BOOT_FROM_PROLOG &&
|
|
||||||
BootMode != YAP_FULL_BOOT_FROM_PROLOG)
|
|
||||||
BootMode = NewBootMode;
|
|
||||||
} else {
|
|
||||||
BootMode = YAP_Init(iap);
|
|
||||||
}
|
|
||||||
if (iap->ErrorNo) {
|
if (iap->ErrorNo) {
|
||||||
/* boot failed */
|
/* boot failed */
|
||||||
YAP_Error(iap->ErrorNo, 0L, iap->ErrorCause);
|
YAP_Error(iap->ErrorNo, 0L, iap->ErrorCause);
|
||||||
|
@ -44,6 +44,10 @@
|
|||||||
* of code.
|
* of code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_REGEXEC
|
||||||
|
|
||||||
#ifdef SNAMES
|
#ifdef SNAMES
|
||||||
#define matcher smatcher
|
#define matcher smatcher
|
||||||
#define fast sfast
|
#define fast sfast
|
||||||
@ -1090,3 +1094,5 @@ int ch;
|
|||||||
#undef print
|
#undef print
|
||||||
#undef at
|
#undef at
|
||||||
#undef match
|
#undef match
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -49,6 +49,9 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
|
|||||||
* representations for state sets.
|
* representations for state sets.
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_REGEXEC
|
||||||
|
|
||||||
#include "c_interface.h"
|
#include "c_interface.h"
|
||||||
#if HAVE_SYS_TYPES_H
|
#if HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -65,87 +68,94 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "yapregex.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "regex2.h"
|
#include "regex2.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "yapregex.h"
|
||||||
|
|
||||||
#if used
|
#if used
|
||||||
static int nope = 0; /* for use in asserts; shuts lint up */
|
static int nope = 0; /* for use in asserts; shuts lint up */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* macros for manipulating states, small version */
|
/* macros for manipulating states, small version */
|
||||||
#define states long
|
#define states long
|
||||||
#define states1 states /* for later use in regexec() decision */
|
#define states1 states /* for later use in regexec() decision */
|
||||||
#define CLEAR(v) ((v) = 0)
|
#define CLEAR(v) ((v) = 0)
|
||||||
#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n)))
|
#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n)))
|
||||||
#define SET1(v, n) ((v) |= (unsigned long)1 << (n))
|
#define SET1(v, n) ((v) |= (unsigned long)1 << (n))
|
||||||
#define ISSET(v, n) (((v) & ((unsigned long)1 << (n))) != 0)
|
#define ISSET(v, n) (((v) & ((unsigned long)1 << (n))) != 0)
|
||||||
#define ASSIGN(d, s) ((d) = (s))
|
#define ASSIGN(d, s) ((d) = (s))
|
||||||
#define EQ(a, b) ((a) == (b))
|
#define EQ(a, b) ((a) == (b))
|
||||||
#define STATEVARS long dummy /* dummy version */
|
#define STATEVARS long dummy /* dummy version */
|
||||||
#define STATESETUP(m, n) /* nothing */
|
#define STATESETUP(m, n) /* nothing */
|
||||||
#define STATETEARDOWN(m) /* nothing */
|
#define STATETEARDOWN(m) /* nothing */
|
||||||
#define SETUP(v) ((v) = 0)
|
#define SETUP(v) ((v) = 0)
|
||||||
#define onestate long
|
#define onestate long
|
||||||
#define INIT(o, n) ((o) = (unsigned long)1 << (n))
|
#define INIT(o, n) ((o) = (unsigned long)1 << (n))
|
||||||
#define INC(o) ((o) <<= 1)
|
#define INC(o) ((o) <<= 1)
|
||||||
#define ISSTATEIN(v, o) (((v) & (o)) != 0)
|
#define ISSTATEIN(v, o) (((v) & (o)) != 0)
|
||||||
/* some abbreviations; note that some of these know variable names! */
|
/* some abbreviations; note that some of these know variable names! */
|
||||||
/* do "if I'm here, I can also be there" etc without branches */
|
/* do "if I'm here, I can also be there" etc without branches */
|
||||||
#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n))
|
#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src) & (here)) << (n))
|
||||||
#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n))
|
#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src) & (here)) >> (n))
|
||||||
#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
|
#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
|
||||||
/* function names */
|
/* function names */
|
||||||
#define SNAMES /* engine.c looks after details */
|
#define SNAMES /* engine.c looks after details */
|
||||||
|
|
||||||
#include "engine.c"
|
#include "engine.c"
|
||||||
|
|
||||||
/* now undo things */
|
/* now undo things */
|
||||||
#undef states
|
#undef states
|
||||||
#undef CLEAR
|
#undef CLEAR
|
||||||
#undef SET0
|
#undef SET0
|
||||||
#undef SET1
|
#undef SET1
|
||||||
#undef ISSET
|
#undef ISSET
|
||||||
#undef ASSIGN
|
#undef ASSIGN
|
||||||
#undef EQ
|
#undef EQ
|
||||||
#undef STATEVARS
|
#undef STATEVARS
|
||||||
#undef STATESETUP
|
#undef STATESETUP
|
||||||
#undef STATETEARDOWN
|
#undef STATETEARDOWN
|
||||||
#undef SETUP
|
#undef SETUP
|
||||||
#undef onestate
|
#undef onestate
|
||||||
#undef INIT
|
#undef INIT
|
||||||
#undef INC
|
#undef INC
|
||||||
#undef ISSTATEIN
|
#undef ISSTATEIN
|
||||||
#undef FWD
|
#undef FWD
|
||||||
#undef BACK
|
#undef BACK
|
||||||
#undef ISSETBACK
|
#undef ISSETBACK
|
||||||
#undef SNAMES
|
#undef SNAMES
|
||||||
|
|
||||||
/* macros for manipulating states, large version */
|
/* macros for manipulating states, large version */
|
||||||
#define states char *
|
#define states char *
|
||||||
#define CLEAR(v) memset(v, 0, m->g->nstates)
|
#define CLEAR(v) memset(v, 0, m->g->nstates)
|
||||||
#define SET0(v, n) ((v)[n] = 0)
|
#define SET0(v, n) ((v)[n] = 0)
|
||||||
#define SET1(v, n) ((v)[n] = 1)
|
#define SET1(v, n) ((v)[n] = 1)
|
||||||
#define ISSET(v, n) ((v)[n])
|
#define ISSET(v, n) ((v)[n])
|
||||||
#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
|
#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
|
||||||
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
|
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
|
||||||
#define STATEVARS long vn; char *space
|
#define STATEVARS \
|
||||||
#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
|
long vn; \
|
||||||
if ((m)->space == NULL) return(REG_ESPACE); \
|
char *space
|
||||||
(m)->vn = 0; }
|
#define STATESETUP(m, nv) \
|
||||||
#define STATETEARDOWN(m) { free((m)->space); }
|
{ \
|
||||||
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
|
(m)->space = malloc((nv) * (m)->g->nstates); \
|
||||||
#define onestate long
|
if ((m)->space == NULL) \
|
||||||
#define INIT(o, n) ((o) = (n))
|
return (REG_ESPACE); \
|
||||||
#define INC(o) ((o)++)
|
(m)->vn = 0; \
|
||||||
#define ISSTATEIN(v, o) ((v)[o])
|
}
|
||||||
|
#define STATETEARDOWN(m) \
|
||||||
|
{ free((m)->space); }
|
||||||
|
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
|
||||||
|
#define onestate long
|
||||||
|
#define INIT(o, n) ((o) = (n))
|
||||||
|
#define INC(o) ((o)++)
|
||||||
|
#define ISSTATEIN(v, o) ((v)[o])
|
||||||
/* some abbreviations; note that some of these know variable names! */
|
/* some abbreviations; note that some of these know variable names! */
|
||||||
/* do "if I'm here, I can also be there" etc without branches */
|
/* do "if I'm here, I can also be there" etc without branches */
|
||||||
#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
|
#define FWD(dst, src, n) ((dst)[here + (n)] |= (src)[here])
|
||||||
#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
|
#define BACK(dst, src, n) ((dst)[here - (n)] |= (src)[here])
|
||||||
#define ISSETBACK(v, n) ((v)[here - (n)])
|
#define ISSETBACK(v, n) ((v)[here - (n)])
|
||||||
/* function names */
|
/* function names */
|
||||||
#define LNAMES /* flag */
|
#define LNAMES /* flag */
|
||||||
|
|
||||||
#include "engine.c"
|
#include "engine.c"
|
||||||
|
|
||||||
@ -164,30 +174,31 @@ static int nope = 0; /* for use in asserts; shuts lint up */
|
|||||||
* when choosing which matcher to call. Also, by this point the matchers
|
* when choosing which matcher to call. Also, by this point the matchers
|
||||||
* have been prototyped.
|
* have been prototyped.
|
||||||
*/
|
*/
|
||||||
int /* 0 success, REG_NOMATCH failure */
|
int /* 0 success, REG_NOMATCH failure */
|
||||||
yap_regexec(preg, string, nmatch, pmatch, eflags)
|
yap_regexec(preg, string, nmatch, pmatch, eflags) const regex_t *preg;
|
||||||
const regex_t *preg;
|
|
||||||
const char *string;
|
const char *string;
|
||||||
size_t nmatch;
|
size_t nmatch;
|
||||||
regmatch_t pmatch[];
|
regmatch_t pmatch[];
|
||||||
int eflags;
|
int eflags;
|
||||||
{
|
{
|
||||||
register struct re_guts *g = preg->re_g;
|
register struct re_guts *g = preg->re_g;
|
||||||
#ifdef REDEBUG
|
#ifdef REDEBUG
|
||||||
# define GOODFLAGS(f) (f)
|
#define GOODFLAGS(f) (f)
|
||||||
#else
|
#else
|
||||||
# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
|
#define GOODFLAGS(f) ((f) & (REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
|
if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
|
||||||
return(REG_BADPAT);
|
return (REG_BADPAT);
|
||||||
assert(!(g->iflags&BAD));
|
assert(!(g->iflags & BAD));
|
||||||
if (g->iflags&BAD) /* backstop for no-debug case */
|
if (g->iflags & BAD) /* backstop for no-debug case */
|
||||||
return(REG_BADPAT);
|
return (REG_BADPAT);
|
||||||
eflags = GOODFLAGS(eflags);
|
eflags = GOODFLAGS(eflags);
|
||||||
|
|
||||||
if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE))
|
if (g->nstates <= CHAR_BIT * sizeof(states1) && !(eflags & REG_LARGE))
|
||||||
return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
|
return (smatcher(g, (char *)string, nmatch, pmatch, eflags));
|
||||||
else
|
else
|
||||||
return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
|
return (lmatcher(g, (char *)string, nmatch, pmatch, eflags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -557,7 +557,7 @@ file_property(File, Type, Size, Date, Permissions, LinkName) :-
|
|||||||
file_property(File, Type, Size, Date, Permissions, LinkName, Error),
|
file_property(File, Type, Size, Date, Permissions, LinkName, Error),
|
||||||
handle_system_internal(Error, off, file_property(File)).
|
handle_system_internal(Error, off, file_property(File)).
|
||||||
|
|
||||||
|
|
||||||
%
|
%
|
||||||
% environment manipulation.
|
% environment manipulation.
|
||||||
%
|
%
|
||||||
@ -681,7 +681,7 @@ shell :-
|
|||||||
exec_command(FullCommand, 0, 1, 2, PID, Error),
|
exec_command(FullCommand, 0, 1, 2, PID, Error),
|
||||||
handle_system_internal(Error, off, G),
|
handle_system_internal(Error, off, G),
|
||||||
wait(PID, _Status, Error, Id),
|
wait(PID, _Status, Error, Id),
|
||||||
handle_system_internal(Error, Id, off, G).
|
handle_system_internal(Error, got(FullCommand, Id), off, G).
|
||||||
|
|
||||||
shell(Command) :-
|
shell(Command) :-
|
||||||
G = shell(Command),
|
G = shell(Command),
|
||||||
|
@ -841,7 +841,7 @@ plwait(void)
|
|||||||
if (WIFEXITED( status ) ) {
|
if (WIFEXITED( status ) ) {
|
||||||
return YAP_Unify(YAP_ARG2, YAP_MkIntTerm(WEXITSTATUS(status)) );
|
return YAP_Unify(YAP_ARG2, YAP_MkIntTerm(WEXITSTATUS(status)) );
|
||||||
} else if (WIFSIGNALED( status )) {
|
} else if (WIFSIGNALED( status )) {
|
||||||
return YAP_Unify(YAP_ARG3, YAP_MkAtomTerm(YAP_LookupAtom("signal")) ) &&
|
return YAP_Unify(YAP_ARG3, YAP_MkAtomTerm(YAP_LookupAtom("signalled")) ) &&
|
||||||
YAP_Unify(YAP_ARG4, YAP_MkIntTerm( WTERMSIG(status)) );
|
YAP_Unify(YAP_ARG4, YAP_MkIntTerm( WTERMSIG(status)) );
|
||||||
} else /* WIFSTOPPED(status) */ {
|
} else /* WIFSTOPPED(status) */ {
|
||||||
return YAP_Unify(YAP_ARG3, YAP_MkAtomTerm(YAP_LookupAtom("stopped")) ) &&
|
return YAP_Unify(YAP_ARG3, YAP_MkAtomTerm(YAP_LookupAtom("stopped")) ) &&
|
||||||
|
@ -76,7 +76,7 @@ If _S_ is a currently opened stream for output, it becomes the
|
|||||||
current output stream. If _S_ is an atom it is taken to be a
|
current output stream. If _S_ is an atom it is taken to be a
|
||||||
filename. If there is no output stream currently associated with it,
|
filename. If there is no output stream currently associated with it,
|
||||||
then it is opened for output, and the new output stream created becomes
|
then it is opened for output, and the new output stream created becomes
|
||||||
the current output stream. Existing files are clobbered, use append/1 to extend a file.
|
the current output stream. Existing files are clobbered, use append/1 to ext end a file.
|
||||||
If it is not possible to open the file, an
|
If it is not possible to open the file, an
|
||||||
error occurs. If there is a single opened output stream currently
|
error occurs. If there is a single opened output stream currently
|
||||||
associated with the file, then it becomes the current output stream; if
|
associated with the file, then it becomes the current output stream; if
|
||||||
|
76
os/sysbits.c
76
os/sysbits.c
@ -192,7 +192,7 @@ bool Yap_Exists(const char *f) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#elif HAVE_ACCESS
|
#elif HAVE_ACCESS
|
||||||
if (access(FileName, F_OK) == 0)
|
if (access(f, F_OK) == 0)
|
||||||
return true;
|
return true;
|
||||||
if (errno == EINVAL) {
|
if (errno == EINVAL) {
|
||||||
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad flags to access");
|
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad flags to access");
|
||||||
@ -448,8 +448,7 @@ static bool ChDir(const char *path) {
|
|||||||
#endif
|
#endif
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
rc = true;
|
rc = true;
|
||||||
if (qpath != NULL &&
|
if (qpath != NULL && qpath[0] &&
|
||||||
qpath[0] &&
|
|
||||||
(rc = (SetCurrentDirectory(qpath) != 0)) == 0) {
|
(rc = (SetCurrentDirectory(qpath) != 0)) == 0) {
|
||||||
Yap_WinError("SetCurrentDirectory failed");
|
Yap_WinError("SetCurrentDirectory failed");
|
||||||
}
|
}
|
||||||
@ -483,20 +482,19 @@ static const char *myrealpath(const char *path, char *out) {
|
|||||||
}
|
}
|
||||||
// rc = NULL;
|
// rc = NULL;
|
||||||
if (errno == ENOENT || errno == EACCES) {
|
if (errno == ENOENT || errno == EACCES) {
|
||||||
char base[YAP_FILENAME_MAX+1];
|
char base[YAP_FILENAME_MAX + 1];
|
||||||
strncpy(base, path, YAP_FILENAME_MAX - 1);
|
strncpy(base, path, YAP_FILENAME_MAX - 1);
|
||||||
rc = realpath(dirname(base), NULL);
|
rc = realpath(dirname(base), out);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
// base may haave been destroyed
|
// base may haave been destroyed
|
||||||
const char *b = basename(path);
|
const char *b = basename((char *)path);
|
||||||
size_t e = strlen(rc);
|
size_t e = strlen(rc);
|
||||||
size_t bs = strlen(b);
|
size_t bs = strlen(b);
|
||||||
|
|
||||||
if (rc != out &&
|
if (rc != out && rc != base) {
|
||||||
rc != base) {
|
rc = realloc(rc, e + bs + 2);
|
||||||
rc = realloc(rc, e + bs + 2);
|
}
|
||||||
}
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
if (rc[e - 1] != '\\' && rc[e - 1] != '/') {
|
if (rc[e - 1] != '\\' && rc[e - 1] != '/') {
|
||||||
rc[e] = '\\';
|
rc[e] = '\\';
|
||||||
@ -551,18 +549,17 @@ const char *Yap_AbsoluteFile(const char *spec, char *rc0, bool ok) {
|
|||||||
const char *rc;
|
const char *rc;
|
||||||
const char *spec1;
|
const char *spec1;
|
||||||
const char *spec2;
|
const char *spec2;
|
||||||
char rc1[YAP_FILENAME_MAX+1];
|
char rc1[YAP_FILENAME_MAX + 1];
|
||||||
|
|
||||||
/// spec gothe original spec;
|
/// spec gothe original spec;
|
||||||
/// rc0 may be an outout buffer
|
/// rc0 may be an outout buffer
|
||||||
/// rc1 the internal buffer
|
/// rc1 the internal buffer
|
||||||
///
|
///
|
||||||
/// PlExpandVars
|
/// PlExpandVars
|
||||||
|
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
char rc2[YAP_FILENAME_MAX];
|
char rc2[YAP_FILENAME_MAX];
|
||||||
if (( rc = unix2win(spec, rc2, YAP_FILENAME_MAX)) == NULL) {
|
if ((rc = unix2win(spec, rc2, YAP_FILENAME_MAX)) == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
spec1 = rc;
|
spec1 = rc;
|
||||||
@ -585,8 +582,8 @@ const char *Yap_AbsoluteFile(const char *spec, char *rc0, bool ok) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Term
|
static Term
|
||||||
/* Expand the string for the program to run. */
|
/* Expand the string for the program to run. */
|
||||||
do_glob(const char *spec, bool glob_vs_wordexp) {
|
do_glob(const char *spec, bool glob_vs_wordexp) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
char u[YAP_FILENAME_MAX + 1];
|
char u[YAP_FILENAME_MAX + 1];
|
||||||
const char *espec = u;
|
const char *espec = u;
|
||||||
@ -604,8 +601,8 @@ do_glob(const char *spec, bool glob_vs_wordexp) {
|
|||||||
char fname[_MAX_FNAME];
|
char fname[_MAX_FNAME];
|
||||||
char ext[_MAX_EXT];
|
char ext[_MAX_EXT];
|
||||||
|
|
||||||
_splitpath( spec, drive, dir, fname, ext );
|
_splitpath(spec, drive, dir, fname, ext);
|
||||||
_makepath( u, drive, dir, fname, ext );
|
_makepath(u, drive, dir, fname, ext);
|
||||||
|
|
||||||
// first pass, remove Unix style stuff
|
// first pass, remove Unix style stuff
|
||||||
hFind = FindFirstFile(u, &find);
|
hFind = FindFirstFile(u, &find);
|
||||||
@ -613,15 +610,15 @@ do_glob(const char *spec, bool glob_vs_wordexp) {
|
|||||||
return TermNil;
|
return TermNil;
|
||||||
} else {
|
} else {
|
||||||
tf = AbsPair(HR);
|
tf = AbsPair(HR);
|
||||||
_makepath( u, drive, dir, find.cFileName, NULL );
|
_makepath(u, drive, dir, find.cFileName, NULL);
|
||||||
HR[0] = MkAtomTerm(Yap_LookupAtom(u));
|
HR[0] = MkAtomTerm(Yap_LookupAtom(u));
|
||||||
HR[1] = TermNil;
|
HR[1] = TermNil;
|
||||||
dest = HR + 1;
|
dest = HR + 1;
|
||||||
HR += 2;
|
HR += 2;
|
||||||
while (FindNextFile(hFind, &find)) {
|
while (FindNextFile(hFind, &find)) {
|
||||||
*dest = AbsPair(HR);
|
*dest = AbsPair(HR);
|
||||||
_makepath( u, drive, dir, find.cFileName, NULL );
|
_makepath(u, drive, dir, find.cFileName, NULL);
|
||||||
HR[0] = MkAtomTerm(Yap_LookupAtom(u));
|
HR[0] = MkAtomTerm(Yap_LookupAtom(u));
|
||||||
HR[1] = TermNil;
|
HR[1] = TermNil;
|
||||||
dest = HR + 1;
|
dest = HR + 1;
|
||||||
HR += 2;
|
HR += 2;
|
||||||
@ -752,7 +749,6 @@ do_glob(const char *spec, bool glob_vs_wordexp) {
|
|||||||
static Int real_path(USES_REGS1) {
|
static Int real_path(USES_REGS1) {
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
const char *cmd, *rc0;
|
const char *cmd, *rc0;
|
||||||
char *rc;
|
|
||||||
|
|
||||||
if (IsAtomTerm(t1)) {
|
if (IsAtomTerm(t1)) {
|
||||||
cmd = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
cmd = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
||||||
@ -762,14 +758,14 @@ static Int real_path(USES_REGS1) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
char cmd2[YAP_FILENAME_MAX+1];
|
char cmd2[YAP_FILENAME_MAX + 1];
|
||||||
|
|
||||||
if (( rc = unix2win(cmd, cmd2, YAP_FILENAME_MAX)) == NULL) {
|
if ((rc = unix2win(cmd, cmd2, YAP_FILENAME_MAX)) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cmd = rc;
|
cmd = rc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rc0 = myrealpath(cmd, NULL);
|
rc0 = myrealpath(cmd, NULL);
|
||||||
if (!rc0) {
|
if (!rc0) {
|
||||||
PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, NULL);
|
PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, NULL);
|
||||||
@ -818,15 +814,15 @@ static Term do_expand_file_name(Term t1, Term opts USES_REGS) {
|
|||||||
#if _WIN32
|
#if _WIN32
|
||||||
{
|
{
|
||||||
char *rc;
|
char *rc;
|
||||||
char cmd2[YAP_FILENAME_MAX+1];
|
char cmd2[YAP_FILENAME_MAX + 1];
|
||||||
|
|
||||||
if (( rc = unix2win(spec, cmd2, YAP_FILENAME_MAX)) == NULL) {
|
if ((rc = unix2win(spec, cmd2, YAP_FILENAME_MAX)) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
spec = rc;
|
spec = rc;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
args = Yap_ArgListToVector(opts, expand_filename_defs, EXPAND_FILENAME_END);
|
args = Yap_ArgListToVector(opts, expand_filename_defs, EXPAND_FILENAME_END);
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
return TermNil;
|
return TermNil;
|
||||||
@ -869,8 +865,7 @@ static Term do_expand_file_name(Term t1, Term opts USES_REGS) {
|
|||||||
const char *o = expandVars(spec, NULL);
|
const char *o = expandVars(spec, NULL);
|
||||||
if (!o)
|
if (!o)
|
||||||
return false;
|
return false;
|
||||||
return MkPairTerm(MkAtomTerm(Yap_LookupAtom(o)),
|
return MkPairTerm(MkAtomTerm(Yap_LookupAtom(o)), TermNil);
|
||||||
TermNil);
|
|
||||||
}
|
}
|
||||||
tf = do_glob(spec, true);
|
tf = do_glob(spec, true);
|
||||||
return tf;
|
return tf;
|
||||||
@ -1383,10 +1378,9 @@ static Int true_file_name(USES_REGS1) {
|
|||||||
Yap_Error(TYPE_ERROR_ATOM, t, "argument to true_file_name");
|
Yap_Error(TYPE_ERROR_ATOM, t, "argument to true_file_name");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!Yap_AbsoluteFile(s,
|
if (!(s = Yap_AbsoluteFile(s, LOCAL_FileNameBuf, true)))
|
||||||
LOCAL_FileNameBuf, true))
|
return false;
|
||||||
return true;
|
return Yap_unify(ARG2, MkAtomTerm(Yap_LookupAtom(s)));
|
||||||
return Yap_unify(ARG2, MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int p_expand_file_name(USES_REGS1) {
|
static Int p_expand_file_name(USES_REGS1) {
|
||||||
|
@ -353,8 +353,6 @@ do_learning_intern(Iterations,Epsilon) :-
|
|||||||
|
|
||||||
format_learning(1,'~nIteration ~d of ~d~n',[CurrentIteration,EndIteration]),
|
format_learning(1,'~nIteration ~d of ~d~n',[CurrentIteration,EndIteration]),
|
||||||
logger_set_variable(iteration,CurrentIteration),
|
logger_set_variable(iteration,CurrentIteration),
|
||||||
leash(none),
|
|
||||||
% trace,
|
|
||||||
write_probabilities_file,
|
write_probabilities_file,
|
||||||
|
|
||||||
once(llh_testset),
|
once(llh_testset),
|
||||||
|
@ -856,9 +856,8 @@ int my_index_calc(int varstart, DdNode *node) {
|
|||||||
}
|
}
|
||||||
void AddNode(hisqueue *HisQueue, int varstart, DdNode *node, double dvalue,
|
void AddNode(hisqueue *HisQueue, int varstart, DdNode *node, double dvalue,
|
||||||
int ivalue, void *dynvalue) {
|
int ivalue, void *dynvalue) {
|
||||||
// int index = GetIndex(node) - varstart;
|
//int index = GetIndex(node) - varstart;
|
||||||
// fprintf(stderr,"----- node added: %p <-> %i <->
|
//fprintf(stderr,"----- node added: %p <-> %i <-> %e\n",node,GetIndex(node),dvalue);
|
||||||
// %e\n",node,GetIndex(node),dvalue);
|
|
||||||
int index = my_index_calc(varstart, node);
|
int index = my_index_calc(varstart, node);
|
||||||
HisQueue[index].thenode = (hisnode *)realloc(
|
HisQueue[index].thenode = (hisnode *)realloc(
|
||||||
HisQueue[index].thenode,
|
HisQueue[index].thenode,
|
||||||
@ -876,8 +875,8 @@ hisnode *GetNode(hisqueue *HisQueue, int varstart, DdNode *node) {
|
|||||||
// int index = GetIndex(node) - varstart;
|
// int index = GetIndex(node) - varstart;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
index = my_index_calc(varstart, node);
|
index = my_index_calc(varstart, node);
|
||||||
// fprintf(stderr,"----- node retuned: %p <-> %i <-> %i
|
// fprintf(stderr,"----- node retuned: %p <-> %i <-> %i
|
||||||
// \n",node,GetIndex(node),index);
|
// \n",node,GetIndex(node),index);
|
||||||
// TODO: this must be check think not initialzied. Null check fails?
|
// TODO: this must be check think not initialzied. Null check fails?
|
||||||
// if (Cudd_IsConstant(node) ){
|
// if (Cudd_IsConstant(node) ){
|
||||||
// fprintf(stderr,"----- node retuned: %p <-> %i \n",node,GetIndex(node));
|
// fprintf(stderr,"----- node retuned: %p <-> %i \n",node,GetIndex(node));
|
||||||
|
Reference in New Issue
Block a user