From: jsancho Date: Mon, 9 Nov 2009 19:13:14 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=d1022020ba95506abae1fa0ec131a62f12c6cd81;p=gacela.git --- diff --git a/gacela_misc.lisp b/gacela_misc.lisp index a3991d5..16e8ab8 100755 --- a/gacela_misc.lisp +++ b/gacela_misc.lisp @@ -68,6 +68,15 @@ (t (power (* p 2) n))))) (power 1 n))) +(defmacro secured-eval (form &optional output-stream) + `(let ((error-handler #'si::universal-error-handler) + (result-eval)) + (defun si::universal-error-handler (error-name correctable function-name continue-format-string error-format-string &rest args) + ,(when output-stream `(format ,output-stream error-format-string))) + (setq result-eval (eval ,form)) + (setf (symbol-function 'si::universal-error-handler) error-handler) + result-eval)) + ;Geometry (defun dotp (dot) (match-pattern dot '(0 0)))