Lines Matching +full:a +full:- +full:za +full:- +full:z0 +full:- +full:9 +full:-

1 #!/usr/bin/perl -w
8 ## Copyright (C) 2005-2012 Randy Dunlap ##
17 # 18/01/2001 - Cleanups
20 # -- huggie@earth.li
22 # 27/06/2001 - Allowed whitespace after initial "/**" and
24 # -- Christian Kreibich <ck@whoop.org>
27 # - add perldoc documentation
28 # - Look more closely at some of the scarier bits :)
30 # 26/05/2001 - Support for separate source and object trees.
34 # 23/09/2001 - Added support for typedefs, structs, enums and unions
37 # -- Tim Jansen <tim@tjansen.de>
39 # 25/07/2012 - Added support for HTML5
40 # -- Dan Luedtke <mail@danrl.de>
43 # This will read a 'c' file and scan for embedded comments in the
44 # style of gnome comments (+minor extensions - see below).
50 # kernel-doc [ -docbook | -html | -html5 | -text | -man | -list ]
51 # [ -no-doc-sections ]
52 # [ -function funcname [ -function funcname ...] ]
55 # [ -nofunction funcname [ -function funcname ...] ]
58 # Set output format using one of -docbook -html -html5 -text or -man.
60 # The -list format is for internal use by docproc.
62 # -no-doc-sections
65 # -function funcname
69 # -nofunction funcname
71 # sections. Cannot be used together with -function (yes, that's a bug --
74 # c files - list of 'c' files to process
83 # * function_name(:)? (- short description)?
85 # (* a blank line)?
96 # If the Description: header tag is omitted, then there must be a blank line
100 # * my_function - does my stuff
108 # * my_function - does my stuff
121 # * struct my_struct - short description
122 # * @a: first member
128 # int a;
140 # A non-void function should have a "Return:" section describing the return
142 # Example-sections should contain the string EXAMPLE so that they are marked
147 # * user_function - function that can only be called in user context
148 # * @a: some argument
161 # 'funcname()' - function
162 # '$ENVVAR' - environmental variable
163 # '&struct_name' - name of a structure (up to two words including 'struct')
164 # '@parameter' - name of a parameter
165 # '%CONST' - name of a constant.
174 my $type_constant = '\%([-_\w]+)';
226 # text-mode
241 if ($#ARGV == -1) {
274 # Generated docbook code is inserted in a template at a point where
275 # docbook v3.1 requires a non-zero sequence of RefEntry's; see:
276 # http://www.oasis-open.org/docbook/documentation/reference/html/refentry.html
277 # We keep track of number of generated entries and generate a dummy
285 # 0 - normal code
286 # 1 - looking for function name
287 # 2 - scanning field start.
288 # 3 - scanning prototype.
289 # 4 - documentation block
323 my $undescribed = "-- undescribed --";
327 while ($ARGV[0] =~ m/^-(.*)/) {
329 if ($cmd eq "-html") {
333 } elsif ($cmd eq "-html5") {
337 } elsif ($cmd eq "-man") {
341 } elsif ($cmd eq "-text") {
345 } elsif ($cmd eq "-docbook") {
349 } elsif ($cmd eq "-list") {
353 } elsif ($cmd eq "-gnome") {
357 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
359 } elsif ($cmd eq "-function") { # to only output specific functions
363 } elsif ($cmd eq "-nofunction") { # to only output specific functions
367 } elsif ($cmd eq "-v") {
369 } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
371 } elsif ($cmd eq '-no-doc-sections') {
373 } elsif ($cmd eq '-show-not-found') {
381 print "Usage: $0 [ -docbook | -html | -html5 | -text | -man | -list ]\n";
382 print " [ -no-doc-sections ]\n";
383 print " [ -function funcname [ -function funcname ...] ]\n";
384 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
385 print " [ -v ]\n";
387 print " -v : verbose output, more warnings & other info listed\n";
454 'content-only' => ($function_only != 0), });
461 # parameterdescs, a hash.
576 print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n";
589 # pointer-to-function
624 print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n";
632 # pointer-to-function
698 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
742 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
763 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
787 # pointer-to-function
835 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
851 # pointer-to-function
898 $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
940 $id = "API-" . $args{'function'};
941 $id =~ s/[^A-Za-z0-9]/-/g;
945 print " <title>U-BOOT</title>\n";
951 print " <manvolnum>9</manvolnum>\n";
973 # pointer-to-function
1017 $id = "API-struct-" . $args{'struct'};
1018 $id =~ s/[^A-Za-z0-9]/-/g;
1022 print " <title>U-BOOT</title>\n";
1028 print " <manvolnum>9</manvolnum>\n";
1047 # This allows us to have #define macros interspersed in a struct.
1060 # pointer-to-function
1111 $id = "API-enum-" . $args{'enum'};
1112 $id =~ s/[^A-Za-z0-9]/-/g;
1116 print " <title>U-BOOT</title>\n";
1122 print " <manvolnum>9</manvolnum>\n";
1178 $id = "API-typedef-" . $args{'typedef'};
1179 $id =~ s/[^A-Za-z0-9]/-/g;
1183 print " <title>U-BOOT</title>\n";
1189 print " <manvolnum>9</manvolnum>\n";
1216 $id =~ s/[^A-Za-z0-9]/-/g;
1221 if (!$args{'content-only'}) {
1237 if (!$args{'content-only'}) {
1252 $id = $args{'module'} . "-" . $args{'function'};
1253 $id =~ s/[^A-Za-z0-9]/-/g;
1268 # pointer-to-function
1331 …print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Bootloader Hacker's Manua…
1334 print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
1351 # pointer-to-function
1382 print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" U-BOOT\n";
1385 print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
1422 …print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \…
1425 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
1441 # pointer-to-function
1477 print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" U-BOOT\n";
1480 print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
1493 print ".TH \"$args{'module'}\" 9 \"$args{'module'}\" \"$man_date\" \"API Manual\" U-BOOT\n";
1509 print $args{'function'} . " - " . $args{'purpose'} . "\n";
1523 # pointer-to-function
1567 print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n";
1596 print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n";
1605 print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n";
1619 # pointer-to-function
1651 print " -> ";
1711 # generic output function - calls the right one based on current output mode.
1720 # takes a declaration (struct, union, enum, typedef) and
1876 # Treat preprocessor directive as a typeless variable just to fill
1881 # pointer-to-function
1916 if ($type ne "") { # skip unnamed bit-fields
1988 # this fixes a problem where check_sections() cannot find
1989 # a parameter like "addr[6 + 2]" because it actually appears
1993 # "[blah" in a parameter string;
2012 $prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
2013 # ignore array size in a parameter string;
2048 # Checks the section describing the return value of a function.
2054 # Ignore an empty return type (It's a macro)
2055 # Ignore functions with a "void" return type. (But don't ignore "void *")
2070 # takes a function prototype and the name of the current file being
2092 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
2095 # 1. Return type (may be nothing if we're looking at a macro)
2104 # If you mess with these regexps, it's a good idea to check that
2106 # - parport_register_device (function pointer parameters)
2107 # - atomic_set (macro)
2108 # - pci_match_device, __copy_to_user (long return type)
2110 if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) {
2111 # This is an object-like macro, it has no return type and no parameter
2113 # Function-like macros are not allowed to have spaces between
2118 } elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2119 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2120 $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2121 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2122 $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2123 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2124 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2125 $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2126 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2127 $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2128 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2129 $prototype =~ m/^(\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2130 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2131 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2132 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2133 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2134 $prototype =~ m/^(\w+\s+\w+\s*\*\s*\w+\s*\*\s*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/) {
2148 # This check emits a lot of warnings at the moment, because many
2149 # functions don't have a 'Return' doc section. So until the number
2216 ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
2229 # now delete all of the odd-number commas in $prototype
2230 # so that arg types & arg names don't have a comma between them
2234 $len = 0; # skip the for-loop
2250 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
2283 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
2294 ($2 eq '}') && $brcount--;
2311 # kernel-doc script are not escaped here; instead, they begin life like
2312 # $blankline_html (4 of '\' followed by a mnemonic + ':'), then these strings
2313 # are converted to their mnemonic-expected output, without the 4 * '\' & ':',
2386 if (/\s*([\w\s]+?)\s*-/) {
2391 if (/-(.*)/) {
2426 " - I thought it was a doc line\n";
2463 if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
2473 # miguel-style comment kludge, look for blank lines after
2493 # i dont know - bad line? ignore.
2588 # generate a sequence of code that will splice in highlighting information