History

kernel-doc: new P directive for DOC: sections

The !P directive includes the contents of a DOC: section given by title, e.g. !Pfilename Title of the section

Johannes Berg committed 19 years ago

Commit e662af41 parent 2e959721 file · +39 −1Browse files

Showing the changes to scripts/basic (1 of 1 file). Show all

Unified · Split

scripts/basic/docproc.c+39−1
@@ -30,6 +30,7 @@ · 29 unmodified lines
30 * !Ifilename30 * !Ifilename
31 * !Dfilename31 * !Dfilename
32 * !Ffilename32 * !Ffilename
33 * !Pfilename
33 *34 *
34 */35 */
35 36
@@ -57,6 +58,7 @@ FILEONLY *symbolsonly; · 21 unmodified lines
57typedef void FILELINE(char * file, char * line);58typedef void FILELINE(char * file, char * line);
58FILELINE * singlefunctions;59FILELINE * singlefunctions;
59FILELINE * entity_system;60FILELINE * entity_system;
61FILELINE * docsection;
60 62
61#define MAXLINESZ 204863#define MAXLINESZ 2048
62#define MAXFILES 25064#define MAXFILES 250
@@ -288,13 +290,37 @@ void singfunc(char * filename, char * line) · 225 unmodified lines
288 exec_kernel_doc(vec);290 exec_kernel_doc(vec);
289}291}
290 292
293/*
294 * Insert specific documentation section from a file.
295 * Call kernel-doc with the following parameters:
296 * kernel-doc -docbook -function "doc section" filename
297 */
298void docsect(char *filename, char *line)
299{
300 char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */
301 char *s;
302
303 for (s = line; *s; s++)
304 if (*s == '\n')
305 *s = '\0';
306
307 vec[0] = KERNELDOC;
308 vec[1] = DOCBOOK;
309 vec[2] = FUNCTION;
310 vec[3] = line;
311 vec[4] = filename;
312 vec[5] = NULL;
313 exec_kernel_doc(vec);
314}
315
291/*316/*
292 * Parse file, calling action specific functions for:317 * Parse file, calling action specific functions for:
293 * 1) Lines containing !E318 * 1) Lines containing !E
294 * 2) Lines containing !I319 * 2) Lines containing !I
295 * 3) Lines containing !D320 * 3) Lines containing !D
296 * 4) Lines containing !F321 * 4) Lines containing !F
297 * 5) Default lines - lines not matching the above322 * 5) Lines containing !P
323 * 6) Default lines - lines not matching the above
298 */324 */
299void parse_file(FILE *infile)325void parse_file(FILE *infile)
300{326{
@@ -328,6 +354,15 @@ void parse_file(FILE *infile) · 27 unmodified lines
328 s++;354 s++;
329 singlefunctions(line +2, s);355 singlefunctions(line +2, s);
330 break;356 break;
357 case 'P':
358 /* filename */
359 while (*s && !isspace(*s)) s++;
360 *s++ = '\0';
361 /* DOC: section name */
362 while (isspace(*s))
363 s++;
364 docsection(line + 2, s);
365 break;
331 default:366 default:
332 defaultline(line);367 defaultline(line);
333 }368 }
@@ -374,6 +409,7 @@ int main(int argc, char *argv[]) · 40 unmodified lines
374 externalfunctions = find_export_symbols;409 externalfunctions = find_export_symbols;
375 symbolsonly = find_export_symbols;410 symbolsonly = find_export_symbols;
376 singlefunctions = noaction2;411 singlefunctions = noaction2;
412 docsection = noaction2;
377 parse_file(infile);413 parse_file(infile);
378 414
379 /* Rewind to start from beginning of file again */415 /* Rewind to start from beginning of file again */
@@ -383,6 +419,7 @@ int main(int argc, char *argv[]) · 3 unmodified lines
383 externalfunctions = extfunc;419 externalfunctions = extfunc;
384 symbolsonly = printline;420 symbolsonly = printline;
385 singlefunctions = singfunc;421 singlefunctions = singfunc;
422 docsection = docsect;
386 423
387 parse_file(infile);424 parse_file(infile);
388 }425 }
@@ -396,6 +433,7 @@ int main(int argc, char *argv[]) · 7 unmodified lines
396 externalfunctions = adddep;433 externalfunctions = adddep;
397 symbolsonly = adddep;434 symbolsonly = adddep;
398 singlefunctions = adddep2;435 singlefunctions = adddep2;
436 docsection = adddep2;
399 parse_file(infile);437 parse_file(infile);
400 printf("\n");438 printf("\n");
401 }439 }