Diff for /loncom/build/lpml_parse.pl between versions 1.28 and 1.29

version 1.28, 2001/12/06 23:14:33 version 1.29, 2001/12/07 04:45:16
Line 225  $cleanstring=~s/\>\s*\n\s*\</\>\</g; Line 225  $cleanstring=~s/\>\s*\n\s*\</\>\</g;
 # storage variables  # storage variables
 my $lpml;  my $lpml;
 my $categories;  my $categories;
   my @categorynamelist;
 my $category;  my $category;
 my $category_att_name;  my $category_att_name;
 my $category_att_type;  my $category_att_type;
Line 272  my @links; Line 273  my @links;
 my %categoryhash;  my %categoryhash;
 my $dpathlength;  my $dpathlength;
 my %fab; # file category abbreviation  my %fab; # file category abbreviation
   my $directory_count;
   my $file_count;
   my $link_count;
   my $fileglob_count;
   my $fileglobnames_count;
   my %categorycount;
   # START TEMP WAY
   #my %bytecount;  # TEMP WAY TO COUNT INFORMATION
   #my %linecount;  # TEMP WAY TO COUNT INFORMATION
   # END TEMP WAY
   
 my @buildall;  my @buildall;
 my @buildinfo;  my @buildinfo;
Line 354  exit; Line 365  exit;
 # ------------------------ Final output at end of markup parsing and formatting  # ------------------------ Final output at end of markup parsing and formatting
 sub end {  sub end {
     if ($mode eq 'html') {      if ($mode eq 'html') {
  return "</body></html>\n";   # START TEMP WAY
   # my $totallinecount;
   # my $totalbytecount;
   # map {$totallinecount+=$linecount{$_};
   #     $totalbytecount+=$bytecount{$_}}
   #  @categorynamelist;
           # END TEMP WAY
    return "<br />&nbsp;<br />".
       "<a name='summary' /><font size='+2'>Summary of Source Repository".
       "</font>".
       "<br />&nbsp;<br />".
       "<table border='1' cellpadding='5'>".
       "<caption>Files, Directories, and Symbolic Links</caption>".
       "<tr><td>Files (not referenced by globs)</td><td>$file_count</td>".
       "</tr>".
       "<tr><td>Files (referenced by globs)</td>".
       "<td>$fileglobnames_count</td>".
       "</tr>".
       "<tr><td>Total Files</td>".
       "<td>".($fileglobnames_count+$file_count)."</td>".
       "</tr>".
       "<tr><td>File globs</td>".
       "<td>".$fileglob_count."</td>".
       "</tr>".
       "<tr><td>Directories</td>".
       "<td>".$directory_count."</td>".
       "</tr>".
       "<tr><td>Symbolic links</td>".
       "<td>".$link_count."</td>".
       "</tr>".
       "</table>".
       "<table border='1' cellpadding='5'>".
       "<caption>File Category Count</caption>".
       "<tr><th>Icon</th><th>Name</th><th>Number of Occurrences</th>".
       join("\n",(map {"<tr><td><img src='$fab{$_}.gif' ".
    "alt='$_ icon' /></td>".
             "<td>$_</td><td>$categorycount{$_}</td></tr>"}
    @categorynamelist)).
       "</table>".
       "</body></html>\n";
   
   # START TEMP WAY
   #    join("\n",(map {"<tr><td><img src='$fab{$_}.gif' ".
   # "alt='$_ icon' /></td>".
   #         "<td>$_</td><td>$categorycount{$_}</td><td>$linecount{$_}</td><td>$bytecount{$_}</td></tr>"}
   # @categorynamelist)).
   #    "<br />&nbsp;<br />".
   #    "Total Lines of Code: $totallinecount".
   #    "<br />&nbsp;<br />".
   #    "Total Bytes: $totalbytecount".
   # END TEMP WAY
     }      }
     if ($mode eq 'install') {      if ($mode eq 'install') {
  return '';   return '';
Line 392  Descriptions</a></li> Line 453  Descriptions</a></li>
 <li><a href='#package'>Software Package Description</a></li>  <li><a href='#package'>Software Package Description</a></li>
 <li><a href='#directories'>Directory Structure</a></li>  <li><a href='#directories'>Directory Structure</a></li>
 <li><a href='#files'>Files</a></li>  <li><a href='#files'>Files</a></li>
   <li><a href='#summary'>Summary of Source Repository</a></li>
 </ul>  </ul>
 END  END
         $lpml .=<<END;          $lpml .=<<END;
Line 525  sub format_category { Line 587  sub format_category {
     $fab{$category_att_name}=$abbreviation;      $fab{$category_att_name}=$abbreviation;
     if ($mode eq 'html') {      if ($mode eq 'html') {
  if ($category_att_type eq $categorytype) {   if ($category_att_type eq $categorytype) {
       push @categorynamelist,$category_att_name;
     $categoryhash{$category_att_name}="$chmod $chown";      $categoryhash{$category_att_name}="$chmod $chown";
     return $category="<tr>".      return $category="<tr>".
  "<td><img src='$abbreviation.gif' ".   "<td><img src='$abbreviation.gif' ".
Line 812  sub format_directory { Line 875  sub format_directory {
     $targetdir='';$categoryname='';$description='';      $targetdir='';$categoryname='';$description='';
     $parser->get_text('/directory');      $parser->get_text('/directory');
     $parser->get_tag('/directory');      $parser->get_tag('/directory');
       $directory_count++;
       $categorycount{$categoryname}++;
     if ($mode eq 'html') {      if ($mode eq 'html') {
  my @a;   my @a;
  @a=($targetdir=~/\//g);   @a=($targetdir=~/\//g);
Line 822  sub format_directory { Line 887  sub format_directory {
  my ($chmod,$chown)=split(/\s/,$categoryhash{$categoryname});   my ($chmod,$chown)=split(/\s/,$categoryhash{$categoryname});
  return $directory="\n<tr><td rowspan='2' bgcolor='#ffffff'>".   return $directory="\n<tr><td rowspan='2' bgcolor='#ffffff'>".
     "$categoryname</td>".      "$categoryname</td>".
     "<td rowspan='2' bgcolor='#ffffff'><!-- POSTEVAL2 verify.pl directory /$targetdir $categoryhash{$categoryname} -->&nbsp;</td>".      "<td rowspan='2' bgcolor='#ffffff'><!-- POSTEVAL verify.pl directory /$targetdir $categoryhash{$categoryname} -->&nbsp;</td>".
     "<td rowspan='2' bgcolor='#ffffff'>$chmod<br />$chown</td>".      "<td rowspan='2' bgcolor='#ffffff'>$chmod<br />$chown</td>".
     "<td bgcolor='#ffffff'>$thtml</td></tr>".      "<td bgcolor='#ffffff'>$thtml</td></tr>".
     "<tr><td bgcolor='#ffffff' colspan='[{{{{{DPATHLENGTH}}}}}]'>".      "<tr><td bgcolor='#ffffff' colspan='[{{{{{DPATHLENGTH}}}}}]'>".
Line 982  sub format_file { Line 1047  sub format_file {
     $note=''; $build=''; $status=''; $dependencies='';      $note=''; $build=''; $status=''; $dependencies='';
     my $text=&trim($parser->get_text('/file'));      my $text=&trim($parser->get_text('/file'));
     my $buildtest;      my $buildtest;
       $file_count++;
       $categorycount{$categoryname}++;
       # START TEMP WAY
   #    if (-T "$sourcerootarg/$source") {
   # $linecount{$categoryname}+=`wc -l $sourcerootarg/$source`;
   #    }
   #    my $bytesize=(-s "$sourcerootarg/$source");
   #    $bytecount{$categoryname}+=$bytesize;
       # END TEMP WAY
     if ($source) {      if ($source) {
  $parser->get_tag('/file');   $parser->get_tag('/file');
  if ($mode eq 'html') {   if ($mode eq 'html') {
     return ($file="\n<!-- FILESORT:$target -->".      return ($file="\n<!-- FILESORT:$target -->".
     "<tr>".      "<tr>".
     "<td><!-- POSTEVAL2 verify.pl file '$sourcerootarg' ".      "<td><!-- POSTEVAL verify.pl file '$sourcerootarg' ".
     "'$targetrootarg' ".      "'$targetrootarg' ".
     "'$source' '$target' ".      "'$source' '$target' ".
     "$categoryhash{$categoryname} -->&nbsp;</td><td>".      "$categoryhash{$categoryname} -->&nbsp;</td><td>".
Line 1108  sub format_link { Line 1182  sub format_link {
     $link=''; $linkto=''; $source=''; $target=''; $categoryname='';       $link=''; $linkto=''; $source=''; $target=''; $categoryname=''; 
     $description=''; $note=''; $build=''; $status=''; $dependencies='';      $description=''; $note=''; $build=''; $status=''; $dependencies='';
     my $text=&trim($parser->get_text('/link'));      my $text=&trim($parser->get_text('/link'));
       my @links;
     if ($linkto) {      if ($linkto) {
  $parser->get_tag('/link');   $parser->get_tag('/link');
  if ($mode eq 'html') {   if ($mode eq 'html') {
     my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target);      my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target);
       $link_count+=scalar(@targets);
     foreach my $tgt (@targets) {      foreach my $tgt (@targets) {
    $categorycount{$categoryname}++;
  push @links,("\n<!-- FILESORT:$tgt -->".   push @links,("\n<!-- FILESORT:$tgt -->".
     "<tr>".      "<tr>".
     "<td><!-- POSTEVAL2 verify.pl link ".      "<td><!-- POSTEVAL verify.pl link ".
     "'/$targetrootarg$linkto' '/$targetrootarg$tgt' ".      "'/$targetrootarg$linkto' '/$targetrootarg$tgt' ".
     "$categoryhash{$categoryname} -->&nbsp;</td><td>".      "$categoryhash{$categoryname} -->&nbsp;</td><td>".
     "<img src='$fab{$categoryname}.gif' ".      "<img src='$fab{$categoryname}.gif' ".
Line 1166  sub format_fileglob { Line 1243  sub format_fileglob {
     $filenames='';      $filenames='';
     my $text=&trim($parser->get_text('/fileglob'));      my $text=&trim($parser->get_text('/fileglob'));
     my $filenames2=$filenames;$filenames2=~s/\s//g;      my $filenames2=$filenames;$filenames2=~s/\s//g;
       $fileglob_count++;
       my @semi=($filenames2=~/(\;)/g);
       $fileglobnames_count+=scalar(@semi)+1;
       $categorycount{$categoryname}+=scalar(@semi)+1;
       # START TEMP WAY
   #    for my $f (split(/\;/,$filenames2)) {
   # if (-T "$sourcerootarg/$sourcedir/$f") {
   #    $linecount{$categoryname}+=`wc -l $sourcerootarg/$sourcedir/$f`;
   #    open OUT,">>/tmp/junk123";
   #    print OUT "$linecount{$categoryname} $categoryname $sourcerootarg/$sourcedir/$f\n";
   #    close OUT;
   # }
   # my $bytesize=(-s "$sourcerootarg/$sourcedir/$f");
   # $bytecount{$categoryname}+=$bytesize;
   #    }
       # END TEMP WAY
     if ($sourcedir) {      if ($sourcedir) {
  $parser->get_tag('/fileglob');   $parser->get_tag('/fileglob');
  if ($mode eq 'html') {   if ($mode eq 'html') {
     return $fileglob="\n<tr>".      return $fileglob="\n<tr>".
  "<td><!-- POSTEVAL2 verify.pl fileglob '$sourcerootarg' ".   "<td><!-- POSTEVAL verify.pl fileglob '$sourcerootarg' ".
  "'$targetrootarg' ".   "'$targetrootarg' ".
  "'$glob' '$sourcedir' '$filenames2' '$targetdir' ".   "'$glob' '$sourcedir' '$filenames2' '$targetdir' ".
  "$categoryhash{$categoryname} -->&nbsp;</td>".   "$categoryhash{$categoryname} -->&nbsp;</td>".

Removed from v.1.28  
changed lines
  Added in v.1.29


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>