fixes to c-interface
fixes for compilation with native mingw32 documentation fixes. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@591 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
cf6391d96b
commit
f0ce954741
164
configure
vendored
164
configure
vendored
@ -2977,8 +2977,72 @@ fi
|
||||
DLL_LIBS="-L /usr/lib/mingw -lmsvcrt -lmingw32 -lkernel32"
|
||||
else
|
||||
DLL_LIBS=""
|
||||
LIBS="-lgcc -lcygwin -lkernel32 -lgcc"
|
||||
LIBS="-lcygwin -lkernel32"
|
||||
fi
|
||||
elif test "$target_os" = "mingw32"
|
||||
then
|
||||
INSTALL_COMMAND=install_win32
|
||||
|
||||
echo "$as_me:$LINENO: checking for main in -lwsock32" >&5
|
||||
echo $ECHO_N "checking for main in -lwsock32... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_wsock32_main+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lwsock32 $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
|
||||
#ifdef F77_DUMMY_MAIN
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int F77_DUMMY_MAIN() { return 1; }
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
main ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_wsock32_main=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_lib_wsock32_main=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_wsock32_main" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_wsock32_main" >&6
|
||||
if test $ac_cv_lib_wsock32_main = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBWSOCK32 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lwsock32 $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
prefix="c:/Program\\ Files/Yap"
|
||||
DLL_LIBS="-L /usr/mingw/lib -lmsvcrt -lmingw32 -lkernel32"
|
||||
else
|
||||
DLL_LIBS=""
|
||||
INSTALL_COMMAND="install_unix"
|
||||
@ -4620,6 +4684,17 @@ fi
|
||||
fi
|
||||
;;
|
||||
*cyg*)
|
||||
# gcc on cygwin seems to have trouble with longjmp
|
||||
# and -fomit-frame-point -DBP_FREE
|
||||
if test "$cygwin" = "no"
|
||||
then
|
||||
YAPLIB="libWYap.a"
|
||||
SHLIB_SUFFIX=".dll"
|
||||
NEWSHOBJ="dll"
|
||||
fi
|
||||
C_PARSER_FLAGS="$C_INTERF_FLAGS"
|
||||
;;
|
||||
*mingw*)
|
||||
# gcc on cygwin seems to have trouble with longjmp
|
||||
# and -fomit-frame-point -DBP_FREE
|
||||
YAPLIB="libWYap.a"
|
||||
@ -10242,8 +10317,7 @@ done
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in fesettrapenable fetestexcept finite getcwd getenv
|
||||
for ac_func in fesettrapenable finite getcwd getenv
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
@ -10881,8 +10955,7 @@ done
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in signal sigprocmask snprintf socket stat
|
||||
for ac_func in signal sigprocmask socket stat
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
@ -11276,6 +11349,87 @@ done
|
||||
|
||||
fi
|
||||
|
||||
if "$target_os" != "mingw32"
|
||||
then
|
||||
|
||||
|
||||
for ac_func in fetestexcept snprintf
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_var+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below. */
|
||||
#include <assert.h>
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char $ac_func ();
|
||||
char (*f) ();
|
||||
|
||||
#ifdef F77_DUMMY_MAIN
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int F77_DUMMY_MAIN() { return 1; }
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
|
||||
choke me
|
||||
#else
|
||||
f = $ac_func;
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
eval "$as_ac_var=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
eval "$as_ac_var=no"
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
|
||||
if test `eval echo '${'$as_ac_var'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for mpz_xor" >&5
|
||||
echo $ECHO_N "checking for mpz_xor... $ECHO_C" >&6
|
||||
if test "${yap_mpz_xor+set}" = set; then
|
||||
|
28
configure.in
28
configure.in
@ -272,8 +272,14 @@ then
|
||||
DLL_LIBS="-L /usr/lib/mingw -lmsvcrt -lmingw32 -lkernel32"
|
||||
else
|
||||
DLL_LIBS=""
|
||||
LIBS="-lgcc -lcygwin -lkernel32 -lgcc"
|
||||
LIBS="-lcygwin -lkernel32"
|
||||
fi
|
||||
elif test "$target_os" = "mingw32"
|
||||
then
|
||||
INSTALL_COMMAND=install_win32
|
||||
AC_CHECK_LIB(wsock32,main)
|
||||
prefix="c:/Program\\ Files/Yap"
|
||||
DLL_LIBS="-L /usr/mingw/lib -lmsvcrt -lmingw32 -lkernel32"
|
||||
else
|
||||
DLL_LIBS=""
|
||||
INSTALL_COMMAND="install_unix"
|
||||
@ -522,6 +528,17 @@ dnl Linux has both elf and a.out, in this case we found elf
|
||||
fi
|
||||
;;
|
||||
*cyg*)
|
||||
# gcc on cygwin seems to have trouble with longjmp
|
||||
# and -fomit-frame-point -DBP_FREE
|
||||
if test "$cygwin" = "no"
|
||||
then
|
||||
YAPLIB="libWYap.a"
|
||||
SHLIB_SUFFIX=".dll"
|
||||
NEWSHOBJ="dll"
|
||||
fi
|
||||
C_PARSER_FLAGS="$C_INTERF_FLAGS"
|
||||
;;
|
||||
*mingw*)
|
||||
# gcc on cygwin seems to have trouble with longjmp
|
||||
# and -fomit-frame-point -DBP_FREE
|
||||
YAPLIB="libWYap.a"
|
||||
@ -813,7 +830,7 @@ fi
|
||||
dnl Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS(acosh asinh atanh chdir dlopen dup2)
|
||||
AC_CHECK_FUNCS(fesettrapenable fetestexcept finite getcwd getenv)
|
||||
AC_CHECK_FUNCS(fesettrapenable finite getcwd getenv)
|
||||
AC_CHECK_FUNCS(gethostbyname gethostid gethostname)
|
||||
AC_CHECK_FUNCS(gethrtime getpwnam getrusage gettimeofday getwd)
|
||||
AC_CHECK_FUNCS(isatty isnan kill labs link localtime lstat)
|
||||
@ -821,7 +838,7 @@ AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp opendir)
|
||||
AC_CHECK_FUNCS(putenv rand random readlink regexec)
|
||||
AC_CHECK_FUNCS(rename rl_set_prompt sbrk select)
|
||||
AC_CHECK_FUNCS(setbuf setlinebuf sigaction siggetmask siginterrupt)
|
||||
AC_CHECK_FUNCS(signal sigprocmask snprintf socket stat)
|
||||
AC_CHECK_FUNCS(signal sigprocmask socket stat)
|
||||
AC_CHECK_FUNCS(strchr strerror strncat strncpy strtod)
|
||||
AC_CHECK_FUNCS(time times tmpnam usleep vsnprintf)
|
||||
|
||||
@ -832,6 +849,11 @@ then
|
||||
AC_CHECK_FUNCS(alarm mmap popen shmat sleep system ttyname waitpid)
|
||||
fi
|
||||
|
||||
if "$target_os" != "mingw32"
|
||||
then
|
||||
AC_CHECK_FUNCS(fetestexcept snprintf)
|
||||
fi
|
||||
|
||||
dnl check for mpz_xor
|
||||
AC_MSG_CHECKING(for mpz_xor)
|
||||
AC_CACHE_VAL(yap_mpz_xor,[
|
||||
|
12
docs/yap.tex
12
docs/yap.tex
@ -5745,7 +5745,7 @@ These counters can be used to find out how many calls a certain
|
||||
goal takes to execute. They can also be used as timers.
|
||||
|
||||
The code for the call counters piggybacks on the profiling
|
||||
code. Therefore, activating the call counters also activates the call
|
||||
code. Therefore, activating the call counters also activates the profiling
|
||||
counters.
|
||||
|
||||
These are the predicates that access and manipulate the call counters:
|
||||
@ -5784,12 +5784,6 @@ reaches 0.
|
||||
|
||||
Next, we show a simple example of how to use call counters:
|
||||
@example
|
||||
G(X,Y,Z,I,J) :-
|
||||
array_element(X,I,E1),
|
||||
array_element(Y,J,E2),
|
||||
array_element(Z,I,E3),
|
||||
E1 is E2+E3.
|
||||
@end example
|
||||
?- yap_flag(call_counting,on), [-user]. l :- l. end_of_file. yap_flag(call_counting,off).
|
||||
|
||||
yes
|
||||
@ -5800,13 +5794,13 @@ yes
|
||||
limit_exceeded.
|
||||
|
||||
yes
|
||||
@end table
|
||||
@end example
|
||||
Notice that we first compile the looping predicate @code{l/0} with
|
||||
@code{call_counting} @code{on}. Next, we @code{catch/3} to handle an
|
||||
exception when @code{l/0} performs more than 10000 reductions.
|
||||
|
||||
|
||||
@node Arrays, Preds, Call Countingf , Top
|
||||
@node Arrays, Preds, Call Counting , Top
|
||||
@section Arrays
|
||||
|
||||
The YAP system includes experimental support for arrays. The
|
||||
|
@ -30,8 +30,8 @@
|
||||
'$process_error'(Error),
|
||||
fail.
|
||||
'$LoopError'(_) :-
|
||||
flush_output(user_output),
|
||||
flush_output(user_error),
|
||||
current_stream(_, write, S),
|
||||
flush_all_streams,
|
||||
fail.
|
||||
|
||||
'$process_error'(abort) :- !,
|
||||
|
Reference in New Issue
Block a user