Another attemp to get call_cleanup/2-3 right. Third is the charm (I hope...).

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1769 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2007-01-07 11:27:09 +00:00
parent 9d3618393f
commit ab33864f0c
2 changed files with 7 additions and 3 deletions

View File

@ -522,6 +522,10 @@ frozen(V, LG) :-
'$purge_done_goals'(G0, GF). '$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_freeze'(Done, _, _)|G0], GF) :- nonvar(Done), !, '$purge_done_goals'(['$redo_freeze'(Done, _, _)|G0], GF) :- nonvar(Done), !,
'$purge_done_goals'(G0, GF). '$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_freeze'(Done, _, CallCleanup)|G0], GF) :-
nonvar(CallCleanup),
CallCleanup = _:'$clean_call'(_), !,
'$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_eq'(Done, _, _, _)|G0], GF) :- nonvar(Done), !, '$purge_done_goals'(['$redo_eq'(Done, _, _, _)|G0], GF) :- nonvar(Done), !,
'$purge_done_goals'(G0, GF). '$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_ground'(Done, _, _)|G0], GF) :- nonvar(Done), !, '$purge_done_goals'(['$redo_ground'(Done, _, _)|G0], GF) :- nonvar(Done), !,

View File

@ -189,8 +189,7 @@ call_cleanup(Goal, Cleanup) :-
call_cleanup(Goal, Catcher, Cleanup) :- call_cleanup(Goal, Catcher, Cleanup) :-
catch('$call_cleanup'(Goal,Cleanup,Result), catch('$call_cleanup'(Goal,Cleanup,Result),
Exception, Exception,
'$cleanup_exception'(Exception,Catcher,Cleanup)), '$cleanup_exception'(Exception,Catcher,Cleanup)).
Result = exit.
'$cleanup_exception'(Exception, exception(Exception), Cleanup) :- '$cleanup_exception'(Exception, exception(Exception), Cleanup) :-
call(Cleanup). call(Cleanup).
@ -205,7 +204,8 @@ call_cleanup(Goal, Catcher, Cleanup) :-
Result = exit, ! Result = exit, !
; true ; true
) )
; Result = fail ; Result = fail,
fail
). ).
'$clean_call'(Cleanup) :- '$clean_call'(Cleanup) :-