(defmacro defun-js (old-name new-name args &body body)
`(defun ,old-name ,args
- ,(when (and (stringp (car body)) (< 1 (length body))) ;; docstring
+ ,(when (and (stringp (car body)) (< 1 (length body))) ; docstring
(car body))
(warn-deprecated ',old-name ',new-name)
,@body))
-;;; DEPRECATED INTERFACE ;;;
+;;; DEPRECATED INTERFACE
-(defun-js js-equal script-equal (a b)
- (script-equal a b))
+(defmacro define-script-symbol-macro (name &body body)
+ (warn-deprecated 'define-script-symbol-macro 'define-ps-symbol-macro)
+ `(define-ps-symbol-macro ,name ,@body))
+
+(defun js-equal (ps-form1 ps-form2)
+ (warn-deprecated 'js-equal)
+ (equalp ps-form1 ps-form2))
(defun-js js-compile compile-script (form)
- (compile-script form :output-spec :javascript))
+ (compile-script form))
(defun-js js-compile-list compile-script (form)
- (compile-script form :output-spec :javascript))
+ (compile-script form))
(defmacro defjsmacro (&rest args)
(warn-deprecated 'defjsmacro 'defpsmacro)
`(defpsmacro ,@args))
-(defmacro js-file (&rest body)
- (warn-deprecated 'js-file)
- `(html
- (:princ
- (js ,@body))))
-
-(defmacro js-script (&rest body)
- (warn-deprecated 'js-script)
- `((:script :type "text/javascript")
- (:princ (format nil "~%// <![CDATA[~%"))
- (:princ (js ,@body))
- (:princ (format nil "~%// ]]>~%"))))
-
(defmacro js-inline (&rest body)
- (warn-deprecated 'js-inline)
+ (warn-deprecated 'js-inline 'ps-inline)
`(js-inline* '(progn ,@body)))
-(defmacro js-inline* (&rest body)
- (warn-deprecated 'js-inline*)
- `(concatenate 'string "javascript:"
- (string-join (js-to-statement-strings (compile-script-form (list 'progn ,@body)) 0) " ")))
+(defun-js js-inline* ps-inline* (&rest body)
+ (apply #'ps-inline* body))
(defmacro with-unique-js-names (&rest args)
- (warn-deprecated 'with-unique-js-names 'with-unique-ps-names)
- `(with-unique-ps-names ,@args))
+ (warn-deprecated 'with-unique-js-names 'with-ps-gensyms)
+ `(with-ps-gensyms ,@args))
-(defmacro gen-js-name (&rest args)
- (warn-deprecated 'gen-js-name 'gen-ps-name)
- `(ps-gensym ,@args))
+(defun-js gen-js-name ps-gensym (&optional (prefix "_js_"))
+ (ps-gensym prefix))
(defmacro js (&rest args)
+ (warn-deprecated 'js 'ps)
`(ps ,@args))
-(defmacro js* (&rest args)
- `(ps ,@args))
\ No newline at end of file
+(defun-js js* ps* (&rest args)
+ (apply #'ps* args))
+
+(defun-js compile-script ps1* (ps-form &key (output-stream nil))
+ "Compiles the Parenscript form PS-FORM into Javascript.
+If OUTPUT-STREAM is NIL, then the result is a string; otherwise code
+is output to the OUTPUT-STREAM stream."
+ (format output-stream "~A" (ps1* ps-form)))
+
+(defun-js symbol-to-js symbol-to-js-string (symbol)
+ (symbol-to-js-string symbol))