mktables: remove internal restriction
authorKarl Williamson <public@khwilliamson.com>
Fri, 15 Jul 2011 02:47:13 +0000 (20:47 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 8 Nov 2011 15:09:05 +0000 (08:09 -0700)
The code punted before under the condition changed.  But it is
relatively easy to handle it; which is needed by future commits.

lib/unicore/mktables

index 6234ab4..30867f7 100644 (file)
@@ -3509,10 +3509,27 @@ sub trace { return main::trace(@_); }
 
             # Don't add an exact duplicate, as it isn't really a multiple
             if ($end >= $r->[$i]->start) {
-                return if $value eq $r->[$i]->value && $type eq $r->[$i]->type;
+                my $existing_value = $r->[$i]->value;
+                my $existing_type = $r->[$i]->type;
+                return if $value eq $existing_value && $type eq $existing_type;
+
+                # If the multiple value is part of an existing range, we want
+                # to split up that range, so that only the single code point
+                # is affected.  To do this, we first call ourselves
+                # recursively to delete that code point from the table, having
+                # preserved its current data above.  Then we call ourselves
+                # recursively again to add the new multiple, which we know by
+                # the test just above is different than the current code
+                # point's value, so it will become a range containing a single
+                # code point: just itself.  Finally, we add back in the
+                # pre-existing code point, which will again be a single code
+                # point range.  Because 'i' likely will have changed as a
+                # result of these operations, we can't just continue on, but
+                # do this operation recursively as well.
                 if ($r->[$i]->start != $r->[$i]->end) {
-                    Carp::my_carp_bug("$owner_name_of{$addr}Can't cope with adding a multiple record when the existing range ($r->[$i]) contains more than one code point.  No action taken.");
-                    return;
+                    $self->_add_delete('-', $start, $end, "");
+                    $self->_add_delete('+', $start, $end, $value, Type => $type);
+                    return $self->_add_delete('+', $start, $end, $existing_value, Type => $existing_type, Replace => $MULTIPLE);
                 }
             }