Updated the documentation and test suite to reflect the fact that html is now ps...
[clinton/parenscript.git] / src / deprecated-interface.lisp
CommitLineData
9da682ca
RD
1(in-package :parenscript)
2
71089439
AL
3(define-condition simple-style-warning (simple-condition style-warning)
4 ())
5
6(defun warn-deprecated (old-name &optional new-name)
7 (warn 'simple-style-warning
8 :format-control "~:@(~a~) is deprecated~:[.~;, use ~:@(~a~) instead~]"
9 :format-arguments (list old-name new-name new-name)))
7590646c 10
3393fbce
VS
11(defmacro defun-js (old-name new-name args &body body)
12 `(defun ,old-name ,args
13 ,(when (and (stringp (car body)) (< 1 (length body))) ;; docstring
14 (car body))
15 (warn-deprecated ',old-name ',new-name)
b8307869 16 ,@body))
3393fbce 17
9da682ca 18;;; DEPRECATED INTERFACE ;;;
7590646c 19
3393fbce 20(defun-js js-equal script-equal (a b)
7590646c 21 (script-equal a b))
9da682ca 22
3393fbce 23(defun-js js-compile compile-script (form)
9da682ca
RD
24 (compile-script form :output-spec :javascript))
25
3393fbce 26(defun-js js-compile-list compile-script (form)
9da682ca
RD
27 (compile-script form :output-spec :javascript))
28
7590646c 29(defmacro defjsmacro (&rest args)
b5be3f57 30 (warn-deprecated 'defjsmacro 'defpsmacro)
4a987e2b 31 `(defpsmacro ,@args))
7590646c 32
5aa10005 33(defmacro js-file (&rest body)
71089439 34 (warn-deprecated 'js-file)
5aa10005
RD
35 `(html
36 (:princ
37 (js ,@body))))
38
39(defmacro js-script (&rest body)
71089439 40 (warn-deprecated 'js-script)
5aa10005
RD
41 `((:script :type "text/javascript")
42 (:princ (format nil "~%// <![CDATA[~%"))
43 (:princ (js ,@body))
44 (:princ (format nil "~%// ]]>~%"))))
45
46(defmacro js-inline (&rest body)
71089439 47 (warn-deprecated 'js-inline)
5aa10005
RD
48 `(js-inline* '(progn ,@body)))
49
50(defmacro js-inline* (&rest body)
71089439 51 (warn-deprecated 'js-inline*)
5aa10005
RD
52 `(concatenate 'string "javascript:"
53 (string-join (js-to-statement-strings (compile-script-form (list 'progn ,@body)) 0) " ")))
7590646c
VS
54
55(defmacro with-unique-js-names (&rest args)
56 (warn-deprecated 'with-unique-js-names 'with-unique-ps-names)
57 `(with-unique-ps-names ,@args))
58
59(defmacro gen-js-name (&rest args)
60 (warn-deprecated 'gen-js-name 'gen-ps-name)
4a987e2b 61 `(ps-gensym ,@args))
7590646c 62
4a987e2b
VS
63(defmacro js (&rest args)
64 `(ps ,@args))
65
66(defmacro js* (&rest args)
67 `(ps ,@args))