annotate test/code-gen.pl @ 684:6e2f1e7f9fc3

*** empty log message ***
author kono
date Tue, 02 Oct 2007 21:18:12 +0900
parents df60b120675d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
200
d83291712bf7 test routine
kono
parents:
diff changeset
1 #!/usr/bin/perl
d83291712bf7 test routine
kono
parents:
diff changeset
2
550
df60b120675d *** empty log message ***
kono
parents: 526
diff changeset
3 my $inline;
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
4 my $call;
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
5
550
df60b120675d *** empty log message ***
kono
parents: 526
diff changeset
6 open(INLINE,">test/code-gen-inline.c") if ($inline);
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
7
200
d83291712bf7 test routine
kono
parents:
diff changeset
8 print "#include \"code-gen.c\"\n";
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
9
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
10 $call .= "int main() {\n";
200
d83291712bf7 test routine
kono
parents:
diff changeset
11
d83291712bf7 test routine
kono
parents:
diff changeset
12 while(<>)
d83291712bf7 test routine
kono
parents:
diff changeset
13 {
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
14 if (/^(\w+)(\(.*)/) {
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
15 $call .= "\t$1(".");\n";
550
df60b120675d *** empty log message ***
kono
parents: 526
diff changeset
16 print INLINE "inline $1$2" if ($inline);
235
c575422d8b6e *** empty log message ***
kono
parents: 201
diff changeset
17 } elsif (/^#/) {
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
18 $call .= $_;
550
df60b120675d *** empty log message ***
kono
parents: 526
diff changeset
19 print INLINE if ($inline);
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
20 } else {
550
df60b120675d *** empty log message ***
kono
parents: 526
diff changeset
21 print INLINE if ($inline);
200
d83291712bf7 test routine
kono
parents:
diff changeset
22 }
d83291712bf7 test routine
kono
parents:
diff changeset
23 }
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
24 $call .= "return 0; }\n";
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
25
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
26 print $call;
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
27
550
df60b120675d *** empty log message ***
kono
parents: 526
diff changeset
28 print INLINE $call if ($inline);
526
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
29
9ff5cd7afe2f *** empty log message ***
kono
parents: 245
diff changeset
30 # end