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