aboutsummaryrefslogtreecommitdiff
path: root/src/propspec.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-01 11:58:20 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-01 14:13:50 -0700
commit46536b5196769896670e0bd8f923c9f99501a3ff (patch)
tree87a4b12f9799dd596f9ccdf8986945eba978f57f /src/propspec.lisp
parent986439442b08b59bb4c44c94fa9f10e12705de66 (diff)
downloadconsfigurator-46536b5196769896670e0bd8f923c9f99501a3ff.tar.gz
rework executing :HOSTATTRS subroutines
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/propspec.lisp')
-rw-r--r--src/propspec.lisp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/propspec.lisp b/src/propspec.lisp
index f63958c..51ab8ca 100644
--- a/src/propspec.lisp
+++ b/src/propspec.lisp
@@ -173,11 +173,31 @@ an atomic property application."
for propapp = (compile-propapp form)
do (propappapply propapp)))
-(defun eval-propspec-hostattrs (propspec)
- (loop for form in (slot-value propspec 'applications)
+(defmethod %eval-propspec-hostattrs ((host host) (propspec propspec))
+ "Modify HOST in-place according to :HOSTATTRS subroutines."
+ (loop with *host* = host
+ for form in (propspec-props propspec)
for propapp = (compile-propapp form)
do (propappattrs propapp)))
+;; return values of the following two functions share structure, and thus are
+;; not safe to use except on host objects that were just made, or that are
+;; going straight into %CONSFIGURE
+
+(defmethod %union-propspec-into-host ((host host) (propspec propspec))
+ (prog1
+ (setq host (make-instance 'host
+ :attrs (hostattrs host)
+ :props (append-propspecs (host-propspec host)
+ propspec)))
+ (%eval-propspec-hostattrs host propspec)))
+
+(defmethod %replace-propspec-into-host ((host host) (propspec propspec))
+ (prog1
+ (setq host (make-instance 'host
+ :attrs (hostattrs host) :props propspec))
+ (%eval-propspec-hostattrs host propspec)))
+
(defun propspec->type (propspec)
"Return :lisp if any types of the properties to be applied by PROPSPEC is
:lisp, else return :posix."