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:
parent
9a498e00f3
commit
6e17ac0070
15
C/cdmgr.c
15
C/cdmgr.c
@ -1445,7 +1445,6 @@ p_number_of_clauses(void)
|
||||
Term t2 = Deref(ARG2);
|
||||
int ncl = 0;
|
||||
Prop pe;
|
||||
yamop *q;
|
||||
int mod;
|
||||
|
||||
if (IsVarTerm(t2) || !IsAtomTerm(t2)) {
|
||||
@ -1458,19 +1457,13 @@ p_number_of_clauses(void)
|
||||
} else if (IsApplTerm(t)) {
|
||||
register Functor f = FunctorOfTerm(t);
|
||||
pe = PredPropByFunc(f, mod);
|
||||
} else
|
||||
} else {
|
||||
return (FALSE);
|
||||
q = RepPredProp(pe)->cs.p_code.FirstClause;
|
||||
READ_LOCK(RepPredProp(pe)->PRWLock);
|
||||
if (q != NIL) {
|
||||
while (q != RepPredProp(pe)->cs.p_code.LastClause) {
|
||||
ncl++;
|
||||
q = NextClause(q);
|
||||
}
|
||||
}
|
||||
READ_LOCK(RepPredProp(pe)->PRWLock);
|
||||
ncl = RepPredProp(pe)->cs.p_code.NOfClauses;
|
||||
READ_UNLOCK(RepPredProp(pe)->PRWLock);
|
||||
t = MkIntegerTerm(ncl);
|
||||
return (Yap_unify_constant(ARG3, t));
|
||||
return (Yap_unify_constant(ARG3, MkIntegerTerm(ncl)));
|
||||
}
|
||||
|
||||
static Int
|
||||
|
@ -1124,7 +1124,11 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
case _get_bigint:
|
||||
if (regcopy_in(myregs, nofregs, cl->u.xc.x)) {
|
||||
clause->WorkPC = cl;
|
||||
#ifdef USE_GMP
|
||||
clause->Tag = AbsAppl((CELL *)FunctorBigInt);
|
||||
#else
|
||||
clause->Tag = AbsAppl((CELL *)FunctorLongInt);
|
||||
#endif
|
||||
return;
|
||||
} else {
|
||||
cl = NEXTOP(cl,xc);
|
||||
@ -1673,7 +1677,11 @@ add_arg_info(ClauseDef *clause, UInt argno)
|
||||
case _unify_bigint:
|
||||
case _unify_l_bigint:
|
||||
if (argno == 1) {
|
||||
#ifdef USE_GMP
|
||||
clause->Tag = AbsAppl((CELL *)FunctorBigInt);
|
||||
#else
|
||||
clause->Tag = AbsAppl((CELL *)FunctorLongInt);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
argno--;
|
||||
|
Reference in New Issue
Block a user