comparison libtommath/gen.pl @ 1511:5916af64acd4 fuzz

merge from main
author Matt Johnston <matt@ucc.asn.au>
date Sat, 17 Feb 2018 19:29:51 +0800
parents 8bba51a55704
children
comparison
equal deleted inserted replaced
1457:32f990cc96b1 1511:5916af64acd4
2 # 2 #
3 # Generates a "single file" you can use to quickly 3 # Generates a "single file" you can use to quickly
4 # add the whole source without any makefile troubles 4 # add the whole source without any makefile troubles
5 # 5 #
6 use strict; 6 use strict;
7 use warnings;
7 8
8 open( OUT, ">mpi.c" ) or die "Couldn't open mpi.c for writing: $!"; 9 open(my $out, '>', 'mpi.c') or die "Couldn't open mpi.c for writing: $!";
9 foreach my $filename (glob "bn*.c") { 10 foreach my $filename (glob 'bn*.c') {
10 open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!"; 11 open(my $src, '<', $filename) or die "Couldn't open $filename for reading: $!";
11 print OUT "/* Start: $filename */\n"; 12 print {$out} "/* Start: $filename */\n";
12 print OUT while <SRC>; 13 print {$out} $_ while <$src>;
13 print OUT "\n/* End: $filename */\n\n"; 14 print {$out} "\n/* End: $filename */\n\n";
14 close SRC or die "Error closing $filename after reading: $!"; 15 close $src or die "Error closing $filename after reading: $!";
15 } 16 }
16 print OUT "\n/* EOF */\n"; 17 print {$out} "\n/* EOF */\n";
17 close OUT or die "Error closing mpi.c after writing: $!"; 18 close $out or die "Error closing mpi.c after writing: $!";
18 19
19 system('perl -pli -e "s/\s*$//" mpi.c'); 20 system('perl -pli -e "s/\s*$//" mpi.c');