mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Run newly-configured perltidy script on Perl files.
Run on HEAD and 9.2.
This commit is contained in:
@@ -6,36 +6,41 @@
|
||||
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";
|
||||
print "/* there is deliberately not an #ifndef ERRCODES_H here */\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 a comment for each section header
|
||||
if (/^Section:(.*)/) {
|
||||
# Emit a comment for each section header
|
||||
if (/^Section:(.*)/)
|
||||
{
|
||||
my $header = $1;
|
||||
$header =~ s/^\s+//;
|
||||
print "\n/* $header */\n";
|
||||
next;
|
||||
}
|
||||
|
||||
die "unable to parse errcodes.txt" unless /^([^\s]{5})\s+[EWS]\s+([^\s]+)/;
|
||||
die "unable to parse errcodes.txt"
|
||||
unless /^([^\s]{5})\s+[EWS]\s+([^\s]+)/;
|
||||
|
||||
(my $sqlstate, my $errcode_macro) = ($1, $2);
|
||||
(my $sqlstate, my $errcode_macro) = ($1, $2);
|
||||
|
||||
# Split the sqlstate letters
|
||||
$sqlstate = join ",", split "", $sqlstate;
|
||||
# And quote them
|
||||
$sqlstate =~ s/([^,])/'$1'/g;
|
||||
# Split the sqlstate letters
|
||||
$sqlstate = join ",", split "", $sqlstate;
|
||||
|
||||
print "#define $errcode_macro MAKE_SQLSTATE($sqlstate)\n";
|
||||
# And quote them
|
||||
$sqlstate =~ s/([^,])/'$1'/g;
|
||||
|
||||
print "#define $errcode_macro MAKE_SQLSTATE($sqlstate)\n";
|
||||
}
|
||||
|
||||
close $errcodes;
|
||||
|
Reference in New Issue
Block a user