Finalize support for restricted mode option.
[clon.git] / src / text.lisp
blob366833f77ef3a60df353670edd8bf6e2ab7fc756
1 ;;; text.lisp --- Text management
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 Text Class
36 ;; ==========================================================================
38 (defclass text (item)
39 ((contents :documentation "The actual text string."
40 :type string
41 :initarg :contents
42 :reader contents))
43 (:documentation "The TEXT class.
44 This class implements plain text objects appearing in a synopsis."))
47 ;; ------------------
48 ;; Traversal protocol
49 ;; ------------------
51 (defmethod untraverse ((text text))
52 "TEXT is a terminal object: just return it."
53 text)
56 ;; ---------------------------
57 ;; Help specification protocol
58 ;; ---------------------------
60 (defmethod help-spec ((text text) &key)
61 "Return TEXT's help specification."
62 (accumulate (text)
63 (contents text)))
67 ;; ==========================================================================
68 ;; Text Instance Creation
69 ;; ==========================================================================
71 (defun make-text (&rest keys &key contents hidden)
72 "Make a new text.
73 - CONTENTS is the actual text to display.
74 - When HIDDEN, the text doesn't appear in help strings."
75 (declare (ignore contents hidden))
76 (apply #'make-instance 'text keys))
78 ;; #### NOTE: currently, there is no difference between internal and external
79 ;; text, but this might change in the future. Besides, having this function it
80 ;; simplifies the defgroup and defsynopsis macros.
81 (defun make-internal-text (&rest keys &key contents hidden)
82 (declare (ignore contents hidden))
83 (apply #'make-text keys))
85 ;;; text.lisp ends here