mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-23 14:57:03 +08:00
Run pgindent, pgperltidy, and reformat-dat-files. This set of diffs is a bit larger than typical. We've updated to pg_bsd_indent 2.1.2, which properly indents variable declarations that have multi-line initialization expressions (the continuation lines are now indented one tab stop). We've also updated to perltidy version 20230309 and changed some of its settings, which reduces its desire to add whitespace to lines to make assignments etc. line up. Going forward, that should make for fewer random-seeming changes to existing code. Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql
85 lines
1.4 KiB
Perl
85 lines
1.4 KiB
Perl
use strict;
|
|
use warnings;
|
|
use Getopt::Long;
|
|
|
|
my $format;
|
|
my $libname;
|
|
my $input;
|
|
my $output;
|
|
|
|
GetOptions(
|
|
'format:s' => \$format,
|
|
'libname:s' => \$libname,
|
|
'input:s' => \$input,
|
|
'output:s' => \$output) or die "wrong arguments";
|
|
|
|
if (not( $format eq 'aix'
|
|
or $format eq 'darwin'
|
|
or $format eq 'gnu'
|
|
or $format eq 'win'))
|
|
{
|
|
die "$0: $format is not yet handled (only aix, darwin, gnu, win are)\n";
|
|
}
|
|
|
|
open(my $input_handle, '<', $input)
|
|
or die "$0: could not open input file '$input': $!\n";
|
|
|
|
open(my $output_handle, '>', $output)
|
|
or die "$0: could not open output file '$output': $!\n";
|
|
|
|
|
|
if ($format eq 'gnu')
|
|
{
|
|
print $output_handle "{
|
|
global:
|
|
";
|
|
}
|
|
elsif ($format eq 'win')
|
|
{
|
|
# XXX: Looks like specifying LIBRARY $libname is optional, which makes it
|
|
# easier to build a generic command for generating export files...
|
|
if ($libname)
|
|
{
|
|
print $output_handle "LIBRARY $libname\n";
|
|
}
|
|
print $output_handle "EXPORTS\n";
|
|
}
|
|
|
|
while (<$input_handle>)
|
|
{
|
|
if (/^#/)
|
|
{
|
|
# don't do anything with a comment
|
|
}
|
|
elsif (/^(\S+)\s+(\S+)/)
|
|
{
|
|
if ($format eq 'aix')
|
|
{
|
|
print $output_handle "$1\n";
|
|
}
|
|
elsif ($format eq 'darwin')
|
|
{
|
|
print $output_handle "_$1\n";
|
|
}
|
|
elsif ($format eq 'gnu')
|
|
{
|
|
print $output_handle " $1;\n";
|
|
}
|
|
elsif ($format eq 'win')
|
|
{
|
|
print $output_handle "$1 @ $2\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
die "$0: unexpected line $_\n";
|
|
}
|
|
}
|
|
|
|
if ($format eq 'gnu')
|
|
{
|
|
print $output_handle " local: *;
|
|
};
|
|
";
|
|
}
|