From 87b59c42af7677f273e6e176e66f3306af9e2089 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 6 Aug 2003 10:03:21 +0000 Subject: [PATCH] r5460: *** empty log message *** --- macros.lisp | 20 +++++++++++++++++++- package.lisp | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/macros.lisp b/macros.lisp index 1697dca..3242f9e 100644 --- a/macros.lisp +++ b/macros.lisp @@ -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 ;;;; @@ -168,3 +168,21 @@ (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)))) diff --git a/package.lisp b/package.lisp index 961bcb7..f5cbc6e 100644 --- a/package.lisp +++ b/package.lisp @@ -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 ;;;; @@ -118,6 +118,7 @@ #:it #:mac #:mv-bind + #:deflex ;; files.lisp #:print-file-contents -- 2.34.1