Commit | Line | Data |
---|---|---|
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 | |
45c9f9c2 | 13 | ,(when (and (stringp (car body)) (< 1 (length body))) ; docstring |
3393fbce VS |
14 | (car body)) |
15 | (warn-deprecated ',old-name ',new-name) | |
b8307869 | 16 | ,@body)) |
3393fbce | 17 | |
45c9f9c2 | 18 | ;;; DEPRECATED INTERFACE |
7590646c | 19 | |
b65b21c2 TC |
20 | (defmacro define-script-symbol-macro (name &body body) |
21 | (warn-deprecated 'define-script-symbol-macro 'define-ps-symbol-macro) | |
22 | `(define-ps-symbol-macro ,name ,@body)) | |
23 | ||
0d971f14 VS |
24 | (defun js-equal (ps-form1 ps-form2) |
25 | (warn-deprecated 'js-equal) | |
26 | (equalp ps-form1 ps-form2)) | |
9da682ca | 27 | |
3393fbce | 28 | (defun-js js-compile compile-script (form) |
0d971f14 | 29 | (compile-script form)) |
9da682ca | 30 | |
3393fbce | 31 | (defun-js js-compile-list compile-script (form) |
0d971f14 | 32 | (compile-script form)) |
9da682ca | 33 | |
7590646c | 34 | (defmacro defjsmacro (&rest args) |
b5be3f57 | 35 | (warn-deprecated 'defjsmacro 'defpsmacro) |
4a987e2b | 36 | `(defpsmacro ,@args)) |
7590646c | 37 | |
5aa10005 | 38 | (defmacro js-inline (&rest body) |
0d971f14 | 39 | (warn-deprecated 'js-inline 'ps-inline) |
5aa10005 RD |
40 | `(js-inline* '(progn ,@body))) |
41 | ||
0d971f14 VS |
42 | (defun-js js-inline* ps-inline* (&rest body) |
43 | (apply #'ps-inline* body)) | |
7590646c VS |
44 | |
45 | (defmacro with-unique-js-names (&rest args) | |
0d971f14 VS |
46 | (warn-deprecated 'with-unique-js-names 'with-ps-gensyms) |
47 | `(with-ps-gensyms ,@args)) | |
7590646c | 48 | |
0d971f14 VS |
49 | (defun-js gen-js-name ps-gensym (&optional (prefix "_js_")) |
50 | (ps-gensym prefix)) | |
7590646c | 51 | |
4a987e2b | 52 | (defmacro js (&rest args) |
0d971f14 | 53 | (warn-deprecated 'js 'ps) |
4a987e2b VS |
54 | `(ps ,@args)) |
55 | ||
0d971f14 VS |
56 | (defun-js js* ps* (&rest args) |
57 | (apply #'ps* args)) | |
cb8f8e58 VS |
58 | |
59 | (defun-js compile-script ps1* (ps-form &key (output-stream nil)) | |
60 | "Compiles the Parenscript form PS-FORM into Javascript. | |
61 | If OUTPUT-STREAM is NIL, then the result is a string; otherwise code | |
62 | is output to the OUTPUT-STREAM stream." | |
63 | (format output-stream "~A" (ps1* ps-form))) | |
ffb6d061 VS |
64 | |
65 | (defun-js symbol-to-js symbol-to-js-string (symbol) | |
66 | (symbol-to-js-string symbol)) |