summaryrefslogtreecommitdiff
blob: 0ddacecc6c87e6b5b7a1612e5b7bb1e8eb858fe4 (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
25
26
27
28
29
30
31
32
#!/usr/bin/perl

open(INPUT, "<cpuemu_6.c");
open(OUT1, ">cpuemu_6.t");
open(OUT2, ">cpuemu_7.c");

$header = 1;
$part = 0;

while ($line = <INPUT>) {

	$size += length($line);

	if (($line =~ /^#/ || $line eq "\n") && ($line ne "#ifdef PART_1\n") && $header) {
		print OUT1 $line;
		print OUT2 $line;
	} else {
	
		$header = 0;
	
		if ($line ne "#ifdef PART_4\n" && $part == 0) {
			print OUT1 $line;
		} else {
			$part = 1;
			print OUT2 $line;
		}
	}
}

close(OUT2);
close(OUT1);
close(INPUT);