Skip to content

Commit c56581b

Browse files
committed
Wrap long lines; add some comments
1 parent 2bd08a7 commit c56581b

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

tools/ucd2c.pl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,15 +2958,27 @@ END
29582958
return;
29592959
}
29602960
2961+
# Set property keypairs, using several defaults to find the propcode
29612962
sub set_lines_for_each_case {
29622963
my ($default, $propname, $prop_val, $hash, $maybe_propcode) = @_;
2963-
my $propcode = $maybe_propcode // $PROP_NAMES->{$propname} // $PROP_NAMES->{$default} // croak;
2964-
# Workaround to 'space' not getting added here
2964+
2965+
# Try three different ways of choosing propcode, or croak if none worked
2966+
my $propcode = $maybe_propcode
2967+
// $PROP_NAMES->{$propname}
2968+
// $PROP_NAMES->{$default}
2969+
// croak;
2970+
2971+
# Workaround for 'space' not getting added here
29652972
$hash->{$propname}->{space} = "{\"$propcode-space\",$prop_val}"
29662973
if $default eq 'White_Space' and $propname eq '_custom_';
2967-
for_each_case($default, sub { $_ = shift;
2974+
2975+
# Add keypairs for each different supported case style of $default
2976+
for_each_case $default, sub {
2977+
$_ = shift;
29682978
$hash->{$propname}->{$_} = "{\"$propcode-$_\",$prop_val}";
2969-
});
2979+
};
2980+
2981+
# Return the propcode actually used
29702982
return $propcode;
29712983
}
29722984
@@ -3033,7 +3045,8 @@ sub emit_unicode_property_value_keypairs {
30333045
my $prop_val = $PROP_NAMES->{$propname} << 24;
30343046
30353047
# emit binary properties
3036-
if (($pv_alias_parts[0] eq 'Y' || $pv_alias_parts[0] eq 'N') && ($pv_alias_parts[1] eq 'Yes' || $pv_alias_parts[1] eq 'No')) {
3048+
if (($pv_alias_parts[0] eq 'Y' || $pv_alias_parts[0] eq 'N')
3049+
&& ($pv_alias_parts[1] eq 'Yes' || $pv_alias_parts[1] eq 'No')) {
30373050
$prop_val++; # one bit width
30383051
for ($propname, ($aliases{$propname} // ())) {
30393052
set_lines_for_each_case($_, $propname, $prop_val, \%lines);

0 commit comments

Comments
 (0)