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" #include "Foreign.h"
#if _WIN32 || defined(__CYGWIN__) #if _WIN32 || defined(__CYGWIN__)
#ifndef YAP_SHLIB_SUFFIX #ifndef SO_EXT
#define YAP_SHLIB_SUFFIX ".dll" #define SO_EXT ".dll"
#endif #endif
#endif #endif
@ -210,12 +210,12 @@ p_call_shared_object_function( USES_REGS1 ) {
static Int static Int
p_obj_suffix( USES_REGS1 ) { p_obj_suffix( USES_REGS1 ) {
return Yap_unify(Yap_StringToList(YAP_SHLIB_SUFFIX),ARG1); return Yap_unify(Yap_StringToList(SO_EXT),ARG1);
} }
static Int static Int
p_open_shared_objects( USES_REGS1 ) { p_open_shared_objects( USES_REGS1 ) {
#ifdef YAP_SHLIB_SUFFIX #ifdef SO_EXT
return TRUE; return TRUE;
#else #else
return FALSE; return FALSE;

View File

@ -319,7 +319,8 @@ word lookupAtom(const char *s, size_t len)
/* dirty trick to ensure s is null terminated */ /* dirty trick to ensure s is null terminated */
char *st = (char *)s; char *st = (char *)s;
st[len] = '\0'; if (st[len])
st[len] = '\0';
if (len >= strlen(s)) { if (len >= strlen(s)) {
at = YAP_LookupAtom(st); at = YAP_LookupAtom(st);
} else { } else {
@ -1300,12 +1301,6 @@ sysError(const char *fm, ...)
#if THREADS #if THREADS
#define COUNT_MUTEX_INITIALIZER(name) \
{ PTHREAD_MUTEX_INITIALIZER, \
name, \
0L \
}
static int static int
recursive_attr(pthread_mutexattr_t **ap) recursive_attr(pthread_mutexattr_t **ap)
{ static int done; { 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 #endif

View File

@ -131,10 +131,10 @@ add_end_dot(char arg[])
static int static int
dump_runtime_variables(void) 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_ROOTDIR=\"%s\"\n",YAP_ROOTDIR);
fprintf(stdout,"YAP_LIBS=\"%s\"\n",YAP_LIBS); fprintf(stdout,"YAP_LIBS=\"%s\"\n",C_LIBS);
fprintf(stdout,"YAP_SHLIB_SUFFIX=\"%s\"\n",YAP_SHLIB_SUFFIX); fprintf(stdout,"YAP_SHLIB_SUFFIX=\"%s\"\n",SO_EXT);
fprintf(stdout,"YAP_VERSION=%d\n",YAP_VERSION); fprintf(stdout,"YAP_VERSION=%d\n",YAP_VERSION);
exit(0); exit(0);
return 1; return 1;

View File

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

View File

@ -74,6 +74,7 @@ AWK=@AWK@
CPP=@CPP@ CPP=@CPP@
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1
LIBS=@LIBS@ LIBS=@LIBS@
DLL_LIBS=@LIBS@ @EXTRA_LIBS_FOR_DLLS@
LDFLAGS=@LDFLAGS@ LDFLAGS=@LDFLAGS@
LN_S=@LN_S@ LN_S=@LN_S@
M4=@M4@ M4=@M4@
@ -276,8 +277,8 @@ C_SOURCES= \
$(srcdir)/OPTYap/or.thread_engine.c \ $(srcdir)/OPTYap/or.thread_engine.c \
$(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \ $(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \
$(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \ $(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \
$(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.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/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c \
$(srcdir)/C/cut_c.c \ $(srcdir)/C/cut_c.c \
$(srcdir)/library/dialect/swi/fli/swi.c \ $(srcdir)/library/dialect/swi/fli/swi.c \
$(srcdir)/library/dialect/swi/fli/blobs.c \ $(srcdir)/library/dialect/swi/fli/blobs.c \
@ -373,7 +374,7 @@ ENGINE_OBJECTS = \
udi.o\ udi.o\
unify.o userpreds.o utilpreds.o \ unify.o userpreds.o utilpreds.o \
yap-args.o write.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 = \ LIBTAI_OBJECTS = \
tai_add.o tai_now.o tai_pack.o \ 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 $(VERSION) | $(AWK) -F. '{ printf("#define YAP_VERSION %d\n", $$1 * 10000 + $$2 * 100 + $$3); }' >> $@%
@echo "#define MYDDAS_VERSION \"$(MYDDAS_VERSION)\"" >> $@% @echo "#define MYDDAS_VERSION \"$(MYDDAS_VERSION)\"" >> $@%
@echo "#define YAP_ARCH \"$(ARCH)\"" >> $@% @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_YAPLIB \"$(YAPLIB)\"" >> $@%
@echo "#define YAP_CC \"$(CC)\"" >> $@% @echo "#define C_CC \"$(CC)\"" >> $@%
@echo "#define YAP_CFLAGS \"$(CFLAGS)\"" >> $@% @echo "#define C_CFLAGS \"$(CFLAGS)\"" >> $@%
@echo "#define YAP_LDFLAGS \"$(LDFLAGS)\"" >> $@% @echo "#define C_LDFLAGS \"$(LDFLAGS)\"" >> $@%
@echo "#define YAP_SHLIB_SUFFIX \".\" \"$(SO)\"" >> $@% @echo "#define SO_EXT \".\" \"$(SO)\"" >> $@%
@echo "#define YAP_TIMESTAMP \"`date +%s`\"" >> $@% @echo "#define YAP_TIMESTAMP \"`date +%s`\"" >> $@%
@echo "#define YAP_SVERSION \"YAP $(VERSION) ($(ARCH)): `date`\"" >> $@% @echo "#define YAP_SVERSION \"YAP $(VERSION) ($(ARCH)): `date`\"" >> $@%
@if cmp -s $@% $@; then rm $@%; else mv $@% $@; fi @if cmp -s $@% $@; then rm $@%; else mv $@% $@; fi
@ -696,7 +698,7 @@ mycb: $(srcdir)/mycb.c
all: startup.yss all: startup.yss
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE)) @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_MATLAB@ (cd library/matlab; $(MAKE))
@INSTALL_DLLS@ (cd library/matrix; $(MAKE)) @INSTALL_DLLS@ (cd library/matrix; $(MAKE))
@INSTALL_DLLS@ (cd library/random; $(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 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@ 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@ yap-win: yap-win@EXEC_SUFFIX@
@ -745,7 +747,7 @@ yapwin: yap-win@EXEC_SUFFIX@
yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@ yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@
(cd swi/console; $(MAKE)) (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) libYap.a: $(LIB_OBJECTS)
-rm -f libYap.a -rm -f libYap.a
@ -772,7 +774,7 @@ install_unix: startup.yss libYap.a
$(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR) $(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR)
$(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR) $(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)
for f in $(PL_SOURCES); do $(INSTALL) $$f $(DESTDIR)$(SHAREDIR)/Yap/pl; done 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/matrix; $(MAKE) install)
@INSTALL_DLLS@ (cd library/random; $(MAKE) install) @INSTALL_DLLS@ (cd library/random; $(MAKE) install)
@INSTALL_DLLS@ (cd library/regex; $(MAKE) install) @INSTALL_DLLS@ (cd library/regex; $(MAKE) install)
@ -915,7 +917,7 @@ depend: $(HEADERS) $(C_SOURCES)
clean: clean_docs clean: clean_docs
rm -f *.o *~ *.BAK *.a rm -f *.o *~ *.BAK *.a
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) clean) @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_MATLAB@ (cd library/matlab; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean) @INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/random; $(MAKE) clean) @INSTALL_DLLS@ (cd library/random; $(MAKE) clean)

View File

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

356
configure vendored
View File

@ -671,15 +671,14 @@ EXTRA_INCLUDES_FOR_WIN32
ENABLE_WINCONSOLE ENABLE_WINCONSOLE
STATIC_MODE STATIC_MODE
MAX_WORKERS MAX_WORKERS
LAMOBJS
JAVALIBS JAVALIBS
JPLLIBS JPLLIBS
JPLCFLAGS JPLCFLAGS
INSTALLCLP INSTALLCLP
INSTALL_COMMAND INSTALL_COMMAND
MPI_LIBS MPICF
MPI_OBJS MPILDF
LAM_MPI_CC INSTALL_MPI
YAPMPILIB YAPMPILIB
IN_UNIX IN_UNIX
LIBJPL LIBJPL
@ -735,13 +734,13 @@ CPLINT_SHLIB_LD
CPLINT_LDFLAGS CPLINT_LDFLAGS
CPLINT_CFLAGS CPLINT_CFLAGS
CPLINT_LIBS CPLINT_LIBS
MPI_CC
ENABLE_PRISM ENABLE_PRISM
ENABLE_GECODE ENABLE_GECODE
NVCC NVCC
PYTHON PYTHON
REXE REXE
INSTALL_INFO INSTALL_INFO
MPI_CC
AR AR
RANLIB RANLIB
INSTALL_DATA INSTALL_DATA
@ -867,7 +866,6 @@ with_readline
with_matlab with_matlab
with_mpi with_mpi
with_mpe with_mpe
with_lam
with_heap_space with_heap_space
with_stack_space with_stack_space
with_trail_space with_trail_space
@ -1548,7 +1546,6 @@ Optional Packages:
--with-matlab=DIR use MATLAB package in DIR --with-matlab=DIR use MATLAB package in DIR
--with-mpi=DIR use LAM/MPI library in DIR --with-mpi=DIR use LAM/MPI library in DIR
--with-mpe=DIR use MPE 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-heap-space=space default heap size in Kbytes
--with-stack-space=space default stack size in Kbytes --with-stack-space=space default stack size in Kbytes
--with-trail-space=space default trail size in Kbytes --with-trail-space=space default trail size in Kbytes
@ -4884,16 +4881,16 @@ fi
# Check whether --with-mpi was given. # Check whether --with-mpi was given.
if test "${with_mpi+set}" = set; then : if test "${with_mpi+set}" = set; then :
withval=$with_mpi; if test "$withval" = yes; then withval=$with_mpi; if test "$withval" = yes; then
yap_cv_lam=yes yap_cv_mpi=yes
elif test "$withval" = no; then elif test "$withval" = no; then
yap_cv_lam=no yap_cv_mpi=no
else else
yap_cv_lam=$with_mpi yap_cv_mpi=$with_mpi
LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib" LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include" CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
fi fi
else else
yap_cv_lam=no yap_cv_mpi=no
fi 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. # Check whether --with-heap-space was given.
if test "${with_heap_space+set}" = set; then : if test "${with_heap_space+set}" = set; then :
withval=$with_heap_space; if test "$withval" = yes; 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" C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
case "`$CC --version < /dev/null`" in case "`$CC --version < /dev/null`" in
*3.4*) CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;; *3.4*)
CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS"
;;
esac esac
case "$target_cpu" in case "$target_cpu" in
i*86*) i*86*)
@ -5567,98 +5549,6 @@ else
AR="$ac_cv_prog_AR" AR="$ac_cv_prog_AR"
fi 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. # Extract the first word of "install-info", so it can be a program name with args.
set dummy install-info; ac_word=$2 set dummy install-info; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@ -8519,6 +8409,12 @@ fi
;; ;;
esac esac
if test "$CC" = icc
then
MPI_CC="$CC"
yap_cv_mpi=no
fi
if test "$dynamic_loading" = "yes" if test "$dynamic_loading" = "yes"
then then
YAPLIB_CFLAGS="$SHLIB_CFLAGS" YAPLIB_CFLAGS="$SHLIB_CFLAGS"
@ -8634,138 +8530,100 @@ if test "$tabling" = "yes"
YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1" YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1"
fi fi
LAMOBJS="" if test "$yap_cv_mpi" != "no"; then
MPI_OBJS= if test "$yap_cv_mpi" != "yes"; then
LAM_MPI_CC=${MPI_CC} # Extract the first word of "mpicc", so it can be a program name with args.
if test "$yap_cv_lam" != "no" ; then set dummy mpicc; ac_word=$2
if test "$yap_cv_lam" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
LAM_MPI_CC="$yap_cv_lam"/bin/mpicc $as_echo_n "checking for $ac_word... " >&6; }
MPI_CC="$yap_cv_lam"/bin/mpicc if ${ac_cv_path_MPI_CC+:} false; then :
CPPFLAGS="$CPPFLAGS -I ${yap_cv_lam}/include" $as_echo_n "(cached) " >&6
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
else else
LAMOBJS="" case $MPI_CC in
$as_echo "#define HAVE_LIBMPI 0" >>confdefs.h [\\/]* | ?:[\\/]*)
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 fi
CC=${OLD_CC} else
elif test "$yap_cv_mpi" != "no"; 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
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} OLD_CC=${CC}
CC=${MPI_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 for ac_header in mpi.h
do : do :
ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default"
@ -8779,7 +8637,6 @@ fi
done done
CC=${OLD_CC} CC=${OLD_CC}
MPI_LIBS=
if test "$yap_cv_mpe" != "no" if test "$yap_cv_mpe" != "no"
then then
OLD_CC=${CC} OLD_CC=${CC}
@ -8848,7 +8705,8 @@ done
CC=${OLD_CC} CC=${OLD_CC}
fi fi
else else
MPI_CC=${CC} INSTALL_MPI="# "
MPI_CC=${CC}
fi fi
@ -10289,7 +10147,7 @@ _ACEOF
fi fi
done done
for ac_func in gethrtime getpagesize for ac_func in gethrtime getpagesize getpid
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 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], [ --with-mpi[=DIR] use LAM/MPI library in DIR],
if test "$withval" = yes; then if test "$withval" = yes; then
dnl handle UBUNTU systems dnl handle UBUNTU systems
yap_cv_lam=yes yap_cv_mpi=yes
elif test "$withval" = no; then elif test "$withval" = no; then
yap_cv_lam=no yap_cv_mpi=no
else else
yap_cv_lam=$with_mpi yap_cv_mpi=$with_mpi
LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib" LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include" CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
fi, fi,
[yap_cv_lam=no]) [yap_cv_mpi=no])
AC_ARG_WITH(mpe, AC_ARG_WITH(mpe,
@ -400,19 +400,6 @@ AC_ARG_WITH(mpe,
fi, fi,
[yap_cv_mpe=no]) [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, AC_ARG_WITH(heap-space,
[ --with-heap-space[=space] default heap size in Kbytes], [ --with-heap-space[=space] default heap size in Kbytes],
if test "$withval" = yes; then if test "$withval" = yes; then
@ -612,7 +599,9 @@ then
C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
case "`$CC --version < /dev/null`" in case "`$CC --version < /dev/null`" in
*3.4*) CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;; *3.4*)
CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS"
;;
esac esac
case "$target_cpu" in case "$target_cpu" in
i*86*) i*86*)
@ -697,7 +686,6 @@ AC_PROG_LN_S
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_RANLIB AC_PROG_RANLIB
AC_CHECK_TOOL(AR,ar,:) 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(INSTALL_INFO,install-info,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
AC_PATH_PROG(SHELL,sh) AC_PATH_PROG(SHELL,sh)
@ -1533,6 +1521,12 @@ dnl Linux has both elf and a.out, in this case we found elf
;; ;;
esac esac
if test "$CC" = icc
then
MPI_CC="$CC"
yap_cv_mpi=no
fi
if test "$dynamic_loading" = "yes" if test "$dynamic_loading" = "yes"
then then
YAPLIB_CFLAGS="$SHLIB_CFLAGS" YAPLIB_CFLAGS="$SHLIB_CFLAGS"
@ -1643,53 +1637,20 @@ if test "$tabling" = "yes"
fi fi
dnl LAM/MPI interface dnl LAM/MPI interface
LAMOBJS="" if test "$yap_cv_mpi" != "no"; then
MPI_OBJS= if test "$yap_cv_mpi" != "yes"; then
LAM_MPI_CC=${MPI_CC} AC_PATH_PROG(MPI_CC,mpicc,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
if test "$yap_cv_lam" != "no" ; then else
if test "$yap_cv_lam" != "yes" ; then AC_PATH_PROG(MPI_CC,mpicc,true,$yap_cv_mpi/bin:$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
LAM_MPI_CC="$yap_cv_lam"/bin/mpicc fi
MPI_CC="$yap_cv_lam"/bin/mpicc MPILDF=`"$MPI_CC" --showme:link`
CPPFLAGS="$CPPFLAGS -I ${yap_cv_lam}/include" MPICF=`"$MPI_CC" --showme:compile`
LDFLAGS="$LDFLAGS -L${yap_cv_lam}/lib" LIBS="$LIBS $MPILDF"
fi INSTALL_MPI=""
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
OLD_CC=${CC} OLD_CC=${CC}
CC=${MPI_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) AC_CHECK_HEADERS(mpi.h)
CC=${OLD_CC} CC=${OLD_CC}
MPI_LIBS=
if test "$yap_cv_mpe" != "no" if test "$yap_cv_mpe" != "no"
then then
OLD_CC=${CC} OLD_CC=${CC}
@ -1706,7 +1667,8 @@ elif test "$yap_cv_mpi" != "no"; then
CC=${OLD_CC} CC=${OLD_CC}
fi fi
else else
MPI_CC=${CC} INSTALL_MPI="# "
MPI_CC=${CC}
fi fi
@ -1910,16 +1872,16 @@ AC_SUBST(JAR)
AC_SUBST(LIBJPL) AC_SUBST(LIBJPL)
AC_SUBST(IN_UNIX) AC_SUBST(IN_UNIX)
AC_SUBST(YAPMPILIB) AC_SUBST(YAPMPILIB)
AC_SUBST(LAM_MPI_CC) AC_SUBST(INSTALL_MPI)
AC_SUBST(MPI_OBJS) AC_SUBST(MPI_CC)
AC_SUBST(MPI_LIBS) AC_SUBST(MPILDF)
AC_SUBST(MPICF)
AC_SUBST(INSTALL_COMMAND) AC_SUBST(INSTALL_COMMAND)
AC_SUBST(INSTALLCLP) AC_SUBST(INSTALLCLP)
AC_SUBST(JPLCFLAGS) AC_SUBST(JPLCFLAGS)
AC_SUBST(JPLLIBS) AC_SUBST(JPLLIBS)
AC_SUBST(JAVALIBS) AC_SUBST(JAVALIBS)
AC_SUBST(JPLCFLAGS) AC_SUBST(JPLCFLAGS)
AC_SUBST(LAMOBJS)
AC_SUBST(MAX_WORKERS) AC_SUBST(MAX_WORKERS)
AC_SUBST(STATIC_MODE) AC_SUBST(STATIC_MODE)
AC_SUBST(ENABLE_WINCONSOLE) 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(fesettrapenable fgetpos finite fpclass ftime ftruncate getcwd getenv)
AC_CHECK_FUNCS(getexecname) AC_CHECK_FUNCS(getexecname)
AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname) 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(getpwnam getrlimit getrusage gettimeofday getwd)
AC_CHECK_FUNCS(isatty isnan isinf kill labs link lgamma) AC_CHECK_FUNCS(isatty isnan isinf kill labs link lgamma)
AC_CHECK_FUNCS(localtime lstat mallinfo) AC_CHECK_FUNCS(localtime lstat mallinfo)

View File

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

View File

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

View File

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

View File

@ -5039,10 +5039,66 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
return p; 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 static void
init_yap(void) init_yap(void)
{ {
GET_LD GET_LD
#ifdef THREADS
initMutexes();
#endif
/* we need encodings first */ /* we need encodings first */
initCharTypes(); initCharTypes();
initPrologFlags(); initPrologFlags();

View File

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

View File

@ -997,6 +997,9 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
{ GET_LD { GET_LD
PL_chars_t txt; 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(+, -) */ if ( !bindings && PL_is_variable(atom) ) /* term_to_atom(+, -) */
{ char buf[1024]; { char buf[1024];
size_t bufsize = sizeof(buf); 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.storage = PL_CHARS_HEAP;
txt.encoding = ENC_UTF8; txt.encoding = ENC_UTF8;
txt.canonical = FALSE; 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); rval = PL_unify_text(atom, 0, &txt, PL_ATOM);
Sclose(stream); Sclose(stream);

View File

@ -2255,9 +2255,11 @@ Svsprintf(char *buf, const char *fm, va_list args)
int int
Svdprintf(const char *fm, va_list args) Svdprintf(const char *fm, va_list args)
{ int rval; { 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); rval = Svfprintf(s, fm, args);
#if defined(_DEBUG) && defined(__WINDOWS__) #if defined(_DEBUG) && defined(__WINDOWS__)
Sputc('\0', s); Sputc('\0', s);
@ -2266,7 +2268,8 @@ Svdprintf(const char *fm, va_list args)
#endif #endif
if ( Sflush(s) != 0 ) if ( Sflush(s) != 0 )
rval = -1; rval = -1;
Sunlock(s); //Sunlock(s);
//Sclose(s);
return rval; return rval;
} }

View File

@ -107,8 +107,25 @@ compile-time
simpleMutexUnlock(&(cm)->mutex); \ simpleMutexUnlock(&(cm)->mutex); \
} while(0) } 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_LOCK(id) IF_MT(id, countingMutexLock(&_PL_mutexes[id]))
#define PL_UNLOCK(id) IF_MT(id, countingMutexUnlock(&_PL_mutexes[id])) #define PL_UNLOCK(id) IF_MT(id, countingMutexUnlock(&_PL_mutexes[id]))
#endif
#undef O_DEBUG_MT
#define IOLOCK recursiveMutex #define IOLOCK recursiveMutex

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -364,6 +364,7 @@ thread_exit(Term) :-
fail. fail.
'$run_at_thread_exit'(Id0) :- '$run_at_thread_exit'(Id0) :-
recorded('$thread_exit_hook',[Id0|Hook],R), erase(R), 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), catch(once(Hook),_,fail),
fail. fail.
'$run_at_thread_exit'(_). '$run_at_thread_exit'(_).
@ -374,7 +375,8 @@ thread_at_exit(Goal) :-
recordz('$thread_exit_hook',[Id0|Goal],_). recordz('$thread_exit_hook',[Id0|Goal],_).
current_thread(Id, Status) :- current_thread(Id, Status) :-
thread_property(Id, status(Status)). catch(thread_property(Id, status(Status)),
error(existence_error(_,_),_), fail).
'$thread_id_alias'(Id, Alias) :- '$thread_id_alias'(Id, Alias) :-

View File

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