11 use vars qw(%db %chardb $atr
14 our @ISA = qw(Exporter);
16 # Items to export into callers namespace by default. Note: do not export
17 # names by default without a very good reason. Use EXPORT_OK instead.
18 # Do not simply export all your public functions/methods/constants.
20 # This allows declaration use Chise_utils ':all';
21 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
23 our %EXPORT_TAGS = ( 'all' => [ qw(
33 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
37 our $VERSION = '0.01';
40 # Preloaded methods go here.
43 if(-e '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db/system-char-id'){
44 $DB_HOME='/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db/system-char-id';
45 }elsif(-e 'd:/work/chise/char-db/system-char-id'){
46 $DB_HOME='d:/work/chise/char-db/system-char-id';
47 }elsif(-e '/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id'){
48 $DB_HOME='/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id';
49 }elsif(-e '/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id'){
50 $DB_HOME='/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db/system-char-id';
52 print STDERR "No database found.\n";
53 print STDERR "Pleas set \$DB_HOME to Chise_utils.pm.\n";
64 foreach $atr (keys %db){
65 if(defined($db{$atr}) and -f $db{$atr}){
66 tie %{$chardb{$atr}}, "BerkeleyDB::Hash",
67 -Filename => $db{$atr};
69 print STDERR "no target\n";
75 sub get_char_attribute{
77 if($chardb{$atr}->{"?$char"}){
78 return $chardb{$atr}->{"?$char"};
80 return "no attribute for $char";
84 sub get_chars_containing{
87 if(defined(%{$chardb{$atr}})){
88 foreach $char (keys %{$chardb{$atr}}){
89 if($chardb{$atr}->{$char}=~/$value/){
97 sub get_chars_matching{
100 if(defined(%{$chardb{$atr}})){
101 foreach $char (keys %{$chardb{$atr}}){
102 if($chardb{$atr}->{$char}=~/^$value$/){
112 my @q=split(",",$query);
113 my(%res,@res,$atr,$value);
117 ($atr,$value)=split("==",$query,2);
119 foreach (&get_chars_matching($atr,$value)){
122 }elsif($query=~/=~/){
123 ($atr,$value)=split("=~",$query,2);
125 foreach (&get_chars_containing($atr,$value)){
141 $char=pack("U",$char);
142 }elsif($char=~/U[\+\-](\d+)/){
144 }elsif($char=~m/CDP\-(\d+)/){
145 # chinese-big5-cdp CDP- 4 X),
146 # ideograph-daikanwa M- 5 d),
147 # ideograph-cbeta CB 5 d),
148 # ideograph-gt GT- 5 d),
149 # ideograph-gt-k GT-K 5 d),
150 # japanese-jisx0208-1990 J90- 4 X),
151 # japanese-jisx0208 J83- 4 X),
152 # japanese-jisx0213-1 JX1- 4 X),
153 # japanese-jisx0213-2 JX2- 4 X),
154 # japanese-jisx0212 JSP- 4 X),
155 # japanese-jisx0208-1978 J78- 4 X),
156 # chinese-cns11643-1 C1- 4 X),
157 # chinese-cns11643-2 C2- 4 X),
158 # chinese-cns11643-3 C3- 4 X),
159 # chinese-cns11643-4 C4- 4 X),
160 # chinese-cns11643-5 C5- 4 X),
161 # chinese-cns11643-6 C6- 4 X),
162 # chinese-cns11643-7 C7- 4 X),
163 # korean-ksc5601 K0- 4 X),
168 # Autoload methods go after =cut, and are processed by the autosplit program.
172 # Below is stub documentation for your module. You better edit it!
176 Chise_utils - Perl extension for blah blah blah
185 Stub documentation for Chise_utils, created by h2xs. It looks like the
186 author of the extension was negligent enough to leave the stub
198 A. U. Thor, a.u.thor@a.galaxy.far.far.away