Removed reference to without-packages in deprecated-interface.lisp.
[clinton/parenscript.git] / src / deprecated-interface.lisp
1 (in-package :parenscript)
2
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)))
10
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)
16 ,@body))
17
18 ;;; DEPRECATED INTERFACE ;;;
19
20 (defun-js js-equal script-equal (a b)
21 (script-equal a b))
22
23 (defun-js js-compile compile-script (form)
24 (compile-script form :output-spec :javascript))
25
26 (defun-js js-compile-list compile-script (form)
27 (compile-script form :output-spec :javascript))
28
29 (defmacro defjsmacro (&rest args)
30 (warn-deprecated 'defjsmacro 'defpsmacro)
31 `(defscriptmacro ,@args))
32
33 (defmacro js-file (&rest body)
34 (warn-deprecated 'js-file)
35 `(html
36 (:princ
37 (js ,@body))))
38
39 (defmacro js-script (&rest body)
40 (warn-deprecated 'js-script)
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)
47 (warn-deprecated 'js-inline)
48 `(js-inline* '(progn ,@body)))
49
50 (defmacro js-inline* (&rest body)
51 (warn-deprecated 'js-inline*)
52 `(concatenate 'string "javascript:"
53 (string-join (js-to-statement-strings (compile-script-form (list 'progn ,@body)) 0) " ")))
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)
61 `(gen-ps-name ,@args))
62
63 (defmacro gen-js-name-string (&rest args)
64 (warn-deprecated 'gen-js-name-string 'gen-script-name-string)
65 `(gen-script-name-string ,@args))