[parenscript-devel] Importing ParenScript Macros
I'm new to Common Lisp and ParenScript, so please forgive my questions if they are obvious. 1. What is the best way to import a file of ParenScript macros so that the macro calls in the file I'm compiling can be properly expanded? 2. Is there some way to watch a directory for changes to *.lisp files, and automatically compile to *.js files? Thanks for the help, David
David, 1. there are lots of solutions. I have most of my macros is a separate library called parenscript-extensions. If it is a "local" macro, I just define it in the file it is used. 2. See http://lists.common-lisp.net/pipermail/parenscript-devel/2011-January/000932... for one solution. This is my solution: (defun compile-site-paren-file (name &optional check-date) (let ((inf (merge-pathnames (make-pathname :name name :type "paren") *parenscript-dir*)) (outf (merge-pathnames (make-pathname :name name :type "js") *static-local-dir*))) (when (and (fad:file-exists-p inf) (or (not check-date) (not (fad:file-exists-p outf)) (> (file-write-date inf) (file-write-date outf)))) (with-open-file (in inf :direction :input) (with-open-file (out outf :direction :output :if-exists :supersede :if-does-not-exist :create) (let ((*parenscript-stream* out)) (ps:ps-compile-stream in)) outf))))) Note: I use the paren extension for parenscript only files. The library fad is http://weitz.de/cl-fad/. Though this does treat a whole directory it could. I prefer to be more explicit in what I am compiling. andy On Fri, Jan 11, 2013 at 11:41 AM, David Sargeant <david@dsargeant.com>wrote:
I'm new to Common Lisp and ParenScript, so please forgive my questions if they are obvious.
1. What is the best way to import a file of ParenScript macros so that the macro calls in the file I'm compiling can be properly expanded?
2. Is there some way to watch a directory for changes to *.lisp files, and automatically compile to *.js files?
Thanks for the help, David _______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
I am not expert in parenscirt ether, for the first question I use paren-files (https://github.com/gonzojive/paren-files), and make my macros into a asdf system. On Fri, Jan 11, 2013 at 10:41 PM, David Sargeant <david@dsargeant.com> wrote:
I'm new to Common Lisp and ParenScript, so please forgive my questions if they are obvious.
1. What is the best way to import a file of ParenScript macros so that the macro calls in the file I'm compiling can be properly expanded?
2. Is there some way to watch a directory for changes to *.lisp files, and automatically compile to *.js files?
Thanks for the help, David _______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
participants (3)
-
Andy Peterson
-
Canhua
-
David Sargeant