aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/basic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/basic')
-rw-r--r--scripts/basic/docproc.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index 7eae53419a48..35bdc68b6e66 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -30,6 +30,7 @@
30 * !Ifilename 30 * !Ifilename
31 * !Dfilename 31 * !Dfilename
32 * !Ffilename 32 * !Ffilename
33 * !Pfilename
33 * 34 *
34 */ 35 */
35 36
@@ -57,6 +58,7 @@ FILEONLY *symbolsonly;
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 2048 63#define MAXLINESZ 2048
62#define MAXFILES 250 64#define MAXFILES 250
@@ -289,12 +291,36 @@ void singfunc(char * filename, char * line)
289} 291}
290 292
291/* 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
316/*
292 * Parse file, calling action specific functions for: 317 * Parse file, calling action specific functions for:
293 * 1) Lines containing !E 318 * 1) Lines containing !E
294 * 2) Lines containing !I 319 * 2) Lines containing !I
295 * 3) Lines containing !D 320 * 3) Lines containing !D
296 * 4) Lines containing !F 321 * 4) Lines containing !F
297 * 5) Default lines - lines not matching the above 322 * 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)
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[])
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[])
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[])
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 }