~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/Documentation/kernel-doc-nano-HOWTO.txt

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 kernel-doc nano-HOWTO
  2 =====================
  3 
  4 Many places in the source tree have extractable documentation in the
  5 form of block comments above functions.  The components of this system
  6 are:
  7 
  8 - scripts/kernel-doc
  9 
 10   This is a perl script that hunts for the block comments and can mark
 11   them up directly into DocBook, man, text, and HTML. (No, not
 12   texinfo.)
 13 
 14 - Documentation/DocBook/*.tmpl
 15 
 16   These are SGML template files, which are normal SGML files with
 17   special place-holders for where the extracted documentation should
 18   go.
 19 
 20 - scripts/docproc.c
 21 
 22   This is a program for converting SGML template files into SGML
 23   files.  It invokes kernel-doc, giving it the list of functions that
 24   are to be documented.
 25 
 26 - scripts/gen-all-syms
 27 
 28   This is a script that lists the EXPORT_SYMBOL symbols in a list of C
 29   files.
 30 
 31 - scripts/docgen
 32 
 33   This script invokes docproc, telling it which functions are to be
 34   documented (this list comes from gen-all-syms).
 35 
 36 - Makefile
 37 
 38   The targets 'sgmldocs', 'psdocs', and 'pdfdocs' are used to build
 39   DocBook files, PostScript files, and PDF files in
 40   Documentation/DocBook.
 41 
 42 - Documentation/DocBook/Makefile
 43 
 44   This is where C files are associated with SGML templates.
 45 
 46 
 47 How to extract the documentation
 48 --------------------------------
 49 
 50 If you just want to read the ready-made books on the various
 51 subsystems (see Documentation/DocBook/*.tmpl), just type 'make
 52 psdocs', or 'make pdfdocs', depending on your preference.  If you
 53 would rather read a different format, you can type 'make sgmldocs' and
 54 then use DocBook tools to convert Documentation/DocBook/*.sgml to a
 55 format of your choice (for example, 'db2html ...').
 56 
 57 If you want to see man pages instead, you can do this:
 58 
 59 $ cd linux
 60 $ scripts/kernel-doc -man $(find -name '*.c' '*.h') | split-man.pl /tmp/man
 61 
 62 Here is split-man.pl:
 63 
 64 -->
 65 #!/usr/bin/perl
 66 
 67 if ($#ARGV < 0) {
 68    die "where do I put the results?\n";
 69 }
 70 
 71 mkdir $ARGV[0],0777 or die "Can't create $ARGV[0]: $!\n";
 72 $state = 0;
 73 while (<STDIN>) {
 74     if (/^\.TH \"[^\"]*\" 4 \"([^\"]*)\"/) {
 75         if ($state == 1) { close OUT }
 76         $state = 1;
 77         $fn = "$ARGV[0]/$1.4";
 78         print STDERR "Creating $fn\n";
 79         open OUT, ">$fn" or die "can't open $fn: $!\n";
 80         print OUT $_;
 81     } elsif ($state != 0) {
 82         print OUT $_;
 83     }
 84 }
 85 
 86 close OUT;
 87 <--
 88 
 89 If you just want to view the documentation for one function in one
 90 file, you can do this:
 91 
 92 $ scripts/kernel-doc -man -function fn file | nroff -man | less
 93 
 94 or this:
 95 
 96 $ scripts/kernel-doc -text -function fn file
 97 
 98 
 99 How to add extractable documentation to your source files
100 ---------------------------------------------------------
101 
102 The format of the block comment is like this:
103 
104 /**
105  * function_name(:)? (- short description)?
106 (* @parameterx: (description of parameter x)?)*
107 (* a blank line)?
108  * (Description:)? (Description of function)?
109  * (section header: (section description)? )*
110 (*)?*/
111 
112 The short function description cannot be multiline, but the other
113 descriptions can be.
114 
115 All descriptive text is further processed, scanning for the following special
116 patterns, which are highlighted appropriately.
117 
118 'funcname()' - function
119 '$ENVVAR' - environment variable
120 '&struct_name' - name of a structure (up to two words including 'struct')
121 '@parameter' - name of a parameter
122 '%CONST' - name of a constant.
123 
124 Take a look around the source tree for examples.
125 
126 
127 How to make new SGML template files
128 -----------------------------------
129 
130 SGML template files (*.tmpl) are like normal SGML files, except that
131 they can contain escape sequences where extracted documentation should
132 be inserted.
133 
134 !E<filename> is replaced by the documentation, in <filename>, for
135 functions that are exported using EXPORT_SYMBOL: the function list is
136 collected from files listed in Documentation/DocBook/Makefile.
137 
138 !I<filename> is replaced by the documentation for functions that are
139 _not_ exported using EXPORT_SYMBOL.
140 
141 !F<filename> <function [functions...]> is replaced by the
142 documentation, in <filename>, for the functions listed.
143 
144 
145 Tim.
146 */ <twaugh@redhat.com>
147 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.