kernel-doc (9938b04472d5c59f8bd8152a548533a8599596a2) kernel-doc (fadc0b31cba0bb56bce1a3259cc60e4d7ee67333)
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 ##

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

34# 23/09/2001 - Added support for typedefs, structs, enums and unions
35# Support for Context section; can be terminated using empty line
36# Small fixes (like spaces vs. \s in regex)
37# -- Tim Jansen <tim@tjansen.de>
38
39# 25/07/2012 - Added support for HTML5
40# -- Dan Luedtke <mail@danrl.de>
41
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 ##

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

34# 23/09/2001 - Added support for typedefs, structs, enums and unions
35# Support for Context section; can be terminated using empty line
36# Small fixes (like spaces vs. \s in regex)
37# -- Tim Jansen <tim@tjansen.de>
38
39# 25/07/2012 - Added support for HTML5
40# -- Dan Luedtke <mail@danrl.de>
41
42#
43# This will read a 'c' file and scan for embedded comments in the
44# style of gnome comments (+minor extensions - see below).
45#
42sub usage {
43 my $message = <<"EOF";
44Usage: $0 [OPTION ...] FILE ...
46
45
47# Note: This only supports 'c'.
46Read C language source or header FILEs, extract embedded documentation comments,
47and print formatted documentation to standard output.
48
48
49# usage:
50# kernel-doc [ -docbook | -html | -html5 | -text | -man | -list ]
51# [ -no-doc-sections ]
52# [ -function funcname [ -function funcname ...] ]
53# c file(s)s > outputfile
54# or
55# [ -nofunction funcname [ -function funcname ...] ]
56# c file(s)s > outputfile
57#
58# Set output format using one of -docbook -html -html5 -text or -man.
59# Default is man.
60# The -list format is for internal use by docproc.
61#
62# -no-doc-sections
63# Do not output DOC: sections
64#
65# -function funcname
66# If set, then only generate documentation for the given function(s) or
67# DOC: section titles. All other functions and DOC: sections are ignored.
68#
69# -nofunction funcname
70# If set, then only generate documentation for the other function(s)/DOC:
71# sections. Cannot be used together with -function (yes, that's a bug --
72# perl hackers can fix it 8))
73#
74# c files - list of 'c' files to process
75#
76# All output goes to stdout, with errors to stderr.
49The documentation comments are identified by "/**" opening comment mark. See
50Documentation/kernel-doc-nano-HOWTO.txt for the documentation comment syntax.
77
51
52Output format selection (mutually exclusive):
53 -docbook Output DocBook format.
54 -html Output HTML format.
55 -html5 Output HTML5 format.
56 -list Output symbol list format. This is for use by docproc.
57 -man Output troff manual page format. This is the default.
58 -text Output plain text format.
59
60Output selection (mutually exclusive):
61 -function NAME Only output documentation for the given function(s)
62 or DOC: section title(s). All other functions and DOC:
63 sections are ignored. May be specified multiple times.
64 -nofunction NAME Do NOT output documentation for the given function(s);
65 only output documentation for the other functions and
66 DOC: sections. May be specified multiple times.
67
68Output selection modifiers:
69 -no-doc-sections Do not output DOC: sections.
70
71Other parameters:
72 -v Verbose output, more warnings and other information.
73 -h Print this help.
74
75EOF
76 print $message;
77 exit 1;
78}
79
78#
79# format of comments.
80# In the following table, (...)? signifies optional structure.
81# (...)* signifies 0 or more structure elements
82# /**
83# * function_name(:)? (- short description)?
84# (* @parameterx: (description of parameter x)?)*
85# (* a blank line)?

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

432 $no_doc_sections = 1;
433 } elsif ($cmd eq '-show-not-found') {
434 $show_not_found = 1;
435 }
436}
437
438# continue execution near EOF;
439
80#
81# format of comments.
82# In the following table, (...)? signifies optional structure.
83# (...)* signifies 0 or more structure elements
84# /**
85# * function_name(:)? (- short description)?
86# (* @parameterx: (description of parameter x)?)*
87# (* a blank line)?

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

434 $no_doc_sections = 1;
435 } elsif ($cmd eq '-show-not-found') {
436 $show_not_found = 1;
437 }
438}
439
440# continue execution near EOF;
441
440sub usage {
441 print "Usage: $0 [ -docbook | -html | -html5 | -text | -man | -list ]\n";
442 print " [ -no-doc-sections ]\n";
443 print " [ -function funcname [ -function funcname ...] ]\n";
444 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
445 print " [ -v ]\n";
446 print " c source file(s) > outputfile\n";
447 print " -v : verbose output, more warnings & other info listed\n";
448 exit 1;
449}
450
451# get kernel version from env
452sub get_kernel_version() {
453 my $version = 'unknown kernel version';
454
455 if (defined($ENV{'KERNELVERSION'})) {
456 $version = $ENV{'KERNELVERSION'};
457 }
458 return $version;

--- 2290 unchanged lines hidden ---
442# get kernel version from env
443sub get_kernel_version() {
444 my $version = 'unknown kernel version';
445
446 if (defined($ENV{'KERNELVERSION'})) {
447 $version = $ENV{'KERNELVERSION'};
448 }
449 return $version;

--- 2290 unchanged lines hidden ---