Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code
[maxima.git] / src / maxima-package.lisp
blob59863f8a05f7156ee1e173a184bc31a65f26f707
1 (in-package :common-lisp-user)
3 (defpackage :pregexp
4 (:use :common-lisp)
5 (:export
6 ;; These exports are the regexp procedures mentioned in the manual.
7 #:pregexp
8 #:pregexp-match-positions
9 #:pregexp-match
10 #:pregexp-split
11 #:pregexp-replace
12 #:pregexp-replace*
13 #:pregexp-quote))
15 (defpackage :cl-info
16 (:use :common-lisp))
18 (defpackage :command-line
19 (:use :common-lisp)
20 (:nicknames :cmdline)
21 (:export #:cl-option #:make-cl-option #:list-cl-options #:process-args
22 #:get-application-args))
24 ;; Kevin Rosenberg's getopt package
25 (defpackage getopt
26 (:use :cl)
27 (:export #:match-unique-abbreviation
28 #:getopt))
30 ;; GCL has SLOOP built in but it's slightly different now...
31 (defpackage :cl-sloop
32 (:use :common-lisp)
33 (:export #:sloop))
35 (defpackage :maxima
36 (:use :common-lisp :command-line)
37 ;; Gcl has DEFINE-COMPILER-MACRO but it's in the SYSTEM package. So
38 ;; we shadowing import it into our package here. (Can't just import
39 ;; because there's already a DEFINE-COMPILER-MACRO symbol.)
40 #+gcl
41 (:shadowing-import-from #:system #:define-compiler-macro)
42 (:nicknames :cl-macsyma :cl-maxima :macsyma)
43 (:import-from :cl-sloop #:sloop)
44 (:shadow continue ;(macsys): part of the top-level loop
45 // ;(clmacs): arithmetic operator
46 float ;(clmacs): has 1.0 as default format
47 functionp ;(commac): accepts symbols
48 array ;(commac)
49 exp ;various files declare this special
50 signum ;(commac): same except
51 ; (cl:signum 1.3)==1.0 not 1 but I (?)
52 ; think this is ok for macsyma
53 asin acos asinh acosh atanh ;different for complex numbers
54 tanh cosh sinh tan ;(trigi): same, could remove from trigi
55 break ; special variable in displa.lisp
56 gcd ; special in rat module
57 #+(and sbcl sb-package-locks) makunbound)
58 #+gcl
59 (:import-from :system
60 ;; Faster modular arithmetic.
61 ;; Unfortunately, as S. Macrakis observed (bug #706562),
62 ;; SI::CMOD currently behaves in a strange way:
63 ;; (let ((si::modulus 4)) (si::cmod 2)) => 2
64 ;; (let ((si::modulus 4)) (si::cmod -2)) => -2
65 #:modulus #:cmod #:ctimes #:cdifference #:cplus
67 #:getpid #:get-instream
68 #:short-name #:cleanup #:instream-stream-name #:instream-line
69 #:instream-name #:instream-stream #:stream-name #:complete-prop
70 #:*stream-alist* #:break-call))
73 (defpackage :mt19937
74 (:use :common-lisp)
75 (:shadow #:random-state
76 #:random-state-p
77 #:random
78 #:*random-state*
79 #:make-random-state)
80 (:export #:random-state
81 #:random-state-p
82 #:random
83 #:*random-state*
84 #:make-random-state
85 #:%random-single-float
86 #:%random-double-float
87 #+(or scl clisp) #:%random-long-float
88 #+cmu #:%random-double-double-float
89 #:random-chunk
90 #:init-random-state))
92 ;; This package is for the implmentation of the BIGFLOAT routines that
93 ;; make working with Maxima's bfloat objects somewhat easier by
94 ;; extending the standard CL numeric functions to work with BIGFLOAT
95 ;; and COMPLEX-BIGFLOAT objects. See src/numeric.lisp for the
96 ;; implementation.
97 (defpackage bigfloat-impl
98 (:use :cl)
99 #+gcl
100 (:shadowing-import-from #:system #:define-compiler-macro)
101 (:shadow #:+
105 #:1+
106 #:1-
107 #:zerop
108 #:plusp
109 #:minusp
110 #:abs
111 #:sqrt
112 #:log
113 #:exp
114 #:sin
115 #:cos
116 #:tan
117 #:asin
118 #:acos
119 #:atan
120 #:sinh
121 #:cosh
122 #:tanh
123 #:asinh
124 #:acosh
125 #:atanh
126 #:expt
128 #:/=
131 #:<=
132 #:>=
133 #:scale-float
134 #:realpart
135 #:imagpart
136 #:complex
137 #:conjugate
138 #:max
139 #:min
140 #:cis
141 #:phase
142 #:floor
143 #:ffloor
144 #:incf
145 #:decf
146 #:realp
147 #:complexp
148 #:numberp
149 #:integer-decode-float
150 #:decode-float
151 #:float
152 #:ceiling
153 #:fceiling
154 #:truncate
155 #:ftruncate
156 #:round
157 #:fround
158 #:random
159 #:signum
160 #:float-sign
161 #:float-digits
162 #:rational
163 #:rationalize
164 #:coerce
166 ;; If any of these exported symbols are updated, update the
167 ;; shadowing-import-from list for BIGFLOAT-USER too!
169 ;; Export types
170 (:export #:bigfloat
171 #:complex-bigfloat)
172 ;; Export functions
173 (:export #:bigfloat
174 #:to
175 #:maybe-to
176 #:epsilon
177 #:%pi
178 #:%e
179 ;; CL equivalents
184 #:1+
185 #:1-
186 #:zerop
187 #:plusp
188 #:minusp
189 #:abs
190 #:sqrt
191 #:log
192 #:exp
193 #:sin
194 #:cos
195 #:tan
196 #:asin
197 #:acos
198 #:atan
199 #:sinh
200 #:cosh
201 #:tanh
202 #:asinh
203 #:acosh
204 #:atanh
205 #:expt
207 #:/=
210 #:<=
211 #:>=
212 #:scale-float
213 #:realpart
214 #:imagpart
215 #:complex
216 #:conjugate
217 #:max
218 #:min
219 #:cis
220 #:phase
221 #:floor
222 #:ffloor
223 #:incf
224 #:decf
225 #:realp
226 #:complexp
227 #:numberp
228 #:integer-decode-float
229 #:decode-float
230 #:float
231 #:ceiling
232 #:fceiling
233 #:truncate
234 #:ftruncate
235 #:round
236 #:fround
237 #:random
238 #:signum
239 #:float-sign
240 #:float-digits
241 #:rational
242 #:rationalize
243 #:coerce
246 ;; BIGFLOAT is the package intended to be used for applications
247 ;; using the routines from the BIGFLOAT-IMPL.
248 (defpackage bigfloat
249 (:use :cl :bigfloat-impl)
250 #+gcl
251 (:shadowing-import-from #:system #:define-compiler-macro)
252 ;; This list should match the SHADOWING-IMPORT-FROM list in
253 ;; BIGFLOAT-IMPL.
254 (:shadowing-import-from #:bigfloat-impl
259 #:1+
260 #:1-
261 #:zerop
262 #:plusp
263 #:minusp
264 #:abs
265 #:sqrt
266 #:log
267 #:exp
268 #:sin
269 #:cos
270 #:tan
271 #:asin
272 #:acos
273 #:atan
274 #:sinh
275 #:cosh
276 #:tanh
277 #:asinh
278 #:acosh
279 #:atanh
280 #:expt
282 #:/=
285 #:<=
286 #:>=
287 #:scale-float
288 #:realpart
289 #:imagpart
290 #:complex
291 #:conjugate
292 #:max
293 #:min
294 #:cis
295 #:phase
296 #:floor
297 #:ffloor
298 #:incf
299 #:decf
300 #:realp
301 #:complexp
302 #:numberp
303 #:integer-decode-float
304 #:decode-float
305 #:float
306 #:ceiling
307 #:fceiling
308 #:truncate
309 #:ftruncate
310 #:round
311 #:fround
312 #:random
313 #:signum
314 #:float-sign
315 #:float-digits
316 #:rational
317 #:rationalize
318 #:coerce
320 (:export #:lentz
321 #:sum-power-series
322 #:format-e
323 #:format-f
324 #:format-g))
326 ;; Export all the external symbols in BIGFLOAT-IMPL from BIGFLOAT too.
327 (do-external-symbols (s '#:bigfloat-impl)
328 (export s '#:bigfloat))
330 ;; For CMUCL, we lock the bigfloat-impl package so we don't
331 ;; accidentally modify the implementation.
332 #+cmu
333 (defun lock-maxima-packages ()
334 (let ((package-names '(#:bigfloat-impl)))
335 (dolist (p package-names)
336 (let ((p (find-package p)))
337 (when p
338 (setf (package-definition-lock p) t)
339 (setf (package-lock p) t)))))
340 (values))
343 #+cmu
344 (progn
345 (lock-maxima-packages)
346 (pushnew 'lock-maxima-packages ext:*after-save-initializations*))
349 ;; Some versions of CMUCL already have a compatible version of INTL,
350 ;; so skip it if we have it. CMUCL will already define the INTL
351 ;; package correctly.
353 #+#.(cl:if (cl:and (cl:member :cmu cl:*features*) (cl:find-package '#:intl)) '(or) '(and))
354 (defpackage :intl
355 (:use :common-lisp)
356 (:export #:setlocale #:textdomain #:gettext #:dgettext
357 #:ngettext #:dngettext
358 #:*translatable-dump-stream* #:*locale*
359 #:*locale-directories*
360 #:read-translatable-string)
361 #+gcl
362 (:shadowing-import-from #:system #:define-compiler-macro))
364 ;; (getalias '$lambda) => CL:LAMBDA, which implies that Maxima parses lambda as CL:LAMBDA.
365 ;; Unlocking the :common-lisp package seems to be the simplest way to avoid an error.
366 ;; (Shadowing LAMBDA causes errors and removing the alias causes some other errors. Oh well.)
367 #+(and sbcl sb-package-locks) (sb-ext:unlock-package :common-lisp)
369 (provide :maxima)