summaryrefslogtreecommitdiff
path: root/regress/style/check_log.pl
blob: a014da1b63d14635fae3c77177f0e4597376cd72 (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
#!/usr/bin/env perl
#
# $FML$
#

use strict;
use Carp;

$| = 1;

my $in_curproc  = 0;
my $in_function = 0;
my $in_debug    = 0;
my $cur_function_name;

while (<>) {
    if (/^sub\s+(\S+)/) { 
	_reset();
	$in_function = 1;
	$cur_function_name = $1;
	next;
    }

    if ($in_function) {
	if (/my.*\$curproc.*=\s*\@_;/) {
	    $in_curproc = 1;
	    next;
	}
	elsif (/my.*\$curproc.*=\s*\$self->{\s*(curproc|_curproc)\s*};/) {
	    $in_curproc = 1;
	    next;
	}

	if (/if.*\$debug/) { 
	    $in_debug = 1;
	}
	elsif (/^\s*$/) { 
	    $in_debug = 0;
	}
    }

    if (/Log\(|Log\w+\(/o) {
	if ($in_curproc) {
	    print STDERR "ok $ARGV $cur_function_name\n" if 0;
	}
	else {
	    print STDERR "?  $ARGV $cur_function_name $_";
	}
    }

    if (/curproc\-\>log/) {
	if ($in_curproc) {
	    print STDERR "ok $ARGV $cur_function_name\n" if 0;
	}
	else {
	    print STDERR "?? $ARGV $cur_function_name $_";
	}
    }
}


sub _reset
{
    $in_curproc  = 0;
    $in_function = 0;
    $in_debug    = 0;
    undef $cur_function_name;
}