History

core ejected

Ge Wang committed 9 years ago

Commit d38351c1 parent 74cf4d4158 files · +0 −196800Browse files

Showing the changes to src/scripts/compressSndFile.pl (1 of 158 files). Show all

Unified · Split

src/scripts/compressSndFile.pl+104−0
@@ -0,0 +1,104 @@
1use Data::Dumper;
2my %seen;
3my @source;
4
5my $output = $ARGV[0];
6
7my @fileList = `ls *.c *.h`;
8foreach $_ (@fileList)
9{
10 chomp;
11 if( $_ =~ /$output/ || $_ =~ /test/ ) {}
12 elsif( $_ =~ /\.h/ ) { $seen{$_} = 0; }
13 elsif( $_ =~ /\.c/ ) { push @source, $_ }
14}
15
16close DOTH;
17close DOTC;
18open DOTH, ">" . $output . ".h" or die;
19open DOTC, ">" . $output . ".c" or die;
20my @list;
21$seen{'config.h'} = 1;
22push @list, "config.h";
23$seen{'sndfile.h'} = 1;
24push @list, "sndfile.h";
25$seen{'common.h'} = 1;
26push @list, "common.h";
27$seen{'G72x.h'} = 1;
28push @list, "G72x.h";
29
30sub depend
31{
32 my $file = shift;
33 my $handle;
34 open $handle, "<$file";
35 while(<$handle>)
36 {
37 if( my $include = /#include[ \t]*[<"]([\w\d]+\.h)[>"]/ )
38 {
39 if( defined( $seen{$include} && $seen{$include} == 0 ) )
40 {
41 depend( $include );
42 }
43 }
44 }
45 close $handle;
46 $seen{$file} = 1;
47 push @list, $file;
48}
49
50foreach my $key ( keys %seen )
51{
52 if( $seen{$key} == 0 ) { depend($key); }
53}
54
55print DOTH '#include <stdio.h>' . "\n\n";
56print DOTH '#include <stdlib.h>' . "\n\n";
57foreach my $file (@list)
58{
59 open F, "<$file";
60 while(<F>)
61 {
62 if( $_ !~ /#include[ \t]*[<"](\w+\.h)[>"]/ )
63 {
64 print DOTH $_;
65 }
66 }
67 close F;
68}
69
70
71
72
73
74close FILE;
75
76print DOTC '#include ' . "\"$output.h\"\n";
77print DOTC '#include <stdio.h>' . "\n\n";
78print DOTC '#include <stdlib.h>' . "\n\n";
79foreach my $file (@source)
80{
81 open FILE, $file;
82 $file =~ s/\.[ch]//g;
83 while( my $line = <FILE> )
84 {
85 if( $line !~ /#include[ \t]*("[\w\d]+\.[ch]")|<CoreServices.h>/ )
86 {
87 $line =~ s/(f2d_array)/$file$1/g;
88 $line =~ s/(d2f_array)/$file$1/g;
89 $line =~ s/(_\w+tab)/$file$1/g;
90 $line =~ s/(STEP)/$file$1/g;
91 $line =~ s/(HAVE_[^D]\w+)/$file$1/g;
92 print DOTC $line;
93 }
94 }
95 close FILE;
96}
97
98
99
100close DOTH;
101close DOTC;
102
103
104

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t