aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc23
1 files changed, 20 insertions, 3 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8fd107a3fac4..01e8a8e22602 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -230,6 +230,7 @@ my $dohighlight = "";
230 230
231my $verbose = 0; 231my $verbose = 0;
232my $output_mode = "man"; 232my $output_mode = "man";
233my $output_preformatted = 0;
233my $no_doc_sections = 0; 234my $no_doc_sections = 0;
234my %highlights = %highlights_man; 235my %highlights = %highlights_man;
235my $blankline = $blankline_man; 236my $blankline = $blankline_man;
@@ -280,9 +281,10 @@ my $doc_special = "\@\%\$\&";
280my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. 281my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
281my $doc_end = '\*/'; 282my $doc_end = '\*/';
282my $doc_com = '\s*\*\s*'; 283my $doc_com = '\s*\*\s*';
284my $doc_com_body = '\s*\* ?';
283my $doc_decl = $doc_com . '(\w+)'; 285my $doc_decl = $doc_com . '(\w+)';
284my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; 286my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)';
285my $doc_content = $doc_com . '(.*)'; 287my $doc_content = $doc_com_body . '(.*)';
286my $doc_block = $doc_com . 'DOC:\s*(.*)?'; 288my $doc_block = $doc_com . 'DOC:\s*(.*)?';
287 289
288my %constants; 290my %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";
@@ -2046,6 +2059,9 @@ sub process_file($) {
2046 2059
2047 $section_counter = 0; 2060 $section_counter = 0;
2048 while (<IN>) { 2061 while (<IN>) {
2062 while (s/\\\s*$//) {
2063 $_ .= <IN>;
2064 }
2049 if ($state == 0) { 2065 if ($state == 0) {
2050 if (/$doc_start/o) { 2066 if (/$doc_start/o) {
2051 $state = 1; # next line is always the function name 2067 $state = 1; # next line is always the function name
@@ -2073,7 +2089,7 @@ sub process_file($) {
2073 $descr= $1; 2089 $descr= $1;
2074 $descr =~ s/^\s*//; 2090 $descr =~ s/^\s*//;
2075 $descr =~ s/\s*$//; 2091 $descr =~ s/\s*$//;
2076 $descr =~ s/\s+/ /; 2092 $descr =~ s/\s+/ /g;
2077 $declaration_purpose = xml_escape($descr); 2093 $declaration_purpose = xml_escape($descr);
2078 $in_purpose = 1; 2094 $in_purpose = 1;
2079 } else { 2095 } else {
@@ -2165,6 +2181,7 @@ sub process_file($) {
2165 # Continued declaration purpose 2181 # Continued declaration purpose
2166 chomp($declaration_purpose); 2182 chomp($declaration_purpose);
2167 $declaration_purpose .= " " . xml_escape($1); 2183 $declaration_purpose .= " " . xml_escape($1);
2184 $declaration_purpose =~ s/\s+/ /g;
2168 } else { 2185 } else {
2169 $contents .= $1 . "\n"; 2186 $contents .= $1 . "\n";
2170 } 2187 }