root/codelist.pl
@
7d4fbcdd0df83802711454fdafce2c9d592bf431
| Revision 7d4fbcdd0df83802711454fdafce2c9d592bf431, 443 bytes (checked in by James M. Kretchmar <kretch@mit.edu>, 7 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | if ($#ARGV eq -1) { |
| 2 | @ARGV=`ls *.c`; |
| 3 | chop(@ARGV); |
| 4 | } |
| 5 | |
| 6 | foreach $file (@ARGV) { |
| 7 | open(FILE, $file); |
| 8 | |
| 9 | print "/* -------------------------------- $file -------------------------------- */\n"; |
| 10 | while (<FILE>) { |
| 11 | if (/^\S/ |
| 12 | && /\{\s*$/ |
| 13 | && !/\}/ |
| 14 | && !/^\{/ |
| 15 | && !/^#include/ |
| 16 | && !/^static/ |
| 17 | && !/^#define/ |
| 18 | && !/\/\*/) |
| 19 | {s/\s+\{/\;/; print "extern "; print;} |
| 20 | |
| 21 | } |
| 22 | close(FILE); |
| 23 | print "\n"; |
| 24 | } |
Note: See TracBrowser
for help on using the browser.
