summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-04-04 12:35:54 -0600
committerKarl Williamson <public@khwilliamson.com>2012-06-02 08:29:18 -0600
commit1d025d66877c2221c4ef30eac81e3cdb44f9851c (patch)
treed66a297c7c3d258c9d6d416141e2cb11d90aa2b1 /lib
parent853d6ba7554fb92f3ed2faa026850272f04e4479 (diff)
downloadperl-1d025d66877c2221c4ef30eac81e3cdb44f9851c.tar.gz
mktables: Enable -annotate arg on early Unicodes
On early Unicode releases, there is no NChar property, and on V1.1.5, no surrogates. The code for -annotate previously assumed these existed, so failed. This moves the surrogates testing later, after new code that specially handles the situation in 1.1.5, and has special handling for the non-character code points, in that they may not exist in the current version.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicore/mktables39
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/unicore/mktables b/lib/unicore/mktables
index 2c6869abf6..d638b0ae89 100644
--- a/lib/unicore/mktables
+++ b/lib/unicore/mktables
@@ -1480,20 +1480,16 @@ sub populate_char_info ($) {
# point of the range.
my $end;
if (! $viacode[$i]) {
- if ($gc-> table('Surrogate')->contains($i)) {
- $viacode[$i] = 'Surrogate';
- $annotate_char_type[$i] = $SURROGATE_TYPE;
- $printable[$i] = 0;
- $end = $gc->table('Surrogate')->containing_range($i)->end;
- }
- elsif ($gc-> table('Private_use')->contains($i)) {
+ my $nonchar;
+ if ($gc-> table('Private_use')->contains($i)) {
$viacode[$i] = 'Private Use';
$annotate_char_type[$i] = $PRIVATE_USE_TYPE;
$printable[$i] = 0;
$end = $gc->table('Private_Use')->containing_range($i)->end;
}
- elsif (Property::property_ref('Noncharacter_Code_Point')-> table('Y')->
- contains($i))
+ elsif ((defined ($nonchar =
+ Property::property_ref('Noncharacter_Code_Point'))
+ && $nonchar->table('Y')->contains($i)))
{
$viacode[$i] = 'Noncharacter';
$annotate_char_type[$i] = $NONCHARACTER_TYPE;
@@ -1508,9 +1504,14 @@ sub populate_char_info ($) {
$end = 0x81 if $i == 0x80; # Hard-code this one known case
}
elsif ($gc-> table('Unassigned')->contains($i)) {
- $viacode[$i] = 'Unassigned, block=' . $block-> value_of($i);
$annotate_char_type[$i] = $UNASSIGNED_TYPE;
$printable[$i] = 0;
+ if ($v_version lt v2.0.0) { # No blocks in earliest releases
+ $viacode[$i] = 'Unassigned';
+ $end = $gc-> table('Unassigned')->containing_range($i)->end;
+ }
+ else {
+ $viacode[$i] = 'Unassigned, block=' . $block-> value_of($i);
# Because we name the unassigned by the blocks they are in, it
# can't go past the end of that block, and it also can't go past
@@ -1520,6 +1521,18 @@ sub populate_char_info ($) {
$end = min($block->containing_range($i)->end,
$unassigned_sans_noncharacters-> containing_range($i)->
end);
+ }
+ }
+ elsif ($v_version lt v2.0.0) { # No surrogates in earliest releases
+ $viacode[$i] = $gc->value_of($i);
+ $annotate_char_type[$i] = $UNKNOWN_TYPE;
+ $printable[$i] = 0;
+ }
+ elsif ($gc-> table('Surrogate')->contains($i)) {
+ $viacode[$i] = 'Surrogate';
+ $annotate_char_type[$i] = $SURROGATE_TYPE;
+ $printable[$i] = 0;
+ $end = $gc->table('Surrogate')->containing_range($i)->end;
}
else {
Carp::my_carp_bug("Can't figure out how to annotate "
@@ -13343,8 +13356,10 @@ END
# This separates out the non-characters from the other unassigneds, so
# can give different annotations for each.
$unassigned_sans_noncharacters = Range_List->new(
- Initialize => $gc->table('Unassigned')
- & property_ref('Noncharacter_Code_Point')->table('N'));
+ Initialize => $gc->table('Unassigned'));
+ if (defined (my $nonchars = property_ref('Noncharacter_Code_Point'))) {
+ $unassigned_sans_noncharacters &= $nonchars->table('N');
+ }
for (my $i = 0; $i <= $MAX_UNICODE_CODEPOINT; $i++ ) {
$i = populate_char_info($i); # Note sets $i so may cause skips