add new DB structure.
authorimiyazaki <imiyazaki>
Sat, 18 Oct 2003 11:15:35 +0000 (11:15 +0000)
committerimiyazaki <imiyazaki>
Sat, 18 Oct 2003 11:15:35 +0000 (11:15 +0000)
Chise_utils/Chise_utils.pm

index aa95af1..184409c 100644 (file)
@@ -31,7 +31,6 @@ our %EXPORT_TAGS = ( 'all' => [ qw(
                                   &get_char_attribute
                                   &get_chars_matching
                                   &get_chars_containing
-                                  &get_chars_matching
                                   &get_chars_for
                                   &de_er
                                   &ids_argc
@@ -47,26 +46,22 @@ our $VERSION = '0.01';
 # Preloaded methods go here.
 
 my $DB_HOME="";
-if(-e '/usr/local/lib/chise/char-db'){
-    $DB_HOME='/usr/local/lib/chise/char-db';
-}elsif(-e '/usr/local/lib/xemacs-21.4.11/i686-pc-linux/char-db'){
-    $DB_HOME='/usr/local/lib/xemacs-21.4.11/i686-pc-linux/char-db';
-}elsif(-e '/usr/local/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db'){
-    $DB_HOME='/usr/local/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db';
-}elsif(-e '/usr/local/xemacs-utf2000/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db'){
-    $DB_HOME='/usr/local/xemacs-utf2000/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db';
-}elsif(-e '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db'){
-    $DB_HOME='/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db';
-}elsif(-e '/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db'){
-    $DB_HOME='/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db';
-}elsif(-e '/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db'){
-    $DB_HOME='/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db';
-}elsif(-e 'd:/work/chise/char-db'){
-    $DB_HOME='d:/work/chise/char-db';
-}else{
-    print STDERR "No database found.\n";
-    print STDERR "Pleas set \$DB_HOME to Chise_utils.pm.\n";
-    exit 1;
+unless($DB_HOME){
+    if(-e '/usr/local/lib/chise/db'){
+       $DB_HOME='/usr/local/lib/chise/db';
+    }elsif(-e '/usr/lib/chise/db'){
+       $DB_HOME='/usr/lib/chise/db';
+    }elsif(-e '/sw/lib/chise/db'){
+       $DB_HOME='/sw/lib/chise/db';
+    }elsif(-e '/usr/local/lib/chise/char-db'){
+       $DB_HOME='/usr/local/lib/chise/char-db';
+    }elsif(-e 'd:/work/chise/char-db'){
+       $DB_HOME='d:/work/chise/char-db';
+    }else{
+       print STDERR "No database found.\n";
+       print STDERR "Pleas set \$DB_HOME to Chise_utils.pm.\n";
+       exit 1;
+    }
 }
 
 $idc="\x{2ff0}-\x{2fff}";
@@ -105,18 +100,36 @@ my %er_alias =
      'M','ideograph-daikanwa',
      );
 
-for (glob "$DB_HOME/system-char-id/*"){
-    next if(/\.txt$/);
-    $atr=$_;
-    $atr=~s!$DB_HOME/system-char-id/!!;
-    $db{$atr}=$_;
-}
-
-for (glob "$DB_HOME/*"){
-    next if(/\.txt$/ or /system-char-id/);
-    $atr=$_;
-    $atr=~s!$DB_HOME/!!;
-    $reverse_db{$atr}=$_."/system-char-id";
+if(-d "$DB_HOME/character"){
+    for (glob "$DB_HOME/character/feature/*"){
+       next if(/\.txt$/);
+       $atr=$_;
+       $atr=~s!$DB_HOME/character/feature/!!;
+       $db{$atr}=$_;
+    }
+    for (glob "$DB_HOME/character/by-feature/*"){
+       next if(/\.txt$/);
+       $atr=$_;
+       $atr=~s!$DB_HOME/character/feature/!!;
+       $reverse_db{$atr}=$_;
+    }
+}elsif(-d "$DB_HOME/system-char-id"){
+    for (glob "$DB_HOME/system-char-id/*"){
+       next if(/\.txt$/);
+       $atr=$_;
+       $atr=~s!$DB_HOME/system-char-id/!!;
+       $db{$atr}=$_;
+    }
+    for (glob "$DB_HOME/*"){
+       next if(/\.txt$/ or /system-char-id/);
+       $atr=$_;
+       $atr=~s!$DB_HOME/!!;
+       $reverse_db{$atr}=$_."/system-char-id";
+    }
+}else{
+    print STDERR "No database found.\n";
+    print STDERR "Pleas set \$DB_HOME to Chise_utils.pm correctly.\n";
+    exit 1;
 }
 
 sub get_db{