1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
;; $Id: dbsynop.dsl 1.4 1998/07/19 16:12:19 nwalsh Exp $
;;
;; This file is part of the Modular DocBook Stylesheet distribution.
;; See ../README or http://www.berkshire.net/~norm/dsssl/
;;
;; ========================= SYNTAX DEFINITIONS =========================
(element synopsis ($verbatim-display$ %number-synopsis-lines%))
(element cmdsynopsis ($paragraph$))
;; Support for ARG provided by James Bostock, augmented by norm
;;
(element group
(let ((choice (attribute-string (normalize "choice")))
(rep (attribute-string (normalize "rep"))))
(make sequence
(if (first-sibling? (current-node))
(literal (inherited-attribute-string (normalize "sepchar")))
(empty-sosofo))
(cond
((equal? choice (normalize "plain"))
(literal %arg-choice-plain-open-str%))
((equal? choice (normalize "req"))
(literal %arg-choice-req-open-str%))
((equal? choice (normalize "opt"))
(literal %arg-choice-opt-open-str%))
(else (literal %arg-choice-def-open-str%)))
(process-children)
(cond
((equal? rep (normalize "repeat"))
(literal %arg-rep-repeat-str%))
((equal? rep (normalize "norepeat"))
(literal %arg-rep-norepeat-str%))
(else (literal %arg-rep-def-str%)))
(cond
((equal? choice (normalize "plain"))
(literal %arg-choice-plain-close-str%))
((equal? choice (normalize "req"))
(literal %arg-choice-req-close-str%))
((equal? choice (normalize "opt"))
(literal %arg-choice-opt-close-str%))
(else (literal %arg-choice-def-close-str%)))
(literal " "))))
(element arg
(let ((choice (attribute-string (normalize "choice")))
(rep (attribute-string (normalize "rep"))))
(make sequence
(if (first-sibling? (current-node))
(literal (inherited-attribute-string "sepchar"))
(empty-sosofo))
(cond
((equal? choice (normalize "plain"))
(literal %arg-choice-plain-open-str%))
((equal? choice (normalize "req")) (literal %arg-choice-req-open-str%))
((equal? choice (normalize "opt")) (literal %arg-choice-opt-open-str%))
(else (literal %arg-choice-def-open-str%)))
(process-children)
(cond
((equal? rep (normalize "repeat")) (literal %arg-rep-repeat-str%))
((equal? rep (normalize "norepeat")) (literal %arg-rep-norepeat-str%))
(else (literal %arg-rep-def-str%)))
(cond
((equal? choice (normalize "plain")) (literal %arg-choice-plain-close-str%))
((equal? choice (normalize "req")) (literal %arg-choice-req-close-str%))
((equal? choice (normalize "opt")) (literal %arg-choice-opt-close-str%))
(else (literal %arg-choice-def-close-str%)))
(literal " "))))
(element (group arg)
(let ((choice (attribute-string (normalize "choice")))
(rep (attribute-string (normalize "rep"))))
(make sequence
(if (not (first-sibling? (current-node)))
(literal %arg-or-sep%)
(empty-sosofo))
(process-children))))
(element sbr
(make empty-element gi: "BR"))
;; ----------------------------------------------------------------------
;; Syntax highlighting...
(define (funcsynopsis-function #!optional (sosofo (process-children)))
(make element gi: "B"
attributes: '(("CLASS" "FSFUNC"))
sosofo))
(define (paramdef-parameter #!optional (sosofo (process-children)))
(make element gi: "VAR"
attributes: '(("CLASS" "PDPARAM"))
sosofo))
;; ----------------------------------------------------------------------
(element synopfragmentref ($paragraph$))
(element synopfragment (process-children))
(element funcsynopsis ($informal-object$))
(element funcsynopsisinfo ($verbatim-display$ %number-funcsynopsisinfo-lines%))
(element funcprototype
(let ((paramdefs (select-elements (children (current-node)) (normalize "paramdef"))))
(make sequence
(make element gi: "P"
(make element gi: "CODE"
(process-children)
(if (equal? %funcsynopsis-style% 'kr)
(with-mode kr-funcsynopsis-mode
(process-node-list paramdefs))
(empty-sosofo)))))))
(element funcdef
(make element gi: "CODE"
attributes: '(("CLASS" "FUNCDEF"))
(process-children)))
(element (funcdef function)
(if %funcsynopsis-decoration%
(funcsynopsis-function)
(process-children)))
(element void
(if (equal? %funcsynopsis-style% 'ansi)
(literal "(void);")
(literal "();")))
(element varargs (literal "(...);"))
(element paramdef
(let ((param (select-elements (children (current-node)) (normalize "parameter"))))
(make sequence
(if (equal? (child-number (current-node)) 1)
(literal "(")
(empty-sosofo))
(if (equal? %funcsynopsis-style% 'ansi)
(process-children)
(process-node-list param))
(if (equal? (gi (ifollow (current-node))) (normalize "paramdef"))
(literal ", ")
(literal ");")))))
(element (paramdef parameter)
(make sequence
(if %funcsynopsis-decoration%
(paramdef-parameter)
(process-children))
(if (equal? (gi (ifollow (current-node))) (normalize "parameter"))
(literal ", ")
(empty-sosofo))))
(element funcparams
(make sequence
(literal "(")
(process-children)
(literal ")")))
(mode kr-funcsynopsis-mode
(element paramdef
(make sequence
(make empty-element gi: "BR")
(process-children)
(literal ";"))))
|