kernel-doc (68f86662380c343317325c024d6a35221f1908ac) | kernel-doc (4d73270192ec8238135d9fb65b49f6f42f50818d) |
---|---|
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 ## --- 192 unchanged lines hidden (view full) --- 201my $type_struct = '\&((struct\s*)*[_\w]+)'; 202my $type_struct_xml = '\\&((struct\s*)*[_\w]+)'; 203my $type_env = '(\$\w+)'; 204 205# Output conversion substitutions. 206# One for each output format 207 208# these work fairly well | 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 ## --- 192 unchanged lines hidden (view full) --- 201my $type_struct = '\&((struct\s*)*[_\w]+)'; 202my $type_struct_xml = '\\&((struct\s*)*[_\w]+)'; 203my $type_env = '(\$\w+)'; 204 205# Output conversion substitutions. 206# One for each output format 207 208# these work fairly well |
209my %highlights_html = ( $type_constant, "<i>\$1</i>", 210 $type_func, "<b>\$1</b>", 211 $type_struct_xml, "<i>\$1</i>", 212 $type_env, "<b><i>\$1</i></b>", 213 $type_param, "<tt><b>\$1</b></tt>" ); | 209my @highlights_html = ( 210 [$type_constant, "<i>\$1</i>"], 211 [$type_func, "<b>\$1</b>"], 212 [$type_struct_xml, "<i>\$1</i>"], 213 [$type_env, "<b><i>\$1</i></b>"], 214 [$type_param, "<tt><b>\$1</b></tt>"] 215 ); |
214my $local_lt = "\\\\\\\\lt:"; 215my $local_gt = "\\\\\\\\gt:"; 216my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" 217 218# html version 5 | 216my $local_lt = "\\\\\\\\lt:"; 217my $local_gt = "\\\\\\\\gt:"; 218my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" 219 220# html version 5 |
219my %highlights_html5 = ( $type_constant, "<span class=\"const\">\$1</span>", 220 $type_func, "<span class=\"func\">\$1</span>", 221 $type_struct_xml, "<span class=\"struct\">\$1</span>", 222 $type_env, "<span class=\"env\">\$1</span>", 223 $type_param, "<span class=\"param\">\$1</span>" ); | 221my @highlights_html5 = ( 222 [$type_constant, "<span class=\"const\">\$1</span>"], 223 [$type_func, "<span class=\"func\">\$1</span>"], 224 [$type_struct_xml, "<span class=\"struct\">\$1</span>"], 225 [$type_env, "<span class=\"env\">\$1</span>"], 226 [$type_param, "<span class=\"param\">\$1</span>]"] 227 ); |
224my $blankline_html5 = $local_lt . "br /" . $local_gt; 225 226# XML, docbook format | 228my $blankline_html5 = $local_lt . "br /" . $local_gt; 229 230# XML, docbook format |
227my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 228 $type_constant, "<constant>\$1</constant>", 229 $type_func, "<function>\$1</function>", 230 $type_struct_xml, "<structname>\$1</structname>", 231 $type_env, "<envar>\$1</envar>", 232 $type_param, "<parameter>\$1</parameter>" ); | 231my @highlights_xml = ( 232 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], 233 [$type_constant, "<constant>\$1</constant>"], 234 [$type_struct_xml, "<structname>\$1</structname>"], 235 [$type_param, "<parameter>\$1</parameter>"], 236 [$type_func, "<function>\$1</function>"], 237 [$type_env, "<envar>\$1</envar>"] 238 ); |
233my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; 234 235# gnome, docbook format | 239my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; 240 241# gnome, docbook format |
236my %highlights_gnome = ( $type_constant, "<replaceable class=\"option\">\$1</replaceable>", 237 $type_func, "<function>\$1</function>", 238 $type_struct, "<structname>\$1</structname>", 239 $type_env, "<envar>\$1</envar>", 240 $type_param, "<parameter>\$1</parameter>" ); | 242my @highlights_gnome = ( 243 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], 244 [$type_func, "<function>\$1</function>"], 245 [$type_struct, "<structname>\$1</structname>"], 246 [$type_env, "<envar>\$1</envar>"], 247 [$type_param, "<parameter>\$1</parameter>" ] 248 ); |
241my $blankline_gnome = "</para><para>\n"; 242 243# these are pretty rough | 249my $blankline_gnome = "</para><para>\n"; 250 251# these are pretty rough |
244my %highlights_man = ( $type_constant, "\$1", 245 $type_func, "\\\\fB\$1\\\\fP", 246 $type_struct, "\\\\fI\$1\\\\fP", 247 $type_param, "\\\\fI\$1\\\\fP" ); | 252my @highlights_man = ( 253 [$type_constant, "\$1"], 254 [$type_func, "\\\\fB\$1\\\\fP"], 255 [$type_struct, "\\\\fI\$1\\\\fP"], 256 [$type_param, "\\\\fI\$1\\\\fP"] 257 ); |
248my $blankline_man = ""; 249 250# text-mode | 258my $blankline_man = ""; 259 260# text-mode |
251my %highlights_text = ( $type_constant, "\$1", 252 $type_func, "\$1", 253 $type_struct, "\$1", 254 $type_param, "\$1" ); | 261my @highlights_text = ( 262 [$type_constant, "\$1"], 263 [$type_func, "\$1"], 264 [$type_struct, "\$1"], 265 [$type_param, "\$1"] 266 ); |
255my $blankline_text = ""; 256 257# list mode | 267my $blankline_text = ""; 268 269# list mode |
258my %highlights_list = ( $type_constant, "\$1", 259 $type_func, "\$1", 260 $type_struct, "\$1", 261 $type_param, "\$1" ); | 270my @highlights_list = ( 271 [$type_constant, "\$1"], 272 [$type_func, "\$1"], 273 [$type_struct, "\$1"], 274 [$type_param, "\$1"] 275 ); |
262my $blankline_list = ""; 263 264# read arguments 265if ($#ARGV == -1) { 266 usage(); 267} 268 269my $kernelversion; 270my $dohighlight = ""; 271 272my $verbose = 0; 273my $output_mode = "man"; 274my $output_preformatted = 0; 275my $no_doc_sections = 0; | 276my $blankline_list = ""; 277 278# read arguments 279if ($#ARGV == -1) { 280 usage(); 281} 282 283my $kernelversion; 284my $dohighlight = ""; 285 286my $verbose = 0; 287my $output_mode = "man"; 288my $output_preformatted = 0; 289my $no_doc_sections = 0; |
276my %highlights = %highlights_man; | 290my @highlights = @highlights_man; |
277my $blankline = $blankline_man; 278my $modulename = "Kernel API"; 279my $function_only = 0; 280my $show_not_found = 0; 281 282my @build_time; 283if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) && 284 (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') { --- 84 unchanged lines hidden (view full) --- 369my $undescribed = "-- undescribed --"; 370 371reset_state(); 372 373while ($ARGV[0] =~ m/^-(.*)/) { 374 my $cmd = shift @ARGV; 375 if ($cmd eq "-html") { 376 $output_mode = "html"; | 291my $blankline = $blankline_man; 292my $modulename = "Kernel API"; 293my $function_only = 0; 294my $show_not_found = 0; 295 296my @build_time; 297if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) && 298 (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') { --- 84 unchanged lines hidden (view full) --- 383my $undescribed = "-- undescribed --"; 384 385reset_state(); 386 387while ($ARGV[0] =~ m/^-(.*)/) { 388 my $cmd = shift @ARGV; 389 if ($cmd eq "-html") { 390 $output_mode = "html"; |
377 %highlights = %highlights_html; | 391 @highlights = @highlights_html; |
378 $blankline = $blankline_html; 379 } elsif ($cmd eq "-html5") { 380 $output_mode = "html5"; | 392 $blankline = $blankline_html; 393 } elsif ($cmd eq "-html5") { 394 $output_mode = "html5"; |
381 %highlights = %highlights_html5; | 395 @highlights = @highlights_html5; |
382 $blankline = $blankline_html5; 383 } elsif ($cmd eq "-man") { 384 $output_mode = "man"; | 396 $blankline = $blankline_html5; 397 } elsif ($cmd eq "-man") { 398 $output_mode = "man"; |
385 %highlights = %highlights_man; | 399 @highlights = @highlights_man; |
386 $blankline = $blankline_man; 387 } elsif ($cmd eq "-text") { 388 $output_mode = "text"; | 400 $blankline = $blankline_man; 401 } elsif ($cmd eq "-text") { 402 $output_mode = "text"; |
389 %highlights = %highlights_text; | 403 @highlights = @highlights_text; |
390 $blankline = $blankline_text; 391 } elsif ($cmd eq "-docbook") { 392 $output_mode = "xml"; | 404 $blankline = $blankline_text; 405 } elsif ($cmd eq "-docbook") { 406 $output_mode = "xml"; |
393 %highlights = %highlights_xml; | 407 @highlights = @highlights_xml; |
394 $blankline = $blankline_xml; 395 } elsif ($cmd eq "-list") { 396 $output_mode = "list"; | 408 $blankline = $blankline_xml; 409 } elsif ($cmd eq "-list") { 410 $output_mode = "list"; |
397 %highlights = %highlights_list; | 411 @highlights = @highlights_list; |
398 $blankline = $blankline_list; 399 } elsif ($cmd eq "-gnome") { 400 $output_mode = "gnome"; | 412 $blankline = $blankline_list; 413 } elsif ($cmd eq "-gnome") { 414 $output_mode = "gnome"; |
401 %highlights = %highlights_gnome; | 415 @highlights = @highlights_gnome; |
402 $blankline = $blankline_gnome; 403 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 404 $modulename = shift @ARGV; 405 } elsif ($cmd eq "-function") { # to only output specific functions 406 $function_only = 1; 407 $function = shift @ARGV; 408 $function_table{$function} = 1; 409 } elsif ($cmd eq "-nofunction") { # to only output specific functions --- 2257 unchanged lines hidden (view full) --- 2667 } 2668} 2669 2670 2671$kernelversion = get_kernel_version(); 2672 2673# generate a sequence of code that will splice in highlighting information 2674# using the s// operator. | 416 $blankline = $blankline_gnome; 417 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 418 $modulename = shift @ARGV; 419 } elsif ($cmd eq "-function") { # to only output specific functions 420 $function_only = 1; 421 $function = shift @ARGV; 422 $function_table{$function} = 1; 423 } elsif ($cmd eq "-nofunction") { # to only output specific functions --- 2257 unchanged lines hidden (view full) --- 2681 } 2682} 2683 2684 2685$kernelversion = get_kernel_version(); 2686 2687# generate a sequence of code that will splice in highlighting information 2688# using the s// operator. |
2675foreach my $pattern (sort keys %highlights) { 2676# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n"; 2677 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; | 2689foreach my $k (keys @highlights) { 2690 my $pattern = $highlights[$k][0]; 2691 my $result = $highlights[$k][1]; 2692# print STDERR "scanning pattern:$pattern, highlight:($result)\n"; 2693 $dohighlight .= "\$contents =~ s:$pattern:$result:gs;\n"; |
2678} 2679 2680# Read the file that maps relative names to absolute names for 2681# separate source and object directories and for shadow trees. 2682if (open(SOURCE_MAP, "<.tmp_filelist.txt")) { 2683 my ($relname, $absname); 2684 while(<SOURCE_MAP>) { 2685 chop(); --- 19 unchanged lines hidden --- | 2694} 2695 2696# Read the file that maps relative names to absolute names for 2697# separate source and object directories and for shadow trees. 2698if (open(SOURCE_MAP, "<.tmp_filelist.txt")) { 2699 my ($relname, $absname); 2700 while(<SOURCE_MAP>) { 2701 chop(); --- 19 unchanged lines hidden --- |