Module Name:    src
Committed By:   martin
Date:           Mon Dec  9 13:00:23 UTC 2019

Modified Files:
        src/distrib/notes [netbsd-9]: Makefile.inc
        src/distrib/notes/common [netbsd-9]: macros

Log Message:
Pull up the following revisions, requested by uwe in ticket #523:

        distrib/notes/Makefile.inc                      up to 1.52
        distrib/notes/common/macros                     up to 1.54

Improve table of contents.


To generate a diff of this commit:
cvs rdiff -u -r1.43.18.4 -r1.43.18.5 src/distrib/notes/Makefile.inc
cvs rdiff -u -r1.43.6.1 -r1.43.6.2 src/distrib/notes/common/macros

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/notes/Makefile.inc
diff -u src/distrib/notes/Makefile.inc:1.43.18.4 src/distrib/notes/Makefile.inc:1.43.18.5
--- src/distrib/notes/Makefile.inc:1.43.18.4	Wed Nov 27 16:07:30 2019
+++ src/distrib/notes/Makefile.inc	Mon Dec  9 13:00:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.43.18.4 2019/11/27 16:07:30 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.43.18.5 2019/12/09 13:00:22 martin Exp $
 #
 
 # Ross Harvey <[email protected]>
@@ -13,12 +13,13 @@ MKTOCS?=yes
 M?=	${.CURDIR:T}
 COMMON=	${.CURDIR}/../common
 
-MAIN=	${COMMON}/main ${COMMON}/macros ${EXTRA}
+MAIN=	${COMMON}/main ${EXTRA}
 TARG=	INSTALL
 TARGS=	${TARG}.ps ${TARG}.txt ${TARG}.html ${TARG}.more
 TOCS=	${TARG}.PostScript.toc ${TARG}.ASCII.toc ${TARG}.HTML.toc \
 	${TARG}.more.toc
-SRCS=	${MAIN} whatis ${COMMON}/contents hardware xfer prep \
+SRCS=	${MAIN} ${COMMON}/macros \
+	whatis ${COMMON}/contents hardware xfer prep \
 	${.CURDIR}/install ${COMMON}/postinstall upgrade \
 	${COMMON}/legal.common ${COMMON}/netboot \
 	${COMMON}/sysinst \
@@ -102,35 +103,26 @@ ${TARG}.more: ${SRCS} ${TOC.more} ${DIST
 	${TOOL_GROFF} ${ARGS_MORE} -mdoc      ${MAIN} > $@
 
 
-# Rules to build the table of contents (.toc) files.
-# They are generated twice to take into account the
-# space taken by the TOC itself.
-#
-
-TOCPROC=	  2>&1 >/dev/null |\
-	   ${TOOL_SED} -n -e 's/"//g' \
-	   -e '/^\.Ti/{s/ \([A-Za-z]\)/ "\1/; s/ *$$/"/; p; }'
+# Rules to build the table of contents (.toc) files.  For the
+# PostScript version it's generated twice to take into account the
+# space taken by the TOC itself.  Other versions are not paginated.
 
 ${TARG}.PostScript.toc: ${SRCS}
-	${TOOL_GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} ${TOCPROC} > [email protected]
+	${TOOL_GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} > /dev/null
 	mv -f [email protected] $@
-	${TOOL_GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} ${TOCPROC} > [email protected]
+	${TOOL_GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} > /dev/null
 	mv -f [email protected] $@
 
 ${TARG}.ASCII.toc: ${SRCS}
-	${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} ${TOCPROC} > [email protected]
-	mv -f [email protected] $@
-	${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} ${TOCPROC} > [email protected]
+	${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} > /dev/null
 	mv -f [email protected] $@
 
 ${TARG}.HTML.toc: ${SRCS}
-	${TOOL_GROFF} -dTOC=1 ${ARGS_HTML} -mdoc ${MAIN} ${TOCPROC} > [email protected]
+	${TOOL_GROFF} -dTOC=1 ${ARGS_HTML} -mdoc ${MAIN} > /dev/null
 	mv -f [email protected] $@
 
 ${TARG}.more.toc: ${SRCS}
-	${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} ${TOCPROC} > [email protected]
-	mv -f [email protected] $@
-	${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} ${TOCPROC} > [email protected]
+	${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} > /dev/null
 	mv -f [email protected] $@
 
 

Index: src/distrib/notes/common/macros
diff -u src/distrib/notes/common/macros:1.43.6.1 src/distrib/notes/common/macros:1.43.6.2
--- src/distrib/notes/common/macros:1.43.6.1	Wed Nov 27 13:36:55 2019
+++ src/distrib/notes/common/macros	Mon Dec  9 13:00:22 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: macros,v 1.43.6.1 2019/11/27 13:36:55 msaitoh Exp $
+.\"	$NetBSD: macros,v 1.43.6.2 2019/12/09 13:00:22 martin Exp $
 .\"
 .\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -309,42 +309,102 @@
 .\" XXX To should be unnecessary if we handle parseable/callable.
 .\"   .Tc			import the TOC
 .\"   .Ti depth page "item"	(internal) output an entry
-.if dTOC \{
+.ds toc-file INSTALL.\*[format].toc
+.if dTOC \{\
+.tm ...writing \*[toc-file].tmp
+.open toc-tmp \*[toc-file].tmp
+.de mktoc
+.nr mktoc-level \\$1
+.shift
+.write toc-tmp .Ti \\n[mktoc-level] \\n% "\\$*"
+..
 .rn Ss Ss-toc
 .de Ss
 .Ss-toc \\$@
-.tm .Ti 0 \\n% "\\$*"
+.mktoc 0 \\$@
 ..
 .rn Ss2 Ss2-toc
 .de Ss2
 .Ss2-toc \\$@
-.tm .Ti 1 \\n% "\\$*"
+.mktoc 1 \\$@
 ..
 .\}
 .de Te
-.ie rHTML <a name="\\$2">\\$2</a>
-.el \\$2
-.if dTOC \.tm .Ti \\$1 \\n% \\$2
+.nr Te-toc-level \\$1
+.shift
+.ie rHTML <a name="\\$*">\\$*</a>
+.el \\$*
+.if dTOC .mktoc \\n[Te-toc-level] \\$@
 ..
 .de To
-.if rHTML <a name="\\$2"></a>
-.if dTOC \.tm .Ti \\$1 \\n% \\$2
+.nr To-toc-level \\$1
+.shift
+.if rHTML <a name="\\$*"></a>
+.if dTOC .mktoc \\n[To-toc-level] \\$@
+..
+.
+.\" .Tc and .Ti for PostScript
+.
+.ie '\*[format]'PostScript' \{\
+.de Ti
+.nr Ti-toc-level \\$1
+.nr Ti-page \\$2
+.shift 2
+.nr Ti-indent (\\n[Tc-saved-indent]+(3n*\\n[Ti-toc-level]))
+.in \\n[Ti-indent]u
+\\$* \c
+'nr Ti-eol-pos (\\n(.l-\\n(.i-\\n(.k)
+'ta (\\n[Ti-eol-pos]u-\w'099'u)R (\\n[Ti-eol-pos]u)R
+\a\t\\n[Ti-page]
+.br
 ..
+.
+.de Tc
+.nr Tc-saved-indent \\n(.i
+.tm ...reading \*[toc-file]
+.\" Use so-real here because toc-file is in objdir not .CURDIR
+.so-real \*[toc-file]
+.in \\n[Tc-saved-indent]u
+..
+.\}
+.
+.\"  .Tc and .Ti for HTML
+.
+.el .ie rHTML \{\
 .de Ti
-.ie rHTML \{.ta (\n(.lu+\w'<a href="#\\$3"></a>'u)R
-\h'3n*\\$1u' <a href="#\\$3">\\$3</a>\a\\$2
+.nr Ti-toc-level \\$1
+.\"nr Ti-page \\$2
+.shift 2
+\h'3n*\\n[Ti-toc-level]u' <a href="#\\$*">\\$*</a>
+..
+.
+.de Tc
+.tm ...reading \*[toc-file]
+.nf
+.\" Use so-real here because toc-file is in objdir not .CURDIR
+.so-real \*[toc-file]
+.fi
+..
 .\}
-.el \h'3n*\\$1u' \\$3\a\\$2
+.
+.\" .Tc and .Ti for unpaginated text
+.
+.el \{\
+.de Ti
+.nr Ti-toc-level \\$1
+.\"nr Ti-page \\$2
+.shift 2
+\h'3n*\\n[Ti-toc-level]u'\\$*
+.br
 ..
 .de Tc
 .Bd -literal
-.ta (\n(.lu)R
-\.tm ...reading INSTALL.\*[format].toc
-.       Pp
-.\" Use so-real here because otherwise we lose on objdirs
-\.so-real INSTALL.\*[format].toc
+.tm ...reading \*[toc-file]
+.\" Use so-real here because toc-file is in objdir not .CURDIR
+.so-real \*[toc-file]
 .Ed
 ..
+.\}
 .
 .
 .\"	--------------------  MISC  --------------------

Reply via email to