summaryrefslogtreecommitdiff
path: root/bin/vc_filter.pl
blob: 5b78ec98f3e7e11150ebc452bafef4480d93e97a (plain)
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
# $Id$
#
# A perl script that filers length VC output into a concise html report.

$usage = "vc_filter.pl [-c] <source>";

# Define html tags.
$header = "<html><head>
<title>Error/Warning Summary of Daily Build</title>
</head>

<body bgcolor=\"white\">
<h1>Error/Warning Summary of Daily Build</h1><TT>\n";
$trailer = "</TT></body></html>";

$kosher_b = "";
$kosher_e = "";

$in_sin_b = "<FONT COLOR=\"RED\">";
$in_sin_e = "</FONT>";

$new_build_b = "<P>";
$new_build_e = "";
$line_break = "<BR>";

while ( $#ARGV >= 0  &&  $ARGV[0] =~ /^-/ )
{
    if ( $ARGV[0] eq '-c') # Text format
    {
        $header = "" ;
        $trailer = "" ;
        $kosher_b = "";
        $kosher_e = "";

        $in_sin_b = "";
        $in_sin_e = "";

        $new_build_b = "\n\n";
        $new_build_e = "";
        $line_break = "";
    }
    else
    {
        warn "$0:  unknown option $ARGV[0]\n";
        die $usage;
    }
    shift;
}

# Get filename.
$fname = $ARGV[0];
open (fp, "$fname");

print $header ;

restart: while ($line = <fp>)
{
    print "$new_build_b $line $new_build_e $line_break" if ($line =~/^--------------------Configuration:/);

    if ($line =~ /(^[A-Z_a-z0-9.]+ - [0-9]+ error\(s\), +[0-9]+ warning\(s\))|(LNK4089)/)
    {
        if ($line =~ /(0 error\(s\), 0 warning\(s\))|(LNK4089)/)
        {
            print "$kosher_b $line $kosher_e $line_break";
        }
        else
        {
            print "$in_sin_b $line $in_sin_e $line_break";
        }
        next restart;
    }

    print "$in_sin_b $line $in_sin_e $line_break"
        if ($line =~/^[-A-Z_a-z0-9.\/\\:]+\([0-9]+\) : / ||
            $line =~/^[-A-Z_a-z0-9.\/\\:]+.*, line [0-9]+: / ||
            $line =~/^[-A-Z_a-z0-9.\\:]+\.obj : / ||
            $line =~/^fatal error/ ||
            $line =~/^Error executing/ ||
            $line =~/^4NT: / ||
            $line =~/^LINK : /);

}

print $trailer;