kernel-doc (48af606ad8912f90e1539621a26e86672976d8ae) kernel-doc (b6c3f456cfed53e9f06f431270c9dcd52010785e)
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 ##

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

307
308my $verbose = 0;
309my $output_mode = "man";
310my $output_preformatted = 0;
311my $no_doc_sections = 0;
312my @highlights = @highlights_man;
313my $blankline = $blankline_man;
314my $modulename = "Kernel API";
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 ##

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

307
308my $verbose = 0;
309my $output_mode = "man";
310my $output_preformatted = 0;
311my $no_doc_sections = 0;
312my @highlights = @highlights_man;
313my $blankline = $blankline_man;
314my $modulename = "Kernel API";
315my $function_only = 0;
315
316use constant {
317 OUTPUT_ALL => 0, # output all symbols and doc sections
318 OUTPUT_INCLUDE => 1, # output only specified symbols
319 OUTPUT_EXCLUDE => 2, # output everything except specified symbols
320 OUTPUT_EXPORTED => 3, # output exported symbols
321 OUTPUT_INTERNAL => 4, # output non-exported symbols
322};
323my $output_selection = OUTPUT_ALL;
316my $show_not_found = 0;
317
318my @build_time;
319if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
320 (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
321 @build_time = gmtime($seconds);
322} else {
323 @build_time = localtime;

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

444 $blankline = $blankline_list;
445 } elsif ($cmd eq "-gnome") {
446 $output_mode = "gnome";
447 @highlights = @highlights_gnome;
448 $blankline = $blankline_gnome;
449 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
450 $modulename = shift @ARGV;
451 } elsif ($cmd eq "-function") { # to only output specific functions
324my $show_not_found = 0;
325
326my @build_time;
327if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
328 (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
329 @build_time = gmtime($seconds);
330} else {
331 @build_time = localtime;

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

452 $blankline = $blankline_list;
453 } elsif ($cmd eq "-gnome") {
454 $output_mode = "gnome";
455 @highlights = @highlights_gnome;
456 $blankline = $blankline_gnome;
457 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
458 $modulename = shift @ARGV;
459 } elsif ($cmd eq "-function") { # to only output specific functions
452 $function_only = 1;
460 $output_selection = OUTPUT_INCLUDE;
453 $function = shift @ARGV;
454 $function_table{$function} = 1;
461 $function = shift @ARGV;
462 $function_table{$function} = 1;
455 } elsif ($cmd eq "-nofunction") { # to only output specific functions
456 $function_only = 2;
463 } elsif ($cmd eq "-nofunction") { # output all except specific functions
464 $output_selection = OUTPUT_EXCLUDE;
457 $function = shift @ARGV;
458 $function_table{$function} = 1;
459 } elsif ($cmd eq "-export") { # only exported symbols
465 $function = shift @ARGV;
466 $function_table{$function} = 1;
467 } elsif ($cmd eq "-export") { # only exported symbols
460 $function_only = 3;
468 $output_selection = OUTPUT_EXPORTED;
461 %function_table = ()
462 } elsif ($cmd eq "-internal") { # only non-exported symbols
469 %function_table = ()
470 } elsif ($cmd eq "-internal") { # only non-exported symbols
463 $function_only = 4;
471 $output_selection = OUTPUT_INTERNAL;
464 %function_table = ()
465 } elsif ($cmd eq "-v") {
466 $verbose = 1;
467 } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
468 usage();
469 } elsif ($cmd eq '-no-doc-sections') {
470 $no_doc_sections = 1;
471 } elsif ($cmd eq '-show-not-found') {

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

525 my $file = shift;
526 my $name = shift;
527 my $contents = join "\n", @_;
528
529 if ($no_doc_sections) {
530 return;
531 }
532
472 %function_table = ()
473 } elsif ($cmd eq "-v") {
474 $verbose = 1;
475 } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
476 usage();
477 } elsif ($cmd eq '-no-doc-sections') {
478 $no_doc_sections = 1;
479 } elsif ($cmd eq '-show-not-found') {

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

533 my $file = shift;
534 my $name = shift;
535 my $contents = join "\n", @_;
536
537 if ($no_doc_sections) {
538 return;
539 }
540
533 if (($function_only == 0) ||
534 ( $function_only == 1 && defined($function_table{$name})) ||
535 ( $function_only == 2 && !defined($function_table{$name})))
541 if (($output_selection == OUTPUT_ALL) ||
542 ($output_selection == OUTPUT_INCLUDE &&
543 defined($function_table{$name})) ||
544 ($output_selection == OUTPUT_EXCLUDE &&
545 !defined($function_table{$name})))
536 {
537 dump_section($file, $name, $contents);
538 output_blockhead({'sectionlist' => \@sectionlist,
539 'sections' => \%sections,
540 'module' => $modulename,
546 {
547 dump_section($file, $name, $contents);
548 output_blockhead({'sectionlist' => \@sectionlist,
549 'sections' => \%sections,
550 'module' => $modulename,
541 'content-only' => ($function_only != 0), });
551 'content-only' => ($output_selection != OUTPUT_ALL), });
542 }
543}
544
545##
546# output function
547#
548# parameterdescs, a hash.
549# function => "function name"

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

1983# generic output function for all types (function, struct/union, typedef, enum);
1984# calls the generated, variable output_ function name based on
1985# functype and output_mode
1986sub output_declaration {
1987 no strict 'refs';
1988 my $name = shift;
1989 my $functype = shift;
1990 my $func = "output_${functype}_$output_mode";
552 }
553}
554
555##
556# output function
557#
558# parameterdescs, a hash.
559# function => "function name"

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

1993# generic output function for all types (function, struct/union, typedef, enum);
1994# calls the generated, variable output_ function name based on
1995# functype and output_mode
1996sub output_declaration {
1997 no strict 'refs';
1998 my $name = shift;
1999 my $functype = shift;
2000 my $func = "output_${functype}_$output_mode";
1991 if (($function_only==0) ||
1992 ( ($function_only == 1 || $function_only == 3) &&
1993 defined($function_table{$name})) ||
1994 ( ($function_only == 2 || $function_only == 4) &&
1995 !($functype eq "function" && defined($function_table{$name}))))
2001 if (($output_selection == OUTPUT_ALL) ||
2002 (($output_selection == OUTPUT_INCLUDE ||
2003 $output_selection == OUTPUT_EXPORTED) &&
2004 defined($function_table{$name})) ||
2005 (($output_selection == OUTPUT_EXCLUDE ||
2006 $output_selection == OUTPUT_INTERNAL) &&
2007 !($functype eq "function" && defined($function_table{$name}))))
1996 {
1997 &$func(@_);
1998 $section_counter++;
1999 }
2000}
2001
2002##
2003# generic output function - calls the right one based on current output mode.

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

2691
2692 if (!open(IN,"<$file")) {
2693 print STDERR "Error: Cannot open file $file\n";
2694 ++$errors;
2695 return;
2696 }
2697
2698 # two passes for -export and -internal
2008 {
2009 &$func(@_);
2010 $section_counter++;
2011 }
2012}
2013
2014##
2015# generic output function - calls the right one based on current output mode.

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

2703
2704 if (!open(IN,"<$file")) {
2705 print STDERR "Error: Cannot open file $file\n";
2706 ++$errors;
2707 return;
2708 }
2709
2710 # two passes for -export and -internal
2699 if ($function_only == 3 || $function_only == 4) {
2711 if ($output_selection == OUTPUT_EXPORTED ||
2712 $output_selection == OUTPUT_INTERNAL) {
2700 while (<IN>) {
2701 if (/$export_symbol/o) {
2702 $function_table{$2} = 1;
2703 }
2704 }
2705 seek(IN, 0, 0);
2706 }
2707

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

2924 {
2925 $contents .= $1 . "\n";
2926 }
2927 }
2928 }
2929 }
2930 if ($initial_section_counter == $section_counter) {
2931 print STDERR "${file}:1: warning: no structured comments found\n";
2713 while (<IN>) {
2714 if (/$export_symbol/o) {
2715 $function_table{$2} = 1;
2716 }
2717 }
2718 seek(IN, 0, 0);
2719 }
2720

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

2937 {
2938 $contents .= $1 . "\n";
2939 }
2940 }
2941 }
2942 }
2943 if ($initial_section_counter == $section_counter) {
2944 print STDERR "${file}:1: warning: no structured comments found\n";
2932 if (($function_only == 1) && ($show_not_found == 1)) {
2945 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
2933 print STDERR " Was looking for '$_'.\n" for keys %function_table;
2934 }
2935 if ($output_mode eq "xml") {
2936 # The template wants at least one RefEntry here; make one.
2937 print "<refentry>\n";
2938 print " <refnamediv>\n";
2939 print " <refname>\n";
2940 print " ${orig_file}\n";

--- 62 unchanged lines hidden ---
2946 print STDERR " Was looking for '$_'.\n" for keys %function_table;
2947 }
2948 if ($output_mode eq "xml") {
2949 # The template wants at least one RefEntry here; make one.
2950 print "<refentry>\n";
2951 print " <refnamediv>\n";
2952 print " <refname>\n";
2953 print " ${orig_file}\n";

--- 62 unchanged lines hidden ---