r9078: add ppmx
[kmrcl.git] / macros.lisp
index 46894ba5e6fc82e3fc728c8cf2ea5688617e8e85..bf2714b86d441eec6f9d0c4bbce5a64f7f539d73 100644 (file)
         (defun ,release-name (instance)
           (kmrcl::with-lock-held (,lock-name)
             (push instance ,cache-name))))))
+
+(defmacro with-ignore-errors (&rest forms)
+  `(progn
+     ,@(mapcar
+       (lambda (x) (list 'ignore-errors x))
+       forms)))
+
+(defmacro ppmx (form)
+  "Pretty prints the macro expansion of FORM."
+  `(let* ((exp1 (macroexpand-1 ',form))
+         (exp (macroexpand exp1))
+         (*print-circle* nil))
+     (cond ((equal exp exp1)
+           (format t "~&Macro expansion:")
+           (pprint exp))
+          (t (format t "~&First step of expansion:")
+             (pprint exp1)
+             (format t "~%~%Final expansion:")
+             (pprint exp)))
+     (format t "~%~%")
+     (values)))