fixing ffi doc extraction for cond-expanded procedures

This commit is contained in:
Alex Shinn 2021-05-10 18:40:33 +09:00
parent 64633d577c
commit 7b2fbb0bf2

View file

@ -723,6 +723,8 @@ h4 { color: #222288; border-top: 1px solid #4588ba; }
args))))) args)))))
(('define-c-const type (or (name _) name)) (('define-c-const type (or (name _) name))
(list (list 'const: type name))) (list (list 'const: type name)))
(('cond-expand (test . clauses) . rest)
(append-map get-ffi-signatures clauses))
(((or 'define-c-struct 'define-c-class 'define-c-type) name . rest) (((or 'define-c-struct 'define-c-class 'define-c-type) name . rest)
(let lp ((ls rest) (res '())) (let lp ((ls rest) (res '()))
(cond (cond
@ -809,38 +811,39 @@ h4 { color: #222288; border-top: 1px solid #4588ba; }
(write-to-string sig))) (write-to-string sig)))
(define (insert-signature orig-ls name sig) (define (insert-signature orig-ls name sig)
(cond (let ((sig (if (pair? sig) sig (and name (list name)))))
((not (pair? sig)) (cond
orig-ls) ((not (pair? sig))
(else '())
(let ((name (else
(cond (let ((name
(name) (cond
((not (pair? (car sig))) (car sig)) (name)
((eq? 'const: (caar sig)) (cadr (cdar sig))) ((not (pair? (car sig))) (car sig))
(else (caar sig))))) ((eq? 'const: (caar sig)) (cadr (cdar sig)))
(let lp ((ls orig-ls) (rev-pre '())) (else (caar sig)))))
(cond (let lp ((ls orig-ls) (rev-pre '()))
((or (null? ls) (cond
(section>=? (car ls) (section-number 'subsubsection))) ((or (null? ls)
`(,@(reverse rev-pre) (section>=? (car ls) (section-number 'subsubsection)))
,@(if (and (pair? ls) `(,@(reverse rev-pre)
(section-describes? ,@(if (and (pair? ls)
(extract-sxml (section-describes?
'(subsubsection procedure macro) (extract-sxml
(car ls)) '(subsubsection procedure macro)
name)) (car ls))
'() name))
`((subsubsection '()
tag: ,(write-to-string name) `((subsubsection
(rawcode tag: ,(write-to-string name)
,@(if (and (pair? (car sig)) (eq? 'const: (caar sig))) (rawcode
`((i ,(write-to-string (car (cdar sig))) ": ") ,@(if (and (pair? (car sig)) (eq? 'const: (caar sig)))
,(write-to-string (cadr (cdar sig)))) `((i ,(write-to-string (car (cdar sig))) ": ")
(intersperse (map write-signature sig) '(br))))))) ,(write-to-string (cadr (cdar sig))))
,@ls)) (intersperse (map write-signature sig) '(br)))))))
(else ,@ls))
(lp (cdr ls) (cons (car ls) rev-pre))))))))) (else
(lp (cdr ls) (cons (car ls) rev-pre))))))))))
;;> Extract inline Scribble documentation (with the ;;> prefix) from ;;> Extract inline Scribble documentation (with the ;;> prefix) from
;;> the source file \var{file}, associating any signatures from the ;;> the source file \var{file}, associating any signatures from the