1 ;;; package.lisp --- Common Lisp Package definition
3 ;; Copyright (C) 2010 Didier Verna
5 ;; Author: Didier Verna <didier@lrde.epita.fr>
6 ;; Maintainer: Didier Verna <didier@lrde.epita.fr>
7 ;; Created: Wed Jun 18 08:49:39 2008
8 ;; Last Revision: Sat Jun 12 17:55:37 2010
10 ;; This file is part of Clon.
12 ;; Clon is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License version 3,
14 ;; as published by the Free Software Foundation.
16 ;; Clon is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; if not, write to the Free Software
23 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;; Contents management by FCM version 0.1.
35 (defpackage :com.dvlsoft.clon
37 (:shadow
:*readtable
*)
38 (:import-from
:com.dvlsoft.clon.asdf
40 :+release-major-level
+
41 :+release-minor-level
+
43 :+release-status-level
+
47 ;; From com.dvlsoft.clon.asd:
48 :+release-major-level
+
49 :+release-minor-level
+
51 :+release-status-level
+
56 ;; From src/util.lisp:
60 ;; From src/text.lisp:
62 ;; From src/options/flag.lisp:
64 ;; From src/options/switch.lisp:
66 ;; From src/options/stropt.lisp:
68 ;; From src/options/lispobj.lisp:
70 ;; From src/options/path.lisp:
72 ;; From src/options/enum.lisp:
74 ;; From src/options/xswitch.lisp:
76 ;; From src/group.lisp:
78 ;; From src/synopsis.lisp:
80 :make-synopsis
:defsynopsis
81 ;; From src/context.lisp:
89 :multiple-value-getopt-cmdline
94 (in-package :com.dvlsoft.clon
)
97 ;; -------------------
98 ;; External utilities:
99 ;; -------------------
101 (defun nickname-package (&optional
(nickname :clon
))
102 "Add NICKNAME (:CLON by default) to the :COM.DVLSOFT.CLON package."
103 (rename-package :com.dvlsoft.clon
104 (package-name :com.dvlsoft.clon
)
105 (adjoin nickname
(package-nicknames :com.dvlsoft.clon
)
106 :test
#'string-equal
)))
109 ;; -------------------
110 ;; Internal utilities:
111 ;; -------------------
113 (defvar *readtable
* (copy-readtable)
114 "The Clon readtable.")
116 (defun tilde-reader (stream char
)
117 "Read a series of ~\"strings\" to be concatenated together."
118 (declare (ignore char
))
119 (apply #'concatenate
'string
120 (loop :for str
:= (read stream t nil t
)
121 :then
(progn (read-char stream t nil t
)
122 (read stream t nil t
))
124 :while
(eql (peek-char t stream nil nil t
) #\~
))))
126 (set-macro-character #\~
#'tilde-reader nil
*readtable
*)
128 ;; ECL and CLISP do not like to see undefined reader macros in expressions
129 ;; that belong to other compilers. For instance this will break:
130 ;; #+ccl (#_ccl-only-function)
131 ;; It seems to be a correct behavior (see *read-suppress* in CLHS), although
132 ;; other implementations like SBCL and CMUCL are more gentle. The solution I
133 ;; use is to define those reader macros to simply return nil.
137 (defun dummy-reader (stream subchar args
)
139 (declare (ignore stream subchar args
))
142 (set-dispatch-macro-character #\
# #\_
#'dummy-reader
*readtable
*)
143 (set-dispatch-macro-character #\
# #\$
#'dummy-reader
*readtable
*))
145 (defmacro in-readtable
(name)
146 "Set the current readtable to the value of NAME::*READTABLE*."
147 `(eval-when (:compile-toplevel
:load-toplevel
:execute
)
148 (setf cl
:*readtable
* (symbol-value (find-symbol "*READTABLE*" ,name
)))))
151 ;;; package.lisp ends here