diff --git a/docs/yap.tex b/docs/yap.tex index 07bd81379..50e051ffe 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -11912,10 +11912,10 @@ shows the active goal using print/1 shows the active goal using display/1 @item erase(R) ; true ), - ( D \= 0 -> recorda('$debug_depth',D,_) ), - fail. +'$new_deb_depth' :- + '$get_deb_depth'(0,D), + '$set_deb_depth'(D). '$get_deb_depth'(X0,XF) :- get0(user_input,C), - '$get_depth_handle_char'(C,X0,XF). + '$get_depth_handle_char'(C,X0,XI), + '$post_process_depth'(XI, XF). + +'$post_process_depth'(0, 10) :- !. +'$post_process_depth'(X, X). '$get_depth_handle_char'(10,X,X) :- !. '$get_depth_handle_char'(C,X0,XF) :- @@ -963,6 +967,20 @@ debugging :- '$get_deb_depth'(XI,XF). '$get_depth_handle_char'(C,X,X) :- '$skipeol'(C). +'$set_deb_depth'(D) :- + recorded('$print_options','$debugger'(L),R), !, + '$delete_if_there'(L, max_depth(_), LN), + erase(R), + '$recorda'('$print_options','$debugger'([max_depth(D)|LN]),_). +'$set_deb_depth'(D) :- + '$recorda'('$print_options','$debugger'([quoted(true),numbervars(true),portrayed(true),max_depth(D)]),_). + +'$delete_if_there'([], _, []). +'$delete_if_there'([T|L], T, LN) :- !, + '$delete_if_there'(L, T, LN). +'$delete_if_there'([Q|L], T, [Q|LN]) :- + '$delete_if_there'(L, T, LN). + '$DebugError'(error(Msg, Where )) :- !, '$output_error_message'(Msg, Where), !, fail.