fix gmpless blob handling

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1860 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2007-03-30 16:47:22 +00:00
parent a7cfc6e799
commit 0f5ccae3b7
4 changed files with 15 additions and 22 deletions

View File

@ -10,8 +10,11 @@
* File: c_interface.c *
* comments: c_interface primitives definition *
* *
* Last rev: $Date: 2007-03-22 11:12:20 $,$Author: vsc $ *
* Last rev: $Date: 2007-03-30 16:47:22 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.90 2007/03/22 11:12:20 vsc
* make sure that YAP_Restart does not restart a failed goal.
*
* Revision 1.89 2007/01/28 14:26:36 vsc
* WIN32 support
*
@ -513,6 +516,7 @@ X_API void *
YAP_BlobOfTerm(Term t)
{
MP_INT *src;
if (IsVarTerm(t))
return NULL;
if (!IsBigIntTerm(t))

View File

@ -10,7 +10,7 @@
* File: TermExt.h *
* mods: *
* comments: Extensions to standard terms for YAP *
* version: $Id: TermExt.h,v 1.12 2006-09-28 16:15:54 vsc Exp $ *
* version: $Id: TermExt.h,v 1.13 2007-03-30 16:47:22 vsc Exp $ *
*************************************************************************/
#ifdef USE_SYSTEM_MALLOC
@ -270,17 +270,12 @@ IsLongIntTerm (Term t)
typedef UInt mp_limb_t;
typedef struct {
int _mp_size, _mp_alloc;
Int _mp_size, _mp_alloc;
mp_limb_t *_mp_d;
} MP_INT;
#endif
#ifdef USE_GMP
Term STD_PROTO (Yap_MkBigIntTerm, (MP_INT *));
MP_INT *STD_PROTO (Yap_BigIntOfTerm, (Term));
inline EXTERN int IsBigIntTerm (Term);
inline EXTERN int
@ -289,6 +284,11 @@ IsBigIntTerm (Term t)
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorBigInt);
}
#ifdef USE_GMP
Term STD_PROTO (Yap_MkBigIntTerm, (MP_INT *));
MP_INT *STD_PROTO (Yap_BigIntOfTerm, (Term));
inline EXTERN void MPZ_SET (mpz_t, MP_INT *);
inline EXTERN void
@ -325,16 +325,6 @@ Yap_SizeOfBigInt (Term t)
#else
inline EXTERN int IsBigIntTerm (Term);
inline EXTERN int
IsBigIntTerm (Term t)
{
return (int) (FALSE);
}
inline EXTERN int IsLargeIntTerm (Term);

View File

@ -634,7 +634,7 @@ typedef CELL label;
save_pc(); \
save_y()
#if BF_FREE
#if BP_FREE
/* if we are using BP as a local register, we must save it whenever we leave absmi.c */
#define always_save_pc() save_pc()
#define always_set_pc() set_pc()

View File

@ -136,7 +136,7 @@ new_int_matrix(int ndims, int dims[], long int data[])
static YAP_Term
new_float_matrix(int ndims, int dims[], double data[])
{
unsigned int sz;
unsigned int sz;
unsigned int i, nelems=1;
YAP_Term blob;
int *mat;
@ -145,7 +145,7 @@ new_float_matrix(int ndims, int dims[], double data[])
for (i=0;i< ndims;i++) {
nelems *= dims[i];
}
sz = ((MAT_DIMS+1)*sizeof(int)+ndims*sizeof(int)+(nelems+1)*sizeof(double))/sizeof(YAP_CELL);
sz = ((MAT_DIMS+1)*sizeof(int)+ndims*sizeof(int)+(nelems+1)*sizeof(double)+(sizeof(YAP_CELL)-1))/sizeof(YAP_CELL);
blob = YAP_MkBlobTerm(sz);
if (blob == YAP_TermNil())
return FALSE;
@ -322,7 +322,6 @@ new_floats_matrix(void)
int ndims = YAP_IntOfTerm(YAP_ARG1);
YAP_Term tl = YAP_ARG2, out;
int dims[MAX_DIMS];
if (!scan_dims(ndims, tl, dims))
return FALSE;
out = new_float_matrix(ndims, dims, NULL);