From: imiyazaki Date: Sat, 1 Mar 2003 09:43:29 +0000 (+0000) Subject: $idc added. X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fperl.git;a=commitdiff_plain;h=2700346d3c00c45915312d0a96cedc3a74b11459 $idc added. &ids_argc added. &get_char_attribute changed. --- diff --git a/Chise_utils/Chise_utils.pm b/Chise_utils/Chise_utils.pm index 3338922..a2365d6 100644 --- a/Chise_utils/Chise_utils.pm +++ b/Chise_utils/Chise_utils.pm @@ -9,6 +9,7 @@ require Exporter; use utf8; use BerkeleyDB; use vars qw(%db %chardb $atr + $idc ); our @ISA = qw(Exporter); @@ -21,13 +22,14 @@ our @ISA = qw(Exporter); # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( 'all' => [ qw( - %db %chardb + %db %chardb $idc &get_char_attribute &get_chars_matching &get_chars_containing &get_chars_matching &get_chars_for &de_er + &ids_argc ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); @@ -54,6 +56,8 @@ if(-e '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db/system-char-id'){ exit 1; } +$idc="[â¿°-â¿»]"; + for (<$DB_HOME/*>){ next if(/\.txt$/); $atr=$_; @@ -77,7 +81,7 @@ sub get_char_attribute{ if($chardb{$atr}->{"?$char"}){ return $chardb{$atr}->{"?$char"}; }else{ - return "no attribute for $char"; + return ""; } } @@ -87,6 +91,7 @@ sub get_chars_containing{ if(defined(%{$chardb{$atr}})){ foreach $char (keys %{$chardb{$atr}}){ if($chardb{$atr}->{$char}=~/$value/){ + $char=~s/^\?//; push @res,$char; } } @@ -99,7 +104,8 @@ sub get_chars_matching{ my($char,@res); if(defined(%{$chardb{$atr}})){ foreach $char (keys %{$chardb{$atr}}){ - if($chardb{$atr}->{$char}=~/^$value$/){ + if($chardb{$atr}->{$char} eq $value){ + $char=~s/^\?//; push @res,$char; } } @@ -165,6 +171,18 @@ sub de_er{ return $char; } +sub ids_argc{ + my($char)=@_; + my $char_id=unpack("U",$char); + if($char_id==0x2ff2 or $char_id==0x2ff3){ + return 3; + }elsif($char_id>=0x2ff0 and $char_id<=0x2fff){ + return 2; + }else{ + return 0; + } +} + # Autoload methods go after =cut, and are processed by the autosplit program. 1;