summaryrefslogtreecommitdiff
path: root/tools/fmt-bindings
blob: 8aed63daccde4618d8d6f71cdfffdcc60b917c24 (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
#!/usr/bin/perl

$in_group_def = 0;
$group_name;
$group_text;
$group_key;
%group_names;
%group_text;

while (<>) {
    next if /^\;/;

    if (/^%/) {

	if ($in_group_def) {
	    chop $group_text;
	    $group_names{$group_key} = $group_name;
	    $group_text{$group_key} = $group_text;
	}

	s/^%//;
	chop;
	($group_key,$group_name) = split (/\s+/, $_, 2);
	$group_text = "";
	$in_group_def = 1;
	next;
    }

    if ($in_group_def) {
	next if (/^[ \t]+$/);
	$group_text .= $_;
	$group_text;
	next;
    }

    next;
}

foreach $k (keys %group_names) {
    print "GROUP: ", $k, " ", $group_names{$k}, "\n\t", $group_text{$k}, "\n";
}

exit 0;