blob: f4f7a7ede9220caff6200b2bb60889e93a6bceea (
plain)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
;; $Id: dbsynop.dsl,v 1.3 2003/01/15 08:24:13 adicarlo Exp $
;;
;; This file is part of the Modular DocBook Stylesheet distribution.
;; See ../README or http://docbook.sourceforge.net/projects/dsssl/
;;
;; ========================= SYNTAX DEFINITIONS =========================
(element synopsis ($verbatim-display$ %indent-synopsis-lines%
%number-synopsis-lines%))
(element cmdsynopsis ($paragraph$))
;; Support for ARG provided by James Bostock, augmented by norm
;;
(element (cmdsynopsis command)
(make sequence
(if (first-sibling? (current-node))
(empty-sosofo)
(make empty-element gi: "BR"))
(next-match)
(literal " ")))
(element group
(let ((choice (attribute-string (normalize "choice")))
(rep (attribute-string (normalize "rep")))
(sepchar (if (inherited-attribute-string (normalize "sepchar"))
(inherited-attribute-string (normalize "sepchar"))
" ")))
(make sequence
(if (equal? (absolute-child-number (current-node)) 1)
(empty-sosofo)
(literal sepchar))
(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? 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%)))
(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%))))))
(element arg
(let ((choice (attribute-string (normalize "choice")))
(rep (attribute-string (normalize "rep")))
(sepchar (if (inherited-attribute-string (normalize "sepchar"))
(inherited-attribute-string (normalize "sepchar"))
" ")))
(make sequence
(if (equal? (absolute-child-number (current-node)) 1)
(empty-sosofo)
(literal sepchar))
(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%))))))
(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
(let* ((target (element-with-id (attribute-string (normalize "linkend"))))
(snum (child-number target)))
(make element gi: "I"
(make element gi: "A"
attributes: (list
(list "HREF" (href-to target)))
(literal "(" (number->string snum) ")"))
(process-children))))
(element synopfragment
(let ((id (element-id (current-node)))
(snum (child-number (current-node))))
(make element gi: "P"
(make element gi: "A"
attributes: (list
(list "NAME" id))
(literal "(" (number->string snum) ")"))
(make entity-ref name: "nbsp")
(process-children))))
(element funcsynopsis ($informal-object$))
(element funcsynopsisinfo ($verbatim-display$ %indent-funcsynopsisinfo-lines%
%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 ";"))))
|