From nobody Fri Nov 14 01:03:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1583769321; cv=none; d=zohomail.com; s=zohoarc; b=jEQTkm2zf7RjBDJRPDRJmug1DBVCTBCftFIhU+YVfim62rhDin4ZEwve9mCMsVw+jMZZj6fOOxN5inzENiYUrwR43HeEPp4vRSvY7Kvowg1+H5K6YYZNbuJqV0L3uYEplO0AsEqr5kVLBVZDEofOz2zJ2I5/P3BlmcEND6trFls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583769321; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TwUFslsYRAq6DQ8EhJ3Ic/biPCQDulRhcZjvZY+KwEE=; b=hceVi9Rvd36xzrDZOj8EW+BaTFOSztPj/GjWDDiXXCP+0R1AKJ/0vF35RbGPYAubmt4VpmNb3PpZWTpLwHdbI2PrN4mnpqkxpURJrBSNzZR2gFt/eztozjujGDprJxihc5MlH6rbUSot/m/dsiO4p+E0AMNMXQAh+PtJPDF5s7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158376932194095.71966531929911; Mon, 9 Mar 2020 08:55:21 -0700 (PDT) Received: from localhost ([::1]:45724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBKkS-0001v3-Jn for importer@patchew.org; Mon, 09 Mar 2020 11:55:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40527) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBKa1-0002Gl-5o for qemu-devel@nongnu.org; Mon, 09 Mar 2020 11:44:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBKZy-0001XR-Il for qemu-devel@nongnu.org; Mon, 09 Mar 2020 11:44:33 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:40191) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jBKZy-0001X0-AO for qemu-devel@nongnu.org; Mon, 09 Mar 2020 11:44:30 -0400 Received: by mail-wr1-x436.google.com with SMTP id p2so11015445wrw.7 for ; Mon, 09 Mar 2020 08:44:30 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id d63sm25932166wmd.44.2020.03.09.08.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 08:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TwUFslsYRAq6DQ8EhJ3Ic/biPCQDulRhcZjvZY+KwEE=; b=VY0KyOIrExZq//d/UaGlzKnDRTdY3iC/vWsnYbmTDza/+OoVezNJJ4FTQGmjaVWMGh LmtNTeF4k5+RM+RWGERuVi1DA9vvL0kFwlb5eGi7mOrZ+KnLlI2U5F5UTNxUMc+m+JZl 5hL9Z0Z3ssRIhIiaoPj/n3MiwvuB1wDAtA7BaJnCQBwfdlZkju1JFm/ce3EBBknuQtEW mXMP3yoHltXfAaTwCLsi7D82jU5l6ekw0x8WnewkO8zEdRflxEOWR5QXR/HYp/ALu+Eu WpCYcIKtSkIW/sAe2uH8yiJusJXzEYPUNJhPzTSWLtGg/KYxvMS43mkxzrnIcg5CzZVN TCkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TwUFslsYRAq6DQ8EhJ3Ic/biPCQDulRhcZjvZY+KwEE=; b=ID9gYTBrgtW0Bq9AGQoMQFn5m0Y/oi5tisr8cZjGzWPUkOqiGeQgHgN4jNJOH6aZvX mOTNyxFjjt3WuCEpsespQ2vbF/Vu++hC9wRxnsHw4VyJsfmQMzistVpmESY0LpqpvTtQ JAWpldH0XLvPugVJbiX901dBVwWzKAQ6GHwlfhyHsk0iYMA1MF+CyvBtguMEb8JLg3Xx EXIgZmgNBlsr5dRB0aSBuhSnJc8pk/v3sB0nRs5tjQyUmQ3orCwV4V1LkK7E4lph0WLv 3roWM4Y2MXdlopIy0axtYFVjrGASb5rAIpDeunWURwg1dz2nPY35wjSrUMrPDEtsInTi 7HHw== X-Gm-Message-State: ANhLgQ0EQhfEUFW8ZwPTRgfSPcAjyA31IJ2gQQ2/XYZTvUxjbVr3rfLT gUGdYkhsZaRv3njanbxVAJlU1I5ZkETcjA== X-Google-Smtp-Source: ADFU+vvbN+bCrnmQClfqbduFTBqnT0HRmQYFv9oJZvmnSW3f6OITCcxHioLd9wKBJDo21SJ+WLk+gg== X-Received: by 2002:a5d:6a8d:: with SMTP id s13mr18667066wru.260.1583768668214; Mon, 09 Mar 2020 08:44:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v4 15/18] scripts/texi2pod: Delete unused script Date: Mon, 9 Mar 2020 15:44:02 +0000 Message-Id: <20200309154405.13548-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200309154405.13548-1-peter.maydell@linaro.org> References: <20200309154405.13548-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Markus Armbruster , Michael Roth , Stefan Hajnoczi , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We no longer need the texi2pod script, so we can delete it, and the special-casing it had in the checkpatch script. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- scripts/checkpatch.pl | 2 +- scripts/texi2pod.pl | 536 ------------------------------------------ 2 files changed, 1 insertion(+), 537 deletions(-) delete mode 100755 scripts/texi2pod.pl diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b27e4ff5e95..701f76a6ccc 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1631,7 +1631,7 @@ sub process { # tabs are only allowed in assembly source code, and in # some scripts we imported from other projects. next if ($realfile =3D~ /\.(s|S)$/); - next if ($realfile =3D~ /(checkpatch|get_maintainer|texi2pod)\.pl$/); + next if ($realfile =3D~ /(checkpatch|get_maintainer)\.pl$/); =20 if ($rawline =3D~ /^\+.*\t/) { my $herevet =3D "$here\n" . cat_vet($rawline) . "\n"; diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl deleted file mode 100755 index 8bfc6f6f4c4..00000000000 --- a/scripts/texi2pod.pl +++ /dev/null @@ -1,536 +0,0 @@ -#! /usr/bin/env perl - -# Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This file is part of GCC. - -# GCC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# GCC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING. If not, -# see . - -# This does trivial (and I mean _trivial_) conversion of Texinfo -# markup to Perl POD format. It's intended to be used to extract -# something suitable for a manpage from a Texinfo document. - -use warnings; - -$output =3D 0; -$skipping =3D 0; -%sects =3D (); -$section =3D ""; -@icstack =3D (); -@endwstack =3D (); -@skstack =3D (); -@instack =3D (); -$shift =3D ""; -%defs =3D (); -$fnno =3D 1; -$inf =3D ""; -$ibase =3D ""; -@ipath =3D (); -$encoding =3D undef; -@args =3D (); - -while ($_ =3D shift) { - if (/^-D(.*)$/) { - if ($1 ne "") { - $flag =3D $1; - } else { - $flag =3D shift; - } - $value =3D ""; - ($flag, $value) =3D ($flag =3D~ /^([^=3D]+)(?:=3D(.+))?/); - die "no flag specified for -D\n" - unless $flag ne ""; - die "flags may only contain letters, digits, hyphens, dashes and undersco= res\n" - unless $flag =3D~ /^[a-zA-Z0-9_-]+$/; - $defs{$flag} =3D $value; - } elsif (/^-I(.*)$/) { - if ($1 ne "") { - $flag =3D $1; - } else { - $flag =3D shift; - } - push (@ipath, $flag); - } elsif (/^-/) { - usage(); - } else { - $in =3D $_, next unless defined $in; - $out =3D $_, next unless defined $out; - usage(); - } -} - -if (defined $in) { - $inf =3D gensym(); - open($inf, "<$in") or die "opening \"$in\": $!\n"; - $ibase =3D $1 if $in =3D~ m|^(.+)/[^/]+$|; -} else { - $inf =3D \*STDIN; -} - -if (defined $out) { - open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; -} - -while(defined $inf) { -while(<$inf>) { - # Certain commands are discarded without further processing. - /^\@(?: - [a-z]+index # @*index: useful only in complete manual - |need # @need: useful only in printed manual - |(?:end\s+)?group # @group .. @end group: ditto - |page # @page: ditto - |node # @node: useful only in .info file - |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents - )\b/x and next; - - chomp; - - # Look for filename and title markers. - /^\@setfilename\s+([^.]+)/ and $fn =3D $1, next; - /^\@settitle\s+([^.]+)/ and $tl =3D postprocess($1), next; - - # Look for document encoding - /^\@documentencoding\s+([^.]+)/ and do { - $encoding =3D $1 unless defined $encoding; - next; - }; - - # Identify a man title but keep only the one we are interested in. - /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { - if (exists $defs{$1}) { - $fn =3D $1; - $tl =3D postprocess($2); - } - next; - }; - - # Look for blocks surrounded by @c man begin SECTION ... @c man end. - # This really oughta be @ifman ... @end ifman and the like, but such - # would require rev'ing all other Texinfo translators. - /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { - $output =3D 1 if exists $defs{$2}; - $sect =3D $1; - next; - }; - /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect =3D $1, $output =3D 1, next; - /^\@c\s+man\s+end/ and do { - $sects{$sect} =3D "" unless exists $sects{$sect}; - $sects{$sect} .=3D postprocess($section); - $section =3D ""; - $output =3D 0; - next; - }; - - # handle variables - /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { - $defs{$1} =3D $2; - next; - }; - /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { - delete $defs{$1}; - next; - }; - - # Single line command handlers. - - /^\@include\s+(.+)$/ and do { - push @instack, $inf; - $inf =3D gensym(); - $file =3D postprocess($1); - - # Try cwd and $ibase, then explicit -I paths. - $done =3D 0; - foreach $path ("", $ibase, @ipath) { - $mypath =3D $file; - $mypath =3D $path . "/" . $mypath if ($path ne ""); - open($inf, "<" . $mypath) and ($done =3D 1, last); - } - die "cannot find $file" if !$done; - next; - }; - - next unless $output; - - # Discard comments. (Can't do it above, because then we'd never see - # @c man lines.) - /^\@c\b/ and next; - - # End-block handler goes up here because it needs to operate even - # if we are skipping. - /^\@end\s+([a-z]+)/ and do { - # Ignore @end foo, where foo is not an operation which may - # cause us to skip, if we are presently skipping. - my $ended =3D $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|copyi= ng)$/; - - die "\@end $ended without \@$ended at line $.\n" unless defined $endw; - die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; - - $endw =3D pop @endwstack; - - if ($ended =3D~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { - $skipping =3D pop @skstack; - next; - } elsif ($ended =3D~ /^(?:example|smallexample|display - |quotation|deftp|deftypefn)$/x) { - $shift =3D ""; - $_ =3D ""; # need a paragraph break - } elsif ($ended =3D~ /^(?:itemize|enumerate|[fv]?table)$/) { - $_ =3D "\n=3Dback\n"; - $ic =3D pop @icstack; - } elsif ($ended eq "multitable") { - $_ =3D "\n=3Dback\n"; - } else { - die "unknown command \@end $ended at line $.\n"; - } - }; - - # We must handle commands which can cause skipping even while we - # are skipping, otherwise we will not process nested conditionals - # correctly. - /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw =3D "ifset"; - $skipping =3D 1 unless exists $defs{$1}; - next; - }; - - /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw =3D "ifclear"; - $skipping =3D 1 if exists $defs{$1}; - next; - }; - - /^\@(ignore|menu|iftex|copying)\b/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw =3D $1; - $skipping =3D 1; - next; - }; - - next if $skipping; - - # Character entities. First the ones that can be replaced by raw text - # or discarded outright: - s/\@copyright\{\}/(c)/g; - s/\@dots\{\}/.../g; - s/\@enddots\{\}/..../g; - s/\@([.!? ])/$1/g; - s/\@[:-]//g; - s/\@bullet(?:\{\})?/*/g; - s/\@TeX\{\}/TeX/g; - s/\@pounds\{\}/\#/g; - s/\@minus(?:\{\})?/-/g; - s/\\,/,/g; - - # Now the ones that have to be replaced by special escapes - # (which will be turned back into text by unmunge()) - s/&/&/g; - s/\@\{/{/g; - s/\@\}/}/g; - s/\@\@/&at;/g; - - # Inside a verbatim block, handle @var specially. - if ($shift ne "") { - s/\@var\{([^\}]*)\}/<$1>/g; - } - - # POD doesn't interpret E<> inside a verbatim block. - if ($shift eq "") { - s//>/g; - } else { - s//>/g; - } - - /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ - and $_ =3D "\n=3Dhead2 $1\n"; - /^\@subsection\s+(.+)$/ - and $_ =3D "\n=3Dhead3 $1\n"; - /^\@subsubsection\s+(.+)$/ - and $_ =3D "\n=3Dhead4 $1\n"; - - # Block command handlers: - /^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do { - push @endwstack, $endw; - push @icstack, $ic; - if (defined $1) { - $ic =3D $1; - } else { - $ic =3D '*'; - } - $_ =3D "\n=3Dover 4\n"; - $endw =3D "itemize"; - }; - - /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do { - push @endwstack, $endw; - push @icstack, $ic; - if (defined $1) { - $ic =3D $1 . "."; - } else { - $ic =3D "1."; - } - $_ =3D "\n=3Dover 4\n"; - $endw =3D "enumerate"; - }; - - /^\@multitable\s.*/ and do { - push @endwstack, $endw; - $endw =3D "multitable"; - $_ =3D "\n=3Dover 4\n"; - }; - - /^\@([fv]?table)\s+(\@[a-z]+)/ and do { - push @endwstack, $endw; - push @icstack, $ic; - $endw =3D $1; - $ic =3D $2; - $ic =3D~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/; - $ic =3D~ s/\@(?:code|kbd)/C/; - $ic =3D~ s/\@(?:dfn|var|emph|cite|i)/I/; - $ic =3D~ s/\@(?:file)/F/; - $ic =3D~ s/\@(?:asis)//; - $_ =3D "\n=3Dover 4\n"; - }; - - /^\@((?:small)?example|display)/ and do { - push @endwstack, $endw; - $endw =3D $1; - $shift =3D "\t"; - $_ =3D ""; # need a paragraph break - }; - - /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do { - @columns =3D (); - for $column (split (/\s*\@tab\s*/, $1)) { - # @strong{...} is used a @headitem work-alike - $column =3D~ s/^\@strong\{(.*)\}$/$1/; - push @columns, $column; - } - $_ =3D "\n=3Ditem ".join (" : ", @columns)."\n"; - }; - - /^\@(quotation)\s*(.+)?$/ and do { - push @endwstack, $endw; - $endw =3D $1; - $_ =3D "\n$2:" - }; - - /^{(.*)}$|^(.*)$/ and $#args > 0 and do { - $kind =3D $args[0]; - $arguments =3D $1 // ""; - if ($endw eq "deftypefn") { - $ret =3D $args[1]; - $fname =3D "B<$args[2]>"; - $_ =3D $ret ? "$ret " : ""; - $_ .=3D "$fname $arguments ($kind)"; - } else { - $_ =3D "B<$args[1]> ($kind)\n\n$arguments"; - } - @args =3D (); - }; - - /^\@(deftp)\s*(.+)?$/ and do { - push @endwstack, $endw; - $endw =3D $1; - $arg =3D $2; - $arg =3D~ s/{([^}]*)}/$1/g; - $arg =3D~ s/\@$//; - @args =3D split (/ /, $arg); - $_ =3D ""; - }; - - /^\@(deftypefn)\s*(.+)?$/ and do { - push @endwstack, $endw; - $endw =3D $1; - $arg =3D $2; - $arg =3D~ s/{([^}]*)}/$1/g; - $arg =3D~ s/\@$//; - @args =3D split (/ /, $arg); - $_ =3D ""; - }; - - /^\@itemx?\s*(.+)?$/ and do { - if (defined $1) { - if ($ic eq "") { - $_ =3D "\n=3Ditem $1\n"; - } else { - # Entity escapes prevent munging by the <> processing belo= w. - $_ =3D "\n=3Ditem $ic\<$1\>\n"; - } - } else { - $_ =3D "\n=3Ditem $ic\n"; - $ic =3D~ y/A-Ya-y/B-Zb-z/; - $ic =3D~ s/(\d+)/$1 + 1/eg; - } - }; - - $section .=3D $shift.$_."\n"; -} -# End of current file. -close($inf); -$inf =3D pop @instack; -} - -die "No filename or title\n" unless defined $fn && defined $tl; - -print "=3Dencoding $encoding\n\n" if defined $encoding; - -$sects{NAME} =3D "$fn \- $tl\n"; -$sects{FOOTNOTES} .=3D "=3Dback\n" if exists $sects{FOOTNOTES}; - -for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES - BUGS NOTES FOOTNOTES EXAMPLES SEEALSO AUTHOR COPYRIGHT)) { - if(exists $sects{$sect}) { - $head =3D $sect; - $head =3D~ s/SEEALSO/SEE ALSO/; - print "=3Dhead1 $head\n\n"; - print scalar unmunge ($sects{$sect}); - print "\n"; - } -} - -sub usage -{ - die "usage: $0 [-D toggle...] [infile [outfile]]\n"; -} - -sub postprocess -{ - local $_ =3D $_[0]; - - # @value{foo} is replaced by whatever 'foo' is defined as. - while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) { - if (! exists $defs{$2}) { - print STDERR "Option $2 not defined\n"; - s/\Q$1\E//; - } else { - $value =3D $defs{$2}; - s/\Q$1\E/$value/; - } - } - - # Formatting commands. - # Temporary escape for @r. - s/\@r\{([^\}]*)\}/R<$1>/g; - s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g; - s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g; - s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<= $1>/g; - s/\@sc\{([^\}]*)\}/\U$1/g; - s/\@file\{([^\}]*)\}/F<$1>/g; - s/\@w\{([^\}]*)\}/S<$1>/g; - s/\@t\{([^\}]*)\}/$1/g; - s/\@(?:dmn|math)\{([^\}]*)\}/$1/g; - - # keep references of the form @ref{...}, print them bold - s/\@(?:ref)\{([^\}]*)\}/B<$1>/g; - - # Change double single quotes to double quotes. - s/''/"/g; - s/``/"/g; - - # Cross references are thrown away, as are @noindent and @refill. - # (@noindent is impossible in .pod, and @refill is unnecessary.) - # @* is also impossible in .pod; we discard it and any newline that - # follows it. Similarly, our macro @gol must be discarded. - - s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; - s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; - s/;\s+\@pxref\{(?:[^\}]*)\}//g; - s/\@noindent\s*//g; - s/\@refill//g; - s/\@gol//g; - s/\@\*\s*\n?//g; - - # Anchors are thrown away - s/\@anchor\{(?:[^\}]*)\}//g; - - # @uref can take one, two, or three arguments, with different - # semantics each time. @url and @email are just like @uref with - # one argument, for our purposes. - s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; - s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; - s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; - - # Un-escape <> at this point. - s/<//g; - - # Now un-nest all B<>, I<>, R<>. Theoretically we could have - # indefinitely deep nesting; in practice, one level suffices. - 1 while s/([BIR])<([^<>]*)([BIR])<([^<>]*)>/$1<$2>$3<$4>$1 with bare ...; eliminate empty markup, B<>; - # shift white space at the ends of [BI]<...> expressions outside - # the expression. - s/R<([^<>]*)>/$1/g; - s/[BI]<>//g; - s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g; - s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g; - - # Extract footnotes. This has to be done after all other - # processing because otherwise the regexp will choke on formatting - # inside @footnote. - while (/\@footnote/g) { - s/\@footnote\{([^\}]+)\}/[$fnno]/; - add_footnote($1, $fnno); - $fnno++; - } - - return $_; -} - -sub unmunge -{ - # Replace escaped symbols with their equivalents. - local $_ =3D $_[0]; - - s/</E/g; - s/>/E/g; - s/{/\{/g; - s/}/\}/g; - s/&at;/\@/g; - s/&/&/g; - return $_; -} - -sub add_footnote -{ - unless (exists $sects{FOOTNOTES}) { - $sects{FOOTNOTES} =3D "\n=3Dover 4\n\n"; - } - - $sects{FOOTNOTES} .=3D "=3Ditem $fnno.\n\n"; $fnno++; - $sects{FOOTNOTES} .=3D $_[0]; - $sects{FOOTNOTES} .=3D "\n\n"; -} - -# stolen from Symbol.pm -{ - my $genseq =3D 0; - sub gensym - { - my $name =3D "GEN" . $genseq++; - my $ref =3D \*{$name}; - delete $::{$name}; - return $ref; - } -} --=20 2.20.1