From f8d2411dc3e91261a7ad7485790c3aecd389adb1 Mon Sep 17 00:00:00 2001 From: nakeee Date: Sun, 14 Jun 2009 20:52:17 +0000 Subject: [PATCH] DSP createtest now calculate the size of body/header now we need to split the test git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3444 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/DSPSpy/util/createtest.pl | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Source/DSPSpy/util/createtest.pl b/Source/DSPSpy/util/createtest.pl index db50c9e2cb..1202603c5d 100755 --- a/Source/DSPSpy/util/createtest.pl +++ b/Source/DSPSpy/util/createtest.pl @@ -7,7 +7,7 @@ use Getopt::Long; use Data::Dumper; sub usage() { - die("createtest -i \n"); + die("createtest -i -c \n"); } sub parseString { @@ -36,6 +36,33 @@ sub generateTest { } } +sub calculateLines { + my $text = shift; + my $lines = 0; + my $incdir = "./"; + + foreach my $line (split /\n/, $text) { + next if ($line =~ /^\S*$/); + next if ($line =~ /^\S*;/); + next if ($line =~ /:/); + + if ($line =~ /incdir\s*\"(.*)\"/) { + $incdir = $1; + } elsif ($line =~ /include\s*\"(.*)\"/) { + my $incname = "$incdir/$1"; + open(INCLUDE, "<$incname") || + die("Can't open include file $incname: $!\n"); + + my $include = join "", ; + $lines += calculateLines($include); + } else { + $lines++; + } + } + + return $lines; +} + my ($cmds,$input,$output); if (!GetOptions('cmds|c=s' => \$cmds, 'input|i=s' => \$input, @@ -54,8 +81,12 @@ foreach my $cmd (split(/,/, $cmds)) { my $name = parseString($xtest->{'name'}, $cmd); $name =~ s/ /_/g; my $desc = parseString($xtest->{'description'}, $cmd); + my $header = parseString($xtest->{'header'}, $cmd); + my $hsize = calculateLines($header); + my $body = parseString($xtest->{'body'}, $cmd); + my $bsize = calculateLines($body); open(OUTPUT, ">$name.ds") || die("Can't open file $name for writing: $!\n");