call_with_args should check if first arg is atom

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@553 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-06-26 05:10:17 +00:00
parent 818bca5fd5
commit 778d99255f
2 changed files with 53 additions and 0 deletions

View File

@ -570,6 +570,10 @@ p_execute_0(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/1");
return(FALSE);
}
a = AtomOfTerm(t);
pe = PredPropByAtom(a, mod);
return (CallPredicate(RepPredProp(pe), B));
@ -583,6 +587,10 @@ p_execute_1(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/2");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
pe = PredPropByFunc(MkFunctor(a,1),mod);
@ -597,6 +605,10 @@ p_execute_2(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/3");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -612,6 +624,10 @@ p_execute_3(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/4");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -628,6 +644,10 @@ p_execute_4(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/5");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -645,6 +665,10 @@ p_execute_5(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/6");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -663,6 +687,10 @@ p_execute_6(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/7");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -682,6 +710,10 @@ p_execute_7(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/8");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -702,6 +734,10 @@ p_execute_8(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/9");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -723,6 +759,10 @@ p_execute_9(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/10");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;
@ -745,6 +785,10 @@ p_execute_10(void)
Prop pe;
Atom a;
if (!IsAtomTerm(t)) {
Error(TYPE_ERROR_ATOM,ARG1,"call_with_args/11");
return(FALSE);
}
a = AtomOfTerm(t);
ARG1 = ARG2;
ARG2 = ARG3;

View File

@ -5645,6 +5645,15 @@ list_profile :-
% predicates will come last:
write_profile_data(SLP).
list_profile(Module) :-
% get number of calls for each profiled procedure
findall(D-P,profile_data(Module:P,calls,D),LP),
% sort them
sort(LP,SLP),
% output so that the most often called
% predicates will come last:
write_profile_data(SLP).
write_profile_data([]).
write_profile_data([D-P|SLP]) :-
% swap the two calls if you want the most often