Fresco/Babylon/utils/UnicodePluginGenerator DerivedProps.pm,NONE,1.1 Bidir.pm,1.6,1.7 Category.pm,1.5,1.6 CombClass.pm,1.5,1.6 Compositions.pm,1.7,1.8 DecDigitVal.pm,1.5,1.6 DecompClass.pm,1.6,1.7 DecompString.pm,1.6,1.7 Defined.pm,1.6,1.7 DigitVal.pm,1.5,1.6 EAWidth.pm,1.6,1.7 Linebreak.pm,1.6,1.7 Lower.pm,1.5,1.6 Mirror.pm,1.6,1.7 NumericVal.pm,1.5,1.6 Title.pm,1.5,1.6 Upper.pm,1.5,1.6
Tobias Hunger <[email protected]> Tue, 05 Aug 2003 11:29:33 -0500
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator
In directory purcel:/tmp/cvs-serv1349/Babylon/utils/UnicodePluginGenerator
Modified Files:
Bidir.pm Category.pm CombClass.pm Compositions.pm
DecDigitVal.pm DecompClass.pm DecompString.pm Defined.pm
DigitVal.pm EAWidth.pm Linebreak.pm Lower.pm Mirror.pm
NumericVal.pm Title.pm Upper.pm
Added Files:
DerivedProps.pm
Log Message:
Fix DerivedCoreProperties unit test. Now all unit tests pass!
Update the character database while we need to modify the modules anyway
and fix up some parsing problems in the perl scripts generating the
modules while doing so.
--- NEW FILE: DerivedProps.pm ---
package UnicodePluginGenerator::DerivedProps;
use strict;
# Get the diff of ID_* and XID_* and use them to calculate the
# closure.
#
# XID_* = ID_* xor XID_*_Closure
#
# This is necessary since some ID_* need to be "deactivated" in XID_*
sub new
{
my $self = {};
my $prop_file = $_[1];
my $currentProp = "";
my %_props;
my @propList;
my $value = 0; # 1 for ID_*, 2 for XID_*
open(PROP, $prop_file) or
die "Can't open DerivedPropertyfile (".$prop_file.")\n";
while(<PROP>)
{
chop;
next unless ($_); # skip empty lines
(my $info, my $rest) = split /#/;
$info =~ s/\s*$//; # remove trailing spaces
next unless ($info);
if ($info =~ /^([A-F0-9]+)\.\.([A-F0-9]+)\s*; ([\w\-]+)/)
{
my $start = $1;
my $end = $2;
my $property = $3;
if ($property =~ /^XID_/)
{
$property =~ s/^XID_//;
$value = 2;
}
elsif ($property =~ /^ID_/)
{
$property =~ s/^ID_//;
$value = 1;
}
next if ($property ne "Start" && $property ne "Continue");
if ($property ne $currentProp)
{
$currentProp = $property;
my $need_to_add = 1;
foreach my $i (@propList)
{
$need_to_add = 0 if $property eq $i;
}
push @propList, $currentProp if $need_to_add;
}
for (my $i = hex($start); $i <= hex($end); $i++)
{
$self->{$property}{$i} += $value;
}
}
elsif ($info =~ /^([A-F0-9]+)\s*; ([\w\-]+)/)
{
my $start = $1;
my $property = $2;
if ($property =~ /^XID_/)
{
$property =~ s/^XID_//;
$value = 2;
}
elsif ($property =~ /^ID_/)
{
$property =~ s/^ID_//;
$value = 1;
}
next if ($property ne "Start" && $property ne "Continue");
if ($property ne $currentProp) {
$currentProp = $property;
my $need_to_add = 1;
foreach my $i (@propList)
{
$need_to_add = 0 if $property eq $i;
}
push @propList, $currentProp if $need_to_add;
}
$self->{$property}{hex($start)} += $value;
}
}
$self->{_PROP_LIST} = [ @propList ];
close(PROP);
bless($self);
return $self;
}
sub data
{
my $self = shift;
my $prop = $_[0];
my $pos = $_[1];
no strict 'refs';
return 1 if (exists($self->{$prop}{$pos}) &&
($self->{$prop}{$pos} == 1 || $self->{$prop}{$pos} == 2));
return 0;
}
sub include
{
return "";
}
sub init
{
return "";
}
sub function
{
my $self = shift;
my $bl_start = $_[0];
my $bl_end = $_[1];
my $bl_name = $_[2];
my @propList = @{ $self->{_PROP_LIST} };
my $tmp = "";
foreach my $prop (@propList)
{
my $func = "XID_".$prop."_Closure";
my $retval = $self->data($prop, $bl_start);
my $attention = 0;
for (my $i = $bl_start; $i <= $bl_end; $i++)
{
$attention = 1 if ($self->data($prop, $i) != $retval);
}
$tmp .= " bool is_".$func."(const UCS4 uc) const\n {\n";
if ($attention)
{
$tmp .= " return my_".$func.".test(uc - my_first_letter);\n";
}
else
{
$tmp .= " return $retval;\n";
}
$tmp .= " }\n\n";
}
return $tmp;
}
sub var_def
{
my $self = shift;
my $bl_start = $_[0];
my $bl_end = $_[1];
my $bl_length = $bl_end - $bl_start + 1;
my @propList = @{ $self->{_PROP_LIST} };
my $tmp = "";
foreach my $prop (@propList)
{
my $func = "XID_".$prop."_Closure";
my $retval = $self->data($prop, $bl_start);
my $attention = 0;
for (my $i = $bl_start; $i <= $bl_end; $i++)
{
$attention = 1 if ($self->data($prop, $i) != $retval);
}
$tmp .= " static const std::bitset<$bl_length> my_".$func.";\n" if ($attention);
}
return $tmp;
}
sub var
{
my $self = shift;
my $bl_start = $_[0];
my $bl_end = $_[1];
my $bl_name = $_[2];
my $bl_length = $bl_end - $bl_start + 1;
my @propList = @{ $self->{_PROP_LIST} };
my $tmp = "";
foreach my $prop (@propList)
{
my $func = "XID_".$prop."_Closure";
my $retval = $self->data($prop, $bl_start);
my $attention = 0;
for (my $i = $bl_start; $i <= $bl_end; $i++)
{
$attention = 1 if ($self->data($prop, $i) != $retval);
}
if ($attention)
{
$tmp .= " const std::bitset<$bl_length> $bl_name\:\:my_$func(std::string(\"";
my $str = "";
for (my $i = $bl_start; $i <= $bl_end; $i++)
{
$str = $self->data($prop, $i).$str;
}
$tmp .= $str."\"));\n\n";
}
}
return $tmp;
}
1; # for use to succeed...
Index: Bidir.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Bidir.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Bidir.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ Bidir.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: Category.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Category.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Category.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ Category.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -11,6 +11,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: CombClass.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/CombClass.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CombClass.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ CombClass.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: Compositions.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Compositions.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Compositions.pm 1 Aug 2003 16:47:17 -0000 1.7
+++ Compositions.pm 5 Aug 2003 16:29:30 -0000 1.8
@@ -12,6 +12,8 @@
{
my $line = chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
+
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: DecDigitVal.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/DecDigitVal.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- DecDigitVal.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ DecDigitVal.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: DecompClass.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/DecompClass.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- DecompClass.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ DecompClass.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: DecompString.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/DecompString.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- DecompString.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ DecompString.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: Defined.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Defined.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Defined.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ Defined.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next if ($info eq "");
Index: DigitVal.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/DigitVal.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- DigitVal.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ DigitVal.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: EAWidth.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/EAWidth.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- EAWidth.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ EAWidth.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: Linebreak.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Linebreak.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Linebreak.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ Linebreak.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: Lower.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Lower.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Lower.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ Lower.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: Mirror.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Mirror.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Mirror.pm 1 Aug 2003 16:47:17 -0000 1.6
+++ Mirror.pm 5 Aug 2003 16:29:30 -0000 1.7
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: NumericVal.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/NumericVal.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- NumericVal.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ NumericVal.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: Title.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Title.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Title.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ Title.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);
Index: Upper.pm
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/utils/UnicodePluginGenerator/Upper.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Upper.pm 1 Aug 2003 16:47:17 -0000 1.5
+++ Upper.pm 5 Aug 2003 16:29:30 -0000 1.6
@@ -12,6 +12,7 @@
{
chop;
(my $info, my $rest) = split /#/;
+ next unless $info;
$info =~ s/([a-zA-Z0-9]*)\s*$/$1/; # remove trailing spaces
next unless ($info);