152{
153 int have_LIBRARY=0;
154 int have_AUTHORS=0;
155 int have_PROCEDURES=0;
156 int have_SEEALSO=0;
157 int have_KEYWORDS=0;
158 int have_OVERVIEW=0;
159 int have_NOTE=0;
160 int have_other=0;
161 int texinfo=0;
163
165 {
166 if (strstr(
buf,
"LIBRARY: ")!=
NULL)
167 {
168 have_LIBRARY++;
169
170 if (have_other+have_AUTHORS+have_PROCEDURES+have_KEYWORDS+have_SEEALSO!=0)
171 printf("error: LIBRARY: must be the first section in info\n");
172 }
173 else if (strstr(
buf,
"NOTE:")!=
NULL)
174 {
175 if (have_PROCEDURES!=0)
176 printf("error: only KEYWORDS/SEE ALSO may follow PROCEDURES\n");
177 have_NOTE++;
178 }
179 else if (strstr(
buf,
"OVERVIEW:")!=
NULL)
180 {
181 have_OVERVIEW++;
182 if (have_PROCEDURES!=0)
183 printf("error: only KEYWORDS/SEE ALSO may follow PROCEDURES\n");
184 }
185 else if (strstr(
buf,
"KEYWORDS: ")!=
NULL)
186 {
187 have_KEYWORDS++;
188 }
189 else if (strstr(
buf,
"SEE ALSO: ")!=
NULL)
190 {
191 have_SEEALSO++;
192 }
193 else if ((strstr(
buf,
"AUTHORS: ")!=
NULL)
194 ||(strstr(
buf,
"AUTHOR: ")!=
NULL))
195 {
196 have_AUTHORS++;
197 if (have_PROCEDURES!=0)
198 printf("error: only KEYWORDS/SEE ALSO may follow PROCEDURES\n");
199 }
200 else if ((
p=strstr(
buf,
"PROCEDURES"))!=
NULL)
201 {
202 unsigned char *
pp=
buf;
204 {
205 if ((*
pp!=
' ')&&(*
pp!=
'\t'))
break;
207 }
209 {
210 have_PROCEDURES++;
212 continue;
213 }
214 else
215 {
216 printf(
"error: unknown section in library header: %s",
buf);
217 have_other++;
218 }
219 }
221 {
222 int ch;
223 unsigned char *
pp=
buf;
224 while((*
pp==
' ')||(*
pp==
'\t'))
pp++;
225 ch=strspn(
pp,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
226 if ((ch>1)||(
pp+ch==
p))
227 {
228
229 if ((ch!=10)||(strncmp(
pp,
"REFERENCES",10)!=0))
230 {
231 printf(
"error: unknown section in library header: %s",
buf);
232 have_other++;
233 }
234 if (have_PROCEDURES!=0)
235 printf("error: only KEYWORDS/SEE ALSO may follow PROCEDURES\n");
236 }
237 }
238 else if (strncmp(
buf,
"\";",2)==0)
goto e_o_info;
239 else
240 {
243 { texinfo++; printf(
"%s",
buf); }
244 }
246 }
247 e_o_info:
248 printf("\nSUMMARY OF THE HEADER:\n");
249 if (have_LIBRARY!=1)
250 printf("error: missing/duplicate LIBRARY (%d lines found, should be 1)\n",have_LIBRARY);
251 if (have_AUTHORS!=1)
252 printf("error: missing/duplicate AUTHOR/AUTHORS (%d lines found, should be 1)\n",have_AUTHORS);
253 if (have_PROCEDURES!=1)
254 printf("error: missing/duplicate PROCEDURES (%d lines found, should be 1)\n",have_PROCEDURES);
255 if (have_SEEALSO>1)
256 printf("error: duplicate SEE ALSO (%d lines found)\n",have_SEEALSO);
257 if (have_KEYWORDS>1)
258 printf("error: duplicate KEYWORDS (%d lines found)\n",have_KEYWORDS);
259 if (have_NOTE==1)
260 printf("hint: avoid NOTE: if not used for a library requirement\n");
261 else if (have_NOTE>1)
262 printf("error: duplicate NOTE (%d lines found)\n",have_NOTE);
263 if ((have_OVERVIEW==1)&&(
proc_cnt<3))
264 printf("hint: avoid OVERVIEW: for small libraries\n");
265 else if (have_OVERVIEW>1)
266 printf("error: duplicate OVERVIEW (%d lines found)\n",have_OVERVIEW);
267
268 if (have_other!=0)
269 printf("error: other header entries found (illegal ?) :%d lines found, should be 0\n",have_other);
271 {
272 printf(
"warning: %d forced line breaks in %d header lines: @* should be used very rarely!\n",
star_nl,
header);
273 }
274 if (texinfo>0)
275 {
276 printf(
"warning: %d texinfo commands in %d header lines: should be used very rarely!\n",texinfo,
header);
277 }
278}