diff options
Diffstat (limited to 'scripts/kernel-doc')
| -rwxr-xr-x | scripts/kernel-doc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 9b0c0b8b4ab4..01e8a8e22602 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -230,6 +230,7 @@ my $dohighlight = ""; | |||
| 230 | 230 | ||
| 231 | my $verbose = 0; | 231 | my $verbose = 0; |
| 232 | my $output_mode = "man"; | 232 | my $output_mode = "man"; |
| 233 | my $output_preformatted = 0; | ||
| 233 | my $no_doc_sections = 0; | 234 | my $no_doc_sections = 0; |
| 234 | my %highlights = %highlights_man; | 235 | my %highlights = %highlights_man; |
| 235 | my $blankline = $blankline_man; | 236 | my $blankline = $blankline_man; |
| @@ -280,9 +281,10 @@ my $doc_special = "\@\%\$\&"; | |||
| 280 | my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. | 281 | my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. |
| 281 | my $doc_end = '\*/'; | 282 | my $doc_end = '\*/'; |
| 282 | my $doc_com = '\s*\*\s*'; | 283 | my $doc_com = '\s*\*\s*'; |
| 284 | my $doc_com_body = '\s*\* ?'; | ||
| 283 | my $doc_decl = $doc_com . '(\w+)'; | 285 | my $doc_decl = $doc_com . '(\w+)'; |
| 284 | my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; | 286 | my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; |
| 285 | my $doc_content = $doc_com . '(.*)'; | 287 | my $doc_content = $doc_com_body . '(.*)'; |
| 286 | my $doc_block = $doc_com . 'DOC:\s*(.*)?'; | 288 | my $doc_block = $doc_com . 'DOC:\s*(.*)?'; |
| 287 | 289 | ||
| 288 | my %constants; | 290 | my %constants; |
| @@ -459,8 +461,13 @@ sub output_highlight { | |||
| 459 | # print STDERR "contents af:$contents\n"; | 461 | # print STDERR "contents af:$contents\n"; |
| 460 | 462 | ||
| 461 | foreach $line (split "\n", $contents) { | 463 | foreach $line (split "\n", $contents) { |
| 464 | if (! $output_preformatted) { | ||
| 465 | $line =~ s/^\s*//; | ||
| 466 | } | ||
| 462 | if ($line eq ""){ | 467 | if ($line eq ""){ |
| 463 | print $lineprefix, local_unescape($blankline); | 468 | if (! $output_preformatted) { |
| 469 | print $lineprefix, local_unescape($blankline); | ||
| 470 | } | ||
| 464 | } else { | 471 | } else { |
| 465 | $line =~ s/\\\\\\/\&/g; | 472 | $line =~ s/\\\\\\/\&/g; |
| 466 | if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { | 473 | if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { |
| @@ -643,10 +650,12 @@ sub output_section_xml(%) { | |||
| 643 | print "<title>$section</title>\n"; | 650 | print "<title>$section</title>\n"; |
| 644 | if ($section =~ m/EXAMPLE/i) { | 651 | if ($section =~ m/EXAMPLE/i) { |
| 645 | print "<informalexample><programlisting>\n"; | 652 | print "<informalexample><programlisting>\n"; |
| 653 | $output_preformatted = 1; | ||
| 646 | } else { | 654 | } else { |
| 647 | print "<para>\n"; | 655 | print "<para>\n"; |
| 648 | } | 656 | } |
| 649 | output_highlight($args{'sections'}{$section}); | 657 | output_highlight($args{'sections'}{$section}); |
| 658 | $output_preformatted = 0; | ||
| 650 | if ($section =~ m/EXAMPLE/i) { | 659 | if ($section =~ m/EXAMPLE/i) { |
| 651 | print "</programlisting></informalexample>\n"; | 660 | print "</programlisting></informalexample>\n"; |
| 652 | } else { | 661 | } else { |
| @@ -949,10 +958,12 @@ sub output_blockhead_xml(%) { | |||
| 949 | } | 958 | } |
| 950 | if ($section =~ m/EXAMPLE/i) { | 959 | if ($section =~ m/EXAMPLE/i) { |
| 951 | print "<example><para>\n"; | 960 | print "<example><para>\n"; |
| 961 | $output_preformatted = 1; | ||
| 952 | } else { | 962 | } else { |
| 953 | print "<para>\n"; | 963 | print "<para>\n"; |
| 954 | } | 964 | } |
| 955 | output_highlight($args{'sections'}{$section}); | 965 | output_highlight($args{'sections'}{$section}); |
| 966 | $output_preformatted = 0; | ||
| 956 | if ($section =~ m/EXAMPLE/i) { | 967 | if ($section =~ m/EXAMPLE/i) { |
| 957 | print "</para></example>\n"; | 968 | print "</para></example>\n"; |
| 958 | } else { | 969 | } else { |
| @@ -1028,10 +1039,12 @@ sub output_function_gnome { | |||
| 1028 | print "<simplesect>\n <title>$section</title>\n"; | 1039 | print "<simplesect>\n <title>$section</title>\n"; |
| 1029 | if ($section =~ m/EXAMPLE/i) { | 1040 | if ($section =~ m/EXAMPLE/i) { |
| 1030 | print "<example><programlisting>\n"; | 1041 | print "<example><programlisting>\n"; |
| 1042 | $output_preformatted = 1; | ||
| 1031 | } else { | 1043 | } else { |
| 1032 | } | 1044 | } |
| 1033 | print "<para>\n"; | 1045 | print "<para>\n"; |
| 1034 | output_highlight($args{'sections'}{$section}); | 1046 | output_highlight($args{'sections'}{$section}); |
| 1047 | $output_preformatted = 0; | ||
| 1035 | print "</para>\n"; | 1048 | print "</para>\n"; |
| 1036 | if ($section =~ m/EXAMPLE/i) { | 1049 | if ($section =~ m/EXAMPLE/i) { |
| 1037 | print "</programlisting></example>\n"; | 1050 | print "</programlisting></example>\n"; |
| @@ -1786,6 +1799,7 @@ sub dump_function($$) { | |||
| 1786 | $prototype =~ s/__init +//; | 1799 | $prototype =~ s/__init +//; |
| 1787 | $prototype =~ s/__init_or_module +//; | 1800 | $prototype =~ s/__init_or_module +//; |
| 1788 | $prototype =~ s/__must_check +//; | 1801 | $prototype =~ s/__must_check +//; |
| 1802 | $prototype =~ s/__weak +//; | ||
| 1789 | $prototype =~ s/^#\s*define\s+//; #ak added | 1803 | $prototype =~ s/^#\s*define\s+//; #ak added |
| 1790 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; | 1804 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; |
| 1791 | 1805 | ||
| @@ -2045,6 +2059,9 @@ sub process_file($) { | |||
| 2045 | 2059 | ||
| 2046 | $section_counter = 0; | 2060 | $section_counter = 0; |
| 2047 | while (<IN>) { | 2061 | while (<IN>) { |
| 2062 | while (s/\\\s*$//) { | ||
| 2063 | $_ .= <IN>; | ||
| 2064 | } | ||
| 2048 | if ($state == 0) { | 2065 | if ($state == 0) { |
| 2049 | if (/$doc_start/o) { | 2066 | if (/$doc_start/o) { |
| 2050 | $state = 1; # next line is always the function name | 2067 | $state = 1; # next line is always the function name |
| @@ -2072,7 +2089,7 @@ sub process_file($) { | |||
| 2072 | $descr= $1; | 2089 | $descr= $1; |
| 2073 | $descr =~ s/^\s*//; | 2090 | $descr =~ s/^\s*//; |
| 2074 | $descr =~ s/\s*$//; | 2091 | $descr =~ s/\s*$//; |
| 2075 | $descr =~ s/\s+/ /; | 2092 | $descr =~ s/\s+/ /g; |
| 2076 | $declaration_purpose = xml_escape($descr); | 2093 | $declaration_purpose = xml_escape($descr); |
| 2077 | $in_purpose = 1; | 2094 | $in_purpose = 1; |
| 2078 | } else { | 2095 | } else { |
| @@ -2164,6 +2181,7 @@ sub process_file($) { | |||
| 2164 | # Continued declaration purpose | 2181 | # Continued declaration purpose |
| 2165 | chomp($declaration_purpose); | 2182 | chomp($declaration_purpose); |
| 2166 | $declaration_purpose .= " " . xml_escape($1); | 2183 | $declaration_purpose .= " " . xml_escape($1); |
| 2184 | $declaration_purpose =~ s/\s+/ /g; | ||
| 2167 | } else { | 2185 | } else { |
| 2168 | $contents .= $1 . "\n"; | 2186 | $contents .= $1 . "\n"; |
| 2169 | } | 2187 | } |
