Coverage report: /home/ellis/comp/core/std/defsys.lisp

KindCoveredAll%
expression049 0.0
branch02 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; defsys.lisp --- defsystem extension macros
2
 
3
 ;; Intended to serve as a replacement for asdf:system utilities and quicklisp.
4
 
5
 ;;; Commentary:
6
 
7
 ;; goals:
8
 ;; - default to asdf (wrap)
9
 ;; - replace quicklisp (will need to be in lib/sys)
10
 ;; - share resources between system and dependency manager
11
 ;; - integrate with lib/packy (package distributor)
12
 ;; - multi-threaded by default
13
 ;; - parallel compilation (completely short-circuiting asdf)
14
 
15
 ;;; Code:
16
 (in-package :std/defsys)
17
 (declaim (optimize speed))
18
 ;;; Conditions
19
 (define-condition defsys-error (error) ())
20
 (define-condition simple-defsys-error (simple-error) ())
21
 (defun defsys-error (format &rest args)
22
   (error 'simple-defsys-error :format-control format :format-arguments args))
23
 
24
 ;;; Components
25
 ;;; Ops
26
 ;;; Actions
27
 ;;; Dependencies
28
 ;;; Systems
29
 (defclass sysdef () ())
30
 
31
 (defmacro defsys (name &body body)
32
   `(defsystem ,name ,@body))
33
 
34
 ;;; Plan
35
 
36
 ;;; Modules
37
 (defvar *module* nil)
38
 (defparameter *core-module-table* (make-hash-table :test 'equal))
39
 
40
 (defclass core-module () ())
41
 
42
 (defun load-core-module (name)
43
   (let ((cmod (gethash name *core-module-table*)))
44
     (with-slots (load-hook exit-hook) cmod
45
       (when exit-hook
46
         (pushnew exit-hook sb-ext:*exit-hooks*))
47
       (funcall load-hook))))
48
 
49
 (defmacro load-module (name)
50
   "Load module NAME from the global list *MODULES*."
51
   (let ((mod (find name *modules* :test 'string-equal)))
52
     (if (null mod) (warn "Module not found: ~A" name)
53
         (let ((core-mod (gethash mod *core-module-table*)))
54
            (if core-mod
55
                `(load-core-module ,core-mod)
56
                `(require ,mod))))))
57
 
58
 (defun unload-module () (setf *module* nil))
59
 
60
 (defun module-provide-core (name)
61
   "Provide a CORE-MODULE, adding valid entries to the *MODULES*
62
   variable. The function USE should be called in order to load and activate a
63
   module, but the deprecated PROVIDE function is also supported."
64
   (load-core-module name))
65
 
66
 (defmacro with-module (name &body body)
67
   "Load the module named NAME, binding it to *MODULE* and eval BODY."
68
   `(let ((*module* (or (load-module ,name) ,name)))
69
      ,@body))
70
 
71
 ;; (with-eval-after-load (module &body body))