]> git.jsancho.org Git - gacela.git/blobdiff - gacela_misc.lisp
(no commit message)
[gacela.git] / gacela_misc.lisp
index ac7b479db805ded3532e7725e0cc4bd87168a74e..d9f38daa5ef4aedafbc7c3f8dfc1498db1efb560 100755 (executable)
@@ -14,7 +14,6 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 (in-package :gacela)
 
 (defconstant INFINITY MOST-POSITIVE-LONG-FLOAT)
                        (t (power (* p 2) n)))))
          (power 1 n)))
 
-(defmacro mapcconst (type c-type name)
-  `(progn
-     (defcfun ,(concatenate 'string c-type " gacela_" name " (void)") 0
-       ,(concatenate 'string "return " name ";"))
-     (defentry ,(intern (string-upcase name)) ()
-       (,type ,(concatenate 'string "gacela_" name)))))
-
+(defmacro secured-eval (form &optional output-stream)
+  (let ((error-handler #'si::universal-error-handler))
+    `(block secure
+       (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))
+        (setf (symbol-function 'si::universal-error-handler) ,error-handler)
+        (return-from secure))
+       (let (result-eval)
+        (setq result-eval (eval ,form))
+        (setf (symbol-function 'si::universal-error-handler) ,error-handler)
+        result-eval))))
 
 ;Geometry
 (defun dotp (dot)