kernel-doc (c099ff6989baf286da8eaed5c7b3d18ae60ea2e7) kernel-doc (13901ef27c354e1bab49a30184ae3b96d96e521a)
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-2012 Randy Dunlap ##

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

391 # proper kernel-doc and ignore the rest.
392};
393my $inline_doc_state;
394
395#declaration types: can be
396# 'function', 'struct', 'union', 'enum', 'typedef'
397my $decl_type;
398
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-2012 Randy Dunlap ##

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

391 # proper kernel-doc and ignore the rest.
392};
393my $inline_doc_state;
394
395#declaration types: can be
396# 'function', 'struct', 'union', 'enum', 'typedef'
397my $decl_type;
398
399my $doc_special = "\@\%\$\&";
400
401my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
402my $doc_end = '\*/';
403my $doc_com = '\s*\*\s*';
404my $doc_com_body = '\s*\* ?';
405my $doc_decl = $doc_com . '(\w+)';
399my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
400my $doc_end = '\*/';
401my $doc_com = '\s*\*\s*';
402my $doc_com_body = '\s*\* ?';
403my $doc_decl = $doc_com . '(\w+)';
406my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)';
404my $doc_sect = $doc_com . '(\@?[\w\s]+):(.*)';
407my $doc_content = $doc_com_body . '(.*)';
408my $doc_block = $doc_com . 'DOC:\s*(.*)?';
409my $doc_inline_start = '^\s*/\*\*\s*$';
410my $doc_inline_sect = '\s*\*\s*(@[\w\s]+):(.*)';
411my $doc_inline_end = '^\s*\*/\s*$';
412my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
413
405my $doc_content = $doc_com_body . '(.*)';
406my $doc_block = $doc_com . 'DOC:\s*(.*)?';
407my $doc_inline_start = '^\s*/\*\*\s*$';
408my $doc_inline_sect = '\s*\*\s*(@[\w\s]+):(.*)';
409my $doc_inline_end = '^\s*\*/\s*$';
410my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
411
414my %constants;
415my %parameterdescs;
416my @parameterlist;
417my %sections;
418my @sectionlist;
419my $sectcheck;
420my $struct_actual;
421
422my $contents = "";

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

506##
507# dumps section contents to arrays/hashes intended for that purpose.
508#
509sub dump_section {
510 my $file = shift;
511 my $name = shift;
512 my $contents = join "\n", @_;
513
412my %parameterdescs;
413my @parameterlist;
414my %sections;
415my @sectionlist;
416my $sectcheck;
417my $struct_actual;
418
419my $contents = "";

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

503##
504# dumps section contents to arrays/hashes intended for that purpose.
505#
506sub dump_section {
507 my $file = shift;
508 my $name = shift;
509 my $contents = join "\n", @_;
510
514 if ($name =~ m/$type_constant/) {
515 $name = $1;
516# print STDERR "constant section '$1' = '$contents'\n";
517 $constants{$name} = $contents;
518 } elsif ($name =~ m/$type_param/) {
511 if ($name =~ m/$type_param/) {
519# print STDERR "parameter def '$1' = '$contents'\n";
520 $name = $1;
521 $parameterdescs{$name} = $contents;
522 $sectcheck = $sectcheck . $name . " ";
523 } elsif ($name eq "@\.\.\.") {
524# print STDERR "parameter def '...' = '$contents'\n";
525 $name = "...";
526 $parameterdescs{$name} = $contents;

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

2523 'sectionlist' => \@sectionlist,
2524 'sections' => \%sections,
2525 'purpose' => $declaration_purpose
2526 });
2527}
2528
2529sub reset_state {
2530 $function = "";
512# print STDERR "parameter def '$1' = '$contents'\n";
513 $name = $1;
514 $parameterdescs{$name} = $contents;
515 $sectcheck = $sectcheck . $name . " ";
516 } elsif ($name eq "@\.\.\.") {
517# print STDERR "parameter def '...' = '$contents'\n";
518 $name = "...";
519 $parameterdescs{$name} = $contents;

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

2516 'sectionlist' => \@sectionlist,
2517 'sections' => \%sections,
2518 'purpose' => $declaration_purpose
2519 });
2520}
2521
2522sub reset_state {
2523 $function = "";
2531 %constants = ();
2532 %parameterdescs = ();
2533 %parametertypes = ();
2534 @parameterlist = ();
2535 %sections = ();
2536 @sectionlist = ();
2537 $sectcheck = "";
2538 $struct_actual = "";
2539 $prototype = "";

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

2919 process_state3_type($_, $file);
2920 }
2921 } elsif ($state == STATE_DOCBLOCK) {
2922 # Documentation block
2923 if (/$doc_block/) {
2924 dump_doc_section($file, $section, xml_escape($contents));
2925 $contents = "";
2926 $function = "";
2524 %parameterdescs = ();
2525 %parametertypes = ();
2526 @parameterlist = ();
2527 %sections = ();
2528 @sectionlist = ();
2529 $sectcheck = "";
2530 $struct_actual = "";
2531 $prototype = "";

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

2911 process_state3_type($_, $file);
2912 }
2913 } elsif ($state == STATE_DOCBLOCK) {
2914 # Documentation block
2915 if (/$doc_block/) {
2916 dump_doc_section($file, $section, xml_escape($contents));
2917 $contents = "";
2918 $function = "";
2927 %constants = ();
2928 %parameterdescs = ();
2929 %parametertypes = ();
2930 @parameterlist = ();
2931 %sections = ();
2932 @sectionlist = ();
2933 $prototype = "";
2934 if ( $1 eq "" ) {
2935 $section = $section_intro;
2936 } else {
2937 $section = $1;
2938 }
2939 }
2940 elsif (/$doc_end/)
2941 {
2942 dump_doc_section($file, $section, xml_escape($contents));
2943 $contents = "";
2944 $function = "";
2919 %parameterdescs = ();
2920 %parametertypes = ();
2921 @parameterlist = ();
2922 %sections = ();
2923 @sectionlist = ();
2924 $prototype = "";
2925 if ( $1 eq "" ) {
2926 $section = $section_intro;
2927 } else {
2928 $section = $1;
2929 }
2930 }
2931 elsif (/$doc_end/)
2932 {
2933 dump_doc_section($file, $section, xml_escape($contents));
2934 $contents = "";
2935 $function = "";
2945 %constants = ();
2946 %parameterdescs = ();
2947 %parametertypes = ();
2948 @parameterlist = ();
2949 %sections = ();
2950 @sectionlist = ();
2951 $prototype = "";
2952 $state = STATE_NORMAL;
2953 }

--- 86 unchanged lines hidden ---
2936 %parameterdescs = ();
2937 %parametertypes = ();
2938 @parameterlist = ();
2939 %sections = ();
2940 @sectionlist = ();
2941 $prototype = "";
2942 $state = STATE_NORMAL;
2943 }

--- 86 unchanged lines hidden ---