kernel-doc (5f4457a4f62cc9d78e04c0eb12ff0540899aad89) kernel-doc (b9d97328e27b9272ed2ff2ad18de61aa1bf12af8)
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 ##
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-2008 Randy Dunlap ##
8## Copyright (C) 2005-2009 Randy Dunlap ##
9## ##
10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
11## Copyright (c) 2000 MontaVista Software, Inc. ##
12## ##
13## This software falls under the GNU General Public License. ##
14## Please read the COPYING file for more information ##
15
16# w.o. 03-11-2000: added the '-filelist' option.

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

80# * (Description:)? (Description of function)?
81# * (section header: (section description)? )*
82# (*)?*/
83#
84# So .. the trivial example would be:
85#
86# /**
87# * my_function
9## ##
10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
11## Copyright (c) 2000 MontaVista Software, Inc. ##
12## ##
13## This software falls under the GNU General Public License. ##
14## Please read the COPYING file for more information ##
15
16# w.o. 03-11-2000: added the '-filelist' option.

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

80# * (Description:)? (Description of function)?
81# * (section header: (section description)? )*
82# (*)?*/
83#
84# So .. the trivial example would be:
85#
86# /**
87# * my_function
88# **/
88# */
89#
90# If the Description: header tag is omitted, then there must be a blank line
91# after the last parameter specification.
92# e.g.
93# /**
94# * my_function - does my stuff
95# * @my_arg: its mine damnit
96# *
97# * Does my stuff explained.
98# */
99#
100# or, could also use:
101# /**
102# * my_function - does my stuff
103# * @my_arg: its mine damnit
104# * Description: Does my stuff explained.
105# */
106# etc.
107#
89#
90# If the Description: header tag is omitted, then there must be a blank line
91# after the last parameter specification.
92# e.g.
93# /**
94# * my_function - does my stuff
95# * @my_arg: its mine damnit
96# *
97# * Does my stuff explained.
98# */
99#
100# or, could also use:
101# /**
102# * my_function - does my stuff
103# * @my_arg: its mine damnit
104# * Description: Does my stuff explained.
105# */
106# etc.
107#
108# Beside functions you can also write documentation for structs, unions,
108# Besides functions you can also write documentation for structs, unions,
109# enums and typedefs. Instead of the function name you must write the name
110# of the declaration; the struct/union/enum/typedef must always precede
111# the name. Nesting of declarations is not supported.
112# Use the argument mechanism to document members or constants.
113# e.g.
114# /**
115# * struct my_struct - short description
116# * @a: first member

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

218 print " [ -function funcname [ -function funcname ...] ]\n";
219 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
220 print " c source file(s) > outputfile\n";
221 print " -v : verbose output, more warnings & other info listed\n";
222 exit 1;
223}
224
225# read arguments
109# enums and typedefs. Instead of the function name you must write the name
110# of the declaration; the struct/union/enum/typedef must always precede
111# the name. Nesting of declarations is not supported.
112# Use the argument mechanism to document members or constants.
113# e.g.
114# /**
115# * struct my_struct - short description
116# * @a: first member

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

218 print " [ -function funcname [ -function funcname ...] ]\n";
219 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
220 print " c source file(s) > outputfile\n";
221 print " -v : verbose output, more warnings & other info listed\n";
222 exit 1;
223}
224
225# read arguments
226if ($#ARGV==-1) {
226if ($#ARGV == -1) {
227 usage();
228}
229
230my $verbose = 0;
231my $output_mode = "man";
232my $no_doc_sections = 0;
233my %highlights = %highlights_man;
234my $blankline = $blankline_man;
235my $modulename = "Kernel API";
236my $function_only = 0;
237my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
238 'July', 'August', 'September', 'October',
239 'November', 'December')[(localtime)[4]] .
240 " " . ((localtime)[5]+1900);
241
242# Essentially these are globals
227 usage();
228}
229
230my $verbose = 0;
231my $output_mode = "man";
232my $no_doc_sections = 0;
233my %highlights = %highlights_man;
234my $blankline = $blankline_man;
235my $modulename = "Kernel API";
236my $function_only = 0;
237my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
238 'July', 'August', 'September', 'October',
239 'November', 'December')[(localtime)[4]] .
240 " " . ((localtime)[5]+1900);
241
242# Essentially these are globals
243# They probably want to be tidied up made more localised or summat.
244# CAVEAT EMPTOR! Some of the others I localised may not want to be which
243# They probably want to be tidied up, made more localised or something.
244# CAVEAT EMPTOR! Some of the others I localised may not want to be, which
245# could cause "use of undefined value" or other bugs.
245# could cause "use of undefined value" or other bugs.
246my ($function, %function_table,%parametertypes,$declaration_purpose);
247my ($type,$declaration_name,$return_type);
248my ($newsection,$newcontents,$prototype,$filelist, $brcount, %source_map);
246my ($function, %function_table, %parametertypes, $declaration_purpose);
247my ($type, $declaration_name, $return_type);
248my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map);
249
250if (defined($ENV{'KBUILD_VERBOSE'})) {
251 $verbose = "$ENV{'KBUILD_VERBOSE'}";
252}
253
254# Generated docbook code is inserted in a template at a point where
255# docbook v3.1 requires a non-zero sequence of RefEntry's; see:
256# http://www.oasis-open.org/docbook/documentation/reference/html/refentry.html

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

274# 'function', 'struct', 'union', 'enum', 'typedef'
275my $decl_type;
276
277my $doc_special = "\@\%\$\&";
278
279my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
280my $doc_end = '\*/';
281my $doc_com = '\s*\*\s*';
249
250if (defined($ENV{'KBUILD_VERBOSE'})) {
251 $verbose = "$ENV{'KBUILD_VERBOSE'}";
252}
253
254# Generated docbook code is inserted in a template at a point where
255# docbook v3.1 requires a non-zero sequence of RefEntry's; see:
256# http://www.oasis-open.org/docbook/documentation/reference/html/refentry.html

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

274# 'function', 'struct', 'union', 'enum', 'typedef'
275my $decl_type;
276
277my $doc_special = "\@\%\$\&";
278
279my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
280my $doc_end = '\*/';
281my $doc_com = '\s*\*\s*';
282my $doc_decl = $doc_com.'(\w+)';
283my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)';
284my $doc_content = $doc_com.'(.*)';
285my $doc_block = $doc_com.'DOC:\s*(.*)?';
282my $doc_decl = $doc_com . '(\w+)';
283my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)';
284my $doc_content = $doc_com . '(.*)';
285my $doc_block = $doc_com . 'DOC:\s*(.*)?';
286
287my %constants;
288my %parameterdescs;
289my @parameterlist;
290my %sections;
291my @sectionlist;
292my $sectcheck;
293my $struct_actual;

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

480 }
481}
482
483# output enum in html
484sub output_enum_html(%) {
485 my %args = %{$_[0]};
486 my ($parameter);
487 my $count;
286
287my %constants;
288my %parameterdescs;
289my @parameterlist;
290my %sections;
291my @sectionlist;
292my $sectcheck;
293my $struct_actual;

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

480 }
481}
482
483# output enum in html
484sub output_enum_html(%) {
485 my %args = %{$_[0]};
486 my ($parameter);
487 my $count;
488 print "<h2>enum ".$args{'enum'}."</h2>\n";
488 print "<h2>enum " . $args{'enum'} . "</h2>\n";
489
489
490 print "<b>enum ".$args{'enum'}."</b> {<br>\n";
490 print "<b>enum " . $args{'enum'} . "</b> {<br>\n";
491 $count = 0;
492 foreach $parameter (@{$args{'parameterlist'}}) {
491 $count = 0;
492 foreach $parameter (@{$args{'parameterlist'}}) {
493 print " <b>".$parameter."</b>";
493 print " <b>" . $parameter . "</b>";
494 if ($count != $#{$args{'parameterlist'}}) {
495 $count++;
496 print ",\n";
497 }
498 print "<br>";
499 }
500 print "};<br>\n";
501
502 print "<h3>Constants</h3>\n";
503 print "<dl>\n";
504 foreach $parameter (@{$args{'parameterlist'}}) {
494 if ($count != $#{$args{'parameterlist'}}) {
495 $count++;
496 print ",\n";
497 }
498 print "<br>";
499 }
500 print "};<br>\n";
501
502 print "<h3>Constants</h3>\n";
503 print "<dl>\n";
504 foreach $parameter (@{$args{'parameterlist'}}) {
505 print "<dt><b>".$parameter."</b>\n";
505 print "<dt><b>" . $parameter . "</b>\n";
506 print "<dd>";
507 output_highlight($args{'parameterdescs'}{$parameter});
508 }
509 print "</dl>\n";
510 output_section_html(@_);
511 print "<hr>\n";
512}
513
514# output typedef in html
515sub output_typedef_html(%) {
516 my %args = %{$_[0]};
517 my ($parameter);
518 my $count;
506 print "<dd>";
507 output_highlight($args{'parameterdescs'}{$parameter});
508 }
509 print "</dl>\n";
510 output_section_html(@_);
511 print "<hr>\n";
512}
513
514# output typedef in html
515sub output_typedef_html(%) {
516 my %args = %{$_[0]};
517 my ($parameter);
518 my $count;
519 print "<h2>typedef ".$args{'typedef'}."</h2>\n";
519 print "<h2>typedef " . $args{'typedef'} . "</h2>\n";
520
520
521 print "<b>typedef ".$args{'typedef'}."</b>\n";
521 print "<b>typedef " . $args{'typedef'} . "</b>\n";
522 output_section_html(@_);
523 print "<hr>\n";
524}
525
526# output struct in html
527sub output_struct_html(%) {
528 my %args = %{$_[0]};
529 my ($parameter);
530
522 output_section_html(@_);
523 print "<hr>\n";
524}
525
526# output struct in html
527sub output_struct_html(%) {
528 my %args = %{$_[0]};
529 my ($parameter);
530
531 print "<h2>".$args{'type'}." ".$args{'struct'}. " - " .$args{'purpose'}."</h2>\n";
532 print "<b>".$args{'type'}." ".$args{'struct'}."</b> {<br>\n";
531 print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n";
532 print "<b>" . $args{'type'} . " " . $args{'struct'} . "</b> {<br>\n";
533 foreach $parameter (@{$args{'parameterlist'}}) {
534 if ($parameter =~ /^#/) {
535 print "$parameter<br>\n";
536 next;
537 }
538 my $parameter_name = $parameter;
539 $parameter_name =~ s/\[.*//;
540

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

556 print "<dl>\n";
557 foreach $parameter (@{$args{'parameterlist'}}) {
558 ($parameter =~ /^#/) && next;
559
560 my $parameter_name = $parameter;
561 $parameter_name =~ s/\[.*//;
562
563 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
533 foreach $parameter (@{$args{'parameterlist'}}) {
534 if ($parameter =~ /^#/) {
535 print "$parameter<br>\n";
536 next;
537 }
538 my $parameter_name = $parameter;
539 $parameter_name =~ s/\[.*//;
540

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

556 print "<dl>\n";
557 foreach $parameter (@{$args{'parameterlist'}}) {
558 ($parameter =~ /^#/) && next;
559
560 my $parameter_name = $parameter;
561 $parameter_name =~ s/\[.*//;
562
563 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
564 print "<dt><b>".$parameter."</b>\n";
564 print "<dt><b>" . $parameter . "</b>\n";
565 print "<dd>";
566 output_highlight($args{'parameterdescs'}{$parameter_name});
567 }
568 print "</dl>\n";
569 output_section_html(@_);
570 print "<hr>\n";
571}
572
573# output function in html
574sub output_function_html(%) {
575 my %args = %{$_[0]};
576 my ($parameter, $section);
577 my $count;
578
565 print "<dd>";
566 output_highlight($args{'parameterdescs'}{$parameter_name});
567 }
568 print "</dl>\n";
569 output_section_html(@_);
570 print "<hr>\n";
571}
572
573# output function in html
574sub output_function_html(%) {
575 my %args = %{$_[0]};
576 my ($parameter, $section);
577 my $count;
578
579 print "<h2>" .$args{'function'}." - ".$args{'purpose'}."</h2>\n";
580 print "<i>".$args{'functiontype'}."</i>\n";
581 print "<b>".$args{'function'}."</b>\n";
579 print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n";
580 print "<i>" . $args{'functiontype'} . "</i>\n";
581 print "<b>" . $args{'function'} . "</b>\n";
582 print "(";
583 $count = 0;
584 foreach $parameter (@{$args{'parameterlist'}}) {
585 $type = $args{'parametertypes'}{$parameter};
586 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
587 # pointer-to-function
588 print "<i>$1</i><b>$parameter</b>) <i>($2)</i>";
589 } else {
582 print "(";
583 $count = 0;
584 foreach $parameter (@{$args{'parameterlist'}}) {
585 $type = $args{'parametertypes'}{$parameter};
586 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
587 # pointer-to-function
588 print "<i>$1</i><b>$parameter</b>) <i>($2)</i>";
589 } else {
590 print "<i>".$type."</i> <b>".$parameter."</b>";
590 print "<i>" . $type . "</i> <b>" . $parameter . "</b>";
591 }
592 if ($count != $#{$args{'parameterlist'}}) {
593 $count++;
594 print ",\n";
595 }
596 }
597 print ")\n";
598
599 print "<h3>Arguments</h3>\n";
600 print "<dl>\n";
601 foreach $parameter (@{$args{'parameterlist'}}) {
602 my $parameter_name = $parameter;
603 $parameter_name =~ s/\[.*//;
604
605 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
591 }
592 if ($count != $#{$args{'parameterlist'}}) {
593 $count++;
594 print ",\n";
595 }
596 }
597 print ")\n";
598
599 print "<h3>Arguments</h3>\n";
600 print "<dl>\n";
601 foreach $parameter (@{$args{'parameterlist'}}) {
602 my $parameter_name = $parameter;
603 $parameter_name =~ s/\[.*//;
604
605 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
606 print "<dt><b>".$parameter."</b>\n";
606 print "<dt><b>" . $parameter . "</b>\n";
607 print "<dd>";
608 output_highlight($args{'parameterdescs'}{$parameter_name});
609 }
610 print "</dl>\n";
611 output_section_html(@_);
612 print "<hr>\n";
613}
614

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

652
653# output function in XML DocBook
654sub output_function_xml(%) {
655 my %args = %{$_[0]};
656 my ($parameter, $section);
657 my $count;
658 my $id;
659
607 print "<dd>";
608 output_highlight($args{'parameterdescs'}{$parameter_name});
609 }
610 print "</dl>\n";
611 output_section_html(@_);
612 print "<hr>\n";
613}
614

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

652
653# output function in XML DocBook
654sub output_function_xml(%) {
655 my %args = %{$_[0]};
656 my ($parameter, $section);
657 my $count;
658 my $id;
659
660 $id = "API-".$args{'function'};
660 $id = "API-" . $args{'function'};
661 $id =~ s/[^A-Za-z0-9]/-/g;
662
663 print "<refentry id=\"$id\">\n";
664 print "<refentryinfo>\n";
665 print " <title>LINUX</title>\n";
666 print " <productname>Kernel Hackers Manual</productname>\n";
667 print " <date>$man_date</date>\n";
668 print "</refentryinfo>\n";
669 print "<refmeta>\n";
661 $id =~ s/[^A-Za-z0-9]/-/g;
662
663 print "<refentry id=\"$id\">\n";
664 print "<refentryinfo>\n";
665 print " <title>LINUX</title>\n";
666 print " <productname>Kernel Hackers Manual</productname>\n";
667 print " <date>$man_date</date>\n";
668 print "</refentryinfo>\n";
669 print "<refmeta>\n";
670 print " <refentrytitle><phrase>".$args{'function'}."</phrase></refentrytitle>\n";
670 print " <refentrytitle><phrase>" . $args{'function'} . "</phrase></refentrytitle>\n";
671 print " <manvolnum>9</manvolnum>\n";
672 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
673 print "</refmeta>\n";
674 print "<refnamediv>\n";
671 print " <manvolnum>9</manvolnum>\n";
672 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
673 print "</refmeta>\n";
674 print "<refnamediv>\n";
675 print " <refname>".$args{'function'}."</refname>\n";
675 print " <refname>" . $args{'function'} . "</refname>\n";
676 print " <refpurpose>\n";
677 print " ";
678 output_highlight ($args{'purpose'});
679 print " </refpurpose>\n";
680 print "</refnamediv>\n";
681
682 print "<refsynopsisdiv>\n";
683 print " <title>Synopsis</title>\n";
684 print " <funcsynopsis><funcprototype>\n";
676 print " <refpurpose>\n";
677 print " ";
678 output_highlight ($args{'purpose'});
679 print " </refpurpose>\n";
680 print "</refnamediv>\n";
681
682 print "<refsynopsisdiv>\n";
683 print " <title>Synopsis</title>\n";
684 print " <funcsynopsis><funcprototype>\n";
685 print " <funcdef>".$args{'functiontype'}." ";
686 print "<function>".$args{'function'}." </function></funcdef>\n";
685 print " <funcdef>" . $args{'functiontype'} . " ";
686 print "<function>" . $args{'function'} . " </function></funcdef>\n";
687
688 $count = 0;
689 if ($#{$args{'parameterlist'}} >= 0) {
690 foreach $parameter (@{$args{'parameterlist'}}) {
691 $type = $args{'parametertypes'}{$parameter};
692 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
693 # pointer-to-function
694 print " <paramdef>$1<parameter>$parameter</parameter>)\n";
695 print " <funcparams>$2</funcparams></paramdef>\n";
696 } else {
687
688 $count = 0;
689 if ($#{$args{'parameterlist'}} >= 0) {
690 foreach $parameter (@{$args{'parameterlist'}}) {
691 $type = $args{'parametertypes'}{$parameter};
692 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
693 # pointer-to-function
694 print " <paramdef>$1<parameter>$parameter</parameter>)\n";
695 print " <funcparams>$2</funcparams></paramdef>\n";
696 } else {
697 print " <paramdef>".$type;
697 print " <paramdef>" . $type;
698 print " <parameter>$parameter</parameter></paramdef>\n";
699 }
700 }
701 } else {
702 print " <void/>\n";
703 }
704 print " </funcprototype></funcsynopsis>\n";
705 print "</refsynopsisdiv>\n";

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

729}
730
731# output struct in XML DocBook
732sub output_struct_xml(%) {
733 my %args = %{$_[0]};
734 my ($parameter, $section);
735 my $id;
736
698 print " <parameter>$parameter</parameter></paramdef>\n";
699 }
700 }
701 } else {
702 print " <void/>\n";
703 }
704 print " </funcprototype></funcsynopsis>\n";
705 print "</refsynopsisdiv>\n";

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

729}
730
731# output struct in XML DocBook
732sub output_struct_xml(%) {
733 my %args = %{$_[0]};
734 my ($parameter, $section);
735 my $id;
736
737 $id = "API-struct-".$args{'struct'};
737 $id = "API-struct-" . $args{'struct'};
738 $id =~ s/[^A-Za-z0-9]/-/g;
739
740 print "<refentry id=\"$id\">\n";
741 print "<refentryinfo>\n";
742 print " <title>LINUX</title>\n";
743 print " <productname>Kernel Hackers Manual</productname>\n";
744 print " <date>$man_date</date>\n";
745 print "</refentryinfo>\n";
746 print "<refmeta>\n";
738 $id =~ s/[^A-Za-z0-9]/-/g;
739
740 print "<refentry id=\"$id\">\n";
741 print "<refentryinfo>\n";
742 print " <title>LINUX</title>\n";
743 print " <productname>Kernel Hackers Manual</productname>\n";
744 print " <date>$man_date</date>\n";
745 print "</refentryinfo>\n";
746 print "<refmeta>\n";
747 print " <refentrytitle><phrase>".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n";
747 print " <refentrytitle><phrase>" . $args{'type'} . " " . $args{'struct'} . "</phrase></refentrytitle>\n";
748 print " <manvolnum>9</manvolnum>\n";
749 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
750 print "</refmeta>\n";
751 print "<refnamediv>\n";
748 print " <manvolnum>9</manvolnum>\n";
749 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
750 print "</refmeta>\n";
751 print "<refnamediv>\n";
752 print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n";
752 print " <refname>" . $args{'type'} . " " . $args{'struct'} . "</refname>\n";
753 print " <refpurpose>\n";
754 print " ";
755 output_highlight ($args{'purpose'});
756 print " </refpurpose>\n";
757 print "</refnamediv>\n";
758
759 print "<refsynopsisdiv>\n";
760 print " <title>Synopsis</title>\n";
761 print " <programlisting>\n";
753 print " <refpurpose>\n";
754 print " ";
755 output_highlight ($args{'purpose'});
756 print " </refpurpose>\n";
757 print "</refnamediv>\n";
758
759 print "<refsynopsisdiv>\n";
760 print " <title>Synopsis</title>\n";
761 print " <programlisting>\n";
762 print $args{'type'}." ".$args{'struct'}." {\n";
762 print $args{'type'} . " " . $args{'struct'} . " {\n";
763 foreach $parameter (@{$args{'parameterlist'}}) {
764 if ($parameter =~ /^#/) {
765 print "$parameter\n";
766 next;
767 }
768
769 my $parameter_name = $parameter;
770 $parameter_name =~ s/\[.*//;
771
772 defined($args{'parameterdescs'}{$parameter_name}) || next;
773 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
774 $type = $args{'parametertypes'}{$parameter};
775 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
776 # pointer-to-function
777 print " $1 $parameter) ($2);\n";
778 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
779 # bitfield
780 print " $1 $parameter$2;\n";
781 } else {
763 foreach $parameter (@{$args{'parameterlist'}}) {
764 if ($parameter =~ /^#/) {
765 print "$parameter\n";
766 next;
767 }
768
769 my $parameter_name = $parameter;
770 $parameter_name =~ s/\[.*//;
771
772 defined($args{'parameterdescs'}{$parameter_name}) || next;
773 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
774 $type = $args{'parametertypes'}{$parameter};
775 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
776 # pointer-to-function
777 print " $1 $parameter) ($2);\n";
778 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
779 # bitfield
780 print " $1 $parameter$2;\n";
781 } else {
782 print " ".$type." ".$parameter.";\n";
782 print " " . $type . " " . $parameter . ";\n";
783 }
784 }
785 print "};";
786 print " </programlisting>\n";
787 print "</refsynopsisdiv>\n";
788
789 print " <refsect1>\n";
790 print " <title>Members</title>\n";

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

819
820# output enum in XML DocBook
821sub output_enum_xml(%) {
822 my %args = %{$_[0]};
823 my ($parameter, $section);
824 my $count;
825 my $id;
826
783 }
784 }
785 print "};";
786 print " </programlisting>\n";
787 print "</refsynopsisdiv>\n";
788
789 print " <refsect1>\n";
790 print " <title>Members</title>\n";

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

819
820# output enum in XML DocBook
821sub output_enum_xml(%) {
822 my %args = %{$_[0]};
823 my ($parameter, $section);
824 my $count;
825 my $id;
826
827 $id = "API-enum-".$args{'enum'};
827 $id = "API-enum-" . $args{'enum'};
828 $id =~ s/[^A-Za-z0-9]/-/g;
829
830 print "<refentry id=\"$id\">\n";
831 print "<refentryinfo>\n";
832 print " <title>LINUX</title>\n";
833 print " <productname>Kernel Hackers Manual</productname>\n";
834 print " <date>$man_date</date>\n";
835 print "</refentryinfo>\n";
836 print "<refmeta>\n";
828 $id =~ s/[^A-Za-z0-9]/-/g;
829
830 print "<refentry id=\"$id\">\n";
831 print "<refentryinfo>\n";
832 print " <title>LINUX</title>\n";
833 print " <productname>Kernel Hackers Manual</productname>\n";
834 print " <date>$man_date</date>\n";
835 print "</refentryinfo>\n";
836 print "<refmeta>\n";
837 print " <refentrytitle><phrase>enum ".$args{'enum'}."</phrase></refentrytitle>\n";
837 print " <refentrytitle><phrase>enum " . $args{'enum'} . "</phrase></refentrytitle>\n";
838 print " <manvolnum>9</manvolnum>\n";
839 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
840 print "</refmeta>\n";
841 print "<refnamediv>\n";
838 print " <manvolnum>9</manvolnum>\n";
839 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
840 print "</refmeta>\n";
841 print "<refnamediv>\n";
842 print " <refname>enum ".$args{'enum'}."</refname>\n";
842 print " <refname>enum " . $args{'enum'} . "</refname>\n";
843 print " <refpurpose>\n";
844 print " ";
845 output_highlight ($args{'purpose'});
846 print " </refpurpose>\n";
847 print "</refnamediv>\n";
848
849 print "<refsynopsisdiv>\n";
850 print " <title>Synopsis</title>\n";
851 print " <programlisting>\n";
843 print " <refpurpose>\n";
844 print " ";
845 output_highlight ($args{'purpose'});
846 print " </refpurpose>\n";
847 print "</refnamediv>\n";
848
849 print "<refsynopsisdiv>\n";
850 print " <title>Synopsis</title>\n";
851 print " <programlisting>\n";
852 print "enum ".$args{'enum'}." {\n";
852 print "enum " . $args{'enum'} . " {\n";
853 $count = 0;
854 foreach $parameter (@{$args{'parameterlist'}}) {
855 print " $parameter";
856 if ($count != $#{$args{'parameterlist'}}) {
857 $count++;
858 print ",";
859 }
860 print "\n";

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

886}
887
888# output typedef in XML DocBook
889sub output_typedef_xml(%) {
890 my %args = %{$_[0]};
891 my ($parameter, $section);
892 my $id;
893
853 $count = 0;
854 foreach $parameter (@{$args{'parameterlist'}}) {
855 print " $parameter";
856 if ($count != $#{$args{'parameterlist'}}) {
857 $count++;
858 print ",";
859 }
860 print "\n";

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

886}
887
888# output typedef in XML DocBook
889sub output_typedef_xml(%) {
890 my %args = %{$_[0]};
891 my ($parameter, $section);
892 my $id;
893
894 $id = "API-typedef-".$args{'typedef'};
894 $id = "API-typedef-" . $args{'typedef'};
895 $id =~ s/[^A-Za-z0-9]/-/g;
896
897 print "<refentry id=\"$id\">\n";
898 print "<refentryinfo>\n";
899 print " <title>LINUX</title>\n";
900 print " <productname>Kernel Hackers Manual</productname>\n";
901 print " <date>$man_date</date>\n";
902 print "</refentryinfo>\n";
903 print "<refmeta>\n";
895 $id =~ s/[^A-Za-z0-9]/-/g;
896
897 print "<refentry id=\"$id\">\n";
898 print "<refentryinfo>\n";
899 print " <title>LINUX</title>\n";
900 print " <productname>Kernel Hackers Manual</productname>\n";
901 print " <date>$man_date</date>\n";
902 print "</refentryinfo>\n";
903 print "<refmeta>\n";
904 print " <refentrytitle><phrase>typedef ".$args{'typedef'}."</phrase></refentrytitle>\n";
904 print " <refentrytitle><phrase>typedef " . $args{'typedef'} . "</phrase></refentrytitle>\n";
905 print " <manvolnum>9</manvolnum>\n";
906 print "</refmeta>\n";
907 print "<refnamediv>\n";
905 print " <manvolnum>9</manvolnum>\n";
906 print "</refmeta>\n";
907 print "<refnamediv>\n";
908 print " <refname>typedef ".$args{'typedef'}."</refname>\n";
908 print " <refname>typedef " . $args{'typedef'} . "</refname>\n";
909 print " <refpurpose>\n";
910 print " ";
911 output_highlight ($args{'purpose'});
912 print " </refpurpose>\n";
913 print "</refnamediv>\n";
914
915 print "<refsynopsisdiv>\n";
916 print " <title>Synopsis</title>\n";
909 print " <refpurpose>\n";
910 print " ";
911 output_highlight ($args{'purpose'});
912 print " </refpurpose>\n";
913 print "</refnamediv>\n";
914
915 print "<refsynopsisdiv>\n";
916 print " <title>Synopsis</title>\n";
917 print " <synopsis>typedef ".$args{'typedef'}.";</synopsis>\n";
917 print " <synopsis>typedef " . $args{'typedef'} . ";</synopsis>\n";
918 print "</refsynopsisdiv>\n";
919
920 output_section_xml(@_);
921
922 print "</refentry>\n\n";
923}
924
925# output in XML DocBook

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

958
959# output in XML DocBook
960sub output_function_gnome {
961 my %args = %{$_[0]};
962 my ($parameter, $section);
963 my $count;
964 my $id;
965
918 print "</refsynopsisdiv>\n";
919
920 output_section_xml(@_);
921
922 print "</refentry>\n\n";
923}
924
925# output in XML DocBook

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

958
959# output in XML DocBook
960sub output_function_gnome {
961 my %args = %{$_[0]};
962 my ($parameter, $section);
963 my $count;
964 my $id;
965
966 $id = $args{'module'}."-".$args{'function'};
966 $id = $args{'module'} . "-" . $args{'function'};
967 $id =~ s/[^A-Za-z0-9]/-/g;
968
969 print "<sect2>\n";
967 $id =~ s/[^A-Za-z0-9]/-/g;
968
969 print "<sect2>\n";
970 print " <title id=\"$id\">".$args{'function'}."</title>\n";
970 print " <title id=\"$id\">" . $args{'function'} . "</title>\n";
971
972 print " <funcsynopsis>\n";
971
972 print " <funcsynopsis>\n";
973 print " <funcdef>".$args{'functiontype'}." ";
974 print "<function>".$args{'function'}." ";
973 print " <funcdef>" . $args{'functiontype'} . " ";
974 print "<function>" . $args{'function'} . " ";
975 print "</function></funcdef>\n";
976
977 $count = 0;
978 if ($#{$args{'parameterlist'}} >= 0) {
979 foreach $parameter (@{$args{'parameterlist'}}) {
980 $type = $args{'parametertypes'}{$parameter};
981 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
982 # pointer-to-function
983 print " <paramdef>$1 <parameter>$parameter</parameter>)\n";
984 print " <funcparams>$2</funcparams></paramdef>\n";
985 } else {
975 print "</function></funcdef>\n";
976
977 $count = 0;
978 if ($#{$args{'parameterlist'}} >= 0) {
979 foreach $parameter (@{$args{'parameterlist'}}) {
980 $type = $args{'parametertypes'}{$parameter};
981 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
982 # pointer-to-function
983 print " <paramdef>$1 <parameter>$parameter</parameter>)\n";
984 print " <funcparams>$2</funcparams></paramdef>\n";
985 } else {
986 print " <paramdef>".$type;
986 print " <paramdef>" . $type;
987 print " <parameter>$parameter</parameter></paramdef>\n";
988 }
989 }
990 } else {
991 print " <void>\n";
992 }
993 print " </funcsynopsis>\n";
994 if ($#{$args{'parameterlist'}} >= 0) {

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

1038sub output_function_man(%) {
1039 my %args = %{$_[0]};
1040 my ($parameter, $section);
1041 my $count;
1042
1043 print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n";
1044
1045 print ".SH NAME\n";
987 print " <parameter>$parameter</parameter></paramdef>\n";
988 }
989 }
990 } else {
991 print " <void>\n";
992 }
993 print " </funcsynopsis>\n";
994 if ($#{$args{'parameterlist'}} >= 0) {

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

1038sub output_function_man(%) {
1039 my %args = %{$_[0]};
1040 my ($parameter, $section);
1041 my $count;
1042
1043 print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n";
1044
1045 print ".SH NAME\n";
1046 print $args{'function'}." \\- ".$args{'purpose'}."\n";
1046 print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
1047
1048 print ".SH SYNOPSIS\n";
1049 if ($args{'functiontype'} ne "") {
1047
1048 print ".SH SYNOPSIS\n";
1049 if ($args{'functiontype'} ne "") {
1050 print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n";
1050 print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n";
1051 } else {
1051 } else {
1052 print ".B \"".$args{'function'}."\n";
1052 print ".B \"" . $args{'function'} . "\n";
1053 }
1054 $count = 0;
1055 my $parenth = "(";
1056 my $post = ",";
1057 foreach my $parameter (@{$args{'parameterlist'}}) {
1058 if ($count == $#{$args{'parameterlist'}}) {
1059 $post = ");";
1060 }
1061 $type = $args{'parametertypes'}{$parameter};
1062 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1063 # pointer-to-function
1053 }
1054 $count = 0;
1055 my $parenth = "(";
1056 my $post = ",";
1057 foreach my $parameter (@{$args{'parameterlist'}}) {
1058 if ($count == $#{$args{'parameterlist'}}) {
1059 $post = ");";
1060 }
1061 $type = $args{'parametertypes'}{$parameter};
1062 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1063 # pointer-to-function
1064 print ".BI \"".$parenth.$1."\" ".$parameter." \") (".$2.")".$post."\"\n";
1064 print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n";
1065 } else {
1066 $type =~ s/([^\*])$/$1 /;
1065 } else {
1066 $type =~ s/([^\*])$/$1 /;
1067 print ".BI \"".$parenth.$type."\" ".$parameter." \"".$post."\"\n";
1067 print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n";
1068 }
1069 $count++;
1070 $parenth = "";
1071 }
1072
1073 print ".SH ARGUMENTS\n";
1074 foreach $parameter (@{$args{'parameterlist'}}) {
1075 my $parameter_name = $parameter;
1076 $parameter_name =~ s/\[.*//;
1077
1068 }
1069 $count++;
1070 $parenth = "";
1071 }
1072
1073 print ".SH ARGUMENTS\n";
1074 foreach $parameter (@{$args{'parameterlist'}}) {
1075 my $parameter_name = $parameter;
1076 $parameter_name =~ s/\[.*//;
1077
1078 print ".IP \"".$parameter."\" 12\n";
1078 print ".IP \"" . $parameter . "\" 12\n";
1079 output_highlight($args{'parameterdescs'}{$parameter_name});
1080 }
1081 foreach $section (@{$args{'sectionlist'}}) {
1082 print ".SH \"", uc $section, "\"\n";
1083 output_highlight($args{'sections'}{$section});
1084 }
1085}
1086
1087##
1088# output enum in man
1089sub output_enum_man(%) {
1090 my %args = %{$_[0]};
1091 my ($parameter, $section);
1092 my $count;
1093
1094 print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";
1095
1096 print ".SH NAME\n";
1079 output_highlight($args{'parameterdescs'}{$parameter_name});
1080 }
1081 foreach $section (@{$args{'sectionlist'}}) {
1082 print ".SH \"", uc $section, "\"\n";
1083 output_highlight($args{'sections'}{$section});
1084 }
1085}
1086
1087##
1088# output enum in man
1089sub output_enum_man(%) {
1090 my %args = %{$_[0]};
1091 my ($parameter, $section);
1092 my $count;
1093
1094 print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";
1095
1096 print ".SH NAME\n";
1097 print "enum ".$args{'enum'}." \\- ".$args{'purpose'}."\n";
1097 print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
1098
1099 print ".SH SYNOPSIS\n";
1098
1099 print ".SH SYNOPSIS\n";
1100 print "enum ".$args{'enum'}." {\n";
1100 print "enum " . $args{'enum'} . " {\n";
1101 $count = 0;
1102 foreach my $parameter (@{$args{'parameterlist'}}) {
1103 print ".br\n.BI \" $parameter\"\n";
1104 if ($count == $#{$args{'parameterlist'}}) {
1105 print "\n};\n";
1106 last;
1107 }
1108 else {
1109 print ", \n.br\n";
1110 }
1111 $count++;
1112 }
1113
1114 print ".SH Constants\n";
1115 foreach $parameter (@{$args{'parameterlist'}}) {
1116 my $parameter_name = $parameter;
1117 $parameter_name =~ s/\[.*//;
1118
1101 $count = 0;
1102 foreach my $parameter (@{$args{'parameterlist'}}) {
1103 print ".br\n.BI \" $parameter\"\n";
1104 if ($count == $#{$args{'parameterlist'}}) {
1105 print "\n};\n";
1106 last;
1107 }
1108 else {
1109 print ", \n.br\n";
1110 }
1111 $count++;
1112 }
1113
1114 print ".SH Constants\n";
1115 foreach $parameter (@{$args{'parameterlist'}}) {
1116 my $parameter_name = $parameter;
1117 $parameter_name =~ s/\[.*//;
1118
1119 print ".IP \"".$parameter."\" 12\n";
1119 print ".IP \"" . $parameter . "\" 12\n";
1120 output_highlight($args{'parameterdescs'}{$parameter_name});
1121 }
1122 foreach $section (@{$args{'sectionlist'}}) {
1123 print ".SH \"$section\"\n";
1124 output_highlight($args{'sections'}{$section});
1125 }
1126}
1127
1128##
1129# output struct in man
1130sub output_struct_man(%) {
1131 my %args = %{$_[0]};
1132 my ($parameter, $section);
1133
1120 output_highlight($args{'parameterdescs'}{$parameter_name});
1121 }
1122 foreach $section (@{$args{'sectionlist'}}) {
1123 print ".SH \"$section\"\n";
1124 output_highlight($args{'sections'}{$section});
1125 }
1126}
1127
1128##
1129# output struct in man
1130sub output_struct_man(%) {
1131 my %args = %{$_[0]};
1132 my ($parameter, $section);
1133
1134 print ".TH \"$args{'module'}\" 9 \"".$args{'type'}." ".$args{'struct'}."\" \"$man_date\" \"API Manual\" LINUX\n";
1134 print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n";
1135
1136 print ".SH NAME\n";
1135
1136 print ".SH NAME\n";
1137 print $args{'type'}." ".$args{'struct'}." \\- ".$args{'purpose'}."\n";
1137 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
1138
1139 print ".SH SYNOPSIS\n";
1138
1139 print ".SH SYNOPSIS\n";
1140 print $args{'type'}." ".$args{'struct'}." {\n.br\n";
1140 print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
1141
1142 foreach my $parameter (@{$args{'parameterlist'}}) {
1143 if ($parameter =~ /^#/) {
1144 print ".BI \"$parameter\"\n.br\n";
1145 next;
1146 }
1147 my $parameter_name = $parameter;
1148 $parameter_name =~ s/\[.*//;
1149
1150 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1151 $type = $args{'parametertypes'}{$parameter};
1152 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1153 # pointer-to-function
1141
1142 foreach my $parameter (@{$args{'parameterlist'}}) {
1143 if ($parameter =~ /^#/) {
1144 print ".BI \"$parameter\"\n.br\n";
1145 next;
1146 }
1147 my $parameter_name = $parameter;
1148 $parameter_name =~ s/\[.*//;
1149
1150 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1151 $type = $args{'parametertypes'}{$parameter};
1152 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1153 # pointer-to-function
1154 print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n";
1154 print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n";
1155 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1156 # bitfield
1155 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1156 # bitfield
1157 print ".BI \" ".$1."\ \" ".$parameter.$2." \""."\"\n;\n";
1157 print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n";
1158 } else {
1159 $type =~ s/([^\*])$/$1 /;
1158 } else {
1159 $type =~ s/([^\*])$/$1 /;
1160 print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n";
1160 print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n";
1161 }
1162 print "\n.br\n";
1163 }
1164 print "};\n.br\n";
1165
1166 print ".SH Members\n";
1167 foreach $parameter (@{$args{'parameterlist'}}) {
1168 ($parameter =~ /^#/) && next;
1169
1170 my $parameter_name = $parameter;
1171 $parameter_name =~ s/\[.*//;
1172
1173 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1161 }
1162 print "\n.br\n";
1163 }
1164 print "};\n.br\n";
1165
1166 print ".SH Members\n";
1167 foreach $parameter (@{$args{'parameterlist'}}) {
1168 ($parameter =~ /^#/) && next;
1169
1170 my $parameter_name = $parameter;
1171 $parameter_name =~ s/\[.*//;
1172
1173 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1174 print ".IP \"".$parameter."\" 12\n";
1174 print ".IP \"" . $parameter . "\" 12\n";
1175 output_highlight($args{'parameterdescs'}{$parameter_name});
1176 }
1177 foreach $section (@{$args{'sectionlist'}}) {
1178 print ".SH \"$section\"\n";
1179 output_highlight($args{'sections'}{$section});
1180 }
1181}
1182
1183##
1184# output typedef in man
1185sub output_typedef_man(%) {
1186 my %args = %{$_[0]};
1187 my ($parameter, $section);
1188
1189 print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";
1190
1191 print ".SH NAME\n";
1175 output_highlight($args{'parameterdescs'}{$parameter_name});
1176 }
1177 foreach $section (@{$args{'sectionlist'}}) {
1178 print ".SH \"$section\"\n";
1179 output_highlight($args{'sections'}{$section});
1180 }
1181}
1182
1183##
1184# output typedef in man
1185sub output_typedef_man(%) {
1186 my %args = %{$_[0]};
1187 my ($parameter, $section);
1188
1189 print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";
1190
1191 print ".SH NAME\n";
1192 print "typedef ".$args{'typedef'}." \\- ".$args{'purpose'}."\n";
1192 print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
1193
1194 foreach $section (@{$args{'sectionlist'}}) {
1195 print ".SH \"$section\"\n";
1196 output_highlight($args{'sections'}{$section});
1197 }
1198}
1199
1200sub output_blockhead_man(%) {

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

1213##
1214# output in text
1215sub output_function_text(%) {
1216 my %args = %{$_[0]};
1217 my ($parameter, $section);
1218 my $start;
1219
1220 print "Name:\n\n";
1193
1194 foreach $section (@{$args{'sectionlist'}}) {
1195 print ".SH \"$section\"\n";
1196 output_highlight($args{'sections'}{$section});
1197 }
1198}
1199
1200sub output_blockhead_man(%) {

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

1213##
1214# output in text
1215sub output_function_text(%) {
1216 my %args = %{$_[0]};
1217 my ($parameter, $section);
1218 my $start;
1219
1220 print "Name:\n\n";
1221 print $args{'function'}." - ".$args{'purpose'}."\n";
1221 print $args{'function'} . " - " . $args{'purpose'} . "\n";
1222
1223 print "\nSynopsis:\n\n";
1224 if ($args{'functiontype'} ne "") {
1222
1223 print "\nSynopsis:\n\n";
1224 if ($args{'functiontype'} ne "") {
1225 $start = $args{'functiontype'}." ".$args{'function'}." (";
1225 $start = $args{'functiontype'} . " " . $args{'function'} . " (";
1226 } else {
1226 } else {
1227 $start = $args{'function'}." (";
1227 $start = $args{'function'} . " (";
1228 }
1229 print $start;
1230
1231 my $count = 0;
1232 foreach my $parameter (@{$args{'parameterlist'}}) {
1233 $type = $args{'parametertypes'}{$parameter};
1234 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1235 # pointer-to-function
1228 }
1229 print $start;
1230
1231 my $count = 0;
1232 foreach my $parameter (@{$args{'parameterlist'}}) {
1233 $type = $args{'parametertypes'}{$parameter};
1234 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1235 # pointer-to-function
1236 print $1.$parameter.") (".$2;
1236 print $1 . $parameter . ") (" . $2;
1237 } else {
1237 } else {
1238 print $type." ".$parameter;
1238 print $type . " " . $parameter;
1239 }
1240 if ($count != $#{$args{'parameterlist'}}) {
1241 $count++;
1242 print ",\n";
1243 print " " x length($start);
1244 } else {
1245 print ");\n\n";
1246 }
1247 }
1248
1249 print "Arguments:\n\n";
1250 foreach $parameter (@{$args{'parameterlist'}}) {
1251 my $parameter_name = $parameter;
1252 $parameter_name =~ s/\[.*//;
1253
1239 }
1240 if ($count != $#{$args{'parameterlist'}}) {
1241 $count++;
1242 print ",\n";
1243 print " " x length($start);
1244 } else {
1245 print ");\n\n";
1246 }
1247 }
1248
1249 print "Arguments:\n\n";
1250 foreach $parameter (@{$args{'parameterlist'}}) {
1251 my $parameter_name = $parameter;
1252 $parameter_name =~ s/\[.*//;
1253
1254 print $parameter."\n\t".$args{'parameterdescs'}{$parameter_name}."\n";
1254 print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n";
1255 }
1256 output_section_text(@_);
1257}
1258
1259#output sections in text
1260sub output_section_text(%) {
1261 my %args = %{$_[0]};
1262 my $section;

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

1271
1272# output enum in text
1273sub output_enum_text(%) {
1274 my %args = %{$_[0]};
1275 my ($parameter);
1276 my $count;
1277 print "Enum:\n\n";
1278
1255 }
1256 output_section_text(@_);
1257}
1258
1259#output sections in text
1260sub output_section_text(%) {
1261 my %args = %{$_[0]};
1262 my $section;

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

1271
1272# output enum in text
1273sub output_enum_text(%) {
1274 my %args = %{$_[0]};
1275 my ($parameter);
1276 my $count;
1277 print "Enum:\n\n";
1278
1279 print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n";
1280 print "enum ".$args{'enum'}." {\n";
1279 print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n";
1280 print "enum " . $args{'enum'} . " {\n";
1281 $count = 0;
1282 foreach $parameter (@{$args{'parameterlist'}}) {
1283 print "\t$parameter";
1284 if ($count != $#{$args{'parameterlist'}}) {
1285 $count++;
1286 print ",";
1287 }
1288 print "\n";
1289 }
1290 print "};\n\n";
1291
1292 print "Constants:\n\n";
1293 foreach $parameter (@{$args{'parameterlist'}}) {
1294 print "$parameter\n\t";
1281 $count = 0;
1282 foreach $parameter (@{$args{'parameterlist'}}) {
1283 print "\t$parameter";
1284 if ($count != $#{$args{'parameterlist'}}) {
1285 $count++;
1286 print ",";
1287 }
1288 print "\n";
1289 }
1290 print "};\n\n";
1291
1292 print "Constants:\n\n";
1293 foreach $parameter (@{$args{'parameterlist'}}) {
1294 print "$parameter\n\t";
1295 print $args{'parameterdescs'}{$parameter}."\n";
1295 print $args{'parameterdescs'}{$parameter} . "\n";
1296 }
1297
1298 output_section_text(@_);
1299}
1300
1301# output typedef in text
1302sub output_typedef_text(%) {
1303 my %args = %{$_[0]};
1304 my ($parameter);
1305 my $count;
1306 print "Typedef:\n\n";
1307
1296 }
1297
1298 output_section_text(@_);
1299}
1300
1301# output typedef in text
1302sub output_typedef_text(%) {
1303 my %args = %{$_[0]};
1304 my ($parameter);
1305 my $count;
1306 print "Typedef:\n\n";
1307
1308 print "typedef ".$args{'typedef'}." - ".$args{'purpose'}."\n";
1308 print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n";
1309 output_section_text(@_);
1310}
1311
1312# output struct as text
1313sub output_struct_text(%) {
1314 my %args = %{$_[0]};
1315 my ($parameter);
1316
1309 output_section_text(@_);
1310}
1311
1312# output struct as text
1313sub output_struct_text(%) {
1314 my %args = %{$_[0]};
1315 my ($parameter);
1316
1317 print $args{'type'}." ".$args{'struct'}." - ".$args{'purpose'}."\n\n";
1318 print $args{'type'}." ".$args{'struct'}." {\n";
1317 print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n";
1318 print $args{'type'} . " " . $args{'struct'} . " {\n";
1319 foreach $parameter (@{$args{'parameterlist'}}) {
1320 if ($parameter =~ /^#/) {
1321 print "$parameter\n";
1322 next;
1323 }
1324
1325 my $parameter_name = $parameter;
1326 $parameter_name =~ s/\[.*//;
1327
1328 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1329 $type = $args{'parametertypes'}{$parameter};
1330 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1331 # pointer-to-function
1332 print "\t$1 $parameter) ($2);\n";
1333 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1334 # bitfield
1335 print "\t$1 $parameter$2;\n";
1336 } else {
1319 foreach $parameter (@{$args{'parameterlist'}}) {
1320 if ($parameter =~ /^#/) {
1321 print "$parameter\n";
1322 next;
1323 }
1324
1325 my $parameter_name = $parameter;
1326 $parameter_name =~ s/\[.*//;
1327
1328 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1329 $type = $args{'parametertypes'}{$parameter};
1330 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1331 # pointer-to-function
1332 print "\t$1 $parameter) ($2);\n";
1333 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1334 # bitfield
1335 print "\t$1 $parameter$2;\n";
1336 } else {
1337 print "\t".$type." ".$parameter.";\n";
1337 print "\t" . $type . " " . $parameter . ";\n";
1338 }
1339 }
1340 print "};\n\n";
1341
1342 print "Members:\n\n";
1343 foreach $parameter (@{$args{'parameterlist'}}) {
1344 ($parameter =~ /^#/) && next;
1345
1346 my $parameter_name = $parameter;
1347 $parameter_name =~ s/\[.*//;
1348
1349 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1350 print "$parameter\n\t";
1338 }
1339 }
1340 print "};\n\n";
1341
1342 print "Members:\n\n";
1343 foreach $parameter (@{$args{'parameterlist'}}) {
1344 ($parameter =~ /^#/) && next;
1345
1346 my $parameter_name = $parameter;
1347 $parameter_name =~ s/\[.*//;
1348
1349 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1350 print "$parameter\n\t";
1351 print $args{'parameterdescs'}{$parameter_name}."\n";
1351 print $args{'parameterdescs'}{$parameter_name} . "\n";
1352 }
1353 print "\n";
1354 output_section_text(@_);
1355}
1356
1357sub output_blockhead_text(%) {
1358 my %args = %{$_[0]};
1359 my ($parameter, $section);

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

1382 $section_counter++;
1383 }
1384}
1385
1386##
1387# generic output function - calls the right one based on current output mode.
1388sub output_blockhead {
1389 no strict 'refs';
1352 }
1353 print "\n";
1354 output_section_text(@_);
1355}
1356
1357sub output_blockhead_text(%) {
1358 my %args = %{$_[0]};
1359 my ($parameter, $section);

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

1382 $section_counter++;
1383 }
1384}
1385
1386##
1387# generic output function - calls the right one based on current output mode.
1388sub output_blockhead {
1389 no strict 'refs';
1390 my $func = "output_blockhead_".$output_mode;
1390 my $func = "output_blockhead_" . $output_mode;
1391 &$func(@_);
1392 $section_counter++;
1393}
1394
1395##
1396# takes a declaration (struct, union, enum, typedef) and
1397# invokes the right handler. NOT called for functions.
1398sub dump_declaration($$) {
1399 no strict 'refs';
1400 my ($prototype, $file) = @_;
1391 &$func(@_);
1392 $section_counter++;
1393}
1394
1395##
1396# takes a declaration (struct, union, enum, typedef) and
1397# invokes the right handler. NOT called for functions.
1398sub dump_declaration($$) {
1399 no strict 'refs';
1400 my ($prototype, $file) = @_;
1401 my $func = "dump_".$decl_type;
1401 my $func = "dump_" . $decl_type;
1402 &$func(@_);
1403}
1404
1405sub dump_union($$) {
1406 dump_struct(@_);
1407}
1408
1409sub dump_struct($$) {

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

1640
1641 $parameterdescs{$param_name} = $undescribed;
1642
1643 if (($type eq 'function') || ($type eq 'enum')) {
1644 print STDERR "Warning(${file}:$.): Function parameter ".
1645 "or member '$param' not " .
1646 "described in '$declaration_name'\n";
1647 }
1402 &$func(@_);
1403}
1404
1405sub dump_union($$) {
1406 dump_struct(@_);
1407}
1408
1409sub dump_struct($$) {

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

1640
1641 $parameterdescs{$param_name} = $undescribed;
1642
1643 if (($type eq 'function') || ($type eq 'enum')) {
1644 print STDERR "Warning(${file}:$.): Function parameter ".
1645 "or member '$param' not " .
1646 "described in '$declaration_name'\n";
1647 }
1648 print STDERR "Warning(${file}:$.):".
1648 print STDERR "Warning(${file}:$.):" .
1649 " No description found for parameter '$param'\n";
1650 ++$warnings;
1651 }
1652 }
1653
1654 push @parameterlist, $param;
1655 $parametertypes{$param} = $type;
1656}

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

1902 }
1903
1904 while (1) {
1905 if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
1906 $prototype .= $1 . $2;
1907 ($2 eq '{') && $brcount++;
1908 ($2 eq '}') && $brcount--;
1909 if (($2 eq ';') && ($brcount == 0)) {
1649 " No description found for parameter '$param'\n";
1650 ++$warnings;
1651 }
1652 }
1653
1654 push @parameterlist, $param;
1655 $parametertypes{$param} = $type;
1656}

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

1902 }
1903
1904 while (1) {
1905 if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
1906 $prototype .= $1 . $2;
1907 ($2 eq '{') && $brcount++;
1908 ($2 eq '}') && $brcount--;
1909 if (($2 eq ';') && ($brcount == 0)) {
1910 dump_declaration($prototype,$file);
1910 dump_declaration($prototype, $file);
1911 reset_state();
1912 last;
1913 }
1914 $x = $3;
1915 } else {
1916 $prototype .= $x;
1917 last;
1918 }

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

2079 # miguel-style comment kludge, look for blank lines after
2080 # @parameter line to signify start of description
2081 if ($1 eq "" &&
2082 ($section =~ m/^@/ || $section eq $section_context)) {
2083 dump_section($file, $section, xml_escape($contents));
2084 $section = $section_default;
2085 $contents = "";
2086 } else {
1911 reset_state();
1912 last;
1913 }
1914 $x = $3;
1915 } else {
1916 $prototype .= $x;
1917 last;
1918 }

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

2079 # miguel-style comment kludge, look for blank lines after
2080 # @parameter line to signify start of description
2081 if ($1 eq "" &&
2082 ($section =~ m/^@/ || $section eq $section_context)) {
2083 dump_section($file, $section, xml_escape($contents));
2084 $section = $section_default;
2085 $contents = "";
2086 } else {
2087 $contents .= $1."\n";
2087 $contents .= $1 . "\n";
2088 }
2089 } else {
2090 # i dont know - bad line? ignore.
2091 print STDERR "Warning(${file}:$.): bad line: $_";
2092 ++$warnings;
2093 }
2094 } elsif ($state == 3) { # scanning for function '{' (end of prototype)
2095 if ($decl_type eq 'function') {

--- 82 unchanged lines hidden ---
2088 }
2089 } else {
2090 # i dont know - bad line? ignore.
2091 print STDERR "Warning(${file}:$.): bad line: $_";
2092 ++$warnings;
2093 }
2094 } elsif ($state == 3) { # scanning for function '{' (end of prototype)
2095 if ($decl_type eq 'function') {

--- 82 unchanged lines hidden ---