aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc102
1 files changed, 54 insertions, 48 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 39580a5dc5df..9f85012acf0d 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -155,6 +155,8 @@ use strict;
155# '@parameter' - name of a parameter 155# '@parameter' - name of a parameter
156# '%CONST' - name of a constant. 156# '%CONST' - name of a constant.
157 157
158## init lots of data
159
158my $errors = 0; 160my $errors = 0;
159my $warnings = 0; 161my $warnings = 0;
160my $anon_struct_union = 0; 162my $anon_struct_union = 0;
@@ -218,21 +220,14 @@ my %highlights_list = ( $type_constant, "\$1",
218 $type_param, "\$1" ); 220 $type_param, "\$1" );
219my $blankline_list = ""; 221my $blankline_list = "";
220 222
221sub usage {
222 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n";
223 print " [ -no-doc-sections ]\n";
224 print " [ -function funcname [ -function funcname ...] ]\n";
225 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
226 print " c source file(s) > outputfile\n";
227 print " -v : verbose output, more warnings & other info listed\n";
228 exit 1;
229}
230
231# read arguments 223# read arguments
232if ($#ARGV == -1) { 224if ($#ARGV == -1) {
233 usage(); 225 usage();
234} 226}
235 227
228my $kernelversion;
229my $dohighlight = "";
230
236my $verbose = 0; 231my $verbose = 0;
237my $output_mode = "man"; 232my $output_mode = "man";
238my $no_doc_sections = 0; 233my $no_doc_sections = 0;
@@ -245,7 +240,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
245 'November', 'December')[(localtime)[4]] . 240 'November', 'December')[(localtime)[4]] .
246 " " . ((localtime)[5]+1900); 241 " " . ((localtime)[5]+1900);
247 242
248# Essentially these are globals 243# Essentially these are globals.
249# They probably want to be tidied up, made more localised or something. 244# They probably want to be tidied up, made more localised or something.
250# CAVEAT EMPTOR! Some of the others I localised may not want to be, which 245# CAVEAT EMPTOR! Some of the others I localised may not want to be, which
251# could cause "use of undefined value" or other bugs. 246# could cause "use of undefined value" or other bugs.
@@ -353,6 +348,18 @@ while ($ARGV[0] =~ m/^-(.*)/) {
353 } 348 }
354} 349}
355 350
351# continue execution near EOF;
352
353sub usage {
354 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n";
355 print " [ -no-doc-sections ]\n";
356 print " [ -function funcname [ -function funcname ...] ]\n";
357 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
358 print " c source file(s) > outputfile\n";
359 print " -v : verbose output, more warnings & other info listed\n";
360 exit 1;
361}
362
356# get kernel version from env 363# get kernel version from env
357sub get_kernel_version() { 364sub get_kernel_version() {
358 my $version = 'unknown kernel version'; 365 my $version = 'unknown kernel version';
@@ -362,15 +369,6 @@ sub get_kernel_version() {
362 } 369 }
363 return $version; 370 return $version;
364} 371}
365my $kernelversion = get_kernel_version();
366
367# generate a sequence of code that will splice in highlighting information
368# using the s// operator.
369my $dohighlight = "";
370foreach my $pattern (keys %highlights) {
371# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
372 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
373}
374 372
375## 373##
376# dumps section contents to arrays/hashes intended for that purpose. 374# dumps section contents to arrays/hashes intended for that purpose.
@@ -1851,34 +1849,6 @@ sub dump_function($$) {
1851 }); 1849 });
1852} 1850}
1853 1851
1854sub process_file($);
1855
1856# Read the file that maps relative names to absolute names for
1857# separate source and object directories and for shadow trees.
1858if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
1859 my ($relname, $absname);
1860 while(<SOURCE_MAP>) {
1861 chop();
1862 ($relname, $absname) = (split())[0..1];
1863 $relname =~ s:^/+::;
1864 $source_map{$relname} = $absname;
1865 }
1866 close(SOURCE_MAP);
1867}
1868
1869foreach (@ARGV) {
1870 chomp;
1871 process_file($_);
1872}
1873if ($verbose && $errors) {
1874 print STDERR "$errors errors\n";
1875}
1876if ($verbose && $warnings) {
1877 print STDERR "$warnings warnings\n";
1878}
1879
1880exit($errors);
1881
1882sub reset_state { 1852sub reset_state {
1883 $function = ""; 1853 $function = "";
1884 %constants = (); 1854 %constants = ();
@@ -2285,3 +2255,39 @@ sub process_file($) {
2285 } 2255 }
2286 } 2256 }
2287} 2257}
2258
2259
2260$kernelversion = get_kernel_version();
2261
2262# generate a sequence of code that will splice in highlighting information
2263# using the s// operator.
2264foreach my $pattern (keys %highlights) {
2265# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
2266 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
2267}
2268
2269# Read the file that maps relative names to absolute names for
2270# separate source and object directories and for shadow trees.
2271if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
2272 my ($relname, $absname);
2273 while(<SOURCE_MAP>) {
2274 chop();
2275 ($relname, $absname) = (split())[0..1];
2276 $relname =~ s:^/+::;
2277 $source_map{$relname} = $absname;
2278 }
2279 close(SOURCE_MAP);
2280}
2281
2282foreach (@ARGV) {
2283 chomp;
2284 process_file($_);
2285}
2286if ($verbose && $errors) {
2287 print STDERR "$errors errors\n";
2288}
2289if ($verbose && $warnings) {
2290 print STDERR "$warnings warnings\n";
2291}
2292
2293exit($errors);