Internal update.
[s-roff.git] / tmac / doc-ditroff.new
blob4abfe86570aea433e2c0956f4e8b7c94df22297c
1 .\" Copyright (c) 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"      This product includes software developed by the University of
15 .\"      California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)doc-ditroff 5.8 (Berkeley) 8/5/91
33 .\"
34 .\"     %beginstrip%
37 .\" use -rC=1 to number pages continuously
39 .if !r C .nr C 0
41 .\" use -rcR=1 to force the creation of a single, very long page
43 .if !r cR .nr cR 0
46 .ec
48 .\" the `doc-xx-font' strings must not be empty!
50 .ds doc-caption-font \f[R]\s[\n[.s]]
51 .ds doc-caption-font2 \f[R]\s[\n[.s]]
52 .ds doc-Ad-font \f[I]\s[\n[.s]]
53 .ds doc-Ar-font \f[CO]\s[\n[.s]]
54 .ds doc-Cm-font \f[CB]\s[\n[.s]]
55 .ds doc-Em-font \f[I]\s[\n[.s]]
56 .ds doc-Er-font \f[C]\s[\n[.s]]
57 .ds doc-Ev-font \f[C]\s[\n[.s]]
58 .ds doc-Fa-font \f[CO]\s[\n[.s]]
59 .ds doc-Fd-font \f[CB]\s[\n[.s]]
60 .ds doc-Fl-font \f[CB]\s[\n[.s]]
61 .ds doc-Fn-font \f[CB]\s[\n[.s]]
62 .ds doc-Ft-font \f[CO]\s[\n[.s]]
63 .ds doc-Ic-font \f[CB]\s[\n[.s]]
64 .ds doc-Li-font \f[C]
65 .ds doc-Me-font \f[B]\s[\n[.s]]
66 .ds doc-Nm-font \f[CB]\s[\n[.s]]
67 .ds doc-No-font \f[R]\s[\n[.s]]
68 .ds doc-Pa-font \f[C]\s[\n[.s]]
69 .ds doc-Sh-font \f[B]\s[\n[.s]]
70 .ds doc-Sy-font \f[B]\s[\n[.s]]
71 .ds doc-Sx-font \f[B]\s[\n[.s]]
72 .ds doc-Tn-font-shape \f[R]
73 .ds doc-Tn-font-size \s[(\n[.s] - 1)]
74 .ds doc-Va-font \f[I]\s[\n[.s]]
75 .ds doc-Xr-font \f[C]\s[\n[.s]]
77 .ds doc-left-parenthesis \f[R]\|(\|\f[P]\s[\n[.s]]
78 .ds doc-right-parenthesis \f[R]\|)\|\f[P]\s[\n[.s]]
79 .ds lp \f[R](\f[P]\s[\n[.s]]
80 .ds rp \f[R])\f[P]\s[\n[.s]]
81 .ds doc-left-bracket \f[R]\^[\^\f[P]\s[\n[.s]]
82 .ds doc-right-bracket \f[R]\^]\f[P]\s[\n[.s]]
84 .tr *\[**]
86 .ds doc-punct-chars \f[R]{\ .\ ,\ :\ ;\ (\ )\ [\ ]\ \f[R]}
87 .nr doc-subheader-indent (\w\a\f[C],\au * 5u)
88 .nr doc-paragraph-space .5v
90 .ds doc-digit-string \0
91 .nr doc-digit-width \w'\0'u
92 .nr doc-fixed-width \w\a\f[C]0\a
94 .eo
97 .\" NS doc-header-space global register
98 .\" NS   the space between header and body
100 .nr doc-header-space 0
103 .\" NS doc-footer-space global register
104 .\" NS   the space between body and footer
106 .nr doc-footer-space 0
109 .\" NS doc-display-vertical global register
110 .\" NS   vertical space between list elements etc.
112 .nr doc-display-vertical 0
115 .\" NS doc-setup-page-layout macro
116 .\" NS   set up page layout
117 .\" NS
118 .\" NS modifies:
119 .\" NS   doc-header-space, doc-footer-space, doc-display-vertical
121 .de doc-setup-page-layout
122 .  nr doc-header-space .5i
123 .  nr doc-footer-space .5i
125 .  ll 6.5i
126 .  lt 6.5i
127 .  po 1i
129 .  nr doc-display-vertical .5v
133 .ds <= \[<=]
134 .ds >= \[>=]
136 .\" Lq and Rq are `official'
137 .ds Lq \[lq]
138 .ds Rq \[rq]
139 .ds ua \[ua]
140 .ds aa \[aa]
141 .ds ga \[ga]
142 .ds doc-right-singlequote \&'
143 .ds doc-left-singlequote \&`
144 .\" q is `official'
145 .ds q \[dq]
147 .\" math stuff -- all macro names are `official'
148 .ds Pi \[*p]
149 .ds Ne \[!=]
150 .ds Le \[<=]
151 .ds Ge \[>=]
152 .ds Lt <
153 .ds Gt >
154 .ds Pm \[+-]
155 .ds If \[if]
156 .ds Na \f[I]NaN\f[P]
157 .ds Ba \f[R]|\f[P]
159 .nr gX 0
162 .\" NS doc-header-string global string
163 .\" NS   the final string used for the manual page header
165 .ds doc-header-string
168 .\" NS doc-setup-header macro
169 .\" NS   install and initialize header and footer support
170 .\" NS
171 .\" NS modifies:
172 .\" NS   doc-header-string
174 .de doc-setup-header
175 .  ds doc-header-string "\*[doc-document-title]
176 .  if !"\*[doc-section]"Null" \
177 .    as doc-header-string \|(\|\*[doc-section]\|)
179 .  wh 0 doc-header
180 .  wh -1.25i doc-footer
182 .  nr nL \n[nl]
183 .  if \n[gX] \
184 .    ds doc-command-name
186 .  br
188 .  \" Don't set the page number if this is the first page,
189 .  \" in case the user has used -n.
190 .  if \n[nL] \
191 .    if !\n[C] \
192 .      nr % 1
194 .  nr gX 0
195 .  e@ doc-end-macro
199 .\" NS doc-get-width macro
200 .\" NS   computes the width of a string as a multiple of `doc-fixed-width':
201 .\" NS   `.doc-get-width string'
202 .\" NS
203 .\" NS modifies:
204 .\" NS   doc-width
206 .de doc-get-width
207 .  nr doc-width \w\a\f[C]\$1\a
208 .  ie (\n[doc-width] >= \n[doc-fixed-width]) \{\
209 .    ie (\n[doc-width] % \n[doc-fixed-width]) \
210 .      nr doc-width ((\n[doc-width] / \n[doc-fixed-width]) + 1)
211 .    el \
212 .      nr doc-width (\n[doc-width] / \n[doc-fixed-width])
213 .  \}
214 .  el \{\
215 .    ie \n[doc-width] \
216 .      nr doc-width 1
217 .    el \
218 .      nr doc-width 0
219 .  \}
223 .\" NS doc-get-arg-width macro
224 .\" NS   computes the width of an argument as a multiple of
225 .\" NS   `doc-fixed-width': `.doc-get-arg-width arg-index'
226 .\" NS
227 .\" NS modifies:
228 .\" NS   doc-width
230 .de doc-get-arg-width
231 .  nr doc-width \w\a\f[C]\*[doc-arg\$1]\a
232 .  ie (\n[doc-width] >= \n[doc-fixed-width]) \{\
233 .    ie (\n[doc-width] % \n[doc-fixed-width]) \
234 .      nr doc-width ((\n[doc-width] / \n[doc-fixed-width]) + 1)
235 .    el \
236 .      nr doc-width (\n[doc-width] / \n[doc-fixed-width])
237 .  \}
238 .  el \{\
239 .    ie \n[doc-width] \
240 .      nr doc-width 1
241 .    el \
242 .      nr doc-width 0
243 .  \}
247 .\" NS Ql macro
248 .\" NS   quoted literal define
249 .\" NS
250 .\" NS modifies:
251 .\" NS   doc-macro-name, doc-argXXX, doc-arg-ptr, doc-typeXXX, doc-spaceXXX,
252 .\" NS   doc-quote-right, doc-quote-left, doc-arg-limit
253 .\" NS
254 .\" NS local variables:
255 .\" NS   doc-reg-Ql, doc-reg-Ql1
256 .\" NS
257 .\" NS width register `Ql' set in doc-common
259 .de Ql
260 .  if !\n[doc-arg-limit] \{\
261 .    ie \n[.$] \{\
262 .      ds doc-macro-name Ql
263 .      doc-parse-args \$@
264 .    \}
265 .    el \
266 .      tm Usage: .Ql argument ... \*[doc-punct-chars] (#\n[.c])
267 .  \}
269 .  nr doc-reg-Ql (\n[doc-arg-ptr] + 1)
270 .  doc-get-arg-width \n[doc-reg-Ql]
272 .  ie (\n[doc-width] > 2) \
273 .    Li
274 .  el \{\
275 .    ie \n[doc-arg-ptr] \{\
276 .      \" we replace `Ql' with `Li'
277 .      ds doc-arg\n[doc-arg-ptr] Li
278 .      nr doc-arg-ptr -1
279 .    \}
280 .    el \{\
281 .      \" if .Ql has been called directly, we must shift all elements in
282 .      \" the argument vector to the right so that we can insert `Li'
283 .      nr doc-reg-Ql \n[doc-arg-limit]
284 .      nr doc-reg-Ql1 (\n[doc-arg-limit] + 1)
285 .      while \n[doc-reg-Ql] \{\
286 .        rn doc-arg\n[doc-reg-Ql] doc-arg\n[doc-reg-Ql1]
287 .        rn doc-type\n[doc-reg-Ql] doc-type\n[doc-reg-Ql1]
288 .        rn doc-space\n[doc-reg-Ql] doc-space\n[doc-reg-Ql1]
289 .        nr doc-reg-Ql -1
290 .        nr doc-reg-Ql1 -1
291 .      \}
292 .      ds doc-arg1 Li
293 .      ds doc-type1 macro
294 .      ds doc-space1
295 .      nr doc-arg-limit +1
296 .    \}
298 .    ds doc-quote-left "\*[doc-left-singlequote]
299 .    ds doc-quote-right "\*[doc-right-singlequote]
300 .    doc-enclose-string
301 .  \}
305 .\" NS doc-in-see-also-section global register (bool)
306 .\" NS   whether we are in the `see also' section
308 .nr doc-in-see-also-section 0
311 .\" NS doc-in-files-section global register (bool)
312 .\" NS   whether we are in the `files' section
314 .nr doc-in-files-section 0
317 .\" NS doc-in-authors-section global register (bool)
318 .\" NS   whether we are in the `authors' section
320 .nr doc-in-authors-section 0
323 .\" NS Sh macro
324 .\" NS   section headers
325 .\" NS
326 .\" NS modifies:
327 .\" NS   doc-in-synopsis-count, doc-indent-synopsis, doc-in-see-also-section,
328 .\" NS   doc-in-files-section, doc-in-authors-section, doc-have-author,
329 .\" NS   doc-is-func, doc-func-count, doc-func-args-processed,
330 .\" NS   doc-num-func-args, doc-func-arg
331 .\" NS
332 .\" NS local variable:
333 .\" NS   doc-reg-Sh
334 .\" NS
335 .\" NS width register `Sh' set in doc-common
337 .de Sh
338 .  nr doc-in-synopsis-count 0
339 .  nr doc-indent-synopsis 0
341 '  ad
343 .  ie "\$1"NAME" \{\
344 .    doc-setup-header
345 '    in 0
346 .  \}
347 .  el \{\
348 .    nr doc-in-see-also-section 0
349 .    nr doc-in-files-section 0
350 .    nr doc-in-authors-section 0
352 .    if "\$1"SYNOPSIS" \{\
353 .      na
354 .      nr doc-in-synopsis-count 1
355 .    \}
356 .    if "\$1"DESCRIPTION" \{\
357 .      nr doc-is-func 0
358 .      nr doc-func-count 0
359 .      nr doc-func-args-processed 0
360 .      nr doc-num-func-args 0
361 .      ds doc-func-arg
362 .    \}
363 .    if "\$1"SEE" \{\
364 .      nr doc-in-see-also-section 1
365 .      na
366 .    \}
367 .    if "\$1"FILES" \
368 .      nr doc-in-files-section 1
369 .    if "\$1"AUTHORS" \
370 .      nr doc-in-authors-section 1
372 .    in 0
373 .    nr doc-have-author 0
374 .  \}
376 .  doc-setup-page-layout
377 '  sp
378 .  ns
379 .  ta T .5i
380 .  if !\n[cR] \
381 .    ne 3
382 '  fi
384 .  ie \n[.$] \{\
385 .    nop \*[doc-Sh-font]\$1\c
386 .    nr doc-reg-Sh 2
387 .    while (\n[doc-reg-Sh] <= \n[.$]) \{\
388 .      nop \& \|\$[\n[doc-reg-Sh]]\c
389 .      nr doc-reg-Sh +1
390 .    \}
391 .    nop \f[P]\s[0]
392 .  \}
393 .  el \
394 .    tm Usage: .Sh section_name ... (#\n[.c])
396 .  in (\n[.i]u + \n[doc-subheader-indent]u)
397 .  ns
400 .\" EOF