#!/usr/bin/perl
#
# Read in the C MIB tree generated by parse and produce a bunch of
# C #define commands for the symbols in field four.
#
$I = 100;

while (<>) {
	chop;
	if (/\{(\{.*\}),\s*(\d+),\s*(\w+),\s*(\w+),\s*(\w+),\s*(\w+),\s*"(\w+)"\},\s*$/) {
		if (++$S{$4} == 1) {	# Count the symbol references.
			++$I;		# Only #define the first time we see a symbol.
			print "/$4/s/},\$/,\"$7\"},/\n";
		}
		++$Fct{$6};	# Count the function references.
	} else {
		print "### no match: \"$_\"\n";
	}
}
#
# Now produce extern declarations for all the functions:
#for $f (sort keys(%Fct)) {
#	print"extern byte* $f();\n";
#}
