setof should cleanup in case of throw.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@786 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-02-21 19:18:12 +00:00
parent 42ed54c331
commit 773f2fb56e
3 changed files with 12 additions and 4 deletions

View File

@ -97,7 +97,6 @@ read_sig.
true true
) )
), ),
'$db_clean_queues'(0),
'$startup_reconsult', '$startup_reconsult',
'$startup_goals' '$startup_goals'
; ;
@ -1108,8 +1107,6 @@ expand_term(Term,Expanded) :-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% catch/throw implementation % catch/throw implementation
/* new design, not working for now: */
% at each catch point I need to know: % at each catch point I need to know:
% what is ball; % what is ball;
% where was the previous catch % where was the previous catch

View File

@ -45,6 +45,7 @@ findall(Template, Generator, Answers, SoFar) :-
% starts by calling the generator, % starts by calling the generator,
% and recording the answers % and recording the answers
'$findall'(Template, Generator, Ref, _, _) :- '$findall'(Template, Generator, Ref, _, _) :-
'$catch'(Error,'$clean_findall'(Ref,Error),_),
'$execute'(Generator), '$execute'(Generator),
'$db_enqueue'(Ref, Template), '$db_enqueue'(Ref, Template),
fail. fail.
@ -52,6 +53,16 @@ findall(Template, Generator, Answers, SoFar) :-
'$findall'(_, _, Ref, SoFar, Answers) :- '$findall'(_, _, Ref, SoFar, Answers) :-
'$collect_for_findall'(Ref, SoFar, Answers). '$collect_for_findall'(Ref, SoFar, Answers).
'$clean_findall'(Ref,_) :-
'$db_dequeue'(Ref,_),
fail.
'$clean_findall'(_,Ball) :-
% get this off the unwound computation.
copy_term(Ball,NewBall),
% get current jump point
'$jump_env_and_store_ball'(NewBall).
% by getting all answers % by getting all answers
'$collect_for_findall'(Ref, SoFar, Out) :- '$collect_for_findall'(Ref, SoFar, Out) :-
( '$db_dequeue'(Ref, Term) -> ( '$db_dequeue'(Ref, Term) ->

View File

@ -372,7 +372,7 @@ system_predicate(P) :-
'$pred_exists'(T,M). '$pred_exists'(T,M).
'$current_predicate3'(M,A/Arity) :- !, '$current_predicate3'(M,A/Arity) :- !,
'$current_predicate'(M,A,Arity), '$current_predicate_for_atom'(A,M,Arity),
functor(T,A,Arity), functor(T,A,Arity),
'$pred_exists'(T,M). '$pred_exists'(T,M).
'$current_predicate3'(M,BadSpec) :- % only for the predicate '$current_predicate3'(M,BadSpec) :- % only for the predicate