Cleaned up deprecated interface, added Lisp/ParenScript macro-defining macros back...
[clinton/parenscript.git] / src / deprecated-interface.lisp
1 (in-package :parenscript)
2
3 (defun warn-deprecated (old-name new-name)
4 (warn (format nil "~:@(~a~) is deprecated. Use ~:@(~a~) instead." old-name new-name)))
5
6 ;;; DEPRECATED INTERFACE ;;;
7
8 (defun js-equal (a b)
9 (warn-deprecated 'js-equal 'script-equal)
10 (script-equal a b))
11
12 (defun js-compile (form)
13 (warn-deprecated 'js-compile 'compile-script)
14 (compile-script form :output-spec :javascript))
15
16 (defun js-compile-list (form)
17 (warn-deprecated 'js-compile-list 'compile-script)
18 (compile-script form :output-spec :javascript))
19
20 (defun js-gensym (&rest args)
21 (warn-deprecated 'js-gensym 'script-gensym)
22 (apply #'script-gensym args))
23
24 (defmacro defjsmacro (&rest args)
25 (warn-deprecated 'defjsmacro 'defscriptmacro)
26 `(defscriptmacro ,@args))
27
28 (defmacro js (&body body)
29 (warn-deprecated 'js 'ps)
30 `(script ,@body))
31
32 (defmacro js* (&body body)
33 (warn-deprecated 'js* 'ps*)
34 `(script* ,@body))
35
36 (defun js-to-string (expr)
37 "Given an AST node, compiles it to a Javascript string."
38 (warn "JS-TO-STRING is deprecated.")
39 (string-join
40 (ps-js::js-to-statement-strings (compile-script-form expr) 0)
41 (string #\Newline)))
42
43 (defun js-to-line (expr)
44 "Given an AST node, compiles it to a Javascript string."
45 (warn "JS-TO-LINE is deprecated.")
46 (string-join
47 (ps-js::js-to-statement-strings (compile-script-form expr) 0) " "))
48
49 (defmacro js-file (&rest body)
50 (warn "JS-FILE is deprecated.")
51 `(html
52 (:princ
53 (js ,@body))))
54
55 (defmacro js-script (&rest body)
56 (warn "JS-SCRIPT is deprecated.")
57 `((:script :type "text/javascript")
58 (:princ (format nil "~%// <![CDATA[~%"))
59 (:princ (js ,@body))
60 (:princ (format nil "~%// ]]>~%"))))
61
62 (defmacro js-inline (&rest body)
63 (warn "JS-INLINE is deprecated.")
64 `(js-inline* '(progn ,@body)))
65
66 (defmacro js-inline* (&rest body)
67 (warn "JS-INLINE* is deprecated.")
68 `(concatenate 'string "javascript:"
69 (string-join (js-to-statement-strings (compile-script-form (list 'progn ,@body)) 0) " ")))
70
71 (defmacro with-unique-js-names (&rest args)
72 (warn-deprecated 'with-unique-js-names 'with-unique-ps-names)
73 `(with-unique-ps-names ,@args))
74
75 (defmacro gen-js-name (&rest args)
76 (warn-deprecated 'gen-js-name 'gen-ps-name)
77 `(gen-ps-name ,@args))
78
79 (defmacro gen-js-name-string (&rest args)
80 (warn-deprecated 'gen-js-name-string 'gen-script-name-string)
81 `(gen-script-name-string ,@args))