(Temporarily) set "animate" to "none" by default (broken feature).
[gf1.git] / makehelptext.pl
blob6156151e41711ba5ce8c422c619429d9d6ed3307
1 #!/usr/bin/perl
4 # $Id$
6 # this program takes a textfile with gf1-documentation, and converts
7 # it to an include-file
10 # Copyright (C) 1998 Kurt Van den Branden
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 if ($ARGV[0])
28 $infile = $ARGV[0];
30 else
32 $infile = 'gf1_doc.txt';
35 if ($ARGV[1])
37 $outfile = $ARGV[1];
39 else
41 $outfile = 'helptext.h';
44 open (IN, $infile) || die "ERROR: input not found ($infile)\n\n";
45 open (OUT, ">$outfile") || die "ERROR: can't create output ($outfile)\n\n";
47 print OUT "/*\n";
48 print OUT "** contains the text to display in the helpwindow from gf1\n";
49 print OUT "**\n";
50 print OUT "** this file is created automatically from the documentation\n";
51 print OUT "*/\n";
52 print OUT "/*\n";
53 print OUT "** Copyright (C) 1998 Kurt Van den Branden\n";
54 print OUT "**\n";
55 print OUT "** This program is free software; you can redistribute it and/or modify\n";
56 print OUT "** it under the terms of the GNU General Public License as published by\n";
57 print OUT "** the Free Software Foundation; either version 2 of the License, or\n";
58 print OUT "** (at your option) any later version.\n";
59 print OUT "** \n";
60 print OUT "** This program is distributed in the hope that it will be useful,\n";
61 print OUT "** but WITHOUT ANY WARRANTY; without even the implied warranty of\n";
62 print OUT "** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n";
63 print OUT "** GNU General Public License for more details.\n";
64 print OUT "** \n";
65 print OUT "** You should have received a copy of the GNU General Public License\n";
66 print OUT "** along with this program; if not, write to the Free Software\n";
67 print OUT "** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. \n";
68 print OUT "*/\n";
69 print OUT "\n";
70 print OUT "#ifndef _HELPTEXT_H_\n";
71 print OUT "#define _HELPTEXT_H_\n";
72 print OUT "\n";
73 print OUT "const char * helplines[] = {\n";
74 print OUT " \"\",\n";
75 print OUT " \"\",\n";
77 $counter = 2;
78 @sections = ();
80 while ($line = <IN>)
82 $counter++;
84 chop ($line);
85 # replace " with \"
86 $line =~ s/\"/\\\"/g;
87 # cut all spaces from the start of the line
88 ($text) = $line =~ m/^\s*(.*)/;
89 if ($counter == 3)
91 print OUT " \"\@c\@m$line\",\n";
92 print OUT " \"\",\n";
93 push (@sections, [$text, $counter]);
94 $counter++;
96 elsif ($line =~ m/^\s*\d+\.\s+/)
98 print OUT " \"\@m$line\",\n";
99 push (@sections, [" $text", $counter]);
101 elsif ($line =~ m/^\s*\d+\.\d+\.\s+/)
103 print OUT " \"\@b$line\",\n";
104 push (@sections, [" $text", $counter]);
106 elsif ($line =~ m/^\s*\d+\.\d+\.\d+\.\s+/)
108 print OUT " \"$line\",\n";
109 push (@sections, [" $text", $counter]);
111 else
113 print OUT " \"$line\",\n";
117 print OUT "};\n\n";
118 print OUT "struct sectiondata {\n";
119 print OUT " char line[100];\n";
120 print OUT " int offset;\n";
121 print OUT "} sectionlines[] = {\n";
123 foreach $item (@sections)
125 print OUT " {\"$item->[0]\", $item->[1]},\n";
128 print OUT "};\n\n";
130 print OUT "#endif\n";
131 exit;