summaryrefslogtreecommitdiff
path: root/gtkdoc-scan.in
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2011-08-26 19:04:37 +0200
committerStefan Sauer <ensonic@users.sf.net>2011-08-26 19:04:37 +0200
commit73aeebbd61912cafeb569208eb62d04c6ac062de (patch)
tree250287b04347283375c5fd5a2c911cbdd38ec9d2 /gtkdoc-scan.in
parent8dd746b00ac0acd9fda196b2cfbec0534ff96298 (diff)
downloadgtk-doc-73aeebbd61912cafeb569208eb62d04c6ac062de.tar.gz
scan: improve gtype detection
Run code that detects a gtype and moves the standard symbols to the standard section in a loop to e.g. handle enums defined in the same header.
Diffstat (limited to 'gtkdoc-scan.in')
-rwxr-xr-xgtkdoc-scan.in73
1 files changed, 42 insertions, 31 deletions
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index 2c5e284..30c51af 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -829,46 +829,57 @@ sub ScanHeader {
}
}
- @TRACE@("Scanning $input_file done\n\n\n");
+ @TRACE@("Scanning $input_file done\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'.
- my ($class) = "";
+ # do this in a loop to catch object, enums and flags
+ my ($class,$lclass);
my ($standard_decl) = "";
- if ($list =~ m/^\S+_IS_(\S*)_CLASS/m) {
- $class = $1;
- } elsif ($list =~ m/^\S+_IS_(\S*)/m) {
- $class = $1;
- }
-
- if ($class ne "") {
- if ($list =~ s/^\S+_IS_$class\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_TYPE_$class\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_.*_get_type\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_${class}_CLASS\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_IS_${class}_CLASS\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_${class}_GET_CLASS\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_${class}_GET_IFACE\n//m) { $standard_decl .= $&; }
- if ($list =~ s/^\S+_${class}_GET_INTERFACE\n//m) { $standard_decl .= $&; }
-
- # We do this one last, otherwise it tends to be caught by the IS_$class macro
- if ($list =~ s/^\S+_$class\n//m) { $standard_decl = $& . $standard_decl; }
-
- if ($standard_decl ne "") {
- $list .= "<SUBSECTION Standard>\n$standard_decl";
- }
-
- if ($list ne "") {
- $$section_list{$file_basename} .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
+ do {
+ if ($list =~ m/^\S+_IS_(\S*)_CLASS/m) {
+ $class = $1;
+ $lclass = lc($class);
+ @TRACE@("Found gobject class '$class'\n");
+ } elsif ($list =~ m/^\S+_IS_(\S*)/m) {
+ $class = $1;
+ $lclass = lc($class);
+ @TRACE@("Found gobject class '$class'\n");
+ } elsif ($list =~ m/^\S+_(\S*)_get_type\n/m) {
+ $lclass = $1;
+ $class = uc($lclass);
+ @TRACE@("Found gobject class '$class'\n");
+ } else {
+ $class = $lclass = "";
}
- } else {
- if ($list ne "") {
- $$section_list{$file_basename} .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
+
+ if ($class ne "") {
+ while ($list =~ s/^\S+_IS_$class\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_TYPE_$class\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_${lclass}_get_type\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_${class}_CLASS\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_IS_${class}_CLASS\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_${class}_GET_CLASS\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_${class}_GET_IFACE\n//m) { $standard_decl .= $&; }
+ while ($list =~ s/^\S+_${class}_GET_INTERFACE\n//m) { $standard_decl .= $&; }
+
+ # We do this one last, otherwise it tends to be caught by the IS_$class macro
+ while ($list =~ s/^\S+_$class\n//m) { $standard_decl .= $&; }
+
+ @TRACE@("Decl '".join(",",split("\n",$list))."'\n");
+ @TRACE@("Std '".join(",",split("\n",$standard_decl))."'\n");
}
+ } while ($class ne "");
+ if ($standard_decl ne "") {
+ # sort the symbols
+ $standard_decl=join("\n",sort(split("\n",$standard_decl)))."\n";
+ $list .= "<SUBSECTION Standard>\n$standard_decl";
+ }
+ if ($list ne "") {
+ $$section_list{$file_basename} .= "<SECTION>\n<FILE>$file_basename</FILE>\n$list</SECTION>\n\n";
}
}