Mercurial > hg > Members > menikon > CbC_xv6
changeset 123:004e825f37c7
tweak trans_impl.pl
author | anatofuz |
---|---|
date | Mon, 02 Dec 2019 19:57:06 +0900 |
parents | f6558602f31e |
children | f103beea19f4 |
files | src/gearsTools/trans_impl.pl |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gearsTools/trans_impl.pl Mon Dec 02 19:21:20 2019 +0900 +++ b/src/gearsTools/trans_impl.pl Mon Dec 02 19:57:06 2019 +0900 @@ -23,18 +23,17 @@ my $output_file = $impl_file; $output_file =~ s/\.h/.cbc/; -open my $fh, '>', $output_file; -my $stdout = $fh; +my $stdout = *STDOUT; -unless ($opt{w}) { - $stdout = *STDOUT; +if ($opt{w}) { + open $stdout, '>', $output_file; } emit_include_part($stdout, $inter_ir->{name}); emit_impl_header_in_comment($stdout, $impl_file); emit_constracutor($stdout,$impl_ir,$inter_ir); emit_code_gears($stdout,$impl_ir,$inter_ir); -close $fh; +close $stdout; sub emit_include_part { my ($out, $interface) = @_;