if name == debugsym and not quiet:
print "=>", id
+ # NB: this is consumed by a regex in 'getAPIFilenames' in hvsupport.pl
output.write(" <%s name='%s' file='%s' module='%s'>\n" % (id.type,
name, self.modulename_file(id.header),
self.modulename_file(id.module)))
use warnings;
use File::Find;
-use XML::XPath;
-use XML::XPath::XMLParser;
die "syntax: $0 SRCDIR\n" unless int(@ARGV) == 1;
}
}, no_chdir => 1}, $srcdir);
+# Map API functions to the header and documentation files they're in
+# so that we can generate proper hyperlinks to their documentation.
+#
+# The function names are grep'd from the XML output of apibuild.py.
+sub getAPIFilenames {
+ my $filename = shift;
+
+ my %files;
+ my $line;
+
+ open FILE, "<", $filename or die "cannot read $filename: $!";
+
+ while (defined($line = <FILE>)) {
+ if ($line =~ /function name='([^']+)' file='([^']+)'/) {
+ $files{$1} = $2;
+ }
+ }
+
+ close FILE;
+
+ if (keys %files == 0) {
+ die "No functions found in $filename. Has the apibuild.py output changed?";
+ }
+ return \%files;
+}
+
sub parseSymsFile {
my $apisref = shift;
my $prefix = shift;
my $vers;
my $prevvers;
- my $apixpath = XML::XPath->new(filename => $xmlfilename);
+ my $filenames = getAPIFilenames($xmlfilename);
open FILE, "<$filename"
or die "cannot read $filename: $!";
$prevvers = $vers;
$vers = undef;
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
- my $file = $apixpath->find("/api/symbols/function[\@name='$1']/\@file");
$$apisref{$1} = {};
$$apisref{$1}->{vers} = $vers;
- $$apisref{$1}->{file} = $file;
+ $$apisref{$1}->{file} = $$filenames{$1};
} else {
die "unexpected data $line\n";
}