From 43c78e1b1925feae62b6fb11ae751de5d3ff36c8 Mon Sep 17 00:00:00 2001 From: ru Date: Thu, 3 Jul 2003 16:46:08 +0000 Subject: Update mdoc(7) to the current version. From ChangeLog: 2003-07-01 Ruslan Ermilov * tmac/doc.tmac (doc-do-func, doc-do-func-args): Don't print a comma after `/*' and `*/'. Fix spacing. (Fn, Fo): Reduce indentation in synopsis. * tmac/doc-common (doc-check-depth): New macro. (doc-end-macro, Sh, Ss): Use it. (Cd): Fix behaviour in synopsis. (In): Make it parsed and callable. If not in the synopsis, represent the C header file enclosed in angle brackets. (doc-str-Rv-std-suffix, doc-str-Rv-stds-suffix, doc-str-Rv-std0): Use minus, not hyphen. --- contrib/groff/tmac/doc-common | 28 +++++++++++-- contrib/groff/tmac/doc.tmac | 86 +++++++++++++++++++++++++++++++-------- contrib/groff/tmac/groff_mdoc.man | 18 ++++++-- 3 files changed, 108 insertions(+), 24 deletions(-) (limited to 'contrib/groff/tmac') diff --git a/contrib/groff/tmac/doc-common b/contrib/groff/tmac/doc-common index 0069998..30f16bc 100644 --- a/contrib/groff/tmac/doc-common +++ b/contrib/groff/tmac/doc-common @@ -101,7 +101,7 @@ .nr Ft 8n\" ? .nr Fx 1 .nr Ic 10n -.nr In 12n\" ? +.nr In 12n .nr It 8n\" ? .nr Lb 11n .nr Li 16n @@ -587,6 +587,25 @@ .. . . +.\" NS doc-check-depth macro +.\" NS check paired macros +. +.de doc-check-depth +. if \n[doc-list-depth] \{\ +. tm mdoc warning: A .Bl directive has no matching .El (#\n[.c]) +. nr doc-list-depth 0 +. \} +. if \n[doc-display-depth] \{\ +. tm mdoc warning: A .Bd directive has no matching .Ed (#\n[.c]) +. nr doc-display-depth 0 +. \} +. if \n[doc-fontmode-depth] \{\ +. tm mdoc warning: A .Bf directive has no matching .Ef (#\n[.c]) +. nr doc-fontmode-depth 0 +. \} +.. +. +. .\" NS doc-end-macro macro .\" NS finish output . @@ -603,8 +622,7 @@ . pl +3v . fl . -. if \n[doc-list-depth] \ -. tm mdoc warning: list open at EOF! A .Bl directive has no matching .El +. doc-check-depth . . if \n[cR] \{\ . sp @@ -834,6 +852,8 @@ . . in +\n[doc-subheader-indent]u . ns +. +. doc-check-depth . \} .. . @@ -898,6 +918,8 @@ . ne 2 . br . ns +. +. doc-check-depth . \} .. . diff --git a/contrib/groff/tmac/doc.tmac b/contrib/groff/tmac/doc.tmac index 97672b3..7f4090f 100644 --- a/contrib/groff/tmac/doc.tmac +++ b/contrib/groff/tmac/doc.tmac @@ -683,7 +683,7 @@ . nr doc-curr-size \n[.ps] . . ie \n[doc-in-synopsis-section] \{\ -. if "\*[doc-macro-name]"Cd" \{\ +. ie "\*[doc-macro-name]"Cd" \{\ . br . if !\n[doc-indent-synopsis] \ . nr doc-indent-synopsis \n[doc-display-indent]u @@ -694,6 +694,10 @@ . 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 \{\ . nop \*[doc-Nm-font]\c @@ -820,22 +824,64 @@ . . .\" NS In user macro -.\" NS #include statement - not callable +.\" NS #include statement in SYNOPSIS +.\" NS if not in SYNOPSIS .\" NS .\" NS this function causes a break; it uses the `Fd' font .\" NS +.\" NS modifies: +.\" NS doc-arg-ptr +.\" NS doc-curr-font +.\" NS doc-curr-size +.\" NS doc-indent-synopsis +.\" NS doc-macro-name +.\" 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 +. if !\n[doc-arg-limit] \{\ +. ie \n[.$] \{\ +. ds doc-macro-name In +. doc-parse-args \$@ +. \} +. el \ +. tm Usage: .In include_file ... (#\n[.c]) . \} +. +. if !\n[doc-arg-limit] \ +. return +. +. nr doc-arg-ptr +1 +. doc-print-prefixes +. ie ((\n[doc-arg-limit] >= \n[doc-arg-ptr]) & (\n[doc-type\n[doc-arg-ptr]] == 2)) \{\ +. nr doc-curr-font \n[.f] +. nr doc-curr-size \n[.ps] +. +. ie \n[doc-in-synopsis-section] \{\ +. ie "\*[doc-macro-name]"In" \{\ +. doc-do-func-decl +. nop \*[doc-Fd-font]#include <\*[doc-arg\n[doc-arg-ptr]]> +. ft \n[doc-curr-font] +. ps \n[doc-curr-size]u +. br +. nr doc-arg-ptr +1 +. ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \ +. doc-print-recursive +. el \ +. doc-reset-args +. \} +. el \{\ +. ds doc-arg\n[doc-arg-ptr] "<\*[doc-Pa-font]\*[doc-arg\n[doc-arg-ptr]] +. as doc-arg\n[doc-arg-ptr] \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]> +. doc-print-recursive +. \}\} +. el \{\ +. ds doc-arg\n[doc-arg-ptr] "<\*[doc-Pa-font]\*[doc-arg\n[doc-arg-ptr]] +. as doc-arg\n[doc-arg-ptr] \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]> +. doc-print-recursive +. \}\} . el \{\ -. tm Usage: .In include_file -- In is not callable (#\n[.c]) +. tm Usage: .In include_file ... (#\n[.c]) . doc-reset-args . \} .. @@ -4676,13 +4722,16 @@ . 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 \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\|\c +. if !"\*[doc-arg\n[doc-arg-ptr]]"/*" \ +. if !"\*[doc-arg\n[doc-arg-ptr]]"*/" \ +. nop ,\)\c . nop \)\*[doc-space\n[doc-arg-ptr]]\*[doc-Fa-font]\c . nop \)\*[doc-arg\n[doc-arg-ptr]]\f[]\s[0]\c . \} . . if (\n[doc-func-arg-count] == 1) \{\ -. nop \|\*[doc-Fa-font]\*[doc-arg\n[doc-arg-ptr]]\c +. nop \)\*[doc-Fa-font]\*[doc-arg\n[doc-arg-ptr]]\c . nop \f[]\s[0]\c . \} . nr doc-func-arg-count +1 @@ -4755,7 +4804,7 @@ . . br . if !\n[doc-indent-synopsis] \ -. nr doc-indent-synopsis (8u * \n[doc-fixed-width]u) +. nr doc-indent-synopsis (4u * \n[doc-fixed-width]u) . if !\n[doc-indent-synopsis-active] \ . in +\n[doc-indent-synopsis]u . ti -\n[doc-indent-synopsis]u @@ -4833,7 +4882,10 @@ . 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 \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\|\c +. if !"\*[doc-arg\n[doc-arg-ptr]]"/*" \ +. if !"\*[doc-arg\n[doc-arg-ptr]]"*/" \ +. nop ,\)\c . nop \)\*[doc-space\n[doc-reg-ddfa]]\f[]\s[0]\|\c . doc-do-func-args . \}\} @@ -4917,7 +4969,7 @@ . . br . if !\n[doc-indent-synopsis] \ -. nr doc-indent-synopsis (8u * \n[doc-fixed-width]u) +. nr doc-indent-synopsis (4u * \n[doc-fixed-width]u) . \} . . \" start function box @@ -6133,19 +6185,19 @@ . .ds doc-str-Rv-std-prefix "The .ds doc-str-Rv-std-suffix "function returns the value\~0 if successful; -.as doc-str-Rv-std-suffix " otherwise the value\~-1 is returned and +.as doc-str-Rv-std-suffix " otherwise the value\~\-1 is returned and .as doc-str-Rv-std-suffix " the global variable \*[doc-Va-font]errno\f[] .as doc-str-Rv-std-suffix " is set to indicate the error. . .ds doc-str-Rv-stds-prefix "The .ds doc-str-Rv-stds-and "and .ds doc-str-Rv-stds-suffix "functions return the value\~0 if successful; -.as doc-str-Rv-stds-suffix " otherwise the value\~-1 is returned and +.as doc-str-Rv-stds-suffix " otherwise the value\~\-1 is returned and .as doc-str-Rv-stds-suffix " the global variable \*[doc-Va-font]errno\f[] .as doc-str-Rv-stds-suffix " is set to indicate the error. . .ds doc-str-Rv-std0 "Upon successful completion, the value\~0 is returned; -.as doc-str-Rv-std0 " otherwise the value\~-1 is returned and +.as doc-str-Rv-std0 " otherwise the value\~\-1 is returned and .as doc-str-Rv-std0 " the global variable \*[doc-Va-font]errno\f[] .as doc-str-Rv-std0 " is set to indicate the error. . diff --git a/contrib/groff/tmac/groff_mdoc.man b/contrib/groff/tmac/groff_mdoc.man index be6c0cf..6ad2100 100644 --- a/contrib/groff/tmac/groff_mdoc.man +++ b/contrib/groff/tmac/groff_mdoc.man @@ -1398,15 +1398,25 @@ the declaration for the next function. .Pp The .Ql .In -.Li ( #include -statement) -macro is the short form of the above example. +macro, while in the +.Sx SYNOPSIS +section, represents the +.Li #include +statement, and is the short form of the above example. It specifies the C\~header file as being included in a C\~program. -It also causes a line break, and is neither callable nor parsed. +It also causes a line break. +.Pp +While not in the +.Sx SYNOPSIS +section, it represents the header file enclosed in angle brackets. .Pp .Dl Usage: .In Ao header file Ac .Pp .Bl -tag -width ".Li .In\ stdio.h" -compact -offset 15n +.nr in-synopsis-section 1 +.It Li ".In stdio.h" +.In stdio.h +.nr in-synopsis-section 0 .It Li ".In stdio.h" .In stdio.h .El -- cgit v1.1