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 without-packages (&body body) |
12 | `(let ((ps:*enable-package-system* nil)) | |
13 | ,@body)) | |
14 | ||
15 | (defmacro defun-js (old-name new-name args &body body) | |
16 | `(defun ,old-name ,args | |
17 | ,(when (and (stringp (car body)) (< 1 (length body))) ;; docstring | |
18 | (car body)) | |
19 | (warn-deprecated ',old-name ',new-name) | |
20 | (without-packages ,@body))) | |
21 | ||
9da682ca | 22 | ;;; DEPRECATED INTERFACE ;;; |
7590646c | 23 | |
3393fbce | 24 | (defun-js js-equal script-equal (a b) |
7590646c | 25 | (script-equal a b)) |
9da682ca | 26 | |
3393fbce | 27 | (defun-js js-compile compile-script (form) |
9da682ca RD |
28 | (compile-script form :output-spec :javascript)) |
29 | ||
3393fbce | 30 | (defun-js js-compile-list compile-script (form) |
9da682ca RD |
31 | (compile-script form :output-spec :javascript)) |
32 | ||
7590646c | 33 | (defmacro defjsmacro (&rest args) |
b5be3f57 | 34 | (warn-deprecated 'defjsmacro 'defpsmacro) |
7590646c VS |
35 | `(defscriptmacro ,@args)) |
36 | ||
5aa10005 | 37 | (defmacro js-file (&rest body) |
71089439 | 38 | (warn-deprecated 'js-file) |
5aa10005 RD |
39 | `(html |
40 | (:princ | |
41 | (js ,@body)))) | |
42 | ||
43 | (defmacro js-script (&rest body) | |
71089439 | 44 | (warn-deprecated 'js-script) |
5aa10005 RD |
45 | `((:script :type "text/javascript") |
46 | (:princ (format nil "~%// <![CDATA[~%")) | |
47 | (:princ (js ,@body)) | |
48 | (:princ (format nil "~%// ]]>~%")))) | |
49 | ||
50 | (defmacro js-inline (&rest body) | |
71089439 | 51 | (warn-deprecated 'js-inline) |
5aa10005 RD |
52 | `(js-inline* '(progn ,@body))) |
53 | ||
54 | (defmacro js-inline* (&rest body) | |
71089439 | 55 | (warn-deprecated 'js-inline*) |
5aa10005 RD |
56 | `(concatenate 'string "javascript:" |
57 | (string-join (js-to-statement-strings (compile-script-form (list 'progn ,@body)) 0) " "))) | |
7590646c VS |
58 | |
59 | (defmacro with-unique-js-names (&rest args) | |
60 | (warn-deprecated 'with-unique-js-names 'with-unique-ps-names) | |
61 | `(with-unique-ps-names ,@args)) | |
62 | ||
63 | (defmacro gen-js-name (&rest args) | |
64 | (warn-deprecated 'gen-js-name 'gen-ps-name) | |
65 | `(gen-ps-name ,@args)) | |
66 | ||
67 | (defmacro gen-js-name-string (&rest args) | |
68 | (warn-deprecated 'gen-js-name-string 'gen-script-name-string) | |
69 | `(gen-script-name-string ,@args)) | |
700ff11c VS |
70 | |
71 | ;;; Functions for setting up and tearing down a persistent compilation environment | |
72 | (defun setup-persistent-compilation-environment () | |
73 | (setf *compilation-environment* (make-basic-compilation-environment))) | |
74 | ||
75 | (defun clear-persistent-compilation-environment () | |
76 | (setf *compilation-environment* nil)) |