Return to chexify.pl CVS log | Up to [RizwankCVS] / group3 / wine / tools |
1 rizwank 1.1 #!/usr/bin/perl 2 # hexify.pl 3 # Takes a list of filenames on stdin and create a C data array for each one. | ||
4 rizwank 1.2 # Copyright Dan Kegel, Rizwan Kassim 2005 | ||
5 rizwank 1.1 # Licensed under LGPL 6 7 # no input record separator 8 undef $/; 9 10 foreach $file (@ARGV) { 11 open FILE, $file || die; 12 binmode FILE; 13 14 # munge filename into C variable name 15 $varname = $file; 16 $varname =~ s/\./_/; 17 18 print "const static char name_$varname"."[] = \"$file\";\n"; 19 print "const static char file_$varname"."[] = {\n"; 20 while (read(FILE, $buffer, 16)) { 21 $buffer =~ s/(.|\n)/'0x' . unpack('H2', $1).', '/ge; 22 print "\t$buffer\n"; 23 } | ||
24 rizwank 1.2 print "const static int size_$varname"." = sizeof(file_$varname);\n"; | ||
25 rizwank 1.1 close FILE; 26 27 print "};\n\n"; 28 } |
Rizwan Kassim |
Powered by ViewCVS 0.9.2 |