File: itkgroup.pl

package info (click to toggle)
insighttoolkit4 4.13.3withdata-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 489,260 kB
  • sloc: cpp: 557,342; ansic: 146,850; fortran: 34,788; python: 16,572; sh: 2,187; lisp: 2,070; tcl: 993; java: 362; perl: 200; makefile: 129; csh: 81; pascal: 69; xml: 19; ruby: 10
file content (84 lines) | stat: -rw-r--r-- 1,991 bytes parent folder | download | duplicates (10)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# if regular doxycomment add a @{
# at next empty line add a //@}

$ingroup = 0;
$semicount =0;
$endbracecount = 0;
$endparencount = 0;
while(<>)
{
    chomp;
    $line = $_;
    # if the line is not an empty line
    if( $line =~ /\S+/ )
    {
        if ( /\/\*\*(.*)/ )
        {
            # I guess it was not a group, dump savebuffer
            if($ingroup)
            {
                print "/**" . $savebuffer . "\n";
            }
            # if it is a class or brief then output the line but
            # do not start a group
            if ( /(\\class|\\brief)/ )
            {
                print $line . "\n";
            }
            # must be a group so start saving
            else
            {
                $savebuffer = "$1" . "\n";
                $ingroup = 1;
                $semicount = 0;
                $endbracecount = 0;
                $endparencount = 0;
            }
        }
        else
        {
            # add to save buffer if in group
            if($ingroup)
            {
                $savebuffer = $savebuffer . $_ . "\n";
            }
            else
            {
                # non empty line that is not the start of a doxy comment
                print $_ . "\n";
            }
        }
        if($line =~ /;/ )
        {
            $semicount = $semicount + 1;
        }
        if($line =~ /\}/ )
        {
            $endbracecount = $endbracecount + 1;
        }
        if($line =~ /\)/ )
        {
            $endparencount = $endparencount + 1;
        }
    }
    else
    {
        if($ingroup)
        {
            if($endparencount > 1 && ($semicount > 1 || $endbracecount > 1))
            {
                print "/**@\{" . $savebuffer . "//@}\n\n";
            }
            else
            {
                print "/**" . $savebuffer . "\n";
            }
            $savebuffer = "";
            $ingroup = 0;
        }
        else
        {
            print $line . "\n";
        }
    }
}