Changeset 209


Ignore:
Timestamp:
Sep 12, 2006, 2:14:10 AM (13 years ago)
Author:
Peter Johansson
Message:

fixes #44 parallel page with code, comment, or empty lines.

Location:
trunk/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r207 r209  
    124124      std::cout << "Printing output for " << path_ << std::endl;
    125125    print("all", "total");
     126    print("all", "code");
     127    print("all", "comments");
     128    print("all", "empty");
    126129
    127130    // print daughter nodes, i.e., this function is recursive
     
    145148    path_anchor(os);
    146149    os << "<p align=center>\n<img src='"
    147        << file_name(stats_.plot(outdir+"/index.png", local_path()))
     150       << file_name(stats_.plot(outdir+"/index.png", local_path(),line_type))
    148151       << "' alt='[plot]' border=0><br>\n";
    149152    os << "<table class=\"listings\">\n";
  • trunk/lib/File.cc

    r207 r209  
    6565    path_anchor(os);
    6666    os << "<p align=center>\n<img src='"
    67        << file_name(stats_.plot(outpath+".png",local_path()))
     67       << file_name(stats_.plot(outpath+".png",local_path(),line_type))
    6868       << "' alt='[plot]' border=0>\n</p>";
    6969
     
    127127      std::cout << "Printing output for " << path_ << std::endl;
    128128    print("all", "total");
     129    print("all", "code");
     130    print("all", "comments");
     131    print("all", "empty");
    129132  }
    130133
  • trunk/lib/Stats.cc

    r208 r209  
    157157
    158158  std::string Stats::plot(const std::string& filename,
    159                           const std::string& title) const
     159                          const std::string& title,
     160                          const std::string& linetype) const
    160161  {
    161162    GnuplotFE* gp=GnuplotFE::instance();
     
    168169    gp->command("set key left Left reverse");
    169170    gp->command("set multiplot");
    170     std::vector<u_int> total=accumulated(total_);   
     171    const Map_* stat=NULL;
     172    if (linetype=="total")
     173      stat = &total_;
     174    else if (linetype=="code")
     175      stat = &code_;
     176    else if (linetype=="comments")
     177      stat = &comments_;
     178    else if (linetype=="empty")
     179      stat = &empty_;
     180    assert(stat);
     181    std::vector<u_int> total=accumulated(*stat);   
    171182    double yrange_max=1.03*total.back()+1;
    172183    gp->yrange(yrange_max);
    173184    size_t plotno=1;
    174185    std::stringstream ss;
    175     for (MapConstIter_ i= total_.begin(); i != total_.end(); ++i) {
     186    for (MapConstIter_ i= stat->begin(); i != stat->end(); ++i) {
    176187      ss.str("");
    177188      ss << "set key height " << 2*plotno;
    178189      gp->command(ss.str());
    179       std::vector<u_int> x=accumulated(total_, i->first);
     190      std::vector<u_int> x=accumulated(*stat, i->first);
    180191      ss.str("");
    181192      ss << x.back() << " " << i->first;
  • trunk/lib/Stats.h

    r202 r209  
    9797    /// Create statistics graph.
    9898    ///
    99     std::string plot(const std::string&, const std::string&) const;
     99    std::string plot(const std::string&, const std::string&,
     100                     const std::string&) const;
    100101
    101102    ///
  • trunk/lib/html_utility.cc

    r207 r209  
    255255       << "<ul><li></li>"
    256256       << "<li>";
    257     anchor(os, "index.html", "Home", level, "Main page");
    258     os << "</li>"
    259        << "<li>";
    260     anchor(os, "all/total/index.html", "Browse", level, "Browser");
     257    anchor(os, "index.html", "Main", level, "Main page");
     258    os << "</li>"
     259       << "<li>";
     260    anchor(os, "all/total/index.html", "Total", level,
     261           "View statistics of all lines");
     262    os << "</li>"
     263       << "<li>";
     264    anchor(os, "all/code/index.html", "Code", level,
     265           "View statistics of code lines");
     266    os << "</li>"
     267       << "<li>";
     268    anchor(os, "all/comments/index.html", "Comment", level,
     269           "View statistics of comment lines");
     270    os << "</li>"
     271       << "<li>";
     272    anchor(os, "all/empty/index.html", "Empty", level,
     273           "View statistics of empty lines");
    261274    os << "</li>"
    262275       << "</ul></div>"
Note: See TracChangeset for help on using the changeset viewer.