Added a file PS-DOM with handy utility macros for DOM functionality, e.g. Lispy ways...
[clinton/parenscript.git] / src / package.lisp
index 1810946..ac0280d 100644 (file)
@@ -1,16 +1,16 @@
-(in-package :cl-user)
+(in-package "CL-USER")
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (defparameter *parenscript-lang-exports*
-    '(
-      ;; literals
+    '(;; literals
       #:t
       #:f
       #:true
-      #.(symbol-name 'nil) ;; for case-sensitive Lisps like some versions of Allegro
+      #.(symbol-name 'nil) ; for case-sensitive Lisps like some versions of Allegro
       #:this
       #:false
       #:undefined
+      #:{}
 
       ;; keywords
       #:break
@@ -20,7 +20,9 @@
       #:array
       #:list
       #:aref
+      #:elt
       #:make-array
+      #:[]
 
       ;; operators
       #:! #:not #:~
@@ -39,7 +41,6 @@
       #:\|\| #:or
       #:>>= #:<<=
       #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~=
-      #:1+ #:1-
       #:incf #:decf
 
       ;; body forms
       #:create
       #:with-slots
 
-      ;; macros
-      #:macrolet
-      #:symbol-macrolet
-
       ;; if
       #:if
       #:when
       ;; assignment and binding
       #:setf
       #:defsetf
+      #:psetf
+      #:setq
+      #:psetq
       #:simple-let*
-      #:let*
+      #:simple-let
       #:lexical-let*
       #:lexical-let
+      #:let*
+      #:let
 
       ;; variables
       #:var
       #:defvar
 
       ;; iteration
+      #:labeled-for
       #:for
-      #:doeach
+      #:for-in
       #:while
+      #:do
+      #:do*
+      #:dotimes
+      #:dolist
+      #:loop
 
       ;; with
       #:with
       ;; function definition
       #:defun
       #:lambda
+      #:flet
+      #:labels
 
       ;; lambda lists
       #:&key
       #:macrolet
       #:symbol-macrolet
       #:define-symbol-macro
-      #:define-script-symbol-macro
+      #:define-ps-symbol-macro
       #:defmacro
 
       ;; lisp eval
       #:lisp
 
-      ;; iteration
-      #:do
-      #:dotimes
-      #:dolist
-      #:doeach
-      #:while
-
       ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
 
       ;; html generator for javascript
+      #:*ps-html-empty-tag-aware-p*
+      #:*ps-html-mode*
       #:ps-html
+      #:who-ps-html
 
       ;; utils
       #:do-set-timeout
-      #:min
       #:max
+      #:min
+      #:floor
       #:ceiling
-      #:abs
+      #:round
       #:sin
       #:cos
       #:tan
-      #:acos
       #:asin
+      #:acos
       #:atan
+      #:pi
+      #:sinh
+      #:cosh
+      #:tanh
+      #:asinh
+      #:acosh
+      #:atanh
+      #:1+
+      #:1-
+      #:abs
+      #:evenp
+      #:oddp
       #:exp
-      #:floor
       #:expt
-      #:round
+      #:log
+      #:sqrt
       #:random
-      #:oddp
-      #:evenp
       #:ignore-errors
       #:concatenate
+      #:concat-string
       #:length
       #:null
+      #:defined
+      #:undefined
       #:@
-
+      #:with-lambda
+      #:stringp
+      #:numberp
+      #:functionp
+      #:objectp
+      #:memoize
+      #:append
+      #:apply
+      #:destructuring-bind
+
+      ;; DOM accessing utils
+      #:inner-html
+      #:uri-encode
+      #:attribute
+      #:offset
+      #:scroll
+      #:inner
+      #:client
+      
       ;; js runtime utils
       #:*ps-lisp-library*
       #:mapcar
       #:append
       #:set-difference
       ))
-  "All symbols considered part of the Parenscript language.")
+  (defparameter *parenscript-interface-exports*
+    '(;; compiler
+      #:compile-script
+      #:ps
+      #:ps-doc
+      #:ps-doc*
+      #:ps*
+      #:ps1*
+      #:ps-inline
+      #:ps-inline*
+
+      ;; for parenscript macro definition within lisp
+      #:defpsmacro
+      #:defmacro/ps
+      #:defmacro+ps
+      #:import-macros-from-lisp
+
+      ;; gensym
+      #:ps-gensym
+      #:with-ps-gensyms
+      #:ps-once-only
+      #:*ps-gensym-counter*
+
+      ;; naming and namespaces
+      #:ps-package-prefix
+      #:obfuscate-package
+      #:unobfuscate-package
+
+      ;; printer
+      #:symbol-to-js-string
+      #:*js-string-delimiter*
+      #:*js-inline-string-delimiter*
+      #:*ps-print-pretty*
+      #:*indent-num-spaces*
+      ))
+  (defparameter *parenscript-interface-deprecated-exports*
+    '(;; deprecated interface
+      #:define-script-symbol-macro
+      #:gen-js-name
+      #:with-unique-js-names
+      #:defjsmacro
+      #:js-compile
+      #:js-inline
+      #:js-inline*
+      #:js
+      #:js*
+      #:symbol-to-js
+      ))
+
+  (defparameter *javascript-exports*
+    '(;; for representing js code as s-expressions
+      #:?
+      #:if
+      #:unary-operator
+      #:--
+      #:!
+      #:block
+      #:literal
+      #:break
+      #:continue
+      #:return
+      #:throw
+      #:array
+      #:aref
+      #:++
+      #:+=
+      #:operator
+      #:-=
+      #:-
+      #:=
+      #:cond
+      #:lambda
+      #:object
+      #:variable
+      #:slot-value
+      #:new
+      #:funcall
+      #:instanceof
+      #:in
+      #:escape
+      ))
+  )
 
-(defpackage :parenscript
-  (:use :common-lisp)
-  (:nicknames :js :ps)
+(defpackage "PARENSCRIPT"
+  (:use "COMMON-LISP")
+  (:nicknames "JS" "PS")
   #.(cons :export *parenscript-lang-exports*)
+  #.(cons :export *parenscript-interface-exports*)
+  #.(cons :export *parenscript-interface-deprecated-exports*)
+  #.(cons :export *javascript-exports*)
+  )
 
-  ;;; symbols that form the interface to the Parenscript compiler
-  (:export
-   ;; compiler
-   #:compile-script
-   #:ps
-   #:ps*
-   #:ps-inline
-   #:ps-inline*
-
-   ;; for parenscript macro definition within lisp
-   #:defpsmacro
-   #:defmacro/ps
-   #:defmacro+ps
-   #:import-macros-from-lisp
-
-   ;; gensym
-   #:ps-gensym
-   #:with-ps-gensyms
-   #:*ps-gensym-counter*
-
-   ;; naming and namespaces
-   #:ps-package-prefix
-   #:obfuscate-package
-   #:unobfuscate-package
-
-   ;; printer
-   #:*js-string-delimiter*
-   #:*js-inline-string-delimiter*
-   #:*ps-print-pretty*
-   #:*indent-num-spaces*
-
-   ;; deprecated interface
-   #:gen-js-name
-   #:gen-js-name-string
-   #:with-unique-js-names
-   #:defjsmacro
-   #:js-compile
-   #:js-inline
-   #:js-inline*
-   #:js-file
-   #:js-script
-   #:js-to-statement-strings
-   #:js
-   #:js*
-   #:let
-   ))
-
-(defpackage :parenscript-special-forms
-  (:use))