isupport opaque type testing.

This commit is contained in:
Vitor Santos Costa 2013-09-19 14:23:10 +01:00
parent ad9a973a26
commit 448380c715
1 changed files with 19 additions and 0 deletions

View File

@ -390,6 +390,24 @@ p_has_bignums( USES_REGS1 )
#endif
}
static Int
p_is_opaque( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsVarTerm(t))
return FALSE;
if (IsApplTerm(t)) {
Functor f = FunctorOfTerm(t);
CELL *pt;
if (f != FunctorBigInt)
return FALSE;
pt = RepAppl(t);
return ( pt[1] != BIG_RATIONAL || pt[1] != BIG_INT );
}
return FALSE;
}
static Int
p_is_rational( USES_REGS1 )
{
@ -594,5 +612,6 @@ Yap_InitBigNums(void)
Yap_InitCPred("$bignum", 1, p_is_bignum, SafePredFlag);
Yap_InitCPred("rational", 3, p_rational, 0);
Yap_InitCPred("rational", 1, p_is_rational, SafePredFlag);
Yap_InitCPred("opaque", 1, p_is_opaque, SafePredFlag);
Yap_InitCPred("nb_set_bit", 2, p_nb_set_bit, SafePredFlag);
}