linux_weird

This commit is contained in:
Vitor Santos Costa 2016-08-23 15:08:36 -05:00
parent cbef36b565
commit 6148e8199f
7 changed files with 53 additions and 5 deletions

View File

@ -18,10 +18,10 @@ if (CUDD_FOUND)
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CUDD_INCLUDE_DIR} )
check_include_files( cudd.h HAVE_CUDD_H )
check_include_files( "stdio.h;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 )
check_include_files( "cuddInt.h" HAVE_CUDDINT_H )
check_include_files( "cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
endif (CUDD_FOUND)
endif(WITH_CUDD)

View File

@ -45,6 +45,7 @@
mktemp/2,
make_directory/1,
popen/3,
read_link/3,
rename_file/2,
shell/0,
shell/1,
@ -318,6 +319,14 @@ Create file _OldFile_ to _NewFile_. This predicate uses the
`C` built-in function `rename`.
*/
/** @pred read_link(+ SymbolicLink, -Link, -NewPath)
Follow a _SymbolicLink_, and obtain the actual _Link_ and the target _newPath_). This predicate uses the
`C` built-in function `readlink` and is not yet operational in WIN32.
*/
/** @pred shell
@ -797,3 +806,8 @@ tmpdir(TmpDir):-
path_separator('\\'):-
win, !.
path_separator('/').
read_link(P,D,F) :-
read_link(P, D),
absolute_file_name(D, [], F).

View File

@ -312,6 +312,27 @@ static YAP_Bool rename_file(void) {
return (TRUE);
}
static YAP_Bool read_link(void) {
char *s1 = (char *)YAP_AtomName(YAP_AtomOfTerm(YAP_ARG1));
#if HAVE_READLINK
char buf[PATH_MAX + 1];
if (readlink(s1, buf, PATH_MAX) < 0)
return false;
/* return an error number */
if (!YAP_Unify(YAP_ARG2, YAP_MkAtomTerm(YAP_LookupAtom(buf)))) {
return false;
}
#endif
# if _WIN32
return false;
#endif
return true;
}
static YAP_Bool dir_separator(void) {
return (YAP_Unify(YAP_ARG1, YAP_MkAtomTerm(YAP_LookupAtom("/"))));
}
@ -1038,6 +1059,7 @@ void init_sys(void) {
YAP_UserCPredicate("tmpdir", p_tmpdir, 2);
YAP_UserCPredicate("rename_file", rename_file, 3);
YAP_UserCPredicate("sleep", p_sleep, 2);
YAP_UserCPredicate("read_link", read_link, 2);
YAP_UserCPredicate("error_message", error_message, 2);
YAP_UserCPredicate("win", win, 0);
YAP_UserCPredicate("md5", md5, 3);

View File

@ -1,5 +1,15 @@
// cmake template file
/* Define to 1 if you have the <cuddInt.h> header file. */
#ifndef HAVE_CUDD_H
#cmakedefine HAVE_CUDD_H ${HAVE_CUDD_H}
#endif
/* Define to 1 if you have the <cudd/cuddInt.h> header file. */
#ifndef HAVE_CUDD_CUDD_H
#cmakedefine HAVE_CUDD_CUDD_H ${HAVE_CUDD_CUDD_H}
#endif
/* Define to 1 if you have the <cuddInt.h> header file. */
#ifndef HAVE_CUDDINT_H
#cmakedefine HAVE_CUDDINT_H ${HAVE_CUDDINT_H}

View File

@ -12,7 +12,7 @@ for the relative license.
#include "cudd_config.h"
#if HAVE_CUDD_CUDDINT_H
#include "cudd/cuddInt.h"
#else
#elif HAVE_CUDDINT_H
#include "cuddInt.h"
#endif
#include "YapInterface.h"

View File

@ -66,6 +66,7 @@
:- use_module(library(charsio)).
:- use_module(library(readutil)).
:- use_module(library(debug)).
:- use_module(library(system)).
:- dynamic( real:r_started/1 ).

View File

@ -4,7 +4,7 @@ import os
import platform
if platform.system() == 'Darwin':
my_extra_link_args = ['-Wl,-rpath','${dlls}']
my_extra_link_args = ['-Wl,-rpath','-Wl,${dlls}']
else:
my_extra_link_args = []
@ -23,6 +23,7 @@ setup(
extra_link_args=my_extra_link_args,
libraries=['Yap++','Yap','YAPPython'],
include_dirs=['../../..',
'${GMP_INCLUDE_DIRS}',
'${CMAKE_SOURCE_DIR}/H',
'${CMAKE_SOURCE_DIR}/H/generated',
'${CMAKE_SOURCE_DIR}/OPTYap',