[slime-cvs] CVS update: slime/swank-backend.lisp
Helmut Eller
heller at common-lisp.net
Sun Nov 20 23:25:38 UTC 2005
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv21861
Modified Files:
swank-backend.lisp
Log Message:
(compiler-macroexpand-1, compiler-macroexpand): New functions.
Date: Mon Nov 21 00:25:38 2005
Author: heller
Index: slime/swank-backend.lisp
diff -u slime/swank-backend.lisp:1.93 slime/swank-backend.lisp:1.94
--- slime/swank-backend.lisp:1.93 Sat Nov 12 00:43:43 2005
+++ slime/swank-backend.lisp Mon Nov 21 00:25:38 2005
@@ -399,6 +399,28 @@
"Recursively expand all macros in FORM.
Return the resulting form.")
+(definterface compiler-macroexpand-1 (form &optional env)
+ "Call the compiler-macro for form.
+If FORM is a function call for which a compiler-macro has been
+defined, invoke the expander function using *macroexpand-hook* and
+return the results and T. Otherwise, return the original form and
+NIL."
+ (let ((fun (and (consp form) (compiler-macro-function (car form)))))
+ (if fun
+ (let ((result (funcall *macroexpand-hook* fun form env)))
+ (values result (not (eq result form))))
+ (values form nil))))
+
+(definterface compiler-macroexpand (form &optional env)
+ "Repetitively call `compiler-macroexpand-1'."
+ (labels ((frob (form expanded)
+ (multiple-value-bind (new-form newly-expanded)
+ (compiler-macroexpand-1 form env)
+ (if newly-expanded
+ (frob new-form t)
+ (values new-form expanded)))))
+ (frob form env)))
+
(definterface describe-symbol-for-emacs (symbol)
"Return a property list describing SYMBOL.
More information about the slime-cvs
mailing list