-(in-package :parenscript)
-
-;;; DEPRECATED INTERFACE ;;;
-(defun js-equal (a b) (script-equal a b))
-
-(defun js-compile (form)
- (compile-script form :output-spec :javascript))
-
-(defun js-compile-list (form)
- (compile-script form :output-spec :javascript))
-
-(defun js-gensym (&rest args)
- (apply #'script-gensym args))
-
-(defmacro defjsmacro (name args &rest body)
- "Define a ParenScript macro, and store it in the toplevel ParenScript macro environment.
-
-DEPRECATED"
- `(defscriptmacro ,name ,args ,@body))
-
-;;; dual lisp/parenscript macro balderdash
-;;; TODO: should probably move elsewhere ;;;
-#+nil
-(progn
-(defmacro defmacro/js (name args &body body)
- "Define a Lisp macro and import it into the ParenScript macro environment."
- `(progn (defmacro ,name ,args ,@body)
- (js:import-macros-from-lisp ',name)))
-
-(defmacro defmacro+js (name args &body body)
- "Define a Lisp macro and a ParenScript macro in their respective
-macro environments. This function should be used when you want to use
-the same macro in both Lisp and ParenScript, but the 'macroexpand' of
-that macro in Lisp makes the Lisp macro unsuitable to be imported into
-the ParenScript macro environment."
- `(progn (defmacro ,name ,args ,@body)
- (defscriptmacro ,name ,args ,@body)))
-
-(defun import-macros-from-lisp (&rest names)
- "Import the named Lisp macros into the ParenScript macro environment."
- (dolist (name names)
- (let ((name name))
- (undefine-js-special-form name)
- (setf (get-macro-spec name *script-macro-toplevel*)
- (cons nil (lambda (&rest args)
- (macroexpand `(,name ,@args))))))))
-
-(defmacro js-file (&rest body)
- `(html
- (:princ
- (js ,@body))))
-
-(defmacro js-script (&rest body)
- `((:script :type "text/javascript")
- (:princ (format nil "~%// <![CDATA[~%"))
- (:princ (js ,@body))
- (:princ (format nil "~%// ]]>~%"))))
-
-(defmacro js-inline (&rest body)
- `(js-inline* '(progn ,@body)))
-
-(defmacro js-inline* (&rest body)
- "Just like JS-INLINE except that BODY is evaluated before being
-converted to javascript."
- `(concatenate 'string "javascript:"
- (string-join (js-to-statement-strings (compile-script-form (list 'progn ,@body)) 0) " ")))
-)
\ No newline at end of file
+(in-package :parenscript)
+
+(define-condition simple-style-warning (simple-condition style-warning)
+ ())
+
+(defun warn-deprecated (old-name &optional new-name)
+ (warn 'simple-style-warning
+ :format-control "~:@(~a~) is deprecated~:[.~;, use ~:@(~a~) instead~]"
+ :format-arguments (list old-name new-name new-name)))
+
+(defmacro defun-js (old-name new-name args &body body)
+ `(defun ,old-name ,args
+ ,(when (and (stringp (car body)) (< 1 (length body))) ; docstring
+ (car body))
+ (warn-deprecated ',old-name ',new-name)
+ ,@body))
+
+;;; DEPRECATED INTERFACE
+
+(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))
+
+(defun-js js-compile-list compile-script (form)
+ (compile-script form))
+
+(defmacro defjsmacro (&rest args)
+ (warn-deprecated 'defjsmacro 'defpsmacro)
+ `(defpsmacro ,@args))
+
+(defmacro js-inline (&rest body)
+ (warn-deprecated 'js-inline 'ps-inline)
+ `(js-inline* '(progn ,@body)))
+
+(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-ps-gensyms)
+ `(with-ps-gensyms ,@args))
+
+(defun-js gen-js-name ps-gensym (&optional (prefix "_js_"))
+ (ps-gensym prefix))
+
+(defmacro js (&rest args)
+ (warn-deprecated 'js 'ps)
+ `(ps ,@args))
+
+(defun-js js* ps* (&rest args)
+ (apply #'ps* args))
+
+(defun-js compile-script ps* (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" (ps* ps-form)))
+
+(defun-js symbol-to-js symbol-to-js-string (symbol)
+ (symbol-to-js-string symbol))