use IDS data as text file instead of perl script.
authorimiyazaki <imiyazaki>
Thu, 2 Sep 2004 13:55:55 +0000 (13:55 +0000)
committerimiyazaki <imiyazaki>
Thu, 2 Sep 2004 13:55:55 +0000 (13:55 +0000)
chise2otf/chise2otf
makefonts.pl

index fdcd5a6..4659a4e 100755 (executable)
@@ -116,21 +116,26 @@ if($opt_replace){
     $texmacro[0x1E5D]='{\ifmmode \ucirc{\bar{r}}\else \ucirc{\={r}}\fi}';
 }
 
-$idsdata_file="$omegadb_path/idsdata.pl";
+$idsdata_file="$omegadb_path/idsdata.txt";
 $ids_start=0x00; 
 $font_start=0;
 
 if(-e $idsdata_file){
-    open(IDSDATA,"+<$idsdata_file") or die;
+    open(IDSDATA,"+<:utf8",$idsdata_file) or die;
     flock(IDSDATA,LOCK_EX);
     seek(IDSDATA,0,0);
     while(<IDSDATA>){
-       eval $_;
+       utf8::decode($_);
+       if(m/^START\t(\d+)\t(\d+)/){
+           $font_start=$1,$ids_start=$2;
+       }elsif(m/^(.*?)\t(\d+)\t(\d+)/){
+           $ids{$1}=[$2,$3,];
+       }
     }
     seek(IDSDATA,0,0);
-#        require $idsdata_file;
+    truncate(IDSDATA,0);
 }else{
-    open(IDSDATA,">$idsdata_file") or die;
+    open(IDSDATA,">:utf8",$idsdata_file) or die;
     flock(IDSDATA,LOCK_EX);
     seek(IDSDATA,0,0);
 }
@@ -220,14 +225,10 @@ while(<>){
     }
 }
 
-print IDSDATA 'use utf8;',"\n";
+print IDSDATA 'START',"\t",$font_start,"\t",$ids_start,"\n";
 foreach $ids (keys %ids){
-    print IDSDATA '$ids{\'',$ids,'\'}='
-    ,'[',join ",",@{$ids{$ids}},"];\n";
+    print IDSDATA $ids,"\t",join("\t",@{$ids{$ids}}),"\n";
 }
-print IDSDATA '$font_start=',$font_start,";\n";
-print IDSDATA '$ids_start=',$ids_start,";\n";
-print IDSDATA "1;";
 flock(IDSDATA,LOCK_UN);
 
 if($exec_makefonts){
index ea11519..51274b8 100755 (executable)
@@ -224,14 +224,19 @@ BLACKBOX
 ##############
 
 # Read ids data generated by inCHISE
-my $idsdata="$omegadb_path/idsdata.pl";
+my $idsdata="$omegadb_path/idsdata.txt";
 my ($font_start, $ids_start, %ids);
 if(-e $idsdata){
     # "require" doesn't work well.
     # I don't know why...
     open (my $data, "<:utf8","$idsdata");
     while(<$data>){
-       eval $_;
+       utf8::decode($_);
+       if(m/^START\t(\d+)\t(\d+)/){
+           $font_start=$1,$ids_start=$2;
+       }elsif(m/^(.*?)\t(\d+)\t(\d+)/){
+           $ids{$1}=[$2,$3,];
+       }
     }
     close($data);
 }else{