mkhelp: simplify the generated hugehelp program
Use a plain array and puts() every line, also allows us to provide the strings without ending newlines. - merge blank lines into the next one as a prefixed newline. - turn eight consecutive spaces into a tab (since they can only be on the left side of text) - the newly generated tool_hugehelp is 3K lines shorter and 50K smaller - modifies the top logo layout a little by reducing the indent Closes #13047
This commit is contained in:
parent
f03c85635f
commit
62c08d5d4a
@ -35,11 +35,11 @@ if($ARGV[0] eq "-c") {
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
push @out, " _ _ ____ _\n";
|
||||
push @out, " Project ___| | | | _ \\| |\n";
|
||||
push @out, " / __| | | | |_) | |\n";
|
||||
push @out, " | (__| |_| | _ <| |___\n";
|
||||
push @out, " \\___|\\___/|_| \\_\\_____|\n";
|
||||
push @out, " _ _ ____ _\n";
|
||||
push @out, " ___| | | | _ \\| |\n";
|
||||
push @out, " / __| | | | |_) | |\n";
|
||||
push @out, " | (__| |_| | _ <| |___\n";
|
||||
push @out, " \\___|\\___/|_| \\_\\_____|\n";
|
||||
|
||||
my $olen=0;
|
||||
while (<STDIN>) {
|
||||
@ -157,40 +157,43 @@ exit;
|
||||
}
|
||||
else {
|
||||
print <<HEAD
|
||||
static const char * const m[] = {
|
||||
HEAD
|
||||
;
|
||||
}
|
||||
|
||||
my $blank;
|
||||
for my $n (@out) {
|
||||
chomp $n;
|
||||
$n =~ s/\\/\\\\/g;
|
||||
$n =~ s/\"/\\\"/g;
|
||||
|
||||
if(!$n) {
|
||||
$blank++;
|
||||
}
|
||||
else {
|
||||
$n =~ s/ /\\t/g;
|
||||
printf(" \"%s%s\",\n", $blank?"\\n":"", $n);
|
||||
$blank = 0;
|
||||
}
|
||||
}
|
||||
|
||||
print <<ENDLINE
|
||||
NULL
|
||||
};
|
||||
void hugehelp(void)
|
||||
{
|
||||
fputs(
|
||||
HEAD
|
||||
;
|
||||
int i = 0;
|
||||
while(m[i])
|
||||
puts(m[i++]);
|
||||
}
|
||||
|
||||
$outsize=0;
|
||||
for(@out) {
|
||||
chop;
|
||||
|
||||
$new = $_;
|
||||
|
||||
$outsize += length($new)+1; # one for the newline
|
||||
|
||||
$new =~ s/\\/\\\\/g;
|
||||
$new =~ s/\"/\\\"/g;
|
||||
|
||||
# gcc 2.96 claims ISO C89 only is required to support 509 letter strings
|
||||
if($outsize > 500) {
|
||||
# terminate and make another fputs() call here
|
||||
print ", stdout);\n fputs(\n";
|
||||
$outsize=length($new)+1;
|
||||
}
|
||||
printf("\"%s\\n\"\n", $new);
|
||||
|
||||
}
|
||||
|
||||
print ", stdout) ;\n}\n";
|
||||
ENDLINE
|
||||
;
|
||||
|
||||
foot();
|
||||
|
||||
sub foot {
|
||||
print <<FOOT
|
||||
print <<FOOT
|
||||
#endif /* USE_MANUAL */
|
||||
FOOT
|
||||
;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user