File: codelist.pl

package info (click to toggle)
owl 2.1.8-2.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,816 kB
  • ctags: 3,421
  • sloc: ansic: 34,004; perl: 246; makefile: 140; sh: 43
file content (40 lines) | stat: -rwxr-xr-x 691 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/perl
# $Id: codelist.pl,v 1.7 2003/07/02 22:15:24 kretch Exp $

if ($#ARGV eq -1) {
    @ARGV=`ls *.c`;
    chop(@ARGV);
}

foreach $file (@ARGV) {
    open(FILE, $file);

    print "/* -------------------------------- $file -------------------------------- */\n";
    while (<FILE>) {
	if (/^\S/
	    && (/\{\s*$/ || /\)\s*$/)
	    && !/\}/
	    && !/^\{/
	    && !/^#/
	    && !/^static/
	    && !/^system/
	    && !/^XS/
	    && !/\/\*/
	    && !/ZWRITEOPTIONS/
	    && !/owlfaim_priv/)
	{

	    s/\s+\{/\;/;
	    s/\)[ \t]*$/\)\;/;
	    print "extern ";
	    print;
	} elsif (/^#if/ || /^#else/ || /^#endif/) {
	    print;
	}
	    
    }
    close(FILE);
    print "\n";
}