more fixes for bignum support in PLStream.

This commit is contained in:
ubu32
2011-02-27 03:40:27 -08:00
parent 3c261305db
commit f2e8f2ac2e
4 changed files with 72 additions and 2 deletions

View File

@@ -1065,6 +1065,9 @@ writeTerm2(term_t t, int prec, write_options *options, bool arg)
}
}
#if __YAP_PROLOG__
t = Yap_CvtTerm(t);
#endif
if ( PL_get_atom(t, &a) )
{ if ( !arg && prec < 1200 && priorityOperator((Module)NULL, a) > 0 )
{ if ( PutOpenBrace(out) &&

View File

@@ -381,9 +381,14 @@ PL_get_number(term_t l, number *n) {
n->type = V_INTEGER;
n->value.i = YAP_IntOfTerm(t);
#ifdef O_GMP
} else {
} else if (YAP_IsBigNumTerm(t)) {
n->type = V_MPZ;
mpz_init(&n->value.mpq);
YAP_BigNumOfTerm(t, &n->value.mpz);
} else {
n->type = V_MPQ;
mpq_init(&n->value.mpq);
YAP_RationalOfTerm(t, &n->value.mpq);
#endif
}
}

View File

@@ -149,6 +149,8 @@ void PL_license(const char *license, const char *module);
#define isTaggedInt(A) YAP_IsIntTerm(A)
#define valInt(A) YAP_IntOfTerm(A)
extern term_t Yap_CvtTerm(term_t ts);
#define clearNumber(n)
inline static int