Mercurial > hg > CbC > old > device
view test/code-gen.pl @ 884:f915d5ba033e
struct init in function argument in parse_mode fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 05 Apr 2014 19:37:34 +0900 |
parents | df60b120675d |
children |
line wrap: on
line source
#!/usr/bin/perl my $inline; my $call; open(INLINE,">test/code-gen-inline.c") if ($inline); print "#include \"code-gen.c\"\n"; $call .= "int main() {\n"; while(<>) { if (/^(\w+)(\(.*)/) { $call .= "\t$1(".");\n"; print INLINE "inline $1$2" if ($inline); } elsif (/^#/) { $call .= $_; print INLINE if ($inline); } else { print INLINE if ($inline); } } $call .= "return 0; }\n"; print $call; print INLINE $call if ($inline); # end