+Trace function, +Constants
[lineal.git] / src / webui / reload.lisp
blob7aed6bf8684a9baa0c246ec9611e3187deb90156
2 (defmacro bind-reset ((&body args) . body)
3 (let (tmp-lets s-sets)
4 (loop :for a :in args
5 :and b = (gentemp)
6 :collect (list b a) :into l
7 :collect a :into s
8 :collect b :into s
9 :finally
10 (setq tmp-lets l
11 s-sets (cons 'setq s)))
12 `(let ,tmp-lets
13 (unwind-protect
14 ,(cons 'progn body)
15 ,s-sets))))
17 (defun fresheval ()
18 (bind-reset
19 (*saved-numbers* *saved-tuples* *saved-matrices*)
20 ;V Do file loading.V
21 (compile-lineal :load-all nil)
22 ;V Compile the javascript files.V
23 (recompile-ps)))
25 ;V Reload this file via the web.V
26 (defun reload (&aux (worked nil))
27 (compile-if-new
28 "reload" '(:relative "src" "webui")
29 :fasl-dir '(:relative "fasl" "webui")
30 :load-all nil)
31 (unwind-protect
32 (progn (fresheval)
33 ;V say it worked V
34 (setq worked t))
35 ;V explicit return, needed if error thrown V
36 (return-from
37 reload
38 (with-html-output-to-string
39 (s nil :prologue t)
40 (:html (:head (:title "Site reloaded."))
41 (:body (:center
42 (princ (if worked "Everything worked"
43 "eval errorz")
44 s))))))))