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_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);
|
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,9 +68,9 @@ 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 */
|
||||||
@ -129,11 +132,18 @@ static int nope = 0; /* for use in asserts; shuts lint up */
|
|||||||
#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); }
|
{ \
|
||||||
|
(m)->space = malloc((nv) * (m)->g->nstates); \
|
||||||
|
if ((m)->space == NULL) \
|
||||||
|
return (REG_ESPACE); \
|
||||||
|
(m)->vn = 0; \
|
||||||
|
}
|
||||||
|
#define STATETEARDOWN(m) \
|
||||||
|
{ free((m)->space); }
|
||||||
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
|
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
|
||||||
#define onestate long
|
#define onestate long
|
||||||
#define INIT(o, n) ((o) = (n))
|
#define INIT(o, n) ((o) = (n))
|
||||||
@ -165,8 +175,7 @@ static int nope = 0; /* for use in asserts; shuts lint up */
|
|||||||
* 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[];
|
||||||
@ -191,3 +200,5 @@ int eflags;
|
|||||||
else
|
else
|
||||||
return (lmatcher(g, (char *)string, nmatch, pmatch, eflags));
|
return (lmatcher(g, (char *)string, nmatch, pmatch, eflags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -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")) ) &&
|
||||||
|
24
os/sysbits.c
24
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");
|
||||||
}
|
}
|
||||||
@ -485,16 +484,15 @@ static const char *myrealpath(const char *path, char *out) {
|
|||||||
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
|
||||||
@ -559,7 +557,6 @@ const char *Yap_AbsoluteFile(const char *spec, char *rc0, bool ok) {
|
|||||||
///
|
///
|
||||||
/// 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) {
|
||||||
@ -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;
|
||||||
@ -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),
|
||||||
|
@ -857,8 +857,7 @@ 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,
|
||||||
|
Reference in New Issue
Block a user