mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
services: configuration: Simplify normalize-extra-args.
* gnu/services/configuration.scm (define-configuration-helper, normalize-extra-args): Use #f instead of %unset-value. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
e328a5f746
commit
1b29e5db8f
1 changed files with 13 additions and 13 deletions
|
@ -190,32 +190,32 @@ (define (define-configuration-helper serialize? serializer-prefix syn)
|
|||
(define (normalize-extra-args s)
|
||||
"Extract and normalize arguments following @var{doc}."
|
||||
(let loop ((s s)
|
||||
(sanitizer* %unset-value)
|
||||
(serializer* %unset-value))
|
||||
(sanitizer* #f)
|
||||
(serializer* #f))
|
||||
(syntax-case s (sanitizer serializer empty-serializer)
|
||||
(((sanitizer proc) tail ...)
|
||||
(if (maybe-value-set? sanitizer*)
|
||||
(syntax-violation 'sanitizer "duplicate entry"
|
||||
#'proc)
|
||||
(if sanitizer*
|
||||
(syntax-violation 'sanitizer
|
||||
"duplicate entry" #'proc)
|
||||
(loop #'(tail ...) #'proc serializer*)))
|
||||
(((serializer proc) tail ...)
|
||||
(if (maybe-value-set? serializer*)
|
||||
(syntax-violation 'serializer "duplicate or conflicting entry"
|
||||
#'proc)
|
||||
(if serializer*
|
||||
(syntax-violation 'serializer
|
||||
"duplicate or conflicting entry" #'proc)
|
||||
(loop #'(tail ...) sanitizer* #'proc)))
|
||||
((empty-serializer tail ...)
|
||||
(if (maybe-value-set? serializer*)
|
||||
(if serializer*
|
||||
(syntax-violation 'empty-serializer
|
||||
"duplicate or conflicting entry" #f)
|
||||
(loop #'(tail ...) sanitizer* #'empty-serializer)))
|
||||
(() ; stop condition
|
||||
(values (list sanitizer* serializer*)))
|
||||
((proc) ; TODO: deprecated, to be removed.
|
||||
(null? (filter-map maybe-value-set? (list sanitizer* serializer*)))
|
||||
(not (or sanitizer* serializer*))
|
||||
(begin
|
||||
(warning #f (G_ "specifying serializers after documentation is \
|
||||
deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc))
|
||||
(values (list %unset-value #'proc)))))))
|
||||
(values (list #f #'proc)))))))
|
||||
|
||||
(syntax-case syn ()
|
||||
((_ stem (field field-type+def doc extra-args ...) ...)
|
||||
|
@ -239,11 +239,11 @@ (define (normalize-extra-args s)
|
|||
default-value))
|
||||
#'((field-type def) ...)))
|
||||
((field-sanitizer ...)
|
||||
(map maybe-value #'(sanitizer* ...)))
|
||||
#'(sanitizer* ...))
|
||||
((field-serializer ...)
|
||||
(map (lambda (type proc)
|
||||
(and serialize?
|
||||
(or (maybe-value proc)
|
||||
(or proc
|
||||
(if serializer-prefix
|
||||
(id #'stem serializer-prefix #'serialize- type)
|
||||
(id #'stem #'serialize- type)))))
|
||||
|
|
Loading…
Reference in a new issue