summaryrefslogtreecommitdiff
path: root/build-aux/pmccabe2html
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/pmccabe2html')
-rw-r--r--[-rwxr-xr-x]build-aux/pmccabe2html161
1 files changed, 80 insertions, 81 deletions
diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
index 27bb8f3..c7cf3d0 100755..100644
--- a/build-aux/pmccabe2html
+++ b/build-aux/pmccabe2html
@@ -1,7 +1,6 @@
-#!/usr/bin/awk -f
-# pmccabe2html - pmccabe to html converter
+# pmccabe2html - AWK script to convert pmccabe output to html -*- awk -*-
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,16 +21,19 @@
# Typical Invocation is from a Makefile.am:
#
-# cyclo-libidn.html:
-# $(PMCCABE) ${top_srcdir}/lib/*.[ch] \
-# | sort -nr \
-# | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \
-# -v lang=html -v name="$(PACKAGE_NAME)" \
-# -v vcurl="http://git.savannah.gnu.org/gitweb/?p=libidn.git;a=blob;f=%FILENAME%;hb=HEAD" \
-# -v url="http://www.gnu.org/software/libidn/" \
-# -v css=../../build-aux/pmccabe.css \
-# > tmp
-# mv tmp $@
+# CYCLO_SOURCES = ${top_srcdir}/src/*.[ch]
+#
+# cyclo-$(PACKAGE).html: $(CYCLO_SOURCES)
+# $(PMCCABE) $(CYCLO_SOURCES) \
+# | sort -nr \
+# | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \
+# -v lang=html -v name="$(PACKAGE_NAME)" \
+# -v vcurl="http://git.savannah.gnu.org/gitweb/?p=$(PACKAGE).git;a=blob;f=%FILENAME%;hb=HEAD" \
+# -v url="http://www.gnu.org/software/$(PACKAGE)/" \
+# -v css=${top_srcdir}/build-aux/pmccabe.css \
+# -v cut_dir=${top_srcdir}/ \
+# > $@-tmp
+# mv $@-tmp $@
#
# The variables available are:
# lang output language, either 'html' or 'wiki'
@@ -56,7 +58,6 @@ BEGIN {
cyclo_simple_max = 10
cyclo_moderate_max = 20
cyclo_high_max = 50
- cut_dir = "/../"
source_file_link_tmpl = vcurl
# HTML options
@@ -65,7 +66,7 @@ BEGIN {
html_prolog = "<a href=\"" url "\">Back to " package_name " Homepage</a><br/><br/>"
}
html_epilog = "<hr color=\"black\" size=\"2\"/> \
-Copyright (c) 2007, 2008 Free Software Foundation Inc."
+Copyright (c) 2007, 2008 Free Software Foundation, Inc."
html_doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \
\"http://www.w3.org/TR/html401/loose.dtd\">"
html_comment = "<!-- Generated by gnulib's pmccabe2html at " systime() " -->"
@@ -113,12 +114,12 @@ function build_stats()
function html_fnc_table_complete (caption)
{
- html_fnc_table(caption, 1, 0, 1, 1, 1, 0, 1)
+ html_fnc_table(caption, 1, 1, 0, 1, 1, 0, 1)
}
function html_fnc_table_abbrev (caption)
{
- html_fnc_table(caption, 1, 0, 1, 0, 1, 0, 0)
+ html_fnc_table(caption, 1, 1, 0, 0, 1, 0, 0)
}
@@ -136,22 +137,22 @@ function html_fnc_table (caption,
{
print "<caption class=\"function_table_caption\">" caption "</caption>"
}
- html_fnc_header(fname_p,
- mcyclo_p,
- cyclo_p,
- num_statements_p,
- num_lines_p,
- first_line_p,
+ html_fnc_header(fname_p,
+ mcyclo_p,
+ cyclo_p,
+ num_statements_p,
+ num_lines_p,
+ first_line_p,
file_p)
- for (nfnc = 1; nfnc < nfuncs; nfnc++)
+ for (nfnc = 1; nfnc <= nfuncs; nfnc++)
{
html_fnc(nfnc,
- fname_p,
- mcyclo_p,
- cyclo_p,
- num_statements_p,
- num_lines_p,
- first_line_p,
+ fname_p,
+ mcyclo_p,
+ cyclo_p,
+ num_statements_p,
+ num_lines_p,
+ first_line_p,
file_p)
}
print "</table>"
@@ -308,7 +309,7 @@ function html_fnc (nfun,
if (mcyclo[nfun] > cyclo_high_max)
{
trclass="function_entry_untestable"
- }
+ }
else if (mcyclo[nfun] > cyclo_moderate_max)
{
trclass="function_entry_high"
@@ -392,7 +393,7 @@ function html_fnc (nfun,
{
print file[nfun]
}
-
+
print "</td>"
@@ -410,7 +411,7 @@ function html_fnc (nfun,
if (num_lines_p) { num_columns++ }
if (first_line_p) { num_columns++ }
if (file_p) { num_columns++ }
-
+
print "<td colspan=\"" num_columns "\" height=\"0\">"
print "<div id=\"" fname "_src\" class=\"function_src\" style=\"position: relative; display: none;\">"
print "<pre class=\"function_src\">"
@@ -420,11 +421,11 @@ function html_fnc (nfun,
sub(/\\</, "&lt;", codeline)
sub(/\\>/, "&gt;", codeline)
sub(/&/, "&amp;", codeline)
-
+
print codeline
}
close(fname nfun "_fn.txt")
- system("rm " fname nfun "_fn.txt")
+ system("rm " "'" fname "'" nfun "_fn.txt")
print "</pre>"
print "</div>"
print "</td>"
@@ -436,52 +437,51 @@ function html_fnc (nfun,
function html_global_stats ()
{
- print "<div class=\"section_title\">Resume</div>"
+ print "<div class=\"section_title\">Summary</div>"
- print "<br/>"
- print "<table class=\"resume_table\">"
+ print "<table class=\"summary_table\">"
# Total number of functions
print "<tr>"
- print "<td class=\"resume_header_entry\">"
+ print "<td class=\"summary_header_entry\">"
print "Total number of functions"
print "</td>"
- print "<td class=\"resume_number_entry\">"
+ print "<td class=\"summary_number_entry\">"
print num_of_functions
print "</td>"
print "</tr>"
# Number of simple functions
print "<tr>"
- print "<td class=\"resume_header_entry\">"
+ print "<td class=\"summary_header_entry\">"
print "Number of low risk functions"
print "</td>"
- print "<td class=\"resume_number_entry\">"
+ print "<td class=\"summary_number_entry\">"
print num_of_simple_functions
print "</td>"
print "</tr>"
# Number of moderate functions
print "<tr>"
- print "<td class=\"resume_header_entry\">"
+ print "<td class=\"summary_header_entry\">"
print "Number of moderate risk functions"
print "</td>"
- print "<td class=\"resume_number_entry\">"
+ print "<td class=\"summary_number_entry\">"
print num_of_moderate_functions
print "</td>"
print "</tr>"
# Number of high functions
print "<tr>"
- print "<td class=\"resume_header_entry\">"
+ print "<td class=\"summary_header_entry\">"
print "Number of high risk functions"
print "</td>"
- print "<td class=\"resume_number_entry\">"
+ print "<td class=\"summary_number_entry\">"
print num_of_high_functions
print "</td>"
print "</tr>"
# Number of untestable functions
print "<tr>"
- print "<td class=\"resume_header_entry\">"
+ print "<td class=\"summary_header_entry\">"
print "Number of untestable functions"
print "</td>"
- print "<td class=\"resume_number_entry\">"
+ print "<td class=\"summary_number_entry\">"
print num_of_untestable_functions
print "</td>"
print "</tr>"
@@ -492,7 +492,6 @@ function html_global_stats ()
function html_function_cyclo ()
{
print "<div class=\"section_title\">Details for all functions</div>"
- print "<p>Used ranges:</p>"
print "<table class=\"ranges_table\">"
print "<tr>"
@@ -518,7 +517,7 @@ function html_function_cyclo ()
print "Simple module, without much risk"
print "</td>"
print "</tr>"
- # Moderate
+ # Moderate
print "<tr>"
print "<td class=\"ranges_entry_moderate\">"
print "&nbsp;"
@@ -561,27 +560,27 @@ function html_function_cyclo ()
function wiki_global_stats ()
{
- print "{| class=\"cyclo_resume_table\""
+ print "{| class=\"cyclo_summary_table\""
# Total number of functions
print "|-"
- print "| class=\"cyclo_resume_header_entry\" | Total number of functions"
- print "| class=\"cyclo_resume_number_entry\" |" num_of_functions
+ print "| class=\"cyclo_summary_header_entry\" | Total number of functions"
+ print "| class=\"cyclo_summary_number_entry\" |" num_of_functions
# Number of simple functions
print "|-"
- print "| class=\"cyclo_resume_header_entry\" | Number of low risk functions"
- print "| class=\"cyclo_resume_number_entry\" |" num_of_simple_functions
+ print "| class=\"cyclo_summary_header_entry\" | Number of low risk functions"
+ print "| class=\"cyclo_summary_number_entry\" |" num_of_simple_functions
# Number of moderate functions
print "|-"
- print "| class=\"cyclo_resume_header_entry\" | Number of moderate risk functions"
- print "| class=\"cyclo_resume_number_entry\" |" num_of_moderate_functions
+ print "| class=\"cyclo_summary_header_entry\" | Number of moderate risk functions"
+ print "| class=\"cyclo_summary_number_entry\" |" num_of_moderate_functions
# Number of high functions
print "|-"
- print "| class=\"cyclo_resume_header_entry\" | Number of high risk functions"
- print "| class=\"cyclo_resume_number_entry\" |" num_of_high_functions
+ print "| class=\"cyclo_summary_header_entry\" | Number of high risk functions"
+ print "| class=\"cyclo_summary_number_entry\" |" num_of_high_functions
# Number of untestable functions
print "|-"
- print "| class=\"cyclo_resume_header_entry\" | Number of untestable functions"
- print "| class=\"cyclo_resume_number_entry\" |" num_of_untestable_functions
+ print "| class=\"cyclo_summary_header_entry\" | Number of untestable functions"
+ print "| class=\"cyclo_summary_number_entry\" |" num_of_untestable_functions
print "|}"
}
@@ -590,7 +589,7 @@ function wiki_function_cyclo ()
print "==Details for all functions=="
print "Used ranges:"
-
+
print "{| class =\"cyclo_ranges_table\""
print "|-"
print "| class=\"cyclo_ranges_header_entry\" | "
@@ -625,7 +624,7 @@ function wiki_function_cyclo ()
function wiki_fnc_table_complete (caption)
{
- wiki_fnc_table(caption, 1, 0, 1, 1, 1, 0, 1)
+ wiki_fnc_table(caption, 1, 1, 0, 1, 1, 0, 1)
}
function wiki_fnc_table_abbrev (caption)
@@ -647,22 +646,22 @@ function wiki_fnc_table (caption,
{
print "|+" caption
}
- wiki_fnc_header(fname_p,
- mcyclo_p,
- cyclo_p,
- num_statements_p,
- num_lines_p,
- first_line_p,
+ wiki_fnc_header(fname_p,
+ mcyclo_p,
+ cyclo_p,
+ num_statements_p,
+ num_lines_p,
+ first_line_p,
file_p)
- for (nfnc = 1; nfnc < nfuncs; nfnc++)
+ for (nfnc = 1; nfnc <= nfuncs; nfnc++)
{
wiki_fnc(nfnc,
- fname_p,
- mcyclo_p,
- cyclo_p,
- num_statements_p,
- num_lines_p,
- first_line_p,
+ fname_p,
+ mcyclo_p,
+ cyclo_p,
+ num_statements_p,
+ num_lines_p,
+ first_line_p,
file_p)
}
print "|}"
@@ -725,7 +724,7 @@ function wiki_fnc (nfnc,
if (mcyclo[nfnc] > cyclo_high_max)
{
trclass="cyclo_function_entry_untestable"
- }
+ }
else if (mcyclo[nfnc] > cyclo_moderate_max)
{
trclass="cyclo_function_entry_high"
@@ -774,7 +773,7 @@ function wiki_fnc (nfnc,
href = source_file_link_tmpl
sub(/%FILENAME%/, file[nfnc], href)
}
-
+
# Source file
print "| class=\"cyclo_function_entry_filename\" |" \
((href != "") ? "[" href " " file[nfnc] "]" : "[" file[nfnc] "]")
@@ -839,7 +838,7 @@ END {
}
# Print prolog
- if ((output_lang == "html") &&
+ if ((output_lang == "html") &&
(html_prolog != ""))
{
print html_prolog
@@ -885,9 +884,9 @@ END {
wiki_function_cyclo()
}
}
-
+
# Print epilog
- if ((output_lang == "html") &&
+ if ((output_lang == "html") &&
(html_epilog != ""))
{
print html_epilog