# ver.0.2
use strict;
-use vars qw($opt_in_cs $opt_out_cs $opt_protrude
+use vars qw($omegadb_path
+ $opt_protrude $opt_order
+ $opt_in_cs $opt_out_cs
$opt_help $usage
$in_cs $out_cs $i @chars
- @order $opt_order %order
+ @order %order
$char $char_id $out_char
$ids $ids_argc %ids $idsdb
$idsdata_file $ids_start $font_start
);
use Getopt::Long;
use utf8;
+use Fcntl ':flock';
use Chise_utils ':all';
+my $omegadb_path="/usr/local/lib/chise/omega";
+
### Options ###
$opt_order='jtcgk';
exit 1;
}
-$idsdata_file="idsdata.pl";
+$omegadb_path=~s!/$!!;
+
+$idsdata_file="$omegadb_path/idsdata.pl";
$ids_start=0x00;
$font_start=0;
if(-e $idsdata_file){
- require $idsdata_file;
+ open(IDSDATA,"+<$idsdata_file") or die;
+ flock(IDSDATA,LOCK_EX);
+ seek(IDSDATA,0,0);
+ while(<IDSDATA>){
+ eval $_;
+ }
+ seek(IDSDATA,0,0);
+# require $idsdata_file;
+}else{
+ open(IDSDATA,">$idsdata_file") or die;
+ flock(IDSDATA,LOCK_EX);
+ seek(IDSDATA,0,0);
}
$ids_argc=0;
}
}
-open(IDSDATA,">$idsdata_file") or die;
print IDSDATA 'use utf8;',"\n";
foreach $ids (keys %ids){
print IDSDATA '$ids{\'',$ids,'\'}=[',join ",",@{$ids{$ids}},"];\n" if($perl56);
print IDSDATA '$font_start=',$font_start,";\n";
print IDSDATA '$ids_start=',$ids_start,";\n";
print IDSDATA "1;";
+flock(IDSDATA,LOCK_UN);
exit 0;