5 use vars qw($atr $value $char
6 $opt_map $opt_rev_map $opt_mapfrom $opt_mapto
7 $opt_atr $opt_allatr $opt_showatr
11 use Chise_utils ':all';
14 Usage: perl $0 [-m <map> | --map <map> |
21 -a=<atribuite> <char> |
25 total-strokes==8 means
26 the attribute of total-strokes exactly matches to 8.
28 the attribute of ids-parts contains the string 矢.
29 total-strokes==8,ids-parts=~矢 means both at the same time.
30 -a get <attribute> of <char>
31 -aa get all attributes of <char>
34 &GetOptions("mapto=s"=>\$opt_mapto,
35 "mapfrom=s"=>\$opt_mapfrom,
40 "show-attribute"=>\$opt_showatr,
46 or !((($opt_map or $opt_rev_map or $opt_mapfrom or $opt_mapto) and @ARGV==0)
47 or($opt_showatr and @ARGV==0)
54 $char=shift or $char="";
58 $opt_map="<=".$opt_mapfrom;
60 $opt_map="=>".$opt_mapto;
64 if(&get_db($opt_map)){
65 foreach $char (sort keys %{$chardb{$opt_map}}){
66 if($chardb{$opt_map}->{$char}){
67 print $char,"\t",$chardb{$opt_map}->{$char},"\n";
71 print STDERR "No map for $opt_map.\n";
74 if(&get_reverse_db($opt_rev_map)){
75 foreach $char (sort keys %{$reverse_chardb{$opt_rev_map}}){
76 if($reverse_chardb{$opt_rev_map}->{$char}){
77 print $char,"\t",$reverse_chardb{$opt_rev_map}->{$char},"\n";
81 print STDERR "No map for $opt_rev_map.\n";
84 $char=&de_er($char) if($char=~/\d/);
86 foreach $atr (sort keys %db){
87 if($value=&get_char_attribute($char,$atr)){
88 print " ",$atr,":",$value,"\n";
92 $char=&de_er($char) if($char=~/\d/);
94 print " ",$opt_atr,":",&get_char_attribute($char,$opt_atr),"\n";
97 foreach $atr (sort keys %db){
100 # print "In reverse DB\n";
101 # foreach $atr (sort keys %reverse_db){
102 # print " ",$atr,"\n";
106 print join "\n",&get_chars_for($query),"\n";