ECL port step 4: Makefiles.
[clon.git] / package.lisp
blobd83e855dccc3eee635a426c4eb31f51012c03342
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.
26 ;;; Commentary:
28 ;; Contents management by FCM version 0.1.
31 ;;; Code:
33 (in-package :cl-user)
35 (defpackage :com.dvlsoft.clon
36 (:use :cl)
37 (:shadow :*readtable*)
38 (:import-from :com.dvlsoft.clon.asdf
39 :define-constant
40 :+release-major-level+
41 :+release-minor-level+
42 :+release-status+
43 :+release-status-level+
44 :+release-name+
45 :version)
46 (:export
47 ;; From com.dvlsoft.clon.asd:
48 :+release-major-level+
49 :+release-minor-level+
50 :+release-status+
51 :+release-status-level+
52 :+release-name+
53 :version
54 ;; From package.lisp:
55 :nickname-package
56 ;; From src/util.lisp:
57 :exit
58 :cmdline
59 :dump
60 ;; From src/text.lisp:
61 :make-text
62 ;; From src/options/flag.lisp:
63 :make-flag
64 ;; From src/options/switch.lisp:
65 :make-switch
66 ;; From src/options/stropt.lisp:
67 :make-stropt
68 ;; From src/options/lispobj.lisp:
69 :make-lispobj
70 ;; From src/options/path.lisp:
71 :make-path
72 ;; From src/options/enum.lisp:
73 :make-enum
74 ;; From src/options/xswitch.lisp:
75 :make-xswitch
76 ;; From src/group.lisp:
77 :make-group :defgroup
78 ;; From src/synopsis.lisp:
79 :*default-synopsis*
80 :make-synopsis :defsynopsis
81 ;; From src/context.lisp:
82 :*current-context*
83 :make-context
84 :with-context
85 :progname
86 :remainder
87 :getopt
88 :getopt-cmdline
89 :multiple-value-getopt-cmdline
90 :do-cmdline-options
91 :help))
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))
123 :collect str
124 :while (eql (peek-char t stream nil nil t) #\~))))
126 (set-macro-character #\~ #'tilde-reader nil *readtable*)
128 ;; ECL does not like to see undefined reader macros in expressions that
129 ;; 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.
134 #+ecl
135 (progn
136 (defun dummy-reader (stream subchar args)
137 "Return nil."
138 (declare (ignore stream subchar args))
139 nil)
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