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 | if [ $# -eq 1 ] ; then |
---|
45 | grep "^@chapter" $1 | \ |
---|
46 | sed -e "s/^.chapter/@section/" \ |
---|
47 | -e "s/$/ Chapter/" |
---|
48 | else |
---|
49 | echo "@section Overall Summary" |
---|
50 | fi |
---|
51 | |
---|
52 | echo |
---|
53 | |
---|
54 | # functions |
---|
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 | # data types |
---|
70 | |
---|
71 | datatypes_total=`wc2 "Type," $*` |
---|
72 | datatypes_implemented=` wc3 "Type," "Implemented" $*` |
---|
73 | datatypes_unimplemented=` wc3 "Type," "Unimplemented" $*` |
---|
74 | datatypes_unmplementable=`wc3 "Type," "Unimplementable" $*` |
---|
75 | datatypes_partial=` wc3 "Type," "Partial Implementation" $*` |
---|
76 | datatypes_dummy=` wc3 "Type," "Dummy Implementation" $*` |
---|
77 | datatypes_untested=` wc3 "Type," "Untested Implementation" $*` |
---|
78 | |
---|
79 | datatypes_sum=`addit ${datatypes_implemented} \ |
---|
80 | ${datatypes_unimplemented} ${datatypes_unmplementable} \ |
---|
81 | ${datatypes_partial} ${datatypes_dummy} \ |
---|
82 | ${datatypes_untested}` |
---|
83 | |
---|
84 | # feature flags |
---|
85 | |
---|
86 | features_total=`wc2 "Feature Flag," $*` |
---|
87 | features_implemented=` wc3 "Feature Flag," "Implemented" $*` |
---|
88 | features_unimplemented=` wc3 "Feature Flag," "Unimplemented" $*` |
---|
89 | features_unmplementable=`wc3 "Feature Flag," "Unimplementable" $*` |
---|
90 | features_partial=` wc3 "Feature Flag," "Partial Implementation" $*` |
---|
91 | features_dummy=` wc3 "Feature Flag," "Dummy Implementation" $*` |
---|
92 | features_untested=` wc3 "Feature Flag," "Untested Implementation" $*` |
---|
93 | |
---|
94 | features_sum=`addit ${features_implemented} \ |
---|
95 | ${features_unimplemented} ${features_unmplementable} \ |
---|
96 | ${features_partial} ${features_dummy} \ |
---|
97 | ${features_untested}` |
---|
98 | |
---|
99 | # constants |
---|
100 | |
---|
101 | constants_total=`wc2 "Constant," $*` |
---|
102 | constants_implemented=` wc3 "Constant," "Implemented" $*` |
---|
103 | constants_unimplemented=` wc3 "Constant," "Unimplemented" $*` |
---|
104 | constants_unmplementable=`wc3 "Constant," "Unimplementable" $*` |
---|
105 | constants_partial=` wc3 "Constant," "Partial Implementation" $*` |
---|
106 | constants_dummy=` wc3 "Constant," "Dummy Implementation" $*` |
---|
107 | constants_untested=` wc3 "Constant," "Untested Implementation" $*` |
---|
108 | |
---|
109 | constants_sum=`addit ${constants_implemented} \ |
---|
110 | ${constants_unimplemented} ${constants_unmplementable} \ |
---|
111 | ${constants_partial} ${constants_dummy} \ |
---|
112 | ${constants_untested}` |
---|
113 | |
---|
114 | # Now print the reports |
---|
115 | |
---|
116 | echo "@example" |
---|
117 | echo "Functions:" |
---|
118 | echo " Total Number : ${functions_total}" |
---|
119 | echo " Implemented : ${functions_implemented}" |
---|
120 | echo " Unimplemented : ${functions_unimplemented}" |
---|
121 | echo " Unimplementable : ${functions_unmplementable}" |
---|
122 | echo " Partial : ${functions_partial}" |
---|
123 | echo " Dummy : ${functions_dummy}" |
---|
124 | echo " Untested : ${functions_untested}" |
---|
125 | echo "@end example" |
---|
126 | echo |
---|
127 | if [ ${functions_sum} -ne ${functions_total} ] ; then |
---|
128 | echo "@sp 1" |
---|
129 | echo "@center @b{FUNCTION COUNTS DO NOT ADD UP!!}" |
---|
130 | echo "@sp 1" |
---|
131 | fi |
---|
132 | |
---|
133 | echo "@example" |
---|
134 | echo "Data Types:" |
---|
135 | echo " Total Number : ${datatypes_total}" |
---|
136 | echo " Implemented : ${datatypes_implemented}" |
---|
137 | echo " Unimplemented : ${datatypes_unimplemented}" |
---|
138 | echo " Unimplementable : ${datatypes_unmplementable}" |
---|
139 | echo " Partial : ${datatypes_partial}" |
---|
140 | echo " Dummy : ${datatypes_dummy}" |
---|
141 | echo " Untested : ${datatypes_untested}" |
---|
142 | echo "@end example" |
---|
143 | echo |
---|
144 | if [ ${datatypes_sum} -ne ${datatypes_total} ] ; then |
---|
145 | echo "@sp 1" |
---|
146 | echo "@center @b{DATA TYPE COUNTS DO NOT ADD UP!!}" |
---|
147 | echo "@sp 1" |
---|
148 | fi |
---|
149 | |
---|
150 | echo "@example" |
---|
151 | echo "Feature Flags:" |
---|
152 | echo " Total Number : ${features_total}" |
---|
153 | echo " Implemented : ${features_implemented}" |
---|
154 | echo " Unimplemented : ${features_unimplemented}" |
---|
155 | echo " Unimplementable : ${features_unmplementable}" |
---|
156 | echo " Partial : ${features_partial}" |
---|
157 | echo " Dummy : ${features_dummy}" |
---|
158 | echo " Untested : ${features_untested}" |
---|
159 | echo "@end example" |
---|
160 | echo |
---|
161 | if [ ${features_sum} -ne ${features_total} ] ; then |
---|
162 | echo "@sp 1" |
---|
163 | echo "@center @b{FEATURE FLAG COUNTS DO NOT ADD UP!!}" |
---|
164 | echo "@sp 1" |
---|
165 | fi |
---|
166 | |
---|
167 | echo "@example" |
---|
168 | echo "Constants:" |
---|
169 | echo " Total Number : ${constants_total}" |
---|
170 | echo " Implemented : ${constants_implemented}" |
---|
171 | echo " Unimplemented : ${constants_unimplemented}" |
---|
172 | echo " Unimplementable : ${constants_unmplementable}" |
---|
173 | echo " Partial : ${constants_partial}" |
---|
174 | echo " Dummy : ${constants_dummy}" |
---|
175 | echo " Untested : ${constants_untested}" |
---|
176 | echo "@end example" |
---|
177 | echo |
---|
178 | if [ ${constants_sum} -ne ${constants_total} ] ; then |
---|
179 | echo "@sp 1" |
---|
180 | echo "@center @b{CONSTANT COUNTS DO NOT ADD UP!!}" |
---|
181 | echo "@sp 1" |
---|
182 | fi |
---|
183 | } |
---|
184 | |
---|
185 | chapters="ch01.t ch02.t ch03.t ch04.t ch05.t ch06.t ch07.t ch08.t \ |
---|
186 | ch09.t ch10.t ch11.t ch12.t ch13.t ch14.t ch15.t ch16.t ch17.t ch18.t" |
---|
187 | |
---|
188 | # go through the chapters one at a time |
---|
189 | for chapter in ${chapters} |
---|
190 | do |
---|
191 | summarize_chapter $chapter |
---|
192 | echo "@page" |
---|
193 | done |
---|
194 | |
---|
195 | # now generate the overall summary |
---|
196 | summarize_chapter ${chapters} |
---|
197 | |
---|
198 | |
---|
199 | |
---|