Alexandre Julliard : c2man: Add support for running on an entire git checkout.
Alexandre Julliard
julliard at winehq.org
Mon Dec 20 15:42:28 CST 2021
Module: tools
Branch: master
Commit: ba6b317c028ad07db085238993166091e7578737
URL: https://source.winehq.org/git/tools.git/?a=commit;h=ba6b317c028ad07db085238993166091e7578737
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 20 10:53:53 2021 +0100
c2man: Add support for running on an entire git checkout.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
c2man.pl | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/c2man.pl b/c2man.pl
index c736c84..0fe9e78 100755
--- a/c2man.pl
+++ b/c2man.pl
@@ -95,6 +95,12 @@ sub process_comment($);
sub process_extra_comment($);
+sub basedir_name($)
+{
+ (my $file = shift) =~ s/^dlls\/([^\/]*)\/.*/$1/;
+ return $file
+}
+
# Generate the list of exported entries for the dll
sub process_spec_file($)
{
@@ -106,6 +112,7 @@ sub process_spec_file($)
my $spec_details =
{
+ FILE => $spec_name,
NAME => $basename,
DLL_NAME => $dll_name,
DLL_EXT => $dll_ext,
@@ -229,6 +236,7 @@ sub process_source_file($)
my $source_file = shift;
my $source_details =
{
+ FILE => $source_file,
CONTRIBUTORS => [ ],
DEBUG_CHANNEL => "",
};
@@ -1080,7 +1088,7 @@ sub output_comment($)
# Write out an index file for each .spec processed
sub process_index_files()
{
- foreach my $spec_file (keys %spec_files)
+ foreach my $spec_file (sort keys %spec_files)
{
my $spec_details = $spec_files{$spec_file}[0];
if (defined ($spec_details->{DLL_NAME}))
@@ -1129,7 +1137,7 @@ sub output_spec($)
}
$percent_implemented = int($percent_implemented);
my $percent_documented = 0;
- if ($spec_details->{NUM_DOCS})
+ if ($spec_details->{NUM_FUNCS})
{
# Treat forwards and data as documented funcs for statistics
$percent_documented = $spec_details->{NUM_DOCS} / $spec_details->{NUM_FUNCS} * 100;
@@ -1138,15 +1146,16 @@ sub output_spec($)
# Make a list of the contributors to this DLL.
my @contributors;
+ my $files = 0;
foreach my $source_file (keys %source_files)
{
my $source_details = $source_files{$source_file}[0];
- for (@{$source_details->{CONTRIBUTORS}})
- {
- push (@contributors, $_);
- }
+ next unless basedir_name($source_details->{FILE}) eq basedir_name($spec_details->{FILE});
+ $files++;
+ push @contributors, @{$source_details->{CONTRIBUTORS}};
}
+ return unless $files > 0;
my %saw;
@contributors = grep(!$saw{$_}++, @contributors); # remove dups, from perlfaq4 manpage
@@ -2317,6 +2326,18 @@ while(defined($_ = shift @ARGV))
}
}
+unless (@opt_source_file_list)
+{
+ # assume we are running from a git checkout
+ foreach my $f (split /\0/, `git ls-files -c -z`)
+ {
+ next unless $f =~ /^dlls\//;
+ next if $f =~ /\/tests\//;
+ push @opt_spec_file_list, $f if $f =~ /\.spec$/;
+ push @opt_source_file_list, $f if $f =~ /\.c$/;
+ }
+}
+
# Remove duplicate include directories
my %htmp;
@opt_header_file_list = grep(!$htmp{$_}++, @opt_header_file_list);
More information about the wine-cvs
mailing list