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.
32 $infile = 'gf1_doc.txt';
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";
48 print OUT
"** contains the text to display in the helpwindow from gf1\n";
50 print OUT
"** this file is created automatically from the documentation\n";
53 print OUT
"** Copyright (C) 1998 Kurt Van den Branden\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";
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";
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";
70 print OUT
"#ifndef _HELPTEXT_H_\n";
71 print OUT
"#define _HELPTEXT_H_\n";
73 print OUT
"const char * helplines[] = {\n";
87 # cut all spaces from the start of the line
88 ($text) = $line =~ m/^\s*(.*)/;
91 print OUT
" \"\@c\@m$line\",\n";
93 push (@sections, [$text, $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]);
113 print OUT
" \"$line\",\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";
130 print OUT
"#endif\n";