enable path expansion by default
This commit is contained in:
parent
d5ce9a1376
commit
0ed3ee4fc4
@ -1010,9 +1010,6 @@ p_unary_is( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
out= eval1(p->FOfEE, top PASS_REGS);
|
out= eval1(p->FOfEE, top PASS_REGS);
|
||||||
if ((err=Yap_FoundArithError())) {
|
if ((err=Yap_FoundArithError())) {
|
||||||
Functor f = Yap_MkFunctor( name, 1 );
|
|
||||||
Term t = Yap_MkApplTerm( f, 1, &top );
|
|
||||||
Yap_EvalError(err, t ,"error in %s/1", RepAtom(name)->StrOfAE);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return Yap_unify_constant(ARG1,out);
|
return Yap_unify_constant(ARG1,out);
|
||||||
|
50
C/sysbits.c
50
C/sysbits.c
@ -375,7 +375,8 @@ yapExpandVars (const char *source, char *result)
|
|||||||
{
|
{
|
||||||
const char *src = source;
|
const char *src = source;
|
||||||
char *res = result;
|
char *res = result;
|
||||||
|
if(result == NULL)
|
||||||
|
result = malloc( YAP_FILENAME_MAX+1);
|
||||||
|
|
||||||
if (strlen(source) >= YAP_FILENAME_MAX) {
|
if (strlen(source) >= YAP_FILENAME_MAX) {
|
||||||
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "%s in true_file-name is larger than the buffer size (%d bytes)", source, strlen(source));
|
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "%s in true_file-name is larger than the buffer size (%d bytes)", source, strlen(source));
|
||||||
@ -390,14 +391,14 @@ yapExpandVars (const char *source, char *result)
|
|||||||
s = getenv("HOMEDRIVE");
|
s = getenv("HOMEDRIVE");
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
strncpy (result, getenv ("HOMEDRIVE"), YAP_FILENAME_MAX);
|
strncpy (result, getenv ("HOMEDRIVE"), YAP_FILENAME_MAX);
|
||||||
s = getenv("HOMEPATH");
|
//s = getenv("HOMEPATH");
|
||||||
if (s != NULL)
|
|
||||||
strncpy (result, s, YAP_FILENAME_MAX);
|
|
||||||
#else
|
#else
|
||||||
s = getenv ("HOME");
|
s = getenv ("HOME");
|
||||||
|
#endif
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
strncpy (result, s, YAP_FILENAME_MAX);
|
strncpy (result, s, YAP_FILENAME_MAX);
|
||||||
#endif
|
strcat(result,src);
|
||||||
|
return result;
|
||||||
} else {
|
} else {
|
||||||
#if HAVE_GETPWNAM
|
#if HAVE_GETPWNAM
|
||||||
struct passwd *user_passwd;
|
struct passwd *user_passwd;
|
||||||
@ -411,45 +412,46 @@ yapExpandVars (const char *source, char *result)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strncpy (result, user_passwd->pw_dir, YAP_FILENAME_MAX);
|
strncpy (result, user_passwd->pw_dir, YAP_FILENAME_MAX);
|
||||||
|
strcat(result, src);
|
||||||
#else
|
#else
|
||||||
Yap_FileError(OPERATING_SYSTEM_ERROR, MkAtomTerm(Yap_LookupAtom(source)),"User %s cannot be found in %s, missing getpwnam", result, source);
|
Yap_FileError(OPERATING_SYSTEM_ERROR, MkAtomTerm(Yap_LookupAtom(source)),"User %s cannot be found in %s, missing getpwnam", result, source);
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
strncat (result, src, YAP_FILENAME_MAX);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if !HAVE_WORDEXP || !defined(ENABLE_SYSTEM_EXPANSION)
|
|
||||||
// do VARIABLE expansion
|
// do VARIABLE expansion
|
||||||
else if (source[0] == '$') {
|
else if (source[0] == '$') {
|
||||||
/* follow SICStus expansion rules */
|
/* follow SICStus expansion rules */
|
||||||
|
char v[YAP_FILENAME_MAX+1];
|
||||||
int ch;
|
int ch;
|
||||||
char *s;
|
char *s;
|
||||||
src = source+1;
|
src = source+1;
|
||||||
if (src[0] == '{') {
|
if (src[0] == '{') {
|
||||||
|
res = v;
|
||||||
src++;
|
src++;
|
||||||
while ((*res++ = (ch = *src++)) && isValidEnvChar (ch) && ch != '}') {
|
while ((*res = (ch = *src++)) && isValidEnvChar (ch) && ch != '}') {
|
||||||
res++;
|
res++;
|
||||||
}
|
}
|
||||||
if (ch == '}') {
|
if (ch == '}') {
|
||||||
// {...}
|
// {...}
|
||||||
// done
|
// done
|
||||||
|
res[0] = '\0';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while ((*res++ = (ch = *src++)) && isValidEnvChar (ch) && ch != '}') {
|
res = v;
|
||||||
|
while ((*res = (ch = *src++)) && isValidEnvChar (ch) && ch != '}') {
|
||||||
res++;
|
res++;
|
||||||
}
|
}
|
||||||
src--;
|
src--;
|
||||||
}
|
|
||||||
res[0] = '\0';
|
res[0] = '\0';
|
||||||
if ((s = (char *) getenv (result))) {
|
|
||||||
strncpy (result, s, YAP_FILENAME_MAX);
|
|
||||||
} else {
|
|
||||||
result[0] = '\0';
|
|
||||||
}
|
}
|
||||||
strncat (result, src, YAP_FILENAME_MAX);
|
if ((s = (char *) getenv (v))) {
|
||||||
|
strcpy (result, s);
|
||||||
|
strcat (result, src);
|
||||||
|
} else
|
||||||
|
strcpy( result, src);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else {
|
else {
|
||||||
strncpy (result, source, YAP_FILENAME_MAX);
|
strncpy (result, source, YAP_FILENAME_MAX);
|
||||||
}
|
}
|
||||||
@ -460,10 +462,7 @@ char *
|
|||||||
expandVars(const char *pattern, char *expanded, int maxlen)
|
expandVars(const char *pattern, char *expanded, int maxlen)
|
||||||
{
|
{
|
||||||
|
|
||||||
char tmp[YAP_FILENAME_MAX+1];
|
return yapExpandVars(pattern, expanded);
|
||||||
if ((pattern = yapExpandVars(pattern, tmp)) == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#if ( __WIN32 || __MINGW32__ ) && defined(ENABLE_SYSTEM_EXPANSION)
|
#if ( __WIN32 || __MINGW32__ ) && defined(ENABLE_SYSTEM_EXPANSION)
|
||||||
DWORD retval=0;
|
DWORD retval=0;
|
||||||
// notice that the file does not need to exist1
|
// notice that the file does not need to exist1
|
||||||
@ -592,8 +591,8 @@ OsPath(const char *p, char *buf)
|
|||||||
#else
|
#else
|
||||||
char *
|
char *
|
||||||
OsPath(const char *X, char *Y) {
|
OsPath(const char *X, char *Y) {
|
||||||
//if (X!=Y && Y) strcpy(Y,X);
|
if (X!=Y && Y) strcpy(Y,X);
|
||||||
return (char *)X ;
|
return (char *)Y ;
|
||||||
}
|
}
|
||||||
#endif /* O_XOS */
|
#endif /* O_XOS */
|
||||||
|
|
||||||
@ -718,9 +717,8 @@ char *
|
|||||||
{
|
{
|
||||||
GET_LD
|
GET_LD
|
||||||
char *rc;
|
char *rc;
|
||||||
#if HAVE_WORDEXP
|
|
||||||
char o[YAP_FILENAME_MAX+1];
|
char o[YAP_FILENAME_MAX+1];
|
||||||
#elif _WIN32 || defined(__MINGW32__)
|
#if _WIN32 || defined(__MINGW32__)
|
||||||
char u[YAP_FILENAME_MAX+1];
|
char u[YAP_FILENAME_MAX+1];
|
||||||
// first pass, remove Unix style stuff
|
// first pass, remove Unix style stuff
|
||||||
if (unix2win(spec, u, YAP_FILENAME_MAX) == NULL)
|
if (unix2win(spec, u, YAP_FILENAME_MAX) == NULL)
|
||||||
@ -733,11 +731,9 @@ char *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( truePrologFlag(PLFLAG_FILEVARS) )
|
if ( 1 || truePrologFlag(PLFLAG_FILEVARS) )
|
||||||
{
|
{
|
||||||
#if HAVE_WORDEXP
|
|
||||||
spec=expandVars(spec,o,YAP_FILENAME_MAX);
|
spec=expandVars(spec,o,YAP_FILENAME_MAX);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#if HAVE_REALPATH
|
#if HAVE_REALPATH
|
||||||
rc = myrealpath(spec, tmp);
|
rc = myrealpath(spec, tmp);
|
||||||
|
@ -935,6 +935,9 @@ you don't. */
|
|||||||
#cmakedefine HAVE_OPENDIR ${HAVE_OPENDIR}
|
#cmakedefine HAVE_OPENDIR ${HAVE_OPENDIR}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <openssl/ripemd.h> header file. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_RIPEMD_H ${HAVE_OPENSSL_RIPEMD_H}
|
||||||
|
|
||||||
/* Define to 1 if you have the `pipe2' function. */
|
/* Define to 1 if you have the `pipe2' function. */
|
||||||
#ifndef HAVE_PIPE2
|
#ifndef HAVE_PIPE2
|
||||||
#cmakedefine HAVE_PIPE2 ${HAVE_PIPE2}
|
#cmakedefine HAVE_PIPE2 ${HAVE_PIPE2}
|
||||||
|
21
config.h.in
21
config.h.in
@ -159,6 +159,21 @@
|
|||||||
/* Define to 1 if you have the <ctype.h> header file. */
|
/* Define to 1 if you have the <ctype.h> header file. */
|
||||||
#undef HAVE_CTYPE_H
|
#undef HAVE_CTYPE_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cuddInt.h> header file. */
|
||||||
|
#undef HAVE_CUDDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cudd/cuddInt.h> header file. */
|
||||||
|
#undef HAVE_CUDD_CUDDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cudd/cudd.h> header file. */
|
||||||
|
#undef HAVE_CUDD_CUDD_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cudd.h> header file. */
|
||||||
|
#undef HAVE_CUDD_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cudd/util.h> header file. */
|
||||||
|
#undef HAVE_CUDD_UTIL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the declaration of `rl_catch_signals ', and to 0 if
|
/* Define to 1 if you have the declaration of `rl_catch_signals ', and to 0 if
|
||||||
you don't. */
|
you don't. */
|
||||||
#undef HAVE_DECL_RL_CATCH_SIGNALS_
|
#undef HAVE_DECL_RL_CATCH_SIGNALS_
|
||||||
@ -535,6 +550,9 @@
|
|||||||
/* Define to 1 if you have the `opendir' function. */
|
/* Define to 1 if you have the `opendir' function. */
|
||||||
#undef HAVE_OPENDIR
|
#undef HAVE_OPENDIR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <openssl/ripemd.h> header file. */
|
||||||
|
#undef HAVE_OPENSSL_RIPEMD_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `pipe2' function. */
|
/* Define to 1 if you have the `pipe2' function. */
|
||||||
#undef HAVE_PIPE2
|
#undef HAVE_PIPE2
|
||||||
|
|
||||||
@ -881,6 +899,9 @@
|
|||||||
/* Define to 1 if you have the `usleep' function. */
|
/* Define to 1 if you have the `usleep' function. */
|
||||||
#undef HAVE_USLEEP
|
#undef HAVE_USLEEP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <util.h> header file. */
|
||||||
|
#undef HAVE_UTIL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `utime' function. */
|
/* Define to 1 if you have the `utime' function. */
|
||||||
#undef HAVE_UTIME
|
#undef HAVE_UTIME
|
||||||
|
|
||||||
|
15
configure
vendored
15
configure
vendored
@ -8377,7 +8377,7 @@ fi
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_header in netdb.h netinet/in.h netinet/tcp.h pwd.h regex.h shlobj.h
|
for ac_header in netdb.h netinet/in.h netinet/tcp.h openssl/ripemd.h pwd.h regex.h shlobj.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
@ -13451,6 +13451,8 @@ mkdir -p packages/bdd
|
|||||||
if test "$PKG_BDDLIB" != ""; then
|
if test "$PKG_BDDLIB" != ""; then
|
||||||
ac_config_files="$ac_config_files packages/bdd/Makefile"
|
ac_config_files="$ac_config_files packages/bdd/Makefile"
|
||||||
|
|
||||||
|
ac_config_files="$ac_config_files packages/bdd/cudd_config.h"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files packages/ProbLog/simplecudd/Makefile"
|
ac_config_files="$ac_config_files packages/ProbLog/simplecudd/Makefile"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files packages/ProbLog/simplecudd_lfi/Makefile"
|
ac_config_files="$ac_config_files packages/ProbLog/simplecudd_lfi/Makefile"
|
||||||
@ -14132,7 +14134,7 @@ else
|
|||||||
JAVA_TEST=Test.java
|
JAVA_TEST=Test.java
|
||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* #line 14135 "configure" */
|
/* #line 14137 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -14308,7 +14310,7 @@ EOF
|
|||||||
if uudecode$EXEEXT Test.uue; then
|
if uudecode$EXEEXT Test.uue; then
|
||||||
ac_cv_prog_uudecode_base64=yes
|
ac_cv_prog_uudecode_base64=yes
|
||||||
else
|
else
|
||||||
echo "configure: 14311: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
echo "configure: 14313: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
||||||
echo "configure: failed file was:" >&5
|
echo "configure: failed file was:" >&5
|
||||||
cat Test.uue >&5
|
cat Test.uue >&5
|
||||||
ac_cv_prog_uudecode_base64=no
|
ac_cv_prog_uudecode_base64=no
|
||||||
@ -14439,7 +14441,7 @@ else
|
|||||||
JAVA_TEST=Test.java
|
JAVA_TEST=Test.java
|
||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* #line 14442 "configure" */
|
/* #line 14444 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -14474,7 +14476,7 @@ JAVA_TEST=Test.java
|
|||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
TEST=Test
|
TEST=Test
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* [#]line 14477 "configure" */
|
/* [#]line 14479 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
public static void main (String args[]) {
|
public static void main (String args[]) {
|
||||||
System.exit (0);
|
System.exit (0);
|
||||||
@ -16039,6 +16041,7 @@ do
|
|||||||
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
||||||
"YapTermConfig.h") CONFIG_HEADERS="$CONFIG_HEADERS YapTermConfig.h" ;;
|
"YapTermConfig.h") CONFIG_HEADERS="$CONFIG_HEADERS YapTermConfig.h" ;;
|
||||||
"packages/bdd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/bdd/Makefile" ;;
|
"packages/bdd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/bdd/Makefile" ;;
|
||||||
|
"packages/bdd/cudd_config.h") CONFIG_FILES="$CONFIG_FILES packages/bdd/cudd_config.h" ;;
|
||||||
"packages/ProbLog/simplecudd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd/Makefile" ;;
|
"packages/ProbLog/simplecudd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd/Makefile" ;;
|
||||||
"packages/ProbLog/simplecudd_lfi/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd_lfi/Makefile" ;;
|
"packages/ProbLog/simplecudd_lfi/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd_lfi/Makefile" ;;
|
||||||
"packages/cplint/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/Makefile" ;;
|
"packages/cplint/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/Makefile" ;;
|
||||||
@ -17623,6 +17626,7 @@ mkdir -p packages/prism/src/c/up
|
|||||||
mkdir -p packages/prism/src/prolog
|
mkdir -p packages/prism/src/prolog
|
||||||
mkdir -p packages/ProbLog
|
mkdir -p packages/ProbLog
|
||||||
mkdir -p packages/ProbLog/simplecudd
|
mkdir -p packages/ProbLog/simplecudd
|
||||||
|
mkdir -p packages/ProbLog/simplecudd_lfi
|
||||||
mkdir -p packages/R
|
mkdir -p packages/R
|
||||||
mkdir -p packages/RDF
|
mkdir -p packages/RDF
|
||||||
mkdir -p packages/real
|
mkdir -p packages/real
|
||||||
@ -18478,6 +18482,7 @@ do
|
|||||||
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
||||||
"YapTermConfig.h") CONFIG_HEADERS="$CONFIG_HEADERS YapTermConfig.h" ;;
|
"YapTermConfig.h") CONFIG_HEADERS="$CONFIG_HEADERS YapTermConfig.h" ;;
|
||||||
"packages/bdd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/bdd/Makefile" ;;
|
"packages/bdd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/bdd/Makefile" ;;
|
||||||
|
"packages/bdd/cudd_config.h") CONFIG_FILES="$CONFIG_FILES packages/bdd/cudd_config.h" ;;
|
||||||
"packages/ProbLog/simplecudd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd/Makefile" ;;
|
"packages/ProbLog/simplecudd/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd/Makefile" ;;
|
||||||
"packages/ProbLog/simplecudd_lfi/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd_lfi/Makefile" ;;
|
"packages/ProbLog/simplecudd_lfi/Makefile") CONFIG_FILES="$CONFIG_FILES packages/ProbLog/simplecudd_lfi/Makefile" ;;
|
||||||
"packages/cplint/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/Makefile" ;;
|
"packages/cplint/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/Makefile" ;;
|
||||||
|
@ -1325,7 +1325,7 @@ AC_CHECK_HEADERS(errno.h execinfo.h fcntl.h fenv.h)
|
|||||||
AC_CHECK_HEADERS(float.h fpu_control.h ieeefp.h inttypes.h io.h)
|
AC_CHECK_HEADERS(float.h fpu_control.h ieeefp.h inttypes.h io.h)
|
||||||
AC_CHECK_HEADERS(libgen.h limits.h)
|
AC_CHECK_HEADERS(libgen.h limits.h)
|
||||||
AC_CHECK_HEADERS(malloc.h math.h memory.h)
|
AC_CHECK_HEADERS(malloc.h math.h memory.h)
|
||||||
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/tcp.h pwd.h regex.h shlobj.h)
|
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/tcp.h openssl/ripemd.h pwd.h regex.h shlobj.h)
|
||||||
AC_CHECK_HEADERS(siginfo.h signal.h stdarg.h stdbool.h)
|
AC_CHECK_HEADERS(siginfo.h signal.h stdarg.h stdbool.h)
|
||||||
AC_CHECK_HEADERS(stdint.h string.h strings.h stropts.h)
|
AC_CHECK_HEADERS(stdint.h string.h strings.h stropts.h)
|
||||||
AC_CHECK_HEADERS(sys/conf.h sys/dir.h sys/file.h)
|
AC_CHECK_HEADERS(sys/conf.h sys/dir.h sys/file.h)
|
||||||
@ -2202,8 +2202,6 @@ AC_CONFIG_FILES([packages/Dialect.defs])
|
|||||||
AC_CONFIG_FILES([packages/meld/Makefile])
|
AC_CONFIG_FILES([packages/meld/Makefile])
|
||||||
AC_CONFIG_FILES([packages/xml/Makefile])
|
AC_CONFIG_FILES([packages/xml/Makefile])
|
||||||
AC_CONFIG_FILES([packages/ProbLog/Makefile ])
|
AC_CONFIG_FILES([packages/ProbLog/Makefile ])
|
||||||
AC_CONFIG_FILES([packages/ProbLog/simplecudd/Makefile ])
|
|
||||||
AC_CONFIG_FILES([packages/ProbLog/simplecudd_lfi/Makefile ])
|
|
||||||
AC_CONFIG_FILES([swi/library/Makefile])
|
AC_CONFIG_FILES([swi/library/Makefile])
|
||||||
AC_CONFIG_FILES([swi/library/clp/Makefile])
|
AC_CONFIG_FILES([swi/library/clp/Makefile])
|
||||||
|
|
||||||
|
@ -526,9 +526,10 @@ handle_system_error(Error, off, G) :-
|
|||||||
throw(error(system_error(Message),G)).
|
throw(error(system_error(Message),G)).
|
||||||
|
|
||||||
handle_system_error(Error, _Id, _Ignore, _G) :- var(Error), !.
|
handle_system_error(Error, _Id, _Ignore, _G) :- var(Error), !.
|
||||||
handle_system_error(Error, SIG, off, G) :- integer(Error), !,
|
handle_system_error(Error, _SIG, off, G) :- integer(Error), !,
|
||||||
error_message(Error, Message).
|
error_message(Error, Message),
|
||||||
handle_system_error(signal, SIG, off, G) :- atom(Error), !,
|
throw(error(system_error(Message),G)).
|
||||||
|
handle_system_error(signal, SIG, off, G) :- !,
|
||||||
throw(error(system_error(child_signal(SIG)),G)).
|
throw(error(system_error(child_signal(SIG)),G)).
|
||||||
handle_system_error(stopped, SIG, off, G) :-
|
handle_system_error(stopped, SIG, off, G) :-
|
||||||
throw(error(system_error(child_stopped(SIG)),G)).
|
throw(error(system_error(child_stopped(SIG)),G)).
|
||||||
|
@ -543,7 +543,7 @@ get_file_name(term_t n, char **namep, char *tmp, int flags)
|
|||||||
{ fid_t fid;
|
{ fid_t fid;
|
||||||
|
|
||||||
if ( (fid = PL_open_foreign_frame()) )
|
if ( (fid = PL_open_foreign_frame()) )
|
||||||
{ predicate_t pred = PL_predicate("absolute_file_name", 3, "system");
|
{ predicate_t pred = PL_predicate("absolute_file_name", 3, "prolog");
|
||||||
term_t av = PL_new_term_refs(3);
|
term_t av = PL_new_term_refs(3);
|
||||||
term_t options = PL_copy_term_ref(av+2);
|
term_t options = PL_copy_term_ref(av+2);
|
||||||
int rc = TRUE;
|
int rc = TRUE;
|
||||||
@ -639,7 +639,6 @@ PL_get_file_name(term_t n, char **namep, int flags)
|
|||||||
}
|
}
|
||||||
*namep = buffer_string(name, BUF_RING);
|
*namep = buffer_string(name, BUF_RING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ initPrologFlags(void)
|
|||||||
setPrologFlag("toplevel_var_size", FT_INTEGER, 1000);
|
setPrologFlag("toplevel_var_size", FT_INTEGER, 1000);
|
||||||
setPrologFlag("toplevel_print_anon", FT_BOOL, TRUE, 0);
|
setPrologFlag("toplevel_print_anon", FT_BOOL, TRUE, 0);
|
||||||
setPrologFlag("toplevel_prompt", FT_ATOM, "~m~d~l~! ?- ");
|
setPrologFlag("toplevel_prompt", FT_ATOM, "~m~d~l~! ?- ");
|
||||||
setPrologFlag("file_name_variables", FT_BOOL, FALSE, PLFLAG_FILEVARS);
|
setPrologFlag("file_name_variables", FT_BOOL, TRUE, PLFLAG_FILEVARS);
|
||||||
setPrologFlag("fileerrors", FT_BOOL, TRUE, PLFLAG_FILEERRORS);
|
setPrologFlag("fileerrors", FT_BOOL, TRUE, PLFLAG_FILEERRORS);
|
||||||
#ifdef __unix__
|
#ifdef __unix__
|
||||||
setPrologFlag("unix", FT_BOOL|FF_READONLY, TRUE, 0);
|
setPrologFlag("unix", FT_BOOL|FF_READONLY, TRUE, 0);
|
||||||
|
@ -412,24 +412,17 @@ logger_start_timer(Name) :-
|
|||||||
(
|
(
|
||||||
statistics(walltime,[StartTime,_]),
|
statistics(walltime,[StartTime,_]),
|
||||||
bb_put(Key,StartTime)
|
bb_put(Key,StartTime)
|
||||||
);(
|
)
|
||||||
|
;
|
||||||
|
(
|
||||||
bb_get(Key,_)
|
bb_get(Key,_)
|
||||||
->
|
->
|
||||||
(
|
format(user_error, 'logger_start_timer, timer ~a is already started~n', [Name])
|
||||||
write('logger_start_timer, timer '),
|
;
|
||||||
write(Name),
|
format(user_error, 'logger_start_timer, timer ~a is not defined~n', [Name])
|
||||||
write(' is already started'),
|
|
||||||
nl,
|
|
||||||
fail
|
|
||||||
);(
|
|
||||||
write('logger_start_timer, timer '),
|
|
||||||
write(Name),
|
|
||||||
write(' is not defined'),
|
|
||||||
nl,
|
|
||||||
fail
|
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
),!.
|
!.
|
||||||
|
|
||||||
|
|
||||||
logger_stop_timer(Name) :-
|
logger_stop_timer(Name) :-
|
||||||
|
@ -219,7 +219,7 @@
|
|||||||
|
|
||||||
|
|
||||||
% load library modules
|
% load library modules
|
||||||
:- use_module(library(system), [exec/3, file_exists/1,wait/2]).
|
:- use_module(library(system), [exec/3, file_exists/1,wait/2, md5/3]).
|
||||||
:- use_module(library(lists), [memberchk/2]).
|
:- use_module(library(lists), [memberchk/2]).
|
||||||
:- yap_flag(arithmetic_exceptions, false).
|
:- yap_flag(arithmetic_exceptions, false).
|
||||||
|
|
||||||
@ -292,57 +292,27 @@ concat_path_with_filename(Path, File_Name, Result):-
|
|||||||
%========================================================================
|
%========================================================================
|
||||||
|
|
||||||
calc_md5(Filename,MD5):-
|
calc_md5(Filename,MD5):-
|
||||||
catch(calc_md5_intern(Filename,'md5sum',MD5),_,fail),
|
catch(calc_md5_intern(Filename,MD5),_,fail),
|
||||||
!.
|
|
||||||
calc_md5(Filename,MD5):-
|
|
||||||
catch(calc_md5_intern(Filename,'md5 -r',MD5),_,fail),
|
|
||||||
% used in Mac OS
|
|
||||||
% the -r makes the output conform with md5sum
|
|
||||||
!.
|
!.
|
||||||
calc_md5(Filename,MD5):-
|
calc_md5(Filename,MD5):-
|
||||||
throw(md5error(calc_md5(Filename,MD5))).
|
throw(md5error(calc_md5(Filename,MD5))).
|
||||||
|
|
||||||
calc_md5_intern(Filename,Command,MD5) :-
|
calc_md5_intern(Filename,MD5) :-
|
||||||
( file_exists(Filename) -> true ; throw(md5_file(Filename)) ),
|
( file_exists(Filename) -> true ; throw(md5_file(Filename)) ),
|
||||||
|
file_to_codes(Filename, S, []),
|
||||||
|
md5( S, MD5, [] ),
|
||||||
|
format('~s => ~s~n', [S,MD5]).
|
||||||
|
|
||||||
atomic_concat([Command,' "',Filename,'"'],Call),
|
file_to_codes( F, Codes, LF ) :-
|
||||||
% execute the md5 command
|
open(F, read, S),
|
||||||
exec(Call,[null,pipe(S),null],PID),
|
get_codes( S, Codes, LF).
|
||||||
bb_put(calc_md5_temp,End-End), % use difference list
|
|
||||||
bb_put(calc_md5_temp2,0),
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
get_codes(S, [C|L], LF) :-
|
||||||
( % read 32 Bytes from stdout of process
|
get_code(S, C),
|
||||||
repeat,
|
C \= -1,
|
||||||
get_byte(S,C),
|
|
||||||
|
|
||||||
(
|
|
||||||
C== -1
|
|
||||||
->
|
|
||||||
(
|
|
||||||
close(S),
|
|
||||||
wait(PID,_Status),
|
|
||||||
throw(md5error('premature end of output stream, please check os.yap calc_md5/2'))
|
|
||||||
);
|
|
||||||
true
|
|
||||||
),
|
|
||||||
|
|
||||||
bb_get(calc_md5_temp,List-[C|NewEnd]),
|
|
||||||
bb_put(calc_md5_temp,List-NewEnd),
|
|
||||||
bb_get(calc_md5_temp2,OldLength),
|
|
||||||
NewLength is OldLength+1,
|
|
||||||
bb_put(calc_md5_temp2,NewLength),
|
|
||||||
NewLength=32
|
|
||||||
),
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
!,
|
!,
|
||||||
|
get_codes(S, L, LF).
|
||||||
close(S),
|
get_codes(_, LF, LF).
|
||||||
wait(PID,_Status),
|
|
||||||
bb_delete(calc_md5_temp, FinalList-[]),
|
|
||||||
bb_delete(calc_md5_temp2,_),
|
|
||||||
atom_codes(MD5,FinalList).
|
|
||||||
|
|
||||||
|
|
||||||
%========================================================================
|
%========================================================================
|
||||||
%=
|
%=
|
||||||
|
@ -470,6 +470,7 @@ init_learning :-
|
|||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% build BDD script for every example
|
% build BDD script for every example
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
once(init_queries),
|
once(init_queries),
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@ -659,7 +660,7 @@ init_queries :-
|
|||||||
%=
|
%=
|
||||||
%========================================================================
|
%========================================================================
|
||||||
|
|
||||||
init_one_query(QueryID,_Query_Type) :-
|
init_one_query(QueryID,_Query_Type) :- trace,
|
||||||
create_known_values_file_name(QueryID,File_Name),
|
create_known_values_file_name(QueryID,File_Name),
|
||||||
file_exists(File_Name),
|
file_exists(File_Name),
|
||||||
!,
|
!,
|
||||||
@ -888,19 +889,16 @@ update_query(QueryID,ClusterID ,Method,Command,PID,Output_File_Name) :-
|
|||||||
create_bdd_output_file_name(QueryID,ClusterID,Iteration,Output_File_Name),
|
create_bdd_output_file_name(QueryID,ClusterID,Iteration,Output_File_Name),
|
||||||
create_bdd_file_name(QueryID,ClusterID,BDD_File_Name),
|
create_bdd_file_name(QueryID,ClusterID,BDD_File_Name),
|
||||||
|
|
||||||
problog_dir(PD),
|
convert_filename_to_problog_path('problogbdd_lfi',Absolute_Name),
|
||||||
concat_path_with_filename(PD,'problogbdd_lfi',Absolute_Name),
|
|
||||||
|
|
||||||
atomic_concat([Absolute_Name,
|
atomic_concat([Absolute_Name,
|
||||||
' -i "', Input_File_Name, '"',
|
' -i "', Input_File_Name, '"',
|
||||||
' -l "', BDD_File_Name, '"',
|
' -l "', BDD_File_Name, '"',
|
||||||
' -m ', Method,
|
' -m ', Method,
|
||||||
' -id ', QueryID,
|
' -id ', QueryID],Command),
|
||||||
' > "',
|
open( Output_File_Name, write, Stream ),
|
||||||
Output_File_Name,
|
exec(Command,[std, Stream ,std],PID),
|
||||||
'"'],Command),
|
close( Stream ).
|
||||||
|
|
||||||
exec(Command,[std,std,std],PID).
|
|
||||||
|
|
||||||
update_query_wait(QueryID,_ClusterID,Count,Symbol,Command,PID,OutputFilename,BDD_Probability) :-
|
update_query_wait(QueryID,_ClusterID,Count,Symbol,Command,PID,OutputFilename,BDD_Probability) :-
|
||||||
wait(PID,Error),
|
wait(PID,Error),
|
||||||
|
@ -113,7 +113,7 @@ mkdir -p packages/bdd
|
|||||||
|
|
||||||
if test "$PKG_BDDLIB" != ""; then
|
if test "$PKG_BDDLIB" != ""; then
|
||||||
AC_CONFIG_FILES([packages/bdd/Makefile])
|
AC_CONFIG_FILES([packages/bdd/Makefile])
|
||||||
AC_CONFIG_FILES([packages/bdd/Makefile/config.h])
|
AC_CONFIG_FILES([packages/bdd/cudd_config.h])
|
||||||
AC_CONFIG_FILES([packages/ProbLog/simplecudd/Makefile])
|
AC_CONFIG_FILES([packages/ProbLog/simplecudd/Makefile])
|
||||||
AC_CONFIG_FILES([packages/ProbLog/simplecudd_lfi/Makefile])
|
AC_CONFIG_FILES([packages/ProbLog/simplecudd_lfi/Makefile])
|
||||||
fi
|
fi
|
||||||
|
@ -90,7 +90,10 @@ once/1.
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
once(G) :- '$execute'(G), !.
|
once(G) :-
|
||||||
|
strip_module(G, M, C),
|
||||||
|
'$meta_call'(C, M),
|
||||||
|
!.
|
||||||
|
|
||||||
/** @pred forall(: _Cond_,: _Action_)
|
/** @pred forall(: _Cond_,: _Action_)
|
||||||
|
|
||||||
|
@ -889,7 +889,8 @@ be lost.
|
|||||||
'$spycall'(G, M, _, _) :-
|
'$spycall'(G, M, _, _) :-
|
||||||
nb_getval('$debug_jump',true),
|
nb_getval('$debug_jump',true),
|
||||||
!,
|
!,
|
||||||
'$execute_nonstop'(G,M).
|
( '$is_metapredicate'(G, M) -> '$meta_expansion'(G,M,M,M,G1,[]) ; G = G1 ),
|
||||||
|
'$execute_nonstop'(G1,M).
|
||||||
'$spycall'(G, M, _, _) :-
|
'$spycall'(G, M, _, _) :-
|
||||||
(
|
(
|
||||||
'$system_predicate'(G,M)
|
'$system_predicate'(G,M)
|
||||||
|
Reference in New Issue
Block a user