# HG changeset patch # User anatofuz # Date 1575284226 -32400 # Node ID 004e825f37c71bd34e3cf1b86c394ea7719355b4 # Parent f6558602f31e4b2f94c4beeae66850230e645fa5 tweak trans_impl.pl diff -r f6558602f31e -r 004e825f37c7 src/gearsTools/trans_impl.pl --- 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) = @_;