kernel-doc (884f2810b15b6bb489c9dca5013aafbea2f19fba) | kernel-doc (3eb014a103701bedfaa11bc321f470e918c71ff7) |
---|---|
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## ## --- 145 unchanged lines hidden (view full) --- 154 155my $errors = 0; 156my $warnings = 0; 157 158# match expressions used to find embedded type information 159my $type_constant = '\%([-_\w]+)'; 160my $type_func = '(\w+)\(\)'; 161my $type_param = '\@(\w+)'; | 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## ## --- 145 unchanged lines hidden (view full) --- 154 155my $errors = 0; 156my $warnings = 0; 157 158# match expressions used to find embedded type information 159my $type_constant = '\%([-_\w]+)'; 160my $type_func = '(\w+)\(\)'; 161my $type_param = '\@(\w+)'; |
162my $type_struct = '\&((struct\s*)?[_\w]+)'; | 162my $type_struct = '\&((struct\s*)*[_\w]+)'; 163my $type_struct_xml = '\\\amp;((struct\s*)*[_\w]+)'; |
163my $type_env = '(\$\w+)'; 164 165# Output conversion substitutions. 166# One for each output format 167 168# these work fairly well 169my %highlights_html = ( $type_constant, "<i>\$1</i>", 170 $type_func, "<b>\$1</b>", | 164my $type_env = '(\$\w+)'; 165 166# Output conversion substitutions. 167# One for each output format 168 169# these work fairly well 170my %highlights_html = ( $type_constant, "<i>\$1</i>", 171 $type_func, "<b>\$1</b>", |
171 $type_struct, "<i>\$1</i>", | 172 $type_struct_xml, "<i>\$1</i>", 173 $type_env, "<b><i>\$1</i></b>", |
172 $type_param, "<tt><b>\$1</b></tt>" ); 173my $blankline_html = "<p>"; 174 175# XML, docbook format 176my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 177 $type_constant, "<constant>\$1</constant>", 178 $type_func, "<function>\$1</function>", 179 $type_struct, "<structname>\$1</structname>", --- 146 unchanged lines hidden (view full) --- 326 } 327} 328 329 330# generate a sequence of code that will splice in highlighting information 331# using the s// operator. 332my $dohighlight = ""; 333foreach my $pattern (keys %highlights) { | 174 $type_param, "<tt><b>\$1</b></tt>" ); 175my $blankline_html = "<p>"; 176 177# XML, docbook format 178my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 179 $type_constant, "<constant>\$1</constant>", 180 $type_func, "<function>\$1</function>", 181 $type_struct, "<structname>\$1</structname>", --- 146 unchanged lines hidden (view full) --- 328 } 329} 330 331 332# generate a sequence of code that will splice in highlighting information 333# using the s// operator. 334my $dohighlight = ""; 335foreach my $pattern (keys %highlights) { |
334# print "scanning pattern $pattern ($highlights{$pattern})\n"; | 336# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n"; |
335 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; 336} 337 338## 339# dumps section contents to arrays/hashes intended for that purpose. 340# 341sub dump_section { 342 my $name = shift; --- 30 unchanged lines hidden (view full) --- 373 my $line; 374 375# DEBUG 376# if (!defined $contents) { 377# use Carp; 378# confess "output_highlight got called with no args?\n"; 379# } 380 | 337 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; 338} 339 340## 341# dumps section contents to arrays/hashes intended for that purpose. 342# 343sub dump_section { 344 my $name = shift; --- 30 unchanged lines hidden (view full) --- 375 my $line; 376 377# DEBUG 378# if (!defined $contents) { 379# use Carp; 380# confess "output_highlight got called with no args?\n"; 381# } 382 |
383# print STDERR "contents b4:$contents\n"; |
|
381 eval $dohighlight; 382 die $@ if $@; | 384 eval $dohighlight; 385 die $@ if $@; |
386 if ($output_mode eq "html") { 387 $contents =~ s/\\\\//; 388 } 389# print STDERR "contents af:$contents\n"; 390 |
|
383 foreach $line (split "\n", $contents) { 384 if ($line eq ""){ 385 print $lineprefix, $blankline; 386 } else { 387 $line =~ s/\\\\\\/\&/g; 388 print $lineprefix, $line; 389 } 390 print "\n"; --- 70 unchanged lines hidden (view full) --- 461 } 462 my $parameter_name = $parameter; 463 $parameter_name =~ s/\[.*//; 464 465 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 466 $type = $args{'parametertypes'}{$parameter}; 467 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 468 # pointer-to-function | 391 foreach $line (split "\n", $contents) { 392 if ($line eq ""){ 393 print $lineprefix, $blankline; 394 } else { 395 $line =~ s/\\\\\\/\&/g; 396 print $lineprefix, $line; 397 } 398 print "\n"; --- 70 unchanged lines hidden (view full) --- 469 } 470 my $parameter_name = $parameter; 471 $parameter_name =~ s/\[.*//; 472 473 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 474 $type = $args{'parametertypes'}{$parameter}; 475 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 476 # pointer-to-function |
469 print " <i>$1</i><b>$parameter</b>) <i>($2)</i>;<br>\n"; | 477 print " <i>$1</i><b>$parameter</b>) <i>($2)</i>;<br>\n"; |
470 } elsif ($type =~ m/^(.*?)\s*(:.*)/) { | 478 } elsif ($type =~ m/^(.*?)\s*(:.*)/) { |
471 print " <i>$1</i> <b>$parameter</b>$2;<br>\n"; | 479 # bitfield 480 print " <i>$1</i> <b>$parameter</b>$2;<br>\n"; |
472 } else { | 481 } else { |
473 print " <i>$type</i> <b>$parameter</b>;<br>\n"; | 482 print " <i>$type</i> <b>$parameter</b>;<br>\n"; |
474 } 475 } 476 print "};<br>\n"; 477 478 print "<h3>Members</h3>\n"; 479 print "<dl>\n"; 480 foreach $parameter (@{$args{'parameterlist'}}) { 481 ($parameter =~ /^#/) && next; --- 1465 unchanged lines hidden --- | 483 } 484 } 485 print "};<br>\n"; 486 487 print "<h3>Members</h3>\n"; 488 print "<dl>\n"; 489 foreach $parameter (@{$args{'parameterlist'}}) { 490 ($parameter =~ /^#/) && next; --- 1465 unchanged lines hidden --- |