tools/fsh-builddocs
changeset 20 75412e452636
parent 17 949c6f5096e4
child 40 06e2064de820
child 50 e81b4e28b3e2
equal deleted inserted replaced
13:eb50996ae8a8 20:75412e452636
     1 #!perl
     1 #!perl
     2 # fsh-builddocs
     2 # fsh-builddocs
     3 # 
     3 #
     4 # Copyright (c) 2010 Accenture. All rights reserved.
     4 # Copyright (c) 2010 Accenture. All rights reserved.
     5 # This component and the accompanying materials are made available
     5 # This component and the accompanying materials are made available
     6 # under the terms of the "Eclipse Public License v1.0"
     6 # under the terms of the "Eclipse Public License v1.0"
     7 # which accompanies this distribution, and is available
     7 # which accompanies this distribution, and is available
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 # 
     9 #
    10 # Initial Contributors:
    10 # Initial Contributors:
    11 # Accenture - Initial contribution
    11 # Accenture - Initial contribution
    12 
    12 
    13 # Description:
    13 # Description:
    14 # fsh-builddocs - A tool that generates HTML documentation from POD source files.
    14 # fsh-builddocs - A tool that generates HTML documentation from POD source files.
    81 	     'w|what' => \$options{what},
    81 	     'w|what' => \$options{what},
    82 	     'c|clean' => \$options{clean},
    82 	     'c|clean' => \$options{clean},
    83 	     'i|include=s' => $options{includes}) or DisplayHelp();
    83 	     'i|include=s' => $options{includes}) or DisplayHelp();
    84   DisplayHelp() if ($help);
    84   DisplayHelp() if ($help);
    85   warn "Invalid arguments\n" and DisplayHelp() unless (@ARGV == 1);
    85   warn "Invalid arguments\n" and DisplayHelp() unless (@ARGV == 1);
       
    86 
       
    87   my $relativeEpocRootPath = fshu::RelativePath($ENV{EPOCROOT}, cwd());
       
    88   $relativeEpocRootPath =~ s/\\/\//g; # '\' -> '/'.
       
    89   foreach my $include (@{$options{includes}}) {
       
    90     if ($include =~ /^epoc32/i) {
       
    91       $include = "${relativeEpocRootPath}$include";
       
    92     }
       
    93   }
       
    94 
    86   return shift @ARGV;
    95   return shift @ARGV;
    87 }
    96 }
    88 
    97 
    89 sub DisplayHelp {
    98 sub DisplayHelp {
    90   require Pod::Text;
    99   require Pod::Text;
   102   print "Running '$command'\n" if ($options{verbose});
   111   print "Running '$command'\n" if ($options{verbose});
   103   open (CPP, $command) or die "Error: Couldn't run 'cpp.exe': $!\n";
   112   open (CPP, $command) or die "Error: Couldn't run 'cpp.exe': $!\n";
   104   my $spec;
   113   my $spec;
   105 
   114 
   106   my $currentDir;
   115   my $currentDir;
   107   my $currentFile;
   116   my $currentFile = $podListFileName;
   108   my $currentLine = 0;
   117   my $currentLine = 0;
   109   while (my $line = <CPP>) {
   118   while (my $line = <CPP>) {
   110     ++$currentLine;
   119     ++$currentLine;
   111     $line =~ s/^\s+//;
   120     $line =~ s/^\s+//;
   112     next if (!$line); # Blank lines.
   121     next if (!$line); # Blank lines.