Unicode::Property::XS

Unicode properties implemented by lookup table in C code.
Download

Unicode::Property::XS Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mindos Cheng
  • Publisher web site:
  • http://search.cpan.org/~mindos/

Unicode::Property::XS Tags


Unicode::Property::XS Description

Unicode properties implemented by lookup table in C code. Unicode::Property::XS is a Perl module which offers Unicode properties implemented by lookup table in C code..SYNOPSIS use Unicode::Property::XS qw(:all); # 'ucs_' is the default prefix my @property_letters; foreach my $ord (0x0000..0x37FF) { push @property_letters, ucs_L($ord); # /p{L}/ }; my @property_list = ucs_EaFullwidth1(0x0000..0x37FF); foreach my $ord (0x0000..0x3FFFF) { next if !ucs_Legal($ord); die "Internal error!" if ucs_M($ord) != ((chr($ord) =~ /p{M}/) ? 1 : 0); } my @myChars = q( a b c d e f g 1 2 3 ); my @property_list2 = ucs_L( ord(@myChars) ); __END__ ################################# BEGIN { Unicode::Property::XS::Prefix = 'Is'; } use Unicode::Property::XS; my @property_letters; foreach my $ord (0x0000..0x37FF) { push @property_letters, IsL($ord); # /p{L}/ }; __END__ ################################# use Unicode::Property::XS qw( Legal :EastAsianWidth ); use Unicode::EastAsianWidth; BEGIN { $Unicode::EastAsianWidth::EastAsian = 0; }; foreach my $ord (0x0000..0xEFFFF) { next if !ucs_Legal($ord) ; my $lookup_value = ucs_EaFullwidth0($ord); # /p{InFullwidth} my $re_value = chr($ord)=~/p{InFullwidth}/ ; die "Error in Unicode::Property::XS! " if !($lookup_value == $re_value) ; }; __END__Unicode properties for regular expression in perl is handy. But it's somehow slow when the times of repetition is sparse for a given word. So, I made a table lookup XS module for property lookup. The "Unicoae Character Properties" section of perlunicode and properties in Unicode::EastAsianWidth is implemented.The bundle costs 1.2MB for run time dynamic library, and include all the property class listed below. please tell me if you module-spliting or space-saving solutions.All the functions except ucs_Legal() work the same way. Return 1 if the input character (in numeric value) is in that property class. Return 0 if not. Return 0 if the encoding value is illegal (should not happen if the input value is converted by ord($ucs_char)). Return 15 if in plane 15, a user-defined plane. Return 16 if in plane 16, a user-defined plane. Requirements: · Perl


Unicode::Property::XS Related Software