[gtk-doc/wip/desrt/fixes-for-glib: 2/5] scanner: special case G_DECLARE_*



commit cd349b8b5de87e11c1b31005d52b33a8a172c751
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Mon Feb 2 12:47:00 2015 -0500

    scanner: special case G_DECLARE_*
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743879

 gtkdoc-scan.in |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index dcb5e31..a45744a 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -578,6 +578,12 @@ sub ScanHeader {
                     print DECL "<VARIABLE>\n<NAME>$symbol</NAME>\n$deprecated$decl</VARIABLE>\n";
                 }
 
+            # G_DECLARE_*
+
+            } elsif (m/.*G_DECLARE_(FINAL_TYPE|DERIVABLE_TYPE|INTERFACE)\s*\(/) {
+                $in_declaration = "g-declare";
+                $symbol = "G_DECLARE_$1";
+                $decl = $';
 
             # FUNCTIONS
 
@@ -747,6 +753,24 @@ sub ScanHeader {
         #    print "$in_declaration = $decl\n";
         #}
 
+        if ($in_declaration eq "g-declare") {
+            if ($decl =~ s/\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*,\s*(\w+)\s*\).*$//) {
+                my $ModuleObjName = $1;
+                my $module_obj_name = $2;
+                if ($REBUILD_TYPES) {
+                    push (@get_types, "${module_obj_name}_get_type");
+                }
+                $forward_decls{$ModuleObjName} = 
"<STRUCT>\n<NAME>$ModuleObjName</NAME>\n$deprecated</STRUCT>\n";
+                if ($symbol =~ /^G_DECLARE_DERIVABLE/) {
+                    $forward_decls{"${ModuleObjName}Class"} = 
"<STRUCT>\n<NAME>${ModuleObjName}Class</NAME>\n$deprecated</STRUCT>\n";
+                }
+                if ($symbol =~ /^G_DECLARE_INTERFACE/) {
+                    $forward_decls{"${ModuleObjName}Interface"} = 
"<STRUCT>\n<NAME>${ModuleObjName}Interface</NAME>\n$deprecated</STRUCT>\n";
+                }
+                $in_declaration = "";
+            }
+        }
+
         # Note that sometimes functions end in ') G_GNUC_PRINTF (2, 3);' or
         # ') __attribute__ (...);'.
         if ($in_declaration eq 'function') {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]