From d0db96d10fc88ad78e1e913d1b8a67e41f6bb976 Mon Sep 17 00:00:00 2001 From: Luca Padovani Date: Tue, 9 Nov 2004 12:05:09 +0000 Subject: [PATCH] * fix bug detect blank nodes * output of file size --- helm/papers/use_case/stats/Makefile | 11 +++++++++++ helm/papers/use_case/stats/stats.cc | 11 ++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/helm/papers/use_case/stats/Makefile b/helm/papers/use_case/stats/Makefile index fa5f5e2e9..6db5d9469 100644 --- a/helm/papers/use_case/stats/Makefile +++ b/helm/papers/use_case/stats/Makefile @@ -2,3 +2,14 @@ stats: stats.cc g++ -o $@ `pkg-config gdome2-cpp-smart --cflags --libs` $< +stats.xml: + echo "" >stats.xml + find /local/helm/library/coq_contribs/$(CONTRIB) -type f -exec ./stats.sh {} \; >>stats.xml + echo "" >>stats.xml + +stats.html: stats.xml + xsltproc mkhtml.xsl $< >$@ + +stats.txt: stats.html + w3m -dump a.html > a.txt + diff --git a/helm/papers/use_case/stats/stats.cc b/helm/papers/use_case/stats/stats.cc index a7016f0ee..f2b128faf 100644 --- a/helm/papers/use_case/stats/stats.cc +++ b/helm/papers/use_case/stats/stats.cc @@ -22,7 +22,7 @@ bool is_blank(const std::string& s) { for (int i = 0; i < s.length(); i++) - if (!isblank(s[i])) return false; + if (!isspace(s[i])) return false; return true; } @@ -75,7 +75,7 @@ visit(DOM::Node node, int depth) } void -print_results(const std::string& URI) +print_results(const std::string& URI, long size) { int n_depths = 0; int tot_depth = 0; @@ -92,6 +92,7 @@ print_results(const std::string& URI) tot_width += *p; std::cout << "" << std::endl; + std::cout << " " << size << "" << std::endl; std::cout << " " << std::endl; std::cout << " " << max_depth << "" << std::endl; std::cout << " " << tot_depth / ((double) n_depths) << "" << std::endl; @@ -118,13 +119,13 @@ print_results(const std::string& URI) int main(int argc, char* argv[]) { - if (argc != 2) { - std::cerr << "Usage: stats " << std::endl; + if (argc != 3) { + std::cerr << "Usage: stats " << std::endl; return -1; } DOM::DOMImplementation di; DOM::Document doc = di.createDocumentFromURI(argv[1]); visit(doc, 0); - print_results(argv[1]); + print_results(argv[1], atoi(argv[2])); } -- 2.39.2