Column Fitting: don't go higher than 15 significant digits by default.
[gnumeric.git] / tools / biffnames
blob9d8f93a4f2e4a8f0dd9bed35e837cfe1e5a6fcd2
1 #!/usr/bin/perl -w
3 my %names;
5 while (<STDIN>) {
6 chomp;
7 s{/\*.*\*/}{ };
8 if (/^\s*\#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)\s+(.*\S)\s*/) {
9 my $name = $1;
10 my $opcode = $2;
12 if (exists $names{$opcode}) {
13 $names{$opcode} .= "/$name";
14 } else {
15 $names{$opcode} .= $name;
20 print "#include <stdlib.h>\n";
21 print "#include <biff-types.h>\n";
22 print "\n";
23 print "const char *\n";
24 print "biff_opcode_name (unsigned int opcode)\n";
25 print "{\n";
26 print " switch (opcode) {\n";
27 foreach my $opcode (sort keys %names) {
28 my $name = $names{$opcode};
29 print " case $opcode: return \"$name\";\n";
31 print " default: return NULL;\n";
32 print " }\n";
33 print "}\n";