1 .\" $NetBSD: macros,v 1.37 2008/10/29 17:02:54 tsutsui Exp $
3 .\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .\" -------------------- MACROS --------------------
33 .\" Define a .CURDIR-relative include, with entertainment
39 . so-real \*[.CURDIR]/\\$1
40 .\" tm ...back to INSTALL
44 .\" -mdoc only has only two section levels (Sh & Ss)
46 .\" second-level subsection macro (third-level section)
49 . ie rHTML <h5><a name="\\$*">\\$*</a></h5>
60 .\" Standard indented literal display, with nice showmatch parens in the name.
61 .\" Be warned that using font change macros such as `Ic', `Em' and `Sy' inside
62 .\" may cause formatting problems further on; this is probably a bug in the
66 . Bd -literal -offset indent
82 .\" (tag wid rest Creates a tag with width wid and other args rest
103 .\" Bullet list, which swaps between bullet and hyphen at each alternate
109 . ie \\n[b_or_h] .Bl -bullet \\$*
110 . el .Bl -hyphen \\$*
111 . nr b_or_h 1-\\n[b_or_h]
117 . nr b_or_h 1-\\n[b_or_h]
144 .\" Generate NetBSD/${MACHINE}, with NetBSD being done with .Nx.
145 .\" If there's trailing args to the macro, concatenate with no space.
148 .ie \\n[.$]>0 .Nx Ns / Ns \*M Ns \\$*
152 .\" Key-cap; literal text one point size smaller
161 .\" Macro for `UNIX-like', since we don't want to just use `UNIX'
168 .\" Remember <G> and <U> for the next showsize
169 .\" showsize [<G> <U>]
170 .\" Display "<G> MB gzipped, <U> MB uncompressed" on a new line,
171 .\" and then reset the values of <G> and <U> to '-unset-'.
172 .\" Values can be generated with something like this:
173 .\" gzip -l *.tgz | \
174 .\" awk '/\.tar/ { printf ".if \\n[%s] .setsize %d %d\n", \
175 .\" substr($4,0,index($4, "/")-1), \
176 .\" ( $1+1048575 ) /1048576, \
177 .\" ( $2 + 1048575) / 1048576 } '
182 \.ds set_gunzip \\$[2]
186 .if \\n(.$==2 .setsize \\$*
187 .Em \\*[set_gzip] MB gzipped, \\*[set_gunzip] MB uncompressed
188 .setsize -unset- -unset-
190 .setsize -unset- -unset-
192 .\" .Bc/.Ec; begin/end two-column mode. This may not work in all
193 .\" cases, but was designed for common/donations. There is no
194 .\" support for more than two pages, nor for right-margins.
198 .\" macro CF page trap macro for bottom of column
199 .\" macro CZ code duplication; handling of diversion interpolation.
200 .\" macro CC diversion trap macro for subdividing into pages.
201 .\" macro Bc Begin columns
202 .\" macro Ec End columns
203 .\" reg cl current column number
204 .\" reg CI saved indent
205 .\" reg CL saved line-length
206 .\" reg CO saved page offset
207 .\" reg CN number of columns
208 .\" reg CA max height of columnized text
209 .\" reg CB save available space on page
210 .\" reg CE column spacing
211 .\" str C0 entire columnization region [if crosses page boundary]
212 .\" str C1 columnization region for page 1
213 .\" str C2 columnization region for page 2
216 .if \\n(Db .tm page trap (column bottom) at \\n(nlu.
217 .\"TRAP2 \" debugging: here's where the trap is.
218 .ie \\n+(cl<\\n(CN \{
219 .rt \" return to the mk
220 .po +\\n(CEu \" space to next column
224 .ll \\n(CLu \" restore linelength
225 .in \\n(CIu \" restore indent
226 .po \\n(COu \" restore offset
231 .if \\n(Db .tm Saved column top is \\n(nlu.
232 .nr cl 0 1 \" This is column #0
233 .nr CL \\n(.l \" Save the linelength
234 .nr CI \\n(.i \" Save the indent
235 .nr CO \\n(.o \" Save the offset
237 .\" .ll 20n \" this doesn't work in nf-mode.
238 .if \\n(Db .tm Page trap placed at \\n(CDu; next trap at \\n(nlu+\n(.tu.
239 .wh \\n(CDu CF \" set the bottom of column trap
240 .if \\n(Db .tm CZ: \\$1 starts at \\n(nlu; trap in \\n(.tu.
241 .\\$1 \" throw in the diverted text
242 .if \\n(Db .tm CZ: \\$1 ends at \\n(nlu; trap in \\n(.tu.
243 .if !\\n(CN==\\n(cl .sp \" If we didn't finish, space to force a trap.
244 .ch CF \" remove trap
245 .if \\n(Db .tm CZ: before .ne we are at \\n(nlu with \\n(.tu to go.
246 .ne 3V \" space for two lines after
247 .if \\n(Db .tm CZ: after .ne we are at \\n(nlu.
250 .if \\n(Db .tm diversion trap (page break) at \\n(nlu.
251 .\"TRAP1 \" debugging
252 .di \" close first-page (C1) diversion
253 .di C2 \" open second-page (C2) diversion
256 .in +\\n(Dsu \" Indent to match Bd
257 .nr CN 2 \" Number of columns
258 .if !"\\$1"" .nr CN \\$1
259 .ne 2v \" we need at least two lines of space on the page.
261 .di C1 \" divert the text
267 .nr CA \\n(dnu/\\n(CN \" save max height of columnized text
268 .nr CB \\n(.t-(\\n(.v*3) \" save available space on page
269 .nr CE \\n(.lu/\\n(CN
270 .\" .tm The diversion is \\n(dnu high and \\n(dlu wide. At \\n(CN columns,
271 .\" .tm the max height would be \\n(CAu high, if they fit on the same page.
272 .\" .tm The page length is \\n(.p, and the current vposition is \\n(nl, not to
273 .\" .tm be confused with the page offset of \\n(.o.
274 .\" .tm So we have \\n(CBu of space on this page.
275 .ie \\n(CA>=\\n(CB \{
276 .rn C1 C0 \" put original in C0
278 .di C1 \" Divert the first page into new C1
279 .\" Diversion trap location in solid kludgite. If notCRT, we need
280 .\" extra v-height. go figure.
281 .ie \\n(cR==0 .dt \\n(CBu*\\n(CNu+2v CC
282 .el .dt \\n(CBu*\\n(CNu CC
288 .\" Trap at bottom of page
289 .if \\(Db .tm page trap set at \\n(nlu+\\n(.tu-2v)
290 .nr CD \\n(nlu+\\n(.tu-2v) \" trap right before next trap
293 .\" Trap at the bottom of the text. All on one page.
294 .nr CD \\n(CAu+\\n(nlu
297 .\" The .if dxxx construct is groff-specific
299 .if \\(Db .tm max height of text is \\n(dnu/\\n(CN.
300 .if \\(Db .tm breakpoint (for page trap) is 1u+\\n(CAu+\\n(nlu.
301 .nr CA \\n(dnu/\\n(CN \" save max height of columnized text
302 .nr CD \\n(CAu+\\n(nlu
305 .rm C2 \" nuke it otherwise it might pop up later.
306 .\" These should already be restored. But sometimes we don't hit
307 .\" the last page trap [??]
308 .ll \\n(CLu \" restore linelength
309 .in \\n(CIu \" restore indent
310 .po \\n(COu \" restore offset
312 .in -\\n(Dsu \" revert prior indent
314 .\" Unfortunately, none of the above works with -mdoc2html; so we'll
315 .\" just replace columns with a regular Bd -unfilled -offset indent.
320 .Bd -unfilled -offset indent
325 .\" Macros to support Table of Contents
326 .\" TOC is set (from the command line) if we're generating the TOC file;
327 .\" the TOC file is read from groff's stderr.
329 .\" .Sh section header
330 .\" .Ss subsection header
331 .\" .Ss2 sub2section header
332 .\" .Te depth "item" Explicit toc entry, not based on other markup
333 .\" .To depth "item" Like Te, but don't echo the item
334 .\" XXX To should be unnecessary if we handle parseable/callable.
335 .\" .Tc import the TOC
336 .\" .Ti depth page "item" (internal) output an entry
340 .Ss-toc \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
341 \.tm .Ti 0 \\n% \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
345 .Ss2-toc \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
346 \.tm .Ti 1 \\n% \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
350 .ie rHTML <a name="\\$2">\\$2</a>
352 .if dTOC \.tm .Ti \\$1 \\n% \\$2
355 .if rHTML <a name="\\$2"></a>
356 .if dTOC \.tm .Ti \\$1 \\n% \\$2
359 .ie rHTML \{.ta (\n(.lu+\w'<a href="#\\$3"></a>'u)R
360 \h'3n*\\$1u' <a href="#\\$3">\\$3</a>\a\\$2
362 .el \h'3n*\\$1u' \\$3\a\\$2
367 \.tm ...reading INSTALL.\*[format].toc
369 .\" Use so-real here because otherwise we lose on objdirs
370 \.so-real INSTALL.\*[format].toc
375 .\" -------------------- MISC --------------------
377 .\" set the unused target number registers to 0, so that we can turn on all
378 .\" the warnings but still do things like .if \n[amiga]:\n[alpha] \&stuff
379 .\" (The Makefile defines the target as 1, leaving the others undefined.)
383 . if !r\\$1 .nr \\$1 0
388 .define_all \*[MACHINE_LIST]
390 .\" Supported MACHINE_ARCHs:
391 .ds MACHINE_ARCH_LIST alpha arm hppa i386 m68000 m68k mipseb mipsel
392 .as MACHINE_ARCH_LIST " powerpc sh3eb sh3el sparc sparc64 vax x86_64
394 .\" Define registers for MACHINE_ARCHs with multiple or different MACHINEs
397 .if \n[acorn26]:\n[acorn32]:\n[cats]:\n[evbarm]:\n[hpcarm]:\n[iyonix]:\n[netwinder]:\n[shark]:\n[zaurus] .ds A arm
398 .if \n[hp700] .ds A hppa
399 .if \n[sun2] .ds A m68000
400 .if \n[amiga]:\n[atari]:\n[cesfic]:\n[hp300]:\n[luna68k]:\n[mac68k]:\n[mvme68k]:\n[news68k]:\n[next68k]:\n[sun3]:\n[x68k] .ds A m68k
401 .if \n[ews4800mips]:\n[mipsco]:\n[newsmips]:\n[sbmips]:\n[sgimips] .ds A mipseb
402 .if \n[algor]:\n[arc]:\n[cobalt]:\n[evbmips]:\n[hpcmips]:\n[pmax] .ds A mipsel
403 .if \n[amigappc]:\n[bebox]:\n[evbppc]:\n[ibmnws]:\n[macppc]:\n[mvmeppc]:\n[ofppc]:\n[prep]:\n[rs6000]:\n[sandpoint] .ds A powerpc
404 .if \n[evbsh3]:\n[mmeye] .ds A sh3eb
405 .if \n[dreamcast]:\n[hpcsh]:\n[landisk] .ds A sh3el
406 .if \n[amd64] .ds A x86_64
408 .define_all \*[MACHINE_ARCH_LIST]
410 .\" Other strings available:
412 .\" \*M ${MACHINE} (e.g., `i386')
413 .\" \*P ${MACHINE} for packages (e.g., `i386')
414 .\" \*A ${MACHINE_ARCH} (e.g., `m68k')
415 .\" \*V Version (e.g., `1.5')
416 .\" \*[.CURDIR] ${.CURDIR}