Fix comment
[jscl.git] / src / symbol.lisp
1 ;;; symbols --- 
2
3 ;; JSCL is free software: you can redistribute it and/or
4 ;; modify it under the terms of the GNU General Public License as
5 ;; published by the Free Software Foundation, either version 3 of the
6 ;; License, or (at your option) any later version.
7 ;;
8 ;; JSCL is distributed in the hope that it will be useful, but
9 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ;; General Public License for more details.
12 ;;
13 ;; You should have received a copy of the GNU General Public License
14 ;; along with JSCL.  If not, see <http://www.gnu.org/licenses/>.
15
16 (defun symbol-plist (x)
17   (cond
18     ((not (symbolp x))
19      (error "`~a' is not a symbol." x))
20     ((in "plist" x)
21      (oget* x "plist"))))
22
23 (defun set-symbol-plist (new-value x)
24   (if (symbolp x)
25       (oset* new-value x "plist")
26       (error "`~a' is not a symbol." x)))
27
28 (define-setf-expander symbol-plist (x)
29   (let ((g!x (gensym))
30         (g!value (gensym)))
31     (values (list g!x)
32             (list x)
33             (list g!value)
34             `(set-symbol-plist ,g!value ,g!x)
35             `(symbol-plist ,g!x))))
36
37 (defun get (symbol indicator &optional default)
38   (getf (symbol-plist symbol) indicator default))