summaryrefslogtreecommitdiff
path: root/tmac/doc.tmac
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-03-23 00:17:50 +0000
committerwlemb <wlemb>2001-03-23 00:17:50 +0000
commit5a425eaf6e5cc80206e2562878fd9e24f398b973 (patch)
treeb387186eef3de10b1b1ce6056eb7ddd77a5d0039 /tmac/doc.tmac
parenta736fb6eaf38fd5fbb5bc3bd20e59f42b0bad491 (diff)
downloadgroff-5a425eaf6e5cc80206e2562878fd9e24f398b973.tar.gz
Replaced mdoc implementation. The new version is `state of the
art', using almost all new features of groff 1.17 -- it won't run with older versions. * tmac/doc.tmac: Completely rewritten. * tmac/doc-common: Ditto. * tmac/doc-nroff: Ditto. * tmac/doc-ditroff: Ditto. * tmac/doc-syms: Ditto. * tmac/mdoc.local: New file. * tmac/groff_mdoc.samples.man: Replaced with ... * tmac/groff_mdoc.reference.man: New file, covering mdoc completely. * tmac/strip.sed: Updated. * tmac/Makefile.sub: Updated. * INSTALL: Updated. * tmac/groff_man.man: Add `man.local' to the FILES section.
Diffstat (limited to 'tmac/doc.tmac')
-rw-r--r--tmac/doc.tmac9429
1 files changed, 6118 insertions, 3311 deletions
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index f83f0874..45b9770e 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -11,8 +11,8 @@
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
@@ -29,3397 +29,6204 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)doc.tmac 5.8 (Berkeley) 8/5/91
+.\" @(#)doc 5.8 (Berkeley) 8/5/91
+.\"
.\" Modified by jjc@jclark.com as follows: the doc-* files are assumed to be
.\" installed as mdoc/doc-* rather than tmac.doc-* (the filename
.\" `tmac.doc-common' would be too long); when using groff, the doc-* files
.\" are loaded using the `mso' request.
-.\"
-.\" .mdoc-parse - attempt to parse troff request arguments
-.\" %beginstrip%
-.if \n(.g \{\
-.cp 0
-.ftr C CR
-.\}
-.if \n(.g .ig
-.de sO
-.so /usr/share/tmac/\\$1
-..
-.if !\n(.g .ig
-.de sO
-.mso mdoc/\\$1
-..
-.if t \{\
-. sO doc-ditroff
-.\}
-.if n \{\
-. sO doc-nroff
-.\}
-.sO doc-common
-.sO doc-syms
-.\" NS Db macro - start/stop DEBUG MODE
-.\" NS Db register DEBUG MODE
-.\" NS iN register DEBUG MODE (inline if 1, to stderr if 0 (default))
-.nr Db 0
-.de Db
-.ie \\n(.$==0 \{\
-. ie \\n(Db==0 \{\
-.tm DEBUGGING ON
-. nr Db 1
-. \}
-. el \{\
-.tm DEBUGGING OFF
-. nr Db 0
-. \}
-.\}
-.el \{\
-. if "\\$1"on" \{\
-.tm DEBUGGING ON
-. nr Db 1
-. \}
-. if "\\$1"off" \{\
-.tm DEBUGGING OFF
-. nr Db 0
-. \}
-.\}
-..
-.\" NS aV macro - parse argument vector (recursive) (.aV arg ... )
-.\" NS fV macro - parse argument vector (recursive) (.fV)
-.\" NS aC register argument counter (aV/fV)
-.\" NS fV register argument counter (must set to \\n(.$ prior to reuqest) (fV)
-.\" NS A[0-9] argument vector (aV/fV)
-.\" NS C[0-9] reg. arg type(1=macro, 2=arg, 3=punct-suf, 4=punct-pre) (aV/fV)
-.\" NS S[0-9] space vector (sV)
-.\" NS aP register argument pointer (aV)
-.\" NS yU local string used for debugging
-.\" NS iI local register (indent for inline debug mode)
-.\" NS mN name of calling request (set in each user requestable macro)
-.de aV
-.nr aC \\n(aC+1
-.ie "\\$1"|" \{\
-. if "\\*(mN"Op" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"Ar" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"Fl" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"Cm" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"It" .ds A\\n(aC \fR\\$1\fP
-.\}
-.el .ds A\\n(aC \\$1
-.aU \\n(aC
-.nr C\\n(aC \\n(aT
-.s\\n(aT
-.if \\n(Db \{\
-. if \\n(aT==1 .ds yU Executable
-. if \\n(aT==2 .ds yU String
-. if \\n(aT==3 .ds yU Closing Punctuation or suffix
-. if \\n(aT==4 .ds yU Opening Punctuation or prefix
-. if \\n(iN==1 \{\
-. br
-. nr iI \\n(.iu
-. in -\\n(iIu
-. if \\n(aC==1 \{\
-\&\fBDEBUG(argv) MACRO:\fP `.\\*(mN' \fBLine #:\fP \\n(.c
-. \}
-\&\t\fBArgc:\fP \\n(aC \fBArgv:\fP `\\*(A\\n(aC' \fBLength:\fP \\n(sW
-\&\t\fBSpace:\fP `\\*(S\\n(aC' \fBClass:\fP \\*(yU
-. \}
-. if \\n(iN==0 \{\
-. if \\n(aC==1 \{\
-. tm DEBUG(argv) MACRO: `.\\*(mN' Line #: \\n(.c
-. \}
-. tm \tArgc: \\n(aC Argv: `\\*(A\\n(aC' Length: \\n(sW
-. tm \tSpace: `\\*(S\\n(aC' Class: \\*(yU
-. \}
-.\}
-.ie \\n(.$==1 \{\
-. nr aP 0
-. ie \\n(dZ==1 \{\
-. if \\n(oM>1 .as b1 \\*(S0
-. \}
-. el \{\
-. if \\n(oM>0 \{\
-. if \\n(fC==0 .as b1 \\*(S0
-. \}
-. \}
-. ds S0 \\*(S\\n(aC
-. if \\n(Db \{\
-. if \\n(iN==1 \{\
-\&MACRO REQUEST: \t.\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. br
-. in \\n(iIu
-. \}
-. if \\n(iN==0 \{\
-.tm \tMACRO REQUEST: .\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. \}
-. \}
-.\}
-.el .aV \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.de fV
-.nr aC \\n(aC+1
-.if "\\*(A\\n(aC"|" \{\
-. if "\\*(mN"Op" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-. if "\\*(mN"Ar" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-. if "\\*(mN"Fl" .ds A\\n(aC \fR\&\\*(A\\n(aC\fP
-. if "\\*(mN"Cm" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-. if "\\*(mN"It" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-.\}
-.aU \\n(aC
-.nr C\\n(aC \\n(aT
-.s\\n(aT
-.if \\n(Db \{\
-. if \\n(aT==1 .ds yU Executable
-. if \\n(aT==2 .ds yU String
-. if \\n(aT==3 .ds yU Closing Punctuation or suffix
-. if \\n(aT==4 .ds yU Opening Punctuation or prefix
-. if \\n(iN==1 \{\
-. br
-. nr iI \\n(.iu
-. in -\\n(iIu
-. if \\n(aC==1 \{\
-\&\fBDEBUG(fargv) MACRO:\fP `.\\*(mN' \fBLine #:\fP \\n(.c
-. \}
-\&\t\fBArgc:\fP \\n(aC \fBArgv:\fP `\\*(A\\n(aC' \fBLength:\fP \\n(sW
-\&\t\fBSpace:\fP `\\*(S\\n(aC' \fBClass:\fP \\*(yU
-. \}
-. if \\n(iN==0 \{\
-. if \\n(aC==1 \{\
-. tm DEBUG(fargv) MACRO: `.\\*(mN' Line #: \\n(.c
-. \}
-. tm \tArgc: \\n(aC Argv: `\\*(A\\n(aC' Length: \\n(sW
-. tm \tSpace: `\\*(S\\n(aC' Class: \\*(yU
-. \}
-.\}
-.ie \\n(fV==1 \{\
-. nr aP 0
-. ie \\n(dZ==1 \{\
-. if \\n(oM>1 .as b1 \\*(S0
-. \}
-. el \{\
-. if \\n(oM>0 \{\
-. if \\n(fC==0 .as b1 \\*(S0
-. \}
-. \}
-. ds S0 \\*(S\\n(aC
-. nr fV 0
-. if \\n(Db \{\
-. ie \\n(iN \{\
-\&\tMACRO REQUEST: .\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. br
-. in \\n(iIu
-. \}
-. el \{\
-.tm \tMACRO REQUEST: .\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. \}
-. \}
-.\}
-.el \{\
-. nr fV \\n(fV-1
-. fV
-.\}
-..
-.\" NS aX macro - stuff saved strings into `b1' (used by -diag list)
-.de aX
-.nr aP \\n(aP+1
-.as b1 \&\\*(A\\n(aP
-.ie \\n(fV==1 \{\
-. nr aP 0
-. nr fV 0
-.\}
-.el \{\
-. as b1 \&\\*(sV
-. nr fV \\n(fV-1
-. aX
-.\}
-..
-.\" NS aI macro - append arg to arg vector: .aI [arg] [type] (used by .En only)
-.de aI
-.ie \\n(aC<9 \{\
-. nr aC \\n(aC+1
-. ds A\\n(aC \\$1
-. nr C\\n(aC \\$2
-. s\\$2
-. ds xV S\\n(aC
-.\}
-.el \{\
-. tm Usage: Too many arguments (maximum of 8 accepted) (#\\n(.c)
-. tm \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-.\}
-..
-.\"
-.\" NS aZ macro - print buffer (pB) and clean up arg vectors (aY)
-.de aZ
-.pB
-.aY
-..
-.\" NS aY macro - clean up arg vector
-.de aY
-.rm C0 C1 C2 C3 C4 C5 C6 C7 C8 C9
-.rm A0 A1 A2 A3 A4 A5 A6 A7 A8 A9
-.rm S1 S2 S3 S4 S5 S6 S7 S8 S9
-.nr aC 0
-.nr aP 0
-..
-.\" NS pB macro - test for end of vector (eol) (print b1 buffer or divert)
-.de pB
-.ie \\n(dZ==1 \{\
-. if \\n(oM==1 \{\&\\*(b1
-. rm S0
-. ds b1
-. \}
-. if \\n(oM==0 \{\
-. x2
-. \}
-.\}
-.el \{\
-. ie \\n(oM==0 \{\&\\*(b1
-. rm S0
-. ds b1
-. \}
-. el \{\
-. if ((\\n(sM==1)&(\\n(tP==0)) \{\
-. x1
-. \}
-. \}
-.\}
-.hy
-..
-.\" NS x1 macro - save buffer and divert if tP flag set
-.\" NS eB diversion string
-.\" NS b2 string save of buffer
-.\" NS lK register count of lines read from input file
-.de x1
-.nr dZ \\n(dZ+1
-.ds b2 \\*(b1
-.ds b1
-.nr lK \\n(.c
-.ev 2
-.fi
-.di eB
-..
.\"
-.\" NS x2 macro - end diversion and print
-.\" NS b0 string local temporary
-.de x2
-.br
-.di
-.ev
-.ie (\\n(.c-\\n(lK>1) \{\
-. ds b0 \&\\*(eB\\
-. ds b1 \\*(b2\\*(b0\\*(b1
-.\}
-.el .ds b1 \\*(b2\\*(b1
-\&\\*(b1
-.rm eB b2 b0 b1
-.nr dZ \\n(dZ-1
-..
-.\" NS Fl macro - flags (appends - and prints flags)
-.\" NS cF register save current font
-.\" NS cZ register save current font size
-.de Fl
-.as b1 \&\\*(fL
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. as b1 \&\|\-\|\fP\s0
-. pB
-. \}
-. el \{\
-. ds mN Fl
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 \{\
-. as b1 \&\|\-\fP\s0
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. as b1 \&\|\-\fP\s0
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. if \\n(C\\n(aP==3 \{\
-. as b1 \&\|\-\|
-. \}
-. fR
-. \}
-. \}
-.\}
-..
+.\" Modified by
.\"
-.\" NS fR macro - Fl flag recursion routine (special handling)
-.\" NS jM local register
-.\" NS jN local register
-.\"
-.de fR
-.hy 0
-.nr jM \\n(C\\n(aP
-.ie \\n(jM==1 \{\
-. as b1 \&\fP\s0
-. \\*(A\\n(aP
-.\}
-.el \{\
-. nr jN \\n(aP
-. ie \\n(jM==2 \{\
-. ie !"\\*(A\\n(aP"\\*(Ba" \{\
-. ie !"\\*(A\\n(aP"\fR|\fP" \{\
-. ie "\\*(A\\n(aP"-" .as b1 \&\|\-\^\-\|
-. el .as b1 \&\|\-\\*(A\\n(aP
-. \}
-. el .as b1 \&\\*(A\\n(aP
-. \}
-. el .as b1 \&\\*(A\\n(aP
-. \}
-. el .as b1 \&\f\\n(cF\s\\n(cZ\\*(A\\n(aP\fP\s0
-. ie \\n(aC==\\n(aP \{\
-. if \\n(jM==4 .as b1 \&\|\-
-. as b1 \&\fP\s0
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. ie ((\\n(C\\n(aP==3)&(\\n(C\\n(jN==4)) .as b1 \&\|\-
-. el .as b1 \&\\*(S\\n(jN
-. fR \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.rr jM jN
-..
+.\" Werner LEMBERG <wl@gnu.org> and
+.\" Ruslan Ermilov <ru@freebsd.org>
.\"
-.\" NS nR macro - general name recursion routine
-.\" NS jM local register
-.\" NS jN local register
-.de nR
-.hy 0
-.nr jM \\n(C\\n(aP
-.ie \\n(jM==1 \{\
-. as b1 \&\f\\n(cF\s\\n(cZ
-. \\*(A\\n(aP
-.\}
-.el \{\
-. nr jN \\n(aP
-. ie \\n(jM==2 .as b1 \&\\*(A\\n(aP
-. el .as b1 \&\f\\n(cF\s\\n(cZ\\*(A\\n(aP\fP\s0
-. ie \\n(aC==\\n(aP \{\
-. as b1 \&\f\\n(cF\s\\n(cZ
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. as b1 \&\\*(S\\n(jN
-. nR
-. \}
-.\}
-.rr jM jN
-..
-.\" NS Ar macro - command line `argument' macro
+.\" to make it more readable: using long names and many groff features,
+.\" updating and extending documentation, etc.
.\"
+.\" %beginstrip%
+.
+.
+.if !\n(.g \
+. ab This version of mdoc can be run with GNU troff only!
+.
+.
+.cp 0
+.
+.
+.if ((\n[.x] == 0) : ((\n[.x] == 1) & (\n[.y] < 17))) \
+. ab You need GNU troff version 1.17 or higher to run this version of mdoc!
+.
+.
+.\" Load start-up files
+.ie t \
+. mso mdoc/doc-ditroff.new
+.el \
+. mso mdoc/doc-nroff.new
+.
+.mso mdoc/doc-common.new
+.mso mdoc/doc-syms.new
+.
+.
+.eo
+.
+.
+.\" NS Db macro
+.\" NS defunct
+.
+.de Db
+. tm mdoc error: .Db defunct (#\n[.c])
+..
+.
+.
+.\" NS doc-macro-name global string
+.\" NS name of calling request (set in each user-requestable macro)
+.
+.ds doc-macro-name
+.als doc-arg0 doc-macro-name
+.
+.
+.\" NS doc-arg-limit global register
+.\" NS total number of arguments
+.
+.nr doc-arg-limit 0
+.
+.
+.\" NS doc-num-args global register
+.\" NS number of arguments to handle (must be set to \n[.$] prior to
+.\" NS `doc-parse-arg-vector' request)
+.
+.nr doc-num-args 0
+.
+.
+.\" NS doc-arg-ptr global register
+.\" NS argument pointer
+.
+.nr doc-arg-ptr 0
+.
+.
+.\" NS doc-argXXX global string
+.\" NS argument vector
+.\" NS
+.\" NS limit:
+.\" NS doc-arg-limit
+.
+.ds doc-arg1
+.
+.
+.\" NS doc-typeXXX global register
+.\" NS argument type vector (macro=1, string=2, punctuation suffix=3,
+.\" NS punctuation prefix=4)
+.\" NS
+.\" NS limit:
+.\" NS doc-arg-limit
+.
+.nr doc-type1 0
+.
+.
+.\" NS doc-spaceXXX global string
+.\" NS space vector
+.\" NS
+.\" NS limit:
+.\" NS doc-arg-limit
+.
+.ds doc-space1
+.
+.
+.\" NS doc-parse-args macro
+.\" NS parse arguments (recursively) (`.doc-parse-args arg ...')
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-limit
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-spaceXXX
+.\" NS doc-typeXXX
+.\" NS doc-arg-ptr
+.\" NS doc-have-space
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dpa
+.\" NS doc-reg-dpa1
+.\" NS doc-str-dpa
+.
+.de doc-parse-args
+. if !\n[doc-arg-limit] \
+. doc-set-spacing-1
+.
+. nr doc-have-space 0
+.
+. if !\n[.$] \
+. return
+.
+. nr doc-arg-limit +1
+.
+. \" handle `|' specially
+. ie "\$1"|" \
+. ds doc-arg\n[doc-arg-limit] \f[R]|\f[P]
+. el \
+. ds doc-arg\n[doc-arg-limit] "\$1
+.
+. \" get argument type and set spacing
+. doc-get-arg-type* \n[doc-arg-limit]
+. nr doc-type\n[doc-arg-limit] \n[doc-arg-type]
+. doc-set-spacing-\n[doc-arg-type]
+.
+. \" check whether we have processed the last parameter
+. ie (\n[.$] == 1) \
+. nr doc-arg-ptr 0
+. el \{\
+. shift
+. doc-parse-args \$@
+. \}
+.
+. nh
+..
+.
+.
+.\" NS doc-parse-arg-vector macro
+.\" NS parse argument vector (recursive)
+.\" NS
+.\" NS cf. comments in doc-parse-args
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-limit
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-num-args
+.\" NS doc-spaceXXX
+.\" NS doc-typeXXX
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dpav
+.\" NS doc-reg-dpav1
+.\" NS doc-str-dpav
+.
+.de doc-parse-arg-vector
+. if !\n[doc-arg-limit] \
+. doc-set-spacing-1
+.
+. nr doc-arg-limit +1
+.
+. if "\*[doc-arg\n[doc-arg-limit]]"|" \
+. ds doc-arg\n[doc-arg-limit] \f[R]|\f[P]
+.
+. doc-get-arg-type* \n[doc-arg-limit]
+. nr doc-type\n[doc-arg-limit] \n[doc-arg-type]
+. doc-set-spacing-\n[doc-arg-type]
+.
+. ie (\n[doc-num-args] == 1) \{\
+. nr doc-arg-ptr 0
+. nr doc-num-args 0
+. \}
+. el \{\
+. nr doc-num-args -1
+. doc-parse-arg-vector
+. \}
+.
+. nh
+..
+.
+.
+.\" NS doc-parse-space-vector macro
+.\" NS parse space vector (recursive)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-limit
+.\" NS doc-num-args
+.\" NS doc-spaceXXX
+.
+.de doc-parse-space-vector
+. nr doc-arg-limit +1
+.
+. doc-set-spacing-\n[doc-type\n[doc-arg-limit]]
+.
+. ie (\n[doc-num-args] == 1) \
+. nr doc-num-args 0
+. el \{\
+. nr doc-num-args -1
+. doc-parse-space-vector
+. \}
+..
+.
+.
+.\" NS doc-remaining-args macro
+.\" NS output remaining arguments as-is, separated by spaces (until
+.\" NS `doc-num-args' is exhausted)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-num-args
+.
+.de doc-remaining-args
+. nr doc-arg-ptr +1
+. nop \)\*[doc-arg\n[doc-arg-ptr]]\c
+.
+. ie (\n[doc-num-args] == 1) \{\
+. nr doc-arg-ptr 0
+. nr doc-num-args 0
+. \}
+. el \{\
+. nop \)\*[doc-space]\c
+. nr doc-num-args -1
+. doc-remaining-args
+. \}
+..
+.
+.
+.\" NS doc-append-arg macro
+.\" NS append one argument to argument vector:
+.\" NS `.doc-append-arg [arg] [type]'
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-limit
+.\" NS doc-argXXX
+.\" NS doc-typeXXX
+.
+.de doc-append-arg
+. nr doc-arg-limit +1
+. ds doc-arg\n[doc-arg-limit] "\$1
+. nr doc-type\n[doc-arg-limit] \$2
+. doc-set-spacing-\$2
+..
+.
+.
+.\" NS doc-print-and-reset macro
+.\" NS finish input line and clean up argument vectors
+.
+.de doc-print-and-reset
+. if \n[doc-space-mode] \
+. nop \)
+. doc-reset-args
+..
+.
+.
+.\" NS doc-reset-args macro
+.\" NS reset argument counters
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-limit
+.\" NS doc-arg-ptr
+.\" NS doc-have-slot
+.
+.de doc-reset-args
+. nr doc-arg-limit 0
+. nr doc-arg-ptr 0
+. nr doc-have-slot 0
+.
+. hy \n[doc-hyphen-flags]
+..
+.
+.
+.ec
+.
+.\" NS doc-curr-font global register
+.\" NS saved current font
+.
+.nr doc-curr-font \n[.f]
+.
+.
+.\" NS doc-curr-size global register
+.\" NS saved current font size
+.
+.nr doc-curr-size \n[.ps]
+.
+.eo
+.
+.
+.\" NS Fl user macro
+.\" NS handle flags (appends `-' and prints flags): `.Fl [arg ...]'
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-Fl (for communication with doc-flag-recursion)
+.\" NS
+.\" NS width register `Fl' set in doc-common
+.
+.de Fl
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Fl-font]\c
+.
+. if !\n[doc-arg-limit] \{\
+. ds doc-macro-name Fl
+. doc-parse-args \$@
+.
+. if !\n[.$] \{\
+. \" no arguments
+. nop \|\-\|\f[P]\s[0]
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. \" last argument
+. nop \|\-\f[P]\s[0]\c
+. doc-print-and-reset
+. \}
+. el \{\
+. ie (\n[doc-type\n[doc-arg-ptr]] == 1) \{\
+. nop \|\-\f[P]\s[0]\c
+. \*[doc-arg\n[doc-arg-ptr]]
+. \}
+. el \{\
+. if (\n[doc-type\n[doc-arg-ptr]] == 3) \
+. nop \|\-\|\c
+.
+. nr doc-reg-Fl 1
+. doc-flag-recursion
+. \}\}
+..
+.
+.
+.\" NS doc-flag-recursion macro
+.\" NS `Fl' flag recursion routine (special handling)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dfr
+.\" NS doc-reg-dfr1
+.\" NS doc-str-dfr
+.
+.de doc-flag-recursion
+. nr doc-reg-dfr1 \n[doc-type\n[doc-arg-ptr]]
+. ds doc-str-dfr "\*[doc-arg\n[doc-arg-ptr]]
+.
+. ie (\n[doc-reg-dfr1] == 1) \{\
+. nop \f[P]\s[0]\c
+. \*[doc-str-dfr]
+. \}
+. el \{\
+. nr doc-reg-dfr \n[doc-arg-ptr]
+.
+. ie (\n[doc-reg-dfr1] == 2) \{\
+. \" handle vertical bar -- doc-reg-Fl is set for the first call of
+. \" doc-flag-recursion only; we need this to make `.Fl | ...' work
+. \" correctly
+. ie "\*[doc-str-dfr]"\*[Ba]" \{\
+. if \n[doc-reg-Fl] \
+. nop \|\-\*[doc-space]\c
+. nop \)\*[Ba]\c
+. \}
+. el \{\
+. ie "\*[doc-str-dfr]"\f[R]|\f[P]" \{\
+. if \n[doc-reg-Fl] \
+. nop \|\-\*[doc-space]\c
+. nop \f[R]|\f[P]\c
+. \}
+. el \{\
+. \" two consecutive hyphen characters?
+. ie "\*[doc-str-dfr]"-" \
+. nop \|\-\^\-\|\c
+. el \
+. nop \|\%\-\*[doc-str-dfr]\c
+. \}\}\}
+. el \{\
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. nop \)\*[doc-str-dfr]\f[P]\s[0]\c
+. \}
+.
+. ie (\n[doc-arg-limit] == \n[doc-arg-ptr]) \{\
+. \" last argument
+. if (\n[doc-reg-dfr1] == 4) \
+. nop \|\-\c
+. nop \f[P]\s[0]\c
+. doc-print-and-reset
+. \}
+. el \{\
+. nr doc-arg-ptr +1
+. ie (\n[doc-type\n[doc-arg-ptr]] == 3) \{\
+. ie (\n[doc-type\n[doc-reg-dfr]] == 4) \
+. nop \|\-\c
+. el \
+. nop \)\*[doc-space\n[doc-reg-dfr]]\c
+. \}
+. el \
+. nop \)\*[doc-space\n[doc-reg-dfr]]\c
+.
+. shift
+. nr doc-reg-Fl 0
+. doc-flag-recursion \$@
+. \}\}
+..
+.
+.
+.\" NS doc-print-recursive macro
+.\" NS general name recursion routine (print remaining arguments)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dpr
+.\" NS doc-reg-dpr1
+.\" NS doc-str-dpr
+.
+.de doc-print-recursive
+. nr doc-reg-dpr1 \n[doc-type\n[doc-arg-ptr]]
+. ds doc-str-dpr "\*[doc-arg\n[doc-arg-ptr]]
+.
+. ie (\n[doc-reg-dpr1] == 1) \{\
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. \*[doc-str-dpr]
+. \}
+. el \{\
+. nr doc-reg-dpr \n[doc-arg-ptr]
+.
+. ie (\n[doc-reg-dpr1] == 2) \
+. \" the `\%' prevents hyphenation on a dash (`-')
+. nop \%\*[doc-str-dpr]\&\c
+. el \{\
+. \" punctuation character
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. nop \)\*[doc-str-dpr]\f[P]\s[0]\c
+. \}
+.
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. \" last argument
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. doc-print-and-reset
+. \}
+. el \{\
+. nop \)\*[doc-space\n[doc-reg-dpr]]\c
+. doc-print-recursive
+. \}\}
+..
+.
+.
+.\" NS doc-print-prefixes macro
+.\" NS print leading prefixes
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.
+.de doc-print-prefixes
+. while (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. if !(\n[doc-type\n[doc-arg-ptr]] == 4) \
+. break
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. nop \)\*[doc-arg\n[doc-arg-ptr]]\f[P]\s[0]\c
+. nr doc-arg-ptr +1
+. \}
+..
+.
+.
+.\" NS doc-generic-macro macro
+.\" NS this is the skeleton for most simple macros
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.
+.de doc-generic-macro
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name \$0
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .\$0 \*[doc-\$0-usage] ... (#\n[.c])
+. \}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. if (\n[doc-type\n[doc-arg-ptr]] == 1) \{\
+. tm Usage: .\$0 \*[doc-\$0-usage] ... (#\n[.c])
+.
+. \" the right action here would be to reset the argument counters
+. \" and bail out -- unfortunately, a small number of manual pages
+. \" (less than 2% for FreeBSD which has been used for testing)
+. \" relied on the old behaviour (silently ignore this error),
+. \" so it is commented out
+.
+.\" doc-reset-args
+. \}
+.\" el \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-\$0-font]\c
+. doc-print-recursive
+.\" \}
+. \}
+. el \{\
+. tm Usage: .\$0 \*[doc-\$0-usage] ... (#\n[.c])
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS Ar user macro
+.\" NS command line `argument' macro: `.Ar [args ...]'
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS
+.\" NS local variable:
+.\" NS doc-str-Ar-default
+.\" NS
+.\" NS width register `Ar' set in doc-common
+.
+.ds doc-str-Ar-default "file\ .\|.\|.
+.
.de Ar
-.as b1 \\*(aR
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. as b1 file\ ...\fP\s0
-. pB
-. \}
-. el \{\
-. ds mN Ar
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 \{\
-. as b1 \&file\ ...\fP\s0
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. as b1 \&file\ ...\fP\s0
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. if \\n(C\\n(aP==3 \{\
-. as b1 \&file\ ...
-. \}
-. nR
-. \}
-. \}
-.\}
-..
-.\" NS Ad macro - Addresses
-.de Ad
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ad address ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ad
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(aD
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Cd macro - Config declaration (for section 4 SYNOPSIS) (not callable)
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Ar-font]\c
+.
+. if !\n[doc-arg-limit] \{\
+. ds doc-macro-name Ar
+. doc-parse-args \$@
+.
+. if !\n[.$] \{\
+. \" no argument
+. nop \)\*[doc-str-Ar-default]\&\f[P]\s[0]
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. nop \)\*[doc-str-Ar-default]\&\f[P]\s[0]\c
+. doc-print-and-reset
+. \}
+. el \{\
+. if !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
+. \" replace previous argument (Ar) with default value
+. nr doc-arg-ptr -1
+. ds doc-arg\n[doc-arg-ptr] "\*[doc-str-Ar-default]
+. nr doc-type\n[doc-arg-ptr] 2
+. ds doc-space\n[doc-arg-ptr] "\*[doc-space]
+.
+. \" recompute space vector for remaining arguments
+. nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
+. nr doc-arg-limit \n[doc-arg-ptr]
+. doc-parse-space-vector
+. \}
+. doc-print-recursive
+. \}
+..
+.
+.
+.\" NS Ad user macro
+.\" NS Addresses
+.\" NS
+.\" NS width register `Ad' set in doc-common
+.
+.als Ad doc-generic-macro
+.ds doc-Ad-usage address
+.
+.
+.\" NS doc-in-synopsis-count global register
+.\" NS whether we have more than a single item in synopsis
+.
+.nr doc-in-synopsis-count 0
+.
+.
+.\" NS doc-indent-synopsis global register
+.\" NS indentation in synopsis
+.
+.nr doc-indent-synopsis 0
+.
+.
+.\" NS Cd user macro
+.\" NS config declaration (for section 4 SYNOPSIS)
+.\" NS
+.\" NS this function causes a break; it uses the `Nm' font
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-in-synopsis-count
+.\" NS doc-indent-synopsis
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Cd' set in doc-common
+.\"
.\" needs work - not very translatable
+.
.de Cd
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Cd Configuration file declaration (#\\n(.c)
-. el \{\
-. ds mN Cd
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.br
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(nM
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie \\n(nS \{\
-. if "\\*(mN"Cd" \{\
-. rs
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 .nr iS \\n(Dsu
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-. \}
-. nR
-. in -\\n(iSu
-. \}
-. el .nR
-.\}
-..
-.\" NS Cm macro - Interactive command modifier (flag)
-.de Cm
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Cm Interactive command modifier ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Cm
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(cM
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Dv macro - define variable
-.de Dv
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Dv define_variable ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Dv
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eR
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Em macro - Emphasis
-.de Em
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. tm Usage: .Em text ... \\*(Pu (#\\n(.c)
-. \}
-. el \{\
-. ds mN Em
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eM
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Er macro - Errnotype
-.de Er
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Er ERRNOTYPE ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Er
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eR
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Ev macro - Environment variable
-.de Ev
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ev ENVIRONMENT_VARIABLE ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ev
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eV
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Fd macro - function declaration - not callable (& no err check)
-.\" NS fD register subroutine test (in synopsis only)
-.\" NS fY register subroutine count (in synopsis only) (fortran only)
-.\" NS fZ register also subroutine count (in synopsis only)
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Cd
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Cd configuration_file_declaration ... (#\n[.c])
+. \}
+.
+. br
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. ie \n[doc-in-synopsis-count] \{\
+. if "\*[doc-macro-name]"Cd" \{\
+. rs
+. ie (\n[doc-in-synopsis-count] > 1) \
+. br
+. el \{\
+. if !\n[doc-indent-synopsis] \
+. nr doc-indent-synopsis \n[doc-display-indent]u
+. \}
+. in +\n[doc-indent-synopsis]u
+. ti -\n[doc-indent-synopsis]u
+. nr doc-in-synopsis-count +1
+. \}
+.
+. nop \*[doc-Nm-font]\c
+. doc-print-recursive
+. in -\n[doc-indent-synopsis]u
+. \}
+. el \{\
+. nop \*[doc-Nm-font]\c
+. doc-print-recursive
+. \}\}
+. el \{\
+. tm Usage: .Cd configuration_file_declaration ... (#\n[.c])
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS Cm user macro
+.\" NS interactive command modifier (flag)
+.\" NS
+.\" NS width register `Cm' set in doc-common
+.
+.als Cm doc-generic-macro
+.ds doc-Cm-usage interactive_command_modifier
+.
+.
+.\" NS Dv user macro
+.\" NS defined variable
+.\" NS
+.\" NS this function uses the `Er' font
+.\" NS
+.\" NS width register `Dv' set in doc-common
+.
+.als Dv doc-generic-macro
+.ds doc-Dv-usage defined_variable
+.als doc-Dv-font doc-Er-font
+.
+.
+.\" NS Em user macro
+.\" NS emphasis
+.\" NS
+.\" NS width register `Em' set in doc-common
+.
+.als Em doc-generic-macro
+.ds doc-Em-usage text
+.
+.
+.\" NS Er user macro
+.\" NS errno type
+.\" NS
+.\" NS width register `Er' set in doc-common
+.
+.als Er doc-generic-macro
+.ds doc-Er-usage text
+.
+.
+.\" NS Ev user macro
+.\" NS environment variable
+.\" NS
+.\" NS width register `Ev' set in doc-common
+.
+.als Ev doc-generic-macro
+.ds doc-Ev-usage text
+.
+.
+.\" NS doc-have-decl global register (bool)
+.\" NS subroutine test (in synopsis only)
+.
+.nr doc-have-decl 0
+.
+.
+.\" NS doc-have-var global register (bool)
+.\" NS whether last type is a variable type
+.
+.nr doc-have-var 0
+.
+.
+.\" NS doc-do-func-decl macro
+.\" NS do someting special while in SYNOPSIS
+.\" NS
+.\" NS modifies:
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-have-decl
+.\" NS doc-have-var
+.
+.de doc-do-func-decl
+. if \n[doc-in-synopsis-count] \{\
+. \" if a variable type was the last thing given, want vertical space
+. if \n[doc-have-var] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. \}
+. \" if a subroutine was the last thing given, want vertical space
+. if \n[doc-have-func] \{\
+. ie \n[doc-have-decl] \
+. br
+. el \{\
+. doc-paragraph
+. rs
+. \}\}
+. nr doc-have-decl 1
+. \}
+.
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+..
+.
+.
+.\" NS Fd user macro
+.\" NS function declaration -- not callable
+.\" NS
+.\" NS this function causes a break
+.\" NS
+.\" NS width register `Fd' set in doc-common
+.
.de Fd
-.ds mN Fd
-.if \\n(nS>0 \{\
-.\" if a variable type was the last thing given, want vertical space
-. if \\n(fX>0 \{\
-. Pp
-. nr fX 0
-. \}
-.\" if a subroutine was the last thing given, want vertical space
-. if \\n(fZ>0 \{\
-. ie \\n(fD==0 \{\
-. Pp
-. rs
-. \}
-. el .br
-. \}
-. nr fD \\n(fD+1
-.\}
-.nr cF \\n(.f
-.nr cZ \\n(.s
-\&\\*(fD\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.br
-.ft \\n(cF
-.fs \\n(cZ
-..
-.\" NS Fr macro - function return value - not callable (at the moment)
-.de Fr
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fr Function_return_value... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Fr
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(aR
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Ic macro - Interactive command
-.de Ic
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ic Interactive command ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ic
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(iC
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Li macro - literals
-.de Li
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage .Li argument ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Li
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(lI
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Or macro - Pipe symbol (OR)
-.de Or
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Or ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Or
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(iC
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Ms macro - Math symbol
-.de Ms
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ms Math symbol ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ms
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(sY
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Nm macro - Name of command or page topic
-.\" NS n1 string - save first invocation of .Nm
-.\" NS iS register - indent second command line in a synopsis
+. ie ((\n[.$] >= 1) & (\n[doc-arg-limit] == 0)) \{\
+. doc-do-func-decl
+. nop \*[doc-Fd-font]\$*
+. br
+. ft \n[doc-curr-font]
+. ps \n[doc-curr-size]u
+. \}
+. el \{\
+. tm Usage: .Fd function_declaration -- Fd is not callable (#\n[.c])
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS In user macro
+.\" NS #include statement - not callable
+.\" NS
+.\" NS this function causes a break; it uses the `Fd' font
+.\" NS
+.\" NS width register `In' set in doc-common
+.
+.de In
+. ie ((\n[.$] == 1) & (\n[doc-arg-limit] == 0)) \{\
+. doc-do-func-decl
+. nop \*[doc-Fd-font]#include <\$1>
+. br
+. ft \n[doc-curr-font]
+. ps \n[doc-curr-size]u
+. \}
+. el \{\
+. tm Usage: .In include_file -- In is not callable (#\n[.c])
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS Fr user macro
+.\" NS function return value
+.\" NS
+.\" NS this function uses the `Ar' font
+.\" NS
+.\" NS width register `Fr' set in doc-common
+.
+.als Fr doc-generic-macro
+.ds doc-Fr-usage function_return_value
+.als doc-Fr-font doc-Ar-font
+.
+.
+.\" NS Ic user macro
+.\" NS interactive command
+.\" NS
+.\" NS width register `Ic' set in doc-common
+.
+.als Ic doc-generic-macro
+.ds doc-Ic-usage interactive_command
+.
+.
+.\" NS Li user macro
+.\" NS literals
+.\" NS
+.\" NS width register `Li' set in doc-common
+.
+.als Li doc-generic-macro
+.ds doc-Li-usage argument
+.
+.
+.\" NS Or user macro
+.\" NS pipe symbol (OR)
+.\" NS
+.\" NS this function uses the `Ic' font
+.\" NS
+.\" NS width register `Or' set in doc-common
+.\"
+.\" XXX: What is this function good for? It sets a font but does not print
+.\" a pipe symbol. And it isn't documented.
+.
+.als Or doc-generic-macro
+.ds doc-Or-usage
+.als doc-Or-font doc-Ic-font
+.
+.
+.\" NS Ms user macro
+.\" NS math symbol
+.\" NS
+.\" NS this function uses the `Sy' font
+.\" NS
+.\" NS width register `Ms' set in doc-common
+.
+.als Ms doc-generic-macro
+.ds doc-Ms-usage math_symbol
+.als doc-Ms-font doc-Sy-font
+.
+.
+.\" NS doc-command-name global string
+.\" NS save first invocation of .Nm
+.
+.ds doc-command-name
+.
+.
+.\" NS Nm user macro
+.\" NS name of command or page topic
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-command-name
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-in-synopsis-count
+.\" NS doc-indent-synopsis,
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Nm' set in doc-common
+.
.de Nm
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. ie "\\*(n1"" .tm Usage: .Nm Name(s) ... \\*(Pu (#\\n(.c)
-. el \&\\*(nM\\*(n1\fP\s0
-. \}
-. el \{\
-. ds mN Nm
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie \\n(aC==\\n(aP \{\
-. as b1 \&\\*(nM\\*(n1\fP\s0
-. aZ
-. \}
-. el \{\
-. as b1 \\*(nM
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. as b1 \&\\*(n1\fP\s0
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. if \\n(nS \{\
-. if "\\*(mN"Nm" \{\
-. rs
-. in -\\n(iSu
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 \{\
-. sw \\$1
-. nr iS ((\\n(sWu+1)*\\n(fW)u
-. \}
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-. \}
-. \}
-. if "\\*(n1"" .ds n1 \\*(A\\n(aP
-. nR
-. \}
-. \}
-.\}
-..
-.\" NS Pa macro - Pathname
+. if !\n[doc-arg-limit] \{\
+. ds doc-macro-name Nm
+. ie \n[.$] \
+. doc-parse-args \$@
+. el \{\
+. ie "\*[doc-command-name]"" \
+. tm Usage: .Nm name ... (#\n[.c])
+. el \
+. doc-parse-args \*[doc-command-name]
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. \" last argument
+. ie "\*[doc-command-name]"" \{\
+. tm Usage: .Nm name ... (#\n[.c])
+. doc-reset-args
+. \}
+. el \{\
+. nop \*[doc-Nm-font]\*[doc-command-name]\f[P]\s[0]\c
+. doc-print-and-reset
+. \}\}
+. el \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. rs
+.
+. ie !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
+. ie "\*[doc-command-name]"" \
+. tm Usage: .Nm name ... (#\n[.c])
+. el \{\
+. \" replace previous argument (Nm) with default value
+. nr doc-arg-ptr -1
+. ds doc-arg\n[doc-arg-ptr] "\*[doc-Nm-font]\*[doc-command-name]\f[P]\s[0]
+. nr doc-type\n[doc-arg-ptr] 2
+. ds doc-space\n[doc-arg-ptr] "\*[doc-space]
+.
+. \" recompute space vector for remaining arguments
+. nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
+. nr doc-arg-limit \n[doc-arg-ptr]
+. doc-parse-space-vector
+. \}\}
+. el \{\
+. \" handle `.Nm ...' in SYNOPSIS
+. if \n[doc-in-synopsis-count] \{\
+. if "\*[doc-macro-name]"Nm" \{\
+. in -\n[doc-indent-synopsis]u
+. ie (\n[doc-in-synopsis-count] > 1) \
+. br
+. el \{\
+. if !\n[doc-indent-synopsis] \{\
+. doc-get-width "\*[doc-arg\n[doc-arg-ptr]]"
+. nr doc-indent-synopsis ((\n[doc-width]u + 1u) * \n[doc-fixed-width]u)
+. \}\}
+.
+. in +\n[doc-indent-synopsis]u
+. ti -\n[doc-indent-synopsis]u
+. nr doc-in-synopsis-count +1
+. \}\}
+. if "\*[doc-command-name]"" \
+. ds doc-command-name "\*[doc-arg\n[doc-arg-ptr]]
+.
+. nop \*[doc-Nm-font]\c
+. \}
+. doc-print-recursive
+. \}
+..
+.
+.
+.\" NS Pa user macro
+.\" NS pathname: `.Pa [arg ...]'
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Pa' set in doc-common
+.
.de Pa
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \&\\*(pA~\fP\s0
-. el \{\
-. ds mN Pa
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(pA
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Sy macro - Symbolics
-.de Sy
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Sy symbolic_text ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Sy
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(sY
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Tn macro - Trade Name Macro
+. if !\n[doc-arg-limit] \{\
+. ds doc-macro-name Pa
+. doc-parse-args \$@
+.
+. if !\n[.$] \{\
+. \" default value
+. nop \*[doc-Pa-font]~\f[P]\s[0]
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Pa-font]\c
+. if !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
+. \" replace previous argument (Pa) with default value
+. nr doc-arg-ptr -1
+. ds doc-arg\n[doc-arg-ptr] ~
+. nr doc-type\n[doc-arg-ptr] 2
+. ds doc-space\n[doc-arg-ptr] "\*[doc-space]
+.
+. \" recompute space vector for remaining arguments
+. nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
+. nr doc-arg-limit \n[doc-arg-ptr]
+. doc-parse-space-vector
+. \}
+. doc-print-recursive
+. \}
+. el \{\
+. nop \*[doc-Pa-font]~\f[P]\s[0]\c
+. doc-print-and-reset
+. \}
+..
+.
+.
+.\" NS Sy user macro
+.\" NS symbolics
+.\" NS
+.\" NS width register `Sy' set in doc-common
+.
+.als Sy doc-generic-macro
+.ds doc-Sy-usage symbolic_text
+.
+.
+.\" NS Me user macro
+.\" NS menu entries
+.\" NS
+.\" NS width register `Me' set in doc-common
+.
+.als Me doc-generic-macro
+.ds doc-Me-usage menu_entry
+.
+.
+.\" NS Tn user macro
+.\" NS trade name
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Tn' set in doc-common
+.
.de Tn
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Tn Trade_name(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Tn
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(tN\\*(tF
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS nN macro - Trade Name Macro for inside of reference
-.de nN
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Tn Trade_name(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Tn
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(tN
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS Va macro - variable name macro
-.de Va
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Va variable_name(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Va
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(vA
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\"
-.\" NS No macro - Normal text macro (default text style if mess up)
-.de No
-.as b1 \\*(nO
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .No must be called with arguments (#\\n(.c)
-. el \{\
-. ds mN No
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-. \}
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" NS Op macro - Option Expression
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Tn
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Tn trade_name ... (#\n[.c])
+. \}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \)\*[doc-Tn-font-size]\c
+. ie !\n[doc-is-reference] \{\
+. nop \)\*[doc-Tn-font-shape]\c
+. doc-print-recursive
+. \}
+. el \
+. doc-do-references
+. \}
+. el \{\
+. tm Usage: .Tn trade_name ... (#\n[.c])
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS Va user macro
+.\" NS variable name
+.\" NS
+.\" NS width register `Va' set in doc-common
+.
+.als Va doc-generic-macro
+.ds doc-Va-usage variable_name
+.
+.
+.\" NS No user macro
+.\" NS normal text macro (default text style if mess up)
+.\" NS
+.\" NS width register `No' set in doc-common
+.
+.als No doc-generic-macro
+.ds doc-No-usage normal_text
+.
+.
+.\" NS doc-quote-left global string
+.\" NS left quotation character for `doc-enclose-string' and
+.\" NS `doc-enclose-open'
+.
+.ds doc-quote-left
+.
+.
+.\" NS doc-quote-right global string
+.\" NS right quotation character for `doc-enclose-string' and
+.\" NS `doc-enclose-close'
+.
+.ds doc-quote-right
+.
+.
+.\" NS Op user macro
+.\" NS option expression (i.e., enclose string in square brackets)
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Op' set in doc-common
+.
.de Op
-.if \\n(aC==0 \{\
-. ds mN Op
-.\}
-.\" .ds qL \&\\*(lO
-.\" .ds qR \&\\*(rO
-.ds qL \&\\*(lB
-.ds qR \&\\*(rB
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-..
-.\" NS Aq macro - Enclose string in angle brackets
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Op
+.
+. ds doc-quote-left "\*[doc-left-bracket]
+. ds doc-quote-right "\*[doc-right-bracket]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Aq user macro
+.\" NS enclose string in angle brackets
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Aq' set in doc-common
+.
.de Aq
-.if \\n(aC==0 .ds mN Aq
-.ds qL \&<
-.ds qR \&>
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Bq macro - Enclose string in square brackets
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Aq
+.
+. ds doc-quote-left \[la]
+. ds doc-quote-right \[ra]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Bq user macro
+.\" NS enclose string in square brackets
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Bq' set in doc-common
+.
.de Bq
-.if \\n(aC==0 .ds mN Bq
-.ds qL \&\\*(lB
-.ds qR \&\\*(rB
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Dq macro - Enclose string in double quotes
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Bq
+.
+. ds doc-quote-left "\*[doc-left-bracket]
+. ds doc-quote-right "\*[doc-right-bracket]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Brq user macro
+.\" NS enclose string in braces
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Brq' set in doc-common
+.
+.de Brq
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Brq
+.
+. ds doc-quote-left {
+. ds doc-quote-right }
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Dq user macro
+.\" NS enclose string in double quotes
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Dq' set in doc-common
+.
.de Dq
-.if \\n(aC==0 .ds mN Dq
-.ds qL \&\\*(Lq
-.ds qR \&\\*(Rq
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Eq macro - Enclose string in double quotes
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Dq
+.
+. ds doc-quote-left "\*[Lq]
+. ds doc-quote-right "\*[Rq]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Eq user macro
+.\" NS enclose string in user-defined quotes (args 1 and 2)
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Eq' set in doc-common
+.
.de Eq
-.if \\n(aC==0 .ds mN Eq
-.ds qL \\$1
-.ds qR \\$2
-.En \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Pq macro - Enclose string in parenthesis
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Eq
+.
+. ds doc-quote-left "\$1
+. ds doc-quote-right "\$2
+.
+. shift 2
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Pq user macro
+.\" NS enclose string in parentheses
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Pq' set in doc-common
+.
.de Pq
-.if \\n(aC==0 .ds mN Pq
-.ds qL \&\\*(lP
-.ds qR \&\\*(rP
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Ql macro - Quoted literal is in file mdoc-[dit|n|g]roff (too large
-.\" an if-else to carry along recursively for `if n ...')
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Pq
+.
+. ds doc-quote-left "\*[doc-left-parenthesis]
+. ds doc-quote-right "\*[doc-right-parenthesis]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Ql user macro
+.\" NS quoted literal
.\"
-.\" NS Sq macro - Enclose string in single quotes
+.\" is in file doc-[dit|n]roff
+.
+.
+.\" NS Qq user macro
+.\" NS enclose string in straight double quotes
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Qq' set in doc-common
+.
.de Qq
-.if \\n(aC==0 .ds mN Qq
-.ds qL \&\\*q
-.ds qR \&\\*q
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Sq macro - Enclose string in single quotes
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Qq
+.
+. ds doc-quote-left "\*[q]
+. ds doc-quote-right "\*[q]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Sq user macro
+.\" NS enclose string in single quotes
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Sq' set in doc-common
+.
.de Sq
-.if \\n(aC==0 .ds mN Sq
-.ds qL \&\\*(sL
-.ds qR \&\\*(sR
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"
-.\" NS Es macro - Set up strings for .En call
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Sq
+.
+. ds doc-quote-left "\*[doc-left-singlequote]
+. ds doc-quote-right "\*[doc-right-singlequote]
+.
+. doc-enclose-string \$@
+..
+.
+.
+.\" NS Es user macro
+.\" NS set up arguments (i.e., the left and right quotation character as
+.\" NS first and second argument) for .En call
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.
.de Es
-.if \\n(aC==0 \{\
-. ie \\n(.$>2 .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el \{\
-. ds qL \\$1
-. ds qR \\$2
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ds qL \\*(A\\n(aP
-. nr aP \\n(aP+1
-. ds qR \\*(A\\n(aP
-. ie \\n(aC>\\n(aP .c\\n(C\\n(aP
-. el .aZ
-.\}
-..
-.\" .tm En beg arg(A[\\n(aP])==\\*(A\\n(aP;
-.\" .tm En oM==\\n(oM; dZ==\\n(dZ; Xt==\\n(Xt; aC==\\n(aC
-.\" NS En macro - Enclose string with given args (eg [ and ] etc)
-.\" NS qL string variable set by calling macro
-.\" NS qR string variable set by calling macro
-.\" NS aJ register (for vR)
-.de En
-.ie \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. as b1 \&\\*(qL\\*(qR
-. pB
-. \}
-. el \{\
-.\". as mN (En)
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. as b1 \&\\*(qL
-. \}
-.\}
-.el \{\
-. as b1 \&\\*(qL
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 \{\
-. as b1 \&\\*(qR
-. aZ
-. \}
-. el \{\
-. ie \\n(C\\n(aC==3 \{\
-. nr aJ \\n(aC-1
-. vR
-. nr aJ \\n(aJ+1
-. ds A\\n(aJ \&\\*(qR\\*(A\\n(aJ
-. nr aJ 0
-. \}
-. el .aI \&\\*(qR 3
-. nr aP \\n(aP+1
-. if \\n(C\\n(aP==1 .\\*(A\\n(aP
-. if \\n(C\\n(aP>1 \{\
-. nr aP \\n(aP-1
-. No
-. \}
-. \}
-.\}
-..
-.\" NS vR macro - vector routine (for En, trace backwards past trail punct)
-.de vR
-.if \\n(C\\n(aJ==3 \{\
-. nr aJ \\n(aJ-1
-. vR
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" NS Ao macro - Angle open
+. if !\n[doc-arg-limit] \{\
+. ie (\n[.$] > 2) \{\
+. ds doc-macro-name Es
+. doc-parse-args \$@
+. \}
+. el \{\
+. ds doc-quote-left "\$1
+. ds doc-quote-right "\$2
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. ds doc-quote-left "\*[doc-arg\n[doc-arg-ptr]]
+. nr doc-arg-ptr +1
+. ds doc-quote-right "\*[doc-arg\n[doc-arg-ptr]]
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
+. doc-do-\n[doc-type\n[doc-arg-ptr]]
+. el \
+. doc-print-and-reset
+..
+.
+.
+.\" NS doc-have-slot global register (bool)
+.\" NS set if `doc-enclose-string' has created a slot for closing
+.\" NS delimiter
+.
+.nr doc-have-slot 0
+.
+.
+.\" NS doc-enclose-string macro
+.\" NS enclose string with given args (e.g. [ and ])
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-have-slot
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-des
+.\" NS doc-reg-des1
+.\" NS doc-reg-des2
+.\" NS
+.\" NS requires:
+.\" NS doc-quote-left
+.\" NS doc-quote-right
+.
+.de doc-enclose-string
+. if \n[doc-in-synopsis-count] \
+. doc-set-hard-space
+.
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \
+. doc-parse-args \$@
+. el \{\
+. nop \)\*[doc-quote-left]\*[doc-quote-right]
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. \" the final `\)' prevents hyphenation in case the next character is `\%'
+. nop \)\*[doc-quote-left]\)\c
+. ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. \" last argument
+. nop \)\*[doc-quote-right]\)\c
+. doc-print-and-reset
+. \}
+. el \{\
+. \" test whether last arguments are of type closing punctuation
+. \" resp. suffix
+. ie (\n[doc-type\n[doc-arg-limit]] == 3) \{\
+. nr doc-reg-des (\n[doc-arg-limit] - 1)
+. while (\n[doc-type\n[doc-reg-des]] == 3) \
+. nr doc-reg-des -1
+.
+. \" prepend closing delimiter
+. nr doc-reg-des +1
+. ds doc-arg\n[doc-reg-des] "\*[doc-quote-right]\)\*[doc-arg\n[doc-reg-des]]
+. \}
+. el \{\
+. \" test whether last arguments are macros which continue the line
+. \" logically
+. nr doc-reg-des \n[doc-arg-limit]
+. while (\n[doc-reg-des] >= \n[doc-arg-ptr]) \{\
+. if !\A\*[doc-arg\n[doc-reg-des]] \
+. break
+. if !d doc-after-\*[doc-arg\n[doc-reg-des]] \
+. break
+. nr doc-reg-des -1
+. \}
+.
+. \" if there are no trailing macros to be skipped, append argument
+. ie (\n[doc-reg-des] == \n[doc-arg-limit]) \
+. doc-append-arg "\)\*[doc-quote-right]\)" 3
+. el \{\
+. \" if a previous call to `doc-enclose-string' has already created
+. \" a slot, prepend argument
+. ie \n[doc-have-slot] \
+. ds doc-arg\n[doc-reg-des] "\*[doc-quote-right]\)\*[doc-arg\n[doc-reg-des]]
+. el \{\
+. \" we have to shift all arguments to the right
+. nr doc-reg-des +1
+. nr doc-reg-des1 \n[doc-arg-limit]
+. nr doc-reg-des2 (\n[doc-arg-limit] + 1)
+. while (\n[doc-reg-des1] >= \n[doc-reg-des]) \{\
+. rn doc-arg\n[doc-reg-des1] doc-arg\n[doc-reg-des2]
+. rnn doc-type\n[doc-reg-des1] doc-type\n[doc-reg-des2]
+. rn doc-space\n[doc-reg-des1] doc-space\n[doc-reg-des2]
+. nr doc-reg-des1 -1
+. nr doc-reg-des2 -1
+. \}
+. nr doc-arg-limit +1
+.
+. \" finally, insert closing delimiter into the freed slot and
+. \" recompute spacing vector
+. ds doc-arg\n[doc-reg-des] "\)\*[doc-quote-right]\)
+. nr doc-type\n[doc-reg-des] 3
+. nr doc-num-args (\n[doc-arg-limit] - \n[doc-reg-des] + 1)
+. nr doc-arg-limit (\n[doc-reg-des] - 1)
+. doc-parse-space-vector
+. nr doc-have-slot 1
+. \}\}\}
+.
+. doc-do-\n[doc-type\n[doc-arg-ptr]]
+. \}
+.
+. if \n[doc-in-synopsis-count] \
+. doc-set-soft-space
+..
+.
+.
+.\" NS En user macro
+.\" NS enclose arguments with quotation characters set up with `.Es'
+.
+.als En doc-enclose-string
+.
+.
+.\" NS Ao user macro
+.\" NS angle open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Ao' set in doc-common
+.
.de Ao
-.if \\n(aC==0 .ds mN Ao
-.ds qL \&<
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Ac macro - Angle close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Ao
+.
+. ds doc-quote-left \[la]
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Ac user macro
+.\" NS angle close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Ac' set in doc-common
+.
.de Ac
-.if \\n(aC==0 .ds mN Ac
-.ds qR \&>
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Bo macro - Bracket open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Ac
+.
+. ds doc-quote-right \[ra]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Bo user macro
+.\" NS bracket open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Bo' set in doc-common
+.
.de Bo
-.if \\n(aC==0 .ds mN Bo
-.ds qL \&[
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Bc macro - Bracket close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Bo
+.
+. ds doc-quote-left "\*[doc-left-bracket]
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Bc user macro
+.\" NS bracket close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Bc' set in doc-common
+.
.de Bc
-.if \\n(aC==0 .ds mN Bc
-.ds qR \&]
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Do macro - Double Quote open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Bc
+.
+. ds doc-quote-right "\*[doc-right-bracket]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Bro user macro
+.\" NS brace open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Bro' set in doc-common
+.
+.de Bro
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Bo
+.
+. ds doc-quote-left {
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Brc user macro
+.\" NS brace close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Brc' set in doc-common
+.
+.de Brc
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Bc
+.
+. ds doc-quote-right }
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Do user macro
+.\" NS double quote open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Do' set in doc-common
+.
.de Do
-.if \\n(aC==0 .ds mN Do
-.ds qL \&\\*(Lq
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Dc macro - Double Quote close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Do
+.
+. ds doc-quote-left "\*[Lq]
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Dc user macro
+.\" NS double quote close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Dc' set in doc-common
+.
.de Dc
-.if \\n(aC==0 .ds mN Dc
-.ds qR \&\\*(Rq
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Eo macro - Enclose open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Dc
+.
+. ds doc-quote-right "\*[Rq]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Eo user macro
+.\" NS enclose open (using first argument as beginning of enclosure)
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Eo' set in doc-common
+.
.de Eo
-.if \\n(aC==0 .ds mN Eo
-.ds qL \\$1
-.eO \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Ec macro - Enclose close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Eo
+.
+. ds doc-quote-left "\$1
+.
+. shift
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Ec user macro
+.\" NS enclose close (using first argument as end of enclosure)
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Ec' set in doc-common
+.
.de Ec
-.if \\n(aC==0 .ds mN Ec
-.ds qR \\$1
-.eC \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Oo macro - Option open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Ec
+.
+. ds doc-quote-right "\$1
+.
+. shift
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Oo user macro
+.\" NS option open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Oo' set in doc-common
+.
.de Oo
-.if \\n(aC==0 .ds mN Oo
-.ds qL \&[
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Oc macro - Option close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Oo
+.
+. ds doc-quote-left [
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Oc user macro
+.\" NS option close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Oc' set in doc-common
+.
.de Oc
-.if \\n(aC==0 .ds mN Oc
-.ds qR \&]
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Po macro - Parenthesis open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Oc
+.
+. ds doc-quote-right ]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Po user macro
+.\" NS parenthesis open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Po' set in doc-common
+.
.de Po
-.if \\n(aC==0 .ds mN Po
-.ds qL \&(
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Pc macro - Parenthesis close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Po
+.
+. ds doc-quote-left "\*[doc-left-parenthesis]
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Pc user macro
+.\" NS parenthesis close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Pc' set in doc-common
+.
.de Pc
-.if \\n(aC==0 .ds mN Pc
-.ds qR \&)
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Qo macro - Straight Double Quote open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Pc
+.
+. ds doc-quote-right "\*[doc-right-parenthesis]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Qo user macro
+.\" NS straight double quote open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Qo' set in doc-common
+.
.de Qo
-.if \\n(aC==0 .ds mN Qo
-.ds qL \&\\*q
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Qc macro - Straight Double Quote close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Qo
+.
+. ds doc-quote-left "\*[q]
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Qc user macro
+.\" NS straight double quote close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Qc' set in doc-common
+.
.de Qc
-.if \\n(aC==0 .ds mN Qc
-.ds qR \&\\*q
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS So macro - Single Quote open
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Qc
+.
+. ds doc-quote-right "\*[q]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS So user macro
+.\" NS single quote open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `So' set in doc-common
+.
.de So
-.if \\n(aC==0 .ds mN So
-.ds qL \&\\*(sL
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Sc macro - Single Quote close
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name So
+.
+. ds doc-quote-left "\*[doc-left-singlequote]
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Sc user macro
+.\" NS single quote close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Sc' set in doc-common
+.
.de Sc
-.if \\n(aC==0 .ds mN Sc
-.ds qR \&\\*(sR
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Xo macro - Extend open (continue)
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Sc
+.
+. ds doc-quote-right "\*[doc-right-singlequote]
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS Xo user macro
+.\" NS extend open
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Xo' set in doc-common
+.
.de Xo
-.if \\n(aC==0 .ds mN Xo
-.\" .nr mN 1
-.ds qL
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Xe macro - Extend close (end)
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Xo
+.
+. ds doc-quote-left
+.
+. doc-enclose-open \$@
+..
+.
+.
+.\" NS Xc user macro
+.\" NS extend close
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS doc-quote-right
+.\" NS
+.\" NS width register `Xc' set in doc-common
+.
.de Xc
-.\" .nr mN 0
-.if \\n(aC==0 .ds mN Xc
-.ds qR
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS eO macro - enclose string open
-.\" NS oM register (extension possible)
-.de eO
-.nr oM \\n(oM+1
-.\" .tm eO last arg==A[\\n(aC]==\\*(A\\n(aC; aP==\\n(aP; oM==\\n(oM; dZ==\\n(dZ;
-.ie \\n(aC==0 \{\
-. ie \\n(.$>0 \{\
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. as b1 \\*(qL
-. \}
-. el \{\
-. as b1 \\*(qL
-. if (\\n(dZ==0)&(\\n(sM==1) \{\
-. nr dZ \\n(dZ+1
-. ds b2 \\*(b1
-. ds b1
-. nr lK \\n(.c
-. ev 2
-. fi
-. di eB
-. \}
-. \}
-.\}
-.el \{\
-. as b1 \\*(qL
-.\}
-.ie \\n(aC>0 \{\
-. if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 .\\*(A\\n(aP
-. el \{\
-. nr aP \\n(aP-1
-. No
-. \}
-. \}
-. if \\n(aC==\\n(aP \{\
-. if \\n(tP==1 \{\
-.\" .tm SETTING Xt!!!
-. nr Xt 1
-. \}
-.\".\" . ds S0
-.\"CHANGED ds S0 \\*(iV
-. aY
-. \}
-.\}
-.el \{\
-. if \\n(oM>1 .as b1 \\*(sV
-.\}
-..
-.\"
-.\" NS eC macro - enclose string close
-.\" NS aa local register
-.de eC
-.nr oM \\n(oM-1
-.\" tm eC last arg==A[\\n(aC]==\\*(A\\n(aC; aP==\\n(aP; oM==\\n(oM; dZ==\\n(dZ;
-.as b1 \\*(qR
-.if \\n(aC==0 \{\
-. ie \\n(.$>0 \{\
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-. el \{\
-. ie "\\*(xB"" \{\
-. pB
-. \}
-. el \{\
-. pB
-.\\*(L\\n(lC
-. nr Xt 0
-. ds xB
-. \}
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie \\n(aC==\\n(aP \{\
-. ie \\n(oM==0 \{\
-. aZ
-. \}
-. el .aY
-. \}
-. el \{\
-. nr aa \\n(aP+1
-. if \\n(C\\n(aa==2 .as b1 \\*(S\\n(aC
-.\" tm CURRENT arg (aP==\\*(A\\n(aP and ap+1==\\*(A\\n(aa) tP==\\n(tP Xt==\\n(Xt
-. rr aa
-. if \\n(tP>0 \{\
-.\" tm UNSETTING Xt==\\n(Xt!!!!
-. if \\n(Xt>0 .nr Xt \\n(Xt-1
-.\" tm NOW Xt==\\n(Xt!!!!
-. \}
-. No
-. \}
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" NS Pf macro - Prefix (calls .pF)
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Xc
+.
+. ds doc-quote-right
+.
+. doc-enclose-close \$@
+..
+.
+.
+.\" NS doc-nesting-level global register
+.\" NS used by `doc-enclose-open' and `doc-enclose-close'
+.
+.nr doc-nesting-level 0
+.
+.
+.\" NS doc-in-list global register (bool)
+.\" NS whether we are in (logical) .It
+.
+.nr doc-in-list 0
+.
+.
+.\" NS doc-enclose-open macro
+.\" NS enclose string open
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-nesting-level
+.
+.de doc-enclose-open
+. if !\n[doc-arg-limit] \
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. nr doc-arg-ptr -1
+.
+. nop \)\*[doc-quote-left]\)\c
+.
+. \" start enclosure box
+. box doc-enclosure-box\n[doc-nesting-level]
+. ev doc-enclosure-env\n[doc-nesting-level]
+. evc 0
+. in 0
+. nf
+. \" we insert something to make .chop always work
+. nop \&\c
+.
+. \" increase nesting level *after* parsing of arguments
+. nr doc-nesting-level +1
+.
+. if \n[doc-arg-limit] \{\
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
+. doc-print-recursive
+. el \
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS doc-enclose-close macro
+.\" NS enclose string close
+.\" NS
+.\" NS modifies:
+.\" NS doc-nesting-level
+.
+.de doc-enclose-close
+. nr doc-nesting-level -1
+.
+. \" finish enclosure box
+. br
+. ev
+. box
+. chop doc-enclosure-box\n[doc-nesting-level]
+. unformat doc-enclosure-box\n[doc-nesting-level]
+.
+. nh
+. nop \*[doc-enclosure-box\n[doc-nesting-level]]\c
+. nop \)\*[doc-quote-right]\)\c
+.
+. if !\n[doc-arg-limit] \{\
+. doc-parse-args \$@
+.
+. if !\n[.$] \
+. doc-print-and-reset
+. \}
+.
+. if \n[doc-arg-limit] \{\
+. ie (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\
+. nop \)\*[doc-space\n[doc-arg-ptr]]\c
+. nr doc-arg-ptr +1
+. doc-print-recursive
+. \}
+. el \
+. doc-print-and-reset
+. \}
+.
+. \" shall we finish .It request?
+. if !"\*[doc-macro-name]"It" \
+. if \n[doc-in-list] \
+. if !\n[doc-nesting-level] \
+. doc-\*[doc-list-type-stack\n[doc-list-depth]]
+..
+.
+.
+.\" NS Pf user macro
+.\" NS prefix: `.Pf prefix arg ...'
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-macro-name
+.\" NS doc-quote-left
+.\" NS
+.\" NS width register `Pf' set in doc-common
+.
.de Pf
-.if \\n(aC==0 .ds mN Pf
-.ds qL \&\\$1
-.pF \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS pF macro - Prefix (for prefixing open quotes, brackets etc)
-.de pF
-.ie \\n(aC==0 \{\
-. as b1 \&\\*(qL
-. ie \\n(.$<2 \{\
-. tm Warning: Missing arguments - prefix .Pf)
-. pB
-. \}
-. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.el \{\
-. ie (\\n(aC-\\n(aP)>1 \{\
-. nr aP \\n(aP+1
-. as b1 \&\\*(A\\n(aP
-. \}
-. el .tm Warning: .Pf: trailing prefix (#\\n(.c)
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 .aZ
-. el \{\
-. nr aP \\n(aP+1
-. c\\n(C\\n(aP
-. \}
-.\}
-..
-.\" NS Ns macro - remove space (space remove done by .aV or .fV)
+. if !\n[doc-arg-limit] \
+. ds doc-macro-name Pf
+.
+. ie \n[doc-arg-limit] \{\
+. ie ((\n[doc-arg-limit] - \n[doc-arg-ptr]) > 1) \{\
+. nr doc-arg-ptr +1
+. nop \)\*[doc-arg\n[doc-arg-ptr]]\c
+. \}
+. el \
+. tm mdoc warning: .Pf: trailing prefix (#\n[.c])
+. \}
+. el \{\
+. nop \)\$1\)\c
+. shift
+. ie \n[.$] \
+. doc-parse-args \$@
+. el \{\
+. tm mdoc warning: .Pf: missing arguments (#\n[.c])
+. nop \)
+. \}\}
+.
+. if \n[doc-arg-limit] \{\
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \
+. doc-print-and-reset
+. el \
+. doc-do-\n[doc-type\n[doc-arg-ptr]]
+. \}
+..
+.
+.
+.\" NS Ns user macro
+.\" NS remove space (space removal done by `doc-parse-args')
+.\" NS
+.\" NS modifies:
+.\" NS doc-argXXX
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Ns' set in doc-common
+.
.de Ns
-.if \\n(aC==0 \{\
-. ds mN Ns
-. ie \\n(.$>0 .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el .tm Usage: .Ns must be called with arguments (#\\n(.c)
-.\}
-.No
-..
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Ns
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Ns must be called with arguments (#\n[.c])
+. \}
+.
+. if \n[doc-arg-limit] \{\
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
+. doc-print-recursive
+. el \
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS Ap user macro
+.\" NS append an apostrophe
+.\" NS
+.\" NS width register `Ap' set in doc-common
+.
.de Ap
-.if \\n(aC==0 \{\
-. ds mN Ap
-. tm Usage: Ap "cannot be first request on a line (no .Ap)" (#\\n(.c)
-.\}
-.as b1 \&'
-.No
-..
-.\" NS Hv macro - Hard (unpaddable) Space vector
-.\" NS iV string inter-vector space
-.\" NS sV string inter-argument space
-.de Hv
-.ds iV \\*(sV
-.ds sV \\*(hV
-..
-.\" NS Sv macro - Soft Space vector (troff limitation)
-.de Sv
-.ds sV \\*(iV
-..
-.\" NS Tv macro - Tab Space vector
-.de Tv
-.ds sV \\*(tV
-..
-.\" NS Sm macro - Space mode
-.\" NS sM register - default is one (space mode on)
-.nr sM 1
+. ie !\n[doc-arg-limit] \
+. tm Usage: `Ap' cannot be first request on a line (no `.Ap') (#\n[.c])
+. el \{\
+. nop \)'\)\c
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
+. doc-print-recursive
+. el \
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS doc-space global string
+.\" NS current inter-argument space
+.
+.ds doc-space "\*[doc-soft-space]
+.
+.
+.\" NS doc-soft-space constant string
+.\" NS soft (stretchable) space (defined in doc-common)
+.
+.
+.\" NS doc-hard-space constant string
+.\" NS hard (unpaddable) space (defined in doc-common)
+.
+.
+.\" NS doc-set-hard-space macro
+.\" NS set current space string to hard (unpaddable) space.
+.\" NS
+.\" NS modifies:
+.\" NS doc-saved-space
+.\" NS doc-space
+.
+.de doc-set-hard-space
+. ie "\*[doc-space]"" \
+. ds doc-saved-space "\*[doc-hard-space]
+. el \
+. ds doc-space "\*[doc-hard-space]
+..
+.
+.
+.\" NS doc-set-soft-space macro
+.\" NS set current space string to soft space
+.\" NS
+.\" NS modifies:
+.\" NS doc-saved-space
+.\" NS doc-space
+.
+.de doc-set-soft-space
+. ie "\*[doc-space]"" \
+. ds doc-saved-space "\*[doc-soft-space]
+. el \
+. ds doc-space "\*[doc-soft-space]
+..
+.
+.
+.\" NS doc-space-mode global register (bool)
+.\" NS default is one (space mode on)
+.
+.nr doc-space-mode 1
+.
+.
+.\" NS doc-saved-space global string
+.\" NS saved value of `doc-space'
+.
+.ds doc-saved-space "\*[doc-space]
+.
+.
+.\" NS doc-have-space global register (bool)
+.\" NS set if last command was horizontal space
+.
+.nr doc-have-space 0
+.
+.
+.\" NS Sm user macro
+.\" NS space mode (`.Sm'/`.Sm on'/`.Sm off')
+.\" NS
+.\" NS without argument, toggle space mode
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-limit
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-macro-name
+.\" NS doc-num-args
+.\" NS doc-saved-space
+.\" NS doc-space
+.\" NS doc-space-mode
+.\" NS doc-spaceXXX
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-Sm
+.\" NS
+.\" NS width register `Sm' set in doc-common
+.
.de Sm
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm "Usage: .Sm [off | on]" (#\\n(.c)
-. el \{\
-. ds mN Sm
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>0 \{\
-. nr aP \\n(aP+1
-. if "\\*(A\\n(aP"on" \{\
-. ds sV \\*(iV
-. nr sM 1
-. \}
-. if "\\*(A\\n(aP"off" \{\
-. ds sV
-. rm S0 S1 S2 S3 S4 S5 S6 S7 S8 S9
-. nr sM 0
-. \}
-. ie \\n(aC>\\n(aP \{\
-. No
-. \}
-. el .aY
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" Size and Argument type macros
-.\" NS aT macro - argument type
-.\" NS aU macro - argument type (same as .aT but uses A[1-9] strings
-.\" NS aT register argument type
-.if \n(.g \{\
-.de aT
-.nr aT 0
-.ie \\n(sW>2:(\A'\\$1'==0) \{\
-. nr aT 2
-.\}
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\$1>2 \{\
-. nr aT \\n(z\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie \\n(\\$1 \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.de aU
-.nr aT 0
-.aW \\$1
-.ie \\n(sW>2:(\A'\\*(A\\$1'==0) .nr aT 2
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\*(A\\$1>2 \{\
-. nr aT \\n(z\\*(A\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie (\\n(\\*(A\\$1) \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.\}
-.if !\n(.g \{\
-.de aT
-.nr aT 0
-.ie \\n(sW>2 \{\
-. nr aT 2
-.\}
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\$1>2 \{\
-. nr aT \\n(z\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie \\n(\\$1 \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.de aU
-.nr aT 0
-.aW \\$1
-.ie \\n(sW>2 .nr aT 2
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\*(A\\$1>2 \{\
-. nr aT \\n(z\\*(A\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie (\\n(\\*(A\\$1) \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.\}
-.\" NS s1 macro - set spacing for class type 1
-.\" NS s2 macro - set spacing for class type 2
-.\" NS s3 macro - set spacing for class type 3
-.\" NS s1 macro - set spacing for class type 1
-.\" NS s2 macro - set spacing for class type 2
-.\" NS s3 macro - set spacing for class type 3
-.\" NS s4 macro - set spacing for class type 4
-.\" NS S[0-9] string spacing
-.\" NS xX local register
-.\" NS aa local register
-.de s0
-.tm MDOC-ERROR: bogus type 0 (can't set space '\\*(A\\n(aC') (#\\n(.c)
-..
-.de s1
-.if \\n(\\*(A\\n(aC==3 \{\
-. nr xX \\n(aC-1
-. rm S\\n(xX
-. ds S\\n(aC \\*(sV
-.\}
-.if \\n(\\*(A\\n(aC==2 \{\
-. nr xX \\n(aC-1
-.\" this kludge can probably go away, but need to double check first
-. ie "\\*(A\\n(aC"Nb" .ds S\\n(xX \\*(hV
-. el .rm S\\n(xX
-.\}
-..
-.de s2
-.ds S\\n(aC \\*(sV
-..
-.de s3
-.if \\n(aC>1 \{\
-. nr xX \\n(aC-1
-. rm S\\n(xX
-.\}
-.ds S\\n(aC \\*(sV
-..
-.de s4
-.nr aa 0
-..
-.\" Class switches (on current argument aP)
-.\" NS c0 macro - catch errors (non-existent class type 0)
-.\" NS c1 macro - call request if type 1
-.\" NS c2 macro - call .No if type 2
-.\" NS c3 macro - call .No if type 3
-.\" NS c4 macro - call .No if type 4
-.de c0
-.tm MDOC-ERROR: bogus class 0 (can't determine '\\*(A\\n(aC') (#\\n(.c)
-..
-.de c1
-.\\*(A\\n(aP
-..
-.de c2
-.nr aP \\n(aP-1
-.No
-..
-.de c3
-.nr aP \\n(aP-1
-.No
-..
-.de c4
-.nr aP \\n(aP-1
-.No
-..
-.\" NS y1 macro - ignore if class 1
-.\" NS y2 macro - ignore if class 2
-.\" NS y3 macro - append if type 3
-.\" NS y4 macro - append if type 4
-.de y1
-.nr aa 1
-..
-.de y2
-.nr aa 1
-..
-.de y3
-.as b1 \\*(A\\n(aP
-.nr aP \\n(aP+1
-.n\\C\\n(aP
-..
-.de y4
-.as b1 \\*(A\\n(aP
-.nr aP \\n(aP+1
-.n\\C\\n(aP
-..
-.\"--------------------------------------------------------------------------
-.\" Ns Bf macro - Begin Font Mode (will be begin-mode/end-mode in groff & TeX)
-.\" Ns Ef macro - End Font Mode
+. ie \n[doc-have-space] \
+. nr doc-reg-Sm 0
+. el \
+. nr doc-reg-Sm 1
+.
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Sm
+. doc-parse-args \$@
+. \}
+. el \{\
+. ie \n[doc-space-mode] \
+. nr doc-space-mode 0
+. el \
+. nr doc-space-mode 1
+. \}\}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+.
+. \" avoid a warning message in case `Sm' is the last parameter
+. if !d doc-arg\n[doc-arg-ptr] \
+. ds doc-arg\n[doc-arg-ptr]
+.
+. ie "\*[doc-arg\n[doc-arg-ptr]]"on" \{\
+. ds doc-space "\*[doc-saved-space]
+. nr doc-space-mode 1
+. \}
+. el \{\
+. ie "\*[doc-arg\n[doc-arg-ptr]]"off" \{\
+. ds doc-saved-space "\*[doc-space]
+. ds doc-space
+. nr doc-space-mode 0
+. \}
+. el \{\
+. \" no argument for Sm
+. nr doc-arg-ptr -1
+. ie \n[doc-space-mode] \
+. nr doc-space-mode 0
+. el \
+. nr doc-space-mode 1
+. \}\}
+.
+. ie \n[doc-space-mode] \{\
+. \" recompute space vector for remaining arguments
+. nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
+. nr doc-arg-limit \n[doc-arg-ptr]
+. if \n[doc-num-args] \
+. doc-parse-space-vector
+.
+. \" finish line only if it is interrupted and `doc-have-space'
+. \" isn't set
+. if \n[doc-reg-Sm] \
+. if \n[.int] \
+. nop \)
+. \}
+. el \{\
+. \" reset remaining space vector elements
+. nr doc-reg-Sm (\n[doc-arg-ptr] + 1)
+. while (\n[doc-reg-Sm] <= \n[doc-arg-limit]) \{\
+. ds doc-space\n[doc-reg-Sm]
+. nr doc-reg-Sm +1
+. \" the body of a `while' request must end with the fitting `\}'!
+. \}
+. \}
+.
+. \" do we have parameters to print?
+. ie (\n[doc-arg-limit] <= \n[doc-arg-ptr]) \{\
+. \" ignore `.Sm on' and `.Sm off' without additional parameters
+. ie (\n[doc-arg-ptr] > 1) \
+. doc-print-and-reset
+. el \
+. doc-reset-args
+. \}
+. el \{\
+. \" skip `Sm' argument
+. nr doc-arg-ptr +1
+. doc-print-recursive
+. \}
+..
+.
+.
+.\" NS doc-arg-type immediate register
+.\" NS argument type (macro=1, string=2, punctuation suffix=3,
+.\" NS punctuation prefix=4)
+.
+.nr doc-arg-type 0
+.
+.
+.\" NS doc-get-arg-type macro
+.\" NS get argument type
+.\" NS
+.\" NS this macro expects the width of the argument in `doc-width'
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-type
+.
+.de doc-get-arg-type
+. nr doc-arg-type 2
+.
+. if ((\n[doc-width] < 4) & \A\$1) \{\
+. ie (\n[doc-width] == 1) \{\
+. if r doc-punct\$1 \
+. nr doc-arg-type \n[doc-punct\$1]
+. \}
+. el \
+. if r \$1 \
+. if d \$1 \
+. nr doc-arg-type 1
+. \}
+..
+.
+.
+.\" NS doc-get-arg-type* macro
+.\" NS similar to as `doc-get-arg-type' but uses doc-argXXX strings
+.\" NS
+.\" NS this macro sets the `doc-width' register using the `length' request
+.\" NS to get the number of characters in a string literally
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-type
+.\" NS doc-width
+.
+.de doc-get-arg-type*
+. nr doc-arg-type 2
+. length doc-width "\*[doc-arg\$1]
+.
+. if ((\n[doc-width] < 4) & \A\*[doc-arg\$1]) \{\
+. ie (\n[doc-width] == 1) \{\
+. if r doc-punct\*[doc-arg\$1] \
+. nr doc-arg-type \n[doc-punct\*[doc-arg\$1]]
+. \}
+. el \
+. if r \*[doc-arg\$1] \
+. if d \*[doc-arg\$1] \
+. nr doc-arg-type 1
+. \}
+..
+.
+.
+.\" NS doc-set-spacing-1 macro
+.\" NS set spacing for macros
+.\" NS
+.\" NS modifies:
+.\" NS doc-spaceXXX
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dssfm
+.\" NS doc-reg-dssfm1
+.
+.de doc-set-spacing-1
+. nr doc-reg-dssfm1 \n[\*[doc-arg\n[doc-arg-limit]]]
+.
+. \" closing macros like .Ac, Bc., etc. have value 3 (remove space before
+. \" argument)
+. ie (\n[doc-reg-dssfm1] == 3) \{\
+. if \n[doc-arg-limit] \{\
+. nr doc-reg-dssfm (\n[doc-arg-limit] - 1)
+. ds doc-space\n[doc-reg-dssfm]
+. \}
+. ds doc-space\n[doc-arg-limit] "\*[doc-space]
+. \}
+. el \{\
+. \" macros like .Ap and .Ns have value 2 (remove space before and after
+. \" argument)
+. ie (\n[doc-reg-dssfm1] == 2) \{\
+. if \n[doc-arg-limit] \{\
+. nr doc-reg-dssfm (\n[doc-arg-limit] - 1)
+. ds doc-space\n[doc-reg-dssfm]
+. \}
+. ds doc-space\n[doc-arg-limit]
+. \}
+. el \
+. ds doc-space\n[doc-arg-limit]
+. \}
+..
+.
+.
+.\" NS doc-set-spacing-2 macro
+.\" NS set spacing for strings
+.\" NS
+.\" NS modifies:
+.\" NS doc-spaceXXX
+.
+.de doc-set-spacing-2
+. ds doc-space\n[doc-arg-limit] "\*[doc-space]
+..
+.
+.
+.\" NS doc-set-spacing-3 macro
+.\" NS set spacing for punctuation suffixes
+.\" NS
+.\" NS modifies:
+.\" NS doc-spaceXXX
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dssfps
+.
+.de doc-set-spacing-3
+. if \n[doc-arg-limit] \{\
+. nr doc-reg-dssfps (\n[doc-arg-limit] - 1)
+. ds doc-space\n[doc-reg-dssfps]
+. \}
+.
+. ds doc-space\n[doc-arg-limit] "\*[doc-space]
+..
+.
+.
+.\" NS doc-set-spacing-4 macro
+.\" NS set spacing for punctuation prefixes
+.\" NS
+.\" NS modifies:
+.\" NS doc-spaceXXX
+.
+.de doc-set-spacing-4
+. ds doc-space\n[doc-arg-limit]
+..
+.
+.
+.\" type switches (on current argument doc-arg-ptr)
+.
+.
+.\" NS doc-do-1 macro
+.\" NS call request if macro
+.
+.de doc-do-1
+. \*[doc-arg\n[doc-arg-ptr]]
+..
+.
+.
+.\" NS doc-do-2 macro
+.\" NS call .doc-print-recursive if string
+.
+.als doc-do-2 doc-print-recursive
+.
+.
+.\" NS doc-do-3 macro
+.\" NS call .doc-print-recursive if punctuation suffix
+.
+.als doc-do-3 doc-print-recursive
+.
+.
+.\" NS doc-do-4 macro
+.\" NS call .doc-print-recursive if punctuation prefix
+.
+.als doc-do-4 doc-print-recursive
+.
+.
+.\" NS doc-fontmode-depth global register
+.\" NS font mode level
+.
+.nr doc-fontmode-depth 0
+.
+.
+.\" NS doc-fontmode-font-stackXXX global register
+.\" NS stack of saved current font values from `Bf' request
+.\" NS
+.\" NS limit:
+.\" NS doc-fontmode-depth
+.
+.nr doc-fontmode-font-stack0 0
+.
+.
+.\" NS doc-fontmode-size-stackXXX global register
+.\" NS stack of saved current size values from `Bf' request
+.\" NS
+.\" NS limit:
+.\" NS doc-fontmode-depth
+.
+.nr doc-fontmode-size-stack0 0
+.
+.
+.\" NS Bf user macro
+.\" NS begin font mode (will be begin-mode/end-mode in groff & TeX)
+.\" NS
+.\" NS modifies:
+.\" NS doc-fontmode-depth
+.\" NS doc-fontmode-font-stackXXX
+.\" NS doc-fontmode-size-stackXXX
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Bf' set in doc-common
+.
.de Bf
-.ds mN Bf
-.ie \\n(.$>0 \{\
-. nr bF \\n(.f
-. nr bZ \\n(.s
-. if "\\$1"Em" \&\\*(eM\c
-. if "\\$1"Li" \&\\*(lI\c
-. if "\\$1"Sy" \&\\*(sY\c
-. if "\\$1"-emphasis" \&\\*(eM\c
-. if "\\$1"-literal" \&\\*(lI\c
-. if "\\$1"-symbolic" \&\\*(sY\c
-.\}
-.el .tm Usage .Bf [Em | -emphasis | Li | -literal | Sy | -symbolic] (#\\n(.c)
-..
+. ds doc-macro-name Bf
+.
+. ie \n[.$] \{\
+. nr doc-fontmode-depth +1
+.
+. \" save current font and size
+. nr doc-fontmode-font-stack\n[doc-fontmode-depth] \n[.f]
+. nr doc-fontmode-size-stack\n[doc-fontmode-depth] \n[.ps]
+.
+. ie "\$1"Em" \
+. nop \*[doc-Em-font]\c
+. el \{ .ie "\$1"Li" \
+. nop \*[doc-Li-font]\c
+. el \{ .ie "\$1"Sy" \
+. nop \*[doc-Sy-font]\c
+. el \{ .ie "\$1"-emphasis" \
+. nop \*[doc-Em-font]\c
+. el \{ .ie "\$1"-literal" \
+. nop \*[doc-Li-font]\c
+. el \{ .ie "\$1"-symbolic" \
+. nop \*[doc-Sy-font]\c
+. el \{\
+. tmc mdoc warning: Unknown keyword `\$1' in .Bf request
+. tm1 " (#\n[.c])
+. \}\}\}\}\}\}\}
+. el \
+. tm Usage: .Bf [Em | -emphasis | Li | -literal | Sy | -symbolic] (#\n[.c])
+..
+.
+.
+.\" NS Ef user macro
+.\" NS end font mode
+.\" NS
+.\" NS modifies:
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Ef' set in doc-common
+.
.de Ef
-.ds mN Ef
-.ie \\n(.$>0 .tm Usage .Ef (does not take arguments) (#\\n(.c)
-.el \&\f\\n(bF\s\\n(bZ
-..
-.\" Ns Bk macro - Begin Keep
-.\" Ns Ek macro - End Keep
-.\" Ns kS string - keep type
+. ds doc-macro-name Ef
+.
+. ie \n[doc-fontmode-depth] \{\
+. \" restore saved font and size
+. nop \)\f[\n[doc-fontmode-font-stack\n[doc-fontmode-depth]]]\c
+. nop \)\s[\n[doc-fontmode-size-stack\n[doc-fontmode-depth]]u]\c
+.
+. nr doc-fontmode-font-stack\n[doc-fontmode-depth] 0
+. nr doc-fontmode-size-stack\n[doc-fontmode-depth] 0
+. nr doc-fontmode-depth -1
+. \}
+. el \
+. tm mdoc warning: Extraneous .Ef (#\n[.c])
+..
+.
+.
+.\" NS doc-keep-type global register
+.\" NS current keep type; 1 is `-words', 2 is `-lines', 3 is unknown
+.
+.nr doc-keep-type 0
+.
+.
+.\" NS Bk user macro
+.\" NS begin keep
+.\" NS
+.\" NS modifies:
+.\" NS doc-keep-type
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Bk' set in doc-common
+.
.de Bk
-.ds mN Bk
-.ie \\n(.$==0 \{\
-.tm Usage: .Bk [-lines | -words] (#\\n(.c)
-.\}
-.el \{\
-. if !"\\*(kS"" .tm .Bk: nesting keeps not implemented yet. (#\\n(.c)
-. if "\\$1"-lines" .tm .Bd -lines: Not implemented yet. (#\\n(.c)
-. if "\\$1"-words" .Hv
-. ds kS \\$1
-.\}
-..
+. ds doc-macro-name Bk
+.
+. if \n[doc-keep-type] \
+. tm .Bk: nesting keeps not implemented yet. (#\n[.c])
+.
+. ie "\$1"-lines" \{\
+. nr doc-keep-type 2
+. tm .Bk -lines: Not implemented yet. (#\n[.c])
+. \}
+. el \{ .ie "\$1"-words" \{\
+. nr doc-keep-type 1
+. doc-set-hard-space
+. \}
+. el \{ .ie "\$1"" \{\
+. \" default
+. nr doc-keep-type 1
+. doc-set-hard-space
+. \}
+. el \{\
+. tm mdoc warning: Unknown keyword `\$1' in .Bk request (#\n[.c])
+. nr doc-keep-type 3
+. \}\}\}
+.
+\#. nr doc-nesting-level +1
+..
+.
+.
+.\" NS Ek user macro
+.\" NS end keep
+.\" NS
+.\" NS modifies:
+.\" NS doc-keep-type
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Ek' set in doc-common
+.
.de Ek
-.ds mN Ek
-.ie \\n(.$>0 .tm Usage .Ek (does not take arguments) (#\\n(.c)
-.el \{\
-. if "\\*(kS"-lines" .tm .Bd -lines: Not implemented yet. (#\\n(.c)
-. if "\\*(kS"-words" .Sv
-. rm kS
-.\}
-..
-.\" NS Bd macro - Begin Display display-type [offset string]
-.\" NS Ed macro - end Display
-.\" NS O[0-9] registers - stack of indent
-.\" NS d[0-9] registers - display-type stack
+. ds doc-macro-name Ek
+.
+\#. nr doc-nesting-level -1
+.
+. ie \n[.$] \
+. tm Usage: .Ek (does not take arguments) (#\n[.c])
+. el \{\
+. if !\n[doc-keep-type] \
+. tm mdoc warning: .Ek found without .Bk before (#\n[.c])
+.
+. ie (\n[doc-keep-type] == 1) \
+. doc-set-soft-space
+. el \{ .if (\n[doc-keep-type] == 2) \
+. tm .Bk -lines: Not implemented yet. (#\n[.c])
+. \}\}
+.
+. nr doc-keep-type 0
+.
+\#. if !"\*[doc-out-string]"" \
+\#. doc-print-out-string
+..
+.
+.
+.\" NS doc-display-depth global register
+.\" NS display level
+.
+.nr doc-display-depth 0
+.
+.
+.\" NS doc-is-compact global register (bool)
+.\" NS set if the `compact' keyword is given
+.
+.nr doc-is-compact 0
+.
+.
+.\" NS doc-display-type-stackXXX global string
+.\" NS the display type stack
+.\" NS
+.\" NS limit:
+.\" NS doc-display-depth
+.
+.ds doc-display-type-stack0
+.
+.
+.\" NS doc-display-indent-stackXXX global register
+.\" NS stack of display indentation values
+.\" NS
+.\" NS limit:
+.\" NS doc-display-depth
+.
+.nr doc-display-indent-stack0 0
+.
+.
+.\" NS doc-display-ad-stackXXX global register
+.\" NS stack of saved adjustment modes
+.\" NS
+.\" NS limit:
+.\" NS doc-display-depth
+.
+.nr doc-display-ad-stack0 0
+.
+.
+.\" NS doc-display-fi-stackXXX global register
+.\" NS stack of saved fill modes
+.\" NS
+.\" NS limit:
+.\" NS doc-display-depth
+.
+.nr doc-display-fi-stack0 0
+.
+.
+.\" NS Bd user macro
+.\" NS begin display
+.\" NS
+.\" NS width register `Bd' set in doc-common
+.\" NS
+.\" NS modifies:
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-display-depth
+.\" NS doc-display-ad-stackXXX
+.\" NS doc-display-fi-stackXXX
+.\" NS doc-display-file
+.\" NS doc-display-indent-stackXXX
+.\" NS doc-display-type-stackXXX
+.\" NS doc-is-compact
+.\" NS doc-macro-name
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-Bd
+.
.de Bd
-.ds mN Bd
-.ie \\n(.$==0 \{\
-.tm Usage: .Bd [-literal | -filled | -ragged | -unfilled] [-offset [string]] [-compact] (#\\n(.c)
-.\}
-.el \{\
-. ds aa
-. nr bV 0
-. nr iD 0
-. nr dP \\n(dP+1
-. if "\\$1"-literal" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dL
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie t \{\&\\*(lI
-' ta 9n 18n 27n 36n 45n 54n 63n 72n
-. \}
-. el \{\
-' ta 8n 16n 24n 32n 40n 48n 56n 64n 72n
-. \}
-. nf
-. \}
-. if "\\$1"-filled" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dF
-. br
-. \}
-. if "\\$1"-ragged" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dR
-. na
-. \}
-. if "\\$1"-unfilled" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dU
-. nf
-. \}
-.\" .tm Here is argc: \\n(.$ and here is iD \\n(iD
-. if ((\\n(iD>=1)&(\\n(.$>\\n(iD)) \{\
-. bV \\$2 \\$3 \\$4
-. \}
-. if \\n(O\\n(dP>0 'in \\n(.iu+\\n(O\\n(dPu
-. if (\\n(bV==0) \{\
-. if (\\n(nS==0) \{\
-. ie "\\*(d\\n(dP"dR" .sp \\n(dVu
-. el 'sp \\n(dVu
-. \}
-. \}
-. if \\n(cR==0 .ne 2v
-. nr bV 0
-. nr iD 0
-.\}
-..
-.\" NS bV macro - resolve remaining .Bd arguments
-.de bV
-.\" .tm in bV with args: \\$1 \\$2 \\$3
-.nr iD 1
-.ds bY
-.if "\\$1"-offset" \{\
-. ds bY \\$2
-. if "\\*(bY"left" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP 0
-. \}
-. if "\\*(bY"right" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP (\\n(.l/3)u
-. \}
-. if "\\*(bY"center" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP (\\n(.l-\\n(.i)/4u
-. \}
-. if "\\*(bY"indent" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP \\n(dIu
-. \}
-. if "\\*(bY"indent-two" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP \\n(dIu+\\n(dIu
-. \}
-. if \\n(iD==1 \{\
-. nr iD \\n(iD+1
-. sW "\\*(bY"
-. ie \\n(sW>2 \{\
-. ie ((\\*(bY>9n)&(\\*(bY<100n)) \{\
-. nr O\\n(dP \\*(bY
-. \}
-. el .nr O\\n(dP (\\n(sW)*\\n(fWu
-. \}
-. el \{\
-. if \\n(sW==2 .aT \\*(bY
-. ie \\n(aT==1 \{\
-. nr O\\n(dP \\n(\\*(bY
-. \}
-. el .nr O\\n(dP \\*(bY
-. \}
-. \}
-.\}
-.if "\\$1"-compact" \{\
-. nr bV 1
-.\}
-.if \\n(iD<\\n(.$ \{\
-. ie "\\*(bY"" \{\
-. bV \\$2 \\$3
-. \}
-. el \{\
-. bV \\$3
-. \}
-.\}
-..
-.\" NS Ed macro - end display
+. ds doc-macro-name Bd
+.
+. if !\n[.$] \{\
+. tm1 "Usage: .Bd {-literal | -filled | -ragged | -centered | -unfilled}
+. tm1 " [-offset [string]] [-compact] [-file name] (#\n[.c])
+. return
+. \}
+.
+. nr doc-is-compact 0
+. ds doc-display-file
+. nr doc-reg-Bd 1
+. nr doc-display-depth +1
+.
+. \" save current adjustment and fill modes
+. nr doc-display-ad-stack\n[doc-display-depth] \n[.j]
+. nr doc-display-fi-stack\n[doc-display-depth] \n[.u]
+.
+. ie "\$1"-literal" \{\
+. ds doc-display-type-stack\n[doc-display-depth] literal
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. ie t \{\
+. nop \*[doc-Li-font]\c
+' ta T 9n
+. \}
+. el \
+' ta T 8n
+. nf
+. \}
+. el \{ .ie "\$1"-filled" \{\
+. ds doc-display-type-stack\n[doc-display-depth] filled
+. ad b
+. fi
+. \}
+. el \{ .ie "\$1"-ragged" \{\
+. ds doc-display-type-stack\n[doc-display-depth] ragged
+. na
+. fi
+. \}
+. el \{ .ie "\$1"-centered" \{\
+. ds doc-display-type-stack\n[doc-display-depth] centered
+. ad c
+. fi
+. \}
+. el \{ .ie "\$1"-unfilled" \{\
+. ds doc-display-type-stack\n[doc-display-depth] unfilled
+. nf
+. \}
+. el \{\
+. tm1 "mdoc warning: Unknown keyword `\$1' (or missing display type)
+. tm1 " in .Bd request (#\n[.c])
+. nr doc-reg-Bd 0
+. \}\}\}\}\}
+.
+. \" have we seen an argument?
+. if \n[doc-reg-Bd] \{\
+. shift
+. \" check other arguments
+. if \n[.$] \
+. doc-do-Bd-args \$@
+. \}
+.
+. \" avoid warning about non-existent register
+. if !r doc-display-indent-stack\n[doc-display-depth] \
+. nr doc-display-indent-stack\n[doc-display-depth] 0
+.
+. if \n[doc-display-indent-stack\n[doc-display-depth]] \
+' in +\n[doc-display-indent-stack\n[doc-display-depth]]u
+.
+. if !\n[doc-is-compact] \{\
+. if !\n[doc-in-synopsis-count] \{\
+. ie "\*[doc-display-type-stack\n[doc-display-depth]]"ragged" \
+. sp \n[doc-display-vertical]u
+. el \
+' sp \n[doc-display-vertical]u
+. \}\}
+.
+. if !\n[cR] \
+. ne 2v
+.
+. if !"\*[doc-display-file]"" \
+. so \*[doc-display-file]
+.
+. nr doc-is-compact 0
+. ds doc-display-file
+..
+.
+.
+.\" NS doc-do-Bd-args macro
+.\" NS resolve remaining .Bd arguments
+.\" NS
+.\" NS modifies:
+.\" NS doc-display-file
+.\" NS doc-display-indent-stackXXX
+.\" NS doc-is-compact
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-ddBa
+.\" NS doc-reg-ddBa1
+.\" NS doc-reg-ddBa2
+.\" NS doc-reg-ddBa3
+.\" NS doc-reg-ddBa4
+.\" NS doc-str-ddBa
+.
+.de doc-do-Bd-args
+. nr doc-reg-ddBa 1
+.
+. ie "\$1"-offset" \{\
+. nr doc-reg-ddBa 2
+.
+. ie "\$2"left" \
+. nr doc-display-indent-stack\n[doc-display-depth] 0
+. el \{ .ie "\$2"right" \
+. nr doc-display-indent-stack\n[doc-display-depth] (\n[.l]u / 3u)
+. el \{ .ie "\$2"center" \
+. nr doc-display-indent-stack\n[doc-display-depth] ((\n[.l]u - \n[.i]u) / 4u)
+. el \{ .ie "\$2"indent" \
+. nr doc-display-indent-stack\n[doc-display-depth] \n[doc-display-indent]u
+. el \{ .ie "\$2"indent-two" \
+. nr doc-display-indent-stack\n[doc-display-depth] (\n[doc-display-indent]u + \n[doc-display-indent]u)
+. el \
+. nr doc-reg-ddBa 1
+. \}\}\}\}
+.
+. \" not a known keyword
+. if (\n[doc-reg-ddBa] == 1) \{\
+. nr doc-reg-ddBa 2
+.
+. nr doc-reg-ddBa1 0
+. if \B(\$2) \{\
+. \" disable warnings related to scaling indicators (32)
+. nr doc-reg-ddBa2 \n[.warn]
+. warn (\n[.warn] - (\n[.warn] / 32 % 2 * 32))
+.
+. \" values without a scaling indicator are taken as strings;
+. \" we test whether the parameter string with and without the last
+. \" character yields identical numerical results (ignoring the
+. \" scaling indicator)
+. ds doc-str-ddBa "\$2
+. substring doc-str-ddBa 1 -1
+. if \B(\*[doc-str-ddBa]) \{\
+. nr doc-reg-ddBa3 (;(\$2))
+. nr doc-reg-ddBa4 (\*[doc-str-ddBa])
+. if (\n[doc-reg-ddBa3] == \n[doc-reg-ddBa4]) \
+. nr doc-reg-ddBa1 1
+. \}
+.
+. \" enable all warnings again
+. warn \n[doc-reg-ddBa2]
+. \}
+.
+. ie \n[doc-reg-ddBa1] \
+. nr doc-display-indent-stack\n[doc-display-depth] \$2
+. el \{\
+. doc-get-width "\$2"
+. ie (\n[doc-width] <= 3) \{\
+. \" if the offset parameter is a macro, use the macro's
+. \" width as specified in doc-common
+. doc-get-arg-type "\$2"
+. ie (\n[doc-arg-type] == 1) \
+. nr doc-display-indent-stack\n[doc-display-depth] \n[\$2]
+. el \
+. nr doc-display-indent-stack\n[doc-display-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}
+. el \
+. nr doc-display-indent-stack\n[doc-display-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}\}
+. \}
+. el \{ .ie "\$1"-compact" \
+. nr doc-is-compact 1
+. el \{ .ie "\$1"-file" \{\
+. ie !"\$2"" \{\
+. ds doc-display-file "\$2
+. nr doc-reg-ddBa 2
+. \}
+. el \
+. tm mdoc warning: .Bd `-file' keyword requires argument (#\n[.c])
+. \}
+. el \
+. tm mdoc warning: Unknown keyword `\$1' in .Bd request (#\n[.c])
+. \}\}
+.
+. if (\n[doc-reg-ddBa] < \n[.$]) \{\
+. shift \n[doc-reg-ddBa]
+. doc-do-Bd-args \$@
+. \}
+..
+.
+.
+.\" NS Ed user macro
+.\" NS end display
+.\" NS
+.\" NS modifies:
+.\" NS doc-display-depth
+.\" NS doc-display-indent-stackXXX
+.\" NS doc-display-type-stackXXX
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Ed' set in doc-common
+.
.de Ed
-.ds mN Ed
-.br
-.if \\n(dP==0 .tm mdoc: Extraneous .Ed
-.if "\\*(d\\n(dP"dL" \{\
-. ft \\n(cF
-. fz \\n(cZ
-.\}
-.in \\n(.iu-\\n(O\\n(dPu
-.rr O\\n(dP
-.rm d\\n(dP
-.nr dP \\n(dP-1
-.fi
-.if t .ad
-..
-.\"--------------------------------------------------------------------------
-.\" NS Bl macro - begin list (.Bl list-type)
-.\" NS L[0-9] registers - stack of list types
+. ds doc-macro-name Ed
+.
+. br
+.
+. if !\n[doc-display-depth] \{\
+. tm mdoc warning: Extraneous .Ed (#\n[.c])
+. nr doc-display-depth 1
+. \}
+.
+. if "\*[doc-display-type-stack\n[doc-display-depth]]"literal" \{\
+. ft \n[doc-curr-font]
+. ps \n[doc-curr-size]u
+. \}
+.
+. in -\n[doc-display-indent-stack\n[doc-display-depth]]u
+.
+. \" restore saved adjustment and fill modes
+. ie \n[doc-display-fi-stack\n[doc-display-depth]] \
+. fi
+. el \
+. nf
+. ad \n[doc-display-ad-stack\n[doc-display-depth]]
+.
+. nr doc-display-indent-stack\n[doc-display-depth] 0
+. ds doc-display-type-stack\n[doc-display-depth]
+. nr doc-display-depth -1
+..
+.
+.
+.\" NS doc-list-type-stackXXX global string
+.\" NS stack of list types
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.ds doc-list-type-stack1
+.
+.
+.\" NS doc-list-indent-stackXXX global register
+.\" NS stack of list indentation values
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.nr doc-list-indent-stack1 0
+.
+.
+.\" NS doc-have-indent global register (bool)
+.\" NS an indentation value is active
+.
+.nr doc-have-indent 0
+.
+.
+.\" NS Bl user macro
+.\" NS begin list
+.\" NS
+.\" NS width register `Bl' set in doc-common
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-have-diag-list
+.\" NS doc-list-depth
+.\" NS doc-have-indent
+.\" NS doc-list-indent-stackXXX
+.\" NS doc-list-type-stackXXX
+.\" NS doc-macro-name
+.\" NS doc-num-args
+.\" NS doc-num-columns
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-Bl
+.
.de Bl
-.ie \\n(.$==0 \{\
-.tm Usage: .Bl [[-hang | -tag] [-width]] [ -item | -enum | -bullet | -diag] (#\\n(.c)
-.\}
-.el \{\
-. ds mN Bl
-. nr aP 0
-. nr lC \\n(lC+1
-. ds A1 \\$2
-. ds A2 \\$3
-. ds A3 \\$4
-. ds A4 \\$5
-. ds A5 \\$6
-. ds A6 \\$7
-. ds A7 \\$8
-. ds A8 \\$9
-. nr fV \\n(.$-1
-. if "\\$1"-hang" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC hL
-. nr w\\n(lC 6n
-. nr tC 1
-. \}
-. if "\\$1"-tag" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC tL
-. nr tC 1
-. \}
-. if "\\$1"-item" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC iT
-. nr tC 1
-. \}
-. if "\\$1"-enum" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC nU
-. nr w\\n(lC 3n
-. nr tC 1
-. \}
-. if "\\$1"-bullet" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC bU
-. nr w\\n(lC 2n
-. nr tC 1
-. \}
-. if "\\$1"-dash" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC hU
-. nr w\\n(lC 2n
-. nr tC 1
-. \}
-. if "\\$1"-hyphen" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC hU
-. nr w\\n(lC 2n
-. nr tC 1
-. \}
-. if "\\$1"-inset" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC lL
-. nr tC 1
-. \}
-. if "\\$1"-diag" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC mL
-. nr mL 1
-. \}
-. if "\\$1"-ohang" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC oL
-. nr tC 1
-. \}
-. if "\\$1"-column" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC cL
-. \}
-. ie \\n(aP==0 \{\
-. tm \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. tm Usage: .Bl [[-inset|-tag] -width] [-item|-enum|-bullet|-diag] (#\\n(.c)
-. \}
-. el \{\
-. tY
-. if (\\n(aP==1)&(\\n(aP<\\n(.$) \{\
-. nr aP 0
-. lV
-. if "\\*(L\\n(lC"cL" \{\
-. W\\n(wV
-. nr w\\n(lC 0
-' in -\\n(eWu
-. ie \\n(v\\n(lC==1 \{\
-. nr aa 0
-. \}
-. el \{\
-. sp \\n(dVu
-. \}
-. nf
-. nr wV 0
-. \}
-. \}
-. \}
-. nr aP 0
-.\" . ds b1
-. aY
-.\" .tm Here is L[\\n(lC]==\\*(L\\n(lC
-.\}
-..
-.if \n(.g \{\
-. nr i 10
-. while \ni<100 \{\
-. nr num!\nin 1
-. nr i +1
-. \}
-.\}
-.\" NS lV macro - resolve remaining .Bl arguments
-.de lV
-.nr aP \\n(aP+1
-.if \\n(fV>=\\n(aP \{\
-. nr iD 0
-. if "\\*(A\\n(aP"-compact" \{\
-. nr iD 1
-. nr v\\n(lC 1
-. \}
-. if "\\*(A\\n(aP"-width" \{\
-. nr iD 1
-. nr aP \\n(aP+1
-. nr tW 1
-. ds t\\n(lC TagwidtH
-. ds tS \\*(A\\n(aP
-. aW \\n(aP
-. ie \\n(sW>2 \{\
-. nr w\\n(lC (\\n(sW)*\\n(fWu
-. if \\n(sW==3 \{\
-. ie \\n(.g \{\
-. if \A'\\*(tS' .if r num!\\*(tS \{\
-. nr w\\n(lC \\*(tS
-. \}
-. \}
-. el \{\
-. if (\\*(tS>9n)&(\\*(tS<99n) \{\
-. nr w\\n(lC \\*(tSu
-. \}
-. \}
-. \}
-. \}
-. el \{\
-. aT \\*(tS
-. ie \\n(aT==1 \{\
-. nr w\\n(lC \\n(\\*(tS
-. \}
-. el \{\
-. nr w\\n(lC \\*(tSu
-. \}
-. \}
-. \}
-. if "\\*(A\\n(aP"-offset" \{\
-. nr iD 1
-. nr aP \\n(aP+1
-. ie "\\*(A\\n(aP"indent" \{\
-. nr o\\n(lC \\n(Dsu
-. \}
-. el \{\
-. ds tS \\*(A\\n(aP
-. aW \\n(aP
-. ie \\n(sW>2 \{\
-. nr o\\n(lC (\\n(sW)*\\n(fWu
-. ie \\n(.g \{\
-. if \A'\\*(tS' .if r num!\\*(tS \{\
-. nr o\\n(lC \\*(tS
-. \}
-. \}
-. el \{\
-. if (\\*(tS>9n)&(\\*(tS<100n) \{\
-. nr o\\n(lC \\*(tS
-. \}
-. \}
-. \}
-. el \{\
-. ie \\n(C\\n(aP==1 .nr o\\n(lC \\n(\\*(tS
-. el .nr o\\n(lC \\*(tS
-. \}
-. \}
-. \}
-. if \\n(iD==0 \{\
-. if "\\*(L\\n(lC"cL" \{\
-. nr wV \\n(wV+1
-. ds A\\n(wV \\*(A\\n(aP
-. \}
-. \}
-. if \\n(fV>\\n(aP .lV
-.\}
-..
-.\" NS El macro - end list
-.\" NS iD local register
+. if !\n[.$] \{\
+. doc-Bl-usage
+. return
+. \}
+.
+. ds doc-macro-name Bl
+. nr doc-list-depth +1
+. nr doc-arg-ptr 1
+.
+. ie "\$1"-hang" \{\
+. ds doc-list-type-stack\n[doc-list-depth] hang-list
+. nr doc-list-indent-stack\n[doc-list-depth] 6n
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-tag" \{\
+. ds doc-list-type-stack\n[doc-list-depth] tag-list
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-item" \{\
+. ds doc-list-type-stack\n[doc-list-depth] item-list
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-enum" \{\
+. ds doc-list-type-stack\n[doc-list-depth] enum-list
+. nr doc-list-indent-stack\n[doc-list-depth] 3n
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-bullet" \{\
+. ds doc-list-type-stack\n[doc-list-depth] bullet-list
+. nr doc-list-indent-stack\n[doc-list-depth] 2n
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-dash" \{\
+. ds doc-list-type-stack\n[doc-list-depth] dash-list
+. nr doc-list-indent-stack\n[doc-list-depth] 2n
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-hyphen" \{\
+. ds doc-list-type-stack\n[doc-list-depth] dash-list
+. nr doc-list-indent-stack\n[doc-list-depth] 2n
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-inset" \{\
+. ds doc-list-type-stack\n[doc-list-depth] inset-list
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-diag" \{\
+. ds doc-list-type-stack\n[doc-list-depth] diag-list
+. nr doc-have-diag-list 1
+. \}
+. el \{ .ie "\$1"-ohang" \{\
+. ds doc-list-type-stack\n[doc-list-depth] ohang-list
+. nr doc-have-indent 1
+. \}
+. el \{ .ie "\$1"-column" \{\
+. ds doc-list-type-stack\n[doc-list-depth] column-list
+. linetabs 1
+. \}
+. el \{\
+. tm1 "mdoc warning: Unknown list type `\$1' (or missing list type)
+. tm1 " in .Bl request
+. tm
+. nr doc-arg-ptr 0
+. \}\}\}\}\}\}\}\}\}\}\}
+.
+. \" we have seen a list type
+. if !\n[doc-arg-ptr] \{\
+. doc-Bl-usage
+. doc-reset-args
+. return
+. \}
+.
+. shift
+.
+. \" fill argument vector
+. nr doc-reg-Bl 1
+. while (\n[doc-reg-Bl] <= \n[.$]) \{\
+. ds doc-arg\n[doc-reg-Bl] "\$[\n[doc-reg-Bl]]
+. nr doc-reg-Bl +1
+. \}
+.
+. doc-increment-list-stack
+.
+. if \n[.$] \{\
+. nr doc-arg-limit \n[.$]
+. nr doc-arg-ptr 0
+. doc-do-Bl-args
+.
+. \" initialize column list
+. if "\*[doc-list-type-stack\n[doc-list-depth]]"column-list" \{\
+. doc-set-column-tab \n[doc-num-columns]
+. nr doc-list-indent-stack\n[doc-list-depth] 0
+' in -\n[doc-column-indent-width]u
+. if !\n[doc-compact-list-stack\n[doc-list-depth]] \
+. sp \n[doc-display-vertical]u
+.
+. nf
+. nr doc-num-columns 0
+. \}\}
+.
+. doc-reset-args
+..
+.
+.
+.\" NS doc-Bl-usage macro
+.
+.de doc-Bl-usage
+. tm1 "Usage: .Bl {-hang | -ohang | -tag | -diag | -inset}
+. tm1 " [-width <string>] [-xwidth <command>]
+. tm1 " [-offset <string>] [-compact]
+. tm1 " .Bl -column [-offset <string>] <string1> <string2> ...
+. tm1 " .Bl {-item | -enum [-nested] | -bullet | -hyphen | -dash}
+. tm1 " [-offset <string>] [-compact] (#\n[.c])
+..
+.
+.
+.\" NS doc-do-Bl-args macro
+.\" NS resolve remaining .Bl arguments
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-compact-list-stackXXX
+.\" NS doc-list-indent-stackXXX
+.\" NS doc-list-offset-stackXXX
+.\" NS doc-num-columns
+.\" NS doc-tag-prefix-stackXXX
+.\" NS doc-tag-width-stackXXX
+.\" NS
+.\" NS local variables:
+.\" NS doc-box-dBla
+.\" NS doc-env-dBla
+.\" NS doc-reg-dBla
+.\" NS doc-reg-dBla1
+.\" NS doc-reg-dBla2
+.\" NS doc-reg-dBla3
+.\" NS doc-reg-dBla4
+.\" NS doc-str-dBla
+.\" NS doc-str-dBla1
+.
+.de doc-do-Bl-args
+. nr doc-arg-ptr +1
+.
+. if (\n[doc-arg-limit] < \n[doc-arg-ptr]) \
+. return
+.
+. \" avoid a warning message in case e.g. `-offset' has no parameter
+. nr doc-reg-dBla (\n[doc-arg-ptr] + 1)
+. if !d doc-arg\n[doc-reg-dBla] \
+. ds doc-arg\n[doc-reg-dBla]
+.
+. nr doc-reg-dBla 1
+.
+. ie "\*[doc-arg\n[doc-arg-ptr]]"-compact" \
+. nr doc-compact-list-stack\n[doc-list-depth] 1
+.
+. el \{ .ie "\*[doc-arg\n[doc-arg-ptr]]"-nested" \{\
+. ie (\n[doc-list-depth] > 1) \{\
+. nr doc-reg-dBla1 (\n[doc-list-depth] - 1)
+. ds doc-tag-prefix-stack\n[doc-list-depth] "\*[doc-tag-prefix-stack\n[doc-reg-dBla1]]
+. as doc-tag-prefix-stack\n[doc-list-depth] \n[doc-enum-list-count-stack\n[doc-reg-dBla1]].
+. length doc-reg-dBla1 "\*[doc-tag-prefix-stack\n[doc-list-depth]]
+. nr doc-list-indent-stack\n[doc-list-depth] +\n[doc-reg-dBla1]n
+. \}
+. el \
+. tm mdoc warning: `-nested' allowed with nested .Bl requests only (#\n[.c])
+. \}
+.
+. el \{ .ie "\*[doc-arg\n[doc-arg-ptr]]"-width" \{\
+. nr doc-arg-ptr +1
+. ds doc-tag-width-stack\n[doc-list-depth] TagwidtH
+. ds doc-str-dBla "\*[doc-arg\n[doc-arg-ptr]]
+.
+. \" test whether argument is a valid numeric expression
+. nr doc-reg-dBla1 0
+. if \B(\*[doc-str-dBla]) \{\
+. \" disable warnings related to scaling indicators (32)
+. nr doc-reg-dBla2 \n[.warn]
+. warn (\n[.warn] - (\n[.warn] / 32 % 2 * 32))
+.
+. \" values without a scaling indicator are taken as strings;
+. \" we test whether the parameter string with and without the last
+. \" character yields identical numerical results (ignoring the
+. \" scaling indicator)
+. ds doc-str-dBla1 "\*[doc-str-dBla]
+. substring doc-str-dBla1 1 -1
+. if \B(\*[doc-str-dBla1]) \{\
+. nr doc-reg-dBla3 (;(\*[doc-str-dBla]))
+. nr doc-reg-dBla4 (\*[doc-str-dBla1])
+. if (\n[doc-reg-dBla3] == \n[doc-reg-dBla4]) \
+. nr doc-reg-dBla1 1
+. \}
+.
+. \" enable all warnings again
+. warn \n[doc-reg-dBla2]
+. \}
+.
+. ie \n[doc-reg-dBla1] \
+. nr doc-list-indent-stack\n[doc-list-depth] (\*[doc-str-dBla])
+. el \{\
+. doc-get-arg-width \n[doc-arg-ptr]
+. ie (\n[doc-width] == 2) \{\
+. \" if the width parameter is a macro, use the macro's
+. \" width as specified in doc-common
+. doc-get-arg-type \*[doc-str-dBla]
+. ie (\n[doc-arg-type] == 1) \
+. nr doc-list-indent-stack\n[doc-list-depth] \n[\*[doc-str-dBla]]
+. el \
+. nr doc-list-indent-stack\n[doc-list-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}
+. el \
+. nr doc-list-indent-stack\n[doc-list-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}\}
+.
+. el \{ .ie "\*[doc-arg\n[doc-arg-ptr]]"-xwidth" \{\
+. nr doc-arg-ptr +1
+. ds doc-tag-width-stack\n[doc-list-depth] TagwidtH
+.
+. ds doc-str-dBla \*[doc-arg\n[doc-arg-ptr]]
+. substring doc-str-dBla 1 2
+. if .\*[doc-str-dBla] \{\
+. \" execute string in a box to get the width of the diversion
+. ds doc-str-dBla \*[doc-arg\n[doc-arg-ptr]]
+. doc-save-global-vars
+. doc-reset-args
+. box doc-box-dBla
+. ev doc-env-dBla
+. evc 0
+. in 0
+. nf
+. nop \*[doc-str-dBla]
+. br
+. ev
+. box
+. doc-restore-global-vars
+. doc-get-width \h'\n[dl]u'
+. \}
+. nr doc-list-indent-stack\n[doc-list-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}
+.
+. el \{ .ie "\*[doc-arg\n[doc-arg-ptr]]"-offset" \{\
+. nr doc-arg-ptr +1
+.
+. ie "\*[doc-arg\n[doc-arg-ptr]]"indent" \
+. nr doc-list-offset-stack\n[doc-list-depth] \n[doc-display-indent]u
+. el \{\
+. ds doc-str-dBla "\*[doc-arg\n[doc-arg-ptr]]
+. nr doc-reg-dBla1 0
+. if \B(\*[doc-str-dBla]) \{\
+. nr doc-reg-dBla2 \n[.warn]
+. warn (\n[.warn] - (\n[.warn] / 32 % 2 * 32))
+.
+. ds doc-str-dBla1 "\*[doc-str-dBla]
+. substring doc-str-dBla1 1 -1
+. if \B(\*[doc-str-dBla1]) \{\
+. nr doc-reg-dBla3 (;(\*[doc-str-dBla]))
+. nr doc-reg-dBla4 (\*[doc-str-dBla1])
+. if (\n[doc-reg-dBla3] == \n[doc-reg-dBla4]) \
+. nr doc-reg-dBla1 1
+. \}
+.
+. warn \n[doc-reg-dBla2]
+. \}
+.
+. ie \n[doc-reg-dBla1] \
+. nr doc-list-offset-stack\n[doc-list-depth] \*[doc-str-dBla]
+. el \{\
+. doc-get-arg-width \n[doc-arg-ptr]
+. ie (\n[doc-width] <= 3) \{\
+. \" if the offset parameter is a macro, use the macro's
+. \" width as specified in doc-common
+. doc-get-arg-type \*[doc-str-dBla]
+. ie (\n[doc-arg-type] == 1) \
+. nr doc-list-offset-stack\n[doc-list-depth] \n[\*[doc-str-dBla]]
+. el \
+. nr doc-list-offset-stack\n[doc-list-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}
+. el \
+. nr doc-list-offset-stack\n[doc-list-depth] (\n[doc-width]u * \n[doc-fixed-width]u)
+. \}\}\}
+. el \
+. nr doc-reg-dBla 0
+. \}\}\}\}
+.
+. \" not a known keyword, so it specifies the width of the next column
+. \" (if it is a column list)
+. if !\n[doc-reg-dBla] \{\
+. ie "\*[doc-list-type-stack\n[doc-list-depth]]"column-list" \{\
+. nr doc-num-columns +1
+. ds doc-arg\n[doc-num-columns] "\*[doc-arg\n[doc-arg-ptr]]
+. \}
+. el \{\
+. tmc mdoc warning: Unknown keyword `\*[doc-arg\n[doc-arg-ptr]]'
+. tm1 " in .Bl request (#\n[.c])
+. \}\}
+.
+. if (\n[doc-arg-limit] > \n[doc-arg-ptr]) \
+. doc-do-Bl-args
+..
+.
+.
+.\" NS doc-save-global-vars macro
+.\" NS save all global variables
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dsgv
+.
+.de doc-save-global-vars
+. ds doc-macro-name-saved "\*[doc-macro-name]
+. nr doc-arg-limit-saved \n[doc-arg-limit]
+. nr doc-num-args-saved \n[doc-num-args]
+. nr doc-arg-ptr-saved \n[doc-arg-ptr]
+.
+. nr doc-reg-dsgv 1
+. while (\n[doc-reg-dsgv] <= \n[doc-arg-limit]) \{\
+. ds doc-arg\n[doc-reg-dsgv]-saved "\*[doc-arg\n[doc-reg-dsgv]]
+. nr doc-type\n[doc-reg-dsgv]-saved \n[doc-type\n[doc-reg-dsgv]]
+. ds doc-space\n[doc-reg-dsgv]-saved "\*[doc-space\n[doc-reg-dsgv]]
+. nr doc-reg-dsgv +1
+. \}
+.
+. nr doc-curr-font-saved \n[doc-curr-font]
+. nr doc-curr-size-saved \n[doc-curr-size]
+. nr doc-in-synopsis-count-saved \n[doc-in-synopsis-count]
+. nr doc-indent-synopsis-saved \n[doc-indent-synopsis]
+. nr doc-have-decl-saved \n[doc-have-decl]
+. nr doc-have-var-saved \n[doc-have-var]
+. ds doc-command-name-saved "\*[doc-command-name]
+. ds doc-quote-left-saved "\*[doc-quote-left]
+. ds doc-quote-right-saved "\*[doc-quote-right]
+. nr doc-nesting-level-saved \n[doc-nesting-level]
+. nr doc-in-list-saved \n[doc-in-list]
+. ds doc-space-saved "\*[doc-space]
+. ds doc-saved-space-saved "\*[doc-saved-space]
+. nr doc-space-mode-saved \n[doc-space-mode]
+. nr doc-have-space-saved \n[doc-have-space]
+. nr doc-have-slot-saved \n[doc-have-slot]
+. nr doc-keep-type-saved \n[doc-keep-type]
+. nr doc-display-depth-saved \n[doc-display-depth]
+. nr doc-is-compact-saved \n[doc-is-compact]
+.
+. nr doc-reg-dsgv 0
+. while (\n[doc-reg-dsgv] <= \n[doc-display-depth]) \{\
+. ds doc-display-type-stack\n[doc-reg-dsgv]-saved "\*[doc-display-type-stack\n[doc-reg-dsgv]]
+. nr doc-display-indent-stack\n[doc-reg-dsgv]-saved \n[doc-display-indent-stack\n[doc-reg-dsgv]]
+. nr doc-display-ad-stack\n[doc-reg-dsgv]-saved \n[doc-display-ad-stack\n[doc-reg-dsgv]]
+. nr doc-display-fi-stack\n[doc-reg-dsgv]-saved \n[doc-display-fi-stack\n[doc-reg-dsgv]]
+. nr doc-reg-dsgv +1
+. \}
+.
+. nr doc-fontmode-depth-saved \n[doc-fontmode-depth]
+.
+. nr doc-reg-dsgv 1
+. while (\n[doc-reg-dsgv] <= \n[doc-fontmode-depth]) \{\
+. nr doc-fontmode-font-stack\n[doc-reg-dsgv]-saved \n[doc-fontmode-font-stack\n[doc-reg-dsgv]]
+. nr doc-fontmode-size-stack\n[doc-reg-dsgv]-saved \n[doc-fontmode-size-stack\n[doc-reg-dsgv]]
+. nr doc-reg-dsgv +1
+. \}
+.
+. nr doc-list-depth-saved \n[doc-list-depth]
+.
+. nr doc-reg-dsgv 1
+. while (\n[doc-reg-dsgv] <= \n[doc-list-depth]) \{\
+. ds doc-list-type-stack\n[doc-reg-dsgv]-saved "\*[doc-list-type-stack\n[doc-reg-dsgv]]
+. nr doc-list-indent-stack\n[doc-reg-dsgv]-saved \n[doc-list-indent-stack\n[doc-reg-dsgv]]
+. nr doc-compact-list-stack\n[doc-reg-dsgv]-saved \n[doc-compact-list-stack\n[doc-reg-dsgv]]
+. ds doc-tag-prefix-stack\n[doc-reg-dsgv]-saved "\*[doc-tag-prefix-stack\n[doc-reg-dsgv]]
+. ds doc-tag-width-stack\n[doc-reg-dsgv]-saved "\*[doc-tag-width-stack\n[doc-reg-dsgv]]
+. nr doc-list-offset-stack\n[doc-reg-dsgv]-saved \n[doc-list-offset-stack\n[doc-reg-dsgv]]
+. nr doc-enum-list-count-stack\n[doc-reg-dsgv]-saved \n[doc-enum-list-count-stack\n[doc-reg-dsgv]]
+. nr doc-reg-dsgv +1
+. \}
+.
+. nr doc-have-indent-saved \n[doc-have-indent]
+. ds doc-saved-Pa-font-saved "\*[doc-saved-Pa-font]
+. nr doc-curr-type-saved \n[doc-curr-type]
+. ds doc-curr-arg-saved "\*[doc-curr-arg]
+. nr doc-have-diag-list-saved \n[doc-have-diag-list]
+. nr doc-diag-list-input-line-count-saved \n[doc-diag-list-input-line-count]
+. nr doc-num-columns-saved \n[doc-num-columns]
+. nr doc-next-list-depth-saved \n[doc-next-list-depth]
+. nr doc-column-indent-width-saved \n[doc-column-indent-width]
+. nr doc-is-func-saved \n[doc-is-func]
+. nr doc-have-old-func-saved \n[doc-have-old-func]
+. nr doc-func-arg-count-saved \n[doc-func-arg-count]
+. ds doc-func-arg-saved "\*[doc-func-arg]
+. nr doc-num-func-args-saved \n[doc-num-func-args]
+. nr doc-func-args-processed-saved \n[doc-func-args-processed]
+. nr doc-have-func-saved \n[doc-have-func]
+. nr doc-is-reference-saved \n[doc-is-reference]
+. nr doc-reference-count-saved \n[doc-reference-count]
+. nr doc-author-count-saved \n[doc-author-count]
+.
+. nr doc-reg-dsgv 0
+. while (\n[doc-reg-dsgv] <= \n[doc-author-count]) \{\
+. ds doc-author-name\n[doc-reg-dsgv]-saved "\*[doc-author-name\n[doc-reg-dsgv]]
+. nr doc-reg-dsgv +1
+. \}
+.
+. nr doc-book-count-saved \n[doc-book-count]
+. ds doc-book-name-saved "\*[doc-book-name]
+. nr doc-date-count-saved \n[doc-date-count]
+. ds doc-date-saved "\*[doc-date]
+. nr doc-publisher-count-saved \n[doc-publisher-count]
+. ds doc-publisher-name-saved "\*[doc-publisher-name]
+. nr doc-journal-count-saved \n[doc-journal-count]
+. ds doc-journal-name-saved "\*[doc-journal-name]
+. nr doc-issue-count-saved \n[doc-issue-count]
+. ds doc-issue-name-saved "\*[doc-issue-name]
+. nr doc-optional-count-saved \n[doc-optional-count]
+. ds doc-optional-string-saved "\*[doc-optional-string]
+. nr doc-page-number-count-saved \n[doc-page-number-count]
+. ds doc-page-number-string-saved "\*[doc-page-number-string]
+. nr doc-corporate-count-saved \n[doc-corporate-count]
+. ds doc-corporate-name-saved "\*[doc-corporate-name]
+. nr doc-report-count-saved \n[doc-report-count]
+. ds doc-report-name-saved "\*[doc-report-name]
+. nr doc-reference-title-count-saved \n[doc-reference-title-count]
+. ds doc-reference-title-name-saved "\*[doc-reference-title-name]
+. ds doc-reference-title-name-for-book-saved "\*[doc-reference-title-name-for-book]
+. nr doc-volume-count-saved \n[doc-volume-count]
+. ds doc-volume-name-saved "\*[doc-volume-name]
+. nr doc-have-author-saved \n[doc-have-author]
+.
+. ds doc-document-title-saved "\*[doc-document-title]
+. ds doc-volume-saved "\*[doc-volume]
+. ds doc-section-saved "\*[doc-section]
+. ds doc-operating-system-saved "\*[doc-operating-system]
+. ds doc-date-string-saved "\*[doc-date-string]
+. nr doc-header-space-saved \n[doc-header-space]
+. nr doc-footer-space-saved \n[doc-footer-space]
+. nr doc-display-vertical-saved \n[doc-display-vertical]
+. ds doc-header-string-saved "\*[doc-header-string]
+. nr doc-in-see-also-section-saved \n[doc-in-see-also-section]
+. nr doc-in-files-section-saved \n[doc-in-files-section]
+. nr doc-in-authors-section-saved \n[doc-in-authors-section]
+..
+.
+.
+.\" NS doc-restore-global-vars macro
+.\" NS restore all global variables
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-drgv
+.
+.de doc-restore-global-vars
+. ds doc-macro-name "\*[doc-macro-name-saved]
+. nr doc-arg-limit \n[doc-arg-limit-saved]
+. nr doc-num-args \n[doc-num-args-saved]
+. nr doc-arg-ptr \n[doc-arg-ptr-saved]
+.
+. nr doc-reg-drgv 1
+. while (\n[doc-reg-drgv] <= \n[doc-arg-limit]) \{\
+. ds doc-arg\n[doc-reg-drgv] "\*[doc-arg\n[doc-reg-drgv]-saved]
+. nr doc-type\n[doc-reg-drgv] \n[doc-type\n[doc-reg-drgv]-saved]
+. ds doc-space\n[doc-reg-drgv] "\*[doc-space\n[doc-reg-drgv]-saved]
+. nr doc-reg-drgv +1
+. \}
+.
+. nr doc-curr-font \n[doc-curr-font-saved]
+. nr doc-curr-size \n[doc-curr-size-saved]
+. nr doc-in-synopsis-count \n[doc-in-synopsis-count-saved]
+. nr doc-indent-synopsis \n[doc-indent-synopsis-saved]
+. nr doc-have-decl \n[doc-have-decl-saved]
+. nr doc-have-var \n[doc-have-var-saved]
+. ds doc-command-name "\*[doc-command-name-saved]
+. ds doc-quote-left "\*[doc-quote-left-saved]
+. ds doc-quote-right "\*[doc-quote-right-saved]
+. nr doc-nesting-level \n[doc-nesting-level-saved]
+. nr doc-in-list \n[doc-in-list-saved]
+. ds doc-space "\*[doc-space-saved]
+. ds doc-saved-space "\*[doc-saved-space-saved]
+. nr doc-space-mode \n[doc-space-mode-saved]
+. nr doc-have-space \n[doc-have-space-saved]
+. nr doc-have-slot \n[doc-have-slot-saved]
+. nr doc-keep-type \n[doc-keep-type-saved]
+. nr doc-display-depth \n[doc-display-depth-saved]
+. nr doc-is-compact \n[doc-is-compact-saved]
+.
+. nr doc-reg-drgv 0
+. while (\n[doc-reg-drgv] <= \n[doc-display-depth]) \{\
+. ds doc-display-type-stack\n[doc-reg-drgv] "\*[doc-display-type-stack\n[doc-reg-drgv]-saved]
+. nr doc-display-indent-stack\n[doc-reg-drgv] \n[doc-display-indent-stack\n[doc-reg-drgv]-saved]
+. nr doc-display-ad-stack\n[doc-reg-drgv] \n[doc-display-ad-stack\n[doc-reg-drgv]-saved]
+. nr doc-display-fi-stack\n[doc-reg-drgv] \n[doc-display-fi-stack\n[doc-reg-drgv]-saved]
+. nr doc-reg-drgv +1
+. \}
+.
+. nr doc-fontmode-depth \n[doc-fontmode-depth-saved]
+.
+. nr doc-reg-drgv 1
+. while (\n[doc-reg-drgv] <= \n[doc-fontmode-depth]) \{\
+. nr doc-fontmode-font-stack\n[doc-reg-drgv] \n[doc-fontmode-font-stack\n[doc-reg-drgv]]-saved
+. nr doc-fontmode-size-stack\n[doc-reg-drgv] \n[doc-fontmode-size-stack\n[doc-reg-drgv]]-saved
+. nr doc-reg-drgv +1
+. \}
+.
+. nr doc-list-depth \n[doc-list-depth-saved]
+.
+. nr doc-reg-drgv 1
+. while (\n[doc-reg-drgv] <= \n[doc-list-depth]) \{\
+. ds doc-list-type-stack\n[doc-reg-drgv] "\*[doc-list-type-stack\n[doc-reg-drgv]-saved]
+. nr doc-list-indent-stack\n[doc-reg-drgv] \n[doc-list-indent-stack\n[doc-reg-drgv]-saved]
+. nr doc-compact-list-stack\n[doc-reg-drgv] \n[doc-compact-list-stack\n[doc-reg-drgv]-saved]
+. ds doc-tag-prefix-stack\n[doc-reg-drgv] "\*[doc-tag-prefix-stack\n[doc-reg-drgv]-saved]
+. ds doc-tag-width-stack\n[doc-reg-drgv] "\*[doc-tag-width-stack\n[doc-reg-drgv]-saved]
+. nr doc-list-offset-stack\n[doc-reg-drgv] \n[doc-list-offset-stack\n[doc-reg-drgv]-saved]
+. nr doc-enum-list-count-stack\n[doc-reg-drgv] \n[doc-enum-list-count-stack\n[doc-reg-drgv]-saved]
+. nr doc-reg-drgv +1
+. \}
+.
+. nr doc-have-indent \n[doc-have-indent-saved]
+. ds doc-saved-Pa-font "\*[doc-saved-Pa-font-saved]
+. nr doc-curr-type \n[doc-curr-type-saved]
+. ds doc-curr-arg "\*[doc-curr-arg-saved]
+. nr doc-have-diag-list \n[doc-have-diag-list-saved]
+. nr doc-diag-list-input-line-count \n[doc-diag-list-input-line-count-saved]
+. nr doc-num-columns \n[doc-num-columns-saved]
+. nr doc-next-list-depth \n[doc-next-list-depth-saved]
+. nr doc-column-indent-width \n[doc-column-indent-width-saved]
+. nr doc-is-func \n[doc-is-func-saved]
+. nr doc-have-old-func \n[doc-have-old-func-saved]
+. nr doc-func-arg-count \n[doc-func-arg-count-saved]
+. ds doc-func-arg "\*[doc-func-arg-saved]
+. nr doc-num-func-args \n[doc-num-func-args-saved]
+. nr doc-func-args-processed \n[doc-func-args-processed-saved]
+. nr doc-have-func \n[doc-have-func-saved]
+. nr doc-is-reference \n[doc-is-reference-saved]
+. nr doc-reference-count \n[doc-reference-count-saved]
+. nr doc-author-count \n[doc-author-count-saved]
+.
+. nr doc-reg-drgv 0
+. while (\n[doc-reg-drgv] <= \n[doc-author-count]) \{\
+. ds doc-author-name\n[doc-reg-drgv] "\*[doc-author-name\n[doc-reg-drgv]-saved]
+. nr doc-reg-drgv +1
+. \}
+.
+. nr doc-book-count \n[doc-book-count-saved]
+. ds doc-book-name "\*[doc-book-name-saved]
+. nr doc-date-count \n[doc-date-count-saved]
+. ds doc-date "\*[doc-date-saved]
+. nr doc-publisher-count \n[doc-publisher-count-saved]
+. ds doc-publisher-name "\*[doc-publisher-name-saved]
+. nr doc-journal-count \n[doc-journal-count-saved]
+. ds doc-journal-name "\*[doc-journal-name-saved]
+. nr doc-issue-count \n[doc-issue-count-saved]
+. ds doc-issue-name "\*[doc-issue-name-saved]
+. nr doc-optional-count \n[doc-optional-count-saved]
+. ds doc-optional-string "\*[doc-optional-string-saved]
+. nr doc-page-number-count \n[doc-page-number-count-saved]
+. ds doc-page-number-string "\*[doc-page-number-string-saved]
+. nr doc-corporate-count \n[doc-corporate-count-saved]
+. ds doc-corporate-name "\*[doc-corporate-name-saved]
+. nr doc-report-count \n[doc-report-count-saved]
+. ds doc-report-name "\*[doc-report-name-saved]
+. nr doc-reference-title-count \n[doc-reference-title-count-saved]
+. ds doc-reference-title-name "\*[doc-reference-title-name-saved]
+. ds doc-reference-title-name-for-book "\*[doc-reference-title-name-for-book-saved]
+. nr doc-volume-count \n[doc-volume-count-saved]
+. ds doc-volume-name "\*[doc-volume-name-saved]
+. nr doc-have-author \n[doc-have-author-saved]
+.
+. ds doc-document-title "\*[doc-document-title-saved]
+. ds doc-volume "\*[doc-volume-saved]
+. ds doc-section "\*[doc-section-saved]
+. ds doc-operating-system "\*[doc-operating-system-saved]
+. ds doc-date-string "\*[doc-date-string-saved]
+. nr doc-header-space \n[doc-header-space-saved]
+. nr doc-footer-space \n[doc-footer-space-saved]
+. nr doc-display-vertical \n[doc-display-vertical-saved]
+. ds doc-header-string "\*[doc-header-string-saved]
+. nr doc-in-see-also-section \n[doc-in-see-also-section-saved]
+. nr doc-in-files-section \n[doc-in-files-section-saved]
+. nr doc-in-authors-section \n[doc-in-authors-section-saved]
+..
+.
+.
+.\" NS El user macro
+.\" NS end list
+.\" NS
+.\" NS modifies:
+.\" NS doc-have-diag-list
+.\" NS doc-list-depth
+.\" NS doc-macro-name
+.\" NS
+.\" NS local variables:
+.\" NS doc-str-El
+.\" NS
+.\" NS width register `El' set in doc-common
+.
.de El
-.ie \\n(.$>0 \{\
-. tm Usage: .El (#\\n(.c)
-.\}
-.el \{\
-. ds mN El
-. nr iD 0
-. if "\\*(L\\n(lC"cL" \{\
-. nr iD 1
-. cC
-. \}
-. if "\\*(L\\n(lC"nU" \{\
-. nr nU 0
-. \}
-. if \\n(mL>0 \{\
-. nr iD 1
-. nr mL 0
-. tZ
-. nr lC \\n(lC-1
-. tY
-. \}
-. if "\\*(L\\n(lC"iT" \{\
-' in \\n(.iu-\\n(o\\n(lCu
-. tZ
-. nr lC \\n(lC-1
-. tY
-. nr iD 1
-. \}
-. if "\\*(L\\n(lC"oL" \{\
-' in \\n(.iu-\\n(o\\n(lCu
-. tZ
-. nr lC \\n(lC-1
-. tY
-. nr iD 1
-. \}
-. if "\\*(L\\n(lC"lL" \{\
-' in \\n(.iu-\\n(o\\n(lCu
-. tZ
-. nr lC \\n(lC-1
-. tY
-. nr iD 1
-. \}
-. if \\n(iD==0 \{\
-. lE
-. \}
-. br
-. nr iD 0
-.\}
-..
-.\" NS It macro - list item
-.\" NS iD local register
-.\" NS aA save pA font string for section FILES (no underline if nroff)
+. if \n[.$] \{\
+. tm Usage: .El (does not take arguments) (#\n[.c])
+. return
+. \}
+.
+. ds doc-macro-name El
+. ds doc-str-El \*[doc-list-type-stack\n[doc-list-depth]]
+.
+. ie "\*[doc-str-El]"diag-list" \{\
+. nr doc-have-diag-list 0
+. doc-end-list 0
+. \}
+. el \{ .ie "\*[doc-str-El]"column-list" \
+. doc-end-column-list
+. el \{ .ie "\*[doc-str-El]"item-list" \
+. doc-end-list 0
+. el \{ .ie "\*[doc-str-El]"ohang-list" \
+. doc-end-list 0
+. el \{ .ie "\*[doc-str-El]"inset-list" \
+. doc-end-list 0
+. el \
+. doc-end-list 1
+. \}\}\}\}
+.
+. br
+..
+.
+.
+.\" NS doc-saved-Pa-font global string
+.\" NS saved doc-Pa-font string for section FILES (no underline if
+.\" NS nroff)
+.
+.ds doc-saved-Pa-font
+.
+.
+.\" NS doc-curr-type global register
+.\" NS current argument type
+.
+.nr doc-curr-type 0
+.
+.
+.\" NS doc-curr-arg global string
+.\" NS current argument
+.
+.ds doc-curr-arg
+.
+.
+.\" NS doc-item-boxXXX global box
+.\" NS item boxes associated list depth
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.
+.\" NS It user macro
+.\" NS list item
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-curr-arg
+.\" NS doc-curr-type
+.\" NS doc-in-list
+.\" NS doc-macro-name
+.\" NS doc-num-args
+.\" NS doc-saved-Pa-font
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-It
+.\" NS doc-str-It
+.\" NS doc-XXX-list-type
+.\" NS
+.\" NS width register `It' set in doc-common
+.
+.nr doc-bullet-list-type 1
+.nr doc-column-list-type 0
+.nr doc-dash-list-type 1
+.nr doc-diag-list-type 0
+.nr doc-enum-list-type 1
+.nr doc-hang-list-type 2
+.nr doc-inset-list-type 2
+.nr doc-item-list-type 1
+.nr doc-ohang-list-type 2
+.nr doc-tag-list-type 2
+.
.de It
-.if "\\*(L\\n(lC"" \{\
-. tm Usage .Bl -list-type [-width [string] | -compact | -offset [string]] (#\\n(.c)
-. tm .It \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-.\}
-.\" .tm Here is L[\\n(lC]==\\*(L\\n(lC
-.ne 3v
-.ie \\n(.$>0 \{\
-. ds mN It
-. ds b1
-. nr iD 0
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. if "\\*(L\\n(lC"mL" \{\
-. nr iD 1
-. nr aP 0
-. aX
-. \\*(L\\n(lC
-. \}
-. if "\\*(L\\n(lC"cL" \{\
-. ds b1
-. nr aP 0
-. nr iD 1
-. \\*(L\\n(lC
-. \}
-. if "\\*(L\\n(lC"iT" \{\
-. nr aP 0
-. nr iD 1
-. \\*(L\\n(lC
-. \}
-. if \\n(iD==0 \{\
-. fV
-.\" tm ------------------------------------------------------------------------
-.\" tm It list-type==\\*(L\\n(lC, aP==\\n(aP
-.\" tm It beg arg(A[1])==\\*(A1; oM==\\n(oM; dZ==\\n(dZ; Xt==\\n(Xt; aC==\\n(aC
-. nr oM \\n(oM+1
-. nr tP 1
-. nr aP \\n(aP+1
-. nr tX \\n(C\\n(aP
-. ds tX \\*(A\\n(aP
-. if \\n(nF==1 \{\
-. ds aA \\*(pA
-. if n .ds pA \\*(nO
-. \}
-. ie \\n(C\\n(aP==1 \{\
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr aP \\n(aP-1
-. No
-. \}
-.\" tm in It here is b1==\\*(b1
-.\" tm It mid arg(A[1])==\\*(A1; oM==\\n(oM; dZ==\\n(dZ; Xt==\\n(Xt; aC==\\n(aC
-. ie \\n(Xt==1 .ds xB \&\\*(L\\n(lC
-. el .\\*(L\\n(lC
-. \}
-. nr iD 0
-.\}
-.el .\\*(L\\n(lC
-..
-.\" NS lL macro - .It item of list-type inset
-.de lL
-.lY
-.br
-\&\\*(b1
-.nr oM \\n(oM-1
-.nr tP 0
-.ds b1
-.aY
-'fi
-..
-.\" NS hL macro - .It item of list-type hanging label (as opposed to tagged)
-.de hL
-.lX
-.nr bb \\n(w\\n(lCu+\\n(lSu
-.ti -\\n(bbu
-.ie \w\\*(b1u>=(\\n(w\\n(lCu) \&\\*(b1
-.el \&\\*(b1\h'|\\n(bbu'\c
-.nr oM \\n(oM-1
-.ds b1
-.nr tP 0
-.aY
-'fi
-..
-.\" NS oL macro - .It item of list-type overhanging label
-.de oL
-.lY
-\&\\*(b1
-.br
-.nr oM \\n(oM-1
-.ds b1
-.nr tP 0
-.aY
-'fi
-..
-.\" NS iT macro - .It item of list-type [empty label]
-.de iT
-.lY
-.br
-.\" .ds b1
-.aY
-'fi
-..
-.\" NS nU macro - Enumerated list
-.\" NS nU register count
-.\" NS hU macro - Hyphen paragraph list (sub bullet list)
-.\" NS bU macro - Bullet paragraph list
-.de nU
-.nr oM \\n(oM+1
-.nr nU \\n(nU+1
-.ds b1 \&\\n(nU.
-.uL
-..
-.de bU
-.nr oM \\n(oM+1
-.nr bU \\n(bU+1
-.ds b1 \&\\*(sY\&\(bu\fP
-.uL
-..
-.de hU
-.nr oM \\n(oM+1
-.nr bU \\n(bU+1
-.ds b1 \&\\*(sY\&\-\fP
-.uL
-..
-.\" NS uL macro - .It item of list-type enum/bullet/hyphen
-.de uL
-.lX
-.nr bb \\n(w\\n(lCu+\\n(lSu
-.ti -\\n(bbu
-.ie \w\\*(b1u>=(\\n(w\\n(lCu) \&\\*(b1
-.el \&\\*(b1\h'|\\n(bbu'\c
-.nr oM \\n(oM-1
-.\" .nr dZ \\n(dZ+1
-.ds b1
-.nr tP 0
-.aY
-'fi
-..
-.\" NS mL macro - .It item of list-type diagnostic-message
-.de mL
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ie \\n(mL==1 \{\
-. nr zB \\n(.c
-. ie (\\n(zB-\\n(zA)>1 .Pp
-. el .br
-. nr zA \\n(zB
-. nr zB 0
-.\}
-.el \{\
-. nr zA \\n(.c
-. br
-.\}
-\&\\*(sY\\*(b1\f\\n(cF\s\\n(cZ\\*(lS\c
-.aY
-.ds b1
-'fi
-..
-.\" NS tL macro - .It item of list-type "tag"
-.de tL
-.\" tm in tL here is b1==\\*(b1
-.if \\n(tW==0 .lW
-.lX
-.nr bb \\n(w\\n(lCu+\\n(lSu
-.ti -\\n(bbu
-.ie (\w\\*(b1u)>(\\n(w\\n(lCu) \{\&\\*(b1
-. br
-.\}
-.el \&\\*(b1\h'|\\n(bbu'\c
-.if \\n(nF==1 \{\
-. if n .ds pA \\*(aA
-.\}
-.nr oM \\n(oM-1
-.nr tP 0
-.\" .nr dZ \\n(dZ+1
-.ds b1
-.aY
-'fi
-..
-.\" NS lW macro - resolve unknown label/tag width (if .Bl [inset | tag] only)
-.de lW
-.if !"TagwidtH"\\*(t\\n(lC" \{\
-. ie \\n(tX==1 \{\
-. ds t\\n(lN \\*(tX
-. nr w\\n(lN \\n(\\*(tX
-. \}
-. el \{\
-. ds t\\n(lN No
-. nr w\\n(lN \\n(No
-. \}
-. if !"\\*(t\\n(lC"\\*(t\\n(lN" .nr tC 1
-.\}
-..
-.\" NS lX macro - set up vertical spacing (if compact) and offset+indent (all)
-.de lX
-.ie \\n(tC \{\
-. nr tC 0
-. nr tW 0
-. if \\n(v\\n(lC==0 .sp \\n(dVu
-. in \\n(.iu+\\n(w\\n(lCu+\\n(o\\n(lCu+\\n(lSu
-.\}
-.el \{\
-. ie \\n(v\\n(lC==1 \{\
-. nr aa 0
-. \}
-. el \{\
-. sp \\n(dVu
-. \}
-.\}
-.if !\\n(cR .ne 2v
-..
-.\" NS lY macro - set up vertical spacing (if compact) and offset+indent (all)
-.de lY
-.ie \\n(tC \{\
-. nr tC 0
-. nr tW 0
-. if \\n(v\\n(lC==0 .sp \\n(dVu
-. in \\n(.iu+\\n(o\\n(lCu
-.\}
-.el \{\
-. ie \\n(v\\n(lC==1 \{\
-. nr aa 0
-. \}
-. el \{\
-. sp \\n(dVu
-. \}
-.\}
-.if !\\n(cR .ne 2v
-..
-.\" NS tS temporary string
-.\" NS hL macro - hanging list function
-.\" NS lT macro - tagged list function
-.\" NS lE macro - list end function
-.\" NS tX string (initial string)
-.\" NS tX register (initial class)
-.\" NS tC parameter change flag
-.\" NS Xt save current list-type flag
-.\" NS lC register - list type stack counter
-.\" NS tP register tag flag (for diversions)
-.\" NS w[0-9] register tag stack (nested tags)
-.\" NS t[0-9] register tag string stack (nested tags)
-.\" NS o[0-9] register offset stack (nested tags)
-.\" NS v[0-9] register vertical tag break stack
-.\" NS h[0-9] register horizontal tag stack (continuous if 1, break if 0)
-.nr lC 0
-.nr wV 0
-.nr w1 0
-.nr o1 0
-.nr v1 0
-.nr h1 0
-.ds t\n(lC
-.de lE
-.\" IN lC o[\\n(lC]==\\n(o\\n(lC, w[\\n(lC]==\\n(w\\n(lC,
-.ie \\n(o\\n(lC>0 \{\
-' in \\n(.iu-(\\n(w\\n(lCu)-(\\n(o\\n(lCu)-\\n(lSu
-. rr o\\n(lC
-.\}
-.el 'in \\n(.iu-\\n(w\\n(lCu-\\n(lSu
-.if \\n(lC<=0 .tm Extraneous .El call (#\\n(.c)
-.tZ
-.nr lC \\n(lC-1
-.tY
-..
-.\" NS tY macro - set up next block for list
-.\" NS tZ macro - decrement stack
-.\" NS tY register (next possible lC value)
-.de tY
-.nr tY (\\n(lC+1)
-.nr w\\n(tY 0
-.nr h\\n(tY 0
-.nr o\\n(tY 0
-.ds t\\n(tY \\*(t\\n(lC
-.ds L\\n(tY
-.nr v\\n(tY 0
-..
-.de tZ
-.rm L\\n(tY
-.rr w\\n(tY
-.rr h\\n(tY
-.rr o\\n(tY
-.rm t\\n(tY
-.rr v\\n(tY
-.nr tY \\n(tY-1
-..
-.\" initial values
-.nr w1 0
-.nr o1 0
-.nr h1 0
-.ds t1
-.nr v1 0
-.nr tY 1
-.\" NS Xr macro - cross reference (man page only)
+. ds doc-str-It \*[doc-list-type-stack\n[doc-list-depth]]
+.
+. if "\*[doc-str-It]"" \
+. tm mdoc error: .It without preceding .Bl (#\n[.c])
+.
+. if \n[doc-nesting-level] \{\
+. tmc "mdoc error: .It found in enclosing (e.g. .Ac ... .It ... .Ao)
+. tm1 " (#\n[.c])
+. \}
+.
+. br
+. if !\n[cR] \
+. ne 3v
+.
+. if \n[.$] \{\
+. ds doc-macro-name It
+.
+. \" fill argument vector
+. nr doc-reg-It 1
+. while (\n[doc-reg-It] <= \n[.$]) \{\
+. ds doc-arg\n[doc-reg-It] "\$[\n[doc-reg-It]]
+. nr doc-reg-It +1
+. \}
+.
+. nr doc-num-args \n[.$]
+. nr doc-arg-ptr 0
+. \}
+.
+. nr doc-reg-It \n[doc-\*[doc-str-It]-type]
+.
+. if \n[doc-reg-It] \{\
+. \" start item box
+. box doc-item-box\n[doc-list-depth]
+. ev doc-item-env\n[doc-list-depth]
+. evc 0
+. in 0
+. nf
+. \}
+.
+. ie (\n[doc-reg-It] == 1) \{\
+. if \n[.$] \{\
+. tm1 "mdoc warning: .It requests in lists of type `\*[doc-str-It]'
+. tm1 " don't take arguments (#\n[.c])
+. \}\}
+. el \{\
+. ie \n[.$] \{\
+. if (\n[doc-reg-It] == 2) \{\
+. \" handle list types with arguments
+. doc-parse-arg-vector
+.
+. nr doc-in-list 1
+. nr doc-arg-ptr 1
+. nr doc-curr-type \n[doc-type1]
+. ds doc-curr-arg "\*[doc-arg1]
+.
+. if \n[doc-in-files-section] \{\
+. ds doc-saved-Pa-font "\*[doc-Pa-font]
+. if n \
+. ds doc-Pa-font "\*[doc-No-font]
+. \}
+.
+. ie (\n[doc-type1] == 1) \
+. \*[doc-arg1]
+. el \{\
+. nr doc-arg-ptr 1
+. doc-print-recursive
+. \}\}\}
+. el \{\
+. tm1 "mdoc warning: .It requests in lists of type `\*[doc-str-It]'
+. tm1 " require arguments (#\n[.c])
+. \}
+. \}
+.
+. \" the previous call of `.doc-print-recursive' can contain calls to
+. \" opening requests like `.Ao'; we then defer the call of `doc-xxx-list'
+. if !\n[doc-nesting-level] \
+. doc-\*[doc-str-It]
+..
+.
+.
+.\" NS doc-inset-list macro
+.\" NS .It item of list-type inset
+.\" NS
+.\" NS modifies:
+.\" NS doc-in-list
+.
+.de doc-inset-list
+. \" finish item box
+. br
+. ev
+. box
+. unformat doc-item-box\n[doc-list-depth]
+.
+. doc-set-vertical-and-indent 0
+. br
+.
+. nh
+. doc-item-box\n[doc-list-depth]
+.
+. nr doc-in-list 0
+. doc-reset-args
+..
+.
+.
+.\" NS doc-hang-list macro
+.\" NS .It item of list-type hanging tag (as opposed to tagged)
+.\" NS
+.\" NS modifies:
+.\" NS doc-have-space
+.\" NS doc-in-list
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dhl
+.\" NS doc-reg-dhl1
+.
+.de doc-hang-list
+. \" finish item box
+. br
+. ev
+. box
+. unformat doc-item-box\n[doc-list-depth]
+.
+. doc-set-vertical-and-indent 1
+. nr doc-reg-dhl (\n[doc-list-indent-stack\n[doc-list-depth]]u + \n[doc-digit-width]u)
+. ti -\n[doc-reg-dhl]u
+.
+. nh
+. ie (\n[dl]u > \n[doc-list-indent-stack\n[doc-list-depth]]u) \
+. doc-item-box\n[doc-list-depth]
+. el \{\
+. chop doc-item-box\n[doc-list-depth]
+. nr doc-reg-dhl1 \n[.k]u
+. nop \*[doc-item-box\n[doc-list-depth]]\c
+. nop \h'|(\n[doc-reg-dhl1]u - \n[.k]u + \n[doc-reg-dhl]u)'\c
+. nr doc-have-space 1
+. \}
+.
+. nr doc-in-list 0
+. doc-reset-args
+..
+.
+.
+.\" NS doc-ohang-list macro
+.\" NS .It item of list-type overhanging tag
+.\" NS
+.\" NS modifies:
+.\" NS doc-in-list
+.
+.de doc-ohang-list
+. \" finish item box
+. br
+. ev
+. box
+. unformat doc-item-box\n[doc-list-depth]
+.
+. doc-set-vertical-and-indent 0
+. nh
+. doc-item-box\n[doc-list-depth]
+. br
+.
+. nr doc-in-list 0
+. doc-reset-args
+..
+.
+.
+.\" NS doc-item-list macro
+.\" NS .It item of list-type [empty tag]
+.
+.de doc-item-list
+. \" finish (dummy) item box
+. br
+. ev
+. box
+.
+. doc-set-vertical-and-indent 0
+. br
+.
+. doc-reset-args
+..
+.
+.
+.\" NS doc-enum-list-count-stackXXX global register
+.\" NS stack of current enum count values
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.nr doc-enum-list-count-stack1 0
+.
+.
+.\" NS doc-enum-list macro
+.\" NS enumerated list
+.\" NS
+.\" NS modifies:
+.\" NS doc-enum-list-count-stackXXX
+.\" NS doc-in-list
+.
+.de doc-enum-list
+. nr doc-in-list 1
+. nr doc-enum-list-count-stack\n[doc-list-depth] +1
+\# XXX
+\#.ll \n[doc-list-indent-stack\n[doc-list-depth]]u
+\#.rj
+. nop \*[doc-tag-prefix-stack\n[doc-list-depth]]\c
+. nop \n[doc-enum-list-count-stack\n[doc-list-depth]].\&
+. doc-do-list
+..
+.
+.
+.\" NS doc-bullet-list macro
+.\" NS bullet paragraph list
+.\" NS
+.\" NS modifies:
+.\" NS doc-in-list
+.
+.de doc-bullet-list
+. nr doc-in-list 1
+. nop \)\*[doc-Sy-font]\[bu]\f[P]
+. doc-do-list
+..
+.
+.
+.\" NS doc-dash-list macro
+.\" NS hyphen paragraph list (sub bullet list)
+.\" NS
+.\" NS modifies:
+.\" NS doc-in-list
+.
+.de doc-dash-list
+. nr doc-in-list 1
+. nop \)\*[doc-Sy-font]\-\f[P]
+. doc-do-list
+..
+.
+.
+.\" NS doc-do-list macro
+.\" NS .It item of list-type enum/bullet/hyphen
+.
+.als doc-do-list doc-hang-list
+.
+.
+.\" NS doc-have-diag-list global register (bool)
+.\" NS set if last item was a diag list
+.
+.\" XXX: this should be modified to handle nested lists of any type
+.
+.nr doc-have-diag-list 0
+.
+.
+.\" NS doc-diag-list-input-line-count global register
+.\" NS saved line number to be checked in next diag-list item
+.
+.nr doc-diag-list-input-line-count 0
+.
+.
+.\" NS doc-diag-list macro
+.\" NS .It item of list-type diagnostic-message
+.\" NS
+.\" NS modifies:
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-diag-list-input-line-count
+.
+.de doc-diag-list
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. ie \n[doc-have-diag-list] \{\
+. ie ((\n[.c] - \n[doc-diag-list-input-line-count]) > 1) \
+. doc-paragraph
+. el \
+. br
+. \}
+. el \
+. br
+. nr doc-diag-list-input-line-count \n[.c]
+.
+. nh
+. nop \*[doc-Sy-font]\c
+. if \n[doc-num-args] \
+. doc-remaining-args
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\*[doc-hard-space]\c
+.
+. doc-print-and-reset
+..
+.
+.
+.\" NS doc-tag-list macro
+.\" NS .It item of list-type `tag'
+.\" NS
+.\" NS modifies:
+.\" NS doc-have-space
+.\" NS doc-in-list
+.\" NS
+.\" NS local variables:
+.\" NS doc-box-dtl
+.\" NS doc-reg-dtl
+.\" NS doc-reg-dtl1
+.
+.de doc-tag-list
+. \" finish item box
+. br
+. ev
+. box
+. unformat doc-item-box\n[doc-list-depth]
+.
+. \" we use a box without `.nf' to compute the tag width (via `dl' register)
+. box doc-box-dtl
+. ev doc-env-dtl
+. evc 0
+. fi
+. ad 0
+. in 0
+. doc-item-box\n[doc-list-depth]
+. br
+. ev
+. box
+.
+. if !"TagwidtH"\*[doc-tag-width-stack\n[doc-list-depth]]" \
+. doc-get-tag-width
+. doc-set-vertical-and-indent 1
+. nr doc-reg-dtl (\n[doc-list-indent-stack\n[doc-list-depth]]u + \n[doc-digit-width]u)
+. ti -\n[doc-reg-dtl]u
+.
+. nh
+. ie (\n[dl]u > \n[doc-list-indent-stack\n[doc-list-depth]]u) \{\
+. doc-item-box\n[doc-list-depth]
+. br
+. \}
+. el \{\
+. chop doc-item-box\n[doc-list-depth]
+. nr doc-reg-dtl1 \n[.k]u
+. nop \*[doc-item-box\n[doc-list-depth]]\c
+. nop \h'|(\n[doc-reg-dtl1]u - \n[.k]u + \n[doc-reg-dtl]u)'\c
+. nr doc-have-space 1
+. \}
+.
+. if \n[doc-in-files-section] \
+. if n \
+. ds doc-Pa-font "\*[doc-saved-Pa-font]
+.
+. nr doc-in-list 0
+. doc-reset-args
+..
+.
+.
+.\" NS doc-get-tag-width macro
+.\" NS resolve unknown tag width (`tag' list-type only)
+.\" NS
+.\" NS modifies:
+.\" NS doc-have-indent
+.\" NS doc-list-indent-stackXXX
+.\" NS doc-tag-width-stackXXX
+.\" NS
+.\" NS requires:
+.\" NS doc-curr-arg
+.\" NS doc-curr-type
+.
+.de doc-get-tag-width
+. ie (\n[doc-curr-type] == 1) \{\
+. ds doc-tag-width-stack\n[doc-list-depth] \*[doc-curr-arg]
+. nr doc-list-indent-stack\n[doc-list-depth] \n[\*[doc-curr-arg]]
+. \}
+. el \{\
+. ds doc-tag-width-stack\n[doc-list-depth] No
+. nr doc-list-indent-stack\n[doc-list-depth] \n[No]
+. \}
+..
+.
+.
+.\" NS doc-set-vertical-and-indent macro
+.\" NS set up vertical spacing (if not compact) and indentation (with
+.\" NS offset if argument is non-zero)
+.\" NS
+.\" NS modifies:
+.\" NS doc-have-indent
+.
+.de doc-set-vertical-and-indent
+. ie \n[doc-have-indent] \{\
+. nr doc-have-indent 0
+. if !\n[doc-compact-list-stack\n[doc-list-depth]] \
+. sp \n[doc-display-vertical]u
+. in +\n[doc-list-offset-stack\n[doc-list-depth]]u
+. if \$1 \
+. in +(\n[doc-list-indent-stack\n[doc-list-depth]]u + \n[doc-digit-width]u)
+. \}
+. el \{\
+. if !\n[doc-compact-list-stack\n[doc-list-depth]] \
+. sp \n[doc-display-vertical]u
+. \}
+.
+. if !\n[cR] \
+. ne 2v
+..
+.
+.
+.\" NS doc-list-depth global register
+.\" NS list type stack counter
+.
+.nr doc-list-depth 0
+.
+.
+.\" NS doc-num-columns global register
+.\" NS number of columns
+.
+.nr doc-num-columns 0
+.
+.
+.\" NS doc-compact-list-stackXXX global register (bool)
+.\" NS stack of flags to indicate whether a particular list is compact
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.nr doc-compact-list-stack1 0
+.
+.
+.\" NS doc-tag-prefix-stackXXX global string
+.\" NS stack of tag prefixes (currently used for -nested -enum lists)
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.ds doc-tag-prefix-stack1
+.
+.
+.\" NS doc-tag-width-stackXXX global string
+.\" NS stack of strings indicating how to set up current element of
+.\" NS doc-list-indent-stackXXX -- if set to TagwidtH, user has set it
+.\" NS directly; if it is a macro name, use the macro's width value;
+.\" NS otherwise, `doc-get-tag-width' uses width value of `No'.
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.ds doc-tag-width-stack0
+.ds doc-tag-width-stack1
+.
+.
+.\" NS doc-list-offset-stackXXX global register
+.\" NS stack of list offsets
+.\" NS
+.\" NS limit:
+.\" NS doc-list-depth
+.
+.nr doc-list-offset-stack1 0
+.
+.
+.\" NS doc-end-list macro
+.\" NS list end function; resets indentation (and offset if argument is
+.\" NS non-zero)
+.\" NS
+.\" NS modifies:
+.\" NS doc-list-depth
+.\" NS doc-list-offset-stackXXX
+.
+.de doc-end-list
+. if \$1 \
+' in -(\n[doc-list-indent-stack\n[doc-list-depth]]u + \n[doc-digit-width]u)
+.
+' in -\n[doc-list-offset-stack\n[doc-list-depth]]u
+. nr doc-list-offset-stack\n[doc-list-depth] 0
+.
+. if (\n[doc-list-depth] <= 0) \
+. tm mdoc warning: extraneous .El call (#\n[.c])
+.
+. doc-decrement-list-stack
+. nr doc-list-depth -1
+. doc-increment-list-stack
+..
+.
+.
+.\" NS doc-next-list-depth global register
+.\" NS next possible doc-list-depth value
+.
+.nr doc-next-list-depth 1
+.
+.
+.\" NS doc-increment-list-stack macro
+.\" NS set up next block for list
+.\" NS
+.\" NS modifies:
+.\" NS doc-compact-list-stackXXX
+.\" NS doc-list-indent-stackXXX
+.\" NS doc-list-offset-stackXXX
+.\" NS doc-list-type-stackXXX
+.\" NS doc-next-list-depth
+.\" NS doc-tag-prefix-stackXXX
+.\" NS doc-tag-width-stackXXX
+.\" NS doc-enum-list-count-stackXXX
+.
+.de doc-increment-list-stack
+. nr doc-next-list-depth (\n[doc-list-depth] + 1)
+. nr doc-list-indent-stack\n[doc-next-list-depth] 0
+. nr doc-list-offset-stack\n[doc-next-list-depth] 0
+. ds doc-tag-prefix-stack\n[doc-next-list-depth]
+. ds doc-tag-width-stack\n[doc-next-list-depth] \*[doc-tag-width-stack\n[doc-list-depth]]
+. ds doc-list-type-stack\n[doc-next-list-depth]
+. nr doc-compact-list-stack\n[doc-next-list-depth] 0
+. nr doc-enum-list-count-stack\n[doc-next-list-depth] 0
+..
+.
+.
+.\" NS doc-decrement-list-stack macro
+.\" NS decrement stack
+.\" NS
+.\" NS modifies:
+.\" NS doc-compact-list-stackXXX
+.\" NS doc-list-indent-stackXXX
+.\" NS doc-list-offset-stackXXX
+.\" NS doc-list-type-stackXXX
+.\" NS doc-next-list-depth
+.\" NS doc-tag-prefix-stackXXX
+.\" NS doc-tag-width-stackXXX
+.\" NS doc-enum-list-count-stackXXX
+.
+.de doc-decrement-list-stack
+. ds doc-list-type-stack\n[doc-next-list-depth]
+. nr doc-list-indent-stack\n[doc-next-list-depth] 0
+. nr doc-list-offset-stack\n[doc-next-list-depth] 0
+. ds doc-tag-prefix-stack\n[doc-next-list-depth]
+. ds doc-tag-width-stack\n[doc-next-list-depth]
+. nr doc-compact-list-stack\n[doc-next-list-depth] 0
+. nr doc-enum-list-count-stack\n[doc-next-list-depth] 0
+. nr doc-next-list-depth -1
+..
+.
+.
+.\" NS Xr user macro
+.\" NS cross reference (for man pages only)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-macro-name
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-Xr
+.\" NS
+.\" NS width register `Xr' set in doc-common
+.
.de Xr
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Xr manpage_name [section#] \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Xr
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 .tm Usage: .Xr manpage_name [section#] \\*(Pu (#\\n(.c)
-. el \{\
-. ie \\n(C\\n(aP>2 .y\\n(C\\n(aP
-. el \{\
-. as b1 \&\\*(xR\\*(A\\n(aP\fP\s0
-. if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. if \\n(C\\n(aP==2 \{\
-. as b1 \&(\\*(A\\n(aP)
-. nr aP \\n(aP+1
-. \}
-. if \\n(aC>=\\n(aP \{\
-. c\\n(C\\n(aP
-. \}
-. \}
-. \}
-. aZ
-. \}
-.\}
-..
-.\" NS Sx macro - cross section reference
-.de Sx
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Sx Usage: .Sx Section Header \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Sx
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. as b1 \\*(sX
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS cC macro - column-list end-list
-.\" NS eW macro - column indent width
-.\" NS cI register - column indent width
-.\" NS W[1-5] macro - establish tabs for list-type column
-.de cC
-'in \\n(.iu-\\n(o\\n(lCu-\\n(w\\n(lCu
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.fi
-.tZ
-.nr lC \\n(lC-1
-.tY
-..
-.de W1
-.ta \w\\*(A1 u
-.nr eW \w\\*(A1 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W2
-.ta \w\\*(A1 u +\w\\*(A2 u
-.nr eW \w\\*(A1 u+\w\\*(A2 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W3
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u
-.nr eW \w\\*(A1 u+\w\\*(A2 u+\w\\*(A3 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W4
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u
-.nr eW \w\\*(A1 u+\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W5
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u
-.nr eW \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u
-' in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.\" This is packed abnormally close, intercol width should be an option
-.de W6
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u +\w\\*(A6
-.nr eW \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u +\w\\*(A6
-' in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.\" NS cL macro - column items
-.de cL
-.if \\n(w\\n(lC==0 .nr w\\n(lC \\n(eWu
-.if \\n(.u==0 \{\
-. fi
-' in \\n(.iu+\\n(eWu
-.\}
-.ti -\\n(eWu
-.fV
-.nr aP \\n(aP+1
-.ie \\n(aC>=\\n(aP \{\
-. if "\\*(A\\n(aP"Ta" \{\
-. nr jJ \\n(aP-1
-. rm S\\n(jJ
-. rr jJ
-. \}
-. c\\n(C\\n(aP
-.\}
-.el .tm Usage: .It column_string [Ta [column_string ...] ] (#\\n(.c)
-..
-.\" NS Ta macro - append tab (\t)
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Xr
+. doc-parse-args \$@
+. \}
+. el \
+. doc-Xr-usage
+. \}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. \" first argument must be a string
+. ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. ds doc-arg\n[doc-arg-ptr] \*[doc-Xr-font]\*[doc-arg\n[doc-arg-ptr]]\f[P]\s[0]
+.
+. if (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\
+. nr doc-reg-Xr (\n[doc-arg-ptr] + 1)
+. \" modify second argument if it is a string and
+. \" remove space inbetween
+. if (\n[doc-type\n[doc-reg-Xr]] == 2) \{\
+. ds doc-arg\n[doc-reg-Xr] \*[lp]\*[doc-arg\n[doc-reg-Xr]]\*[rp]
+. ds doc-space\n[doc-arg-ptr]
+. \}
+. \}
+. doc-print-recursive
+. \}
+. el \
+. doc-Xr-usage
+. \}
+. el \
+. doc-Xr-usage
+..
+.
+.
+.\" NS doc-Xr-usage macro
+.
+.de doc-Xr-usage
+. tm Usage: .Xr manpage_name [section#] ... (#\n[.c])
+. doc-reset-args
+..
+.
+.
+.\" NS Sx user macro
+.\" NS cross section reference
+.\" NS
+.\" NS width register `Sx' set in doc-common
+.
+.als Sx doc-generic-macro
+.ds doc-Sx-usage section_header
+.
+.
+.\" NS doc-end-column-list macro
+.\" NS column-list end-list
+.\" NS
+.\" NS modifies:
+.\" NS doc-list-depth
+.
+.de doc-end-column-list
+. linetabs 0
+' in -(\n[doc-list-offset-stack\n[doc-list-depth]]u + \n[doc-list-indent-stack\n[doc-list-depth]]u)
+. ta T .5i
+. fi
+. doc-decrement-list-stack
+. nr doc-list-depth -1
+. doc-increment-list-stack
+..
+.
+.
+.\" NS doc-column-indent-width global register
+.\" NS holds the indent width for a column list
+.
+.nr doc-column-indent-width 0
+.
+.
+.\" NS doc-set-column-tab macro
+.\" NS establish tabs for list-type column: `.doc-set-column-tab num_cols'
+.\" NS
+.\" NS modifies:
+.\" NS doc-column-indent-width
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dsct
+.\" NS doc-str-dsct
+.\" NS doc-str-dsct1
+.
+.de doc-set-column-tab
+. ds doc-str-dsct
+. nr doc-reg-dsct 1
+. nr doc-column-indent-width 0
+.
+. ie (\$1 < 5) \
+. ds doc-str-dsct1 " \"
+. el \{\
+. ie (\$1 == 5) \
+. ds doc-str-dsct1 " \"
+. el \{\
+. \" XXX: this is packed abnormally close -- intercolumn width
+. \" should be configurable
+. ds doc-str-dsct1 " \"
+. \}\}
+.
+. while (\n[doc-reg-dsct] <= \$1) \{\
+. as doc-str-dsct " +\w\*[doc-arg\n[doc-reg-dsct]]\*[doc-str-dsct1]u
+. nr doc-column-indent-width +\w\*[doc-arg\n[doc-reg-dsct]]\*[doc-str-dsct1]u
+. nr doc-reg-dsct +1
+. \}
+.
+. ta \*[doc-str-dsct]
+' in +(\n[doc-column-indent-width]u + \n[doc-list-offset-stack\n[doc-list-depth]]u)
+..
+.
+.
+.\" NS doc-column-list macro
+.\" NS column items
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-list-indent-stackXXX
+.\" NS doc-spaceXXX
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dcl
+.
+.de doc-column-list
+. if \n[doc-num-args] \
+. doc-parse-arg-vector
+. nr doc-arg-ptr +1
+.
+. if (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. tm Usage: .It column_string [Ta [column_string ...] ] (#\n[.c])
+. return
+. \}
+.
+. if "\*[doc-arg\n[doc-arg-ptr]]"Ta" \{\
+. nr doc-reg-dcl (\n[doc-arg-ptr] - 1)
+. ds doc-space\n[doc-reg-dcl]
+. \}
+.
+. if !\n[doc-list-indent-stack\n[doc-list-depth]] \
+. nr doc-list-indent-stack\n[doc-list-depth] \n[doc-column-indent-width]u
+. if !\n[.u] \{\
+. fi
+' in +\n[doc-column-indent-width]u
+. \}
+. ti -\n[doc-column-indent-width]u
+.
+. doc-do-\n[doc-type\n[doc-arg-ptr]]
+..
+.
+.
+.\" NS Ta user macro
+.\" NS append tab (\t)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS
+.\" NS width register `Ta' set in doc-common
+.
.de Ta
-.ie \\n(aC>0 \{\
-. nr aP \\n(aP+1
-. ie \\n(aC>=\\n(aP \{\
-. if "\\*(A\\n(aP"Ta" \{\
-. nr jJ \\n(aP-1
-. rm S\\n(jJ
-. rr jJ
-. \}
-. as b1 \\t
-. c\\n(C\\n(aP
-. \}
-. el \{\
-. as b1 \\t\\c
-. rm S\\n(aP
-. pB
-. aY
-.\" . ds b1
-. \}
-.\}
-.el \{\
-. tm Usage: Ta must follow column entry: e.g. (#\\n(.c)
-. tm .It column_string [Ta [column_string ...] ]
-.\}
-..
-.\"
-.\" NS Dl macro - display (one line) literal
+. ie \n[doc-arg-limit] \{\
+. nr doc-arg-ptr +1
+. nop \*[doc-tab]\c
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
+. doc-do-\n[doc-type\n[doc-arg-ptr]]
+. el \
+. doc-reset-args
+. \}
+. el \{\
+. tm1 "Usage: Ta must follow column entry: e.g.
+. tm1 " .It column_string [Ta [column_string ...]] (#\n[.c])
+. \}
+..
+.
+.
+.\" NS Dl user macro
+.\" NS display (one line) literal
+.\" NS
+.\" NS this function uses the `Li' font
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Dl' set in doc-common
+.
.de Dl
-'ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.in \\n(.iu+\\n(Dsu
-.ie \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. tm Usage: .Dl argument ... (#\\n(.c)
-. \}
-. el \{\
-. ds mN Dl
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. Li
-. \}
-.\}
-.el \{\
-. tm Usage: .Dl not callable by other macros (#\\n(.c)
-.\}
-.in \\n(.iu-\\n(Dsu
-..
-.\"
-.\" NS D1 macro - display (one line)
+' ta T .5i
+. in +\n[doc-display-indent]u
+.
+. ie \n[doc-arg-limit] \{\
+. tm Usage: .Dl not callable by other macros (#\n[.c])
+. doc-reset-args
+. \}
+. el \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Dl
+. doc-parse-args \$@
+. nr doc-arg-ptr 1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Li-font]\c
+. doc-print-recursive
+. \}
+. el \
+. tm Usage: .Dl argument ... (#\n[.c])
+. \}
+.
+. in -\n[doc-display-indent]u
+..
+.
+.
+.\" NS D1 user macro
+.\" NS display (one line)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `D1' set in doc-common
+.
.de D1
-'ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.in \\n(.iu+\\n(Dsu
-.ie \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. tm Usage: .D1 argument ... (#\\n(.c)
-. \}
-. el \{\
-. ds mN D1
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 .\\*(A\\n(aP
-. el .No
-. \}
-.\}
-.el \{\
-. tm Usage: .D1 not callable by other macros (#\\n(.c)
-.\}
-.in \\n(.iu-\\n(Dsu
-..
-.\" NS Ex macro - DEFUNCT
-.de Ex
-.tm Ex defunct, Use .D1: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"
-.\" NS Ex macro - DEFUNCT
+' ta T .5i
+. in +\n[doc-display-indent]u
+.
+. ie \n[doc-arg-limit] \{\
+. tm Usage: .D1 not callable by other macros (#\n[.c])
+. doc-reset-args
+. \}
+. el \{\
+. ie \n[.$] \{\
+. ds doc-macro-name D1
+. doc-parse-args \$@
+. nr doc-arg-ptr 1
+. doc-print-recursive
+. \}
+. el \
+. tm Usage: .D1 argument ... (#\n[.c])
+. \}
+.
+. in -\n[doc-display-indent]u
+..
+.
+.
+.\" NS Ex user macro
+.\" NS defunct
+.
.de Ex
-.tm Ex defunct, Use .D1: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"
-.\" NS Vt macro - Variable type (for forcing old style variable declarations)
-.\" this is not done in the same manner as .Ot for fortrash - clean up later
+. tm mdoc error: .Ex defunct, use .D1: \$@ (#\n[.c])
+..
+.
+.
+.\" NS Vt user macro
+.\" NS variable type (for forcing old style variable declarations);
+.\" NS this is not done in the same manner as .Ot for fortrash --
+.\" NS clean up later
+.\" NS
+.\" NS modifies:
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-have-decl
+.\" NS doc-have-var
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Vt' set in doc-common
+.
.de Vt
-.\" if a function declaration was the last thing given, want vertical space
-.if \\n(fD>0 \{\
-. Pp
-. nr fD 0
-.\}
-.\" if a subroutine was the last thing given, want vertical space
-.if \\n(fZ>0 \{\
-. ie \\n(fX==0 \{\
-. Pp
-. rs
-. \}
-. el .br
-.\}
-.nr fX \\n(fX+1
-.nr cF \\n(.f
-.nr cZ \\n(.s
-\\*(fT\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ie \\n(oT==0 .br
-.el \&\ \&
-.ft \\n(cF
-.fs \\n(cZ
-..
-.\"
-.\" NS Ft macro - Function type
-.nr fZ 0
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Vt
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Vt variable_type ... (#\n[.c])
+. \}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. if (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. tm Usage: .Vt variable_type ... (#\n[.c])
+. doc-reset-args
+. return
+. \}
+.
+. if \n[doc-in-synopsis-count] \{\
+. \" if a function declaration was the last thing given,
+. \" want vertical space
+. if \n[doc-have-decl] \{\
+. doc-paragraph
+. nr doc-have-decl 0
+. \}
+.
+. \" if a subroutine was the last thing given, want vertical space
+. if \n[doc-have-func] \{\
+. ie \n[doc-have-var] \
+. br
+. el \{\
+. doc-paragraph
+. rs
+. \}\}
+.
+. nr doc-have-var 1
+. \}
+.
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Ft-font]\c
+. doc-print-recursive
+.
+. if \n[doc-in-synopsis-count] \{\
+. ie \n[doc-have-old-func] \
+. nop \*[doc-soft-space]\c
+. el \
+. br
+. \}
+..
+.
+.
+.\" NS doc-is-func global register (bool)
+.\" NS set if subroutine (in synopsis only) (fortran only)
+.
+.nr doc-is-func 0
+.
+.
+.\" NS Ft user macro
+.\" NS function type
+.\" NS
+.\" NS modifies:
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-have-decl
+.\" NS doc-have-var
+.\" NS doc-is-func
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Ft' set in doc-common
+.
.de Ft
-.if \\n(nS>0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fX 0
-. \}
-. nr fY 1
-.\}
-.nr cF \\n(.f
-.nr cZ \\n(.s
-\&\\*(fT\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ft \\n(cF
-.fs \\n(cZ
-.\" .br
-..
-.\"
-.\" NS Ot macro - Old Function type (fortran - no newline)
-.\" Ns oT register
-.nr oT 0
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Ft
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Ft function_type ... (#\n[.c])
+. \}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. if (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. tm Usage: .Ft function_type ... (#\n[.c])
+. doc-reset-args
+. return
+. \}
+.
+. if \n[doc-in-synopsis-count] \{\
+. if (\n[doc-have-func] : \n[doc-have-decl]) \{\
+. doc-paragraph
+. nr doc-have-decl 0
+. nr doc-have-var 0
+. \}
+.
+. if \n[doc-have-var] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. \}
+.
+. nr doc-is-func 1
+. \}
+.
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Ft-font]\c
+. doc-print-recursive
+..
+.
+.
+.\" NS doc-have-old-func global register (bool)
+.\" NS set if `Ot' has been called
+.
+.nr doc-have-old-func 0
+.
+.
+.\" NS Ot user macro
+.\" NS old function type (fortran -- no newline)
+.\" NS
+.\" NS modifies:
+.\" NS doc-have-decl
+.\" NS doc-have-old-func
+.\" NS doc-have-var
+.\" NS doc-is-func
+.\" NS
+.\" NS width register `Ot' set in doc-common
+.
.de Ot
-.nr oT 1
-.if \\n(nS>0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fX 0
-. \}
-. nr fY 1
-.\}
-.if \\n(.$==4 .as b1 \&\\*(fT\&\\$1 \\$2 \\$3 \\$4
-.if \\n(.$==3 .as b1 \&\\*(fT\&\\$1 \\$2 \\$3
-.if \\n(.$==2 .as b1 \&\\*(fT\&\\$1 \\$2
-.if \\n(.$==1 .as b1 \&\\*(fT\&\\$1
-.as b1 \&\ \fP
-..
-.\"
-.\" NS Fa macro - Function arguments
+. nr doc-have-old-func 1
+.
+. if \n[doc-in-synopsis-count] \{\
+. if (\n[doc-have-func] : \n[doc-have-decl]) \{\
+. doc-paragraph
+. nr doc-have-decl 0
+. nr doc-have-var 0
+. \}
+.
+. if \n[doc-have-var] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. \}
+.
+. nr doc-is-func 1
+. \}
+.
+. if \n[.$] \
+. nop \*[doc-Ft-font]\$*\c
+. nop \ \f[P]\c
+..
+.
+.
+.\" NS Fa user macro
+.\" NS function arguments
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Fa' set in doc-common
+.
.de Fa
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fa Function Arguments ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Fa
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.ie \\n(fC>0 \{\
-. fC
-.\}
-.el \{\
-. if \\n(aC>\\n(aP \{\
-. as b1 \\*(fA
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-. if \\n(nS>0 \{\
-. if \\n(fZ>0 .br
-. \}
-. \}
-.\}
-..
-.\" NS fC macro - interal .Fa for .FO and .Fc
-.de fC
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-.\" . nr aa \\n(aP
-.\" . if \\n(nS>0 \{\
-. ds Fb
-. nr fB 0
-. nr Fb 0
-. fB \\*(A\\n(aP
-. if \\n(fB>1 \{\
-. rm A\\n(aP
-. rn Fb A\\n(aP
-. \}
-.\" . \}
-. if \\n(fC>1 \{\
-. as b1 \&\f\\n(cF\s\\n(cZ,\\*(S\\n(aP\\*(fA\\*(A\\n(aP\fP\s0
-.\" . as b1 \&\\,\\*(S\\n(aP\fP\s0\\*(fA\\*(A\\n(aP\fP\s0
-. \}
-. if \\n(fC==1 \{\
-. as b1 \&\|\\*(fA\\*(A\\n(aP\fP\s0
-. \}
-. nr fC \\n(fC+1
-. fC
-.\}
-.el \{\
-. aY
-.\}
-..
-.\" NS Fn macro - functions
-.\" NS fY register - dick with old style function declarations (fortran)
-.\" NS fZ register - break a line when more than one function in a synopsis
-.\"
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Fa
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Fa function_arguments ... (#\n[.c])
+. \}
+.
+. ie \n[doc-func-arg-count] \
+. doc-do-func
+. el \{\
+. nr doc-arg-ptr +1
+. if (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Fa-font]\c
+. doc-print-recursive
+.
+. if \n[doc-in-synopsis-count] \
+. if \n[doc-have-func] \
+. br
+. \}\}
+..
+.
+.
+.\" NS doc-func-arg-count global register
+.\" NS how many function arguments have been processed so far
+.
+.nr doc-func-arg-count 0
+.
+.
+.\" NS doc-func-arg global string
+.\" NS work buffer for function name strings
+.
+.ds doc-func-arg
+.
+.
+.\" NS doc-num-func-args global register
+.\" NS number of function arguments
+.
+.nr doc-num-func-args 0
+.
+.
+.\" NS doc-func-args-processed global register
+.\" NS function arguments processed so far
+.
+.nr doc-func-args-processed 0
+.
+.
+.\" NS doc-do-func macro
+.\" NS internal .Fa for .Fc
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-func-arg
+.\" NS doc-func-arg-count
+.\" NS doc-func-args-processed
+.\" NS doc-num-func-args
+.
+.de doc-do-func
+. if (\n[doc-arg-limit] <= \n[doc-arg-ptr]) \{\
+. doc-reset-args
+. return
+. \}
+.
+. nr doc-arg-ptr +1
+.
+. ds doc-func-arg
+. nr doc-num-func-args 0
+. nr doc-func-args-processed 0
+.
+. doc-build-func-string \*[doc-arg\n[doc-arg-ptr]]
+. if (\n[doc-num-func-args] > 1) \
+. ds doc-arg\n[doc-arg-ptr] "\*[doc-func-arg]
+.
+. if (\n[doc-func-arg-count] > 1) \{\
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\|,\)\c
+. nop \)\*[doc-space\n[doc-arg-ptr]]\*[doc-Fa-font]\c
+. nop \)\*[doc-arg\n[doc-arg-ptr]]\f[P]\s[0]\c
+. \}
+.
+. if (\n[doc-func-arg-count] == 1) \{\
+. nop \|\*[doc-Fa-font]\*[doc-arg\n[doc-arg-ptr]]\c
+. nop \f[P]\s[0]\c
+. \}
+. nr doc-func-arg-count +1
+. doc-do-func
+..
+.
+.
+.\" NS doc-have-func global register (bool)
+.\" NS whether we have more than one function in synopsis
+.
+.nr doc-have-func 0
+.
+.
+.\" NS Fn user macro
+.\" NS functions
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-have-decl
+.\" NS doc-have-func
+.\" NS doc-have-var
+.\" NS doc-in-synopsis-count
+.\" NS doc-indent-synopsis
+.\" NS doc-is-func
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Fn' set in doc-common
+.
.de Fn
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fn function_name function_arg(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Fn
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(nS>0 \{\
-.\" if there is/has been more than one subroutine declaration
-. if \\n(fY==0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fX 0
-. nr fD 0
-. \}
-. \}
-. if \\n(fY==1 \{\
-. br
-. nr fX 0
-. nr fD 0
-. nr fY 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fD 0
-. \}
-. nr fZ \\n(fZ+1
-. nr fY 0
-. rs
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 \{\
-. nr iS ((8)*\\n(fW)u
-. \}
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. as b1 \\*(fN\\*(A\\n(aP\fP\s0\\*(lp
-. ie \\n(aC>\\n(aP \{\
-. as b1 \\*(fA
-. nr aP \\n(aP+1
-. f\\n(C\\n(aP
-. \}
-. el \{\
-. as b1 \|\\*(rp
-. aZ
-. \}
-. if \\n(nS>0 \{\
-. in -\\n(iSu
-. \}
-.\}
-..
-.\"
-.\" NS f1 macro - class switch
-.\" NS f2 macro - handle function arguments
-.\" NS f3 macro - punctuation
-.\" NS f4 macro - write out function
-.de f1
-.as b1 \\*(rp\f\\n(cF\s\\n(cZ
-.\\*(A\\n(aP
-..
-.de f2
-.if \\n(nS>0 \{\
-. ds Fb
-. nr fB 0
-. nr Fb 0
-. fB \\*(A\\n(aP
-. if \\n(fB>1 \{\
-. rm A\\n(aP
-. rn Fb A\\n(aP
-. \}
-.\}
-.as b1 \\*(A\\n(aP
-.ie \\n(aC>\\n(aP \{\
-. nr aa \\n(aP
-. nr aP \\n(aP+1
-. if \\n(C\\n(aP==2 \{\
-. as b1 \&\|\f\\n(cF\s\\n(cZ,\\*(S\\n(aa\fP\s0\|
-. \}
-. f\\n(C\\n(aP
-.\}
-.el \{\
-. as b1 \\*(rp\f\\n(cF\s\\n(cZ
-. aZ
-.\}
-..
-.de f3
-.as b1 \\*(rp\f\\n(cF\s\\n(cZ\\*(A\\n(aP
-.ie \\n(aC>\\n(aP \{\
-. No
-.\}
-.el .aZ
-..
-.de f4
-.as b1 \\*(rp\f\\n(cF\s\\n(cZ\\*(S\\n(aP\\*(A\\n(aP
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. No
-.\}
-.el .aZ
-..
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Fn
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Fn function_name [function_arg] ... (#\n[.c])
+. \}
+.
+. if \n[doc-in-synopsis-count] \{\
+. \" if there is/has been more than one subroutine declaration
+. ie \n[doc-is-func] \{\
+. br
+. nr doc-have-var 0
+. nr doc-have-decl 0
+. nr doc-is-func 0
+. \}
+. el \{\
+. if \n[doc-have-func] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. nr doc-have-decl 0
+. \}\}
+.
+. if \n[doc-have-decl] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. \}
+.
+. if \n[doc-have-var] \{\
+. doc-paragraph
+. nr doc-have-decl 0
+. \}
+.
+. nr doc-have-func 1
+. nr doc-is-func 0
+. rs
+.
+. ie (\n[doc-in-synopsis-count] > 1) \
+. br
+. el \{\
+. if !\n[doc-indent-synopsis] \
+. nr doc-indent-synopsis (8u * \n[doc-fixed-width]u)
+. \}
+.
+. in +\n[doc-indent-synopsis]u
+. ti -\n[doc-indent-synopsis]u
+. nr doc-in-synopsis-count +1
+. \}
+.
+. if !\n[doc-arg-limit] \
+. return
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. if (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
+. tm Usage: .Fn function_name [function_arg] ... (#\n[.c])
+. doc-reset-args
+. return
+. \}
+.
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. nop \*[doc-Fn-font]\*[doc-arg\n[doc-arg-ptr]]\c
+. nop \f[P]\s[0]\*[lp]\)\c
+.
+. nr doc-arg-ptr +1
+. if (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. if (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
+. nop \*[doc-Fa-font]\c
+. doc-do-func-args
+. nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. \}\}
+.
+. nop \)\*[rp]\)\c
+.
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. \" output the space (if needed)
+. nr doc-arg-ptr -1
+. nop \)\*[doc-space\n[doc-arg-ptr]]\c
+. nr doc-arg-ptr +1
+.
+. doc-print-recursive
+. \}
+. el \
+. doc-print-and-reset
+.
+. if \n[doc-in-synopsis-count] \
+. in -\n[doc-indent-synopsis]u
+..
+.
+.
+.\" NS doc-do-func-args macro
+.\" NS handle function arguments
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-argXXX
+.\" NS doc-func-arg
+.\" NS doc-func-args-processed
+.\" NS doc-num-func-args
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-ddfa
+.
+.de doc-do-func-args
+. if \n[doc-in-synopsis-count] \{\
+. ds doc-func-arg
+. nr doc-num-func-args 0
+. nr doc-func-args-processed 0
+.
+. doc-build-func-string \*[doc-arg\n[doc-arg-ptr]]
+. if (\n[doc-num-func-args] > 1) \
+. ds doc-arg\n[doc-arg-ptr] "\*[doc-func-arg]
+. \}
+.
+. nop \)\*[doc-arg\n[doc-arg-ptr]]\c
+. nr doc-arg-ptr +1
+.
+. if (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. if (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
+. nr doc-reg-ddfa (\n[doc-arg-ptr] - 1)
+. nop \|\f[\n[doc-curr-font]]\s[\n[doc-curr-size]u],\)\c
+. nop \)\*[doc-space\n[doc-reg-ddfa]]\f[P]\s[0]\|\c
+. doc-do-func-args
+. \}\}
+..
+.
+.
+.\" NS doc-saved-nesting-level global register
+.
+.nr doc-saved-nesting-level 0
+.
+.
+.\" NS doc-in-func-enclosure global register (bool)
+.
+.nr doc-in-func-enclosure 0
+.
+.
+.\" NS Fo user macro
+.\" NS function open
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-func-arg-count
+.\" NS doc-have-decl
+.\" NS doc-have-func
+.\" NS doc-have-var
+.\" NS doc-in-func-enclosure
+.\" NS doc-in-synopsis-count
+.\" NS doc-indent-synopsis
+.\" NS doc-is-func
+.\" NS doc-macro-name
+.\" NS doc-saved-nesting-level
+.\" NS
+.\" NS width register `Fo' set in doc-common
+.
.de Fo
-.hy 0
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fo function_name
-. el \{\
-. ds mN Fo
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(nS>0 \{\
-.\" if there is/has been more than one subroutine declaration
-. if \\n(fY==0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fX 0
-. nr fD 0
-. \}
-. \}
-. if \\n(fY==1 \{\
-. br
-. nr fX 0
-. nr fD 0
-. nr fY 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fD 0
-. \}
-. nr fZ \\n(fZ+1
-. nr fY 0
-. rs
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 \{\
-. nr iS ((8)*\\n(fW)u
-. \}
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr oM \\n(oM+1
-. nr fC 1
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. as b1 \\*(fN\\*(A\\n(aP\fP\s0\\*(lp
-. aY
-.\}
-..
+. if (\n[doc-in-func-enclosure]) \{\
+. tm mdoc error: .Fo/.Fc can't be nested (#\n[.c])
+. return
+. \}
+.
+. nr doc-saved-nesting-level \n[doc-nesting-level]
+. nr doc-in-func-enclosure 1
+.
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ds doc-macro-name Fo
+. doc-parse-args \$@
+. \}
+. el \
+. tm Usage: .Fo function_name (#\n[.c])
+. \}
+.
+. if \n[doc-in-synopsis-count] \{\
+. \" if there is/has been more than one subroutine declaration
+. ie \n[doc-is-func] \{\
+. br
+. nr doc-have-var 0
+. nr doc-have-decl 0
+. nr doc-is-func 0
+. \}
+. el \{\
+. if \n[doc-have-func] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. nr doc-have-decl 0
+. \}\}
+.
+. if \n[doc-have-decl] \{\
+. doc-paragraph
+. nr doc-have-var 0
+. \}
+.
+. if \n[doc-have-var] \{\
+. doc-paragraph
+. nr doc-have-decl 0
+. \}
+.
+. nr doc-have-func 1
+. nr doc-is-func 0
+. rs
+.
+. ie (\n[doc-in-synopsis-count] > 1) \
+. br
+. el \{\
+. if !\n[doc-indent-synopsis] \
+. nr doc-indent-synopsis (8u * \n[doc-fixed-width]u)
+. \}
+.
+. nr doc-in-synopsis-count +1
+. \}
+.
+. \" start function box
+. box doc-func-box
+. ev doc-func-env
+. evc 0
+. in 0
+. nf
+.
+. nr doc-arg-ptr +1
+. doc-print-prefixes
+. if (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-func-arg-count 1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. nop \*[doc-Fn-font]\*[doc-arg\n[doc-arg-ptr]]\c
+. nop \f[P]\s[0]\*[lp]\)\c
+. doc-reset-args
+. \}
+..
+.
+.
+.\" NS Fc user macro
+.\" NS function close
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-func-arg-count
+.\" NS doc-in-func-enclosure
+.\" NS doc-saved-nesting-level
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `Fc' set in doc-common
+.
.de Fc
-.if \\n(aC==0 \{\
-. if \\n(.$>0 \{\
-. ds mN Fo
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.nr fC 0
-.nr oM \\n(oM-1
-.as b1 \|\\*(rp
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. \\*(A\\n(aP
-.\}
-.el \{\
-. aZ
-.\}
-.if \\n(nS>0 \{\
-. in -\\n(iSu
-.\}
-.hy
-..
-.\" NS fb macro - if SYNOPSIS, set hard space inbetween function args
-.\" NS fb register - count of words in a function argument
-.\" NS Fb register - counter
-.\" NS Fb string - temporary string
-.de fB
-.\" .tm fB==\\n(fB, Fb==\\n(Fb, 1==\\$1 2==\\$2 3==\\$3 4==\\$4 5==\\$5 6==\\$6
-.if \\n(fB==0 \{\
-. nr fB \\n(.$
-. nr Fb 0
-. ds Fb
-.\}
-.nr Fb \\n(Fb+1
-.as Fb \&\\$1
-.if \\n(Fb<\\n(fB \{\
-. as Fb \&\\*(hV
-. fB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-..
-.\" NS Fc - Function close - not implemented yet
-.\" NS Fo - Function open - not implemented yet
-.\"
-.\" Very crude references, stash all reference info into strings (usual
-.\" use of b1 buffer, then b1 contents copied to string of retrievable
-.\" naming convention), print out reference on .Re request and clean up.
-.\" Ordering very limited, no fancy citations, but can do articles, journals
-.\" and books - need to add several missing options (like city etc).
-.\" should be able to grab a refer entry, massage it a wee bit (prefix
-.\" a `.' to the %[A-Z]) and not worry (ha!)
-.\"
-.\" NS Rs macro - Reference Start
-.\" NS rS register - Reference Start flag
-.\" NS rS string - Reference Start buffer name for next save (of b1 buffer)
+. if !\n[doc-in-func-enclosure] \{\
+. tm mdoc warning: Extraneous .Fc (#\n[.c])
+. return
+. \}
+.
+. if \n[.$] \{\
+. ds doc-macro-name Fc
+. \" the first (dummy) argument is used to get the correct spacing
+. doc-parse-args \) \$@
+. \}
+.
+. if !(\n[doc-saved-nesting-level] == \n[doc-nesting-level]) \
+. tm mdoc warning: Unbalanced enclosure commands within .Fo/.Fc
+.
+. nr doc-func-arg-count 0
+. nr doc-in-func-enclosure 0
+.
+. nop \|\*[rp]\)
+.
+. \" finish function box
+. br
+. ev
+. box
+. chop doc-func-box
+. unformat doc-func-box
+.
+. if \n[doc-in-synopsis-count] \{\
+. in +\n[doc-indent-synopsis]u
+. ti -\n[doc-indent-synopsis]u
+. \}
+.
+. nh
+. nop \*[doc-func-box]\c
+.
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. doc-print-recursive
+. \}
+. el \
+. doc-print-and-reset
+.
+. if \n[doc-in-synopsis-count] \
+. in -\n[doc-indent-synopsis]u
+..
+.
+.
+.\" NS doc-build-func-string macro
+.\" NS collect function arguments and set hard spaces inbetween
+.\" NS
+.\" NS modifies:
+.\" NS doc-func-arg
+.\" NS doc-func-args-processed
+.\" NS doc-num-func-args
+.
+.de doc-build-func-string
+. if !\n[doc-num-func-args] \{\
+. nr doc-num-func-args \n[.$]
+. nr doc-func-args-processed 0
+. ds doc-func-arg
+. \}
+.
+. nr doc-func-args-processed +1
+. as doc-func-arg "\$1
+.
+. if (\n[doc-func-args-processed] < \n[doc-num-func-args]) \{\
+. as doc-func-arg "\*[doc-hard-space]
+.
+. shift
+. doc-build-func-string \$@
+. \}
+..
+.
+.
+.\" Very crude references: Stash all reference info into boxes, print out
+.\" reference on .Re request and clean up. Ordering very limited, no fancy
+.\" citations, but can do articles, journals, and books -- need to add
+.\" several missing options (like city etc). Should be able to grab a refer
+.\" entry, massage it a wee bit (prefix a `.' to the %[A-Z]) and not worry
+.\" (ha!).
+.
+.
+.\" NS doc-is-reference global register (bool)
+.\" NS set if in reference
+.
+.nr doc-is-reference 0
+.
+.
+.\" NS doc-reference-count global register
+.\" NS reference element counter
+.
+.nr doc-reference-count 0
+.
+.
+.\" NS Rs user macro
+.\" NS reference start
+.\" NS
+.\" NS modifies:
+.\" NS doc-is-reference
+.\" NS doc-reference-count
+.\" NS
+.\" NS width register `Rs' set in doc-common
+.
.de Rs
-.nr rS 1
-.rC
-.if \\n(nA==1 .Pp
-.nr Kl 0
-..
-.\" NS Re macro - Reference End
+. ie \n[.$] \
+. tm Usage: .Rs (does not take arguments) (#\n[.c])
+. el \{\
+. nr doc-is-reference 1
+. doc-reset-reference
+. if \n[doc-in-see-also-section] \
+. doc-paragraph
+. nr doc-reference-count 0
+. \}
+..
+.
+.
+.\" NS Re user macro
+.\" NS reference end
+.\" NS
+.\" NS modifies:
+.\" NS doc-is-reference
+.\" NS
+.\" NS width register `Re' set in doc-common
+.
.de Re
-.rZ
-.rC
-.nr rS 0
-..
-.\" NS rC macro - reference cleanup
-.de rC
-.nr uK 0
-.nr jK 0
-.nr nK 0
-.nr oK 0
-.nr qK 0
-.nr rK 0
-.nr tK 0
-.nr vK 0
-.nr dK 0
-.nr pK 0
-.nr bK 0
-.ds rS
-.rm U1 U2 U3 U4 U5 U6 U7 U8
-.rm uK jK nK oK rK qK tK vK dK pK bK
-..
-.\" NS rZ macro - reference print
-.de rZ
-.if \\n(uK \{\&\\*(U1,
-. nr aK 1
-. if (\\n(uK>1 \{\
-. aK
-. \}
-. nr Kl -\\n(uK
-.\}
-.if \\n(tK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \{\
-. ie (\\n(jK==1):(\\n(bK==1) \{\&\\*q\\*(tK\\*q.
-. \}
-. el \{\&\\*(eM\\*(tK\\*(nO.
-. \}
-. \}
-. if \\n(Kl>0 \{\
-. ie (\\n(jK==1):(\\n(bK==1) \{\&\\*q\\*(tK\\*q,
-. \}
-. el \{\&\\*(eM\\*(tK\\*(nO,
-. \}
-. \}
-.\}
-.if \\n(bK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(eM\\*(bK\\*(nO.
-. if \\n(Kl>0 \&\\*(eM\\*(bK\\*(nO,
-.\}
-.if \\n(jK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(eM\\*(jK\\*(nO.
-. if \\n(Kl>0 \&\\*(eM\\*(jK\\*(nO,
-.\}
-.if \\n(rK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(rK.
-. if \\n(Kl>0 \&\\*(rK,
-.\}
-.if \\n(nK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(nK.
-. if \\n(Kl>0 \&\\*(nK,
-.\}
-.if \\n(vK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(vK.
-. if \\n(Kl>0 \&\\*(vK,
-.\}
-.if \\n(pK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(pK.
-. if \\n(Kl>0 \&\\*(pK,
-.\}
-.if \\n(qK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(qK.
-. if \\n(Kl>0 \&\\*(qK,
-.\}
-.if \\n(dK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(dK.
-. if \\n(Kl>0 \&\\*(dK,
-.\}
-.if \\n(oK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(oK.
-. if \\n(Kl>0 \&\\*(oK,
-.\}
-.if \\n(Kl>0 .tm unresolved reference problem
-..
-.\" NS aK macro - print out reference authors
-.de aK
-.nr aK \\n(aK+1
-.ie (\\n(uK-\\n(aK)==0 \{\&and \\*(U\\n(aK,
-.\}
-.el \{\&\\*(U\\n(aK,
-. aK
-.\}
-..
-.\" NS %A macro - reference author(s)
-.\" NS uK register - reference author(s) counter
-.\" NS U[1-9] strings - reference author(s) names
+. ie \n[.$] \
+. tm Usage: .Re (does not take arguments) (#\n[.c])
+. el \{\
+. doc-print-reference
+. doc-reset-reference
+. nr doc-is-reference 0
+. \}
+..
+.
+.
+.\" NS doc-reset-reference macro
+.\" NS reference cleanup
+.\" NS
+.\" NS modifies:
+.\" NS doc-author-count
+.\" NS doc-author-nameXXX
+.\" NS doc-book-count
+.\" NS doc-book-name
+.\" NS doc-corporate-count
+.\" NS doc-corporate-name
+.\" NS doc-date
+.\" NS doc-date-count
+.\" NS doc-issue-count
+.\" NS doc-issue-name
+.\" NS doc-journal-count
+.\" NS doc-journam-name
+.\" NS doc-optional-count
+.\" NS doc-optional-string
+.\" NS doc-page-number-count
+.\" NS doc-page-number-string
+.\" NS doc-reference-title-count
+.\" NS doc-reference-title-name
+.\" NS doc-reference-title-name-for-book
+.\" NS doc-report-count
+.\" NS doc-report-name
+.\" NS doc-volume-count
+.\" NS doc-volume-name
+.
+.de doc-reset-reference
+. while (\n[doc-author-count]) \{\
+. ds doc-author-name\n[doc-author-count]
+. nr doc-author-count -1
+. \}
+. nr doc-journal-count 0
+. nr doc-issue-count 0
+. nr doc-optional-count 0
+. nr doc-corporate-count 0
+. nr doc-report-count 0
+. nr doc-reference-title-count 0
+. nr doc-volume-count 0
+. nr doc-date-count 0
+. nr doc-page-number-count 0
+. nr doc-book-count 0
+.
+. ds doc-journal-name
+. ds doc-issue-name
+. ds doc-optional-string
+. ds doc-corporate-name
+. ds doc-report-name
+. ds doc-reference-title-name
+. ds doc-reference-title-name-for-book
+. ds doc-volume-name
+. ds doc-date
+. ds doc-page-number-string
+. ds doc-book-name
+..
+.
+.
+.\" NS doc-finish-reference macro
+.\" NS auxiliary macro for doc-print-reference
+.\" NS
+.\" NS modifies:
+.\" NS doc-reference-count
+.
+.de doc-finish-reference
+. nr doc-reference-count -1
+. ie \n[doc-reference-count] \
+. nop \),
+. el \
+. nop \).
+..
+.
+.
+.\" NS doc-print-reference macro
+.\" NS reference print
+.\" NS
+.\" NS modifies:
+.\" NS doc-reference-count
+.
+.de doc-print-reference
+.
+. nh
+.
+. if \n[doc-author-count] \{\
+. doc-print-reference-authors
+. nr doc-reference-count -\n[doc-author-count]
+. \}
+.
+. if \n[doc-reference-title-count] \{\
+. unformat doc-reference-title-name
+. chop doc-reference-title-name
+. unformat doc-reference-title-name-for-book
+. chop doc-reference-title-name-for-book
+. ie ((\n[doc-journal-count] == 1) : (\n[doc-book-count] == 1)) \{\
+. nop \)\*[q]\)\*[doc-reference-title-name-for-book]\)\*[q]\c
+. doc-finish-reference
+. \}
+. el \{\
+. nop \*[doc-reference-title-name]\c
+. doc-finish-reference
+. \}\}
+.
+. if \n[doc-book-count] \{\
+. unformat doc-book-name
+. chop doc-book-name
+. nop \*[doc-book-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-publisher-count] \{\
+. unformat doc-publisher-name
+. chop doc-publisher-name
+. nop \*[doc-publisher-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-journal-count] \{\
+. unformat doc-journal-name
+. chop doc-journal-name
+. nop \*[doc-journal-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-report-count] \{\
+. unformat doc-report-name
+. chop doc-report-name
+. nop \*[doc-report-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-issue-count] \{\
+. unformat doc-issue-name
+. chop doc-issue-name
+. nop \*[doc-issue-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-volume-count] \{\
+. unformat doc-volume-name
+. chop doc-volume-name
+. nop \*[doc-volume-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-page-number-count] \{\
+. unformat doc-page-number-string
+. chop doc-page-number-string
+. nop \*[doc-page-number-string]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-corporate-count] \{\
+. unformat doc-corporate-name
+. chop doc-corporate-name
+. nop \*[doc-corporate-name]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-date-count] \{\
+. unformat doc-date
+. chop doc-date
+. nop \*[doc-date]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-optional-count] \{\
+. unformat doc-optional-string
+. chop doc-optional-string
+. nop \*[doc-optional-string]\c
+. doc-finish-reference
+. \}
+.
+. if \n[doc-reference-count] \
+. tm mdoc warning: unresolved reference problem
+.
+. hy \n[doc-hyphen-flags]
+..
+.
+.
+.\" NS doc-print-reference-authors macro
+.\" NS print out reference authors
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-dpra
+.\" NS doc-str-dpra
+.
+.ds doc-str-dpra "and
+.
+.de doc-print-reference-authors
+. nr doc-reg-dpra 1
+.
+. while (\n[doc-reg-dpra] < \n[doc-author-count]) \{\
+. unformat doc-author-name\n[doc-reg-dpra]
+. chop doc-author-name\n[doc-reg-dpra]
+. ie (\n[doc-author-count] > 2) \
+. nop \)\*[doc-author-name\n[doc-reg-dpra]],
+. el \
+. nop \)\*[doc-author-name\n[doc-reg-dpra]]
+. nr doc-reg-dpra +1
+. \}
+.
+. unformat doc-author-name\n[doc-reg-dpra]
+. chop doc-author-name\n[doc-reg-dpra]
+. if (\n[doc-author-count] > 1) \
+. nop \)\*[doc-str-dpra]
+. nop \)\*[doc-author-name\n[doc-reg-dpra]],
+..
+.
+.
+.\" NS doc-author-count global register
+.\" NS counter of author references
+.
+.nr doc-author-count 0
+.
+.
+.\" NS doc-author-nameXXX global box
+.\" NS array of author names
+.\" NS
+.\" NS limit:
+.\" NS doc-author-count
+.
+.ds doc-author-name0
+.
+.
+.\" NS %A user macro
+.\" NS reference author(s)
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-author-count
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%A
+.\" NS
+.\" NS width register `%A' set in doc-common
+.
.de %A
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%A Author_name (#\\n(.c)
-. el \{\
-. nr uK \\n(uK+1
-. nr Kl \\n(Kl+1
-. ds rS U\\n(uK
-. ds mN %A
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %B macro - [reference] Book Name
-.\" NS bK string - Book Name
-.\" NS bK register - Book Name flag
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%A author_name ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-author-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %A
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" save to reference box
+. box doc-author-name\n[doc-author-count]
+. ev doc-env-%A
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-book-count global register
+.\" NS counter of book references
+.
+.nr doc-book-count 0
+.
+.
+.\" NS doc-book-name global box
+.\" NS string of collected book references
+.
+.ds doc-book-name
+.
+.
+.\" NS %B user macro
+.\" NS [reference] book name
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-book-count
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%B
+.\" NS
+.\" NS width register `%B' set in doc-common
+.
.de %B
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%B Book Name (#\\n(.c)
-. el \{\
-. ds mN %B
-. if \\n(rS>0 \{\
-. nr bK \\n(bK+1
-. nr Kl \\n(Kl+1
-. ds rS bK
-. \}
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie \\n(rS==0 \{\
-. as b1 \&\\*(eM
-. nR
-. \}
-. el .rR
-.\}
-..
-.\" NS %D macro - [reference] Date
-.\" NS dK string - Date String
-.\" NS dK register - Date flag
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%B book_name ... (#\n[.c])
+. return
+. \}
+.
+. if \n[doc-is-reference] \{\
+. nr doc-book-count +1
+. nr doc-reference-count +1
+. \}
+.
+. ds doc-macro-name %B
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. ie \n[doc-is-reference] \{\
+. \" append to reference box
+. boxa doc-book-name
+. ev doc-env-%B
+. evc 0
+. in 0
+. nf
+. nop \*[doc-Em-font]\c
+. doc-do-references
+. \}
+. el \{\
+. nop \*[doc-Em-font]\c
+. doc-print-recursive
+. \}
+..
+.
+.
+.\" NS doc-date-count global register
+.\" NS counter of date references
+.
+.nr doc-date-count 0
+.
+.
+.\" NS doc-date global box
+.\" NS string of collected date references
+.
+.ds doc-date
+.
+.
+.\" NS %D user macro
+.\" NS [reference] date
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-date-count
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%D
+.\" NS
+.\" NS width register `%D' set in doc-common
+.
.de %D
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%D Date (#\\n(.c)
-. el \{\
-. ds mN %D
-. nr dK \\n(dK+1
-. nr Kl \\n(Kl+1
-. ds rS dK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %J macro - [reference] Journal Name
-.\" NS jK register - [reference] Journal Name flag
-.\" NS jK string - [reference] Journal Name
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%D date ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-date-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %D
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-date
+. ev doc-env-%D
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-publisher-count global register
+.\" NS counter of publisher references
+.
+.nr doc-publisher-count 0
+.
+.
+.\" NS doc-publisher-name global box
+.\" NS string of collected publisher references
+.
+.ds doc-publisher-name
+.
+.
+.\" NS %I user macro
+.\" NS [reference] issuer/publisher name
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-publisher-count
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%I
+.\" NS
+.\" NS width register `%I' set in doc-common
+.
+.de %I
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%I issuer/publisher_name ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-publisher-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %I
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-publisher-name
+. ev doc-env-%I
+. evc 0
+. in 0
+. nf
+. nop \*[doc-Em-font]\c
+. doc-do-references
+..
+.
+.
+.\" NS doc-journal-count global register
+.\" NS counter of journal references
+.
+.nr doc-journal-count 0
+.
+.
+.\" NS doc-journal-name global box
+.\" NS string of collected journal references
+.
+.ds doc-journal-name
+.
+.
+.\" NS %J user macro
+.\" NS [reference] Journal Name
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-journal-count
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%J
+.\" NS
+.\" NS width register `%J' set in doc-common
+.
.de %J
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%J Journal Name (#\\n(.c)
-. el \{\
-. ds mN %J
-. nr jK \\n(jK+1
-. ds rS jK
-. nr Kl \\n(Kl+1
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %N macro - [reference] issue number
-.\" NS nK register - [reference] issue number flag
-.\" NS nK string - [reference] issue number
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%J journal_name ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-journal-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %J
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-journal-name
+. ev doc-env-%J
+. evc 0
+. in 0
+. nf
+. nop \*[doc-Em-font]\c
+. doc-do-references
+..
+.
+.
+.\" NS doc-issue-count global register
+.\" NS counter of issue number references
+.
+.nr doc-issue-count 0
+.
+.
+.\" NS doc-issue-name global box
+.\" NS string of collected issue number references
+.
+.ds doc-issue-name
+.
+.
+.\" NS %N user macro
+.\" NS [reference] issue number
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-issue-count
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%N
+.\" NS
+.\" NS width register `%N' set in doc-common
+.
.de %N
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%N issue number (#\\n(.c)
-. el \{\
-. nr nK \\n(nK+1
-. nr Kl \\n(Kl+1
-. ds rS nK
-. ds mN %N
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %O macro - [reference] optional information
-.\" NS oK register - [reference] optional information flag
-.\" NS oK string - [reference] optional information
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%N issue_number ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-issue-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %N
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-issue-name
+. ev doc-env-%N
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-optional-count global register
+.\" NS counter of optional information references
+.
+.nr doc-optional-count 0
+.
+.
+.\" NS doc-optional-string global box
+.\" NS string of collected optional information references
+.
+.ds doc-optional-string
+.
+.
+.\" NS %O user macro
+.\" NS [reference] optional information
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-optional-count
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%O
+.\" NS
+.\" NS width register `%O' set in doc-common
+.
.de %O
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%O optional information ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN %O
-. nr oK \\n(oK+1
-. nr Kl \\n(Kl+1
-. ds rS oK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %P macro - [reference] page numbers
-.\" NS pK register - [reference] page number flag
-.\" NS pK string - [reference] page number
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%O optional_information ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-optional-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %O
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-optional-string
+. ev doc-env-%O
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-page-number-count global register
+.\" NS counter of page number references
+.
+.nr doc-page-number-count 0
+.
+.
+.\" NS doc-page-number-string global box
+.\" NS string of collected page number references
+.
+.ds doc-page-number-string
+.
+.
+.\" NS %P user macro
+.\" NS [reference] page numbers
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-page-number-count
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%P
+.\" NS
+.\" NS width register `%P' set in doc-common
+.
.de %P
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%P page numbers ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN %P
-. nr pK \\n(pK+1
-. nr Kl \\n(Kl+1
-. ds rS pK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %Q macro - Corporate or Foreign Author
-.\" NS qK string - Corporate or Foreign Author
-.\" NS qK register - Corporate or Foreign Author flag
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%P page_number ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-page-number-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %P
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-page-number-string
+. ev doc-env-%P
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-corporate-count global register
+.\" NS counter of corporate references
+.
+.nr doc-corporate-count 0
+.
+.
+.\" NS doc-corporate-name global box
+.\" NS string of collected corporate references
+.
+.ds doc-corporate-name
+.
+.
+.\" NS %Q user macro
+.\" NS corporate or foreign author
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-corporate-count
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%Q
+.\" NS
+.\" NS width register `%Q' set in doc-common
+.
.de %Q
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%Q Corporate or Foreign Author (#\\n(.c)
-. el \{\
-. ds mN %Q
-. nr qK \\n(qK+1
-. nr Kl \\n(Kl+1
-. ds rS qK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %R macro - [reference] report name
-.\" NS rK string - [reference] report name
-.\" NS rK register - [reference] report flag
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%Q corporate_or_foreign_author ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-corporate-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %Q
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-corporate-name
+. ev doc-env-%Q
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-report-count global register
+.\" NS counter of report references
+.
+.nr doc-report-count 0
+.
+.
+.\" NS doc-report-name global box
+.\" NS string of collected report references
+.
+.ds doc-report-name
+.
+.
+.\" NS %R user macro
+.\" NS [reference] report name
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-reference-count
+.\" NS doc-report-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%R
+.\" NS
+.\" NS width register `%R' set in doc-common
+.
.de %R
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%R reference report (#\\n(.c)
-. el \{\
-. ds mN %R
-. nr rK \\n(rK+1
-. nr Kl \\n(Kl+1
-. ds rS rK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %T macro - reference title
-.\" NS tK string - reference title
-.\" NS tK register - reference title flag
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%R reference_report ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-report-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %R
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-report-name
+. ev doc-env-%R
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-reference-title-count global register
+.\" NS counter of reference title references
+.
+.nr doc-reference-title-count 0
+.
+.
+.\" NS doc-reference-title-name global box
+.\" NS string of collected reference title references
+.
+.ds doc-reference-title-name
+.
+.
+.\" NS doc-reference-title-name-for-book global box
+.\" NS string of collected reference title references
+.\" NS (saved with another font; this is a shortcoming of groff)
+.
+.ds doc-reference-title-name-for-book
+.
+.
+.\" NS %T user macro
+.\" NS reference title
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-reference-title-count
+.\" NS doc-report-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%T
+.\" NS
+.\" NS width register `%T' set in doc-common
+.
.de %T
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%T (#\\n(.c)
-. el \{\
-. ds mN %T
-. if \\n(rS>0 \{\
-. nr tK \\n(tK+1
-. nr Kl \\n(Kl+1
-. ds rS tK
-. \}
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-.\" . ie \\n(jS==1 \{\
-.\" . nr cF \\n(.f
-.\" . nr cZ \\n(.s
-.\" . ds qL \&\\*(Lq\\*(rA
-.\" . ds qR \&\\*(Rq\f\\n(cF\s\\n(cZ
-.\" . En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\" . \}
-.\" . el \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie \\n(rS==0 \{\
-. as b1 \&\\*(eM
-. nR
-. \}
-. el .rR
-.\" . \}
-.\}
-..
-.\" NS %V macro - reference volume
-.\" NS vK string - reference volume
-.\" NS vK register - reference volume flag
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%T reference_title ... (#\n[.c])
+. return
+. \}
+.
+. if \n[doc-is-reference] \{\
+. nr doc-reference-title-count +1
+. nr doc-reference-count +1
+. \}
+.
+. ds doc-macro-name %T
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. ie \n[doc-is-reference] \{\
+. \" append to reference box
+. boxa doc-reference-title-name-for-book
+. ev doc-env-%T
+. evc 0
+. in 0
+. nf
+. nop \*[doc-No-font]\c
+. doc-do-references
+.
+. \" do it a second time with another font
+. ds doc-macro-name %T
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. boxa doc-reference-title-name
+. ev doc-env-%T
+. evc 0
+. in 0
+. nf
+. nop \*[doc-Em-font]\c
+. doc-do-references
+. \}
+. el \{\
+. nop \*[doc-Em-font]\c
+. doc-print-recursive
+. \}
+..
+.
+.
+.\" NS doc-volume-count global register
+.\" NS counter of reference title references
+.
+.nr doc-volume-count 0
+.
+.
+.\" NS doc-volume-name global box
+.\" NS string of collected volume references
+.
+.ds doc-volume-name
+.
+.
+.\" NS %V user macro
+.\" NS reference volume
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-macro-name
+.\" NS doc-reference-title-count
+.\" NS doc-volume-count
+.\" NS
+.\" NS local variables:
+.\" NS doc-env-%V
+.\" NS
+.\" NS width register `%V' set in doc-common
+.
.de %V
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%V Volume , ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN %V
-. nr vK \\n(vK+1
-. nr Kl \\n(Kl+1
-. ds rS vK
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS rR macro - reference recursion routine
-.\" NS jM local register
-.\" NS jN local register
-.de rR
-.hy 0
-.nr jM \\n(C\\n(aP
-.ie \\n(jM==1 \{\
-.\" . as b1 \&\f\\n(cF\s\\n(cZ
-. ie "\\*(A\\n(aP"Tn" \{\
-. nN
-. \}
-. el \{\
-. if \\n(aC>8 .tm Usage: \\*(mN - maximum 8 arguments (#\\n(.c)
-. aI rR 1
-. \\*(A\\n(aP
-. \}
-.\}
-.el \{\
-. nr jN \\n(aP
-. ie \\n(jM==2 .as b1 \&\\*(A\\n(aP
-. el .as b1 \&\\*(A\\n(aP
-.\" . el .as b1 \&\f\\n(cF\s\\n(cZ\\*(A\\n(aP\fP\s0
-. ie \\n(aC==\\n(aP \{\
-.\" . as b1 \&\f\\n(cF\s\\n(cZ
-. rD
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. as b1 \&\\*(S\\n(jN
-. rR
-. \}
-.\}
-.rr jM jN
-..
-.\" NS rD macro - save b1 buffer in to appropriate name
-.de rD
-.as \\*(rS \\*(b1
-.ds b1
-.ds rS
-.aY
-..
-.\" NS Hf macro - source include header files.
+. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\
+. tm Usage: .%V volume ... (#\n[.c])
+. return
+. \}
+.
+. nr doc-volume-count +1
+. nr doc-reference-count +1
+.
+. ds doc-macro-name %V
+. doc-parse-args \$@
+.
+. nr doc-arg-ptr +1
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+.
+. \" append to reference box
+. boxa doc-volume-name
+. ev doc-env-%V
+. evc 0
+. in 0
+. nf
+. doc-do-references
+..
+.
+.
+.\" NS doc-do-references macro
+.\" NS reference recursion routine
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-ddr
+.\" NS doc-reg-ddr1
+.
+.de doc-do-references
+. if !\n[doc-is-reference] \
+. tm mdoc error: .\*[doc-macro-name] found outside of .Rs ... .Re (#\n[.c])
+.
+. nr doc-reg-ddr1 \n[doc-type\n[doc-arg-ptr]]
+.
+. ie (\n[doc-reg-ddr1] == 1) \{\
+. \" .nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
+. doc-append-arg \c 3
+. \*[doc-arg\n[doc-arg-ptr]]
+. \}
+. el \{\
+. nop \)\*[doc-arg\n[doc-arg-ptr]]\c
+.
+. ie (\n[doc-arg-limit] == \n[doc-arg-ptr]) \{\
+. \" finish reference box
+. br
+. ev
+. boxa
+.
+. doc-reset-args
+. \}
+. el \{\
+. nr doc-reg-ddr \n[doc-arg-ptr]
+. nr doc-arg-ptr +1
+. nop \)\*[doc-space\n[doc-reg-ddr]]\c
+. doc-do-references
+. \}\}
+..
+.
+.
+.\" NS Hf user macro
+.\" NS source include header files.
+.\" NS
+.\" NS modifies:
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS
+.\" NS width register `Hf' set in doc-common
+.
.de Hf
-.Pp
-File:
-.Pa \\$1
-.Pp
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ie t \{\
-\&\\*(lI
-.br
-.ta +9n 18n 27n 36n 45n 54n 63n 72n
-.\}
-.el \{\
-.ta +8n 16n 24n 32n 40n 48n 56n 64n 72n
-.\}
-.nf
-.so \\$1
-.fi
-.ft \\n(cF
-.fz \\n(cZ
-.Pp
-..
-.\" NS An macro - author name
-.\" NS aN register
-.nr aN 0
+. ie ((\n[.$] == 1) & (\n[doc-arg-limit] == 0)) \{\
+. doc-paragraph
+. nop File:
+. Pa \$1
+.
+. Bd -literal
+. so \$1
+. Ed
+.
+. doc-paragraph
+. \}
+. el \
+. Usage: .Hf file (#\n[.c])
+..
+.
+.
+.\" NS doc-have-author global register (bool)
+.\" NS set in `An'
+.
+.nr doc-have-author 0
+.
+.
+.\" NS An user macro
+.\" NS author name
+.\" NS
+.\" NS modifies:
+.\" NS doc-arg-ptr
+.\" NS doc-curr-font
+.\" NS doc-curr-size
+.\" NS doc-have-author
+.\" NS doc-macro-name
+.\" NS
+.\" NS width register `An' set in doc-common
+.
.de An
-.if \\n(nY==1 \{\
-. ie \\n(aN==1 \{\
-. br
-. \}
-. el \{\
-. nr aN 1
-. \}
-.\}
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .An author_name ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN An
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Sf macro -defunct
+. if !\n[doc-arg-limit] \{\
+. ie \n[.$] \{\
+. ie "\$1"-nosplit" \
+. nr doc-in-authors-section 0
+. el \{ .ie "\$1"-split" \
+. nr doc-in-authors-section 1
+. el \{\
+. ds doc-macro-name An
+. doc-parse-args \$@
+. \}\}\}
+. el \{\
+. tm1 "Usage: .An {-nosplit | -split}
+. tm1 .An author_name ... (#\n[.c])
+. \}\}
+.
+. if \n[doc-in-authors-section] \{\
+. ie \n[doc-have-author] \
+. br
+. el \
+. nr doc-have-author 1
+. \}
+.
+. if \n[doc-arg-limit] \{\
+. nr doc-arg-ptr +1
+. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
+. nr doc-curr-font \n[.f]
+. nr doc-curr-size \n[.ps]
+. doc-print-recursive
+. \}
+. el \{\
+. tm Usage: .An author_name ... (#\n[.c])
+. doc-reset-args
+. \}\}
+..
+.
+.
+.\" NS Sf user macro
+.\" NS defunct
+.\" NS
+.\" NS width register `Sf' set in doc-common
+.
.de Sf
-.tm .Sf defunct, use prefix or Ns
-..
-.ds rV "function returns the value 0 if successful; otherwise the value -1 is returned and the global variable \\*(vAerrno\fP is set to indicate the error.
-.\" Ns Rv macro - return values
-.\" Ns rV string - standard return message
+. tm mdoc error: .Sf defunct, use .Pf or .Ns (#\n[.c])
+..
+.
+.
+.\" NS Rv user macro
+.\" NS return values
+.\" NS
+.\" NS width register `Rv' set in doc-common
+.\" NS
+.\" NS local variables:
+.\" NS doc-str-Rv-prefix
+.\" NS doc-str-Rv-suffix
+.
+.ds doc-str-Rv-prefix "The
+.ds doc-str-Rv-suffix "function returns the value\~0 if successful;
+.as doc-str-Rv-suffix " otherwise the value\~-1 is returned and
+.as doc-str-Rv-suffix " the global variable \*[doc-Va-font]errno\f[P]
+.as doc-str-Rv-suffix " is set to indicate the error.
+.
.de Rv
-.ie \\n(.$==0 \{\
-.tm Usage: .Rv [-std] (#\\n(.c)
-.\}
-.el \{\
-. ds mN Rv
-.\" . nr aP 0
-.\" . nr lR \\n(lR+1
-.\" . ds A1 \\$2
-.\" . ds A2 \\$3
-.\" . ds A3 \\$4
-.\" . ds A4 \\$5
-.\" . ds A5 \\$6
-.\" . ds A6 \\$7
-.\" . ds A7 \\$8
-.\" . ds A8 \\$9
-.\" . nr fV \\n(.$-1
-. if "\\$1"-std" \{\
-. nr cH \\*(cH
-. if (\\n(cH<2):(\\n(cH>3) .tm Usage: .Rv -std sections 2 and 3 only
-. br
-\&The
-.Fn \\$2
-\&\\*(rV
-. \}
-.\}
-..
+.
+.\" XXX: what does this function without `-std'?
+.
+. if !\n[.$] \{\
+. tm Usage: .Rv [-std] (#\n[.c])
+. return
+. \}
+.
+. \" .ds doc-macro-name Rv
+. \" .nr doc-arg-ptr 0
+. \" .nr lR +1
+. \" .ds doc-arg1 \$2
+. \" .ds doc-arg2 \$3
+. \" .ds doc-arg3 \$4
+. \" .ds doc-arg4 \$5
+. \" .ds doc-arg5 \$6
+. \" .ds doc-arg6 \$7
+. \" .ds doc-arg7 \$8
+. \" .ds doc-arg8 \$9
+. \" .
+. \" .nr doc-num-args (\n[.$] - 1)
+.
+. if "\$1"-std" \{\
+. nr doc-reg-Rv \*[doc-section]
+. if ((\n[doc-reg-Rv] < 2) : (\n[doc-reg-Rv] > 3)) \
+. tm Usage: .Rv -std in sections 2 and 3 only (#\n[.c])
+. br
+. nop \)\*[doc-str-Rv-prefix]
+. Fn \$2
+. nop \)\*[doc-str-Rv-suffix]
+. \}
+..
+.
+.
+.\" NS Mt user macro
+.\" NS mailto (for conversion to HTML)
+.
+.de Mt
+. \" XXX: error handling missing
+. Pa \$@
+..
+.
+.
+.\" NS Lk user macro
+.\" NS link (for conversion to HTML)
+.\" NS
+.\" NS local variables:
+.\" NS doc-reg-Lk
+.\" NS doc-str-Lk
+.
+.de Lk
+. ds doc-str-Lk Sy \$@
+.
+. ie (\n[.$] > 1) \{\
+. doc-get-arg-type \$2
+. ie (\n[doc-arg-type] < 3) \{\
+. Em \)\$2:
+. ds doc-str-Lk Sy "\$1"
+. doc-get-width "\$1"
+. shift 2
+. if \n[.$] \
+. as doc-str-Lk " \$@
+. \}
+. el \
+. doc-get-width "\$1"
+. \}
+. el \
+. doc-get-width "\$1"
+.
+. ie n \
+. nr doc-reg-Lk 26
+. el \
+. nr doc-reg-Lk 38
+. ie (\n[doc-width] >= \n[doc-reg-Lk]) \
+. D1 \*[doc-str-Lk]
+. el \
+. \*[doc-str-Lk]
+..
+.
+.
+.rn em e@
+.
+.de em
+. tm1 "mdoc error: end-macro (.em) respecification is not allowed. (#\n[.c])
+. tm1 " Should this have been `.Em ...'?
+. ab
+..
+.
+.
+.\" NS doc-empty-line macro
+.\" NS emit warning and print empty line
+.
+.de doc-empty-line
+. if !"\*[doc-macro-name]"Bd" \
+. tm mdoc warning: Empty input line #\n[.c]
+. sp
+..
+.
+.blm doc-empty-line
+.
+.
+.ec
+.
+.
+.\" load local modifications
+.mso mdoc.local
+.
+.\" EOF