Some minor comment and whitespace cleanup.
[clinton/parenscript.git] / src / deprecated-interface.lisp
dissimilarity index 70%
index 5c5764f..85470e9 100644 (file)
@@ -1,61 +1,53 @@
-(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)))
-
-;;; DEPRECATED INTERFACE ;;;
-
-(defun js-equal (a b)
-  (warn-deprecated 'js-equal 'script-equal)
-  (script-equal a b))
-
-(defun js-compile (form)
-  (warn-deprecated 'js-compile 'compile-script)
-  (compile-script form :output-spec :javascript))
-
-(defun js-compile-list (form)
-  (warn-deprecated 'js-compile-list 'compile-script)
-  (compile-script form :output-spec :javascript))
-
-(defmacro defjsmacro (&rest args)
-  (warn-deprecated 'defjsmacro 'defpsmacro)
-  `(defscriptmacro ,@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)
-  `(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) " ")))
-
-(defmacro with-unique-js-names (&rest args)
-  (warn-deprecated 'with-unique-js-names 'with-unique-ps-names)
-  `(with-unique-ps-names ,@args))
-
-(defmacro gen-js-name (&rest args)
-  (warn-deprecated 'gen-js-name 'gen-ps-name)
-  `(gen-ps-name ,@args))
-
-(defmacro gen-js-name-string (&rest args)
-  (warn-deprecated 'gen-js-name-string 'gen-script-name-string)
-  `(gen-script-name-string ,@args))
+(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
+
+(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))