summaryrefslogtreecommitdiff
path: root/tmac/doc.tmac
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-04-09 22:59:19 +0000
committerwlemb <wlemb>2001-04-09 22:59:19 +0000
commit21ebecd3dc1722faa746a7f5e943a580beffb138 (patch)
tree9bd49a3ec2848ac00888b29fe0aef8dc7f9bd6d8 /tmac/doc.tmac
parent1df99c0e5f5c42764a6a754ee172be53ea3e74fc (diff)
downloadgroff-21ebecd3dc1722faa746a7f5e943a580beffb138.tar.gz
Fix indentation in SYNOPSIS.
Updated to include changes of latest BSD mdoc version (basically, `.Fn' and `.Fc' put a final semicolon after a function declaration in the SYNOPSIS section. * tmac/doc.tmac (doc-in-synopsis-count): Replaced with ... (doc-in-synopsis-section): New variable. Updated all related functions. (doc-indent-synopsis-active): New register. (Nd, Fn, Fo): Use it. (Cd): It requires manipulation of n[doc-indent-synopsis] so that `.Cd' with long argument line produces indented wrapped lines. Also, the misplaced `.nop *[doc-Nm-font]c'' caused extra undesirable line break to be output. (doc-do-func-decl, Nm, Vt, Fn, Fo): Remove extraneous calls to `.rs'. (Fn, Fc): Add final `;' to output. (doc-save-global-vars, doc-restore-global-vars): Updated. * tmac/doc-common: Remove `Ex' register. Updated. * tmac/doc-ditroff, tmac/doc-nroff, tmac/doc-syms: Updated copyright.
Diffstat (limited to 'tmac/doc.tmac')
-rw-r--r--tmac/doc.tmac166
1 files changed, 84 insertions, 82 deletions
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 17669bf1..da546a27 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -1,5 +1,5 @@
-.\" Copyright (c) 1991 The Regents of the University of California.
-.\" All rights reserved.
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)doc 5.8 (Berkeley) 8/5/91
+.\" @(#)doc 8.1 (Berkeley) 06/08/93
.\"
.\" Modified by jjc@jclark.com as follows: the doc-* files are assumed to be
.\" installed as mdoc/doc-* rather than tmac.doc-* (the filename
@@ -642,18 +642,18 @@
.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 doc-indent-synopsis-active global register (bool)
+.\" NS indentation in synopsis active
+.
+.nr doc-indent-synopsis-active 0
+.
+.
.\" NS Cd user macro
.\" NS config declaration (for section 4 SYNOPSIS)
.\" NS
@@ -663,6 +663,7 @@
.\" NS doc-arg-ptr
.\" NS doc-curr-font
.\" NS doc-curr-size
+.\" NS doc-indent-synopsis
.\" NS doc-macro-name
.\" NS
.\" NS width register `Cd' set in doc-common
@@ -684,14 +685,24 @@
. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
. nr doc-curr-font \n[.f]
. nr doc-curr-size \n[.ps]
-. nop \*[doc-Nm-font]\c
.
-. if \n[doc-in-synopsis-count] \
-. br
-. doc-print-recursive
-. if \n[doc-in-synopsis-count] \
-. br
-. \}
+. ie \n[doc-in-synopsis-section] \{\
+. if "\*[doc-macro-name]"Cd" \{\
+. br
+. if !\n[doc-indent-synopsis] \
+. nr doc-indent-synopsis \n[doc-display-indent]u
+. if !\n[doc-indent-synopsis-active] \
+. in +\n[doc-indent-synopsis]u
+. ti -\n[doc-indent-synopsis]u
+. nop \*[doc-Nm-font]\c
+. doc-print-recursive
+. if !\n[doc-indent-synopsis-active] \
+. 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
@@ -769,7 +780,7 @@
.\" NS doc-have-var
.
.de doc-do-func-decl
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. \" if a variable type was the last thing given, want vertical space
. if \n[doc-have-var] \{\
. doc-paragraph
@@ -779,10 +790,9 @@
. if \n[doc-have-func] \{\
. ie \n[doc-have-decl] \
. br
-. el \{\
+. el \
. doc-paragraph
-. rs
-. \}\}
+. \}
. nr doc-have-decl 1
. \}
.
@@ -906,8 +916,8 @@
.\" NS doc-command-name
.\" NS doc-curr-font
.\" NS doc-curr-size
-.\" NS doc-in-synopsis-count
.\" NS doc-indent-synopsis
+.\" NS doc-indent-synopsis-active
.\" NS doc-macro-name
.\" NS
.\" NS width register `Nm' set in doc-common
@@ -943,8 +953,6 @@
. 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])
@@ -962,20 +970,18 @@
. \}\}
. el \{\
. \" handle `.Nm ...' in SYNOPSIS
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. 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
+. br
+. 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)
+. \}
+. if !\n[doc-indent-synopsis-active] \{\
+. in +\n[doc-indent-synopsis]u
+. nr doc-indent-synopsis-active 1
+. \}
. 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]]
@@ -1388,7 +1394,7 @@
.\" NS doc-quote-right
.
.de doc-enclose-string
-. if \n[doc-in-synopsis-count] \
+. if \n[doc-in-synopsis-section] \
. doc-set-hard-space
.
. if !\n[doc-arg-limit] \{\
@@ -1472,7 +1478,7 @@
. doc-do-\n[doc-type\n[doc-arg-ptr]]
. \}
.
-. if \n[doc-in-synopsis-count] \
+. if \n[doc-in-synopsis-section] \
. doc-set-soft-space
..
.
@@ -2692,7 +2698,7 @@
' in +\n[doc-display-indent-stack\n[doc-display-depth]]u
.
. if !\n[doc-is-compact] \{\
-. if !\n[doc-in-synopsis-count] \{\
+. if !\n[doc-in-synopsis-section] \{\
. ie "\*[doc-display-type-stack\n[doc-display-depth]]"ragged" \
. sp \n[doc-display-vertical]u
. el \
@@ -3223,8 +3229,9 @@
.
. 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-in-synopsis-section-saved \n[doc-in-synopsis-section]
. nr doc-indent-synopsis-saved \n[doc-indent-synopsis]
+. nr doc-indent-synopsis-active-saved \n[doc-indent-synopsis-active]
. 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]
@@ -3359,8 +3366,9 @@
.
. 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-in-synopsis-section \n[doc-in-synopsis-section-saved]
. nr doc-indent-synopsis \n[doc-indent-synopsis-saved]
+. nr doc-indent-synopsis-active \n[doc-indent-synopsis-active-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]
@@ -4391,7 +4399,7 @@
. return
. \}
.
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. \" if a function declaration was the last thing given,
. \" want vertical space
. if \n[doc-have-decl] \{\
@@ -4403,10 +4411,9 @@
. if \n[doc-have-func] \{\
. ie \n[doc-have-var] \
. br
-. el \{\
+. el \
. doc-paragraph
-. rs
-. \}\}
+. \}
.
. nr doc-have-var 1
. \}
@@ -4416,7 +4423,7 @@
. nop \*[doc-Ft-font]\c
. doc-print-recursive
.
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. ie \n[doc-have-old-func] \
. nop \*[doc-soft-space]\c
. el \
@@ -4464,7 +4471,7 @@
. return
. \}
.
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. if (\n[doc-have-func] : \n[doc-have-decl]) \{\
. doc-paragraph
. nr doc-have-decl 0
@@ -4506,7 +4513,7 @@
.de Ot
. nr doc-have-old-func 1
.
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. if (\n[doc-have-func] : \n[doc-have-decl]) \{\
. doc-paragraph
. nr doc-have-decl 0
@@ -4558,7 +4565,7 @@
. nop \*[doc-Fa-font]\c
. doc-print-recursive
.
-. if \n[doc-in-synopsis-count] \
+. if \n[doc-in-synopsis-section] \
. if \n[doc-have-func] \
. br
. \}\}
@@ -4647,7 +4654,6 @@
.\" 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
@@ -4664,7 +4670,10 @@
. tm Usage: .Fn function_name [function_arg] ... (#\n[.c])
. \}
.
-. if \n[doc-in-synopsis-count] \{\
+. if !\n[doc-arg-limit] \
+. return
+.
+. if \n[doc-in-synopsis-section] \{\
. \" if there is/has been more than one subroutine declaration
. ie \n[doc-is-func] \{\
. br
@@ -4691,23 +4700,15 @@
.
. 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
+. br
+. if !\n[doc-indent-synopsis] \
+. nr doc-indent-synopsis (8u * \n[doc-fixed-width]u)
+. if !\n[doc-indent-synopsis-active] \
+. 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]) \{\
@@ -4730,6 +4731,8 @@
. \}\}
.
. nop \)\*[rp]\)\c
+. if \n[doc-in-synopsis-section] \
+. nop \);\)\c
.
. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
. \" output the space (if needed)
@@ -4742,8 +4745,9 @@
. el \
. doc-print-and-reset
.
-. if \n[doc-in-synopsis-count] \
-. in -\n[doc-indent-synopsis]u
+. if \n[doc-in-synopsis-section] \
+. if !\n[doc-indent-synopsis-active] \
+. in -\n[doc-indent-synopsis]u
..
.
.
@@ -4761,7 +4765,7 @@
.\" NS doc-reg-ddfa
.
.de doc-do-func-args
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. ds doc-func-arg
. nr doc-num-func-args 0
. nr doc-func-args-processed 0
@@ -4806,7 +4810,6 @@
.\" 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
@@ -4832,7 +4835,7 @@
. tm Usage: .Fo function_name (#\n[.c])
. \}
.
-. if \n[doc-in-synopsis-count] \{\
+. if \n[doc-in-synopsis-section] \{\
. \" if there is/has been more than one subroutine declaration
. ie \n[doc-is-func] \{\
. br
@@ -4859,16 +4862,10 @@
.
. 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
+. br
+. if !\n[doc-indent-synopsis] \
+. nr doc-indent-synopsis (8u * \n[doc-fixed-width]u)
. \}
.
. \" start function box
@@ -4922,7 +4919,10 @@
. nr doc-func-arg-count 0
. nr doc-in-func-enclosure 0
.
-. nop \|\*[rp]\)
+. ie \n[doc-in-synopsis-section] \
+. nop \|\*[rp];\)
+. el \
+. nop \|\*[rp]\)
.
. \" finish function box
. br
@@ -4931,8 +4931,9 @@
. chop doc-func-box
. unformat doc-func-box
.
-. if \n[doc-in-synopsis-count] \{\
-. in +\n[doc-indent-synopsis]u
+. if \n[doc-in-synopsis-section] \{\
+. if !\n[doc-indent-synopsis-active] \
+. in +\n[doc-indent-synopsis]u
. ti -\n[doc-indent-synopsis]u
. \}
.
@@ -4948,8 +4949,9 @@
. el \
. doc-print-and-reset
.
-. if \n[doc-in-synopsis-count] \
-. in -\n[doc-indent-synopsis]u
+. if \n[doc-in-synopsis-section] \
+. if !\n[doc-indent-synopsis-active] \
+. in -\n[doc-indent-synopsis]u
..
.
.