patch-2.4.0-test12 linux/scripts/kernel-doc
Next file: linux/CREDITS
Previous file: linux/net/x25/af_x25.c
Back to the patch index
Back to the overall index
- Lines: 110
- Date:
Mon Dec 11 13:43:59 2000
- Orig file:
v2.4.0-test11/linux/scripts/kernel-doc
- Orig date:
Wed Jul 5 12:56:01 2000
diff -u --recursive --new-file v2.4.0-test11/linux/scripts/kernel-doc linux/scripts/kernel-doc
@@ -2,10 +2,15 @@
## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
## Copyright (C) 2000 Tim Waugh <twaugh@redhat.com> ##
+## ##
+## #define enhancements by Armin Kuster <akuster@mvista.com> ##
+## Copyright (c) 2000 MontaVista Software, Inc. ##
## ##
## This software falls under the GNU General Public License. ##
## Please read the COPYING file for more information ##
+# w.o. 03-11-2000: added the '-filelist' option.
+
#
# This will read a 'c' file and scan for embedded comments in the
# style of gnome comments (+minor extensions - see below).
@@ -85,7 +90,7 @@
$type_constant = "\\\%([-_\\w]+)";
$type_func = "(\\w+)\\(\\)";
$type_param = "\\\@(\\w+)";
-$type_struct = "\\\&((struct\\s*)?\\w+)";
+$type_struct = "\\\&((struct\\s*)?[_\\w]+)";
$type_env = "(\\\$\\w+)";
@@ -150,6 +155,8 @@
$blankline = $blankline_man;
$modulename = "API Documentation";
$function_only = 0;
+$filelist = '';
+
while ($ARGV[0] =~ m/^-(.*)/) {
$cmd = shift @ARGV;
if ($cmd eq "-html") {
@@ -186,6 +193,8 @@
$verbose = 1;
} elsif (($cmd eq "-h") || ($cmd eq "--help")) {
usage();
+ } elsif ($cmd eq '-filelist') {
+ $filelist = shift @ARGV;
}
}
@@ -326,7 +335,8 @@
print "<refnamediv>\n";
print " <refname>".$args{'function'}."</refname>\n";
print " <refpurpose>\n";
- print " ".$args{'purpose'}."\n";
+ print " ";
+ output_highlight ($args{'purpose'});
print " </refpurpose>\n";
print "</refnamediv>\n";
@@ -662,8 +672,14 @@
$prototype =~ s/^extern+ //;
$prototype =~ s/^inline+ //;
$prototype =~ s/^__inline__+ //;
+ $prototype =~ s/^#define+ //; #ak added
- if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
+ if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
+ $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
+ $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
+ $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
+ $prototype =~ m/^(\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
+ $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
$prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
$prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
$prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
@@ -780,13 +796,28 @@
$section_intro = "Introduction";
$section = $section_default;
-$lineno = 0;
+if( $filelist ne '' ) {
+ open(FLIST,"<$filelist") or die "Can't open file list $filelist";
+ while(<FLIST>) {
+ chop;
+ process_file($_);
+ }
+}
+
foreach $file (@ARGV) {
chomp($file);
+ process_file($file);
+}
+
+sub process_file($) {
+ my ($file) = @_;
+
if (!open(IN,"<$file")) {
print STDERR "Error: Cannot open file $file\n";
- next;
+ return;
}
+
+ $lineno = 0;
while (<IN>) {
$lineno++;
@@ -876,7 +907,7 @@
elsif (/([^\{]*)/) {
$prototype .= $1;
}
- if (/\{/) {
+ if (/\{/ || /\#/) { # added for #define AK
$prototype =~ s@/\*.*?\*/@@gos; # strip comments.
$prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
$prototype =~ s@^ +@@gos; # strip leading spaces
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)