open(GPERF, "> dpiconst.gperf") or die "Cannot create dpiconst.gperf\n";
open(NAMES, "> dpiconst.list")  or die "Cannot create dpiconst.list\n";

print GPERF "struct DpiConst { const char *name; long val; };\n%%\n";
%consts = ();
while (<>) {
    if (/^\s*#define\s+((SNMP_|DPI_|dpi)\w+)\s/) {
	$consts{$1} = 1;
    }
}
@consts = sort keys %consts;

foreach (@consts) {
    print GPERF "$_,$_\n";
    print NAMES "$_\n";
}

close(GPERF);
close(NAMES);
