Debian Codegraph @

systest/lgverbosity

raw
1 #!/usr/bin/env bash
2 # Written by <[email protected]>
3 #%DESC List function and file verbosity levels
4
5 cd ${0%/*}/..
6
7 shopt -s globstar
8 perl -ne \
9 'BEGIN { $func_fieldwidth = 30; }
10 $filedebug = "";
11 if (/(?:verbosity_level|lgdebug)\(\+?(D_SPEC\+\d+)/)
12 {
13 $line = $.;
14 $verbosity = $1;
15 while (<>)
16 {
17 next if /{/;
18 $more_info = $_;
19 last;
20 }
21 $more_info =~ s/^\s+//;
22 chomp($more_info);
23 $out = sprintf "%-10s %-15s %s", $verbosity, "", $more_info;
24 }
25 elsif (/^#define\s+(D_[A-Z]+)\s+(\S+)\s*(.*)$/)
26 {
27 $line = $.;
28 $out = sprintf "%-10s %-15s %s", $1, $2, $3;
29 $filedebug = /for this file/;
30 }
31 $func = "";
32 $func = $1 if /([\w:]+)\(.*[\),]\s*$/;
33 if ($. > $line && $out)
34 {
35 ($file) = $ARGV =~ m|link-grammar/(.*)|;
36 if ($func)
37 {
38 $func = $func ."()";
39 $func = "...".substr($func, -($func_fieldwidth-3))
40 if $func =~ /::/ && length($func) > $func_fieldwidth;
41 }
42 $func = "Whole file" if $filedebug;
43 printf "%-30s %${func_fieldwidth}s %s\n", $file.":", $func, $out;
44 $out = "";
45 }
46 ' \
47 **/*.[ch]* | sort -n -k 4