Merge branch 'master' of ssh://git.code.sf.net/p/yap/yap-6.3

This commit is contained in:
Vítor Santos Costa 2013-10-30 07:23:37 +00:00
commit 007a2aa87e
23 changed files with 322 additions and 519 deletions

View File

@ -29,8 +29,8 @@ static char SccsId[] = "%W% %G%.2";
#include "Foreign.h"
#if _WIN32 || defined(__CYGWIN__)
#ifndef YAP_SHLIB_SUFFIX
#define YAP_SHLIB_SUFFIX ".dll"
#ifndef SO_EXT
#define SO_EXT ".dll"
#endif
#endif
@ -210,12 +210,12 @@ p_call_shared_object_function( USES_REGS1 ) {
static Int
p_obj_suffix( USES_REGS1 ) {
return Yap_unify(Yap_StringToList(YAP_SHLIB_SUFFIX),ARG1);
return Yap_unify(Yap_StringToList(SO_EXT),ARG1);
}
static Int
p_open_shared_objects( USES_REGS1 ) {
#ifdef YAP_SHLIB_SUFFIX
#ifdef SO_EXT
return TRUE;
#else
return FALSE;

View File

@ -319,7 +319,8 @@ word lookupAtom(const char *s, size_t len)
/* dirty trick to ensure s is null terminated */
char *st = (char *)s;
st[len] = '\0';
if (st[len])
st[len] = '\0';
if (len >= strlen(s)) {
at = YAP_LookupAtom(st);
} else {
@ -1300,12 +1301,6 @@ sysError(const char *fm, ...)
#if THREADS
#define COUNT_MUTEX_INITIALIZER(name) \
{ PTHREAD_MUTEX_INITIALIZER, \
name, \
0L \
}
static int
recursive_attr(pthread_mutexattr_t **ap)
{ static int done;
@ -1360,27 +1355,4 @@ recursiveMutexInit(recursiveMutex *m)
}
counting_mutex _PL_mutexes[] =
{ COUNT_MUTEX_INITIALIZER("L_MISC"),
COUNT_MUTEX_INITIALIZER("L_ALLOC"),
COUNT_MUTEX_INITIALIZER("L_ATOM"),
COUNT_MUTEX_INITIALIZER("L_FLAG"),
COUNT_MUTEX_INITIALIZER("L_FUNCTOR"),
COUNT_MUTEX_INITIALIZER("L_RECORD"),
COUNT_MUTEX_INITIALIZER("L_THREAD"),
COUNT_MUTEX_INITIALIZER("L_PREDICATE"),
COUNT_MUTEX_INITIALIZER("L_MODULE"),
COUNT_MUTEX_INITIALIZER("L_TABLE"),
COUNT_MUTEX_INITIALIZER("L_BREAK"),
COUNT_MUTEX_INITIALIZER("L_FILE"),
COUNT_MUTEX_INITIALIZER("L_PLFLAG"),
COUNT_MUTEX_INITIALIZER("L_OP"),
COUNT_MUTEX_INITIALIZER("L_INIT"),
COUNT_MUTEX_INITIALIZER("L_TERM"),
COUNT_MUTEX_INITIALIZER("L_GC"),
COUNT_MUTEX_INITIALIZER("L_AGC"),
COUNT_MUTEX_INITIALIZER("L_FOREIGN"),
COUNT_MUTEX_INITIALIZER("L_OS")
};
#endif

View File

@ -131,10 +131,10 @@ add_end_dot(char arg[])
static int
dump_runtime_variables(void)
{
fprintf(stdout,"CC=\"%s\"\n",YAP_CC);
fprintf(stdout,"CC=\"%s\"\n",C_CC);
fprintf(stdout,"YAP_ROOTDIR=\"%s\"\n",YAP_ROOTDIR);
fprintf(stdout,"YAP_LIBS=\"%s\"\n",YAP_LIBS);
fprintf(stdout,"YAP_SHLIB_SUFFIX=\"%s\"\n",YAP_SHLIB_SUFFIX);
fprintf(stdout,"YAP_LIBS=\"%s\"\n",C_LIBS);
fprintf(stdout,"YAP_SHLIB_SUFFIX=\"%s\"\n",SO_EXT);
fprintf(stdout,"YAP_VERSION=%d\n",YAP_VERSION);
exit(0);
return 1;

View File

@ -188,6 +188,7 @@ Yap_Eval(Term t)
return Yap_InnerEval(t);
}
#ifdef P
inline static Term
Yap_FoundArithError(Term t, Term inp)
{
@ -199,6 +200,7 @@ Yap_FoundArithError(Term t, Term inp)
}
return t;
}
#endif
#define RINT(v) return(MkIntegerTerm(v))

View File

@ -74,6 +74,7 @@ AWK=@AWK@
CPP=@CPP@
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1
LIBS=@LIBS@
DLL_LIBS=@LIBS@ @EXTRA_LIBS_FOR_DLLS@
LDFLAGS=@LDFLAGS@
LN_S=@LN_S@
M4=@M4@
@ -276,8 +277,8 @@ C_SOURCES= \
$(srcdir)/OPTYap/or.thread_engine.c \
$(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \
$(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \
$(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
$(srcdir)/library/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c \
# $(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
# $(srcdir)/library/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c \
$(srcdir)/C/cut_c.c \
$(srcdir)/library/dialect/swi/fli/swi.c \
$(srcdir)/library/dialect/swi/fli/blobs.c \
@ -373,7 +374,7 @@ ENGINE_OBJECTS = \
udi.o\
unify.o userpreds.o utilpreds.o \
yap-args.o write.o \
blobs.o swi.o ypstdio.o $(IOLIB_OBJECTS) @MPI_OBJS@
blobs.o swi.o ypstdio.o $(IOLIB_OBJECTS)
LIBTAI_OBJECTS = \
tai_add.o tai_now.o tai_pack.o \
@ -431,12 +432,13 @@ parms.h: Makefile
@echo $(VERSION) | $(AWK) -F. '{ printf("#define YAP_VERSION %d\n", $$1 * 10000 + $$2 * 100 + $$3); }' >> $@%
@echo "#define MYDDAS_VERSION \"$(MYDDAS_VERSION)\"" >> $@%
@echo "#define YAP_ARCH \"$(ARCH)\"" >> $@%
@echo "#define YAP_LIBS \"$(LIBS)\"" >> $@%
@echo "#define C_LIBS \"$(LIBS)\"" >> $@%
@echo "#define C_LIBPLSO \"$(DLL_LIBS)\"" >> $@%
@echo "#define YAP_YAPLIB \"$(YAPLIB)\"" >> $@%
@echo "#define YAP_CC \"$(CC)\"" >> $@%
@echo "#define YAP_CFLAGS \"$(CFLAGS)\"" >> $@%
@echo "#define YAP_LDFLAGS \"$(LDFLAGS)\"" >> $@%
@echo "#define YAP_SHLIB_SUFFIX \".\" \"$(SO)\"" >> $@%
@echo "#define C_CC \"$(CC)\"" >> $@%
@echo "#define C_CFLAGS \"$(CFLAGS)\"" >> $@%
@echo "#define C_LDFLAGS \"$(LDFLAGS)\"" >> $@%
@echo "#define SO_EXT \".\" \"$(SO)\"" >> $@%
@echo "#define YAP_TIMESTAMP \"`date +%s`\"" >> $@%
@echo "#define YAP_SVERSION \"YAP $(VERSION) ($(ARCH)): `date`\"" >> $@%
@if cmp -s $@% $@; then rm $@%; else mv $@% $@; fi
@ -696,7 +698,7 @@ mycb: $(srcdir)/mycb.c
all: startup.yss
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE))
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE))
@INSTALL_MPI@ (cd library/lammpi; $(MAKE))
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE))
@INSTALL_DLLS@ (cd library/matrix; $(MAKE))
@INSTALL_DLLS@ (cd library/random; $(MAKE))
@ -737,7 +739,7 @@ startup.yss: yap@EXEC_SUFFIX@ $(PL_SOURCES)
echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). qsave_program('startup.yss')." | @PRE_INSTALL_ENV@ ./yap -b $(srcdir)/pl/boot.yap
yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@
$(MPI_CC) $(EXECUTABLE_CFLAGS) $(LDFLAGS) -o yap yap.o @YAPLIB@ $(LIBS) @MPI_LIBS@
$(MPI_CC) $(EXECUTABLE_CFLAGS) $(LDFLAGS) -o yap yap.o @YAPLIB@ $(LIBS)
yap-win: yap-win@EXEC_SUFFIX@
@ -745,7 +747,7 @@ yapwin: yap-win@EXEC_SUFFIX@
yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@
(cd swi/console; $(MAKE))
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) @MPI_LIBS@
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) @MPILDF@
libYap.a: $(LIB_OBJECTS)
-rm -f libYap.a
@ -772,7 +774,7 @@ install_unix: startup.yss libYap.a
$(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR)
$(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)
for f in $(PL_SOURCES); do $(INSTALL) $$f $(DESTDIR)$(SHAREDIR)/Yap/pl; done
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) install)
@INSTALL_MPI@ (cd library/lammpi; $(MAKE) install)
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) install)
@INSTALL_DLLS@ (cd library/random; $(MAKE) install)
@INSTALL_DLLS@ (cd library/regex; $(MAKE) install)
@ -915,7 +917,7 @@ depend: $(HEADERS) $(C_SOURCES)
clean: clean_docs
rm -f *.o *~ *.BAK *.a
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) clean)
@INSTALL_MPI@ (cd library/lammpi; $(MAKE) clean)
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/random; $(MAKE) clean)

View File

@ -198,6 +198,7 @@
#undef HAVE_GETHOSTNAME
#undef HAVE_GETHRTIME
#undef HAVE_GETPAGESIZE
#undef HAVE_GETPID
#undef HAVE_GETPWNAM
#undef HAVE_GETRUSAGE
#undef HAVE_GETTIMEOFDAY

356
configure vendored
View File

@ -671,15 +671,14 @@ EXTRA_INCLUDES_FOR_WIN32
ENABLE_WINCONSOLE
STATIC_MODE
MAX_WORKERS
LAMOBJS
JAVALIBS
JPLLIBS
JPLCFLAGS
INSTALLCLP
INSTALL_COMMAND
MPI_LIBS
MPI_OBJS
LAM_MPI_CC
MPICF
MPILDF
INSTALL_MPI
YAPMPILIB
IN_UNIX
LIBJPL
@ -735,13 +734,13 @@ CPLINT_SHLIB_LD
CPLINT_LDFLAGS
CPLINT_CFLAGS
CPLINT_LIBS
MPI_CC
ENABLE_PRISM
ENABLE_GECODE
NVCC
PYTHON
REXE
INSTALL_INFO
MPI_CC
AR
RANLIB
INSTALL_DATA
@ -867,7 +866,6 @@ with_readline
with_matlab
with_mpi
with_mpe
with_lam
with_heap_space
with_stack_space
with_trail_space
@ -1548,7 +1546,6 @@ Optional Packages:
--with-matlab=DIR use MATLAB package in DIR
--with-mpi=DIR use LAM/MPI library in DIR
--with-mpe=DIR use MPE library in DIR
--with-lam=DIR use LAM MPI library in DIR
--with-heap-space=space default heap size in Kbytes
--with-stack-space=space default stack size in Kbytes
--with-trail-space=space default trail size in Kbytes
@ -4884,16 +4881,16 @@ fi
# Check whether --with-mpi was given.
if test "${with_mpi+set}" = set; then :
withval=$with_mpi; if test "$withval" = yes; then
yap_cv_lam=yes
yap_cv_mpi=yes
elif test "$withval" = no; then
yap_cv_lam=no
yap_cv_mpi=no
else
yap_cv_lam=$with_mpi
yap_cv_mpi=$with_mpi
LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
fi
else
yap_cv_lam=no
yap_cv_mpi=no
fi
@ -4916,23 +4913,6 @@ fi
# Check whether --with-lam was given.
if test "${with_lam+set}" = set; then :
withval=$with_lam; if test "$withval" = yes; then
yap_cv_lam=yes
elif test "$withval" = no; then
yap_cv_lam=no
else
yap_cv_lam=$with_lam
LDFLAGS="$LDFLAGS -L${yap_cv_lam}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_lam}/include"
fi
else
yap_cv_lam=no
fi
# Check whether --with-heap-space was given.
if test "${with_heap_space+set}" = set; then :
withval=$with_heap_space; if test "$withval" = yes; then
@ -5201,7 +5181,9 @@ then
C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
case "`$CC --version < /dev/null`" in
*3.4*) CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;;
*3.4*)
CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS"
;;
esac
case "$target_cpu" in
i*86*)
@ -5567,98 +5549,6 @@ else
AR="$ac_cv_prog_AR"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}mpicc", so it can be a program name with args.
set dummy ${ac_tool_prefix}mpicc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_MPI_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$MPI_CC"; then
ac_cv_prog_MPI_CC="$MPI_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_MPI_CC="${ac_tool_prefix}mpicc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
MPI_CC=$ac_cv_prog_MPI_CC
if test -n "$MPI_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPI_CC" >&5
$as_echo "$MPI_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_MPI_CC"; then
ac_ct_MPI_CC=$MPI_CC
# Extract the first word of "mpicc", so it can be a program name with args.
set dummy mpicc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_MPI_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_MPI_CC"; then
ac_cv_prog_ac_ct_MPI_CC="$ac_ct_MPI_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_MPI_CC="mpicc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_MPI_CC=$ac_cv_prog_ac_ct_MPI_CC
if test -n "$ac_ct_MPI_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MPI_CC" >&5
$as_echo "$ac_ct_MPI_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_MPI_CC" = x; then
MPI_CC="${CC}"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
MPI_CC=$ac_ct_MPI_CC
fi
else
MPI_CC="$ac_cv_prog_MPI_CC"
fi
# Extract the first word of "install-info", so it can be a program name with args.
set dummy install-info; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@ -8519,6 +8409,12 @@ fi
;;
esac
if test "$CC" = icc
then
MPI_CC="$CC"
yap_cv_mpi=no
fi
if test "$dynamic_loading" = "yes"
then
YAPLIB_CFLAGS="$SHLIB_CFLAGS"
@ -8634,138 +8530,100 @@ if test "$tabling" = "yes"
YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1"
fi
LAMOBJS=""
MPI_OBJS=
LAM_MPI_CC=${MPI_CC}
if test "$yap_cv_lam" != "no" ; then
if test "$yap_cv_lam" != "yes" ; then
LAM_MPI_CC="$yap_cv_lam"/bin/mpicc
MPI_CC="$yap_cv_lam"/bin/mpicc
CPPFLAGS="$CPPFLAGS -I ${yap_cv_lam}/include"
LDFLAGS="$LDFLAGS -L${yap_cv_lam}/lib"
fi
OLD_CC=${CC}
CC=${LAM_MPI_CC}
ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default"
if test "x$ac_cv_header_mpi_h" = xyes; then :
LAMOBJS=yap_mpi."$SO"
$as_echo "#define HAVE_LIBMPI 1" >>confdefs.h
if test "$yap_cv_mpi" != "no"; then
if test "$yap_cv_mpi" != "yes"; then
# Extract the first word of "mpicc", so it can be a program name with args.
set dummy mpicc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MPI_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
LAMOBJS=""
$as_echo "#define HAVE_LIBMPI 0" >>confdefs.h
case $MPI_CC in
[\\/]* | ?:[\\/]*)
ac_cv_path_MPI_CC="$MPI_CC" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MPI_CC="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_MPI_CC" && ac_cv_path_MPI_CC="true"
;;
esac
fi
MPI_CC=$ac_cv_path_MPI_CC
if test -n "$MPI_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPI_CC" >&5
$as_echo "$MPI_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
CC=${OLD_CC}
elif test "$yap_cv_mpi" != "no"; then
else
# Extract the first word of "mpicc", so it can be a program name with args.
set dummy mpicc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MPI_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MPI_CC in
[\\/]* | ?:[\\/]*)
ac_cv_path_MPI_CC="$MPI_CC" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="$yap_cv_mpi/bin:$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MPI_CC="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_MPI_CC" && ac_cv_path_MPI_CC="true"
;;
esac
fi
MPI_CC=$ac_cv_path_MPI_CC
if test -n "$MPI_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPI_CC" >&5
$as_echo "$MPI_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
MPILDF=`"$MPI_CC" --showme:link`
MPICF=`"$MPI_CC" --showme:compile`
LIBS="$LIBS $MPILDF"
INSTALL_MPI=""
OLD_CC=${CC}
CC=${MPI_CC}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5
$as_echo_n "checking for MPI_Init in -lmpi... " >&6; }
if ${ac_cv_lib_mpi_MPI_Init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmpi $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char MPI_Init ();
int
main ()
{
return MPI_Init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_mpi_MPI_Init=yes
else
ac_cv_lib_mpi_MPI_Init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5
$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; }
if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then :
LAMOBJS=yap_mpi."$SO"
$as_echo "#define HAVE_LIBMPI 1" >>confdefs.h
else
LAMOBJS=yap_mpi."$SO"
$as_echo "#define HAVE_LIBMPI 0" >>confdefs.h
fi
if test "$ac_cv_lib_mpi_MPI_Init" = yes
then
#YAPMPILIB=YapMPI.a
MPI_OBJS=mpi.o
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5
$as_echo_n "checking for MPI_Init in -lmpich... " >&6; }
if ${ac_cv_lib_mpich_MPI_Init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmpich $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char MPI_Init ();
int
main ()
{
return MPI_Init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_mpich_MPI_Init=yes
else
ac_cv_lib_mpich_MPI_Init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5
$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; }
if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then :
$as_echo "#define HAVE_LIBMPICH 1" >>confdefs.h
else
$as_echo "#define HAVE_LIBMPICH 0" >>confdefs.h
fi
if test "$ac_cv_lib_mpich_MPI_Init" = yes
then
#YAPMPILIB=YapMPI.a
MPI_OBJS=mpi.o
else
#YAPMPILIB=
MPI_CC=${CC}
fi
fi
for ac_header in mpi.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default"
@ -8779,7 +8637,6 @@ fi
done
CC=${OLD_CC}
MPI_LIBS=
if test "$yap_cv_mpe" != "no"
then
OLD_CC=${CC}
@ -8848,7 +8705,8 @@ done
CC=${OLD_CC}
fi
else
MPI_CC=${CC}
INSTALL_MPI="# "
MPI_CC=${CC}
fi
@ -10289,7 +10147,7 @@ _ACEOF
fi
done
for ac_func in gethrtime getpagesize
for ac_func in gethrtime getpagesize getpid
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@ -376,15 +376,15 @@ AC_ARG_WITH(mpi,
[ --with-mpi[=DIR] use LAM/MPI library in DIR],
if test "$withval" = yes; then
dnl handle UBUNTU systems
yap_cv_lam=yes
yap_cv_mpi=yes
elif test "$withval" = no; then
yap_cv_lam=no
yap_cv_mpi=no
else
yap_cv_lam=$with_mpi
yap_cv_mpi=$with_mpi
LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
fi,
[yap_cv_lam=no])
[yap_cv_mpi=no])
AC_ARG_WITH(mpe,
@ -400,19 +400,6 @@ AC_ARG_WITH(mpe,
fi,
[yap_cv_mpe=no])
AC_ARG_WITH(lam,
[ --with-lam[=DIR] use LAM MPI library in DIR],
if test "$withval" = yes; then
yap_cv_lam=yes
elif test "$withval" = no; then
yap_cv_lam=no
else
yap_cv_lam=$with_lam
LDFLAGS="$LDFLAGS -L${yap_cv_lam}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_lam}/include"
fi,
[yap_cv_lam=no])
AC_ARG_WITH(heap-space,
[ --with-heap-space[=space] default heap size in Kbytes],
if test "$withval" = yes; then
@ -612,7 +599,9 @@ then
C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
case "`$CC --version < /dev/null`" in
*3.4*) CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;;
*3.4*)
CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS"
;;
esac
case "$target_cpu" in
i*86*)
@ -697,7 +686,6 @@ AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_CHECK_TOOL(AR,ar,:)
AC_CHECK_TOOL(MPI_CC,mpicc,${CC})
AC_PATH_PROG(INSTALL_INFO,install-info,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
AC_PATH_PROG(SHELL,sh)
@ -1533,6 +1521,12 @@ dnl Linux has both elf and a.out, in this case we found elf
;;
esac
if test "$CC" = icc
then
MPI_CC="$CC"
yap_cv_mpi=no
fi
if test "$dynamic_loading" = "yes"
then
YAPLIB_CFLAGS="$SHLIB_CFLAGS"
@ -1643,53 +1637,20 @@ if test "$tabling" = "yes"
fi
dnl LAM/MPI interface
LAMOBJS=""
MPI_OBJS=
LAM_MPI_CC=${MPI_CC}
if test "$yap_cv_lam" != "no" ; then
if test "$yap_cv_lam" != "yes" ; then
LAM_MPI_CC="$yap_cv_lam"/bin/mpicc
MPI_CC="$yap_cv_lam"/bin/mpicc
CPPFLAGS="$CPPFLAGS -I ${yap_cv_lam}/include"
LDFLAGS="$LDFLAGS -L${yap_cv_lam}/lib"
fi
OLD_CC=${CC}
CC=${LAM_MPI_CC}
AC_CHECK_HEADER(mpi.h,
[LAMOBJS=yap_mpi."$SO"
AC_DEFINE(HAVE_LIBMPI, 1)],
[LAMOBJS=""
AC_DEFINE(HAVE_LIBMPI, 0)])
CC=${OLD_CC}
dnl use mpich library
elif test "$yap_cv_mpi" != "no"; then
if test "$yap_cv_mpi" != "no"; then
if test "$yap_cv_mpi" != "yes"; then
AC_PATH_PROG(MPI_CC,mpicc,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
else
AC_PATH_PROG(MPI_CC,mpicc,true,$yap_cv_mpi/bin:$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
fi
MPILDF=`"$MPI_CC" --showme:link`
MPICF=`"$MPI_CC" --showme:compile`
LIBS="$LIBS $MPILDF"
INSTALL_MPI=""
OLD_CC=${CC}
CC=${MPI_CC}
AC_CHECK_LIB(mpi,MPI_Init,
[LAMOBJS=yap_mpi."$SO"
AC_DEFINE(HAVE_LIBMPI, 1)],
[LAMOBJS=yap_mpi."$SO"
AC_DEFINE(HAVE_LIBMPI, 0)])
if test "$ac_cv_lib_mpi_MPI_Init" = yes
then
#YAPMPILIB=YapMPI.a
MPI_OBJS=mpi.o
else
AC_CHECK_LIB(mpich,MPI_Init,
[AC_DEFINE(HAVE_LIBMPICH, 1)],
[AC_DEFINE(HAVE_LIBMPICH, 0)])
if test "$ac_cv_lib_mpich_MPI_Init" = yes
then
#YAPMPILIB=YapMPI.a
MPI_OBJS=mpi.o
else
#YAPMPILIB=
MPI_CC=${CC}
fi
fi
AC_CHECK_HEADERS(mpi.h)
CC=${OLD_CC}
MPI_LIBS=
if test "$yap_cv_mpe" != "no"
then
OLD_CC=${CC}
@ -1706,7 +1667,8 @@ elif test "$yap_cv_mpi" != "no"; then
CC=${OLD_CC}
fi
else
MPI_CC=${CC}
INSTALL_MPI="# "
MPI_CC=${CC}
fi
@ -1910,16 +1872,16 @@ AC_SUBST(JAR)
AC_SUBST(LIBJPL)
AC_SUBST(IN_UNIX)
AC_SUBST(YAPMPILIB)
AC_SUBST(LAM_MPI_CC)
AC_SUBST(MPI_OBJS)
AC_SUBST(MPI_LIBS)
AC_SUBST(INSTALL_MPI)
AC_SUBST(MPI_CC)
AC_SUBST(MPILDF)
AC_SUBST(MPICF)
AC_SUBST(INSTALL_COMMAND)
AC_SUBST(INSTALLCLP)
AC_SUBST(JPLCFLAGS)
AC_SUBST(JPLLIBS)
AC_SUBST(JAVALIBS)
AC_SUBST(JPLCFLAGS)
AC_SUBST(LAMOBJS)
AC_SUBST(MAX_WORKERS)
AC_SUBST(STATIC_MODE)
AC_SUBST(ENABLE_WINCONSOLE)
@ -2126,7 +2088,7 @@ AC_CHECK_FUNCS(erf feclearexcept)
AC_CHECK_FUNCS(fesettrapenable fgetpos finite fpclass ftime ftruncate getcwd getenv)
AC_CHECK_FUNCS(getexecname)
AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname)
AC_CHECK_FUNCS(gethrtime getpagesize)
AC_CHECK_FUNCS(gethrtime getpagesize getpid)
AC_CHECK_FUNCS(getpwnam getrlimit getrusage gettimeofday getwd)
AC_CHECK_FUNCS(isatty isnan isinf kill labs link lgamma)
AC_CHECK_FUNCS(localtime lstat mallinfo)

View File

@ -46,6 +46,8 @@
selectchk/3,
sublist/2,
sumlist/2,
nth1/4,
nth0/4,
nth1/3,
nth0/3]).

View File

@ -18,7 +18,9 @@ index(selectchk,3,system,library(dialect/swi)).
index(sublist,2,system,library(dialect/swi)).
index(sumlist,2,system,library(dialect/swi)).
index(nth1,3,system,library(dialect/swi)).
index(nth1,4,system,library(dialect/swi)).
index(nth0,3,system,library(dialect/swi)).
index(nth0,4,system,library(dialect/swi)).
index(maplist,2,system,library(dialect/swi)).
index(maplist,3,system,library(dialect/swi)).
index(maplist,4,system,library(dialect/swi)).

View File

@ -23,7 +23,7 @@ YAPLIBDIR=@libdir@/Yap
#
#
CC=@CC@
MPI_CC=@LAM_MPI_CC@
MPI_CC=@MPI_CC@
CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include
#
#
@ -37,13 +37,12 @@ RANLIB=@RANLIB@
srcdir=@srcdir@
SO=@SO@
CWD=$(PWD)
MPILDF=`$(MPI_CC) --showme:link`
MPICF=`$(MPI_CC) --showme:compile`
MPILDF=@MPILDF@
MPICF=@MPICF@
#
OBJS=yap_mpi.o hash.o prologterms2c.o
SOBJS=@LAMOBJS@
#yap_mpi.@SO@
SOBJS=yap_mpi.@SO@
#in some systems we just create a single object, in others we need to
# create a libray

View File

@ -5039,10 +5039,66 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
return p;
}
#ifdef THREADS
#define COUNT_MUTEX_INITIALIZER(name) \
{ PTHREAD_MUTEX_INITIALIZER, \
name, \
0L \
}
counting_mutex _PL_mutexes[] =
{ COUNT_MUTEX_INITIALIZER("L_MISC"),
COUNT_MUTEX_INITIALIZER("L_ALLOC"),
COUNT_MUTEX_INITIALIZER("L_ATOM"),
COUNT_MUTEX_INITIALIZER("L_FLAG"),
COUNT_MUTEX_INITIALIZER("L_FUNCTOR"),
COUNT_MUTEX_INITIALIZER("L_RECORD"),
COUNT_MUTEX_INITIALIZER("L_THREAD"),
COUNT_MUTEX_INITIALIZER("L_PREDICATE"),
COUNT_MUTEX_INITIALIZER("L_MODULE"),
COUNT_MUTEX_INITIALIZER("L_TABLE"),
COUNT_MUTEX_INITIALIZER("L_BREAK"),
COUNT_MUTEX_INITIALIZER("L_FILE"),
COUNT_MUTEX_INITIALIZER("L_PLFLAG"),
COUNT_MUTEX_INITIALIZER("L_OP"),
COUNT_MUTEX_INITIALIZER("L_INIT"),
COUNT_MUTEX_INITIALIZER("L_TERM"),
COUNT_MUTEX_INITIALIZER("L_GC"),
COUNT_MUTEX_INITIALIZER("L_AGC"),
COUNT_MUTEX_INITIALIZER("L_STOPTHEWORLD"),
COUNT_MUTEX_INITIALIZER("L_FOREIGN"),
COUNT_MUTEX_INITIALIZER("L_OS"),
COUNT_MUTEX_INITIALIZER("L_LOCALE")
#ifdef __WINDOWS__
, COUNT_MUTEX_INITIALIZER("L_DDE")
, COUNT_MUTEX_INITIALIZER("L_CSTACK")
#endif
};
static void
initMutexes( void )
{ counting_mutex *m;
int n = sizeof(_PL_mutexes)/sizeof(*m);
int i;
for(i=0, m=_PL_mutexes; i<n; i++, m++)
simpleMutexInit(&m->mutex);
}
#endif
static void
init_yap(void)
{
GET_LD
#ifdef THREADS
initMutexes();
#endif
/* we need encodings first */
initCharTypes();
initPrologFlags();

View File

@ -25,6 +25,7 @@
#include "pl-incl.h"
#ifdef __YAP_PROLOG__
#include "pl-ctype.h"
#include "eval.h"
#else
#include "os/pl-ctype.h"
#endif
@ -1049,32 +1050,48 @@ initPrologFlagTable(void)
void
initPrologFlags(void)
{ GET_LD
#ifndef __YAP_PROLOG__
setPrologFlag("iso", FT_BOOL, FALSE, PLFLAG_ISO);
#ifdef __YAP_PROLOG__
setPrologFlag("arch", FT_ATOM|FF_READONLY, YAP_ARCH);
#else
setPrologFlag("arch", FT_ATOM|FF_READONLY, PLARCH);
#endif
#if __WINDOWS__
setPrologFlag("windows", FT_BOOL|FF_READONLY, TRUE, 0);
#endif
#ifndef __YAP_PROLOG__
setPrologFlag("version", FT_INTEGER|FF_READONLY, PLVERSION);
setPrologFlag("dialect", FT_ATOM|FF_READONLY, "swi");
if ( systemDefaults.home )
setPrologFlag("home", FT_ATOM|FF_READONLY, systemDefaults.home);
if ( GD->paths.executable )
setPrologFlag("executable", FT_ATOM|FF_READONLY, GD->paths.executable);
#else
setPrologFlag("dialect", FT_ATOM|FF_READONLY, "yap");
setPrologFlag("home", FT_ATOM|FF_READONLY, YAP_ROOTDIR);
if (GLOBAL_argv && GLOBAL_argv[0]) {
Yap_TrueFileName (GLOBAL_argv[0], LOCAL_FileNameBuf, FALSE);
setPrologFlag("executable", FT_ATOM|FF_READONLY, LOCAL_FileNameBuf);
} else
setPrologFlag("executable", FT_ATOM|FF_READONLY, Yap_FindExecutable());
#endif
#if defined(HAVE_GETPID) || defined(EMULATE_GETPID)
setPrologFlag("pid", FT_INTEGER|FF_READONLY, getpid());
#endif
setPrologFlag("optimise", FT_BOOL, GD->cmdline.optimise, PLFLAG_OPTIMISE);
setPrologFlag("generate_debug_info", FT_BOOL,
truePrologFlag(PLFLAG_DEBUGINFO), PLFLAG_DEBUGINFO);
#ifndef __YAP_PROLOG__
setPrologFlag("last_call_optimisation", FT_BOOL, TRUE, PLFLAG_LASTCALL);
setPrologFlag("warn_override_implicit_import", FT_BOOL, TRUE,
PLFLAG_WARN_OVERRIDE_IMPLICIT_IMPORT);
#endif
setPrologFlag("c_cc", FT_ATOM, C_CC);
setPrologFlag("c_libs", FT_ATOM, C_LIBS);
setPrologFlag("c_libplso", FT_ATOM, C_LIBPLSO);
setPrologFlag("c_ldflags", FT_ATOM, C_LDFLAGS);
setPrologFlag("c_cflags", FT_ATOM, C_CFLAGS);
#ifndef __YAP_PROLOG__
#if defined(O_LARGEFILES) || SIZEOF_LONG == 8
setPrologFlag("large_files", FT_BOOL|FF_READONLY, TRUE, 0);
#endif
@ -1083,6 +1100,7 @@ initPrologFlags(void)
#ifdef O_ATOMGC
setPrologFlag("agc_margin",FT_INTEGER, GD->atoms.margin);
#endif
#endif
#if defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD) || defined(EMULATE_DLOPEN)
setPrologFlag("open_shared_object", FT_BOOL|FF_READONLY, TRUE, 0);
setPrologFlag("shared_object_extension", FT_ATOM|FF_READONLY, SO_EXT);
@ -1123,8 +1141,13 @@ initPrologFlags(void)
setPrologFlag("max_integer", FT_INT64|FF_READONLY, PLMAXINT);
setPrologFlag("min_integer", FT_INT64|FF_READONLY, PLMININT);
#endif
#ifndef __YAP_PROLOG__
setPrologFlag("max_tagged_integer", FT_INTEGER|FF_READONLY, PLMAXTAGGEDINT);
setPrologFlag("min_tagged_integer", FT_INTEGER|FF_READONLY, PLMINTAGGEDINT);
#else
setPrologFlag("max_tagged_integer", FT_INTEGER|FF_READONLY, Int_MAX);
setPrologFlag("min_tagged_integer", FT_INTEGER|FF_READONLY, Int_MIN);
#endif
#ifdef O_GMP
setPrologFlag("bounded", FT_BOOL|FF_READONLY, FALSE, 0);
#ifdef __GNU_MP__
@ -1148,6 +1171,7 @@ initPrologFlags(void)
setPrologFlag("occurs_check", FT_ATOM, "false");
setPrologFlag("access_level", FT_ATOM, "user");
setPrologFlag("double_quotes", FT_ATOM, "codes");
#ifndef __YAP_PROLOG__
setPrologFlag("unknown", FT_ATOM, "error");
setPrologFlag("debug", FT_BOOL, FALSE, 0);
setPrologFlag("verbose", FT_ATOM|FF_KEEP, GD->options.silent ? "silent" : "normal");
@ -1161,6 +1185,7 @@ initPrologFlags(void)
setPrologFlag("toplevel_prompt", FT_ATOM, "~m~d~l~! ?- ");
setPrologFlag("file_name_variables", FT_BOOL, FALSE, PLFLAG_FILEVARS);
setPrologFlag("fileerrors", FT_BOOL, TRUE, PLFLAG_FILEERRORS);
#endif
#ifdef __unix__
setPrologFlag("unix", FT_BOOL|FF_READONLY, TRUE, 0);
#endif
@ -1184,7 +1209,6 @@ initPrologFlags(void)
setPrologFlag("compiled_at", FT_ATOM|FF_READONLY, buf);
}
#endif
#endif /* YAP_PROLOG */
/* Flags copied by YAP */
setPrologFlag("optimise", FT_BOOL, GD->cmdline.optimise, PLFLAG_OPTIMISE);
/* FLAGS used by PLStream */

View File

@ -997,6 +997,9 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
{ GET_LD
PL_chars_t txt;
{ FILE *f=fopen("/home/vsc/coutput.txt", "append");
fprintf(f, "IN: %ld\n", bindings);
fclose(f); }
if ( !bindings && PL_is_variable(atom) ) /* term_to_atom(+, -) */
{ char buf[1024];
size_t bufsize = sizeof(buf);
@ -1015,6 +1018,9 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
txt.storage = PL_CHARS_HEAP;
txt.encoding = ENC_UTF8;
txt.canonical = FALSE;
{ FILE *f=fopen("/home/vsc/coutput.txt", "append");
fprintf(f, "SUCCESS: %s\n", buf);
fclose(f); }
rval = PL_unify_text(atom, 0, &txt, PL_ATOM);
Sclose(stream);

View File

@ -2255,9 +2255,11 @@ Svsprintf(char *buf, const char *fm, va_list args)
int
Svdprintf(const char *fm, va_list args)
{ int rval;
IOSTREAM *s = Serror;
IOSTREAM *s = Serror;
//IOSTREAM *s = Sopen_file("/home/vsc/cout.txt", "append");
Slock(s);
//Slock(s);
rval = Svfprintf(s, fm, args);
#if defined(_DEBUG) && defined(__WINDOWS__)
Sputc('\0', s);
@ -2266,7 +2268,8 @@ Svdprintf(const char *fm, va_list args)
#endif
if ( Sflush(s) != 0 )
rval = -1;
Sunlock(s);
//Sunlock(s);
//Sclose(s);
return rval;
}

View File

@ -107,8 +107,25 @@ compile-time
simpleMutexUnlock(&(cm)->mutex); \
} while(0)
//#define O_DEBUG_MT
#ifdef O_DEBUG_MT
#define PL_LOCK(id) \
do { Sdprintf("[%d] %s:%d: LOCK(%s)\n", \
pthread_self(), \
__BASE_FILE__, __LINE__, #id); \
countingMutexLock(&_PL_mutexes[id]); \
} while(0)
#define PL_UNLOCK(id) \
do { Sdprintf("[%d] %s:%d: UNLOCK(%s)\n", \
pthread_self(), \
__BASE_FILE__, __LINE__, #id); \
countingMutexUnlock(&_PL_mutexes[id]); \
} while(0)
#else
#define PL_LOCK(id) IF_MT(id, countingMutexLock(&_PL_mutexes[id]))
#define PL_UNLOCK(id) IF_MT(id, countingMutexUnlock(&_PL_mutexes[id]))
#endif
#undef O_DEBUG_MT
#define IOLOCK recursiveMutex

View File

@ -94,22 +94,15 @@ true :- true.
'$init_globals' :-
'$init_consult',
nb_setval('$chr_toplevel_show_store',false),
nb_setval('$break',0),
% '$set_read_error_handler'(error), let the user do that
nb_setval('$open_expands_filename',true),
nb_setval('$trace',off),
% '$set_read_error_handler'(error), let the user do that
nb_setval('$system_mode',off),
nb_setval('$chr_toplevel_show_store',false),
nb_setval('$assert_all',off),
nb_setval('$if_skip_mode',no_skip),
b_setval('$spy_glist',[]),
nb_setval('$spy_gn',1),
nb_setval('$debug_run',off),
nb_setval('$debug_jump',off).
nb_setval('$chr_toplevel_show_store',false).
'$init_consult' :-
set_value('$open_expands_filename',true),
set_value('$lf_verbose',informational),
nb_setval('$assert_all',off),
nb_setval('$if_level',0),
nb_setval('$endif',off),
nb_setval('$consulting_file',[]),
@ -1263,7 +1256,7 @@ catch_ball(C, C).
'$execute_outside_system_mode'(G2, M, CP)
).
'$execute_outside_system_mode'(G, M, CP) :-
nb_getval('$trace', on), !,
'$nb_getval'('$trace', on, fail), !,
(
'$$save_by'(CP1),
'$do_spy'(G, M, CP, meta_creep),

View File

@ -923,20 +923,20 @@ absolute_file_name(File,Opts,TrueFileName) :-
'$get_if'(Level0),
Level is Level0 + 1,
nb_setval('$if_level',Level),
nb_getval('$endif',OldEndif),
nb_getval('$if_skip_mode',Mode),
'$nb_getval'('$endif', OldEndif, OldEndif=top),
'$nb_getval'('$if_skip_mode', Mode, Mode=run),
nb_setval('$endif',elif(Level,OldEndif,Mode)),
fail.
% we are in skip mode, ignore....
'$if'(Goal,_) :-
nb_getval('$endif',elif(Level, OldEndif, skip)), !,
'$nb_getval'('$endif',elif(Level, OldEndif, skip), fail), !,
nb_setval('$endif',endif(Level, OldEndif, skip)).
% we are in non skip mode, check....
'$if'(Goal,_) :-
('$if_call'(Goal)
->
% we will execute this branch, and later enter skip
nb_getval('$endif',elif(Level,OldEndif,Mode)),
'$nb_getval'('$endif', elif(Level,OldEndif,Mode), fail),
nb_setval('$endif',endif(Level,OldEndif,Mode))
;
% we are now in skip, but can start an elif.

View File

@ -320,6 +320,7 @@ b_getval(GlobalVariable, Val) :-
debugger state */
break :-
'$init_debugger',
nb_getval('$system_mode',SystemMode),
nb_getval('$trace',Trace),
nb_setval('$trace',off),

View File

@ -11,7 +11,7 @@
* File: debug.pl *
* Last rev: *
* mods: *
* comments: YAP's debugger *
* comments: YAP debugger *
* *
*************************************************************************/
@ -23,6 +23,16 @@
:- op(900,fx,[spy,nospy]).
'$init_debugger' :-
nb_getval('$trace', _, fail), !.
'$init_debugger' :-
nb_setval('$trace',off),
nb_setval('$if_skip_mode',no_skip),
b_setval('$spy_glist',[]),
nb_setval('$spy_gn',1),
nb_setval('$debug_run',off),
nb_setval('$debug_jump',off).
% First part : setting and reseting spy points
@ -123,6 +133,7 @@
recorded('$spy','$spy'(G,M),_), !.
spy Spec :-
'$init_debugger',
prolog:debug_action_hook(spy(Spec)), !.
spy L :-
'$current_module'(M),
@ -130,6 +141,7 @@ spy L :-
spy _ :- debug.
nospy Spec :-
'$init_debugger',
prolog:debug_action_hook(nospy(Spec)), !.
nospy L :-
'$current_module'(M),
@ -137,6 +149,7 @@ nospy L :-
nospy _.
nospyall :-
'$init_debugger',
prolog:debug_action_hook(nospyall), !.
nospyall :-
recorded('$spy','$spy'(T,M),_), functor(T,F,N), '$suspy'(F/N,nospy,M), fail.
@ -145,6 +158,7 @@ nospyall.
% debug mode -> debug flag = 1
debug :-
'$init_debugger',
( nb_getval('$spy_gn',L) -> true ; nb_setval('$spy_gn',1) ),
'$start_debugging'(on),
print_message(informational,debug(debug)).
@ -159,6 +173,7 @@ debug :-
nb_setval('$debug_jump',false).
nodebug :-
'$init_debugger',
'$debug_on'(false),
nb_setval('$trace',off),
print_message(informational,debug(off)).
@ -168,7 +183,8 @@ nodebug :-
%
trace :-
nb_getval('$trace',on), !.
'$init_debugger',
'$nb_getval'('$trace', on, fail), !.
trace :-
nb_setval('$trace',on),
'$start_debugging'(on),
@ -176,7 +192,7 @@ trace :-
'$meta_creep'.
'$do_trace' :-
nb_getval('$trace',on), !.
'$nb_getval'('$trace', on, fail), !.
'$do_trace' :-
nb_setval('$trace',on),
'$start_debugging'(on),
@ -184,6 +200,7 @@ trace :-
'$creep'.
notrace :-
'$init_debugger',
nodebug.
/*-----------------------------------------------------------------------------
@ -196,6 +213,7 @@ notrace :-
leash(X) :- var(X),
'$do_error'(instantiation_error,leash(X)).
leash(X) :-
'$init_debugger',
'$leashcode'(X,Code),
set_value('$leash',Code),
'$show_leash'(informational,Code), !.
@ -243,6 +261,7 @@ leash(X) :-
debugging :-
'$init_debugger',
prolog:debug_action_hook(nospyall), !.
debugging :-
( '$debug_on'(true) ->

View File

@ -58,9 +58,6 @@ yap_flag(autoload,false) :-
% do or do not machine code
yap_flag(argv,L) :- '$argv'(L).
% do or do not machine code
yap_flag(executable,L) :- '$executable'(L).
% hide/unhide atoms
yap_flag(hide,Atom) :- !, hide(Atom).
yap_flag(unhide,Atom) :- !, unhide(Atom).
@ -212,16 +209,6 @@ yap_flag(associate,X) :-
yap_flag(associate,X) :-
'$do_error'(type_error(atom,X),associate(X)).
yap_flag(bounded,X) :-
var(X), !,
'$access_yap_flags'(0, X1),
'$transl_to_true_false'(X1,X).
yap_flag(bounded,X) :-
(X = true ; X = false), !,
'$do_error'(permission_error(modify,flag,bounded),yap_flag(bounded,X)).
yap_flag(bounded,X) :-
'$do_error'(domain_error(flag_value,bounded+X),yap_flag(bounded,X)).
% do or do not indexation
yap_flag(index,X) :- var(X),
'$access_yap_flags'(19, X1),
@ -244,9 +231,6 @@ yap_flag(index_sub_term_search_depth,X,X) :-
yap_flag(index_sub_term_search_depth,X,X) :-
'$do_error'(domain_error(out_of_range,index_sub_term_search_depth+X),yap_flag(index_sub_term_search_depth,X)).
yap_flag(home,X) :-
'$yap_home'(X).
% should match definitions in Yap.h
'$transl_to_index_mode'(0, off).
'$transl_to_index_mode'(1, single).
@ -312,58 +296,12 @@ yap_flag(integer_rounding_function,X) :-
yap_flag(integer_rounding_function,X) :-
'$do_error'(domain_error(flag_value,integer_rounding_function+X),yap_flag(integer_rounding_function,X)).
yap_flag(max_arity,X) :-
var(X), !,
'$access_yap_flags'(1, X1),
'$transl_to_arity'(X1,X).
yap_flag(max_arity,X) :-
integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,max_arity),yap_flag(max_arity,X)).
yap_flag(max_arity,X) :-
'$do_error'(domain_error(flag_value,max_arity+X),yap_flag(max_arity,X)).
yap_flag(version,X) :-
var(X), !,
get_value('$version_name',X).
yap_flag(version,X) :-
'$do_error'(permission_error(modify,flag,version),yap_flag(version,X)).
yap_flag(max_integer,X) :-
var(X), !,
'$access_yap_flags'(0, 1),
'$access_yap_flags'(3, X).
yap_flag(max_integer,X) :-
integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,max_integer),yap_flag(max_integer,X)).
yap_flag(max_integer,X) :-
'$do_error'(domain_error(flag_value,max_integer+X),yap_flag(max_integer,X)).
yap_flag(max_tagged_integer,X) :-
'$max_tagged_integer'(X), !.
yap_flag(max_tagged_integer,X) :-
integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,max_tagged_integer),yap_flag(max_tagged_integer,X)).
yap_flag(max_tagged_integer,X) :-
'$do_error'(domain_error(flag_value,max_tagged_integer+X),yap_flag(max_tagged_integer,X)).
yap_flag(min_integer,X) :-
var(X), !,
'$access_yap_flags'(0, 1),
'$access_yap_flags'(4, X).
yap_flag(min_integer,X) :-
integer(X), X < 0, !,
'$do_error'(permission_error(modify,flag,min_integer),yap_flag(min_integer,X)).
yap_flag(min_integer,X) :-
'$do_error'(domain_error(flag_value,min_integer+X),yap_flag(min_integer,X)).
yap_flag(min_tagged_integer,X) :-
'$min_tagged_integer'( X), !.
yap_flag(min_tagged_integer,X) :-
integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,min_tagged_integer),yap_flag(min_tagged_integer,X)).
yap_flag(min_tagged_integer,X) :-
'$do_error'(domain_error(flag_value,min_tagged_integer+X),yap_flag(min_tagged_integer,X)).
/* ISO Core Revision DTR: new float flags
yap_flag(float_mantissa_digits,X) :-
@ -419,16 +357,6 @@ yap_flag(char_conversion,X) :-
yap_flag(char_conversion,X) :-
'$do_error'(domain_error(flag_value,char_conversion+X),yap_flag(char_conversion,X)).
yap_flag(double_quotes,X) :-
var(X), !,
'$access_yap_flags'(6, X1),
'$transl_to_trl_types'(X1,X).
yap_flag(double_quotes,X) :-
'$transl_to_trl_types'(X1,X), !,
'$set_yap_flags'(6,X1).
yap_flag(double_quotes,X) :-
'$do_error'(domain_error(flag_value,double_quotes+X),yap_flag(double_quotes,X)).
yap_flag(n_of_integer_keys_in_db,X) :-
var(X), !,
'$resize_int_keys'(X).
@ -514,13 +442,6 @@ yap_flag(discontiguous_warnings,X) :-
yap_flag(discontiguous_warnings,X) :-
'$do_error'(domain_error(flag_value,discontiguous_warnings+X),yap_flag(discontiguous_warnings,X)).
yap_flag(occurs_check,X) :-
X = false, !.
yap_flag(occurs_check,true) :- !,
fail.
yap_flag(occurs_check,X) :-
'$do_error'(domain_error(flag_value,occurs_check+X),yap_flag(occurs_check,X)).
yap_flag(redefine_warnings,X) :-
var(X), !,
'$syntax_check_multiple'(X,X).
@ -536,7 +457,7 @@ yap_flag(redefine_warnings,X) :-
yap_flag(chr_toplevel_show_store,X) :-
var(X), !,
nb_getval('$chr_toplevel_show_store',X).
'$nb_getval'('$chr_toplevel_show_store', X, fail).
yap_flag(chr_toplevel_show_store,X) :-
(X = true ; X = false), !,
nb_setval('$chr_toplevel_show_store',X).
@ -581,8 +502,6 @@ yap_flag(system_options,X) :-
'$swi_current_prolog_flag'(readline, true).
'$system_options'(tabling) :-
\+ '$undefined'('$c_table'(_,_,_), prolog).
'$system_options'(threads) :-
\+ '$no_threads'.
'$system_options'(wam_profiler) :-
\+ '$undefined'(reset_op_counters, prolog).
@ -630,14 +549,6 @@ yap_flag(toplevel_hook,G) :-
yap_flag(toplevel_hook,G) :- !,
'$set_toplevel_hook'(G).
yap_flag(unix,true) :-
'$unix', !.
yap_flag(unix,false).
yap_flag(windows,true) :-
'$win32', !.
yap_flag(windows,false).
yap_flag(shared_object_search_path,P) :-
'$ld_path'(P).
@ -788,35 +699,19 @@ yap_flag(max_threads,X) :-
yap_flag(max_threads,X) :-
'$do_error'(domain_error(flag_value,max_threads+X),yap_flag(max_threads,X)).
yap_flag(address_bits,X) :-
var(X), !,
'$address_bits'(X).
yap_flag(address_bits,X) :-
integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,address_bits),yap_flag(address_bits,X)).
yap_flag(address_bits,X) :-
'$do_error'(domain_error(flag_value,address_bits+X),yap_flag(address_bits,X)).
yap_flag(dialect,yap).
'$yap_system_flag'(address_bits).
'$yap_system_flag'(agc_margin).
'$yap_system_flag'(answer_format).
'$yap_system_flag'(argv).
'$yap_system_flag'(autoload).
'$yap_system_flag'(bounded).
'$yap_system_flag'(char_conversion).
'$yap_system_flag'(character_escapes).
'$yap_system_flag'(chr_toplevel_show_store).
'$yap_system_flag'(debug).
'$yap_system_flag'(debug_on_error ).
'$yap_system_flag'(debugger_print_options).
'$yap_system_flag'(dialect).
'$yap_system_flag'(discontiguous_warnings).
'$yap_system_flag'(dollar_as_lower_case).
'$yap_system_flag'(double_quotes).
% '$yap_system_flag'(encoding).
'$yap_system_flag'(executable).
% V = fast ;
% '$yap_system_flag'(file_name_variables).
% '$yap_system_flag'(fileerrors ).
@ -830,7 +725,6 @@ yap_flag(dialect,yap).
'$yap_system_flag'(gc_trace ).
'$yap_system_flag'(generate_debug_info ).
% V = hide ;
'$yap_system_flag'(home ).
'$yap_system_flag'(host_type ).
'$yap_system_flag'(index).
'$yap_system_flag'(index_sub_term_search_depth).
@ -838,15 +732,9 @@ yap_flag(dialect,yap).
'$yap_system_flag'(informational_messages).
'$yap_system_flag'(integer_rounding_function).
'$yap_system_flag'(language).
'$yap_system_flag'(max_arity).
'$yap_system_flag'(max_integer).
'$yap_system_flag'(max_tagged_integer).
'$yap_system_flag'(max_workers).
'$yap_system_flag'(max_threads).
'$yap_system_flag'(min_integer).
'$yap_system_flag'(min_tagged_integer).
'$yap_system_flag'(n_of_integer_keys_in_db).
'$yap_system_flag'(occurs_check).
'$yap_system_flag'(open_expands_filename).
'$yap_system_flag'(open_shared_object).
% '$yap_system_flag'(optimise).
@ -866,7 +754,6 @@ yap_flag(dialect,yap).
'$yap_system_flag'(toplevel_hook).
'$yap_system_flag'(toplevel_print_options).
'$yap_system_flag'(typein_module).
'$yap_system_flag'(unix).
'$yap_system_flag'(unknown).
'$yap_system_flag'(update_semantics).
'$yap_system_flag'(user_error).
@ -878,7 +765,6 @@ yap_flag(dialect,yap).
'$yap_system_flag'(verbose_load).
'$yap_system_flag'(verbose_auto_load).
'$yap_system_flag'(version).
'$yap_system_flag'(windows).
'$yap_system_flag'(write_strings).
'$show_yap_flag_opts'(V,Out) :-
@ -957,10 +843,6 @@ yap_flag(dialect,yap).
'$transl_to_rounding_function'(0,toward_zero).
'$transl_to_rounding_function'(1,down).
'$transl_to_trl_types'(0,chars).
'$transl_to_trl_types'(1,codes).
'$transl_to_trl_types'(2,atom).
'$yap_flag_show_gc_tracing'(true, _, _, on) :- !.
'$yap_flag_show_gc_tracing'(_, true, _, verbose) :- !.
'$yap_flag_show_gc_tracing'(_, _, on, very_verbose) :- !.

View File

@ -364,6 +364,7 @@ thread_exit(Term) :-
fail.
'$run_at_thread_exit'(Id0) :-
recorded('$thread_exit_hook',[Id0|Hook],R), erase(R),
open('/home/vsc/coutput.txt', append, W), writeln(hook:Hook), close(W),
catch(once(Hook),_,fail),
fail.
'$run_at_thread_exit'(_).
@ -374,7 +375,8 @@ thread_at_exit(Goal) :-
recordz('$thread_exit_hook',[Id0|Goal],_).
current_thread(Id, Status) :-
thread_property(Id, status(Status)).
catch(thread_property(Id, status(Status)),
error(existence_error(_,_),_), fail).
'$thread_id_alias'(Id, Alias) :-

View File

@ -368,12 +368,12 @@ stream_position_data(Prop, Term, Value) :-
'$default_expand'(Expand) :-
nb_getval('$open_expands_filename',Expand).
get_value('$open_expands_filename',Expand).
'$set_default_expand'(true) :- !,
nb_setval('$open_expands_filename',true).
set_value('$open_expands_filename',true).
'$set_default_expand'(false) :- !,
nb_setval('$open_expands_filename',false).
set_value('$open_expands_filename',false).
'$set_default_expand'(V) :- !,
'$do_error'(domain_error(flag_value,V),yap_flag(open_expands_file_name,X)).