Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3

This commit is contained in:
Vítor Santos Costa 2012-03-06 14:12:39 +00:00
commit fd0cf6ee14
13 changed files with 14819 additions and 4121 deletions

View File

@ -3034,14 +3034,6 @@ Yap_absmi(int inp)
if (LOCAL_PrologMode & (AbortMode|InterruptMode)) {
CreepFlag = CalculateStackGap();
UNLOCK(LOCAL_SignalLock);
/* same instruction */
if (LOCAL_PrologMode & InterruptMode) {
LOCAL_PrologMode &= ~InterruptMode;
SET_ASP(YREG, E_CB*sizeof(CELL));
saveregs();
Yap_ProcessSIGINT();
setregs();
}
JMPNext();
}
UNLOCK(LOCAL_SignalLock);
@ -8562,7 +8554,7 @@ Yap_absmi(int inp)
d0 = XREG(PREG->u.xl.x);
deref_head(d0, atom_x_unk);
atom_x_nvar:
if (IsAtomTerm(d0)) {
if (IsAtomTerm(d0) && !IsBlob(AtomOfTerm(d0))) {
PREG = NEXTOP(PREG, xl);
GONext();
}
@ -8586,7 +8578,7 @@ Yap_absmi(int inp)
d0 = *pt0;
deref_head(d0, atom_y_unk);
atom_y_nvar:
if (IsAtomTerm(d0)) {
if (IsAtomTerm(d0) && !IsBlob(AtomOfTerm(d0))) {
PREG = NEXTOP(PREG, yl);
GONext();
}

View File

@ -74,18 +74,6 @@ LeaveGrowMode(prolog_exec_mode grow_mode)
{
CACHE_REGS
LOCAL_PrologMode &= ~grow_mode;
if (LOCAL_PrologMode & AbortMode) {
CACHE_REGS
LOCAL_PrologMode &= ~AbortMode;
Yap_Error(PURE_ABORT, TermNil, "");
/* in case someone mangles the P register */
save_machine_regs();
#if _MSC_VER || defined(__MINGW32__)
/* don't even think about trying this */
#else
Yap_RestartYap( 1 );
#endif
}
}
@ -822,10 +810,10 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
UNLOCK(LOCAL_SignalLock);
}
ASP -= 256;
YAPEnterCriticalSection();
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
LOCAL_XDiff = LOCAL_HDiff = 0;
LOCAL_GSplit = NULL;
YAPEnterCriticalSection();
SetHeapRegs(FALSE PASS_REGS);
MoveLocalAndTrail( PASS_REGS1 );
if (fix_code) {
@ -849,10 +837,10 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
AdjustStacksAndTrail(0, FALSE PASS_REGS);
}
AdjustRegs(MaxTemps PASS_REGS);
YAPLeaveCriticalSection();
ASP += 256;
if (minimal_request)
Yap_AllocHole(minimal_request, size);
YAPLeaveCriticalSection();
growth_time = Yap_cputime()-start_growth_time;
LOCAL_total_heap_overflow_time += growth_time;
if (gc_verbose) {
@ -1406,9 +1394,8 @@ growatomtable( USES_REGS1 )
if (HeapTop + sizeof(YAP_SEG_SIZE) > HeapLim - MinHeapGap) {
/* make sure there is no heap overflow */
int res;
YAPEnterCriticalSection();
res = do_growheap(FALSE, 0, NULL, NULL, NULL, NULL PASS_REGS);
YAPLeaveCriticalSection();
return res;
} else {
return TRUE;
@ -1744,7 +1731,9 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
#if USE_SYSTEM_MALLOC
execute_growstack(size, TRUE, in_parser, old_trp, tksp, vep PASS_REGS);
#else
YAPEnterCriticalSection();
if (!Yap_ExtendWorkSpace(size)) {
YAPLeaveCriticalSection();
LOCAL_ErrorMessage = NULL;
if (contiguous_only) {
/* I can't expand in this case */
@ -1753,7 +1742,6 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
}
execute_growstack(size, TRUE, in_parser, old_trp, tksp, vep PASS_REGS);
} else {
YAPEnterCriticalSection();
if (in_parser) {
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_BaseDiff = LOCAL_DelayDiff = LOCAL_XDiff = LOCAL_HDiff = LOCAL_GDiff0 = 0;
AdjustScannerStacks(tksp, vep PASS_REGS);

View File

@ -4148,8 +4148,9 @@ LeaveGCMode( USES_REGS1 )
LOCAL_PrologMode &= ~GCMode;
if (LOCAL_PrologMode & AbortMode) {
LOCAL_PrologMode &= ~AbortMode;
Yap_Error(PURE_ABORT, TermNil, "");
P = FAILCODE;
/* in case someone mangles the P register */
Yap_Error(PURE_ABORT, TermNil, "abort from console");
Yap_RestartYap( 1 );
}
}

View File

@ -47,7 +47,7 @@ p_atom( USES_REGS1 )
d0 = ARG1;
deref_head(d0, atom_unk);
atom_nvar:
if (IsAtomTerm(d0)) {
if (IsAtomTerm(d0) && !IsBlob(AtomOfTerm(d0))) {
return(TRUE);
}
else {

View File

@ -1553,15 +1553,14 @@ void (*handler)(int);
static int
InteractSIGINT(int ch) {
CACHE_REGS
LOCAL_PrologMode |= AsyncIntMode;
switch (ch) {
case 'a':
/* abort computation */
if (LOCAL_PrologMode & (GCMode|ConsoleGetcMode|GrowStackMode|GrowHeapMode)) {
if (LOCAL_PrologMode & (GCMode|ConsoleGetcMode|CritMode)) {
LOCAL_PrologMode |= AbortMode;
return -1;
} else {
Yap_Error(PURE_ABORT, TermNil, "abort from console");
/* in case someone mangles the P register */
}
LOCAL_PrologMode &= ~AsyncIntMode;
Yap_RestartYap( 1 );
@ -1569,44 +1568,36 @@ InteractSIGINT(int ch) {
case 'b':
/* continue */
Yap_signal (YAP_BREAK_SIGNAL);
LOCAL_PrologMode &= ~AsyncIntMode;
return 1;
case 'c':
/* continue */
return 1;
case 'd':
Yap_signal (YAP_DEBUG_SIGNAL);
LOCAL_PrologMode &= ~AsyncIntMode;
/* enter debug mode */
return 1;
case 'e':
/* exit */
LOCAL_PrologMode &= ~AsyncIntMode;
Yap_exit(0);
return -1;
case 'g':
/* exit */
Yap_signal (YAP_STACK_DUMP_SIGNAL);
LOCAL_PrologMode &= ~AsyncIntMode;
return -1;
case 't':
/* start tracing */
Yap_signal (YAP_TRACE_SIGNAL);
LOCAL_PrologMode &= ~AsyncIntMode;
return 1;
#ifdef LOW_LEVEL_TRACER
case 'T':
toggle_low_level_trace();
LOCAL_PrologMode &= ~AsyncIntMode;
return 1;
#endif
case 's':
/* show some statistics */
Yap_signal (YAP_STATISTICS_SIGNAL);
LOCAL_PrologMode &= ~AsyncIntMode;
return 1;
case EOF:
LOCAL_PrologMode &= ~AsyncIntMode;
return(0);
break;
case 'h':
@ -1617,7 +1608,6 @@ InteractSIGINT(int ch) {
fprintf(GLOBAL_stderr, " a for abort\n c for continue\n d for debug\n");
fprintf(GLOBAL_stderr, " e for exit\n g for stack dump\n s for statistics\n t for trace\n");
fprintf(GLOBAL_stderr, " b for break\n");
LOCAL_PrologMode &= ~AsyncIntMode;
return(0);
}
}
@ -1631,19 +1621,15 @@ ProcessSIGINT(void)
{
int ch, out;
LOCAL_PrologMode |= AsyncIntMode;
do {
ch = Yap_GetCharForSIGINT();
} while (!(out = InteractSIGINT(ch)));
LOCAL_PrologMode &= ~AsyncIntMode;
LOCAL_PrologMode &= ~InterruptMode;
return(out);
}
int
Yap_ProcessSIGINT(void)
{
return ProcessSIGINT();
}
#if !_MSC_VER && !defined(__MINGW32__)
#if HAVE_SIGNAL
@ -1662,6 +1648,7 @@ HandleSIGINT (int sig)
#endif
{
CACHE_REGS
/* fprintf(stderr,"mode = %x\n",LOCAL_PrologMode); */
my_signal(SIGINT, HandleSIGINT);
/* do this before we act */
#if HAVE_ISATTY
@ -1673,8 +1660,9 @@ HandleSIGINT (int sig)
if (LOCAL_InterruptsDisabled) {
return;
}
if (LOCAL_PrologMode & (CritMode|ConsoleGetcMode)) {
if (LOCAL_PrologMode & ConsoleGetcMode) {
LOCAL_PrologMode |= InterruptMode;
return;
}
#ifdef HAVE_SETBUF
/* make sure we are not waiting for the end of line */

View File

@ -4223,10 +4223,9 @@ camacho_dum( USES_REGS1 )
int
Yap_IsListTerm(Term t)
{
while (!IsVarTerm(t) && IsPairTerm(t)) {
t = TailOfTerm(t);
}
return t == TermNil;
Term *tailp;
Yap_SkipList(&t, &tailp);
return *tailp == TermNil;
}
static Int

15
H/Yap.h
View File

@ -615,10 +615,6 @@ typedef enum
LOCAL_CritLocks--; \
if (!LOCAL_CritLocks) { \
LOCAL_PrologMode &= ~CritMode; \
if (LOCAL_PrologMode & InterruptMode) { \
LOCAL_PrologMode &= ~InterruptMode; \
Yap_ProcessSIGINT(); \
} \
if (LOCAL_PrologMode & AbortMode) { \
LOCAL_PrologMode &= ~AbortMode; \
Yap_Error(PURE_ABORT, 0, ""); \
@ -636,13 +632,10 @@ typedef enum
#define YAPLeaveCriticalSection() \
{ \
LOCAL_PrologMode &= ~CritMode; \
if (LOCAL_PrologMode & InterruptMode) { \
LOCAL_PrologMode &= ~InterruptMode; \
Yap_ProcessSIGINT(); \
} \
if (LOCAL_PrologMode & AbortMode) { \
LOCAL_PrologMode &= ~AbortMode; \
Yap_Error(PURE_ABORT, 0, ""); \
Yap_RestartYap( 1 ); \
} \
/* UNLOCK(BGL); */ \
}
@ -657,13 +650,9 @@ typedef enum
LOCAL_CritLocks--; \
if (!LOCAL_CritLocks) { \
LOCAL_PrologMode &= ~CritMode; \
if (LOCAL_PrologMode & InterruptMode) { \
LOCAL_PrologMode &= ~InterruptMode; \
Yap_ProcessSIGINT(); \
} \
if (LOCAL_PrologMode & AbortMode) { \
LOCAL_PrologMode &= ~AbortMode; \
Yap_Error(PURE_ABORT, 0, ""); \
Yap_RestartYap( 1 ); \
} \
} \
}

View File

@ -356,7 +356,6 @@ void STD_PROTO(Yap_InitSysbits,(void));
void STD_PROTO(Yap_InitSysPreds,(void));
void STD_PROTO(Yap_InitTime,(void));
int STD_PROTO(Yap_TrueFileName, (char *, char *, int));
int STD_PROTO(Yap_ProcessSIGINT,(void));
double STD_PROTO(Yap_random, (void));
#ifdef _WIN32
char *STD_PROTO(Yap_RegistryGetString,(char *));

18668
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -241,7 +241,7 @@ AC_ARG_WITH(R,
else
yap_cv_R=$with_R
fi,
[yap_cv_R=yes])
[yap_cv_R=no])
dnl best test we could do.
AC_ARG_WITH(minisat,
@ -257,28 +257,73 @@ AC_ARG_WITH(minisat,
AC_ARG_WITH(cudd,
[ --with-cudd[=DIR] use CUDD package in DIR],
if test "$withval" = yes; then
if test "$prefix" = "NONE"; then
yap_cv_cudd=/usr/local/cudd
yap_cv_cudd="$withval"
if test "$withval" != no; then
oldlibs="$LIBS"
if test "$withval" != "yes"; then
if test -d "$yap_cv_cudd"/include/cudd; then
CUDD_CPPFLAGS="-I $yap_cv_cudd/include/cudd"
else
CUDD_CPPFLAGS="-I $yap_cv_cudd/include"
fi
cudd_dir="$yap_cv_cudd"
elif test -e /usr/include/cudd; then
CUDD_CPPFLAGS="-I /usr/include/cudd"
cudd_dir="$withval"
elif test "$prefix" != "NONE"; then
if test -d "$prefix"/include/cudd; then
CUDD_CPPFLAGS="-I $prefix/include/cudd"
else
CUDD_CPPFLAGS="-I $prefix/include"
fi
cudd_dir="$prefix"
else
yap_cv_cudd=$prefix/cudd;
fi
CUDD_LDFLAGS="-L $yap_cv_cudd/lib -lcudd -lmtr -lst -lutil -lepd"
CUDD_CPPFLAGS="-I $yap_cv_cudd/include"
elif test "$withval" = no; then
yap_cv_cudd=no
elif test "$withval" = /opt/local; then
yap_cv_cudd=$with_cudd
CUDD_LDFLAGS="-L/opt/local/lib/cudd -lcudd"
CUDD_CPPFLAGS="-I /opt/local/include/cudd"
elif test "$withval" = /usr; then
yap_cv_cudd=$with_cudd
CUDD_LDFLAGS="-lcudd -lmtr -lcuddst -lcuddutil -lepd"
CUDD_CPPFLAGS="-I /usr/include/cudd"
else
yap_cv_cudd=$with_cudd
CUDD_LDFLAGS="$yap_cv_cudd/cudd/libcudd.a $yap_cv_cudd/mtr/libmtr.a $yap_cv_cudd/st/libst.a $yap_cv_cudd/util/libutil.a $yap_cv_cudd/epd/libepd.a"
CUDD_CPPFLAGS="-I $yap_cv_cudd/include"
if test -d /usr/local/include/cudd; then
CUDD_CPPFLAGS="-I /usr/local/include/cudd"
fi
cudd_dir=/usr/local
fi
dnl cudd can be most everywhere
if test -d "$cudd_dir/lib64/cudd" -a "$YAP_TARGET" = amd64; then
LIBS="$LIBS -L $cudd_dir/lib64/cudd"
elif test -d "$cudd_dir/lib64" -a "$YAP_TARGET" = amd64; then
LIBS="$LIBS -L $cudd_dir/lib64"
elif test -d "$cudd_dir/lib/cudd"; then
LIBS="$LIBS -L $cudd_dir/lib/cudd"
elif test -d "$cudd_dir/lib"; then
LIBS="$LIBS -L $cudd_dir/lib"
fi
if test -d "$cudd_dir/util"; then
LIBS="$LIBS -L $cudd_dir/util"
fi
AC_SEARCH_LIBS(util_print_cpu_stats, [cuddutil util])
if test -d "$cudd_dir/st"; then
LIBS="$LIBS -L $cudd_dir/st"
fi
AC_SEARCH_LIBS(st_insert, [cuddst st])
if test -d "$cudd_dir/epd"; then
LIBS="$LIBS -L $cudd_dir/epd"
fi
AC_SEARCH_LIBS(EpdAdd, epd)
if test -d "$cudd_dir/mtr"; then
LIBS="$LIBS -L $cudd_dir/mtr"
fi
AC_SEARCH_LIBS(Mtr_InitTree, [mtr])
if test -d "$cudd_dir/cudd"; then
LIBS="$LIBS -L $cudd_dir/cudd"
fi
AC_SEARCH_LIBS(Cudd_Init, [cudd], [cudd_installed="yes"], [cudd_installed="no"])
if test "$cudd_installed" = yes; then
CUDD_LDFLAGS="$LIBS"
else
cat << EOF
##################################################################
# ERROR: Could not find cudd library. Either I don't have the
# correct path, or CUDD is installed in some strange way
##################################################################
EOF
fi
LIBS="$oldlibs"
fi,
[yap_cv_cudd=no])
@ -811,61 +856,38 @@ dnl fi
if test "$yap_cv_myddas" != "no"
then
dnl check for mysql
AC_MSG_CHECKING(for main in -lmysqlclient)
AC_CACHE_VAL(yap_cv_mysql,[
AC_TRY_COMPILE(
#include <mysql/mysql.h>
#include <stdio.h>
,
MYSQL *conn;
conn = mysql_init(NULL);
,
yap_cv_mysql=yes,yap_cv_mysql=no)])
AC_MSG_RESULT($yap_cv_mysql)
AC_SEARCH_LIBS(mysql_init, [mysqlclient], [yap_cv_mysql="yes"], [yap_cv_mysql="no"])
if test "$yap_cv_mysql" = yes
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_MYSQL"
LIBS="$LIBS -L${yap_cv_myddas}/lib/mysql -lmysqlclient "
fi
dnl check for odbc
AC_MSG_CHECKING(for main in -lodbc)
AC_CACHE_VAL(yap_cv_odbc,[
AC_TRY_COMPILE(
#include <sql.h>
#include <sqlucode.h>
#include <stdio.h>
,
SQLHENV henv;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
,
yap_cv_odbc=yes,yap_cv_odbc=no)])
AC_MSG_RESULT($yap_cv_odbc)
case "$target_os" in
*darwin*)
LIBS="$LIBS -framework CoreFoundation"
;;
**)
;;
esac
AC_SEARCH_LIBS(SQLAllocHandle, [odbc], [yap_cv_odbc="yes"], [yap_cv_odbc="no"])
if test "$yap_cv_odbc" = yes
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_ODBC"
case "$target_os" in
*darwin*)
LIBS="$LIBS -lodbc -framework CoreFoundation"
;;
**)
LIBS="$LIBS -lodbc"
;;
esac
fi
if test "$myddasstats" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_STATS"
fi
if test "$myddastoplevel" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_TOP_LEVEL"
fi
fi
if test "$myddasstats" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_STATS"
fi
if test "$myddastoplevel" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_TOP_LEVEL"
fi
if test "$threads" = yes
then
AC_CHECK_LIB(pthread,pthread_create)

View File

@ -602,10 +602,13 @@ raw_read2(ReadData _PL_rd ARG_LD)
discardBuffer(cbuf);
setErrorLocation(pos, _PL_rd);
rawSyntaxError("end_of_file_in_block_comment");
#ifndef __YAP_PROLOG__
/* YAP does not support comment levels in original scanner */
case '*':
if ( last == '/' )
level++;
break;
#endif
case '/':
if ( last == '*' &&
(--level == 0 || _PL_rd->strictness) )

View File

@ -293,11 +293,16 @@ use_module(M,F,Is) :-
!.
'$reset_if'(OldIfLevel) :-
catch(nb_getval('$if_level',OldIncludeLevel),_,fail), !,
catch(nb_getval('$if_level',OldIfLevel),_,fail), !,
nb_setval('$if_level',0).
'$reset_if'(0) :-
nb_setval('$if_level',0).
'$get_if'(Level0) :-
catch(nb_getval('$if_level',Level),_,fail), !,
Level0 = Level.
'$get_if'(0).
'$bind_module'(_, load_files).
'$bind_module'(Mod, use_module(Mod)).
@ -894,7 +899,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
%
'$if'(_,top) :- !, fail.
'$if'(Goal,_) :-
nb_getval('$if_level',Level0),
'$get_if'(Level0),
Level is Level0 + 1,
nb_setval('$if_level',Level),
nb_getval('$endif',OldEndif),
@ -919,7 +924,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
'$else'(top) :- !, fail.
'$else'(_) :-
nb_getval('$if_level',0), !,
'$get_if'(0), !,
'$do_error'(context_error(no_if),(:- else)).
% we have done an if, so just skip
'$else'(_) :-
@ -927,14 +932,14 @@ absolute_file_name(File,Opts,TrueFileName) :-
nb_setval('$if_skip_mode',skip).
% we can try the elif
'$else'(_) :-
nb_getval('$if_level',Level),
'$get_if'(Level),
nb_getval('$endif',elif(Level,OldEndif,Mode)),
nb_setval('$endif',endif(Level,OldEndif,Mode)),
nb_setval('$if_skip_mode',run).
'$elif'(_,top) :- !, fail.
'$elif'(Goal,_) :-
nb_getval('$if_level',0),
'$get_if'(0),
'$do_error'(context_error(no_if),(:- elif(Goal))).
% we have done an if, so just skip
'$elif'(_,_) :-
@ -942,7 +947,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
nb_setval('$if_skip_mode',skip).
% we can try the elif
'$elif'(Goal,_) :-
nb_getval('$if_level',Level),
'$get_if'(Level),
nb_getval('$endif',elif(Level,OldEndif,Mode)),
('$if_call'(Goal)
->
@ -958,11 +963,11 @@ absolute_file_name(File,Opts,TrueFileName) :-
'$endif'(top) :- !, fail.
'$endif'(_) :-
% unmmatched endif.
nb_getval('$if_level',0),
'$get_if'(0),
'$do_error'(context_error(no_if),(:- endif)).
'$endif'(_) :-
% back to where you belong.
nb_getval('$if_level',Level),
'$get_if'(Level),
nb_getval('$endif',Endif),
Level0 is Level-1,
nb_setval('$if_level',Level0),

View File

@ -743,19 +743,19 @@ yap_flag(user_input,OUT) :-
var(OUT), !,
stream_property(OUT,alias(user_input)).
yap_flag(user_input,Stream) :-
set_stream(Stream, alias(user_input).
set_stream(Stream, alias(user_input)).
yap_flag(user_output,OUT) :-
var(OUT), !,
stream_property(OUT,alias(user_output)).
yap_flag(user_output,Stream) :-
set_stream(Stream, alias(user_output).
set_stream(Stream, alias(user_output)).
yap_flag(user_error,OUT) :-
var(OUT), !,
stream_property(OUT,alias(user_error)).
yap_flag(user_error,Stream) :-
set_stream(Stream, alias(user_error).
set_stream(Stream, alias(user_error)).
yap_flag(debugger_print_options,OUT) :-
var(OUT),