diff options
| author | Tom Lane | 2023-05-19 21:24:48 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-05-19 21:24:48 +0000 |
| commit | 0245f8db36f375326c2bae0c3420d3c77714e72d (patch) | |
| tree | 7ce91f23658a05ea24be4703fb06cdc6b56248f7 /src/common/unicode | |
| parent | df6b19fbbc20d830de91d9bea68715a39635b568 (diff) | |
Pre-beta mechanical code beautification.
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
Diffstat (limited to 'src/common/unicode')
| -rw-r--r-- | src/common/unicode/generate-norm_test_table.pl | 12 | ||||
| -rw-r--r-- | src/common/unicode/generate-unicode_norm_table.pl | 35 | ||||
| -rw-r--r-- | src/common/unicode/generate-unicode_normprops_table.pl | 6 |
3 files changed, 26 insertions, 27 deletions
diff --git a/src/common/unicode/generate-norm_test_table.pl b/src/common/unicode/generate-norm_test_table.pl index 45fedad9ae0..3434f7e2630 100644 --- a/src/common/unicode/generate-norm_test_table.pl +++ b/src/common/unicode/generate-norm_test_table.pl @@ -13,7 +13,7 @@ use warnings; use File::Basename; die "Usage: $0 INPUT_FILE OUTPUT_FILE\n" if @ARGV != 2; -my $input_file = $ARGV[0]; +my $input_file = $ARGV[0]; my $output_file = $ARGV[1]; my $output_base = basename($output_file); @@ -66,7 +66,7 @@ sub codepoint_string_to_hex foreach (split(' ', $codepoint_string)) { - my $cp = $_; + my $cp = $_; my $utf8 = "0x$cp, "; $result .= $utf8; } @@ -89,10 +89,10 @@ while (my $line = <$INPUT>) my ($source, $nfc, $nfd, $nfkc, $nfkd) = split(';', $line); my $source_utf8 = codepoint_string_to_hex($source); - my $nfc_utf8 = codepoint_string_to_hex($nfc); - my $nfd_utf8 = codepoint_string_to_hex($nfd); - my $nfkc_utf8 = codepoint_string_to_hex($nfkc); - my $nfkd_utf8 = codepoint_string_to_hex($nfkd); + my $nfc_utf8 = codepoint_string_to_hex($nfc); + my $nfd_utf8 = codepoint_string_to_hex($nfd); + my $nfkc_utf8 = codepoint_string_to_hex($nfkc); + my $nfkd_utf8 = codepoint_string_to_hex($nfkd); print $OUTPUT "\t{ $linenum, { $source_utf8 }, { { $nfc_utf8 }, { $nfd_utf8 }, { $nfkc_utf8 }, { $nfkd_utf8 } } },\n"; diff --git a/src/common/unicode/generate-unicode_norm_table.pl b/src/common/unicode/generate-unicode_norm_table.pl index ecc33fcd1ad..d5914118abf 100644 --- a/src/common/unicode/generate-unicode_norm_table.pl +++ b/src/common/unicode/generate-unicode_norm_table.pl @@ -18,11 +18,10 @@ use PerfectHash; my $output_path = '.'; -GetOptions( - 'outdir:s' => \$output_path); +GetOptions('outdir:s' => \$output_path); my $output_table_file = "$output_path/unicode_norm_table.h"; -my $output_func_file = "$output_path/unicode_norm_hashfunc.h"; +my $output_func_file = "$output_path/unicode_norm_hashfunc.h"; my $FH; @@ -43,7 +42,7 @@ close $FH; # Read entries from UnicodeData.txt into a list, and a hash table. We need # three fields from each row: the codepoint, canonical combining class, # and character decomposition mapping -my @characters = (); +my @characters = (); my %character_hash = (); open($FH, '<', "$output_path/UnicodeData.txt") or die "Could not open $output_path/UnicodeData.txt: $!."; @@ -54,9 +53,9 @@ while (my $line = <$FH>) # - Unicode code value # - Canonical Combining Class # - Character Decomposition Mapping - my @elts = split(';', $line); - my $code = $elts[0]; - my $class = $elts[3]; + my @elts = split(';', $line); + my $code = $elts[0]; + my $class = $elts[3]; my $decomp = $elts[5]; # Skip codepoints above U+10FFFF. They cannot be represented in 4 bytes @@ -168,7 +167,7 @@ typedef struct HEADER -my $decomp_index = 0; +my $decomp_index = 0; my $decomp_string = ""; my @dec_cp_packed; my $main_index = 0; @@ -177,8 +176,8 @@ my @rec_info; my $last_code = $characters[-1]->{code}; foreach my $char (@characters) { - my $code = $char->{code}; - my $class = $char->{class}; + my $code = $char->{code}; + my $class = $char->{class}; my $decomp = $char->{decomp}; # Save the code point bytes as a string in network order. @@ -205,7 +204,7 @@ foreach my $char (@characters) my $first_decomp = shift @decomp_elts; - my $flags = ""; + my $flags = ""; my $comment = ""; if ($compat) @@ -243,10 +242,10 @@ foreach my $char (@characters) { push @rec_info, { - code => $code, + code => $code, main_index => $main_index, - first => $first_decomp, - second => $decomp_elts[0] + first => $first_decomp, + second => $decomp_elts[0] }; } } @@ -302,7 +301,7 @@ HEADER # Emit the definition of the decomp hash function. my $dec_funcname = 'Decomp_hash_func'; -my $dec_func = PerfectHash::generate_hash_function(\@dec_cp_packed, +my $dec_func = PerfectHash::generate_hash_function(\@dec_cp_packed, $dec_funcname, fixed_key_length => 4); print $OF "/* Perfect hash function for decomposition */\n"; print $OF "static $dec_func\n"; @@ -395,11 +394,11 @@ sub recomp_sort # First sort by the first code point return -1 if $a1 < $b1; - return 1 if $a1 > $b1; + return 1 if $a1 > $b1; # Then sort by the second code point return -1 if $a2 < $b2; - return 1 if $a2 > $b2; + return 1 if $a2 > $b2; # Finally sort by the code point that decomposes into first and # second ones. @@ -407,7 +406,7 @@ sub recomp_sort my $bcode = hex($b->{code}); return -1 if $acode < $bcode; - return 1 if $acode > $bcode; + return 1 if $acode > $bcode; die "found duplicate entries of recomposeable code pairs"; } diff --git a/src/common/unicode/generate-unicode_normprops_table.pl b/src/common/unicode/generate-unicode_normprops_table.pl index d90d6b35855..1b7473180b3 100644 --- a/src/common/unicode/generate-unicode_normprops_table.pl +++ b/src/common/unicode/generate-unicode_normprops_table.pl @@ -108,7 +108,7 @@ foreach my $prop (sort keys %data) # Emit the definition of the perfect hash function. my $funcname = $prop . '_hash_func'; - my $f = PerfectHash::generate_hash_function(\@cp_packed, $funcname, + my $f = PerfectHash::generate_hash_function(\@cp_packed, $funcname, fixed_key_length => 4); printf "\n/* Perfect hash function for %s */", $prop; print "\nstatic $f\n"; @@ -119,7 +119,7 @@ foreach my $prop (sort keys %data) printf "\nstatic const pg_unicode_norminfo "; printf "UnicodeNormInfo_%s = {\n", $prop; printf "\tUnicodeNormProps_%s,\n", $prop; - printf "\t%s,\n", $funcname; - printf "\t%d\n", scalar @cp_packed; + printf "\t%s,\n", $funcname; + printf "\t%d\n", scalar @cp_packed; printf "};\n"; } |
