1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

Run newly-configured perltidy script on Perl files.

Run on HEAD and 9.2.
This commit is contained in:
Bruce Momjian
2012-07-04 21:47:48 -04:00
parent 9c6f8be2b1
commit 2bc09ff499
53 changed files with 3249 additions and 2590 deletions

View File

@ -6,51 +6,54 @@
use warnings;
use strict;
print "<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
print
"<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
open my $errcodes, $ARGV[0] or die;
while (<$errcodes>) {
chomp;
while (<$errcodes>)
{
chomp;
# Skip comments
next if /^#/;
next if /^\s*$/;
# Skip comments
next if /^#/;
next if /^\s*$/;
# Emit section headers
if (/^Section:/) {
# Emit section headers
if (/^Section:/)
{
# Remove the Section: string
s/^Section: //;
# Escape dashes for SGML
s/-/&mdash;/;
# Wrap PostgreSQL in <productname/>
s/PostgreSQL/<productname>PostgreSQL<\/>/g;
# Remove the Section: string
s/^Section: //;
print "\n\n";
# Escape dashes for SGML
s/-/&mdash;/;
# Wrap PostgreSQL in <productname/>
s/PostgreSQL/<productname>PostgreSQL<\/>/g;
print "\n\n";
print "<row>\n";
print "<entry spanname=\"span12\">";
print "<emphasis role=\"bold\">$_</></entry>\n";
print "</row>\n";
next;
}
die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
(my $sqlstate, my $type, my $errcode_macro, my $condition_name) =
($1, $2, $3, $4);
# Skip lines without PL/pgSQL condition names
next unless defined($condition_name);
print "\n";
print "<row>\n";
print "<entry spanname=\"span12\">";
print "<emphasis role=\"bold\">$_</></entry>\n";
print "<entry><literal>$sqlstate</literal></entry>\n";
print "<entry><symbol>$condition_name</symbol></entry>\n";
print "</row>\n";
next;
}
die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
(my $sqlstate,
my $type,
my $errcode_macro,
my $condition_name) = ($1, $2, $3, $4);
# Skip lines without PL/pgSQL condition names
next unless defined($condition_name);
print "\n";
print "<row>\n";
print "<entry><literal>$sqlstate</literal></entry>\n";
print "<entry><symbol>$condition_name</symbol></entry>\n";
print "</row>\n";
}
close $errcodes;

View File

@ -25,34 +25,41 @@ process_file($infile);
exit 0;
sub process_file {
my $filename = shift;
sub process_file
{
my $filename = shift;
local *FILE; # need a local filehandle so we can recurse
local *FILE; # need a local filehandle so we can recurse
my $f = $srcdir . '/' . $filename;
open(FILE, $f) || die "could not read $f: $!\n";
my $f = $srcdir . '/' . $filename;
open(FILE, $f) || die "could not read $f: $!\n";
while (<FILE>) {
# Recursively expand sub-files of the release notes
if (m/^&(release-.*);$/) {
process_file($1 . ".sgml");
next;
while (<FILE>)
{
# Recursively expand sub-files of the release notes
if (m/^&(release-.*);$/)
{
process_file($1 . ".sgml");
next;
}
# Remove <link ...> tags, which might span multiple lines
while (m/<link/)
{
if (s/<link\s+linkend[^>]*>//)
{
next;
}
# incomplete tag, so slurp another line
$_ .= <FILE>;
}
# Remove </link> too
s|</link>||g;
print;
}
# Remove <link ...> tags, which might span multiple lines
while (m/<link/) {
if (s/<link\s+linkend[^>]*>//) {
next;
}
# incomplete tag, so slurp another line
$_ .= <FILE>;
}
# Remove </link> too
s|</link>||g;
print;
}
close(FILE);
close(FILE);
}

View File

@ -8,14 +8,18 @@ open PACK, $ARGV[1] or die;
my %feature_packages;
while (<PACK>) {
chomp;
my ($fid, $pname) = split /\t/;
if ($feature_packages{$fid}) {
$feature_packages{$fid} .= ", $pname";
} else {
$feature_packages{$fid} = $pname;
}
while (<PACK>)
{
chomp;
my ($fid, $pname) = split /\t/;
if ($feature_packages{$fid})
{
$feature_packages{$fid} .= ", $pname";
}
else
{
$feature_packages{$fid} = $pname;
}
}
close PACK;
@ -24,33 +28,41 @@ open FEAT, $ARGV[2] or die;
print "<tbody>\n";
while (<FEAT>) {
chomp;
my ($feature_id, $feature_name, $subfeature_id, $subfeature_name, $is_supported, $comments) = split /\t/;
while (<FEAT>)
{
chomp;
my ($feature_id, $feature_name, $subfeature_id,
$subfeature_name, $is_supported, $comments) = split /\t/;
$is_supported eq $yesno || next;
$is_supported eq $yesno || next;
$feature_name =~ s/</&lt;/g;
$feature_name =~ s/>/&gt;/g;
$subfeature_name =~ s/</&lt;/g;
$subfeature_name =~ s/>/&gt;/g;
$feature_name =~ s/</&lt;/g;
$feature_name =~ s/>/&gt;/g;
$subfeature_name =~ s/</&lt;/g;
$subfeature_name =~ s/>/&gt;/g;
print " <row>\n";
print " <row>\n";
if ($subfeature_id) {
print " <entry>$feature_id-$subfeature_id</entry>\n";
} else {
print " <entry>$feature_id</entry>\n";
}
print " <entry>" . $feature_packages{$feature_id} . "</entry>\n";
if ($subfeature_id) {
print " <entry>$subfeature_name</entry>\n";
} else {
print " <entry>$feature_name</entry>\n";
}
print " <entry>$comments</entry>\n";
if ($subfeature_id)
{
print " <entry>$feature_id-$subfeature_id</entry>\n";
}
else
{
print " <entry>$feature_id</entry>\n";
}
print " <entry>" . $feature_packages{$feature_id} . "</entry>\n";
if ($subfeature_id)
{
print " <entry>$subfeature_name</entry>\n";
}
else
{
print " <entry>$feature_name</entry>\n";
}
print " <entry>$comments</entry>\n";
print " </row>\n";
print " </row>\n";
}
print "</tbody>\n";