aboutsummaryrefslogtreecommitdiff
path: root/lib/asap/files2anylang.pl
blob: ba1defd8c6c5ba6ac3e1400991eba2d3b46e523a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl -w
# Turns binary files into source code of initialized arrays.
use strict;
for (@ARGV) {
	open INPUT, $_ and binmode INPUT or die "$_: $!\n";
	s!.*[/\\]!!;
	y/0-9A-Za-z/_/c;
	print "CONST_ARRAY(byte, $_)\n\t";
	$/ = \1;
	$. = 0;
	print $. % 16 != 1 ? ',' : $. > 1 ? ",\n\t" : '', ord
		while <INPUT>;
	print "\nEND_CONST_ARRAY;\n"
}