summaryrefslogtreecommitdiff
path: root/makeheader.pl
blob: 2e2c4267c9450a3689711decef6d1e37941ba3c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl -w

use strict;

my ($basename, $midname, $endname, $infilename, $outfilename) = @ARGV;

my $perl = $ENV{PERL};

my $output_text = `$perl bin2c.pl THINGY < $infilename`;

$output_text =~ s/THINGY\[\]/$basename\[\]/;

$output_text =~ s/unsigned int THINGY_len = (\d+)/unsigned char $endname = $basename + $1/;

my $repltext = "unsigned char $midname = $endname - 4;";
$repltext = "" if ($midname eq '');

$output_text =~ s/int THINGY_mtime = \d+;/$repltext/;

open JELLY, ">", $outfilename;

print JELLY $output_text;

close JELLY;