5 open(SRC
,"helpmsgs.src") || die $!;
6 open(NC
,">helpmsgs.cc.new") || die $!;
7 open(NH
,">helpmsgs.h.new") || die $!;
9 &autowarn
('NC'); &autowarn
('NH');
11 print(NC
"#include \"helpmsgs.h\"\n") || die $!;
12 print(NH
<<'END') || die $!;
15 struct helpmessage { const char *title; const char *text; };
19 $nblanks= 0; $nlines= 0;
22 if (m/^\@\@\@ (\w+)\s+(\S.*\S)\s+$/) {
24 $currentname= $1; $currenttitle= $2;
25 print(NH
"extern const struct helpmessage hlp_$currentname;\n") || die $!;
27 "const struct helpmessage hlp_$currentname = {\n".
28 " \"$currenttitle\", \"") || die $!;
29 } elsif (m/^\@\@\@/) {
34 if ($state ne 'start' && $nblanks) {
35 print(NC
("\\n"x
$nblanks)."\\\n") || die $!;
38 $state= 'middle'; $nblanks= 0;
40 print(NC
"\\\n".$_."\\n") || die $!;
48 print(NH
"#endif /* HELPMSGS_H */\n") || die $!;
51 rename("helpmsgs.cc.new","helpmsgs.cc") || die $!;
52 rename("helpmsgs.h.new","helpmsgs.h") || die $!;
55 if ($state ne 'start') {
56 print(NC
"\"\n};\n") || die $!;
57 printf "\t\t%s: %d lines\n",$currentname,$nlines;
58 if ($nlines > $maxnlines) { warn "Too many lines in $currentname"; }
61 $nblanks= 0; $nlines= 0;
67 print($fh <<'END') || die $!;
69 * WARNING - THIS FILE IS GENERATED AUTOMATICALLY - DO NOT EDIT
70 * It is generated by mkhelpmsgs.pl from helpmsgs.src.