From 93ac7eed8f69f19013472f078b544be145619ff5 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 18 Apr 2004 23:11:52 +0000 Subject: [PATCH] r9078: add ppmx --- macros.lisp | 15 +++++++++++++++ package.lisp | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/macros.lisp b/macros.lisp index 9b6150a..bf2714b 100644 --- a/macros.lisp +++ b/macros.lisp @@ -239,3 +239,18 @@ ,@(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))) diff --git a/package.lisp b/package.lisp index b04ab8e..3d44266 100644 --- a/package.lisp +++ b/package.lisp @@ -139,7 +139,8 @@ #:def-cached-vector #:def-cached-instance #:with-ignore-errors - + #:ppmx + ;; files.lisp #:print-file-contents #:read-stream-to-string -- 2.34.1