partial fix to predicate_property trouble (obs from Nicos).
fix core dump when writing arrays without bignum support. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2217 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
4677a5ba10
commit
3c3d0de2de
@ -475,8 +475,8 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb)
|
|||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
wrputn(LongIntOfTerm(t),wglb->writewch);
|
wrputn(LongIntOfTerm(t),wglb->writewch);
|
||||||
return;
|
return;
|
||||||
#ifdef USE_GMP
|
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
|
#ifdef USE_GMP
|
||||||
{
|
{
|
||||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||||
char *s = (char *)TR;
|
char *s = (char *)TR;
|
||||||
@ -498,8 +498,12 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb)
|
|||||||
mpz_get_str(s, 10, big);
|
mpz_get_str(s, 10, big);
|
||||||
wrputs(s,wglb->writewch);
|
wrputs(s,wglb->writewch);
|
||||||
}
|
}
|
||||||
return;
|
#else
|
||||||
|
{
|
||||||
|
wrputs("0",wglb->writewch);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arity = ArityOfFunctor(functor);
|
Arity = ArityOfFunctor(functor);
|
||||||
|
@ -61,6 +61,7 @@ split(SplitCodes, [C|New], Set) -->
|
|||||||
split(_, [], []) --> [].
|
split(_, [], []) --> [].
|
||||||
|
|
||||||
glue([], _, []).
|
glue([], _, []).
|
||||||
|
glue([A], _, A) :- !.
|
||||||
glue([H|T], [B|_], Merged) :-
|
glue([H|T], [B|_], Merged) :-
|
||||||
append(H, [B|Rest], Merged),
|
append(H, [B|Rest], Merged),
|
||||||
glue(T, [B], Rest).
|
glue(T, [B], Rest).
|
||||||
|
14
pl/preds.yap
14
pl/preds.yap
@ -818,7 +818,16 @@ predicate_property(Pred,Prop) :-
|
|||||||
'$predicate_property'(Pred,Mod,Mod,Prop).
|
'$predicate_property'(Pred,Mod,Mod,Prop).
|
||||||
'$predicate_property2'(Pred,Prop,Mod) :-
|
'$predicate_property2'(Pred,Prop,Mod) :-
|
||||||
recorded('$import','$import'(M,Mod,NPred,Pred,_,_),_),
|
recorded('$import','$import'(M,Mod,NPred,Pred,_,_),_),
|
||||||
'$predicate_property2'(NPred,Prop,M).
|
(
|
||||||
|
Prop = imported_from(M)
|
||||||
|
;
|
||||||
|
functor(Pred,P,A),
|
||||||
|
recorded('$module','$module'(_TFN,Mod,Publics),_),
|
||||||
|
lists:memberchk(N/A,Publics)
|
||||||
|
;
|
||||||
|
'$predicate_property2'(NPred,Prop,M),
|
||||||
|
Prop \= exported
|
||||||
|
).
|
||||||
|
|
||||||
'$generate_all_preds_from_mod'(Pred, M, M) :-
|
'$generate_all_preds_from_mod'(Pred, M, M) :-
|
||||||
'$current_predicate'(M,Na,Ar),
|
'$current_predicate'(M,Na,Ar),
|
||||||
@ -845,8 +854,6 @@ predicate_property(Pred,Prop) :-
|
|||||||
'$meta_predicate'(M,Na,Ar,P).
|
'$meta_predicate'(M,Na,Ar,P).
|
||||||
'$predicate_property'(P,M,_,multifile) :-
|
'$predicate_property'(P,M,_,multifile) :-
|
||||||
'$is_multifile'(P,M).
|
'$is_multifile'(P,M).
|
||||||
'$predicate_property'(P,Mod,M,imported_from(Mod)) :-
|
|
||||||
recorded('$import','$import'(Mod,M,_,P,_,_),_).
|
|
||||||
'$predicate_property'(P,M,_,public) :-
|
'$predicate_property'(P,M,_,public) :-
|
||||||
'$is_public'(P,M).
|
'$is_public'(P,M).
|
||||||
'$predicate_property'(P,M,M,exported) :-
|
'$predicate_property'(P,M,M,exported) :-
|
||||||
@ -854,6 +861,7 @@ predicate_property(Pred,Prop) :-
|
|||||||
recorded('$module','$module'(_TFN,M,Publics),_),
|
recorded('$module','$module'(_TFN,M,Publics),_),
|
||||||
lists:memberchk(N/A,Publics), !.
|
lists:memberchk(N/A,Publics), !.
|
||||||
'$predicate_property'(P,Mod,_,number_of_clauses(NCl)) :-
|
'$predicate_property'(P,Mod,_,number_of_clauses(NCl)) :-
|
||||||
|
write(P:Mod),nl,
|
||||||
'$number_of_clauses'(P,Mod,NCl).
|
'$number_of_clauses'(P,Mod,NCl).
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user