1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!@PERL@
use strict;
print "Creating built-in documentation for bbackupquery...\n";
open DOC, "Documentation.txt" or die "Can't open Documentation.txt file: $!";
my $section;
my %help;
my @in_order;
while(<DOC>)
{
if(m/\A>\s+(\w+)/)
{
$section = $1;
m/\A>\s+(.+)\Z/;
$help{$section} = $1."\n";
push @in_order,$section;
}
elsif(m/\A</)
{
$section = '';
}
elsif($section ne '')
{
$help{$section} .= $_;
}
}
close DOC;
open OUT,">autogen_Documentation.cpp" or die "Can't open output file for writing";
print OUT <<__E;
//
// Automatically generated file, do not edit.
//
#include "Box.h"
#include "MemLeakFindOn.h"
const char *help_commands[] =
{
__E
for(@in_order)
{
print OUT qq:\t"$_",\n:;
}
print OUT <<__E;
0
};
const char *help_text[] =
{
__E
for(@in_order)
{
my $t = $help{$_};
$t =~ s/\t/ /g;
$t =~ s/\n/\\n/g;
$t =~ s/"/\\"/g;
print OUT qq:\t"$t",\n:;
}
print OUT <<__E;
0
};
__E
close OUT;
|