Coverage report: /home/ellis/comp/core/app/skel/comp/lisp.lisp
Kind | Covered | All | % |
expression | 0 | 128 | 0.0 |
branch | 0 | 4 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; lisp.lisp --- Lisp files
6
(in-package :skel/comp/lisp)
8
(defclass sk-lisp-component (sk-component ast) ())
9
(defclass sk-lisp-file (sk-lisp-component sk-meta) ())
11
(defmethod sk-new ((self (eql :lisp)) &rest args)
12
(apply #'make-instance 'sk-lisp-file args))
14
(defmethod sk-convert ((self cl-source-file))
15
(make-instance 'sk-lisp-file
16
:path #1=(component-pathname self)
17
:name (component-name self)
18
:parent (component-parent self)
19
:version (component-version self)))
21
(defmethod sk-compile ((self sk-lisp-file) &rest args)
22
(apply 'compile-file (path self) args))
24
(defmethod sk-load ((self sk-lisp-file) &key (compile t))
26
(compile-and-load (path self))
29
(defmethod sk-run ((self sk-lisp-file))
30
(compile-and-eval `(progn ,@(ast self))))
32
(defmethods sk-load-component
33
(((self (eql :lisp)) (form pathname) &optional (path (project-root)))
34
(declare (ignore self))
35
(let* ((type (pathname-type form))
36
(name (namestring (if type (pathname-name form) form)))
37
(fname (if type form (make-pathname :directory (namestring path) :name name :type "lisp")))
38
(comp (make-instance 'sk-lisp-file :parent *skel-project* :path fname :name name)))
40
(((self (eql :lisp)) (form list) &optional (path (project-root)))
41
(let ((opts (cdr form))
42
(comp (sk-load-component self (pathname (car form)) (namestring path))))
43
(when-let ((eval (getf opts :eval)))
45
(:always (sk-run comp))
47
(:load (sk-load comp :compile nil))
48
;; default is :COMPILE
49
(t (sk-load comp :compile t))))
50
(when (getf opts :read)
51
(sk-read-file comp (path comp)))
54
(defmethod print-object ((object sk-lisp-component) stream)
55
(print-unreadable-object (object stream :type t)
56
(format stream ":ID ~A" (format-sxhash (id object)))))
58
(defmethod read-ast ((self sk-lisp-component) stream &key)
59
(setf (ast self) (read-lisp-until-end stream)))
61
(defmethod sk-read-file ((self sk-lisp-component) path)
62
(with-input-from-file (f path)
65
(defmethod write-ast ((self sk-lisp-component) stream &key)
66
(write (ast self) :stream stream))
68
(defmethod sk-write-file ((self sk-lisp-component) &key path)
69
(with-output-to-file (f (or path (path self)))
72
(defmethod load-ast ((self sk-lisp-component))