Replaced FiveAM with EOS (EOS is a drop-in replacement with better code and no depend...
[parenscript.git] / src / deprecated-interface.lisp
blob016190d1628fb3cbef3e9160a6277773bef7003f
1 (in-package #:parenscript)
2 (in-readtable :parenscript)
4 (define-condition simple-style-warning (style-warning simple-warning)
5 ())
7 (defun warn-deprecated (old-name &optional new-name)
8 (warn 'simple-style-warning
9 :format-control "~:@(~a~) is deprecated~:[.~;, use ~:@(~a~) instead~]"
10 :format-arguments (list old-name new-name new-name)))
12 (defmacro defun-js (old-name new-name args &body body)
13 `(defun ,old-name ,args
14 ,(when (and (stringp (car body)) (< 1 (length body))) ; docstring
15 (car body))
16 (warn-deprecated ',old-name ',new-name)
17 ,@body))
19 ;;; DEPRECATED INTERFACE
21 (defmacro define-script-symbol-macro (name &body body)
22 (warn-deprecated 'define-script-symbol-macro 'define-ps-symbol-macro)
23 `(define-ps-symbol-macro ,name ,@body))
25 (defun js-equal (ps-form1 ps-form2)
26 (warn-deprecated 'js-equal)
27 (equalp ps-form1 ps-form2))
29 (defun-js js-compile compile-script (form)
30 (compile-script form))
32 (defun-js js-compile-list compile-script (form)
33 (compile-script form))
35 (defmacro defjsmacro (&rest args)
36 (warn-deprecated 'defjsmacro 'defpsmacro)
37 `(defpsmacro ,@args))
39 (defmacro js-inline (&rest body)
40 (warn-deprecated 'js-inline 'ps-inline)
41 `(js-inline* '(progn ,@body)))
43 (defun-js js-inline* ps-inline* (&rest body)
44 (apply #'ps-inline* body))
46 (defmacro with-unique-js-names (&rest args)
47 (warn-deprecated 'with-unique-js-names 'with-ps-gensyms)
48 `(with-ps-gensyms ,@args))
50 (defun-js gen-js-name ps-gensym (&optional (prefix "_JS_"))
51 (ps-gensym prefix))
53 (defmacro js (&rest args)
54 (warn-deprecated 'js 'ps)
55 `(ps ,@args))
57 (defun-js js* ps* (&rest args)
58 (apply #'ps* args))
60 (defun-js compile-script ps* (ps-form &key (output-stream nil))
61 "Compiles the Parenscript form PS-FORM into Javascript.
62 If OUTPUT-STREAM is NIL, then the result is a string; otherwise code
63 is output to the OUTPUT-STREAM stream."
64 (format output-stream "~A" (ps* ps-form)))
66 (defun-js symbol-to-js symbol-to-js-string (symbol)
67 (symbol-to-js-string symbol))
69 (defmacro defmacro/ps (name args &body body)
70 (warn-deprecated 'defmacro/ps 'defmacro+ps)
71 `(progn (defmacro ,name ,args ,@body)
72 (import-macros-from-lisp ',name)))
74 (defmacro defpsmacro-deprecated (old new)
75 `(defpsmacro ,old (&rest args)
76 (warn-deprecated ',old ',new)
77 (cons ',new args)))
79 (defpsmacro-deprecated slot-value getprop)
80 (defpsmacro-deprecated === eql)
81 (defpsmacro-deprecated == equal)
82 (defpsmacro-deprecated % rem)
83 (defpsmacro-deprecated concat-string stringify)
85 (defpsmacro !== (&rest args)
86 (warn-deprecated '!==)
87 `(not (eql ,@args)))
89 (defpsmacro != (&rest args)
90 (warn-deprecated '!=)
91 `(not (equal ,@args)))
93 (defpsmacro labeled-for (label init-forms cond-forms step-forms &rest body)
94 (warn-deprecated 'labeled-for 'label)
95 `(label ,label (for ,init-forms ,cond-forms ,step-forms ,@body)))
97 (defpsmacro do-set-timeout ((timeout) &body body)
98 (warn-deprecated 'do-set-timeout 'set-timeout)
99 `(set-timeout (lambda () ,@body) ,timeout))
101 (defun concat-string (&rest things)
102 (warn-deprecated 'concat-string 'stringify)
103 (apply #'stringify things))
105 (define-statement-operator with (expression &rest body)
106 (warn-deprecated 'with '|LET or WITH-SLOTS|)
107 `(ps-js:with ,(compile-expression expression)
108 ,(compile-statement `(progn ,@body))))
110 (defpsmacro label (&rest args)
111 (warn-deprecated 'label 'block)
112 `(block ,@args))
114 (setf %compiling-reserved-forms-p% nil)