On Fri, 2005-12-09 at 14:50 +0000, Damon Chaplin wrote: > I'd take a patch that added an option like "--source-suffixes=c,h,cc". Here's a quick shot at it. Apologies in advance, as my perl knowledge is weak. Thanks, -Jonathan
? autoregen.sh
Index: gtkdoc-mkdb.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-mkdb.in,v
retrieving revision 1.131
diff -u -p -r1.131 gtkdoc-mkdb.in
--- gtkdoc-mkdb.in 20 Dec 2005 04:38:33 -0000 1.131
+++ gtkdoc-mkdb.in 29 Dec 2005 06:17:55 -0000
@@ -42,6 +42,7 @@ my $MODULE;
my $TMPL_DIR;
my $SGML_OUTPUT_DIR;
my @SOURCE_DIRS;
+my $SOURCE_SUFFIXES;
my $IGNORE_FILES = "";
my $PRINT_VERSION;
my $PRINT_HELP;
@@ -54,6 +55,7 @@ my $OUTPUT_FORMAT;
my %optctl = (module => \$MODULE,
'source-dir' => \ SOURCE_DIRS,
+ 'source-suffixes' => \$SOURCE_SUFFIXES,
'ignore-files' => \$IGNORE_FILES,
'output-dir' => \$SGML_OUTPUT_DIR,
'tmpl-dir' => \$TMPL_DIR,
@@ -65,7 +67,7 @@ my %optctl = (module => \$MODULE,
'sgml-mode' => \$SGML_MODE,
'default-stability' => \$DEFAULT_STABILITY,
'output-format' => \$OUTPUT_FORMAT);
-GetOptions(\%optctl, "module=s", "source-dir:s", "ignore-files:s", "output-dir:s", "tmpl-dir:s", "version", "outputallsymbols", "expand-content-files:s", "main-sgml-file:s", "extra-db-files:s", "help", "sgml-mode", "default-stability:s", "output-format:s");
+GetOptions(\%optctl, "module=s", "source-dir:s", "source-suffixes:s", "ignore-files:s", "output-dir:s", "tmpl-dir:s", "version", "outputallsymbols", "expand-content-files:s", "main-sgml-file:s", "extra-db-files:s", "help", "sgml-mode", "default-stability:s", "output-format:s");
if ($PRINT_VERSION) {
print "@VERSION \n";
@@ -85,6 +87,7 @@ if ($PRINT_HELP) {
print "gtkdoc-mkdb version @VERSION \n";
print "\n--module=MODULE_NAME Name of the doc module being parsed";
print "\n--source-dir=DIRNAME Directories which contain inline reference material";
+ print "\n--source-suffixed=SUFFIXES ";
print "\n--ignore-files=FILES Files or directories which should not be scanned";
print "\n May be used more than once for multiple directories";
print "\n--output-dir=DIRNAME Directory to put the generated DocBook files in";
@@ -2501,22 +2504,32 @@ sub GetArgs {
sub ReadSourceDocumentation {
my ($source_dir) = @_;
+ my (@source_list);
# print "Scanning source directory: $source_dir\n";
# This array holds any subdirectories found.
my (@subdirs) = ();
+ @source_list = split (/,/, $SOURCE_SUFFIXES);
opendir (SRCDIR, $source_dir)
|| die "Can't open source directory $source_dir: $!";
my $file;
+
foreach $file (readdir (SRCDIR)) {
- if ($file =~ /^\./) {
- next;
- } elsif (-d "$source_dir/$file") {
- push (@subdirs, $file);
- } elsif ($file =~ m/\.[ch]$/) {
+ if ($file =~ /^\./) {
+ next;
+ } elsif (-d "$source_dir/$file") {
+ push (@subdirs, $file);
+ } elsif (@source_list) {
+ my ($ext);
+ foreach $ext (@source_list) {
+ if ($file =~ m/.\b$ext\b$/) {
&ScanSourceFile ("$source_dir/$file");
+ }
}
+ } elsif ($file =~ m/\.[ch]$/) {
+ &ScanSourceFile ("$source_dir/$file");
+ }
}
closedir (SRCDIR);
Attachment:
signature.asc
Description: This is a digitally signed message part