diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
| commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
| tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /scripts/kernel-doc | |
| parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) | |
Patched in Tegra support.
Diffstat (limited to 'scripts/kernel-doc')
| -rwxr-xr-x | scripts/kernel-doc | 335 |
1 files changed, 12 insertions, 323 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index f565536a2be..d793001929c 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -5,8 +5,7 @@ use strict; | |||
| 5 | ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## | 5 | ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## |
| 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## | 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## |
| 7 | ## Copyright (C) 2001 Simon Huggins ## | 7 | ## Copyright (C) 2001 Simon Huggins ## |
| 8 | ## Copyright (C) 2005-2012 Randy Dunlap ## | 8 | ## Copyright (C) 2005-2010 Randy Dunlap ## |
| 9 | ## Copyright (C) 2012 Dan Luedtke ## | ||
| 10 | ## ## | 9 | ## ## |
| 11 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## | 10 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## |
| 12 | ## Copyright (c) 2000 MontaVista Software, Inc. ## | 11 | ## Copyright (c) 2000 MontaVista Software, Inc. ## |
| @@ -36,8 +35,6 @@ use strict; | |||
| 36 | # Small fixes (like spaces vs. \s in regex) | 35 | # Small fixes (like spaces vs. \s in regex) |
| 37 | # -- Tim Jansen <tim@tjansen.de> | 36 | # -- Tim Jansen <tim@tjansen.de> |
| 38 | 37 | ||
| 39 | # 25/07/2012 - Added support for HTML5 | ||
| 40 | # -- Dan Luedtke <mail@danrl.de> | ||
| 41 | 38 | ||
| 42 | # | 39 | # |
| 43 | # This will read a 'c' file and scan for embedded comments in the | 40 | # This will read a 'c' file and scan for embedded comments in the |
| @@ -47,16 +44,12 @@ use strict; | |||
| 47 | # Note: This only supports 'c'. | 44 | # Note: This only supports 'c'. |
| 48 | 45 | ||
| 49 | # usage: | 46 | # usage: |
| 50 | # kernel-doc [ -docbook | -html | -html5 | -text | -man | -list ] | 47 | # kernel-doc [ -docbook | -html | -text | -man | -list ] [ -no-doc-sections ] |
| 51 | # [ -no-doc-sections ] | 48 | # [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile |
| 52 | # [ -function funcname [ -function funcname ...] ] | ||
| 53 | # c file(s)s > outputfile | ||
| 54 | # or | 49 | # or |
| 55 | # [ -nofunction funcname [ -function funcname ...] ] | 50 | # [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile |
| 56 | # c file(s)s > outputfile | ||
| 57 | # | 51 | # |
| 58 | # Set output format using one of -docbook -html -html5 -text or -man. | 52 | # Set output format using one of -docbook -html -text or -man. Default is man. |
| 59 | # Default is man. | ||
| 60 | # The -list format is for internal use by docproc. | 53 | # The -list format is for internal use by docproc. |
| 61 | # | 54 | # |
| 62 | # -no-doc-sections | 55 | # -no-doc-sections |
| @@ -137,8 +130,6 @@ use strict; | |||
| 137 | # should document the "Context:" of the function, e.g. whether the functions | 130 | # should document the "Context:" of the function, e.g. whether the functions |
| 138 | # can be called form interrupts. Unlike other sections you can end it with an | 131 | # can be called form interrupts. Unlike other sections you can end it with an |
| 139 | # empty line. | 132 | # empty line. |
| 140 | # A non-void function should have a "Return:" section describing the return | ||
| 141 | # value(s). | ||
| 142 | # Example-sections should contain the string EXAMPLE so that they are marked | 133 | # Example-sections should contain the string EXAMPLE so that they are marked |
| 143 | # appropriately in DocBook. | 134 | # appropriately in DocBook. |
| 144 | # | 135 | # |
| @@ -191,14 +182,6 @@ my $local_lt = "\\\\\\\\lt:"; | |||
| 191 | my $local_gt = "\\\\\\\\gt:"; | 182 | my $local_gt = "\\\\\\\\gt:"; |
| 192 | my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" | 183 | my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" |
| 193 | 184 | ||
| 194 | # html version 5 | ||
| 195 | my %highlights_html5 = ( $type_constant, "<span class=\"const\">\$1</span>", | ||
| 196 | $type_func, "<span class=\"func\">\$1</span>", | ||
| 197 | $type_struct_xml, "<span class=\"struct\">\$1</span>", | ||
| 198 | $type_env, "<span class=\"env\">\$1</span>", | ||
| 199 | $type_param, "<span class=\"param\">\$1</span>" ); | ||
| 200 | my $blankline_html5 = $local_lt . "br /" . $local_gt; | ||
| 201 | |||
| 202 | # XML, docbook format | 185 | # XML, docbook format |
| 203 | my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", | 186 | my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", |
| 204 | $type_constant, "<constant>\$1</constant>", | 187 | $type_constant, "<constant>\$1</constant>", |
| @@ -247,7 +230,6 @@ my $dohighlight = ""; | |||
| 247 | 230 | ||
| 248 | my $verbose = 0; | 231 | my $verbose = 0; |
| 249 | my $output_mode = "man"; | 232 | my $output_mode = "man"; |
| 250 | my $output_preformatted = 0; | ||
| 251 | my $no_doc_sections = 0; | 233 | my $no_doc_sections = 0; |
| 252 | my %highlights = %highlights_man; | 234 | my %highlights = %highlights_man; |
| 253 | my $blankline = $blankline_man; | 235 | my $blankline = $blankline_man; |
| @@ -298,10 +280,9 @@ my $doc_special = "\@\%\$\&"; | |||
| 298 | my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. | 280 | my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. |
| 299 | my $doc_end = '\*/'; | 281 | my $doc_end = '\*/'; |
| 300 | my $doc_com = '\s*\*\s*'; | 282 | my $doc_com = '\s*\*\s*'; |
| 301 | my $doc_com_body = '\s*\* ?'; | ||
| 302 | my $doc_decl = $doc_com . '(\w+)'; | 283 | my $doc_decl = $doc_com . '(\w+)'; |
| 303 | my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; | 284 | my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; |
| 304 | my $doc_content = $doc_com_body . '(.*)'; | 285 | my $doc_content = $doc_com . '(.*)'; |
| 305 | my $doc_block = $doc_com . 'DOC:\s*(.*)?'; | 286 | my $doc_block = $doc_com . 'DOC:\s*(.*)?'; |
| 306 | 287 | ||
| 307 | my %constants; | 288 | my %constants; |
| @@ -317,7 +298,6 @@ my $section_default = "Description"; # default section | |||
| 317 | my $section_intro = "Introduction"; | 298 | my $section_intro = "Introduction"; |
| 318 | my $section = $section_default; | 299 | my $section = $section_default; |
| 319 | my $section_context = "Context"; | 300 | my $section_context = "Context"; |
| 320 | my $section_return = "Return"; | ||
| 321 | 301 | ||
| 322 | my $undescribed = "-- undescribed --"; | 302 | my $undescribed = "-- undescribed --"; |
| 323 | 303 | ||
| @@ -329,10 +309,6 @@ while ($ARGV[0] =~ m/^-(.*)/) { | |||
| 329 | $output_mode = "html"; | 309 | $output_mode = "html"; |
| 330 | %highlights = %highlights_html; | 310 | %highlights = %highlights_html; |
| 331 | $blankline = $blankline_html; | 311 | $blankline = $blankline_html; |
| 332 | } elsif ($cmd eq "-html5") { | ||
| 333 | $output_mode = "html5"; | ||
| 334 | %highlights = %highlights_html5; | ||
| 335 | $blankline = $blankline_html5; | ||
| 336 | } elsif ($cmd eq "-man") { | 312 | } elsif ($cmd eq "-man") { |
| 337 | $output_mode = "man"; | 313 | $output_mode = "man"; |
| 338 | %highlights = %highlights_man; | 314 | %highlights = %highlights_man; |
| @@ -375,11 +351,10 @@ while ($ARGV[0] =~ m/^-(.*)/) { | |||
| 375 | # continue execution near EOF; | 351 | # continue execution near EOF; |
| 376 | 352 | ||
| 377 | sub usage { | 353 | sub usage { |
| 378 | print "Usage: $0 [ -docbook | -html | -html5 | -text | -man | -list ]\n"; | 354 | print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n"; |
| 379 | print " [ -no-doc-sections ]\n"; | 355 | print " [ -no-doc-sections ]\n"; |
| 380 | print " [ -function funcname [ -function funcname ...] ]\n"; | 356 | print " [ -function funcname [ -function funcname ...] ]\n"; |
| 381 | print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; | 357 | print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; |
| 382 | print " [ -v ]\n"; | ||
| 383 | print " c source file(s) > outputfile\n"; | 358 | print " c source file(s) > outputfile\n"; |
| 384 | print " -v : verbose output, more warnings & other info listed\n"; | 359 | print " -v : verbose output, more warnings & other info listed\n"; |
| 385 | exit 1; | 360 | exit 1; |
| @@ -473,8 +448,7 @@ sub output_highlight { | |||
| 473 | # confess "output_highlight got called with no args?\n"; | 448 | # confess "output_highlight got called with no args?\n"; |
| 474 | # } | 449 | # } |
| 475 | 450 | ||
| 476 | if ($output_mode eq "html" || $output_mode eq "html5" || | 451 | if ($output_mode eq "html" || $output_mode eq "xml") { |
| 477 | $output_mode eq "xml") { | ||
| 478 | $contents = local_unescape($contents); | 452 | $contents = local_unescape($contents); |
| 479 | # convert data read & converted thru xml_escape() into &xyz; format: | 453 | # convert data read & converted thru xml_escape() into &xyz; format: |
| 480 | $contents =~ s/\\\\\\/\&/g; | 454 | $contents =~ s/\\\\\\/\&/g; |
| @@ -484,19 +458,9 @@ sub output_highlight { | |||
| 484 | die $@ if $@; | 458 | die $@ if $@; |
| 485 | # print STDERR "contents af:$contents\n"; | 459 | # print STDERR "contents af:$contents\n"; |
| 486 | 460 | ||
| 487 | # strip whitespaces when generating html5 | ||
| 488 | if ($output_mode eq "html5") { | ||
| 489 | $contents =~ s/^\s+//; | ||
| 490 | $contents =~ s/\s+$//; | ||
| 491 | } | ||
| 492 | foreach $line (split "\n", $contents) { | 461 | foreach $line (split "\n", $contents) { |
| 493 | if (! $output_preformatted) { | ||
| 494 | $line =~ s/^\s*//; | ||
| 495 | } | ||
| 496 | if ($line eq ""){ | 462 | if ($line eq ""){ |
| 497 | if (! $output_preformatted) { | 463 | print $lineprefix, local_unescape($blankline); |
| 498 | print $lineprefix, local_unescape($blankline); | ||
| 499 | } | ||
| 500 | } else { | 464 | } else { |
| 501 | $line =~ s/\\\\\\/\&/g; | 465 | $line =~ s/\\\\\\/\&/g; |
| 502 | if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { | 466 | if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { |
| @@ -509,7 +473,7 @@ sub output_highlight { | |||
| 509 | } | 473 | } |
| 510 | } | 474 | } |
| 511 | 475 | ||
| 512 | # output sections in html | 476 | #output sections in html |
| 513 | sub output_section_html(%) { | 477 | sub output_section_html(%) { |
| 514 | my %args = %{$_[0]}; | 478 | my %args = %{$_[0]}; |
| 515 | my $section; | 479 | my $section; |
| @@ -669,239 +633,6 @@ sub output_blockhead_html(%) { | |||
| 669 | print "<hr>\n"; | 633 | print "<hr>\n"; |
| 670 | } | 634 | } |
| 671 | 635 | ||
| 672 | # output sections in html5 | ||
| 673 | sub output_section_html5(%) { | ||
| 674 | my %args = %{$_[0]}; | ||
| 675 | my $section; | ||
| 676 | |||
| 677 | foreach $section (@{$args{'sectionlist'}}) { | ||
| 678 | print "<section>\n"; | ||
| 679 | print "<h1>$section</h1>\n"; | ||
| 680 | print "<p>\n"; | ||
| 681 | output_highlight($args{'sections'}{$section}); | ||
| 682 | print "</p>\n"; | ||
| 683 | print "</section>\n"; | ||
| 684 | } | ||
| 685 | } | ||
| 686 | |||
| 687 | # output enum in html5 | ||
| 688 | sub output_enum_html5(%) { | ||
| 689 | my %args = %{$_[0]}; | ||
| 690 | my ($parameter); | ||
| 691 | my $count; | ||
| 692 | my $html5id; | ||
| 693 | |||
| 694 | $html5id = $args{'enum'}; | ||
| 695 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 696 | print "<article class=\"enum\" id=\"enum:". $html5id . "\">"; | ||
| 697 | print "<h1>enum " . $args{'enum'} . "</h1>\n"; | ||
| 698 | print "<ol class=\"code\">\n"; | ||
| 699 | print "<li>"; | ||
| 700 | print "<span class=\"keyword\">enum</span> "; | ||
| 701 | print "<span class=\"identifier\">" . $args{'enum'} . "</span> {"; | ||
| 702 | print "</li>\n"; | ||
| 703 | $count = 0; | ||
| 704 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 705 | print "<li class=\"indent\">"; | ||
| 706 | print "<span class=\"param\">" . $parameter . "</span>"; | ||
| 707 | if ($count != $#{$args{'parameterlist'}}) { | ||
| 708 | $count++; | ||
| 709 | print ","; | ||
| 710 | } | ||
| 711 | print "</li>\n"; | ||
| 712 | } | ||
| 713 | print "<li>};</li>\n"; | ||
| 714 | print "</ol>\n"; | ||
| 715 | |||
| 716 | print "<section>\n"; | ||
| 717 | print "<h1>Constants</h1>\n"; | ||
| 718 | print "<dl>\n"; | ||
| 719 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 720 | print "<dt>" . $parameter . "</dt>\n"; | ||
| 721 | print "<dd>"; | ||
| 722 | output_highlight($args{'parameterdescs'}{$parameter}); | ||
| 723 | print "</dd>\n"; | ||
| 724 | } | ||
| 725 | print "</dl>\n"; | ||
| 726 | print "</section>\n"; | ||
| 727 | output_section_html5(@_); | ||
| 728 | print "</article>\n"; | ||
| 729 | } | ||
| 730 | |||
| 731 | # output typedef in html5 | ||
| 732 | sub output_typedef_html5(%) { | ||
| 733 | my %args = %{$_[0]}; | ||
| 734 | my ($parameter); | ||
| 735 | my $count; | ||
| 736 | my $html5id; | ||
| 737 | |||
| 738 | $html5id = $args{'typedef'}; | ||
| 739 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 740 | print "<article class=\"typedef\" id=\"typedef:" . $html5id . "\">\n"; | ||
| 741 | print "<h1>typedef " . $args{'typedef'} . "</h1>\n"; | ||
| 742 | |||
| 743 | print "<ol class=\"code\">\n"; | ||
| 744 | print "<li>"; | ||
| 745 | print "<span class=\"keyword\">typedef</span> "; | ||
| 746 | print "<span class=\"identifier\">" . $args{'typedef'} . "</span>"; | ||
| 747 | print "</li>\n"; | ||
| 748 | print "</ol>\n"; | ||
| 749 | output_section_html5(@_); | ||
| 750 | print "</article>\n"; | ||
| 751 | } | ||
| 752 | |||
| 753 | # output struct in html5 | ||
| 754 | sub output_struct_html5(%) { | ||
| 755 | my %args = %{$_[0]}; | ||
| 756 | my ($parameter); | ||
| 757 | my $html5id; | ||
| 758 | |||
| 759 | $html5id = $args{'struct'}; | ||
| 760 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 761 | print "<article class=\"struct\" id=\"struct:" . $html5id . "\">\n"; | ||
| 762 | print "<hgroup>\n"; | ||
| 763 | print "<h1>" . $args{'type'} . " " . $args{'struct'} . "</h1>"; | ||
| 764 | print "<h2>". $args{'purpose'} . "</h2>\n"; | ||
| 765 | print "</hgroup>\n"; | ||
| 766 | print "<ol class=\"code\">\n"; | ||
| 767 | print "<li>"; | ||
| 768 | print "<span class=\"type\">" . $args{'type'} . "</span> "; | ||
| 769 | print "<span class=\"identifier\">" . $args{'struct'} . "</span> {"; | ||
| 770 | print "</li>\n"; | ||
| 771 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 772 | print "<li class=\"indent\">"; | ||
| 773 | if ($parameter =~ /^#/) { | ||
| 774 | print "<span class=\"param\">" . $parameter ."</span>\n"; | ||
| 775 | print "</li>\n"; | ||
| 776 | next; | ||
| 777 | } | ||
| 778 | my $parameter_name = $parameter; | ||
| 779 | $parameter_name =~ s/\[.*//; | ||
| 780 | |||
| 781 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | ||
| 782 | $type = $args{'parametertypes'}{$parameter}; | ||
| 783 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | ||
| 784 | # pointer-to-function | ||
| 785 | print "<span class=\"type\">$1</span> "; | ||
| 786 | print "<span class=\"param\">$parameter</span>"; | ||
| 787 | print "<span class=\"type\">)</span> "; | ||
| 788 | print "(<span class=\"args\">$2</span>);"; | ||
| 789 | } elsif ($type =~ m/^(.*?)\s*(:.*)/) { | ||
| 790 | # bitfield | ||
| 791 | print "<span class=\"type\">$1</span> "; | ||
| 792 | print "<span class=\"param\">$parameter</span>"; | ||
| 793 | print "<span class=\"bits\">$2</span>;"; | ||
| 794 | } else { | ||
| 795 | print "<span class=\"type\">$type</span> "; | ||
| 796 | print "<span class=\"param\">$parameter</span>;"; | ||
| 797 | } | ||
| 798 | print "</li>\n"; | ||
| 799 | } | ||
| 800 | print "<li>};</li>\n"; | ||
| 801 | print "</ol>\n"; | ||
| 802 | |||
| 803 | print "<section>\n"; | ||
| 804 | print "<h1>Members</h1>\n"; | ||
| 805 | print "<dl>\n"; | ||
| 806 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 807 | ($parameter =~ /^#/) && next; | ||
| 808 | |||
| 809 | my $parameter_name = $parameter; | ||
| 810 | $parameter_name =~ s/\[.*//; | ||
| 811 | |||
| 812 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | ||
| 813 | print "<dt>" . $parameter . "</dt>\n"; | ||
| 814 | print "<dd>"; | ||
| 815 | output_highlight($args{'parameterdescs'}{$parameter_name}); | ||
| 816 | print "</dd>\n"; | ||
| 817 | } | ||
| 818 | print "</dl>\n"; | ||
| 819 | print "</section>\n"; | ||
| 820 | output_section_html5(@_); | ||
| 821 | print "</article>\n"; | ||
| 822 | } | ||
| 823 | |||
| 824 | # output function in html5 | ||
| 825 | sub output_function_html5(%) { | ||
| 826 | my %args = %{$_[0]}; | ||
| 827 | my ($parameter, $section); | ||
| 828 | my $count; | ||
| 829 | my $html5id; | ||
| 830 | |||
| 831 | $html5id = $args{'function'}; | ||
| 832 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 833 | print "<article class=\"function\" id=\"func:". $html5id . "\">\n"; | ||
| 834 | print "<hgroup>\n"; | ||
| 835 | print "<h1>" . $args{'function'} . "</h1>"; | ||
| 836 | print "<h2>" . $args{'purpose'} . "</h2>\n"; | ||
| 837 | print "</hgroup>\n"; | ||
| 838 | print "<ol class=\"code\">\n"; | ||
| 839 | print "<li>"; | ||
| 840 | print "<span class=\"type\">" . $args{'functiontype'} . "</span> "; | ||
| 841 | print "<span class=\"identifier\">" . $args{'function'} . "</span> ("; | ||
| 842 | print "</li>"; | ||
| 843 | $count = 0; | ||
| 844 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 845 | print "<li class=\"indent\">"; | ||
| 846 | $type = $args{'parametertypes'}{$parameter}; | ||
| 847 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | ||
| 848 | # pointer-to-function | ||
| 849 | print "<span class=\"type\">$1</span> "; | ||
| 850 | print "<span class=\"param\">$parameter</span>"; | ||
| 851 | print "<span class=\"type\">)</span> "; | ||
| 852 | print "(<span class=\"args\">$2</span>)"; | ||
| 853 | } else { | ||
| 854 | print "<span class=\"type\">$type</span> "; | ||
| 855 | print "<span class=\"param\">$parameter</span>"; | ||
| 856 | } | ||
| 857 | if ($count != $#{$args{'parameterlist'}}) { | ||
| 858 | $count++; | ||
| 859 | print ","; | ||
| 860 | } | ||
| 861 | print "</li>\n"; | ||
| 862 | } | ||
| 863 | print "<li>)</li>\n"; | ||
| 864 | print "</ol>\n"; | ||
| 865 | |||
| 866 | print "<section>\n"; | ||
| 867 | print "<h1>Arguments</h1>\n"; | ||
| 868 | print "<p>\n"; | ||
| 869 | print "<dl>\n"; | ||
| 870 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 871 | my $parameter_name = $parameter; | ||
| 872 | $parameter_name =~ s/\[.*//; | ||
| 873 | |||
| 874 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | ||
| 875 | print "<dt>" . $parameter . "</dt>\n"; | ||
| 876 | print "<dd>"; | ||
| 877 | output_highlight($args{'parameterdescs'}{$parameter_name}); | ||
| 878 | print "</dd>\n"; | ||
| 879 | } | ||
| 880 | print "</dl>\n"; | ||
| 881 | print "</section>\n"; | ||
| 882 | output_section_html5(@_); | ||
| 883 | print "</article>\n"; | ||
| 884 | } | ||
| 885 | |||
| 886 | # output DOC: block header in html5 | ||
| 887 | sub output_blockhead_html5(%) { | ||
| 888 | my %args = %{$_[0]}; | ||
| 889 | my ($parameter, $section); | ||
| 890 | my $count; | ||
| 891 | my $html5id; | ||
| 892 | |||
| 893 | foreach $section (@{$args{'sectionlist'}}) { | ||
| 894 | $html5id = $section; | ||
| 895 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 896 | print "<article class=\"doc\" id=\"doc:". $html5id . "\">\n"; | ||
| 897 | print "<h1>$section</h1>\n"; | ||
| 898 | print "<p>\n"; | ||
| 899 | output_highlight($args{'sections'}{$section}); | ||
| 900 | print "</p>\n"; | ||
| 901 | } | ||
| 902 | print "</article>\n"; | ||
| 903 | } | ||
| 904 | |||
| 905 | sub output_section_xml(%) { | 636 | sub output_section_xml(%) { |
| 906 | my %args = %{$_[0]}; | 637 | my %args = %{$_[0]}; |
| 907 | my $section; | 638 | my $section; |
| @@ -912,12 +643,10 @@ sub output_section_xml(%) { | |||
| 912 | print "<title>$section</title>\n"; | 643 | print "<title>$section</title>\n"; |
| 913 | if ($section =~ m/EXAMPLE/i) { | 644 | if ($section =~ m/EXAMPLE/i) { |
| 914 | print "<informalexample><programlisting>\n"; | 645 | print "<informalexample><programlisting>\n"; |
| 915 | $output_preformatted = 1; | ||
| 916 | } else { | 646 | } else { |
| 917 | print "<para>\n"; | 647 | print "<para>\n"; |
| 918 | } | 648 | } |
| 919 | output_highlight($args{'sections'}{$section}); | 649 | output_highlight($args{'sections'}{$section}); |
| 920 | $output_preformatted = 0; | ||
| 921 | if ($section =~ m/EXAMPLE/i) { | 650 | if ($section =~ m/EXAMPLE/i) { |
| 922 | print "</programlisting></informalexample>\n"; | 651 | print "</programlisting></informalexample>\n"; |
| 923 | } else { | 652 | } else { |
| @@ -1220,12 +949,10 @@ sub output_blockhead_xml(%) { | |||
| 1220 | } | 949 | } |
| 1221 | if ($section =~ m/EXAMPLE/i) { | 950 | if ($section =~ m/EXAMPLE/i) { |
| 1222 | print "<example><para>\n"; | 951 | print "<example><para>\n"; |
| 1223 | $output_preformatted = 1; | ||
| 1224 | } else { | 952 | } else { |
| 1225 | print "<para>\n"; | 953 | print "<para>\n"; |
| 1226 | } | 954 | } |
| 1227 | output_highlight($args{'sections'}{$section}); | 955 | output_highlight($args{'sections'}{$section}); |
| 1228 | $output_preformatted = 0; | ||
| 1229 | if ($section =~ m/EXAMPLE/i) { | 956 | if ($section =~ m/EXAMPLE/i) { |
| 1230 | print "</para></example>\n"; | 957 | print "</para></example>\n"; |
| 1231 | } else { | 958 | } else { |
| @@ -1301,12 +1028,10 @@ sub output_function_gnome { | |||
| 1301 | print "<simplesect>\n <title>$section</title>\n"; | 1028 | print "<simplesect>\n <title>$section</title>\n"; |
| 1302 | if ($section =~ m/EXAMPLE/i) { | 1029 | if ($section =~ m/EXAMPLE/i) { |
| 1303 | print "<example><programlisting>\n"; | 1030 | print "<example><programlisting>\n"; |
| 1304 | $output_preformatted = 1; | ||
| 1305 | } else { | 1031 | } else { |
| 1306 | } | 1032 | } |
| 1307 | print "<para>\n"; | 1033 | print "<para>\n"; |
| 1308 | output_highlight($args{'sections'}{$section}); | 1034 | output_highlight($args{'sections'}{$section}); |
| 1309 | $output_preformatted = 0; | ||
| 1310 | print "</para>\n"; | 1035 | print "</para>\n"; |
| 1311 | if ($section =~ m/EXAMPLE/i) { | 1036 | if ($section =~ m/EXAMPLE/i) { |
| 1312 | print "</programlisting></example>\n"; | 1037 | print "</programlisting></example>\n"; |
| @@ -2042,28 +1767,6 @@ sub check_sections($$$$$$) { | |||
| 2042 | } | 1767 | } |
| 2043 | 1768 | ||
| 2044 | ## | 1769 | ## |
| 2045 | # Checks the section describing the return value of a function. | ||
| 2046 | sub check_return_section { | ||
| 2047 | my $file = shift; | ||
| 2048 | my $declaration_name = shift; | ||
| 2049 | my $return_type = shift; | ||
| 2050 | |||
| 2051 | # Ignore an empty return type (It's a macro) | ||
| 2052 | # Ignore functions with a "void" return type. (But don't ignore "void *") | ||
| 2053 | if (($return_type eq "") || ($return_type =~ /void\s*\w*\s*$/)) { | ||
| 2054 | return; | ||
| 2055 | } | ||
| 2056 | |||
| 2057 | if (!defined($sections{$section_return}) || | ||
| 2058 | $sections{$section_return} eq "") { | ||
| 2059 | print STDERR "Warning(${file}:$.): " . | ||
| 2060 | "No description found for return value of " . | ||
| 2061 | "'$declaration_name'\n"; | ||
| 2062 | ++$warnings; | ||
| 2063 | } | ||
| 2064 | } | ||
| 2065 | |||
| 2066 | ## | ||
| 2067 | # takes a function prototype and the name of the current file being | 1770 | # takes a function prototype and the name of the current file being |
| 2068 | # processed and spits out all the details stored in the global | 1771 | # processed and spits out all the details stored in the global |
| 2069 | # arrays/hashes. | 1772 | # arrays/hashes. |
| @@ -2079,10 +1782,9 @@ sub dump_function($$) { | |||
| 2079 | $prototype =~ s/^__inline +//; | 1782 | $prototype =~ s/^__inline +//; |
| 2080 | $prototype =~ s/^__always_inline +//; | 1783 | $prototype =~ s/^__always_inline +//; |
| 2081 | $prototype =~ s/^noinline +//; | 1784 | $prototype =~ s/^noinline +//; |
| 1785 | $prototype =~ s/__devinit +//; | ||
| 2082 | $prototype =~ s/__init +//; | 1786 | $prototype =~ s/__init +//; |
| 2083 | $prototype =~ s/__init_or_module +//; | 1787 | $prototype =~ s/__init_or_module +//; |
| 2084 | $prototype =~ s/__must_check +//; | ||
| 2085 | $prototype =~ s/__weak +//; | ||
| 2086 | $prototype =~ s/^#\s*define\s+//; #ak added | 1788 | $prototype =~ s/^#\s*define\s+//; #ak added |
| 2087 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; | 1789 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; |
| 2088 | 1790 | ||
| @@ -2133,15 +1835,6 @@ sub dump_function($$) { | |||
| 2133 | my $prms = join " ", @parameterlist; | 1835 | my $prms = join " ", @parameterlist; |
| 2134 | check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); | 1836 | check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); |
| 2135 | 1837 | ||
| 2136 | # This check emits a lot of warnings at the moment, because many | ||
| 2137 | # functions don't have a 'Return' doc section. So until the number | ||
| 2138 | # of warnings goes sufficiently down, the check is only performed in | ||
| 2139 | # verbose mode. | ||
| 2140 | # TODO: always perform the check. | ||
| 2141 | if ($verbose) { | ||
| 2142 | check_return_section($file, $declaration_name, $return_type); | ||
| 2143 | } | ||
| 2144 | |||
| 2145 | output_declaration($declaration_name, | 1838 | output_declaration($declaration_name, |
| 2146 | 'function', | 1839 | 'function', |
| 2147 | {'function' => $declaration_name, | 1840 | {'function' => $declaration_name, |
| @@ -2351,9 +2044,6 @@ sub process_file($) { | |||
| 2351 | 2044 | ||
| 2352 | $section_counter = 0; | 2045 | $section_counter = 0; |
| 2353 | while (<IN>) { | 2046 | while (<IN>) { |
| 2354 | while (s/\\\s*$//) { | ||
| 2355 | $_ .= <IN>; | ||
| 2356 | } | ||
| 2357 | if ($state == 0) { | 2047 | if ($state == 0) { |
| 2358 | if (/$doc_start/o) { | 2048 | if (/$doc_start/o) { |
| 2359 | $state = 1; # next line is always the function name | 2049 | $state = 1; # next line is always the function name |
| @@ -2381,7 +2071,7 @@ sub process_file($) { | |||
| 2381 | $descr= $1; | 2071 | $descr= $1; |
| 2382 | $descr =~ s/^\s*//; | 2072 | $descr =~ s/^\s*//; |
| 2383 | $descr =~ s/\s*$//; | 2073 | $descr =~ s/\s*$//; |
| 2384 | $descr =~ s/\s+/ /g; | 2074 | $descr =~ s/\s+/ /; |
| 2385 | $declaration_purpose = xml_escape($descr); | 2075 | $declaration_purpose = xml_escape($descr); |
| 2386 | $in_purpose = 1; | 2076 | $in_purpose = 1; |
| 2387 | } else { | 2077 | } else { |
| @@ -2473,7 +2163,6 @@ sub process_file($) { | |||
| 2473 | # Continued declaration purpose | 2163 | # Continued declaration purpose |
| 2474 | chomp($declaration_purpose); | 2164 | chomp($declaration_purpose); |
| 2475 | $declaration_purpose .= " " . xml_escape($1); | 2165 | $declaration_purpose .= " " . xml_escape($1); |
| 2476 | $declaration_purpose =~ s/\s+/ /g; | ||
| 2477 | } else { | 2166 | } else { |
| 2478 | $contents .= $1 . "\n"; | 2167 | $contents .= $1 . "\n"; |
| 2479 | } | 2168 | } |
