[movitz-cvs] CVS update: movitz/losp/muerte/basic-macros.lisp
Frode Vatvedt Fjeld
ffjeld at common-lisp.net
Tue Apr 13 16:40:54 UTC 2004
Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv11686
Modified Files:
basic-macros.lisp
Log Message:
Added a compiler-macro for defparameter. This should reduce the number
of file-toplevels that needs to be executed at boot-time just to
initialize some variables to constant values.
Date: Tue Apr 13 12:40:53 2004
Author: ffjeld
Index: movitz/losp/muerte/basic-macros.lisp
diff -u movitz/losp/muerte/basic-macros.lisp:1.6 movitz/losp/muerte/basic-macros.lisp:1.7
--- movitz/losp/muerte/basic-macros.lisp:1.6 Tue Apr 6 09:39:47 2004
+++ movitz/losp/muerte/basic-macros.lisp Tue Apr 13 12:40:53 2004
@@ -9,7 +9,7 @@
;;;; Created at: Wed Nov 8 18:44:57 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
-;;;; $Id: basic-macros.lisp,v 1.6 2004/04/06 13:39:47 ffjeld Exp $
+;;;; $Id: basic-macros.lisp,v 1.7 2004/04/13 16:40:53 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
@@ -119,8 +119,20 @@
;; (muerte::compile-time-setq ,name ,initial-value)
(setq ,name ,initial-value)))
-(defmacro defvar (name &optional value documentation)
- `(defparameter ,name ,value ,documentation))
+(define-compiler-macro defparameter (&whole form name initial-value
+ &optional docstring &environment env)
+ (declare (ignore docstring))
+ (if (not (movitz:movitz-constantp initial-value env))
+ form
+ (let ((mname (translate-program name :cl :muerte.cl)))
+ (setf (movitz::movitz-symbol-value (movitz:movitz-read mname))
+ (movitz:movitz-eval initial-value env))
+ `(declaim (special ,name)))))
+
+(defmacro defvar (name &optional (value nil valuep) documentation)
+ (if (not valuep)
+ `(declaim (special ,name))
+ `(defparameter ,name ,value ,documentation)))
(defmacro define-compile-time-variable (name value)
`(progn
More information about the Movitz-cvs
mailing list