-
Notifications
You must be signed in to change notification settings - Fork 1
/
maxima-asdf.lisp
40 lines (29 loc) · 1.38 KB
/
maxima-asdf.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;; maxima_asdf.lisp -- ASDF glue code for Maxima
;; copyright 2015 by Robert Dodier
;; I release this work under terms of the GNU General Public License
(require 'asdf)
(in-package :maxima)
(defmacro append-to-path (path-variable path item)
`(let ((to-be-added (concatenate 'string ,path ,item)))
(unless (member to-be-added (rest ,path-variable) :test #'string=)
(setq ,path-variable (append ,path-variable (list to-be-added))))))
(defun append-to-maxima-paths (p)
(declare (special $file_search_demo $file_search_lisp $file_search_maxima $file_search_tests $file_search_usage))
(append-to-path $file_search_demo p "$$$.{dem,demo}")
(append-to-path $file_search_lisp p "$$$.lisp")
(append-to-path $file_search_maxima p "$$$.mac")
(append-to-path $file_search_tests p "$$$.mac")
(append-to-path $file_search_usage p "$$$.{usg,txt}"))
(defmacro with-maxima-path-update (name &body body)
(let ((source-topdir (gensym)))
`(prog1
(progn
,@body)
(let ((,source-topdir (format nil "~a" (ql:where-is-system ,name))))
(append-to-maxima-paths ,source-topdir)))))
(defun $asdf_load (name)
(with-maxima-path-update name (asdf:load-system name)))
(defun $asdf_compile (name)
(with-maxima-path-update name (asdf:compile-system name)))
(defun $asdf_load_source (name)
(with-maxima-path-update name (asdf:oos 'asdf:load-source-op name)))