(file) Return to chexify.pl CVS log (file) (dir) Up to [RizwankCVS] / group3 / wine / tools

Diff for /group3/wine/tools/chexify.pl between version 1.4 and 1.5

version 1.4, 2005/02/25 22:55:23 version 1.5, 2005/02/26 02:10:50
Line 12 
Line 12 
 my $file;       #each of the files we are working on my $file;       #each of the files we are working on
 my $varname;    #file name converted to variable name my $varname;    #file name converted to variable name
 my $buffer;     #buffer to store the hexified contents of a file till output my $buffer;     #buffer to store the hexified contents of a file till output
   my $readcount;   #number of chars actually read
   
  
 # no input record separator to just slurp everything # no input record separator to just slurp everything
 undef $INPUT_RECORD_SEPARATOR; undef $INPUT_RECORD_SEPARATOR;
Line 29 
Line 31 
        #hex contents of the file        #hex contents of the file
            #BUG:have to get rid of the last comma            #BUG:have to get rid of the last comma
            print "const static char file_$varname"."[] = {\n";            print "const static char file_$varname"."[] = {\n";
        while ( read(FILE, $buffer, 16) ) {  
   
   
          while ( $readcount=read(FILE, $buffer, 16) ) {
   
                              die("Read error in $file:$OS_ERROR") unless defined($readcount);
                $buffer =~ s/(.|\n)/'0x' . unpack('H2', $1).', '/ge;                $buffer =~ s/(.|\n)/'0x' . unpack('H2', $1).', '/ge;
                              $buffer =~ s/(, )$//g if($readcount < 16);
                print "\t$buffer\n";                print "\t$buffer\n";
   
        }        }
        print "};\n";        print "};\n";
            close FILE;            close FILE;


Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

Rizwan Kassim
Powered by
ViewCVS 0.9.2