From 2f8c9c6b6c5a4c7cb08e7497901a072718d6270b Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Wed, 22 Apr 2009 11:32:07 -0500 Subject: [PATCH] block users from catching user balls. --- pl/boot.yap | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pl/boot.yap b/pl/boot.yap index 034f2d76b..dda517ff5 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -1147,13 +1147,24 @@ throw(Ball) :- '$handle_throw'(_, _, _). '$handle_throw'(C, A, Ball) :- - % reset info - (Ball \== '$abort', C = Ball -> + % reset info + ('catch_ball'(Ball, C) -> '$execute'(A) ; throw(Ball) ). +'catch_ball'('$abort', _, _) :- !, fail. +% system defined throws should be ignored by used, unless the +% user is hacking away. +'catch_ball'(Ball, V) :- + var(V), + nonvar(Ball), + functor(Ball, Name, _), + atom_codes(Name, [0'$|_]), %'0 + !, fail. +'catch_ball'(C, C). + '$run_toplevel_hooks' :- nb_getval('$break',0), recorded('$toplevel_hooks',H,_), !,