r5460: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 6 Aug 2003 10:03:21 +0000 (10:03 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 6 Aug 2003 10:03:21 +0000 (10:03 +0000)
macros.lisp
package.lisp

index 1697dca0c47bd1cada09e93663267ae04f8001d2..3242f9e464fff835006f7e65f783a13aed50db72 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: macros.lisp,v 1.3 2003/07/11 06:58:32 kevin Exp $
+;;;; $Id: macros.lisp,v 1.4 2003/08/06 10:03:21 kevin Exp $
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 (defmacro mv-bind (vars form &body body)
   `(multiple-value-bind ,vars ,form 
      ,@body))
+
+(defmacro deflex (var val &optional (doc nil docp))    
+  "Defines a top level (global) lexical VAR with initial value VAL,
+      which is assigned unconditionally as with DEFPARAMETER. If a DOC
+      string is provided, it is attached to both the name |VAR| and the
+      name *STORAGE-FOR-DEFLEX-VAR-|VAR|* as a documentation string of
+      kind 'VARIABLE. The new VAR will have lexical scope and thus may
+      be shadowed by LET bindings without affecting its global value."
+  (let* ((s0 (load-time-value (symbol-name '#:*storage-for-deflex-var-)))
+        (s1 (symbol-name var))
+        (p1 (symbol-package var))
+        (s2 (load-time-value (symbol-name '#:*)))
+        (backing-var (intern (concatenate 'string s0 s1 s2) p1)))
+    `(progn
+      (defparameter ,backing-var ,val ,@(when docp `(,doc)))
+      ,@(when docp
+             `((setf (documentation ',var 'variable) ,doc)))
+      (define-symbol-macro ,var ,backing-var))))
index 961bcb7c82b39e0380179fd18e5295e481978aff..f5cbc6e4f6e178c0990d92cb694545d8bd386f4f 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: package.lisp,v 1.55 2003/07/31 07:32:11 kevin Exp $
+;;;; $Id: package.lisp,v 1.56 2003/08/06 10:03:21 kevin Exp $
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
    #:it
    #:mac
    #:mv-bind
+   #:deflex
    
    ;; files.lisp
    #:print-file-contents