summaryrefslogtreecommitdiff
path: root/gtkdoc-scan.in
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2011-08-25 19:45:26 +0200
committerStefan Kost <ensonic@users.sf.net>2011-08-25 19:45:26 +0200
commit84b58c06e1214c984f12af4067b6520d16707fe1 (patch)
tree1630a12f9e80b37ce2a153f2f710ab3e1fda8ee9 /gtkdoc-scan.in
parent347b08b3e52aaa971e7ead20b15b164920f3cd0b (diff)
downloadgtk-doc-84b58c06e1214c984f12af4067b6520d16707fe1.tar.gz
scan: make the generated section file more deterministic
Sort the section and the symbols with the section.
Diffstat (limited to 'gtkdoc-scan.in')
-rwxr-xr-xgtkdoc-scan.in41
1 files changed, 23 insertions, 18 deletions
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index cce2d5d..c3ae7e5 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -138,8 +138,7 @@ if ($REBUILD_TYPES) {
|| die "Can't open $new_types";
}
-my $main_list = "";
-my $object_list = "";
+my %section_list = ();
my $file;
my @get_types = ();
@@ -151,16 +150,23 @@ my %seen_headers;
# The header files to scan are passed in as command-line args.
for $file (@ARGV) {
- &ScanHeader ($file, \$object_list, \$main_list);
+ &ScanHeader ($file, \%section_list);
}
for my $dir (@SOURCE_DIRS) {
- &ScanHeaders ($dir, \$object_list, \$main_list);
+ &ScanHeaders ($dir, \%section_list);
+}
+
+## FIXME: sort by key and output
+#print DECLLIST $section_list;
+my $section;
+foreach $section (sort(keys %section_list)) {
+ print DECLLIST "$section_list{$section}\n";
}
-print DECLLIST $object_list, $main_list;
close (DECLLIST);
close (DECL);
+
if ($REBUILD_TYPES) {
my $func;
@@ -200,13 +206,11 @@ if (! -e $overrides_file) {
# Description : This scans a directory tree looking for header files.
#
# Arguments : $source_dir - the directory to scan.
-# $object_list - a reference to the list of object functions &
-# declarations.
-# $main_list - a reference to the list of other declarations.
+# $section_list - a reference to the hashmap of sections.
#############################################################################
sub ScanHeaders {
- my ($source_dir, $object_list, $main_list) = @_;
+ my ($source_dir, $section_list) = @_;
@TRACE@("Scanning source directory: $source_dir");
# This array holds any subdirectories found.
@@ -221,7 +225,7 @@ sub ScanHeaders {
} elsif (-d "$source_dir/$file") {
push (@subdirs, $file);
} elsif ($file =~ m/\.h$/) {
- &ScanHeader ("$source_dir/$file", $object_list, $main_list);
+ &ScanHeader ("$source_dir/$file", $section_list);
}
}
closedir (SRCDIR);
@@ -230,7 +234,7 @@ sub ScanHeaders {
my $dir;
foreach $dir (@subdirs) {
next if ($IGNORE_HEADERS =~ m/(\s|^)\Q${dir}\E(\s|$)/);
- &ScanHeaders ("$source_dir/$dir", $object_list, $main_list);
+ &ScanHeaders ("$source_dir/$dir", $section_list);
}
}
@@ -241,14 +245,12 @@ sub ScanHeaders {
# functions, macros, typedefs, structs and unions, which it
# outputs to the DECL file.
# Arguments : $input_file - the header file to scan.
-# $object_list - a reference to the list of object functions &
-# declarations.
-# $main_list - a reference to the list of other declarations.
+# $section_list - a reference to the hashmap of sections.
# Returns : it adds declarations to the appropriate list.
#############################################################################
sub ScanHeader {
- my ($input_file, $object_list, $main_list) = @_;
+ my ($input_file, $section_list) = @_;
my $list = ""; # Holds the resulting list of declarations.
my ($in_comment) = 0; # True if we are in a comment.
@@ -828,7 +830,10 @@ sub ScanHeader {
}
@TRACE@("Scanning $input_file done\n\n\n");
-
+
+ # sort the symbols
+ $list=join("\n",sort(split("\n",$list)))."\n";
+
# Try to separate the standard macros and functions, placing them at the
# end of the current section, in a subsection named 'Standard'.
@@ -858,11 +863,11 @@ sub ScanHeader {
}
if ($list ne "") {
- $$object_list .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
+ $$section_list{$file_basename} .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
}
} else {
if ($list ne "") {
- $$main_list .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
+ $$section_list{$file_basename} .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
}
}
}