From owner-svn-doc-all@freebsd.org Sun Oct 22 11:23:00 2017 Return-Path: Delivered-To: svn-doc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71B44E50405; Sun, 22 Oct 2017 11:23:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gatekeeper.allbsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E769C33C8; Sun, 22 Oct 2017 11:22:59 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail-d.allbsd.org ([IPv6:2409:11:a740:c00:58:65ff:fe00:b0b]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id v9MBMdkU092228 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) (Client CN "/OU=GT07882699/OU=See+20www.rapidssl.com/resources/cps+20+28c+2915/OU=Domain+20Control+20Validated+20-+20RapidSSL+28R+29/CN=*.allbsd.org", Issuer "/C=US/O=GeoTrust+20Inc./CN=RapidSSL+20SHA256+20CA+20-+20G3"); Sun, 22 Oct 2017 20:22:50 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from alph.d.allbsd.org (alph.allbsd.org [192.168.0.10]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id v9MBMcDL051978 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 22 Oct 2017 20:22:38 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:0:0:0:0:0:0:0:1]) (authenticated bits=0) by alph.d.allbsd.org (8.15.2/8.15.2) with ESMTPA id v9MBMang051970; Sun, 22 Oct 2017 20:22:38 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sun, 22 Oct 2017 20:20:23 +0900 (JST) Message-Id: <20171022.202023.700298682654760426.hrs@allbsd.org> To: gjb@FreeBSD.org Cc: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: Re: svn commit: r51055 - head/en_US.ISO8859-1/htdocs/releases/12.0R From: Hiroki Sato In-Reply-To: <201710052007.v95K7wdI038021@repo.freebsd.org> References: <201710052007.v95K7wdI038021@repo.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Sun_Oct_22_20_20_23_2017_644)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99.2 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.allbsd.org [IPv6:2001:2f0:104:e001:0:0:0:32]); Sun, 22 Oct 2017 20:22:55 +0900 (JST) X-Spam-Status: No, score=-97.2 required=13.0 tests=CONTENT_TYPE_PRESENT, FAKEDWORD_ATMARK,QENCPTR1,QENCPTR2,URIBL_SC2_SURBL,URIBL_XS_SURBL, USER_IN_WHITELIST autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gatekeeper.allbsd.org X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 11:23:00 -0000 ----Security_Multipart0(Sun_Oct_22_20_20_23_2017_644)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Sun_Oct_22_20_20_23_2017_745)--" Content-Transfer-Encoding: 7bit ----Next_Part(Sun_Oct_22_20_20_23_2017_745)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Glen Barber wrote in <201710052007.v95K7wdI038021@repo.freebsd.org>: gj> Author: gjb gj> Date: Thu Oct 5 20:07:58 2017 gj> New Revision: 51055 gj> URL: https://svnweb.freebsd.org/changeset/doc/51055 gj> gj> Log: gj> Reapply r51054, with a few fixes. gj> Fix a typo: s/elfi/elif/ gj> Remove dependencies from the dev-auto.ent target, which seems gj> I misread the original version of how this was invoked. gj> gj> Sponsored by: The FreeBSD Foundation These part should be in hardware/ directory and a part of guessing MAN4DIR should be dropped. MAN4DIR must be specified because each hardware directory is for a specific branch/release as I pointed out in another email. A generic location such as src/share/man/man4 or a guessed directory is confusing. Makefile does not handle cross-directory dependency well, so dev-auto.ent should be generated in the hardware directory. Also, please do not use /htdocs/share. Common files should be in head/share or head//share consistently. releases/12.0R/share/xml needs some more consideration, but I think it is fine for now. A patch to fix generation of hardware notes and other minor nits is attached. Note that XML catalog resolution is still broken. -- Hiroki ----Next_Part(Sun_Oct_22_20_20_23_2017_745)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="releases-120R-fix.20171022-1.diff" Index: en_US.ISO8859-1/htdocs/releases/12.0R/Makefile =================================================================== --- en_US.ISO8859-1/htdocs/releases/12.0R/Makefile (revision 51140) +++ en_US.ISO8859-1/htdocs/releases/12.0R/Makefile (working copy) @@ -19,6 +19,8 @@ DATA= docbook.css +SUBDIR= errata hardware readme relnotes + # PGP-signed checksums _BIGIRON?= amd64 \ @@ -55,63 +57,4 @@ . endfor .endfor -_hardware?= hardware - -# The path used on build-web is 'src/share/man/man4'. -.if !defined(MAN4DIR) || empty(MAN4DIR) -. if exists(${DOC_PREFIX}/../src/share/man/man4) -MAN4DIR= ${DOC_PREFIX}/../src/share/man/man4 -. elif exists(${DOC_PREFIX}/../share/man/man4) -MAN4DIR= ${DOC_PREFIX}/../share/man/man4 -. elif exists(${DOC_PREFIX}/../man/man4) -MAN4DIR= ${DOC_PREFIX}/../man/man4 -. elif exists(${DOC_PREFIX}/../man4) -MAN4DIR= ${DOC_PREFIX}/../man4 -. else -. warning "MAN4DIR not found. Unable to build hardware.html" -_hardware= # empty -. endif -.endif - -D= errata -D+= ${_hardware} -D+= readme -D+= relnotes - -MAN4PAGES?= ${MAN4DIR}/*.4 ${MAN4DIR}/man4.*/*.4 -ARCHLIST?= ${.CURDIR}/../../share/misc/dev.archlist.txt -CLEANFILES+= dev-auto.ent \ - index.html \ - schedule.html - -MAN2HWNOTES_CMD=${.CURDIR}/../../share/misc/man2hwnotes.pl -.if defined(HWNOTES_MI) -MAN2HWNOTES_FLAGS= -.else -MAN2HWNOTES_FLAGS= -c -.endif - -dev-auto.ent: - ${PERL} ${MAN2HWNOTES_CMD} ${MAN2HWNOTES_FLAGS} -a ${ARCHLIST} -o ${.TARGET}.tmp ${MAN4PAGES} - ${MV} ${.TARGET}.tmp ${.TARGET} - -.if make(clean) -beforeclean: -SUBDIR+= ${D} -.include "${DOC_PREFIX}/share/mk/doc.subdir.mk" -.endif - -beforeinstall: -.for _SD in ${D} -. if (${_SD:Mhardware} != "") - ${MAKE} -B -C ${.CURDIR} dev-auto.ent -. endif - ${MAKE} -C ${_SD} DOCINSTALLDIR=${DOCINSTALLDIR} all -.endfor - -afterinstall: -.for _SD in ${D} - ${MAKE} -C ${_SD} DOCINSTALLDIR=${DOCINSTALLDIR} install -.endfor - .include "${DOC_PREFIX}/share/mk/web.site.mk" Index: en_US.ISO8859-1/htdocs/releases/12.0R/Makefile.inc =================================================================== --- en_US.ISO8859-1/htdocs/releases/12.0R/Makefile.inc (nonexistent) +++ en_US.ISO8859-1/htdocs/releases/12.0R/Makefile.inc (working copy) @@ -0,0 +1,12 @@ +# $FreeBSD$ +.if !defined(_HTDOCS_RELEASES_12_0R_INC) +_HTDOCS_RELEASES_12_0R_INC=1 +DOC_PREFIX?= ${.CURDIR}/../../../../.. +WEBDIR?= /data/releases/12.0R +.if defined(DESTDIR) +DESTDIR:= ${DESTDIR}/${WEBDIR} +.else +DESTDIR= ${HOME}/public_html/${WEBDIR} +.endif +DOCBOOK_DEPS_DISABLE= YES +.endif Index: en_US.ISO8859-1/htdocs/releases/12.0R/errata/Makefile =================================================================== --- en_US.ISO8859-1/htdocs/releases/12.0R/errata/Makefile (revision 51140) +++ en_US.ISO8859-1/htdocs/releases/12.0R/errata/Makefile (working copy) @@ -1,34 +1,12 @@ # $FreeBSD$ -.if exists(../Makefile.conf) -.include "../Makefile.conf" -.endif .if exists(../Makefile.inc) .include "../Makefile.inc" .endif -DOC_PREFIX?= ${.CURDIR}/../../../../.. -RELN_ROOT?= ${.CURDIR}/.. - DOC?= errata -FORMATS?= html +FORMATS?= html txt INSTALL_COMPRESSED?= gz INSTALL_ONLY_COMPRESSED= -JADEFLAGS+= -V %generate-article-toc% - -SRCS?= errata.xml - -DATA+= ${DOC}.html - -CLEANFILES+= ${DOC}.html \ - ${DOC}.txt \ - catalog-cwd.xml \ - autogen.ent \ - ${DOC}.parsed.* - -install: ${DOC}.html - mkdir -p ${DOCINSTALLDIR} - ${INSTALL_DOCS} ${DATA} ${DOCINSTALLDIR} - .include "${DOC_PREFIX}/share/mk/doc.project.mk" Index: en_US.ISO8859-1/htdocs/releases/12.0R/hardware/Makefile =================================================================== --- en_US.ISO8859-1/htdocs/releases/12.0R/hardware/Makefile (revision 51140) +++ en_US.ISO8859-1/htdocs/releases/12.0R/hardware/Makefile (working copy) @@ -1,34 +1,32 @@ # $FreeBSD$ -.if exists(../Makefile.conf) -.include "../Makefile.conf" -.endif .if exists(../Makefile.inc) .include "../Makefile.inc" .endif -DOC_PREFIX?= ${.CURDIR}/../../../../.. -RELN_ROOT?= ${.CURDIR}/.. +# The path used on build-web is 'src/share/man/man4'. +.if make(all) && (!defined(MAN4DIR) || empty(MAN4DIR) || !exists(${MAN4DIR})) +. error "MAN4DIR not found. Unable to build hardware.html" +.endif -JADEFLAGS+= -V %generate-article-toc% +MAN4PAGES?= ${MAN4DIR}/*.4 ${MAN4DIR}/man4.*/*.4 +ARCHLIST?= ${DOC_PREFIX}/share/misc/dev.archlist.txt -DOC?= hardware +MAN2HWNOTES_CMD=${DOC_PREFIX}/share/misc/man2hwnotes.pl +.if defined(HWNOTES_MI) +MAN2HWNOTES_FLAGS= +.else +MAN2HWNOTES_FLAGS= -c +.endif + +DOC= hardware FORMATS?= html INSTALL_COMPRESSED?= gz INSTALL_ONLY_COMPRESSED= -SRCS?= hardware.xml +hardware.parsed.xml: dev-auto.ent +dev-auto.ent: + ${PERL} ${MAN2HWNOTES_CMD} ${MAN2HWNOTES_FLAGS} -a ${ARCHLIST} -o ${.TARGET} ${MAN4PAGES} || (rm -f ${.TARGET}) +CLEANFILES+= dev-auto.ent -DATA+= ${DOC}.html - -CLEANFILES+= ${DOC}.html \ - ${DOC}.txt \ - catalog-cwd.xml \ - autogen.ent \ - ${DOC}.parsed.* - -install: ${DOC}.html - mkdir -p ${DOCINSTALLDIR} - ${INSTALL_DOCS} ${DATA} ${DOCINSTALLDIR} - .include "${DOC_PREFIX}/share/mk/doc.project.mk" Index: en_US.ISO8859-1/htdocs/releases/12.0R/hardware/hardware.xml =================================================================== --- en_US.ISO8859-1/htdocs/releases/12.0R/hardware/hardware.xml (revision 51140) +++ en_US.ISO8859-1/htdocs/releases/12.0R/hardware/hardware.xml (working copy) @@ -1,16 +1,19 @@ + "http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd" [ + %release; - + %sponsor; - + %vendor; - - + %devauto; ]>
[,...] -# -aac i386,amd64 -adv i386,amd64 -adw i386,amd64 -aha i386 -ahb i386 -ahd i386,sparc64,amd64 -aic i386,amd64 -amd i386,amd64 -arcmsr i386,amd64 -asr i386 -ath i386,amd64,sparc64 -aue i386,amd64,powerpc -axe i386,amd64,powerpc -bce i386,amd64 -bge i386,sparc64,amd64 -bktr i386 -bt i386,amd64 -bxe i386,amd64 -cdce i386,amd64,powerpc -ciss i386,amd64 -ce i386 -cm i386 -cnw i386,amd64 -cp i386 -ctau i386 -cue i386,amd64,powerpc -cx i386 -cxgb i386,amd64 -de i386,amd64 -dpt i386,amd64 -ed i386 -ep i386,amd64 -esp sparc64 -ex i386,amd64 -fe i386,amd64 -fwohci i386,sparc64,amd64,powerpc -hifn i386,amd64 -hpt27xx i386,amd64 -hptiop i386,amd64 -hptmv i386,amd64 -hptrr i386,amd64 -ida i386 -ie i386 -iir i386,amd64 -ips i386,amd64 -isci i386,amd64 -ixgb i386,amd64 -kue i386,amd64,powerpc -lge i386,amd64 -mfi i386,amd64 -mlx i386,amd64 -mly i386,amd64 -msk i386,amd64 -mxge i386,amd64 -my i386 -ncr i386,amd64 -ncv i386 -nfe i386,amd64 -ng_bt3c i386,amd64 -ng_ubt i386,amd64 -nsp i386 -nxge i386,amd64 -oce i386,amd64 -ohci i386,amd64,powerpc -oltr i386 -otus i386,amd64 -pcn i386,amd64 -pst i386 -qlxgb amd64 -qlxgbe amd64 -qlxge amd64 -rc i386 -ral i386,amd64 -rsu i386,amd64 -rue i386,amd64 -rum i386,amd64 -run i386,amd64 -safe i386,amd64 -sbp i386,sparc64,amd64 -sfgxe amd64 -sn i386,amd64 -snd_ad1816 i386,amd64 -snd_als4000 i386 -snd_atiixp i386,amd64 -snd_audiocs sparc64 -snd_cmi i386,amd64 -snd_cs4281 i386,amd64 -snd_csa i386,amd64 -snd_ds1 i386,amd64 -snd_emu10k1 i386,amd64 -snd_emu10kx i386,amd64 -snd_envy24 i386,amd64 -snd_envy24ht i386,amd64 -snd_es137x i386,sparc64,amd64 -snd_ess i386,amd64 -snd_fm801 i386,amd64 -snd_gusc i386,amd64 -snd_hda i386,amd64 -snd_hdspe i386,amd64 -snd_ich i386,amd64 -snd_maestro i386,amd64 -snd_maestro3 i386,amd64 -snd_mss i386 -snd_neomagic i386,amd64 -snd_sbc i386,amd64 -snd_solo i386,amd64 -snd_spicds i386,amd64 -snd_t4dwave i386,amd64,sparc64 -snd_via8233 i386,amd64 -snd_via82c686 i386,amd64 -snd_vibes i386,amd64 -stg i386 -ti i386,amd64,sparc64 -tl i386,amd64 -trm i386,amd64 -twa i386,amd64 -twe i386,amd64 -tws i386,amd64 -ubsa i386,amd64 -ubsec i386,amd64 -ubser i386,amd64 -ucycom i386,amd64 -udav i386,amd64 -uftdi i386,amd64 -uhci i386,amd64,powerpc -ulpt i386,amd64,powerpc -umass i386,amd64,powerpc -umodem i386,amd64 -uplcom i386,amd64 -ural i386,amd64 -urio i386,amd64,powerpc -uvisor i386,amd64 -uvscom i386,amd64 -vpo i386 -vx i386,amd64 -vxge i386,amd64 -wb i386,amd64 -xe i386,amd64 -zyd i386,amd64 Property changes on: en_US.ISO8859-1/htdocs/share/misc/dev.archlist.txt ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: en_US.ISO8859-1/htdocs/share/misc/man2hwnotes.pl =================================================================== --- en_US.ISO8859-1/htdocs/share/misc/man2hwnotes.pl (revision 51140) +++ en_US.ISO8859-1/htdocs/share/misc/man2hwnotes.pl (nonexistent) @@ -1,534 +0,0 @@ -#!/usr/local/bin/perl -w -# Emacs should use -*- cperl -*- mode -# -# Copyright (c) 2003-2006 Simon L. Nielsen -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# Parse the list of supported hardware out of section 4 manual pages -# and output it on stdout as SGML/DocBook entities. - -# The script will look for the following line in the manual page: -# .Sh HARDWARE -# and make an entity of the content until the line containing: -# .Sh -# -# For Lists only the first line will be printed. If there are -# arguments to the .It command, only the argument will be printed. - -# Usage: -# man2hwnotes.pl [-cl] [-d 0-6] [-a ] [-o ] -# [ ...] - -use strict; -#use warnings; -use Getopt::Std; -use Digest::MD5 qw(md5_hex); - -# Section from manual page to extract -my $hwlist_sect = "HARDWARE"; - -# Override default archtecture list for some devices: -my $archlist_file = "dev.archlist.txt"; -my %archlist; - -# Globals -my $compat_mode = 0; # Enable compat for old Hardware Notes style -my $debuglevel = 0; -my $only_list_out = 0; # Should only lists be generated in the output? -my @out_lines; # Single lines -my @out_dev; # Device entities - -# Getopt -my %options = (); -if (!getopts("a:cd:lo:",\%options)) { - die("$!: Invalid command line arguments in ", __LINE__, "\n"); -} - -if (defined($options{c})) { - $compat_mode = 1; -} -if (defined($options{d})) { - $debuglevel = $options{d}; -} -if (defined($options{a})) { - $archlist_file = $options{a}; -} -if (defined($options{l})) { - $only_list_out = 1; -} - -my $outputfile = $options{o}; - -if ($debuglevel > 0) { - # Don't do output buffering in debug mode. - $| = 1; -} - -load_archlist($archlist_file); - -if (defined($outputfile)) { - open(OLDOUT, ">&STDOUT") || die("$!: Could not open STDOUT in ", __LINE__, ".\n"); - open(STDOUT, ">$outputfile") || die("$!: Could not open $outputfile in ", __LINE__, ".\n"); -} - -print < -EOT - -if ($only_list_out) { - # Print the default device preamble entities - print "\n"; - print "\n"; -} - -foreach my $page (@ARGV) { - if ($page !~ m/\.4$/) { - dlog(2, "Skipped $page (not *.4)"); - next; - } - dlog(2, "Parsing $page"); - parse($page); - - if (@out_lines) { - print join("\n", @out_lines), "\n"; - } - if (@out_dev) { - print join("\n", @out_dev), "\n"; - } - - @out_lines = (); - @out_dev = (); -} - -if (defined($outputfile)) { - open(STDOUT, ">&OLDOUT") || die("$!: Could not open STDOUT in ", __LINE__, ".\n"); - close(OLDOUT) || die("$!: Could not close OLDOUT in ", __LINE__, ".\n"); -} - -sub normalize (@) { - my @lines = @_; - - foreach my $l (@lines) { - $l =~ s/\\&//g; - $l =~ s:([\x21-\x2f\x5b-\x60\x7b-\x7f]):sprintf("&\#\%d;", ord($1)):eg; - # Make sure ampersand is encoded as & since jade seems to - # be confused when it is encoded as & inside an entity. - $l =~ s/&/&/g; - } - return (wantarray) ? @lines : join "", @lines; -} - -sub parse { - my ($manpage) = @_; - - my $cur_mansection; - my $found_hwlist = 0; - my %mdocvars; - $mdocvars{isin_hwlist} = 0; - $mdocvars{isin_list} = 0; - $mdocvars{first_para} = 1; - $mdocvars{parabuf} = ""; - $mdocvars{listtype} = ""; - $mdocvars{it_nr} = 0; - - open(MANPAGE, "$manpage") || die("$!: Could not open $manpage in ", __LINE__, ".\n"); - while() { - chomp; - my $line = $_; - - dlog(5, "Read '$line'"); - - # Find commands - if (s/^\.(.*)$/$1/) { - my $cmd = $1; - - # Detect, and ignore, comment lines - if (s/^\\"(.*)$/$1/) { - next; - } - - $cmd =~ s/^([^ ]+).*$/$1/; - - if (/^Nm "?(\w+)"?/ && !defined($mdocvars{Nm})) { - dlog(3, "Setting Nm to $1"); - $mdocvars{Nm} = $1; - # "_" cannot be used for an entity name. - $mdocvars{EntNm} = $1; - $mdocvars{EntNm} =~ s,_,.,g; - - } elsif (/^Nm$/) { - if (defined($mdocvars{Nm}) && $mdocvars{Nm} ne "") { - parabuf_addline(\%mdocvars, "&man.".$mdocvars{EntNm}.".$cur_mansection;"); - } else { - dlog(2, "Warning: Bad Nm call in $manpage"); - } - - } elsif (/^Sh (.+)$/) { - dlog(4, "Setting section to $1"); - my $cur_section = $1; - - flush_out(\%mdocvars); - - if ($cur_section =~ /^${hwlist_sect}$/) { - dlog(2, "Found the device section ${hwlist_sect}"); - $mdocvars{isin_hwlist} = 1; - $found_hwlist = 1; - add_sgmltag(\%mdocvars, "&hwlist.preamble.pre; " . - "&man.".$mdocvars{EntNm}.".$cur_mansection; " . - "&hwlist.preamble.post;"); - } - } elsif ($mdocvars{isin_hwlist}) { - dlog(2, "Found a HWLIST STOP key!"); - add_sgmltag(\%mdocvars, "'>"); - $mdocvars{isin_hwlist} = 0; - } - if ($mdocvars{isin_list}) { - dlog(1, "Warning: Still in list, but just entered new " . - "section. This is probably due to missing .El; " . - "check manual page for errors."); - # If we try to recover from this we will probably - # just end with bad SGML output and it really - # should be fixed in the manual page so we don't - # even try to "fix" this. - } - - - } elsif (/^Dt ([^ ]+) ([^ ]+)/) { - dlog(4, "Setting mansection to $2"); - $mdocvars{cur_manname} = lc($1); - $cur_mansection = $2; - - # "_" cannot be used for an entity name. - $mdocvars{cur_manname} =~ s,_,.,g; - - } elsif (/^It ?(.*)$/) { - my $txt = $1; - - $mdocvars{it_nr}++; - - # Flush last item - if ($mdocvars{parabuf} ne "") { - add_listitem(\%mdocvars); - } - - # Remove quotes, if any. - $txt =~ s/"(.*)"/$1/; - - if ($mdocvars{listtype} eq "column") { - # Ignore first item when it is likely to be a - # header. - if ($mdocvars{it_nr} == 1 && $txt =~ m/^(Em|Sy) /) { - dlog(2, "Skipping header line in column list"); - next; - } - # Only extract the first column. - $txt =~ s/ Ta /\t/g; - $txt =~ s/([^\t]+)\t.*/$1/; - } - - # Remove Li commands - $txt =~ s/^Li //g; - - parabuf_addline(\%mdocvars, normalize($txt)); - } elsif (/^Bl/) { - $mdocvars{isin_list} = 1; - flush_out(\%mdocvars); - add_sgmltag(\%mdocvars, ""); - - if (/-tag/) { - $mdocvars{listtype} = "tag"; - # YACK! Hack for ata(4) - if ($mdocvars{Nm} eq "ata") { - $mdocvars{listtype} = "tagHACK"; - } - } elsif (/-bullet/) { - $mdocvars{listtype} = "bullet"; - } elsif (/-column/) { - $mdocvars{listtype} = "column"; - } else { - $mdocvars{listtype} = "unknown"; - } - dlog(2, "Listtype set to $mdocvars{listtype}"); - } elsif (/^El/) { - if ($mdocvars{parabuf} ne "") { - add_listitem(\%mdocvars); - } - - add_sgmltag(\%mdocvars, ""); - $mdocvars{isin_list} = 0; - } elsif (/^Tn (.+)$/) { - # For now we print TradeName text as regular text. - my ($txt, $punct_str) = split_punct_chars($1); - - parabuf_addline(\%mdocvars, normalize($txt . $punct_str)); - } elsif (/^Xr ([^ ]+) (.+)$/) { - my ($xr_sect, $punct_str) = split_punct_chars($2); - my $txt; - - # We need to check if the manual page exist to avoid - # breaking the doc build just because of a broken - # reference. - #$txt = "&man.$1.$xr_sect;$punct_str"; - $txt = "$1($xr_sect)$punct_str"; - parabuf_addline(\%mdocvars, normalize($txt)); - } elsif (/^Dq (.+)$/) { - my ($txt, $punct_str) = split_punct_chars($1); - - parabuf_addline(\%mdocvars, - normalize("$txt$punct_str")); - } elsif (/^Sx (.+)$/) { - if ($mdocvars{isin_hwlist}) { - dlog(1, "Warning: Reference to another section in the " . - "$hwlist_sect section in " . $mdocvars{Nm} . - "(${cur_mansection})"); - } - parabuf_addline(\%mdocvars, normalize($1)); - } elsif (/^Pa (.+)$/) { - my ($txt, $punct_str) = split_punct_chars($1); - - $txt = make_ulink($txt) . $punct_str; - parabuf_addline(\%mdocvars, normalize($txt)); - } elsif (/^Pp/) { - dlog(3, "Got Pp command - forcing new para"); - flush_out(\%mdocvars); - } elsif (/^Fx (.+)/) { - dlog(3, "Got Fx command"); - parabuf_addline(\%mdocvars, "FreeBSD $1"); - } elsif (/^Fx/) { - dlog(3, "Got Fx command"); - parabuf_addline(\%mdocvars, "FreeBSD"); - } elsif (/^Em (.+)$/) { - my ($txt, $punct_str) = split_punct_chars($1); - - parabuf_addline(\%mdocvars, - normalize("$txt$punct_str")); - } else { - # Ignore all other commands. - dlog(3, "Ignoring unknown command $cmd"); - } - } else { - # This is then regular text - parabuf_addline(\%mdocvars, normalize($_)); - } - } - close(MANPAGE) || die("$!: Could not close $manpage in ", __LINE__, ".\n"); - if (! $found_hwlist) { - dlog(2, "Hardware list not found in $manpage"); - } -} - -sub dlog { - my ($level, $txt) = @_; - - if ($level <= $debuglevel) { - print STDERR "$level: $txt\n"; - } -} - -# Output a SGML tag. -sub add_sgmltag { - my ($mdocvars, $txt) = (@_); - - # We only care about the HW list for now. - if (${$mdocvars}{isin_hwlist}) { - push(@out_dev, $txt); - } -} - -# Add a text entity, and return the used entity name. -sub add_txt_ent { - my ($itemtxt) = (@_); - my ($entity_name); - - # Convert mdoc(7) minus - $itemtxt =~ s/\\-/-/g; - - $itemtxt =~ s/'/‘/g; - - $entity_name = "hwlist." . md5_hex($itemtxt); - dlog(4, "Adding '$itemtxt' as entity $entity_name"); - push(@out_lines, ""); - - return ($entity_name); -} -sub flush_out { - my ($mdocvars) = (@_); - my ($entity_name, $out); - my $para_arch = ""; - - if (!${$mdocvars}{isin_hwlist} || ${$mdocvars}{parabuf} eq "") { - return; - } - - $entity_name = add_txt_ent(${$mdocvars}{parabuf}); - ${$mdocvars}{parabuf} = ""; - if(defined($archlist{${$mdocvars}{Nm}})) { - if ($compat_mode) { - $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; - } else { - $para_arch = '[' . $archlist{${$mdocvars}{Nm}} . '] '; - } - } - if ($compat_mode) { - $out = "&".$entity_name.";"; - } else { - if (${$mdocvars}{first_para}) { - $out = "".$para_arch."&".$entity_name.";"; - } else { - $out = "&".$entity_name.";"; - } - ${$mdocvars}{first_para} = 0; - } - - dlog(4, "Flushing parabuf"); - add_sgmltag($mdocvars, $out); -} - -# Add a new list item from the "parabuf". -sub add_listitem { - my ($mdocvars) = (@_); - my ($listitem, $entity_name); - my $para_arch = ""; - - $entity_name = add_txt_ent(${$mdocvars}{parabuf}); - ${$mdocvars}{parabuf} = ""; - - if ($compat_mode) { - if(defined($archlist{${$mdocvars}{Nm}})) { - $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; - } - } - $listitem = "&".$entity_name.";"; - dlog(4, "Adding '$listitem' to out_dev"); - push(@out_dev, $listitem); - -} - -# Add a line to the "paragraph buffer" -sub parabuf_addline { - my $mdocvars = shift; - my ($txt) = (@_); - - dlog(5, "Now in parabuf_addline for '$txt'"); - - # We only care about the HW list for now. - if (!${$mdocvars}{isin_hwlist}) { - dlog(6, "Exiting parabuf_addline due to: !\${\$mdocvars}{isin_hwlist}"); - return; - } - if ($txt eq "") { - dlog(6, "Exiting parabuf_addline due to: \$txt eq \"\""); - return; - } - - if ($only_list_out && !${$mdocvars}{isin_list}) { - dlog(6, "Exiting parabuf_addline due to: ". - "\$only_list_out && !\${\$mdocvars}{isin_list}"); - return; - } - - # We only add the first line for "tag" lists - if (${$mdocvars}{parabuf} ne "" && ${$mdocvars}{isin_list} && - ${$mdocvars}{listtype} eq "tag") { - dlog(6, "Exiting parabuf_addline due to: ". - "\${\$mdocvars}{parabuf} ne \"\" && \${\$mdocvars}{isin_list} && ". - "\${\$mdocvars}{listtype} eq \"tag\""); - return; - } - - if (${$mdocvars}{parabuf} ne "") { - ${$mdocvars}{parabuf} .= " "; - } - - dlog(4, "Adding '$txt' to parabuf"); - - ${$mdocvars}{parabuf} .= $txt; -} - -sub load_archlist { - my ($file) = (@_); - - my $lineno = 0; - - dlog(2, "Parsing archlist $file"); - - open(FILE, "$file") || die("$!: Could not open archlist $file in ", __LINE__, ".\n"); - while() { - chomp; - $lineno++; - - if (/^#/ || $_ eq "") { - next; - } - - if (/(\w+)\t([\w,]+)/) { - dlog(4, "For driver $1 setting arch to $2"); - $archlist{$1} = $2; - } else { - dlog(1, "Warning: Could not parse archlist line $lineno"); - } - } - - close(FILE); -} - -# Check if a character is a mdoc(7) punctuation character. -sub is_punct_char { - my ($str) = (@_); - - return (length($str) == 1 && $str =~ /[\.,:;()\[\]\?!]/); -} - -# Split out the punctuation characters of a mdoc(7) line. -sub split_punct_chars { - my ($str) = (@_); - my (@stritems, $stritem, $punct_str); - - $punct_str = ""; - @stritems = split(/ /, $str); - - while (defined($stritem = $stritems[$#stritems]) && - is_punct_char($stritem)) { - $punct_str = $stritem . $punct_str; - pop(@stritems); - } - - return (join(' ', @stritems), $punct_str); -} - -# Create a ulink, if the string contains an URL. -sub make_ulink { - my ($str) = (@_); - - $str =~ s,(http://[^ ]+),,; - - return $str; -} Property changes on: en_US.ISO8859-1/htdocs/share/misc/man2hwnotes.pl ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: share/misc/dev.archlist.txt =================================================================== --- share/misc/dev.archlist.txt (nonexistent) +++ share/misc/dev.archlist.txt (working copy) @@ -0,0 +1,176 @@ +# +# Copyright (c) 2004-2006 The FreeBSD Project +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# +# This file is used by man2hwnotes.pl to set which drivers are usable +# on which architectures. +# +# Format: +# +# Empty lines, and lines beginning with "#" are ignored. +# [,...] +# +aac i386,amd64 +adv i386,amd64 +adw i386,amd64 +aha i386 +ahb i386 +ahd i386,sparc64,amd64 +aic i386,amd64 +amd i386,amd64 +arcmsr i386,amd64 +asr i386 +ath i386,amd64,sparc64 +aue i386,amd64,powerpc +axe i386,amd64,powerpc +bce i386,amd64 +bge i386,sparc64,amd64 +bktr i386 +bt i386,amd64 +bxe i386,amd64 +cdce i386,amd64,powerpc +ciss i386,amd64 +ce i386 +cm i386 +cnw i386,amd64 +cp i386 +ctau i386 +cue i386,amd64,powerpc +cx i386 +cxgb i386,amd64 +de i386,amd64 +dpt i386,amd64 +ed i386 +ep i386,amd64 +esp sparc64 +ex i386,amd64 +fe i386,amd64 +fwohci i386,sparc64,amd64,powerpc +hifn i386,amd64 +hpt27xx i386,amd64 +hptiop i386,amd64 +hptmv i386,amd64 +hptrr i386,amd64 +ida i386 +ie i386 +iir i386,amd64 +ips i386,amd64 +isci i386,amd64 +ixgb i386,amd64 +kue i386,amd64,powerpc +lge i386,amd64 +mfi i386,amd64 +mlx i386,amd64 +mly i386,amd64 +msk i386,amd64 +mxge i386,amd64 +my i386 +ncr i386,amd64 +ncv i386 +nfe i386,amd64 +ng_bt3c i386,amd64 +ng_ubt i386,amd64 +nsp i386 +nxge i386,amd64 +oce i386,amd64 +ohci i386,amd64,powerpc +oltr i386 +otus i386,amd64 +pcn i386,amd64 +pst i386 +qlxgb amd64 +qlxgbe amd64 +qlxge amd64 +rc i386 +ral i386,amd64 +rsu i386,amd64 +rue i386,amd64 +rum i386,amd64 +run i386,amd64 +safe i386,amd64 +sbp i386,sparc64,amd64 +sfgxe amd64 +sn i386,amd64 +snd_ad1816 i386,amd64 +snd_als4000 i386 +snd_atiixp i386,amd64 +snd_audiocs sparc64 +snd_cmi i386,amd64 +snd_cs4281 i386,amd64 +snd_csa i386,amd64 +snd_ds1 i386,amd64 +snd_emu10k1 i386,amd64 +snd_emu10kx i386,amd64 +snd_envy24 i386,amd64 +snd_envy24ht i386,amd64 +snd_es137x i386,sparc64,amd64 +snd_ess i386,amd64 +snd_fm801 i386,amd64 +snd_gusc i386,amd64 +snd_hda i386,amd64 +snd_hdspe i386,amd64 +snd_ich i386,amd64 +snd_maestro i386,amd64 +snd_maestro3 i386,amd64 +snd_mss i386 +snd_neomagic i386,amd64 +snd_sbc i386,amd64 +snd_solo i386,amd64 +snd_spicds i386,amd64 +snd_t4dwave i386,amd64,sparc64 +snd_via8233 i386,amd64 +snd_via82c686 i386,amd64 +snd_vibes i386,amd64 +stg i386 +ti i386,amd64,sparc64 +tl i386,amd64 +trm i386,amd64 +twa i386,amd64 +twe i386,amd64 +tws i386,amd64 +ubsa i386,amd64 +ubsec i386,amd64 +ubser i386,amd64 +ucycom i386,amd64 +udav i386,amd64 +uftdi i386,amd64 +uhci i386,amd64,powerpc +ulpt i386,amd64,powerpc +umass i386,amd64,powerpc +umodem i386,amd64 +uplcom i386,amd64 +ural i386,amd64 +urio i386,amd64,powerpc +uvisor i386,amd64 +uvscom i386,amd64 +vpo i386 +vx i386,amd64 +vxge i386,amd64 +wb i386,amd64 +xe i386,amd64 +zyd i386,amd64 Property changes on: share/misc/dev.archlist.txt ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: share/misc/man2hwnotes.pl =================================================================== --- share/misc/man2hwnotes.pl (nonexistent) +++ share/misc/man2hwnotes.pl (working copy) @@ -0,0 +1,534 @@ +#!/usr/local/bin/perl -w +# Emacs should use -*- cperl -*- mode +# +# Copyright (c) 2003-2006 Simon L. Nielsen +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# Parse the list of supported hardware out of section 4 manual pages +# and output it on stdout as SGML/DocBook entities. + +# The script will look for the following line in the manual page: +# .Sh HARDWARE +# and make an entity of the content until the line containing: +# .Sh +# +# For Lists only the first line will be printed. If there are +# arguments to the .It command, only the argument will be printed. + +# Usage: +# man2hwnotes.pl [-cl] [-d 0-6] [-a ] [-o ] +# [ ...] + +use strict; +#use warnings; +use Getopt::Std; +use Digest::MD5 qw(md5_hex); + +# Section from manual page to extract +my $hwlist_sect = "HARDWARE"; + +# Override default archtecture list for some devices: +my $archlist_file = "dev.archlist.txt"; +my %archlist; + +# Globals +my $compat_mode = 0; # Enable compat for old Hardware Notes style +my $debuglevel = 0; +my $only_list_out = 0; # Should only lists be generated in the output? +my @out_lines; # Single lines +my @out_dev; # Device entities + +# Getopt +my %options = (); +if (!getopts("a:cd:lo:",\%options)) { + die("$!: Invalid command line arguments in ", __LINE__, "\n"); +} + +if (defined($options{c})) { + $compat_mode = 1; +} +if (defined($options{d})) { + $debuglevel = $options{d}; +} +if (defined($options{a})) { + $archlist_file = $options{a}; +} +if (defined($options{l})) { + $only_list_out = 1; +} + +my $outputfile = $options{o}; + +if ($debuglevel > 0) { + # Don't do output buffering in debug mode. + $| = 1; +} + +load_archlist($archlist_file); + +if (defined($outputfile)) { + open(OLDOUT, ">&STDOUT") || die("$!: Could not open STDOUT in ", __LINE__, ".\n"); + open(STDOUT, ">$outputfile") || die("$!: Could not open $outputfile in ", __LINE__, ".\n"); +} + +print < +EOT + +if ($only_list_out) { + # Print the default device preamble entities + print "\n"; + print "\n"; +} + +foreach my $page (@ARGV) { + if ($page !~ m/\.4$/) { + dlog(2, "Skipped $page (not *.4)"); + next; + } + dlog(2, "Parsing $page"); + parse($page); + + if (@out_lines) { + print join("\n", @out_lines), "\n"; + } + if (@out_dev) { + print join("\n", @out_dev), "\n"; + } + + @out_lines = (); + @out_dev = (); +} + +if (defined($outputfile)) { + open(STDOUT, ">&OLDOUT") || die("$!: Could not open STDOUT in ", __LINE__, ".\n"); + close(OLDOUT) || die("$!: Could not close OLDOUT in ", __LINE__, ".\n"); +} + +sub normalize (@) { + my @lines = @_; + + foreach my $l (@lines) { + $l =~ s/\\&//g; + $l =~ s:([\x21-\x2f\x5b-\x60\x7b-\x7f]):sprintf("&\#\%d;", ord($1)):eg; + # Make sure ampersand is encoded as & since jade seems to + # be confused when it is encoded as & inside an entity. + $l =~ s/&/&/g; + } + return (wantarray) ? @lines : join "", @lines; +} + +sub parse { + my ($manpage) = @_; + + my $cur_mansection; + my $found_hwlist = 0; + my %mdocvars; + $mdocvars{isin_hwlist} = 0; + $mdocvars{isin_list} = 0; + $mdocvars{first_para} = 1; + $mdocvars{parabuf} = ""; + $mdocvars{listtype} = ""; + $mdocvars{it_nr} = 0; + + open(MANPAGE, "$manpage") || die("$!: Could not open $manpage in ", __LINE__, ".\n"); + while() { + chomp; + my $line = $_; + + dlog(5, "Read '$line'"); + + # Find commands + if (s/^\.(.*)$/$1/) { + my $cmd = $1; + + # Detect, and ignore, comment lines + if (s/^\\"(.*)$/$1/) { + next; + } + + $cmd =~ s/^([^ ]+).*$/$1/; + + if (/^Nm "?(\w+)"?/ && !defined($mdocvars{Nm})) { + dlog(3, "Setting Nm to $1"); + $mdocvars{Nm} = $1; + # "_" cannot be used for an entity name. + $mdocvars{EntNm} = $1; + $mdocvars{EntNm} =~ s,_,.,g; + + } elsif (/^Nm$/) { + if (defined($mdocvars{Nm}) && $mdocvars{Nm} ne "") { + parabuf_addline(\%mdocvars, "&man.".$mdocvars{EntNm}.".$cur_mansection;"); + } else { + dlog(2, "Warning: Bad Nm call in $manpage"); + } + + } elsif (/^Sh (.+)$/) { + dlog(4, "Setting section to $1"); + my $cur_section = $1; + + flush_out(\%mdocvars); + + if ($cur_section =~ /^${hwlist_sect}$/) { + dlog(2, "Found the device section ${hwlist_sect}"); + $mdocvars{isin_hwlist} = 1; + $found_hwlist = 1; + add_sgmltag(\%mdocvars, "&hwlist.preamble.pre; " . + "&man.".$mdocvars{EntNm}.".$cur_mansection; " . + "&hwlist.preamble.post;"); + } + } elsif ($mdocvars{isin_hwlist}) { + dlog(2, "Found a HWLIST STOP key!"); + add_sgmltag(\%mdocvars, "'>"); + $mdocvars{isin_hwlist} = 0; + } + if ($mdocvars{isin_list}) { + dlog(1, "Warning: Still in list, but just entered new " . + "section. This is probably due to missing .El; " . + "check manual page for errors."); + # If we try to recover from this we will probably + # just end with bad SGML output and it really + # should be fixed in the manual page so we don't + # even try to "fix" this. + } + + + } elsif (/^Dt ([^ ]+) ([^ ]+)/) { + dlog(4, "Setting mansection to $2"); + $mdocvars{cur_manname} = lc($1); + $cur_mansection = $2; + + # "_" cannot be used for an entity name. + $mdocvars{cur_manname} =~ s,_,.,g; + + } elsif (/^It ?(.*)$/) { + my $txt = $1; + + $mdocvars{it_nr}++; + + # Flush last item + if ($mdocvars{parabuf} ne "") { + add_listitem(\%mdocvars); + } + + # Remove quotes, if any. + $txt =~ s/"(.*)"/$1/; + + if ($mdocvars{listtype} eq "column") { + # Ignore first item when it is likely to be a + # header. + if ($mdocvars{it_nr} == 1 && $txt =~ m/^(Em|Sy) /) { + dlog(2, "Skipping header line in column list"); + next; + } + # Only extract the first column. + $txt =~ s/ Ta /\t/g; + $txt =~ s/([^\t]+)\t.*/$1/; + } + + # Remove Li commands + $txt =~ s/^Li //g; + + parabuf_addline(\%mdocvars, normalize($txt)); + } elsif (/^Bl/) { + $mdocvars{isin_list} = 1; + flush_out(\%mdocvars); + add_sgmltag(\%mdocvars, ""); + + if (/-tag/) { + $mdocvars{listtype} = "tag"; + # YACK! Hack for ata(4) + if ($mdocvars{Nm} eq "ata") { + $mdocvars{listtype} = "tagHACK"; + } + } elsif (/-bullet/) { + $mdocvars{listtype} = "bullet"; + } elsif (/-column/) { + $mdocvars{listtype} = "column"; + } else { + $mdocvars{listtype} = "unknown"; + } + dlog(2, "Listtype set to $mdocvars{listtype}"); + } elsif (/^El/) { + if ($mdocvars{parabuf} ne "") { + add_listitem(\%mdocvars); + } + + add_sgmltag(\%mdocvars, ""); + $mdocvars{isin_list} = 0; + } elsif (/^Tn (.+)$/) { + # For now we print TradeName text as regular text. + my ($txt, $punct_str) = split_punct_chars($1); + + parabuf_addline(\%mdocvars, normalize($txt . $punct_str)); + } elsif (/^Xr ([^ ]+) (.+)$/) { + my ($xr_sect, $punct_str) = split_punct_chars($2); + my $txt; + + # We need to check if the manual page exist to avoid + # breaking the doc build just because of a broken + # reference. + #$txt = "&man.$1.$xr_sect;$punct_str"; + $txt = "$1($xr_sect)$punct_str"; + parabuf_addline(\%mdocvars, normalize($txt)); + } elsif (/^Dq (.+)$/) { + my ($txt, $punct_str) = split_punct_chars($1); + + parabuf_addline(\%mdocvars, + normalize("$txt$punct_str")); + } elsif (/^Sx (.+)$/) { + if ($mdocvars{isin_hwlist}) { + dlog(1, "Warning: Reference to another section in the " . + "$hwlist_sect section in " . $mdocvars{Nm} . + "(${cur_mansection})"); + } + parabuf_addline(\%mdocvars, normalize($1)); + } elsif (/^Pa (.+)$/) { + my ($txt, $punct_str) = split_punct_chars($1); + + $txt = make_ulink($txt) . $punct_str; + parabuf_addline(\%mdocvars, normalize($txt)); + } elsif (/^Pp/) { + dlog(3, "Got Pp command - forcing new para"); + flush_out(\%mdocvars); + } elsif (/^Fx (.+)/) { + dlog(3, "Got Fx command"); + parabuf_addline(\%mdocvars, "FreeBSD $1"); + } elsif (/^Fx/) { + dlog(3, "Got Fx command"); + parabuf_addline(\%mdocvars, "FreeBSD"); + } elsif (/^Em (.+)$/) { + my ($txt, $punct_str) = split_punct_chars($1); + + parabuf_addline(\%mdocvars, + normalize("$txt$punct_str")); + } else { + # Ignore all other commands. + dlog(3, "Ignoring unknown command $cmd"); + } + } else { + # This is then regular text + parabuf_addline(\%mdocvars, normalize($_)); + } + } + close(MANPAGE) || die("$!: Could not close $manpage in ", __LINE__, ".\n"); + if (! $found_hwlist) { + dlog(2, "Hardware list not found in $manpage"); + } +} + +sub dlog { + my ($level, $txt) = @_; + + if ($level <= $debuglevel) { + print STDERR "$level: $txt\n"; + } +} + +# Output a SGML tag. +sub add_sgmltag { + my ($mdocvars, $txt) = (@_); + + # We only care about the HW list for now. + if (${$mdocvars}{isin_hwlist}) { + push(@out_dev, $txt); + } +} + +# Add a text entity, and return the used entity name. +sub add_txt_ent { + my ($itemtxt) = (@_); + my ($entity_name); + + # Convert mdoc(7) minus + $itemtxt =~ s/\\-/-/g; + + $itemtxt =~ s/'/‘/g; + + $entity_name = "hwlist." . md5_hex($itemtxt); + dlog(4, "Adding '$itemtxt' as entity $entity_name"); + push(@out_lines, ""); + + return ($entity_name); +} +sub flush_out { + my ($mdocvars) = (@_); + my ($entity_name, $out); + my $para_arch = ""; + + if (!${$mdocvars}{isin_hwlist} || ${$mdocvars}{parabuf} eq "") { + return; + } + + $entity_name = add_txt_ent(${$mdocvars}{parabuf}); + ${$mdocvars}{parabuf} = ""; + if(defined($archlist{${$mdocvars}{Nm}})) { + if ($compat_mode) { + $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; + } else { + $para_arch = '[' . $archlist{${$mdocvars}{Nm}} . '] '; + } + } + if ($compat_mode) { + $out = "&".$entity_name.";"; + } else { + if (${$mdocvars}{first_para}) { + $out = "".$para_arch."&".$entity_name.";"; + } else { + $out = "&".$entity_name.";"; + } + ${$mdocvars}{first_para} = 0; + } + + dlog(4, "Flushing parabuf"); + add_sgmltag($mdocvars, $out); +} + +# Add a new list item from the "parabuf". +sub add_listitem { + my ($mdocvars) = (@_); + my ($listitem, $entity_name); + my $para_arch = ""; + + $entity_name = add_txt_ent(${$mdocvars}{parabuf}); + ${$mdocvars}{parabuf} = ""; + + if ($compat_mode) { + if(defined($archlist{${$mdocvars}{Nm}})) { + $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; + } + } + $listitem = "&".$entity_name.";"; + dlog(4, "Adding '$listitem' to out_dev"); + push(@out_dev, $listitem); + +} + +# Add a line to the "paragraph buffer" +sub parabuf_addline { + my $mdocvars = shift; + my ($txt) = (@_); + + dlog(5, "Now in parabuf_addline for '$txt'"); + + # We only care about the HW list for now. + if (!${$mdocvars}{isin_hwlist}) { + dlog(6, "Exiting parabuf_addline due to: !\${\$mdocvars}{isin_hwlist}"); + return; + } + if ($txt eq "") { + dlog(6, "Exiting parabuf_addline due to: \$txt eq \"\""); + return; + } + + if ($only_list_out && !${$mdocvars}{isin_list}) { + dlog(6, "Exiting parabuf_addline due to: ". + "\$only_list_out && !\${\$mdocvars}{isin_list}"); + return; + } + + # We only add the first line for "tag" lists + if (${$mdocvars}{parabuf} ne "" && ${$mdocvars}{isin_list} && + ${$mdocvars}{listtype} eq "tag") { + dlog(6, "Exiting parabuf_addline due to: ". + "\${\$mdocvars}{parabuf} ne \"\" && \${\$mdocvars}{isin_list} && ". + "\${\$mdocvars}{listtype} eq \"tag\""); + return; + } + + if (${$mdocvars}{parabuf} ne "") { + ${$mdocvars}{parabuf} .= " "; + } + + dlog(4, "Adding '$txt' to parabuf"); + + ${$mdocvars}{parabuf} .= $txt; +} + +sub load_archlist { + my ($file) = (@_); + + my $lineno = 0; + + dlog(2, "Parsing archlist $file"); + + open(FILE, "$file") || die("$!: Could not open archlist $file in ", __LINE__, ".\n"); + while() { + chomp; + $lineno++; + + if (/^#/ || $_ eq "") { + next; + } + + if (/(\w+)\t([\w,]+)/) { + dlog(4, "For driver $1 setting arch to $2"); + $archlist{$1} = $2; + } else { + dlog(1, "Warning: Could not parse archlist line $lineno"); + } + } + + close(FILE); +} + +# Check if a character is a mdoc(7) punctuation character. +sub is_punct_char { + my ($str) = (@_); + + return (length($str) == 1 && $str =~ /[\.,:;()\[\]\?!]/); +} + +# Split out the punctuation characters of a mdoc(7) line. +sub split_punct_chars { + my ($str) = (@_); + my (@stritems, $stritem, $punct_str); + + $punct_str = ""; + @stritems = split(/ /, $str); + + while (defined($stritem = $stritems[$#stritems]) && + is_punct_char($stritem)) { + $punct_str = $stritem . $punct_str; + pop(@stritems); + } + + return (join(' ', @stritems), $punct_str); +} + +# Create a ulink, if the string contains an URL. +sub make_ulink { + my ($str) = (@_); + + $str =~ s,(http://[^ ]+),,; + + return $str; +} Property changes on: share/misc/man2hwnotes.pl ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property ----Next_Part(Sun_Oct_22_20_20_23_2017_745)---- ----Security_Multipart0(Sun_Oct_22_20_20_23_2017_644)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iEYEABECAAYFAlnsfvcACgkQTyzT2CeTzy0x4ACdGF+zXa956jRN70mStb3RXMw8 LIkAniV/JaS5UfXZv/+aNuUl1nO7MN7x =s98r -----END PGP SIGNATURE----- ----Security_Multipart0(Sun_Oct_22_20_20_23_2017_644)----