source: trunk/j/src/org/armedbear/lisp/symbol.lisp @ 4675

Last change on this file since 4675 was 4675, checked in by piso, 18 years ago

GETF is now implemented in Primitives.java.

File size: 1.8 KB
RevLine 
[568]1;;; symbol.lisp
[1677]2;;;
3;;; Copyright (C) 2003 Peter Graves
[4675]4;;; $Id: symbol.lisp,v 1.8 2003-11-07 20:20:55 piso Exp $
[1677]5;;;
6;;; This program is free software; you can redistribute it and/or
7;;; modify it under the terms of the GNU General Public License
8;;; as published by the Free Software Foundation; either version 2
9;;; of the License, or (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with this program; if not, write to the Free Software
18;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
[568]19
[2946]20(in-package "SYSTEM")
[568]21
[2946]22;;; From CMUCL.
[568]23
[2946]24(defun %putf (place property new-value)
25  (do ((plist place (cddr plist)))
26      ((endp plist) (list* property new-value place))
27    (when (eq (car plist) property)
28      (setf (cadr plist) new-value)
29      (return place))))
30
31(defsetf getf %putf)
32
[1677]33(defun get-properties (place indicator-list)
34  (do ((plist place (cddr plist)))
35      ((null plist) (values nil nil nil))
36    (cond ((atom (cdr plist))
37     (error 'type-error
38                  "malformed property list: ~S" (list place)))
39    ((memq (car plist) indicator-list)
40     (return (values (car plist) (cadr plist) plist))))))
41
[1156]42(defun copy-symbol (symbol &optional (copy-props nil) &aux new-symbol)
43  (setq new-symbol (make-symbol (symbol-name symbol)))
44  (when copy-props
[3400]45    (when (boundp symbol)
46      (set new-symbol (symbol-value symbol)))
[1156]47    (setf (symbol-plist new-symbol) (copy-list (symbol-plist symbol)))
48    (when (fboundp symbol)
49      (setf (symbol-function new-symbol) (symbol-function symbol))))
50  new-symbol)
Note: See TracBrowser for help on using the repository browser.