1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
12 die "Usage: $cmd module...\n";
20 foreach $module (@ARGV) {
22 warn "$cmd: no such directory $module\n";
26 open(DIRS, "find $module -type d|");
27 @dirs = grep {if(!/CVS/) {chop;}} <DIRS>;
30 open(FIND, "find $module -type f|");
31 @files = grep {if (!/build/
45 && !/\.a$/) {chop;}} <FIND>;
53 foreach $file (@files) {
55 if (!open(IN, $file)) {
56 warn "$cmd: cannot open '$file' for reading\n";
68 # Define two associative arrays to keep the results for each kind
72 foreach $type (keys %typeRE) {
73 $linespertype{$type} = 0;
74 $filespertype{$type} = 0;
76 # The file is classified and added to the corresponding variable.
77 FILE: while (($file, $l) = each %lines) {
78 foreach $type (@match_order) {
81 $linespertype{$type} += $l;
82 $filespertype{$type}++;
86 print STDERR "Unmatched file: $file\n";
93 Lines of code in module @<<<<<<<<<<<<<<<<<<<<
98 Directories: @>>>>>>>>
103 File type lines files
104 ---------------------------- ------------------ -----------------
107 @<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>>>>> @>>>>>>>>>>>>>>>>
108 $type, $typelines, $typefiles
112 foreach $type (@match_order) {
113 $typelines = $linespertype{$type};
114 $typefiles = $filespertype{$type};
115 if ($typefiles != 0) {
119 # Forzamos un newpage para cada modulo.
127 if (exists $typeRE{$desc}) {
128 local $mix = $typeRE{$desc} . '|(' . $re . ')';
129 $typeRE{$desc} = $mix;
131 $typeRE{$desc} = '(' . $re . ')';
132 push @match_order, $desc;
137 # Here we define the regular expressions for each kind of file.
138 # This RE must be mutually exclusive, a file will not be counted
139 # twice, but it could be unproperly classified.
142 ('GNUmakefile' => 'Makefile',
143 'Makefile.*' => 'Makefile',
144 'README' => 'README files',
145 'COPYING' => 'Licenses',
146 'LICENSE.*' => 'Licenses',
147 'ChangeLog.*' => 'ChangeLog',
148 'ChangeLog-.*' => 'ChangeLog',
149 '.cvsignore' => 'Control CVS',
150 'run_test.pl' => 'Test driver',
151 'run_test' => 'Test driver',
152 'run_tests' => 'Test driver',
153 'run_test.sh' => 'Test driver');
155 ('cc' => 'C++ sources',
156 'cpp' => 'C++ sources',
157 'inl' => 'C++ sources',
158 'i' => 'C++ sources',
161 'c' => 'C/C++ sources',
162 'idl' => 'IDL sources',
163 'IDL' => 'IDL sources',
164 'pidl' => 'IDL sources',
165 'y' => 'yacc source',
166 'yy' => 'yacc source',
168 'll' => 'lex source',
169 'php' => 'php script',
170 'pm' => 'perl script',
171 'pl' => 'perl script',
172 'perl' => 'perl script',
173 'py' => 'python script',
174 'GNU' => 'GNU make config',
176 'txt' => 'Text files',
181 'sty' => 'TeX styles',
182 'bld' => 'VxWorks build file',
183 'am' => 'Automake file',
184 'icc' => 'VisualAge project files',
185 'icp' => 'VisualAge project files',
186 'vac' => 'VisualAge project files',
187 'vcp' => 'Microsof eMbedded Visual Tools project files',
188 'vcw' => 'Microsof eMbedded Visual Tools project files',
189 'bpr' => 'Borland project files',
190 'bor' => 'Borland project files',
191 'dsp' => 'DevStudio project files',
192 'DSP' => 'DevStudio project files',
193 'mdp' => 'MSVC project files',
194 'MDP' => 'MSVC project files',
195 'dsw' => 'MSVC workspaces',
196 'DSW' => 'MSVC workspaces',
197 'mak' => 'MSVC MAK files',
198 'MAK' => 'MSVC MAK files',
199 'java' => 'JAVA source',
200 'class' => 'JAVA class',
201 'cccc' => 'codecount output',
202 'gif' => 'GIF images',
203 'conf' => 'Svc_Config files',
205 'zip' => 'Compressed files',
206 'gz' => 'Compressed files',
207 'EXE' => 'Win32 executable',
208 'shar' => 'Shar archive',
209 'mib' => 'MIB definition files',
210 'gperf' => 'GPERF input',
211 'phil.*'=> 'Test driver'
215 local ($desc, $reseed);
216 while (($reseed, $desc) = each %filenames) {
217 local $re = '/' . $reseed . '$';
218 updateRE($desc, $re);
220 while (($reseed, $desc) = each %fileexts) {
221 local $re = '/[^/]*\.' . $reseed . '$';
222 updateRE($desc, $re);
224 while (($reseed, $desc) = each %paths) {
226 updateRE($desc, $re);
229 updateRE('Others', '.*');
231 # while (($desc, $reseed) = each %typeRE) {
232 # print STDERR $desc, " ==> ", $reseed, "\n";