X-Git-Url: http://www.git.stargrave.org/?p=dotfiles.git;a=blobdiff_plain;f=bin%2Fbin%2Fdocstringer.pl;h=2de9a0e10331742e336653bac64af3d979dd2926;hp=e9dcf7b110d7f980625605b70ddf222a30750bcb;hb=48338303d760027e62bab963fa11a940bc0d97eb;hpb=926ae326dd2b4716a0007ee78537e9b7ec2f9ebe diff --git a/bin/bin/docstringer.pl b/bin/bin/docstringer.pl index e9dcf7b..2de9a0e 100755 --- a/bin/bin/docstringer.pl +++ b/bin/bin/docstringer.pl @@ -27,6 +27,7 @@ if ($ARGV[0] eq "-v") { 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; @@ -34,7 +35,7 @@ foreach my $srcDir (@srcDirs) { 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; @@ -69,7 +70,7 @@ foreach my $fn (readdir $dir) { 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};