Skip to content

Commit

Permalink
Bug#3848: make the output of lib/mkchartable.pl v2.4 compatible
Browse files Browse the repository at this point in the history
Apparently I have backported too much from the master-branch, I
wanted to have just the charset-aliases.  In turn, the generated
lib/chartable.c was then very different.  With this fix lib/chartable.c
is almost the same as before commit 63856fc .
  • Loading branch information
dilyanpalauzov committed Aug 26, 2014
1 parent d4b08b5 commit 8b59aeb
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/mkchartable.pl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ sub readmapfile {

my ($hexcode, $name, $category, $combiningclass, $bidicat,
$decomposition, $decimal, $digit, $numeric, $mirroredchar,
$uni1name, $comment, $upper, $lower, $title, @rest) = split ';', $line;
$uni1name, $comment, $upper, $lower, @rest) = split ';', $line;
my $code = hex($hexcode);

# This is not RFC5051
Expand All @@ -113,10 +113,6 @@ sub readmapfile {
next;
}

# has a mapping to titlecase
$codemap->{$code}{title} = hex($title)
if $title;

# Compatability mapping, skip over the <type>
while ($decomposition ne '') {
# This is not RFC5051
Expand All @@ -130,7 +126,10 @@ sub readmapfile {
}
}

$codemap->{$code}{chars} ||= [$code];
#Lower case equivalence mapping
if ($lower) {
$codemap->{$code}{chars} = [hex($lower)];
}
}
}

Expand Down Expand Up @@ -294,15 +293,14 @@ sub printmap {
print OUTPUT " { /* Mapping for unicode chars in block $block16 $block8 */\n ";
foreach my $i (0..255) {
my $codepoint = ($block16 << 16) + ($block8 << 8) + $i;
my $titlepoint = $codemap->{$codepoint}{title} || $codepoint;
if (not $codemap->{$titlepoint} or not keys %{$codemap->{$titlepoint}}) {
printf OUTPUT " 0x%04x,", $titlepoint;
if (not $codemap->{$codepoint}) {
printf OUTPUT " 0x%04x,", $codepoint;
}
elsif ($codemap->{$titlepoint}{trans}) {
printf OUTPUT " - %4d,", $codemap->{$titlepoint}{trans};
elsif ($codemap->{$codepoint}{trans}) {
printf OUTPUT " - %4d,", $codemap->{$codepoint}{trans};
}
else {
printf OUTPUT " 0x%04x,", $codemap->{$titlepoint}{chars}[0];
printf OUTPUT " 0x%04x,", $codemap->{$codepoint}{chars}[0];
}
print OUTPUT "\n " if ($i % 8 == 7);
}
Expand Down

0 comments on commit 8b59aeb

Please sign in to comment.