patch-2.4.6 linux/scripts/kernel-doc
Next file: linux/CREDITS
Previous file: linux/scripts/header.tk
Back to the patch index
Back to the overall index
- Lines: 126
- Date:
Mon Jul 2 13:56:40 2001
- Orig file:
v2.4.5/linux/scripts/kernel-doc
- Orig date:
Wed Apr 25 16:31:16 2001
diff -u --recursive --new-file v2.4.5/linux/scripts/kernel-doc linux/scripts/kernel-doc
@@ -18,10 +18,19 @@
# Functions prototyped as foo(void) same as foo()
# Stop eval'ing where we don't need to.
# -- huggie@earth.li
+
+# 27/06/2001 - Allowed whitespace after initial "/**" and
+# allowed comments before function declarations.
+# -- Christian Kreibich <ck@whoop.org>
+
# Still to do:
# - add perldoc documentation
# - Look more closely at some of the scarier bits :)
+# 26/05/2001 - Support for separate source and object trees.
+# Return error code.
+# Keith Owens <kaos@ocs.com.au>
+
#
# This will read a 'c' file and scan for embedded comments in the
# style of gnome comments (+minor extensions - see below).
@@ -97,6 +106,8 @@
# '@parameter' - name of a parameter
# '%CONST' - name of a constant.
+my $errors = 0;
+
# match expressions used to find embedded type information
my $type_constant = '\%([-_\w]+)';
my $type_func = '(\w+)\(\)';
@@ -198,6 +209,7 @@
my @parameterlist = ();
my %sections = ();
my @sectionlist = ();
+my %source_map = ();
my $contents = "";
my $section_default = "Description"; # default section
@@ -776,6 +788,7 @@
if (defined $type && $type && !defined $parameters{$param}) {
$parameters{$param} = "-- undescribed --";
print STDERR "Warning($file:$.): Function parameter '$param' not described in '$function_name'\n";
+ ++$errors;
}
push @parameterlist, $param;
@@ -784,6 +797,7 @@
}
} else {
print STDERR "Error($.): cannot understand prototype: '$prototype'\n";
+ ++$errors;
return;
}
@@ -816,7 +830,7 @@
$doc_special = "\@\%\$\&";
-$doc_start = "^/\\*\\*\$";
+$doc_start = "^/\\*\\*\\s*\$"; # Allow whitespace at end of comment start.
$doc_end = "\\*/";
$doc_com = "\\s*\\*\\s*";
$doc_func = $doc_com."(\\w+):?";
@@ -837,6 +851,19 @@
sub process_file($);
+# Read the file that maps relative names to absolute names for
+# separate source and object directories and for shadow trees.
+if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
+ my ($relname, $absname);
+ while(<SOURCE_MAP>) {
+ chop();
+ ($relname, $absname) = (split())[0..1];
+ $relname =~ s:^/+::;
+ $source_map{$relname} = $absname;
+ }
+ close(SOURCE_MAP);
+}
+
if ($filelist) {
open(FLIST,"<$filelist") or die "Can't open file list $filelist";
while(<FLIST>) {
@@ -850,11 +877,17 @@
process_file($_);
}
+exit($errors);
+
sub process_file($) {
my ($file) = @_;
+ if (defined($source_map{$file})) {
+ $file = $source_map{$file};
+ }
if (!open(IN,"<$file")) {
print STDERR "Error: Cannot open file $file\n";
+ ++$errors;
return;
}
@@ -887,6 +920,7 @@
} else {
print STDERR "WARN($.): Cannot understand $_ on line $.",
" - I thought it was a doc line\n";
+ ++$errors;
$state = 0;
}
} elsif ($state == 2) { # look for head: lines, and include content
@@ -937,6 +971,7 @@
} else {
# i dont know - bad line? ignore.
print STDERR "WARNING($.): bad line: $_";
+ ++$errors;
}
} elsif ($state == 3) { # scanning for function { (end of prototype)
if (m#\s*/\*\s+MACDOC\s*#io) {
@@ -945,7 +980,7 @@
elsif (/([^\{]*)/) {
$prototype .= $1;
}
- if (/\{/ || /\#/) { # added for #define AK
+ if (/\{/ || /\#/ || /;/) { # added for #define AK, ';' added for declarations.
$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)