630a06bb32d85aff87731ff417b031b7ad9fb779
[lineal.git] / src / webui / compile-ps.lisp
blob630a06bb32d85aff87731ff417b031b7ad9fb779
2 (in-package :lineal.webui)
4 ;V Compile given ParenScript file.V
5 (defun compile-ps (ps-path js-path)
6 (when (and (probe-file js-path)
7 (< (file-write-date ps-path)
8 (file-write-date js-path)))
9 (return-from compile-ps))
10 (format t "Generating: ~A~%" (namestring js-path))
11 (with-open-file (ps-strm ps-path)
12 (with-open-file (js-strm js-path :direction :output
13 :if-exists :supersede)
14 (loop :for lis = (read ps-strm nil nil)
15 :while lis
16 :do (princ (eval (list 'ps lis)) js-strm)
17 :do (terpri js-strm)))))
19 (defun recompile-ps ()
20 (ensure-directories-exist
21 (make-pathname
22 :directory '(:relative "http_root" "jsfiles")))
23 (mapc
24 (lambda (name)
25 (compile-ps
26 (make-pathname
27 :directory '(:relative "src" "webui" "psfiles")
28 :name name :type "lisp")
29 (make-pathname
30 :directory '(:relative "http_root" "jsfiles")
31 :name name :type "js")))
32 '("calcupage"
33 "connects"
34 "matrix-edit")))