summaryrefslogtreecommitdiffstats
path: root/scripts/basic/docproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/basic/docproc.c')
-rw-r--r--scripts/basic/docproc.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index 0e4bd5459df4..35bdc68b6e66 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -30,6 +30,7 @@
* !Ifilename
* !Dfilename
* !Ffilename
+ * !Pfilename
*
*/
@@ -57,6 +58,7 @@ FILEONLY *symbolsonly;
typedef void FILELINE(char * file, char * line);
FILELINE * singlefunctions;
FILELINE * entity_system;
+FILELINE * docsection;
#define MAXLINESZ 2048
#define MAXFILES 250
@@ -65,6 +67,7 @@ FILELINE * entity_system;
#define DOCBOOK "-docbook"
#define FUNCTION "-function"
#define NOFUNCTION "-nofunction"
+#define NODOCSECTIONS "-no-doc-sections"
char *srctree;
@@ -231,13 +234,14 @@ void docfunctions(char * filename, char * type)
for (i=0; i <= symfilecnt; i++)
symcnt += symfilelist[i].symbolcnt;
- vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*));
+ vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *));
if (vec == NULL) {
perror("docproc: ");
exit(1);
}
vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK;
+ vec[idx++] = NODOCSECTIONS;
for (i=0; i < symfilecnt; i++) {
struct symfile * sym = &symfilelist[i];
for (j=0; j < sym->symbolcnt; j++) {
@@ -287,12 +291,36 @@ void singfunc(char * filename, char * line)
}
/*
+ * Insert specific documentation section from a file.
+ * Call kernel-doc with the following parameters:
+ * kernel-doc -docbook -function "doc section" filename
+ */
+void docsect(char *filename, char *line)
+{
+ char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */
+ char *s;
+
+ for (s = line; *s; s++)
+ if (*s == '\n')
+ *s = '\0';
+
+ vec[0] = KERNELDOC;
+ vec[1] = DOCBOOK;
+ vec[2] = FUNCTION;
+ vec[3] = line;
+ vec[4] = filename;
+ vec[5] = NULL;
+ exec_kernel_doc(vec);
+}
+
+/*
* Parse file, calling action specific functions for:
* 1) Lines containing !E
* 2) Lines containing !I
* 3) Lines containing !D
* 4) Lines containing !F
- * 5) Default lines - lines not matching the above
+ * 5) Lines containing !P
+ * 6) Default lines - lines not matching the above
*/
void parse_file(FILE *infile)
{
@@ -326,6 +354,15 @@ void parse_file(FILE *infile)
s++;
singlefunctions(line +2, s);
break;
+ case 'P':
+ /* filename */
+ while (*s && !isspace(*s)) s++;
+ *s++ = '\0';
+ /* DOC: section name */
+ while (isspace(*s))
+ s++;
+ docsection(line + 2, s);
+ break;
default:
defaultline(line);
}
@@ -372,6 +409,7 @@ int main(int argc, char *argv[])
externalfunctions = find_export_symbols;
symbolsonly = find_export_symbols;
singlefunctions = noaction2;
+ docsection = noaction2;
parse_file(infile);
/* Rewind to start from beginning of file again */
@@ -381,6 +419,7 @@ int main(int argc, char *argv[])
externalfunctions = extfunc;
symbolsonly = printline;
singlefunctions = singfunc;
+ docsection = docsect;
parse_file(infile);
}
@@ -394,6 +433,7 @@ int main(int argc, char *argv[])
externalfunctions = adddep;
symbolsonly = adddep;
singlefunctions = adddep2;
+ docsection = adddep2;
parse_file(infile);
printf("\n");
}