diff options
Diffstat (limited to 'scripts/kernel-doc')
| -rwxr-xr-x | scripts/kernel-doc | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 39580a5dc5d..9f85012acf0 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 | |||
| 158 | my $errors = 0; | 160 | my $errors = 0; |
| 159 | my $warnings = 0; | 161 | my $warnings = 0; |
| 160 | my $anon_struct_union = 0; | 162 | my $anon_struct_union = 0; |
| @@ -218,21 +220,14 @@ my %highlights_list = ( $type_constant, "\$1", | |||
| 218 | $type_param, "\$1" ); | 220 | $type_param, "\$1" ); |
| 219 | my $blankline_list = ""; | 221 | my $blankline_list = ""; |
| 220 | 222 | ||
| 221 | sub 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 |
| 232 | if ($#ARGV == -1) { | 224 | if ($#ARGV == -1) { |
| 233 | usage(); | 225 | usage(); |
| 234 | } | 226 | } |
| 235 | 227 | ||
| 228 | my $kernelversion; | ||
| 229 | my $dohighlight = ""; | ||
| 230 | |||
| 236 | my $verbose = 0; | 231 | my $verbose = 0; |
| 237 | my $output_mode = "man"; | 232 | my $output_mode = "man"; |
| 238 | my $no_doc_sections = 0; | 233 | my $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 | |||
| 353 | sub 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 |
| 357 | sub get_kernel_version() { | 364 | sub 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 | } |
| 365 | my $kernelversion = get_kernel_version(); | ||
| 366 | |||
| 367 | # generate a sequence of code that will splice in highlighting information | ||
| 368 | # using the s// operator. | ||
| 369 | my $dohighlight = ""; | ||
| 370 | foreach 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 | ||
| 1854 | sub 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. | ||
| 1858 | if (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 | |||
| 1869 | foreach (@ARGV) { | ||
| 1870 | chomp; | ||
| 1871 | process_file($_); | ||
| 1872 | } | ||
| 1873 | if ($verbose && $errors) { | ||
| 1874 | print STDERR "$errors errors\n"; | ||
| 1875 | } | ||
| 1876 | if ($verbose && $warnings) { | ||
| 1877 | print STDERR "$warnings warnings\n"; | ||
| 1878 | } | ||
| 1879 | |||
| 1880 | exit($errors); | ||
| 1881 | |||
| 1882 | sub reset_state { | 1852 | sub 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. | ||
| 2264 | foreach 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. | ||
| 2271 | if (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 | |||
| 2282 | foreach (@ARGV) { | ||
| 2283 | chomp; | ||
| 2284 | process_file($_); | ||
| 2285 | } | ||
| 2286 | if ($verbose && $errors) { | ||
| 2287 | print STDERR "$errors errors\n"; | ||
| 2288 | } | ||
| 2289 | if ($verbose && $warnings) { | ||
| 2290 | print STDERR "$warnings warnings\n"; | ||
| 2291 | } | ||
| 2292 | |||
| 2293 | exit($errors); | ||
