my @srcDirs = split / /, $ARGV[0];
my $docDir = $ARGV[1];
my $docBuildDir = $ARGV[2];
+my @exts = split / /, defined $ENV{EXTS} ? $ENV{EXTS} : "c h h.in";
my %docstrings;
print "src: $srcDir\n" if $verbose;
opendir(my $dir, $srcDir) or die "can not open $srcDir";
foreach my $fn (readdir $dir) {
- next unless $fn =~ /\.[ch]$/;
+ next unless grep { $fn =~ /\.$_$/ } @exts;
open(my $src, "<:encoding(UTF-8)", "$srcDir/$fn") or
die "can not open $srcDir/$fn";
my $curEntry;
open(my $dst, ">:encoding(UTF-8)", "$docBuildDir/$fn") or
die "can not open $docBuildDir/$fn";
while(<$src>) {
- ( print($dst $_) and next ) unless /^\@DOCSTRING (.*)\@$/;
+ ( print($dst $_) and next ) unless /^\s*\@DOCSTRING (.*)\@$/;
print "\t$fn: $1\n" if $verbose;
die "unable to find docstring: $1" unless defined $docstrings{$1};
print $dst $docstrings{$1};