fix count clauses

fix bigint in index.c


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@824 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-05-01 21:07:11 +00:00
parent 9a498e00f3
commit 6e17ac0070
2 changed files with 12 additions and 11 deletions

View File

@ -1445,7 +1445,6 @@ p_number_of_clauses(void)
Term t2 = Deref(ARG2); Term t2 = Deref(ARG2);
int ncl = 0; int ncl = 0;
Prop pe; Prop pe;
yamop *q;
int mod; int mod;
if (IsVarTerm(t2) || !IsAtomTerm(t2)) { if (IsVarTerm(t2) || !IsAtomTerm(t2)) {
@ -1458,19 +1457,13 @@ p_number_of_clauses(void)
} else if (IsApplTerm(t)) { } else if (IsApplTerm(t)) {
register Functor f = FunctorOfTerm(t); register Functor f = FunctorOfTerm(t);
pe = PredPropByFunc(f, mod); pe = PredPropByFunc(f, mod);
} else } else {
return (FALSE); return (FALSE);
q = RepPredProp(pe)->cs.p_code.FirstClause; }
READ_LOCK(RepPredProp(pe)->PRWLock); READ_LOCK(RepPredProp(pe)->PRWLock);
if (q != NIL) { ncl = RepPredProp(pe)->cs.p_code.NOfClauses;
while (q != RepPredProp(pe)->cs.p_code.LastClause) {
ncl++;
q = NextClause(q);
}
}
READ_UNLOCK(RepPredProp(pe)->PRWLock); READ_UNLOCK(RepPredProp(pe)->PRWLock);
t = MkIntegerTerm(ncl); return (Yap_unify_constant(ARG3, MkIntegerTerm(ncl)));
return (Yap_unify_constant(ARG3, t));
} }
static Int static Int

View File

@ -1124,7 +1124,11 @@ add_info(ClauseDef *clause, UInt regno)
case _get_bigint: case _get_bigint:
if (regcopy_in(myregs, nofregs, cl->u.xc.x)) { if (regcopy_in(myregs, nofregs, cl->u.xc.x)) {
clause->WorkPC = cl; clause->WorkPC = cl;
#ifdef USE_GMP
clause->Tag = AbsAppl((CELL *)FunctorBigInt); clause->Tag = AbsAppl((CELL *)FunctorBigInt);
#else
clause->Tag = AbsAppl((CELL *)FunctorLongInt);
#endif
return; return;
} else { } else {
cl = NEXTOP(cl,xc); cl = NEXTOP(cl,xc);
@ -1673,7 +1677,11 @@ add_arg_info(ClauseDef *clause, UInt argno)
case _unify_bigint: case _unify_bigint:
case _unify_l_bigint: case _unify_l_bigint:
if (argno == 1) { if (argno == 1) {
#ifdef USE_GMP
clause->Tag = AbsAppl((CELL *)FunctorBigInt); clause->Tag = AbsAppl((CELL *)FunctorBigInt);
#else
clause->Tag = AbsAppl((CELL *)FunctorLongInt);
#endif
return; return;
} }
argno--; argno--;