123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- die "Could not open $ARGV[0]: $!" unless open (F,$ARGV[0]);
- $goflag=0;
- while($line=<F>){
- print "#### $line";
- if($line=~m/^GO/){
- $goflag=1;
- next;
- }
- if($goflag==0){
- if($line=~m/\S+/ && !($line=~m/^\#/) ){
- my $command=$line;
- print ">>> $command";
- die "Couldn't shell command.\n\tcommand:$command\n"
- if syst($command);
- }
- next;
- }
-
-
- if($line=~m/^>(\S+)\s+(\S*)/){
-
- $globalname=$1;
-
- $command="rm -f $globalname.vqh";
- die "Couldn't remove file.\n\tcommand:$command\n"
- if syst($command);
- next;
- }
-
-
-
-
- if($line=~m/^=(.*)/){
-
- @paths=split(' ',$1);
- next;
- }
-
- if($line=~m/^build (.*)/){
-
- my($datafile,$range,$guard)=split(' ',$1);
-
- $command="rm -f $datafile.tmp";
- print "\n\n>>> $command\n";
- die "Couldn't remove temp file.\n\tcommand:$command\n"
- if syst($command);
-
- foreach $dir (@paths){
- if (-e "$dir/$datafile.vqd"){
- $command="cat $dir/$datafile.vqd >> $datafile.tmp";
- print ">>> $command\n";
- die "Couldn't append training data.\n\tcommand:$command\n"
- if syst($command);
- }
- }
-
- my $command="huffbuild $datafile.tmp $range $guard";
- print ">>> $command\n";
- die "Couldn't build huffbook.\n\tcommand:$command\n"
- if syst($command);
- $command="cat $datafile.vqh >> $globalname.vqh";
- print ">>> $command\n";
- die "Couldn't append to output book.\n\tcommand:$command\n"
- if syst($command);
- $command="rm $datafile.vqh";
- print ">>> $command\n";
- die "Couldn't remove temporary output file.\n\tcommand:$command\n"
- if syst($command);
- $command="rm -f $datafile.tmp";
- print ">>> $command\n";
- die "Couldn't remove temporary output file.\n\tcommand:$command\n"
- if syst($command);
- next;
- }
- }
- $command="rm -f temp$$.vqd";
- print ">>> $command\n";
- die "Couldn't remove temp files.\n\tcommand:$command\n"
- if syst($command);
- sub syst{
- system(@_)/256;
- }
|