11 use vars qw(%db %chardb $atr
15 our @ISA = qw(Exporter);
17 # Items to export into callers namespace by default. Note: do not export
18 # names by default without a very good reason. Use EXPORT_OK instead.
19 # Do not simply export all your public functions/methods/constants.
21 # This allows declaration use Chise_utils ':all';
22 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
24 our %EXPORT_TAGS = ( 'all' => [ qw(
35 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
39 our $VERSION = '0.01';
42 # Preloaded methods go here.
45 if(-e '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db/system-char-id'){
46 $DB_HOME='/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db/system-char-id';
47 }elsif(-e 'd:/work/chise/char-db/system-char-id'){
48 $DB_HOME='d:/work/chise/char-db/system-char-id';
49 }elsif(-e '/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id'){
50 $DB_HOME='/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id';
51 }elsif(-e '/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id'){
52 $DB_HOME='/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id';
54 print STDERR "No database found.\n";
55 print STDERR "Pleas set \$DB_HOME to Chise_utils.pm.\n";
59 $idc="[\x{2ff0}-\x{2fff}]";
68 foreach $atr (keys %db){
69 if(defined($db{$atr}) and -f $db{$atr}){
70 tie %{$chardb{$atr}}, "BerkeleyDB::Hash",
71 -Filename => $db{$atr};
73 print STDERR "no target\n";
79 sub get_char_attribute{
81 if($chardb{$atr}->{"?$char"}){
82 return $chardb{$atr}->{"?$char"};
88 sub get_chars_containing{
91 if(defined(%{$chardb{$atr}})){
92 foreach $char (keys %{$chardb{$atr}}){
93 if($chardb{$atr}->{$char}=~/$value/){
102 sub get_chars_matching{
105 if(defined(%{$chardb{$atr}})){
106 foreach $char (keys %{$chardb{$atr}}){
107 if($chardb{$atr}->{$char} eq $value){
118 my @q=split(",",$query);
119 my(%res,@res,$atr,$value);
123 ($atr,$value)=split("==",$query,2);
125 foreach (&get_chars_matching($atr,$value)){
128 }elsif($query=~/=~/){
129 ($atr,$value)=split("=~",$query,2);
131 foreach (&get_chars_containing($atr,$value)){
147 $char=pack("U",$char);
148 }elsif($char=~/U[\+\-](\d+)/){
150 }elsif($char=~m/CDP\-(\d+)/){
151 # chinese-big5-cdp CDP- 4 X),
152 # ideograph-daikanwa M- 5 d),
153 # ideograph-cbeta CB 5 d),
154 # ideograph-gt GT- 5 d),
155 # ideograph-gt-k GT-K 5 d),
156 # japanese-jisx0208-1990 J90- 4 X),
157 # japanese-jisx0208 J83- 4 X),
158 # japanese-jisx0213-1 JX1- 4 X),
159 # japanese-jisx0213-2 JX2- 4 X),
160 # japanese-jisx0212 JSP- 4 X),
161 # japanese-jisx0208-1978 J78- 4 X),
162 # chinese-cns11643-1 C1- 4 X),
163 # chinese-cns11643-2 C2- 4 X),
164 # chinese-cns11643-3 C3- 4 X),
165 # chinese-cns11643-4 C4- 4 X),
166 # chinese-cns11643-5 C5- 4 X),
167 # chinese-cns11643-6 C6- 4 X),
168 # chinese-cns11643-7 C7- 4 X),
169 # korean-ksc5601 K0- 4 X),
176 my $char_id=unpack("U",$char);
177 if($char_id==0x2ff2 or $char_id==0x2ff3){
179 }elsif($char_id>=0x2ff0 and $char_id<=0x2fff){
186 # Autoload methods go after =cut, and are processed by the autosplit program.
190 # Below is stub documentation for your module. You better edit it!
194 Chise_utils - Perl extension for blah blah blah
203 Stub documentation for Chise_utils, created by h2xs. It looks like the
204 author of the extension was negligent enough to leave the stub
216 A. U. Thor, a.u.thor@a.galaxy.far.far.away