store IDS data as text file instead of perl script.
authorimiyazaki <imiyazaki>
Thu, 2 Sep 2004 13:50:38 +0000 (13:50 +0000)
committerimiyazaki <imiyazaki>
Thu, 2 Sep 2004 13:50:38 +0000 (13:50 +0000)
inCHISE

diff --git a/inCHISE b/inCHISE
index 5d6067a..fa742c9 100755 (executable)
--- a/inCHISE
+++ b/inCHISE
@@ -40,8 +40,6 @@ $opt_use_kage_for_Ext_B=0;# 1=true, 0=false.
 
 ### End ###
 
-$/="";
-
 my $strictly_forbidden_after = '「【『[(〈‘‛“‟(〔{《{\[\(〖{「';
 
 my $forbidden_after = "\x{0000}";
@@ -120,7 +118,7 @@ if($opt_help
 
 $omegadb_path=~s!/$!!;
 
-$idsdata_file="$omegadb_path/idsdata.pl";
+$idsdata_file="$omegadb_path/idsdata.txt";
 $ids_start=0x00; 
 $font_start=0;
 
@@ -129,10 +127,15 @@ if(-e $idsdata_file){
     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,">:utf8",$idsdata_file) or die;
     flock(IDSDATA,LOCK_EX);
@@ -177,6 +180,8 @@ foreach $out_cs ('UniCNS','UniGB','UniJIS','UniKS','UniMulti'){
     }
 }
 
+$/="";
+
 while(<>){
     utf8::decode($_);
 
@@ -306,14 +311,10 @@ while(<>){
     print '}';
 }
 
-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);
 
 exit 0;