4 ;;;; Compiler Macro Expansion
7 ;;**** move to proper place?
8 (defvar *cmp-macros
* nil
)
9 (defvar *cmp-global-macros
* nil
)
11 ;;**** think about precedence if macro and cmpmacro both exist
12 ;;**** may simplify setf that way?
14 (defun cmp-macroexpand (e &optional
(env (list nil
17 *cmp-global-macros
*)))
20 (defun cmp-macroexpand-1 (e &optional
(env (list nil
23 *cmp-global-macros
*)))
24 (macroexpand-1 e env
))
28 ;;;; Declaration Handling
31 (defun check-declarations (decls)
34 (if (and (consp i
) (eq (first i
) 'special
))
36 (warn "special declaration for ~s ignored." v
))))))
38 (defun split-declarations (x)
39 (flet ((head-is-declaration (x)
40 (and (consp (first x
)) (eq (first (first x
)) 'declare
)))
41 (head-is-docstring (x) (and (stringp (first x
)) (consp (rest x
)))))
47 ((head-is-declaration body
) (push (first body
) decls
))
48 ((head-is-docstring body
) (setf doc
(first body
)))
49 (t (check-declarations decls
)
50 #|
(return (list (nreverse decls
) body doc
))|
#
51 (return (list nil body doc
))))))) ; drop declarations for now
58 (define-compiler-macro progv
(syms vals
&rest body
)
59 `(%dynamic-bind
,syms
,vals
#'(lambda () ,@body
)))
64 ;;;; Macros for inlining some functions
65 ;;;; ******* more needed here -- should these be here or as symbol-call-rules??
67 (define-compiler-macro not
(x) `(if ,x nil t
))
68 (define-compiler-macro null
(x) `(if ,x nil t
))
70 (define-compiler-macro row-major-aref
(x i
) `(aref ,x
,i
))
71 (define-compiler-macro xlisp
::%set-rm-aref
(x i v
)
72 `(xlisp::%set-aref
,x
,i
,v
))