kernel-doc (f838bad1b3be8ca0c785ee0e0c570dfda74cf377) kernel-doc (94dc7ad5502e7d74e2fd74651743f5f1773aa1fe)
1#!/usr/bin/perl -w
2
3use strict;
4
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ##
1#!/usr/bin/perl -w
2
3use strict;
4
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ##
8## Copyright (C) 2005-2007 Randy Dunlap ##
8## Copyright (C) 2005-2008 Randy Dunlap ##
9## ##
10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
11## Copyright (c) 2000 MontaVista Software, Inc. ##
12## ##
13## This software falls under the GNU General Public License. ##
14## Please read the COPYING file for more information ##
15
16# w.o. 03-11-2000: added the '-filelist' option.

--- 344 unchanged lines hidden (view full) ---

361# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
362 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
363}
364
365##
366# dumps section contents to arrays/hashes intended for that purpose.
367#
368sub dump_section {
9## ##
10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
11## Copyright (c) 2000 MontaVista Software, Inc. ##
12## ##
13## This software falls under the GNU General Public License. ##
14## Please read the COPYING file for more information ##
15
16# w.o. 03-11-2000: added the '-filelist' option.

--- 344 unchanged lines hidden (view full) ---

361# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
362 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
363}
364
365##
366# dumps section contents to arrays/hashes intended for that purpose.
367#
368sub dump_section {
369 my $file = shift;
369 my $name = shift;
370 my $contents = join "\n", @_;
371
372 if ($name =~ m/$type_constant/) {
373 $name = $1;
374# print STDERR "constant section '$1' = '$contents'\n";
375 $constants{$name} = $contents;
376 } elsif ($name =~ m/$type_param/) {
377# print STDERR "parameter def '$1' = '$contents'\n";
378 $name = $1;
379 $parameterdescs{$name} = $contents;
380 } else {
381# print STDERR "other section '$name' = '$contents'\n";
370 my $name = shift;
371 my $contents = join "\n", @_;
372
373 if ($name =~ m/$type_constant/) {
374 $name = $1;
375# print STDERR "constant section '$1' = '$contents'\n";
376 $constants{$name} = $contents;
377 } elsif ($name =~ m/$type_param/) {
378# print STDERR "parameter def '$1' = '$contents'\n";
379 $name = $1;
380 $parameterdescs{$name} = $contents;
381 } else {
382# print STDERR "other section '$name' = '$contents'\n";
383 if (defined($sections{$name}) && ($sections{$name} ne "")) {
384 print STDERR "Error(${file}:$.): duplicate section name '$name'\n";
385 ++$errors;
386 }
382 $sections{$name} = $contents;
383 push @sectionlist, $name;
384 }
385}
386
387##
388# dump DOC: section after checking that it should go out
389#
390sub dump_doc_section {
387 $sections{$name} = $contents;
388 push @sectionlist, $name;
389 }
390}
391
392##
393# dump DOC: section after checking that it should go out
394#
395sub dump_doc_section {
396 my $file = shift;
391 my $name = shift;
392 my $contents = join "\n", @_;
393
394 if ($no_doc_sections) {
395 return;
396 }
397
398 if (($function_only == 0) ||
399 ( $function_only == 1 && defined($function_table{$name})) ||
400 ( $function_only == 2 && !defined($function_table{$name})))
401 {
397 my $name = shift;
398 my $contents = join "\n", @_;
399
400 if ($no_doc_sections) {
401 return;
402 }
403
404 if (($function_only == 0) ||
405 ( $function_only == 1 && defined($function_table{$name})) ||
406 ( $function_only == 2 && !defined($function_table{$name})))
407 {
402 dump_section $name, $contents;
408 dump_section($file, $name, $contents);
403 output_blockhead({'sectionlist' => \@sectionlist,
404 'sections' => \%sections,
405 'module' => $modulename,
406 'content-only' => ($function_only != 0), });
407 }
408}
409
410##

--- 1507 unchanged lines hidden (view full) ---

1918 $newsection = $1;
1919 $newcontents = $2;
1920
1921 if (($contents ne "") && ($contents ne "\n")) {
1922 if (!$in_doc_sect && $verbose) {
1923 print STDERR "Warning(${file}:$.): contents before sections\n";
1924 ++$warnings;
1925 }
409 output_blockhead({'sectionlist' => \@sectionlist,
410 'sections' => \%sections,
411 'module' => $modulename,
412 'content-only' => ($function_only != 0), });
413 }
414}
415
416##

--- 1507 unchanged lines hidden (view full) ---

1924 $newsection = $1;
1925 $newcontents = $2;
1926
1927 if (($contents ne "") && ($contents ne "\n")) {
1928 if (!$in_doc_sect && $verbose) {
1929 print STDERR "Warning(${file}:$.): contents before sections\n";
1930 ++$warnings;
1931 }
1926 dump_section($section, xml_escape($contents));
1932 dump_section($file, $section, xml_escape($contents));
1927 $section = $section_default;
1928 }
1929
1930 $in_doc_sect = 1;
1931 $contents = $newcontents;
1932 if ($contents ne "") {
1933 while ((substr($contents, 0, 1) eq " ") ||
1934 substr($contents, 0, 1) eq "\t") {
1935 $contents = substr($contents, 1);
1936 }
1937 $contents .= "\n";
1938 }
1939 $section = $newsection;
1940 } elsif (/$doc_end/) {
1941
1942 if ($contents ne "") {
1933 $section = $section_default;
1934 }
1935
1936 $in_doc_sect = 1;
1937 $contents = $newcontents;
1938 if ($contents ne "") {
1939 while ((substr($contents, 0, 1) eq " ") ||
1940 substr($contents, 0, 1) eq "\t") {
1941 $contents = substr($contents, 1);
1942 }
1943 $contents .= "\n";
1944 }
1945 $section = $newsection;
1946 } elsif (/$doc_end/) {
1947
1948 if ($contents ne "") {
1943 dump_section($section, xml_escape($contents));
1949 dump_section($file, $section, xml_escape($contents));
1944 $section = $section_default;
1945 $contents = "";
1946 }
1947
1948 $prototype = "";
1949 $state = 3;
1950 $brcount = 0;
1951# print STDERR "end of doc comment, looking for prototype\n";
1952 } elsif (/$doc_content/) {
1953 # miguel-style comment kludge, look for blank lines after
1954 # @parameter line to signify start of description
1955 if ($1 eq "" &&
1956 ($section =~ m/^@/ || $section eq $section_context)) {
1950 $section = $section_default;
1951 $contents = "";
1952 }
1953
1954 $prototype = "";
1955 $state = 3;
1956 $brcount = 0;
1957# print STDERR "end of doc comment, looking for prototype\n";
1958 } elsif (/$doc_content/) {
1959 # miguel-style comment kludge, look for blank lines after
1960 # @parameter line to signify start of description
1961 if ($1 eq "" &&
1962 ($section =~ m/^@/ || $section eq $section_context)) {
1957 dump_section($section, xml_escape($contents));
1963 dump_section($file, $section, xml_escape($contents));
1958 $section = $section_default;
1959 $contents = "";
1960 } else {
1961 $contents .= $1."\n";
1962 }
1963 } else {
1964 # i dont know - bad line? ignore.
1965 print STDERR "Warning(${file}:$.): bad line: $_";
1966 ++$warnings;
1967 }
1968 } elsif ($state == 3) { # scanning for function '{' (end of prototype)
1969 if ($decl_type eq 'function') {
1970 process_state3_function($_, $file);
1971 } else {
1972 process_state3_type($_, $file);
1973 }
1974 } elsif ($state == 4) {
1975 # Documentation block
1976 if (/$doc_block/) {
1964 $section = $section_default;
1965 $contents = "";
1966 } else {
1967 $contents .= $1."\n";
1968 }
1969 } else {
1970 # i dont know - bad line? ignore.
1971 print STDERR "Warning(${file}:$.): bad line: $_";
1972 ++$warnings;
1973 }
1974 } elsif ($state == 3) { # scanning for function '{' (end of prototype)
1975 if ($decl_type eq 'function') {
1976 process_state3_function($_, $file);
1977 } else {
1978 process_state3_type($_, $file);
1979 }
1980 } elsif ($state == 4) {
1981 # Documentation block
1982 if (/$doc_block/) {
1977 dump_doc_section($section, xml_escape($contents));
1983 dump_doc_section($file, $section, xml_escape($contents));
1978 $contents = "";
1979 $function = "";
1980 %constants = ();
1981 %parameterdescs = ();
1982 %parametertypes = ();
1983 @parameterlist = ();
1984 %sections = ();
1985 @sectionlist = ();
1986 $prototype = "";
1987 if ( $1 eq "" ) {
1988 $section = $section_intro;
1989 } else {
1990 $section = $1;
1991 }
1992 }
1993 elsif (/$doc_end/)
1994 {
1984 $contents = "";
1985 $function = "";
1986 %constants = ();
1987 %parameterdescs = ();
1988 %parametertypes = ();
1989 @parameterlist = ();
1990 %sections = ();
1991 @sectionlist = ();
1992 $prototype = "";
1993 if ( $1 eq "" ) {
1994 $section = $section_intro;
1995 } else {
1996 $section = $1;
1997 }
1998 }
1999 elsif (/$doc_end/)
2000 {
1995 dump_doc_section($section, xml_escape($contents));
2001 dump_doc_section($file, $section, xml_escape($contents));
1996 $contents = "";
1997 $function = "";
1998 %constants = ();
1999 %parameterdescs = ();
2000 %parametertypes = ();
2001 @parameterlist = ();
2002 %sections = ();
2003 @sectionlist = ();

--- 48 unchanged lines hidden ---
2002 $contents = "";
2003 $function = "";
2004 %constants = ();
2005 %parameterdescs = ();
2006 %parametertypes = ();
2007 @parameterlist = ();
2008 %sections = ();
2009 @sectionlist = ();

--- 48 unchanged lines hidden ---