aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMatthias Klose <doko@debian.org>2001-12-14 22:46:31 +0000
committerMatthias Klose <doko@debian.org>2001-12-14 22:46:31 +0000
commit2400135815309748c50d9b74274a325791843dd3 (patch)
tree49f0e3b0355de1a90e2f2c4b034ac8cbdd165d4d /contrib
parent8429941f52e7506f47a26fda818a1621d7867f18 (diff)
2001-12-12 Matthias Klose <doko@debian.org>
* texi2pod.pl: Merge changes from binutils' texi2pod.pl. Allows generation of more than one man page from one source. Add '-' to set of valid chars for an identifier. Let -D option accept flags of the form <flag>=<value>. Use \s+ for whitespace detection in '@c man' lines. Handle @set and @clear independent of $output. Substitute all @value{}'s in a line. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@48015 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog16
-rwxr-xr-xcontrib/texi2pod.pl46
2 files changed, 49 insertions, 13 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index c61d1e371fd..14ce2080fe0 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,13 @@
+2001-12-12 Matthias Klose <doko@debian.org>
+
+ * texi2pod.pl: Merge changes from binutils' texi2pod.pl. Allows
+ generation of more than one man page from one source.
+ Add '-' to set of valid chars for an identifier.
+ Let -D option accept flags of the form <flag>=<value>.
+ Use \s+ for whitespace detection in '@c man' lines.
+ Handle @set and @clear independent of $output.
+ Substitute all @value{}'s in a line.
+
2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
* texi2pod.pl: Handle @ifnottex, @iftex and @display. Handle @var
@@ -16,13 +26,13 @@
2001-09-07 Richard Sandiford <rsandifo@redhat.com>
Revert:
- * gcc_update: (files_and_dependencies) Add gcc/java/parse.c
+ * gcc_update: (files_and_dependencies) Add gcc/java/parse.c
gcc/java/parse-scan.c and gcc/java/keyword.h to list of files to
touch.
2001-09-04 David.Billinghurst <David.Billinghurst@riotinto.com>
- * gcc_update: (files_and_dependencies) Add gcc/java/parse.c
+ * gcc_update: (files_and_dependencies) Add gcc/java/parse.c
gcc/java/parse-scan.c and gcc/java/keyword.h to list of files to
touch.
@@ -46,7 +56,7 @@ Fri Jul 27 18:01:21 CEST 2001 Jan Hubicka <jh@suse.cz>
* gcc_update: Dump timestamp in LAST_UPDATED.
-2001-07-26 Andreas Jaeger <aj@suse.de>,
+2001-07-26 Andreas Jaeger <aj@suse.de>,
Hans-Peter Nilsson <hp@bitrange.com>
* analyze_brprob: Fix documentation.
diff --git a/contrib/texi2pod.pl b/contrib/texi2pod.pl
index 8c8b4f98593..770671a17b5 100755
--- a/contrib/texi2pod.pl
+++ b/contrib/texi2pod.pl
@@ -41,11 +41,13 @@ while ($_ = shift) {
} else {
$flag = shift;
}
+ $value = "";
+ ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
die "no flag specified for -D\n"
unless $flag ne "";
- die "flags may only contain letters, digits, hyphens, and underscores\n"
+ die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
- $defs{$flag} = "";
+ $defs{$flag} = $value;
} elsif (/^-/) {
usage();
} else {
@@ -73,24 +75,43 @@ while(<STDIN>)
|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 = $1, next;
- /^\@settitle\s+([^.]+)/ and $tl = $1, next;
+ /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), 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 = $1;
+ $tl = 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 man begin ([A-Z]+)/ and $sect = $1, $output = 1, next;
- /^\@c man end/ and do {
+ /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
+ $output = 1 if exists $defs{$2};
+ $sect = $1;
+ next;
+ };
+ /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
+ /^\@c\s+man\s+end/ and do {
$sects{$sect} = "" unless exists $sects{$sect};
$sects{$sect} .= postprocess($section);
$section = "";
$output = 0;
next;
};
+
+ # handle variables
+ /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and $defs{$1} = $2, next;
+ /^\@clear\s+([a-zA-Z0-9_-]+)/ and delete $defs{$1}, next;
+
next unless $output;
# Discard comments. (Can't do it above, because then we'd never see
@@ -188,8 +209,6 @@ while(<STDIN>)
}
# Single line command handlers.
- /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and $defs{$1} = $2, next;
- /^\@clear\s+([a-zA-Z0-9_-]+)/ and delete $defs{$1}, next;
/^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ and $_ = "\n=head2 $1\n";
/^\@subsection\s+(.+)$/ and $_ = "\n=head3 $1\n";
@@ -274,7 +293,15 @@ sub postprocess
local $_ = $_[0];
# @value{foo} is replaced by whatever 'foo' is defined as.
- s/\@value\{([a-zA-Z0-9_-]+)\}/$defs{$1}/g;
+ 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 = $defs{$2};
+ s/\Q$1\E/$value/;
+ }
+ }
# Formatting commands.
# Temporary escape for @r.
@@ -355,4 +382,3 @@ sub add_footnote
$sects{FOOTNOTES} .= $_[0];
$sects{FOOTNOTES} .= "\n\n";
}
-