aboutsummaryrefslogtreecommitdiff
path: root/src/property.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-05 17:12:56 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-05 17:25:13 -0700
commita263abe1ff15e4255fc3d1aaa85dea565628e3bc (patch)
treeff5d68a7181aeb947e1dbafb31358df910f8e6fd /src/property.lisp
parent9c56f356c14d51cfbc7e852c01fbf519b64a36ae (diff)
downloadconsfigurator-a263abe1ff15e4255fc3d1aaa85dea565628e3bc.tar.gz
DEFPROPLIST/DEFPROPSPEC: support supplying :HOSTATTRS subroutines
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property.lisp')
-rw-r--r--src/property.lisp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/property.lisp b/src/property.lisp
index 9816ce8..2727147 100644
--- a/src/property.lisp
+++ b/src/property.lisp
@@ -354,13 +354,14 @@ subroutines at the right time.
If the first element of the body is a string, it will be considered a
docstring for the resulting property. If the first element of the body after
any such string is a list beginning with :DESC, the remainder will be used as
-the :DESC subroutine for the resulting property, like DEFPROP. Supplying a
-:CHECK subroutine in the same way is also supported. Otherwise, the body
-defines a function of the arguments specified by the lambda list which returns
-the property application specification expression to be evaluated and applied.
-It should be a pure function aside from retrieving hostattrs (as set by other
-properties applied to the hosts to which the resulting property is applied,
-not as set by the properties in the returned propspec).
+the :DESC subroutine for the resulting property, like DEFPROP. Supplying
+:CHECK and :HOSTATTRS subroutines in the same way is also supported.
+Otherwise, the body defines a function of the arguments specified by the
+lambda list which returns the property application specification expression to
+be evaluated and applied. It should be a pure function aside from retrieving
+hostattrs (as set by other properties applied to the hosts to which the
+resulting property is applied, not as set by the properties in the returned
+propspec).
Macro property combinators should be usable in the normal way in the body, but
some other macros commonly used in DEFHOST and DEFPROPLIST forms will not work
@@ -401,6 +402,7 @@ You can usually use DEFPROPLIST instead of DEFPROPSPEC, which see."
,@(cdr (pop forms))))))
(setf (getf slots :hostattrs)
`(lambda (plist)
+ ,@(cddr (getf slots :hostattrs))
(let ((propspec (with-*host*-*consfig*
(preprocess-propspec
(make-propspec
@@ -419,7 +421,7 @@ If the first element of PROPERTIES is a string, it will be considered a
docstring for the resulting property. If the first element of PROPERTIES
after any such string is a list beginning with :DESC, the remainder will be
used as the :DESC subroutine for the resulting property, like DEFPROP.
-Supplying a :CHECK subroutine in the same way is also supported.
+Supplying :CHECK and :HOSTATTRS subroutines in the same way is also supported.
Otherwise, the body should not contain any references to variables other than
those in LAMBDA. LAMBDA is an ordinary lambda list, so you can use &AUX
@@ -439,8 +441,9 @@ other than constant values and propapps to property combinators."
(loop for remaining on properties
for car = (car remaining)
if (or (stringp car)
- (and (listp car) (member (car car)
- '(:desc :check declare))))
+ (and (listp car)
+ (member (car car)
+ '(:desc :check :hostattrs declare))))
collect car into begin
else
return (nreverse