1 ;;; package.lisp --- Common Lisp Package definition
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 ;; Clon is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License version 3,
12 ;; as published by the Free Software Foundation.
14 ;; Clon is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program; if not, write to the Free Software
21 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 ;; Contents management by FCM version 0.1.
33 (defpackage :com.dvlsoft.clon
34 (:documentation
"The Command-Line Options Nuker package.")
36 (:shadow
:*readtable
*)
37 (:import-from
:com.dvlsoft.clon.asdf
39 :+release-major-level
+
40 :+release-minor-level
+
42 :+release-status-level
+
46 ;; From com.dvlsoft.clon.asd:
47 :+release-major-level
+
48 :+release-minor-level
+
50 :+release-status-level
+
55 ;; From src/util.lisp:
59 ;; From src/text.lisp:
61 ;; From src/options/flag.lisp:
63 ;; From src/options/switch.lisp:
65 ;; From src/options/stropt.lisp:
67 ;; From src/options/lispobj.lisp:
69 ;; From src/options/path.lisp:
71 ;; From src/options/enum.lisp:
73 ;; From src/options/xswitch.lisp:
75 ;; From src/group.lisp:
77 ;; From src/synopsis.lisp:
79 :make-synopsis
:defsynopsis
80 ;; From src/context.lisp:
88 :multiple-value-getopt-cmdline
93 (in-package :com.dvlsoft.clon
)
96 ;; -------------------
97 ;; External utilities:
98 ;; -------------------
100 (defun nickname-package (&optional
(nickname :clon
))
101 "Add NICKNAME (:CLON by default) to the :COM.DVLSOFT.CLON package."
102 (rename-package :com.dvlsoft.clon
103 (package-name :com.dvlsoft.clon
)
104 (adjoin nickname
(package-nicknames :com.dvlsoft.clon
)
105 :test
#'string-equal
)))
108 ;; -------------------
109 ;; Internal utilities:
110 ;; -------------------
112 (defvar *readtable
* (copy-readtable)
113 "The Clon readtable.")
115 (defun tilde-reader (stream char
)
116 "Read a series of ~\"strings\" to be concatenated together."
117 (declare (ignore char
))
118 (apply #'concatenate
'string
119 (loop :for str
:= (read stream t nil t
)
120 :then
(progn (read-char stream t nil t
)
121 (read stream t nil t
))
123 :while
(eql (peek-char t stream nil nil t
) #\~
))))
125 (set-macro-character #\~
#'tilde-reader nil
*readtable
*)
127 ;; ECL and CLISP do not like to see undefined reader macros in expressions
128 ;; that belong to other compilers. For instance this will break:
129 ;; #+ccl (#_ccl-only-function)
130 ;; It seems to be a correct behavior (see *read-suppress* in CLHS), although
131 ;; other implementations like SBCL and CMUCL are more gentle. The solution I
132 ;; use is to define those reader macros to simply return nil.
136 (defun dummy-reader (stream subchar args
)
138 (declare (ignore stream subchar args
))
141 (set-dispatch-macro-character #\
# #\_
#'dummy-reader
*readtable
*)
142 (set-dispatch-macro-character #\
# #\$
#'dummy-reader
*readtable
*))
144 (defmacro in-readtable
(name)
145 "Set the current readtable to the value of NAME::*READTABLE*."
146 `(eval-when (:compile-toplevel
:load-toplevel
:execute
)
147 (setf cl
:*readtable
* (symbol-value (find-symbol "*READTABLE*" ,name
)))))
150 ;;; package.lisp ends here