4 # Generate help (both C and texinfo) from inform.y
6 # This one doesn't even pretend to be nitfol-independant.
14 # command => [ [ argtype1, argtype2, ... ], helptext [ helpname, ... ] ]
17 if(/^\/\* :: (.*) \*\//) {
20 /\| (\S+)\s *(.*?(\/\*.*?\*\/)?.*?)\{/;
26 s/FILE/\@var\{file\}/g;
27 s/commaexp/\@var\{exp\}/g;
28 s/linespec/\@var\{linespec\}/g;
29 s/IF/if/g; # Ugly, but oh well...
32 if($helptable{$helpcommand}[0]) {
33 push @{ $helptable{$helpcommand}[0] }, $helpargs;
34 $helptable{$helpcommand}[1] = $helptable{$helpcommand}[1] . "\\n" . $helptext;
36 @{ $helptable{$helpcommand}[0] } = ( $helpargs );
37 $helptable{$helpcommand}[1] = $helptext;
39 } elsif(/static name_token infix_commands/) {
40 while(<> =~ /\{\s*(\S+)\,\s*\"(.*?)\"\s*\}/) {
41 $helpcommand = $1; $helptext = $2;
42 push @{ $helptable{$helpcommand}[2] }, $helptext;
47 open("MYTEXINFO", ">dbg_help.texi") || die "Unable to write to dbg_help.texi";
50 foreach $helpcommand ( keys %helptable) {
52 foreach my $helparg (@{ $helptable{$helpcommand}[0] }) {
53 print $tag, @{$helptable{$helpcommand}[2]}[0], " $helparg\n";
56 $_ = $helptable{$helpcommand}[1];
63 open("MYCHELP", ">dbg_help.h") || die "Unable to write to dbg_help.c";
66 print "static name_token command_help[] = {\n";
69 foreach $helpcommand ( keys %helptable) {
74 print " { $helpcommand, \"", texi2txt($helptable{$helpcommand}[1]), "\" }";
82 s/\@code\{(.*?)\}/\'$1\'/g;
83 s/\@file\{(.*?)\}/\'$1\'/g;