fix bug with very large integers
fix bug where indexing code was looking at code after a cut. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1513 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
f03fd0c1da
commit
3715f1b1d7
@ -33,12 +33,11 @@ static char SccsId[] = "%W% %G%";
|
||||
Term
|
||||
Yap_MkBigIntTerm(MP_INT *big)
|
||||
{
|
||||
int sz0 = mpz_sizeinbase(big, 2);
|
||||
Int nlimbs;
|
||||
MP_INT *dst = (MP_INT *)(H+1);
|
||||
CELL *ret = H;
|
||||
|
||||
if (sz0 < SIZEOF_LONG_INT*8-1) {
|
||||
if (mpz_fits_slong_p(big)) {
|
||||
int out = mpz_get_si(big);
|
||||
mpz_clear(big);
|
||||
return MkIntegerTerm(out);
|
||||
@ -72,12 +71,11 @@ Yap_MkBigIntTerm(MP_INT *big)
|
||||
Term
|
||||
Yap_MkBigIntTermCopy(MP_INT *big)
|
||||
{
|
||||
int sz0 = mpz_sizeinbase(big, 2);
|
||||
Int nlimbs;
|
||||
MP_INT *dst = (MP_INT *)(H+1);
|
||||
CELL *ret = H;
|
||||
|
||||
if (sz0 < SIZEOF_LONG_INT*8-1) {
|
||||
if (mpz_fits_slong_p(big)) {
|
||||
int out = mpz_get_si(big);
|
||||
return MkIntegerTerm(out);
|
||||
}
|
||||
|
@ -10,8 +10,11 @@
|
||||
* File: c_interface.c *
|
||||
* comments: c_interface primitives definition *
|
||||
* *
|
||||
* Last rev: $Date: 2006-01-02 03:35:44 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-01-16 02:57:51 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.80 2006/01/02 03:35:44 vsc
|
||||
* fix interface and docs
|
||||
*
|
||||
* Revision 1.79 2006/01/02 02:25:44 vsc
|
||||
* cannot release space from external GMPs.
|
||||
*
|
||||
@ -410,7 +413,7 @@ YAP_MkIntTerm(Int n)
|
||||
|
||||
I = MkIntegerTerm(n);
|
||||
RECOVER_H();
|
||||
return(I);
|
||||
return I;
|
||||
}
|
||||
|
||||
X_API Int
|
||||
|
25
C/index.c
25
C/index.c
@ -11,8 +11,13 @@
|
||||
* File: index.c *
|
||||
* comments: Indexing a Prolog predicate *
|
||||
* *
|
||||
* Last rev: $Date: 2005-12-23 00:20:13 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-01-16 02:57:51 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.150 2005/12/23 00:20:13 vsc
|
||||
* updates to gprof
|
||||
* support for __POWER__
|
||||
* Try to saveregs before longjmp.
|
||||
*
|
||||
* Revision 1.149 2005/12/17 03:25:39 vsc
|
||||
* major changes to support online event-based profiling
|
||||
* improve error discovery and restart on scanner.
|
||||
@ -1249,6 +1254,8 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
case _cut:
|
||||
case _cut_t:
|
||||
case _cut_e:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
case _allocate:
|
||||
case _deallocate:
|
||||
case _write_void:
|
||||
@ -1258,8 +1265,10 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
case _count_a_call:
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _save_b_x:
|
||||
case _commit_b_x:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
case _save_b_x:
|
||||
case _write_x_val:
|
||||
case _write_x_loc:
|
||||
case _write_x_var:
|
||||
@ -1400,10 +1409,12 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
cl = NEXTOP(cl,x);
|
||||
break;
|
||||
case _p_cut_by_x:
|
||||
cl = NEXTOP(cl,xF);
|
||||
break;
|
||||
case _save_b_y:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
case _commit_b_y:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
case _save_b_y:
|
||||
case _write_y_var:
|
||||
case _write_y_val:
|
||||
case _write_y_loc:
|
||||
@ -1535,8 +1546,8 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
cl = NEXTOP(cl,yF);
|
||||
break;
|
||||
case _p_cut_by_y:
|
||||
cl = NEXTOP(cl,yF);
|
||||
break;
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
case _p_execute:
|
||||
case _fcall:
|
||||
case _call:
|
||||
|
@ -232,7 +232,7 @@ read_int_overflow(const char *s, Int base, Int val)
|
||||
return t;
|
||||
#else
|
||||
/* try to scan it as a float */
|
||||
return(MkIntegerTerm(val));
|
||||
return MkIntegerTerm(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,11 @@
|
||||
|
||||
<h2>Yap-5.1.0:</h2>
|
||||
<ul>
|
||||
<li> FIXED: mktime was broken in WIN32.
|
||||
<li> FIXED: don't assume a fixed point for WIN32 memory allocation.
|
||||
<li> FIXED: scanner would convert LONG_MIN to bigint, but it can be
|
||||
represent as a LONG; fixed by using mpz_fits_slong_p (Roberto Bagnara). </li>
|
||||
<li> FIXED: indexing cut should stop looking after a cut!!!! (Paulo Moura).
|
||||
<li> FIXED: mktime was broken in WIN32. </li>
|
||||
<li> FIXED: don't assume a fixed point for WIN32 memory allocation. </li>
|
||||
<li> FIXED: don't call goal_expand when looking for handlers of undefined procedures. </li>
|
||||
<li> FIXED: always walk through modules in the same order when waking
|
||||
up variables (otherwise, breaks CLP(QR)). </li>
|
||||
|
228
configure
vendored
228
configure
vendored
@ -845,9 +845,6 @@ if test -n "$ac_init_help"; then
|
||||
Optional Features:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-cut-c support for executing c code when a cut occurs
|
||||
--enable-myddas enable the MYDDAS library
|
||||
--enable-myddas-stats enable the MYDDAS library statistics support
|
||||
--enable-tabling support tabling
|
||||
--enable-or-parallelism support or-parallelism as: env-copy,sba,a-cow
|
||||
--enable-depth-limit support depth-bound computation
|
||||
@ -2265,172 +2262,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-cut-c was given.
|
||||
if test "${enable_cut_c+set}" = set; then
|
||||
enableval="$enable_cut_c"
|
||||
cut_c="$enableval"
|
||||
else
|
||||
cut_c=no
|
||||
fi;
|
||||
# Check whether --enable-myddas was given
|
||||
# and if so, trys to guess which development libraries
|
||||
# (MySQL or ODBC) to use
|
||||
if test "${enable_myddas+set}" = set; then
|
||||
|
||||
#Tests for MySQL Devel Libraries
|
||||
echo "$as_me:$LINENO: checking for MySQL for MYDDAS" >&5
|
||||
echo $ECHO_N "checking for MySQL for MYDDAS... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_mysql_myddas+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <mysql/mysql.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
MYSQL *conn;
|
||||
conn = mysql_init(NULL);
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_mysql_myddas=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_mysql_myddas=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_mysql_myddas" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_mysql_myddas" >&6
|
||||
if test $ac_cv_lib_mysql_myddas = yes; then
|
||||
LIBS="-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv $LIBS"
|
||||
fi
|
||||
|
||||
|
||||
# Tests for ODBC Devel Libraries
|
||||
echo "$as_me:$LINENO: checking for ODBC for MYDDAS" >&5
|
||||
echo $ECHO_N "checking for ODBC for MYDDAS... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_ODBC_myddas+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lodbc $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <sql.h>
|
||||
#include <sqlucode.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
SQLHENV henv;
|
||||
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_odbc_myddas=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_odbc_myddas=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_odbc_myddas" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_odbc_myddas" >&6
|
||||
if test $ac_cv_lib_odbc_myddas = yes; then
|
||||
LIBS="-lodbc $LIBS"
|
||||
fi
|
||||
|
||||
|
||||
if test "$ac_cv_lib_mysql_myddas" = "no"
|
||||
then
|
||||
if test "$ac_cv_lib_odbc_myddas" = "no"
|
||||
then
|
||||
echo "-------------------------------"
|
||||
echo "--"
|
||||
echo "--"
|
||||
echo "--"
|
||||
echo "-- There\'s no devel libraries for MySQL or ODBC"
|
||||
echo "--"
|
||||
echo "--"
|
||||
echo "--"
|
||||
echo "-------------------------------"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --enable-myddas-stats was given.
|
||||
if test "${enable_myddas_stats+set}" = set; then
|
||||
enableval="$enable_myddas_stats"
|
||||
myddas_stats="$enableval"
|
||||
else
|
||||
myddas_stats=no
|
||||
fi;
|
||||
fi
|
||||
|
||||
# Check whether --enable-tabling or --disable-tabling was given.
|
||||
if test "${enable_tabling+set}" = set; then
|
||||
@ -6407,62 +6238,6 @@ case "$orparallelism" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$ac_cv_lib_mysql_myddas" = "yes"
|
||||
then
|
||||
if test "$cut_c" = "no"
|
||||
then
|
||||
echo
|
||||
echo
|
||||
echo "********************************************************"
|
||||
echo
|
||||
echo
|
||||
echo "!!!!!! WARNING !!!!!!"
|
||||
echo "The MyDDAS interface makes no sense without cut-c"
|
||||
echo "Please contact tiagosoares@ncc.up.pt for help"
|
||||
echo
|
||||
echo "Enabling cut-c"
|
||||
echo
|
||||
echo "********************************************************"
|
||||
echo
|
||||
echo
|
||||
cut_c="yes"
|
||||
fi
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_MYSQL"
|
||||
fi
|
||||
|
||||
if test "$ac_cv_lib_odbc_myddas" = "yes"
|
||||
then
|
||||
if test "$cut_c" = "no"
|
||||
then
|
||||
echo
|
||||
echo
|
||||
echo "********************************************************"
|
||||
echo
|
||||
echo
|
||||
echo "!!!!!! WARNING !!!!!!"
|
||||
echo "The MyDDAS interface makes no sense without cut-c"
|
||||
echo "Please contact tiagosoares@ncc.up.pt for help"
|
||||
echo
|
||||
echo "Enabling cut-c"
|
||||
echo
|
||||
echo "********************************************************"
|
||||
echo
|
||||
echo
|
||||
cut_c="yes"
|
||||
fi
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_ODBC"
|
||||
fi
|
||||
|
||||
if test "$myddas_stats" = "yes"
|
||||
then
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_STATS"
|
||||
fi
|
||||
|
||||
if test "$cut_c" = "yes"
|
||||
then
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DCUT_C=1"
|
||||
fi
|
||||
|
||||
if test "$tabling" = "yes"
|
||||
then
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1"
|
||||
@ -13090,7 +12865,8 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
for ac_func in acosh asinh atanh chdir ctime dlopen dup2
|
||||
|
||||
for ac_func in acosh asinh atanh atol chdir ctime dlopen dup2
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
|
Reference in New Issue
Block a user