home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Eudora 1.3.1 / source / Bits / ProcessDlogHelp < prev    next >
Encoding:
Text File  |  1993-03-16  |  1.6 KB  |  73 lines  |  [TEXT/????]

  1. perl -x "{0}" {"parameters"} ; exit
  2. #!/usr/local/bin/perl
  3. open(SRC,"<" . $ARGV[0]) || die;
  4. open(HFIL,">" . $ARGV[1]) || die;
  5. open(SFIL,">" . $ARGV[2]) || die;
  6. $str=$ARGV[3];
  7. $gran=40;
  8. $elem=$gran+1;
  9.  
  10. while (<SRC>)
  11. {
  12.   if (/^#/ || /^\W*$/) {next;}
  13.   chop;
  14.   ($cmd,$rest) = split(/\t/,$_,2);
  15.   if ($cmd eq "DLOG")
  16.   {
  17.     if ($id != 0) {print HFIL "}};\n";}
  18.     ($id,$nSkip) = split(/\t/,$rest,2);
  19.     if ($nSkip eq "") {$nSkip = "0";}
  20.     print HFIL "resource 'hdlg' ($id,purgeable) { HelpMgrVersion,$nSkip,hmDefaultOptions,0,3,\n";
  21.     $notfirst = 0;
  22.   }
  23.   elsif ($cmd eq "SKIP")
  24.   {
  25.     print HFIL "HMSkipItem {},\n";
  26.     if ($notfirst == 0)
  27.     {
  28.       print HFIL "{\n";
  29.       $notfirst = 1;
  30.     }
  31.   }
  32.   else
  33.   {
  34.     print HFIL "HMStringResItem {{5,5},{0,0,0,0},\n";
  35.     @strings = split('##',$rest);
  36.     $rep = $strings[0];
  37.     for ($i=0;$i<=$#strings;$i++)
  38.     {
  39.       if ($strings[$i] eq "")
  40.       {
  41.         print HFIL "0,0,\n";
  42.       }
  43.       else
  44.       {
  45.     if ($elem>=$gran)
  46.     {
  47.       if ($elem==$gran) {print SFIL '}};' . "\n";}
  48.       $elem = 0;
  49.       $str += 200;
  50.       printf SFIL "resource 'STR#' (%d,purgeable) {{\n",$str;
  51.     }
  52.     printf HFIL "%d,%d,\n",$str,++$elem;
  53.     $toprint = $strings[$i];
  54.     ($rp,$rest) = split(' ',$toprint,2);
  55.     if ($rp eq "REPEAT") {$toprint = $rep . "\\n" . $rest;}
  56.     print SFIL "\"$toprint\",\n";
  57.       }
  58.     }
  59.     for (;$i<4;$i++)
  60.     {
  61.       print HFIL "0,0,\n";
  62.     }
  63.     print HFIL "},\n";
  64.     if ($notfirst == 0)
  65.     {
  66.       print HFIL "{\n";
  67.       $notfirst = 1;
  68.     }
  69.   }
  70. }
  71.  
  72. if ($elem>0 && $elem<=$gran) {print SFIL '}};' . "\n";}
  73. if ($id != 0) {print HFIL "}};\n";}