perl -x "{0}" {"parameters"} ; exit #!/usr/local/bin/perl open(SRC,"<$ARGV[0]") || die; open(HFIL,">$ARGV[0].hdlg") || die; open(SFIL,">$ARGV[0].strn") || die; open(EFIL,"<$ARGV[0].extras") || die; $str=$ARGV[1]; $gran=90; $elem=$gran+1; # # read extras # while () { if (/^#/ || /^\W*$/) {next;} chop; ($cmd,$rest) = split(/\t/,$_,2); if ($cmd eq "DLOG") { ($id) = split(/\t/,$rest); $l = 0; } else { $l++; $Extras{"d$id"."l$l"} = $_; } } $id = 0; while () { if (/^#/ || /^\W*$/) {next;} chop; $l++; ($cmd,$rest) = split(/\t/,$_,2); if ($cmd eq "DLOG") { if ($id != 0) {print HFIL "}};\n";} ($id,$nSkip) = split(/\t/,$rest,2); if ($nSkip eq "") {$nSkip = "0";} print HFIL "resource 'hdlg' ($id,purgeable) { HelpMgrVersion,$nSkip,hmDefaultOptions,0,3,\n"; $notfirst = 0; $l = 0; } else { if ($Extras{"d$id"."l$l"} ne "") { $_ = $Extras{"d$id"."l$l"}; ($cmd,$rest) = split(/\t/,$_,2); } if ($cmd eq "SKIP") { print HFIL "HMSkipItem {},\n"; if ($notfirst == 0) { print HFIL "{\n"; $notfirst = 1; } } else { print HFIL "HMStringResItem {{5,5},{0,0,0,0},\n"; @strings = split('##',$rest); $rep = $strings[0]; for ($i=0;$i<=$#strings;$i++) { if ($strings[$i] eq "") { print HFIL "0,0,\n"; } else { if ($elem>=$gran) { if ($elem==$gran) {print SFIL '}};' . "\n";} $elem = 0; $str += 100; printf SFIL "resource 'STR#' (%d,purgeable) {{\n",$str; } printf HFIL "%d,%d,\n",$str,++$elem; $toprint = $strings[$i]; ($rp,$rest) = split(' ',$toprint,2); if ($rp eq "REPEAT") {$toprint = $rep; if ($rest ne "") {$toprint .= "\\n" . $rest;}} print SFIL "\"$toprint\",\n"; } } for (;$i<4;$i++) { print HFIL "0,0,\n"; } print HFIL "},\n"; if ($notfirst == 0) { print HFIL "{\n"; $notfirst = 1; } } } } if ($elem>0 && $elem<=$gran) {print SFIL '}};' . "\n";} if ($id != 0) {print HFIL "}};\n";}