Fix initial value handling of ps-runtime-lib's REDUCE
[parenscript.git] / src / package.lisp
blobfbfb2b58da8e66c7535ef9910d28c85718f9dc43
1 ;;; Copyright 2005 Manuel Odendahl
2 ;;; Copyright 2005-2006 Edward Marco Baringer
3 ;;; Copyright 2006 Luca Capello
4 ;;; Copyright 2006 Atilla Lendvai
5 ;;; Copyright 2007-2012 Vladimir Sedach
6 ;;; Copyright 2007 Red Daly
7 ;;; Copyright 2008 Travis Cross
9 ;;; SPDX-License-Identifier: BSD-3-Clause
11 ;;; Redistribution and use in source and binary forms, with or
12 ;;; without modification, are permitted provided that the following
13 ;;; conditions are met:
15 ;;; 1. Redistributions of source code must retain the above copyright
16 ;;; notice, this list of conditions and the following disclaimer.
18 ;;; 2. Redistributions in binary form must reproduce the above
19 ;;; copyright notice, this list of conditions and the following
20 ;;; disclaimer in the documentation and/or other materials provided
21 ;;; with the distribution.
23 ;;; 3. Neither the name of the copyright holder nor the names of its
24 ;;; contributors may be used to endorse or promote products derived
25 ;;; from this software without specific prior written permission.
27 ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
28 ;;; CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
29 ;;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 ;;; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31 ;;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
32 ;;; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33 ;;; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
34 ;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 ;;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
36 ;;; ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 ;;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 ;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 ;;; POSSIBILITY OF SUCH DAMAGE.
41 (in-package #:cl)
43 (pushnew :parenscript *features*)
45 (eval-when (:compile-toplevel :load-toplevel :execute)
46 (unless (named-readtables:find-readtable :parenscript)
47 (named-readtables:defreadtable :parenscript
48 (:merge :standard)
49 (:case #.(if (eql :upcase (readtable-case *readtable*))
50 :invert
51 (readtable-case *readtable*))))))
53 (named-readtables:in-readtable :parenscript)
55 (defpackage #:parenscript
56 (:use #:cl #:anaphora #:named-readtables)
57 (:nicknames #:ps)
58 (:export
59 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
60 ;;; Compiler interface
62 ;; compiler
63 #:*js-target-version*
64 #:ps
65 #:*parenscript-stream*
66 #:ps-to-stream
67 #:ps-doc
68 #:ps-doc*
69 #:ps*
70 #:ps-inline
71 #:ps-inline*
72 #:*ps-read-function*
73 #:ps-compile-file
74 #:ps-compile-stream
75 ;; for parenscript macro definition within lisp
76 #:defpsmacro
77 #:defmacro+ps
78 #:import-macros-from-lisp
79 #:*defined-operators*
80 #:*version*
82 ;; gensym
83 #:ps-gensym
84 #:with-ps-gensyms
85 #:ps-once-only
86 #:maybe-once-only
87 #:*ps-gensym-counter*
89 ;; naming and namespaces
90 #:in-package
91 #:use-package
92 #:ps-package-prefix
93 #:obfuscate-package
94 #:unobfuscate-package
96 ;; printer
97 #:symbol-to-js-string
98 #:*js-string-delimiter*
99 #:*js-inline-string-delimiter*
100 #:*ps-print-pretty*
101 #:*indent-num-spaces*
103 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
104 ;;; Language
106 ;; literals
108 #:nil
110 ;; array literals
111 #:array
112 #:list
113 #:aref
114 #:elt
115 #:make-array
116 #:[]
118 ;; operators
119 ;; logical boolean
120 #:not
121 #:and
122 #:or
124 ;; bitwise boolean
125 #:logand
126 #:logior
127 #:logxor
128 #:lognot
129 #:ash
133 #:rem
134 #:mod
139 #:<=
140 #:>=
141 #:incf
142 #:decf
143 #:equal
144 #:eql
145 #:eq
148 ;; compile-time stuff
149 #:eval-when
151 ;; body forms
152 #:progn
154 ;; if
155 #:if
156 #:when
157 #:unless
159 ;; control flow
160 #:return
161 #:return-from
162 #:throw
164 ;; assignment and binding
165 #:setf
166 #:defsetf
167 #:psetf
168 #:setq
169 #:psetq
170 #:let*
171 #:let
173 ;; variables
174 #:defvar
176 ;; iteration
177 #:do
178 #:do*
179 #:dotimes
180 #:dolist
181 #:loop
183 ;; case
184 #:switch
185 #:case
186 #:default
188 ;; function definition
189 #:defun
190 #:lambda
191 #:flet
192 #:labels
194 ;; lambda lists
195 #:&key
196 #:&rest
197 #:&body
198 #:&optional
199 #:&aux
200 #:&environment
201 #:&key-object
203 ;; macros
204 #:macrolet
205 #:symbol-macrolet
206 #:define-symbol-macro
207 #:define-ps-symbol-macro
208 #:defmacro
210 ;; utils
211 #:max
212 #:min
213 #:floor
214 #:ceiling
215 #:round
216 #:sin
217 #:cos
218 #:tan
219 #:asin
220 #:acos
221 #:atan
222 #:pi
223 #:sinh
224 #:cosh
225 #:tanh
226 #:asinh
227 #:acosh
228 #:atanh
229 #:1+
230 #:1-
231 #:abs
232 #:evenp
233 #:oddp
234 #:exp
235 #:expt
236 #:log
237 #:sqrt
238 #:random
239 #:ignore-errors
240 #:concatenate
241 #:length
242 #:stringp
243 #:numberp
244 #:functionp
245 #:append
246 #:apply
247 #:destructuring-bind
249 ;; js runtime utils
250 #:*ps-lisp-library*
251 #:mapcar
252 #:map-into
253 #:map
254 #:member
255 #:append
256 #:set-difference
258 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
259 ;;; Non-Common Lisp functionality
261 ;; DOM accessing utils
262 #:inner-html
263 #:uri-encode
264 #:attribute
265 #:offset
266 #:scroll
267 #:inner
268 #:client
270 ;; utils
272 #:chain
273 #:defined
274 #:undefined
275 #:booleanp
276 #:objectp
277 #:stringify
279 ;; html generator for javascript
280 #:*ps-html-empty-tag-aware-p*
281 #:*ps-html-mode*
282 #:ps-html
283 #:who-ps-html
285 ;; lisp eval
286 #:lisp
288 ;; js object stuff
289 #:delete
290 #:typeof
291 #:instanceof
292 #:new
293 #:create
295 ;; slot access
296 #:with-slots
297 #:getprop
298 #:in
300 ;; literals
301 #:regex
302 #:this
303 #:undefined
304 #:{}
305 #:false
307 ;; iteration
308 #:for
309 #:for-in
310 #:while
312 ;; global var
313 #:var
315 ;; control flow
316 #:try
317 #:break
318 #:continue
320 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
321 ;;; Deprecated functionality
323 #:define-script-symbol-macro
324 #:gen-js-name
325 #:with-unique-js-names
326 #:defjsmacro
327 #:js-compile
328 #:js-inline
329 #:js-inline*
330 #:js
331 #:js*
332 #:symbol-to-js
333 #:slot-value
334 #:compile-script
335 #:defmacro/ps
337 #:==
338 #:===
339 #:!=
340 #:!==
341 #:labeled-for
342 #:do-set-timeout
343 #:concat-string
344 #:with
345 #:label
347 #:bind
348 #:bind*