Fix a couple of CLISP warnings.
[clon.git] / src / item.lisp
blob4275101f401743dfd66b869efbce43bae1f5a592
1 ;;; item.lisp --- Item objects
3 ;; Copyright (C) 2010, 2011 Didier Verna
5 ;; Author: Didier Verna <didier@lrde.epita.fr>
6 ;; Maintainer: Didier Verna <didier@lrde.epita.fr>
8 ;; This file is part of Clon.
10 ;; Permission to use, copy, modify, and distribute this software for any
11 ;; purpose with or without fee is hereby granted, provided that the above
12 ;; copyright notice and this permission notice appear in all copies.
14 ;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ;;; Commentary:
25 ;; Contents management by FCM version 0.1.
28 ;;; Code:
30 (in-package :com.dvlsoft.clon)
31 (in-readtable :com.dvlsoft.clon)
34 ;; ==========================================================================
35 ;; The Item Class
36 ;; ==========================================================================
38 (defabstract item ()
39 ((traversedp :documentation "The item's traversal state."
40 :initform nil
41 :accessor traversedp)
42 (hiddenp :documentation "Whether the item is hidden in help strings."
43 :initform nil
44 ;; #### NOTE: the initarg below doesn't follow the *p convention
45 ;; because that would look strange in a declarative group
46 ;; construction.
47 :initarg :hidden
48 :reader hiddenp))
49 (:documentation "The ITEM class.
50 This class is the base class for all synopsis items."))
54 ;; ==========================================================================
55 ;; The Traversal Protocol
56 ;; ==========================================================================
58 (defgeneric untraverse (item)
59 (:documentation "Reset ITEM's traversal state, and return ITEM.")
60 (:method :after ((item item))
61 "Mark ITEM as untraversed."
62 (setf (traversedp item) nil)))
66 ;; ==========================================================================
67 ;; The Help Specification Protocol
68 ;; ==========================================================================
70 (defgeneric help-spec (item &key &allow-other-keys)
71 (:documentation "Return ITEM's help specification.")
72 (:method :around ((item item) &key unhide)
73 "Call the actual method only when ITEM is not hidden or UNHIDE."
74 (when (or (not (hiddenp item)) unhide)
75 (call-next-method))))
78 ;;; item.lisp ends here