source:
codelist.pl
Last change on this file was 4fd3c04, checked in by Anders Kaseorg <andersk@mit.edu>, 7 years ago | |
---|---|
|
|
File size: 702 bytes |
Rev | Line | |
---|---|---|
[69894d2] | 1 | #! /usr/bin/perl |
[1aee7d9] | 2 | |
[06adc25] | 3 | my $guard_symbol = "INC_BARNOWL_OWL_PROTOTYPES_H"; |
4 | print "#ifndef $guard_symbol\n"; | |
5 | print "#define $guard_symbol\n"; | |
[7d4fbcd] | 6 | foreach $file (@ARGV) { |
7 | open(FILE, $file); | |
8 | ||
9 | print "/* -------------------------------- $file -------------------------------- */\n"; | |
10 | while (<FILE>) { | |
11 | if (/^\S/ | |
[ac70242] | 12 | && (/\{\s*$/ || /\)\s*$/) |
[7d4fbcd] | 13 | && !/\}/ |
14 | && !/^\{/ | |
[ac70242] | 15 | && !/^#/ |
[7d4fbcd] | 16 | && !/^static/ |
[69894d2] | 17 | && !/^system/ |
[4594d83] | 18 | && !/^XS/ |
[0ff8fb57] | 19 | && !/\/\*/ |
[4fd3c04] | 20 | && !/ZWRITEOPTIONS/) |
[0ff8fb57] | 21 | { |
[09489b89] | 22 | |
[4594d83] | 23 | s/\s+\{/\;/; |
24 | s/\)[ \t]*$/\)\;/; | |
25 | print "extern "; | |
26 | print; | |
[09489b89] | 27 | } elsif (/^#if/ || /^#else/ || /^#endif/) { |
28 | print; | |
[4594d83] | 29 | } |
[7d4fbcd] | 30 | |
31 | } | |
32 | close(FILE); | |
33 | print "\n"; | |
34 | } | |
[06adc25] | 35 | print "#endif /* $guard_symbol */\n"; |
Note: See TracBrowser
for help on using the repository browser.