1 | #! /bin/sh |
---|
2 | # |
---|
3 | # Generate the summary chapter |
---|
4 | # |
---|
5 | # $Id$ |
---|
6 | # |
---|
7 | |
---|
8 | echo "@c" |
---|
9 | echo "@c DO NOT EDIT -- AUTOMATICALLY GENERATED!!!" |
---|
10 | echo "@c" |
---|
11 | echo |
---|
12 | echo "@chapter Compliance Summary" |
---|
13 | echo |
---|
14 | |
---|
15 | wc2() |
---|
16 | { |
---|
17 | pattern=$1 |
---|
18 | shift |
---|
19 | grep "${pattern}" $* | wc -l |
---|
20 | } |
---|
21 | |
---|
22 | wc3() |
---|
23 | { |
---|
24 | pattern=$1 |
---|
25 | filter=$2 |
---|
26 | shift ; shift |
---|
27 | grep "${pattern}" $* | grep "${filter}" | wc -l |
---|
28 | } |
---|
29 | |
---|
30 | # adds the numbers passed on the command line |
---|
31 | addit() |
---|
32 | { |
---|
33 | sumx=0 |
---|
34 | for x in $* |
---|
35 | do |
---|
36 | sumx=`expr $sumx + $x` |
---|
37 | done |
---|
38 | echo $sumx |
---|
39 | } |
---|
40 | |
---|
41 | summarize_chapter() |
---|
42 | { |
---|
43 | echo |
---|
44 | # takes at least 3.0 inches for each generated section |
---|
45 | echo "@need 3000" |
---|
46 | if [ $# -eq 1 ] ; then |
---|
47 | grep "^@chapter" $1 | \ |
---|
48 | sed -e "s/^.chapter/@section/" \ |
---|
49 | -e "s/$/ Chapter/" |
---|
50 | else |
---|
51 | echo "@section Overall Summary" |
---|
52 | fi |
---|
53 | |
---|
54 | echo |
---|
55 | |
---|
56 | functions_total=`wc2 "()" $*` |
---|
57 | functions_implemented=` wc3 "()" "Implemented" $*` |
---|
58 | functions_unimplemented=` wc3 "()" "Unimplemented" $*` |
---|
59 | functions_unmplementable=`wc3 "()" "Unimplementable" $*` |
---|
60 | functions_partial=` wc3 "()" "Partial Implementation" $*` |
---|
61 | functions_dummy=` wc3 "()" "Dummy Implementation" $*` |
---|
62 | functions_untested=` wc3 "()" "Untested Implementation" $*` |
---|
63 | |
---|
64 | functions_sum=`addit ${functions_implemented} \ |
---|
65 | ${functions_unimplemented} ${functions_unmplementable} \ |
---|
66 | ${functions_partial} ${functions_dummy} \ |
---|
67 | ${functions_untested}` |
---|
68 | |
---|
69 | datatypes_total=`wc2 "Type," $*` |
---|
70 | datatypes_implemented=` wc3 "Type," "Implemented" $*` |
---|
71 | datatypes_unimplemented=` wc3 "Type," "Unimplemented" $*` |
---|
72 | datatypes_unmplementable=`wc3 "Type," "Unimplementable" $*` |
---|
73 | datatypes_partial=` wc3 "Type," "Partial Implementation" $*` |
---|
74 | datatypes_dummy=` wc3 "Type," "Dummy Implementation" $*` |
---|
75 | datatypes_untested=` wc3 "Type," "Untested Implementation" $*` |
---|
76 | |
---|
77 | datatypes_sum=`addit ${datatypes_implemented} \ |
---|
78 | ${datatypes_unimplemented} ${datatypes_unmplementable} \ |
---|
79 | ${datatypes_partial} ${datatypes_dummy} \ |
---|
80 | ${datatypes_untested}` |
---|
81 | |
---|
82 | echo "@example" |
---|
83 | echo "Functions:" |
---|
84 | echo " Total Number : ${functions_total}" |
---|
85 | echo " Implemented : ${functions_implemented}" |
---|
86 | echo " Unimplemented : ${functions_unimplemented}" |
---|
87 | echo " Unimplementable : ${functions_unmplementable}" |
---|
88 | echo " Partial : ${functions_partial}" |
---|
89 | echo " Dummy : ${functions_dummy}" |
---|
90 | echo " Untested : ${functions_untested}" |
---|
91 | echo "@end example" |
---|
92 | echo |
---|
93 | if [ ${functions_sum} -ne ${functions_total} ] ; then |
---|
94 | echo "@sp" |
---|
95 | echo "@center{@b{FUNCTION COUNTS DO NOT ADD UP!!}}" |
---|
96 | echo "@sp" |
---|
97 | fi |
---|
98 | |
---|
99 | echo "@example" |
---|
100 | echo "Data Types:" |
---|
101 | echo " Total Number : ${datatypes_total}" |
---|
102 | echo " Implemented : ${datatypes_implemented}" |
---|
103 | echo " Unimplemented : ${datatypes_unimplemented}" |
---|
104 | echo " Unimplementable : ${datatypes_unmplementable}" |
---|
105 | echo " Partial : ${datatypes_partial}" |
---|
106 | echo " Dummy : ${datatypes_dummy}" |
---|
107 | echo " Untested : ${datatypes_untested}" |
---|
108 | echo "@end example" |
---|
109 | echo |
---|
110 | if [ ${datatypes_sum} -ne ${datatypes_total} ] ; then |
---|
111 | echo "@sp" |
---|
112 | echo "@center{@b{DATA TYPE COUNTS DO NOT ADD UP!!}}" |
---|
113 | echo "@sp" |
---|
114 | fi |
---|
115 | } |
---|
116 | |
---|
117 | chapters="ch01.t ch02.t ch03.t ch04.t ch05.t ch06.t ch07.t ch08.t \ |
---|
118 | ch09.t ch10.t ch11.t ch12.t ch13.t ch14.t ch15.t ch16.t ch17.t ch18.t" |
---|
119 | |
---|
120 | # go through the chapters one at a time |
---|
121 | for chapter in ${chapters} |
---|
122 | do |
---|
123 | summarize_chapter $chapter |
---|
124 | done |
---|
125 | |
---|
126 | # now generate the overall summary |
---|
127 | summarize_chapter ${chapters} |
---|
128 | |
---|
129 | |
---|
130 | |
---|