source: codelist.pl

release-1.7release-1.8release-1.9
Last change on this file was 06adc25, checked in by David Benjamin <davidben@mit.edu>, 7 years ago
Sanitize our include guards somewhat Avoid double underscores to avoid clashing with reserved symbols. Also adding BARNOWL to guard names. While I'm at it, owl_prototypes.h could use guards.
  • Property mode set to 100755
File size: 726 bytes
Line 
1#! /usr/bin/perl
2
3my $guard_symbol = "INC_BARNOWL_OWL_PROTOTYPES_H";
4print "#ifndef $guard_symbol\n";
5print "#define $guard_symbol\n";
6foreach $file (@ARGV) {
7    open(FILE, $file);
8
9    print "/* -------------------------------- $file -------------------------------- */\n";
10    while (<FILE>) {
11        if (/^\S/
12            && (/\{\s*$/ || /\)\s*$/)
13            && !/\}/
14            && !/^\{/
15            && !/^#/
16            && !/^static/
17            && !/^system/
18            && !/^XS/
19            && !/\/\*/
20            && !/ZWRITEOPTIONS/
21            && !/owlfaim_priv/)
22        {
23
24            s/\s+\{/\;/;
25            s/\)[ \t]*$/\)\;/;
26            print "extern ";
27            print;
28        } elsif (/^#if/ || /^#else/ || /^#endif/) {
29            print;
30        }
31           
32    }
33    close(FILE);
34    print "\n";
35}
36print "#endif /* $guard_symbol */\n";
Note: See TracBrowser for help on using the repository browser.