fix WIN stuff

This commit is contained in:
Vitor Santos Costa 2016-04-18 16:41:30 +01:00
parent 49699f52e9
commit 96f03e26e8
13 changed files with 168 additions and 151 deletions

View File

@ -124,7 +124,21 @@ endif()
set(WITH_CUDD YES CACHE FILEPATH "Try to use Cudd (currently Cudd 3)")
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)
set(WITH_JAVA YES CACHE FILEPATH "Try to use Java (currently Java 6,7,8)")

View File

@ -2,9 +2,7 @@
#ifndef YAPT_HH
#define YAPT_HH 1
class YAPAtomTerm;
extern "C" X_API Term YAP_ReadBuffer(const char *s, Term *tp);
extern "C" Term YAP_ReadBuffer(const char *s, Term *tp);
/**
* @brief Generic Prolog Term

View File

@ -115,11 +115,18 @@ find_library(CUDD_EPD_LIBRARY
set(CUDD_LIBRARIES
${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.
SET( CUDD_FOUND "NO" )
IF(CUDD_INCLUDE_DIR AND CUDD_LIBRARIES)
SET( CUDD_FOUND "YES" )
ENDIF()
mark_as_advanced (CUDD_FOUND)
find_package_handle_standard_args(R DEFAULT_MSG CUDD_LIBRARIES CUDD_INCLUDE_DIR )

View File

@ -10,9 +10,5 @@ macro_log_feature (CUDD_FOUND "CUDD"
"Use CUDD Library"
"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 )

View File

@ -72,20 +72,14 @@ long _stksize = 32000;
static void do_top_goal(YAP_Term Goal) { YAP_RunGoalOnce(Goal); }
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 */
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);
}
if (iap->ErrorNo) {
/* boot failed */
YAP_Error(iap->ErrorNo, 0L, iap->ErrorCause);

View File

@ -44,6 +44,10 @@
* of code.
*/
#include "config.h"
#ifndef HAVE_REGEXEC
#ifdef SNAMES
#define matcher smatcher
#define fast sfast
@ -1090,3 +1094,5 @@ int ch;
#undef print
#undef at
#undef match
#endif

View File

@ -49,6 +49,9 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
* representations for state sets.
*/
#include "config.h"
#ifndef HAVE_REGEXEC
#include "c_interface.h"
#if HAVE_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>
#endif
#include "yapregex.h"
#include "utils.h"
#include "regex2.h"
#include "utils.h"
#include "yapregex.h"
#if used
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 ASSIGN(d, s) memcpy(d, s, m->g->nstates)
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
#define STATEVARS long vn; char *space
#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
if ((m)->space == NULL) return(REG_ESPACE); \
(m)->vn = 0; }
#define STATETEARDOWN(m) { free((m)->space); }
#define STATEVARS \
long vn; \
char *space
#define STATESETUP(m, nv) \
{ \
(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 onestate long
#define INIT(o, n) ((o) = (n))
@ -165,8 +175,7 @@ static int nope = 0; /* for use in asserts; shuts lint up */
* have been prototyped.
*/
int /* 0 success, REG_NOMATCH failure */
yap_regexec(preg, string, nmatch, pmatch, eflags)
const regex_t *preg;
yap_regexec(preg, string, nmatch, pmatch, eflags) const regex_t *preg;
const char *string;
size_t nmatch;
regmatch_t pmatch[];
@ -191,3 +200,5 @@ int eflags;
else
return (lmatcher(g, (char *)string, nmatch, pmatch, eflags));
}
#endif

View File

@ -681,7 +681,7 @@ shell :-
exec_command(FullCommand, 0, 1, 2, PID, Error),
handle_system_internal(Error, off, G),
wait(PID, _Status, Error, Id),
handle_system_internal(Error, Id, off, G).
handle_system_internal(Error, got(FullCommand, Id), off, G).
shell(Command) :-
G = shell(Command),

View File

@ -841,7 +841,7 @@ plwait(void)
if (WIFEXITED( status ) ) {
return YAP_Unify(YAP_ARG2, YAP_MkIntTerm(WEXITSTATUS(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)) );
} else /* WIFSTOPPED(status) */ {
return YAP_Unify(YAP_ARG3, YAP_MkAtomTerm(YAP_LookupAtom("stopped")) ) &&

View File

@ -192,7 +192,7 @@ bool Yap_Exists(const char *f) {
}
return false;
#elif HAVE_ACCESS
if (access(FileName, F_OK) == 0)
if (access(f, F_OK) == 0)
return true;
if (errno == EINVAL) {
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad flags to access");
@ -448,8 +448,7 @@ static bool ChDir(const char *path) {
#endif
#if _WIN32
rc = true;
if (qpath != NULL &&
qpath[0] &&
if (qpath != NULL && qpath[0] &&
(rc = (SetCurrentDirectory(qpath) != 0)) == 0) {
Yap_WinError("SetCurrentDirectory failed");
}
@ -485,16 +484,15 @@ static const char *myrealpath(const char *path, char *out) {
if (errno == ENOENT || errno == EACCES) {
char base[YAP_FILENAME_MAX + 1];
strncpy(base, path, YAP_FILENAME_MAX - 1);
rc = realpath(dirname(base), NULL);
rc = realpath(dirname(base), out);
if (rc) {
// base may haave been destroyed
const char *b = basename(path);
const char *b = basename((char *)path);
size_t e = strlen(rc);
size_t bs = strlen(b);
if (rc != out &&
rc != base) {
if (rc != out && rc != base) {
rc = realloc(rc, e + bs + 2);
}
#if _WIN32
@ -559,7 +557,6 @@ const char *Yap_AbsoluteFile(const char *spec, char *rc0, bool ok) {
///
/// PlExpandVars
#if _WIN32
char rc2[YAP_FILENAME_MAX];
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) {
Term t1 = Deref(ARG1);
const char *cmd, *rc0;
char *rc;
if (IsAtomTerm(t1)) {
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);
if (!o)
return false;
return MkPairTerm(MkAtomTerm(Yap_LookupAtom(o)),
TermNil);
return MkPairTerm(MkAtomTerm(Yap_LookupAtom(o)), TermNil);
}
tf = do_glob(spec, true);
return tf;
@ -1383,10 +1378,9 @@ static Int true_file_name(USES_REGS1) {
Yap_Error(TYPE_ERROR_ATOM, t, "argument to true_file_name");
return FALSE;
}
if (!Yap_AbsoluteFile(s,
LOCAL_FileNameBuf, true))
return true;
return Yap_unify(ARG2, MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)));
if (!(s = Yap_AbsoluteFile(s, LOCAL_FileNameBuf, true)))
return false;
return Yap_unify(ARG2, MkAtomTerm(Yap_LookupAtom(s)));
}
static Int p_expand_file_name(USES_REGS1) {

View File

@ -353,8 +353,6 @@ do_learning_intern(Iterations,Epsilon) :-
format_learning(1,'~nIteration ~d of ~d~n',[CurrentIteration,EndIteration]),
logger_set_variable(iteration,CurrentIteration),
leash(none),
% trace,
write_probabilities_file,
once(llh_testset),

View File

@ -857,8 +857,7 @@ int my_index_calc(int varstart, DdNode *node) {
void AddNode(hisqueue *HisQueue, int varstart, DdNode *node, double dvalue,
int ivalue, void *dynvalue) {
//int index = GetIndex(node) - varstart;
// fprintf(stderr,"----- node added: %p <-> %i <->
// %e\n",node,GetIndex(node),dvalue);
//fprintf(stderr,"----- node added: %p <-> %i <-> %e\n",node,GetIndex(node),dvalue);
int index = my_index_calc(varstart, node);
HisQueue[index].thenode = (hisnode *)realloc(
HisQueue[index].thenode,