1 line
1.5 KiB
Plaintext
Executable File
1 line
1.5 KiB
Plaintext
Executable File
perl -x "{0}" {"parameters"} ; exit
|
|
#!/usr/local/bin/perl
|
|
open(SRC,"<$ARGV[0]") || die;
|
|
open(HFIL,">$ARGV[0].hmnu") || die;
|
|
open(EFIL,"<$ARGV[0].extras") || die;
|
|
$str=$ARGV[1];
|
|
$gran=40;
|
|
$elem=$gran+1;
|
|
|
|
|
|
#
|
|
# read extras
|
|
#
|
|
while (<EFIL>)
|
|
{
|
|
if (/^#/ || /^\W*$/) {next;}
|
|
chop;
|
|
($cmd,$rest) = split(/\t/,$_,2);
|
|
if ($cmd eq "MENU")
|
|
{
|
|
$id = $rest;
|
|
$l = 0;
|
|
}
|
|
else
|
|
{
|
|
$l++;
|
|
$Extras{"d$id"."l$l"} = $_;
|
|
}
|
|
}
|
|
|
|
|
|
$id = 0;
|
|
while (<SRC>)
|
|
{
|
|
if (/^\W*$/) {next;}
|
|
if (/^#/) {print HFIL;next;}
|
|
chop;
|
|
$l++;
|
|
($cmd,$rest) = split(/\t/,$_,2);
|
|
if ($cmd eq "MENU")
|
|
{
|
|
if ($id != 0) {print HFIL "}};\n";}
|
|
$id = $rest;
|
|
print HFIL "resource 'hmnu' ($rest,purgeable) { HelpMgrVersion,0,0,0,\n";
|
|
$notfirst = 0;
|
|
$l = 0;
|
|
}
|
|
elsif ($cmd eq "SKIP")
|
|
{
|
|
print HFIL "HMSkipItem {},\n";
|
|
if ($notfirst == 0)
|
|
{
|
|
print HFIL "{\n";
|
|
$notfirst = 1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ($Extras{"d$id"."l$l"} ne "")
|
|
{
|
|
$_ = $Extras{"d$id"."l$l"};
|
|
($cmd,$rest) = split(/\t/,$_,2);
|
|
}
|
|
print HFIL "HMStringItem {\n";
|
|
@strings = split('##',$rest);
|
|
$rep = $strings[0];
|
|
for ($i=0;$i<=$#strings;$i++)
|
|
{
|
|
$toprint = $strings[$i];
|
|
($rp,$rest) = split(' ',$toprint,2);
|
|
if ($rp eq "REPEAT") {$toprint = $rep; if ($rest ne "") {$toprint .= "\\n" . $rest;}}
|
|
print HFIL qq/"$toprint",\n/;
|
|
}
|
|
for (;$i<4;$i++)
|
|
{
|
|
print HFIL qq/"",\n/;
|
|
}
|
|
print HFIL "},\n";
|
|
if ($notfirst == 0)
|
|
{
|
|
print HFIL "{\n";
|
|
$notfirst = 1;
|
|
}
|
|
}
|
|
}
|
|
if ($id != 0) {print HFIL "}};\n";} |