gobject-introspection r391 - in trunk: . gir giscanner



Author: johan
Date: Sun Aug 17 16:52:46 2008
New Revision: 391
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=391&view=rev

Log:
2008-08-17  Johan Dahlin  <johan gnome org>

    * gir/Makefile.am:
    * gir/glib-2.0-good.gir:
    * gir/gobject-2.0-good.gir:
    * giscanner/cgobject.py:
    * giscanner/glibtransformer.py:
    Regenerate GObject & GType.
    Avoid warnings when generating gobject-2.0.gir.
    Introspect a little more, and skip *_get_type functions.



Modified:
   trunk/ChangeLog
   trunk/gir/Makefile.am
   trunk/gir/glib-2.0-good.gir
   trunk/gir/gobject-2.0-good.gir
   trunk/giscanner/cgobject.py
   trunk/giscanner/glibtransformer.py

Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am	(original)
+++ trunk/gir/Makefile.am	Sun Aug 17 16:52:46 2008
@@ -19,18 +19,21 @@
 BUILT_SOURCES += glib-2.0.gir
 
 # gobject
+GOBJECT_INCLUDEDIR=`pkg-config --variable=includedir glib-2.0`/glib-2.0
 GOBJECT_LIBDIR=`pkg-config --variable=libdir gobject-2.0`
 gobject-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
 	$(G_IR_SCANNER) -v --namespace GObject \
 	    --output $@ \
 	    --strip-prefix=g \
             --include=glib-2.0.gir \
-	    -I$(GLIB_INCLUDEDIR) \
-	    -I$(GLIB_LIBDIR)/glib-2.0/include \
+	    --library=$(GOBJECT_LIBDIR)/libgobject-2.0.so \
+	    -I$(GOBJECT_INCLUDEDIR) \
+	    -I$(GOBJECT_LIBDIR)/glib-2.0/include \
 	    -DGOBJECT_COMPILATION \
             --pkg glib-2.0 \
 	    $(GLIB_INCLUDEDIR)/gobject/*.h
 BUILT_SOURCES += gobject-2.0.gir
+CLEANFILES = $(BUILT_SOURCES)
 
 girdir=$(datadir)/gir
 dist_gir_DATA = $(BUILT_SOURCES)

Modified: trunk/gir/glib-2.0-good.gir
==============================================================================
--- trunk/gir/glib-2.0-good.gir	(original)
+++ trunk/gir/glib-2.0-good.gir	Sun Aug 17 16:52:46 2008
@@ -13896,19 +13896,6 @@
         </parameter>
       </parameters>
     </function>
-    <function name="fprintf" c:identifier="g_fprintf">
-      <return-value>
-        <type name="int32" c:type="gint"/>
-      </return-value>
-      <parameters>
-        <parameter name="file">
-          <type name="FILE" c:type="FILE*"/>
-        </parameter>
-        <parameter name="format">
-          <type name="string" c:type="gchar*"/>
-        </parameter>
-      </parameters>
-    </function>
     <function name="sprintf" c:identifier="g_sprintf">
       <return-value>
         <type name="int32" c:type="gint"/>

Modified: trunk/gir/gobject-2.0-good.gir
==============================================================================
--- trunk/gir/gobject-2.0-good.gir	(original)
+++ trunk/gir/gobject-2.0-good.gir	Sun Aug 17 16:52:46 2008
@@ -1217,47 +1217,6 @@
         </parameter>
       </parameters>
     </function>
-    <function name="closure_get_type" c:identifier="g_closure_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="value_get_type" c:identifier="g_value_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="value_array_get_type"
-              c:identifier="g_value_array_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="date_get_type" c:identifier="g_date_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="strv_get_type" c:identifier="g_strv_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="gstring_get_type" c:identifier="g_gstring_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="hash_table_get_type" c:identifier="g_hash_table_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="regex_get_type" c:identifier="g_regex_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
     <record name="Closure" c:type="GClosure"/>
     <record name="ClosureNotifyData" c:type="GClosureNotifyData"/>
     <callback name="GCallback">
@@ -4063,12 +4022,6 @@
         <type name="GValue" c:type="GValue*"/>
       </field>
     </record>
-    <function name="initially_unowned_get_type"
-              c:identifier="g_initially_unowned_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
     <function name="object_class_install_property"
               c:identifier="g_object_class_install_property">
       <return-value>
@@ -5594,81 +5547,21 @@
         </parameter>
       </parameters>
     </function>
-    <function name="io_channel_get_type" c:identifier="g_io_channel_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
-    <function name="io_condition_get_type"
-              c:identifier="g_io_condition_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
+    <bitfield name="GIOCondition"
+              c:type="GIOCondition"
+              glib:type-name="GIOCondition"
+              glib:get-type="g_io_condition_get_type">
+      <member name="in" value="1" c:identifier="G_IO_IN" glib:nick="in"/>
+      <member name="out" value="4" c:identifier="G_IO_OUT" glib:nick="out"/>
+      <member name="pri" value="2" c:identifier="G_IO_PRI" glib:nick="pri"/>
+      <member name="err" value="8" c:identifier="G_IO_ERR" glib:nick="err"/>
+      <member name="hup" value="16" c:identifier="G_IO_HUP" glib:nick="hup"/>
+      <member name="nval"
+              value="32"
+              c:identifier="G_IO_NVAL"
+              glib:nick="nval"/>
+    </bitfield>
     <record name="TypeModule" c:type="GTypeModule"/>
-    <record name="GTypeModule" c:type="_GTypeModule">
-      <field name="parent_instance">
-        <type name="Object" c:type="GObject"/>
-      </field>
-      <field name="use_count">
-        <type name="uint32" c:type="guint"/>
-      </field>
-      <field name="type_infos">
-        <type name="GLib.GSList" c:type="GSList*"/>
-      </field>
-      <field name="interface_infos">
-        <type name="GLib.GSList" c:type="GSList*"/>
-      </field>
-      <field name="name">
-        <type name="string" c:type="gchar*"/>
-      </field>
-      <callback name="load">
-        <return-value>
-          <type name="boolean" c:type="gboolean"/>
-        </return-value>
-        <parameters>
-          <parameter name="module">
-            <type name="GTypeModule" c:type="GTypeModule*"/>
-          </parameter>
-        </parameters>
-      </callback>
-      <callback name="unload">
-        <return-value>
-          <type name="none" c:type="void"/>
-        </return-value>
-        <parameters>
-          <parameter name="module">
-            <type name="GTypeModule" c:type="GTypeModule*"/>
-          </parameter>
-        </parameters>
-      </callback>
-      <callback name="reserved1">
-        <return-value>
-          <type name="none" c:type="void"/>
-        </return-value>
-      </callback>
-      <callback name="reserved2">
-        <return-value>
-          <type name="none" c:type="void"/>
-        </return-value>
-      </callback>
-      <callback name="reserved3">
-        <return-value>
-          <type name="none" c:type="void"/>
-        </return-value>
-      </callback>
-      <callback name="reserved4">
-        <return-value>
-          <type name="none" c:type="void"/>
-        </return-value>
-      </callback>
-    </record>
-    <function name="type_module_get_type"
-              c:identifier="g_type_module_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
     <function name="type_module_use" c:identifier="g_type_module_use">
       <return-value>
         <type name="boolean" c:type="gboolean"/>
@@ -5838,12 +5731,25 @@
         </parameter>
       </parameters>
     </callback>
-    <function name="type_plugin_get_type"
-              c:identifier="g_type_plugin_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
+    <interface name="GTypePlugin"
+               c:type="GTypePlugin"
+               glib:type-name="GTypePlugin"
+               glib:get-type="g_type_plugin_get_type">
+      <field name="use_plugin">
+        <type name="GTypePluginUse" c:type="GTypePluginUse"/>
+      </field>
+      <field name="unuse_plugin">
+        <type name="GTypePluginUnuse" c:type="GTypePluginUnuse"/>
+      </field>
+      <field name="complete_type_info">
+        <type name="GTypePluginCompleteTypeInfo"
+              c:type="GTypePluginCompleteTypeInfo"/>
+      </field>
+      <field name="complete_interface_info">
+        <type name="GTypePluginCompleteInterfaceInfo"
+              c:type="GTypePluginCompleteInterfaceInfo"/>
+      </field>
+    </interface>
     <function name="type_plugin_use" c:identifier="g_type_plugin_use">
       <return-value>
         <type name="none" c:type="void"/>
@@ -6367,11 +6273,6 @@
         </parameter>
       </parameters>
     </function>
-    <function name="gtype_get_type" c:identifier="g_gtype_get_type">
-      <return-value>
-        <type name="GType" c:type="GType"/>
-      </return-value>
-    </function>
     <function name="value_set_gtype" c:identifier="g_value_set_gtype">
       <return-value>
         <type name="none" c:type="void"/>

Modified: trunk/giscanner/cgobject.py
==============================================================================
--- trunk/giscanner/cgobject.py	(original)
+++ trunk/giscanner/cgobject.py	Sun Aug 17 16:52:46 2008
@@ -41,10 +41,10 @@
 TYPE_ENUM = 48
 TYPE_FLAGS = 52
 TYPE_STRING = 64
+TYPE_POINTER = 68
 TYPE_BOXED = 72
 TYPE_OBJECT = 80
 
-
 # Typedefs
 
 # FIXME - this is wrong on win64, where long == 32 but size_t == 64
@@ -253,3 +253,6 @@
         info = GSignalInfo()
         signal_query(signal_ids[i], ctypes.byref(info))
         yield info
+
+TYPE_GTYPE = type_from_name('GType')
+TYPE_POINTER = type_from_name('gpointer')

Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py	(original)
+++ trunk/giscanner/glibtransformer.py	Sun Aug 17 16:52:46 2008
@@ -152,17 +152,18 @@
         symbol = func.symbol
         if not symbol.endswith('_get_type'):
             return False
-        if not self._libraries:
-            print "Warning: No libraries loaded, parsing _get_type function"
-            return False
         # GType *_get_type(void)
-        if func.retval.type.name != 'GObject.GType':
+        if func.retval.type.name not in ['GType', 'GObject.GType']:
             print ("Warning: *_get_type function returns '%r'" + \
                 ", not GObject.GType") % (func.retval.type.name, )
             return False
         if func.parameters:
             return False
 
+        if not self._libraries:
+            print "Warning: No libraries loaded, cannot call %s" % (symbol, )
+            return False
+
         for library in self._libraries:
             try:
                 func = getattr(library, symbol)
@@ -288,8 +289,16 @@
             self._introspect_interface(type_id, symbol)
         elif fundamental_type_id == cgobject.TYPE_BOXED:
             self._introspect_boxed(type_id, symbol)
+        elif fundamental_type_id == cgobject.TYPE_BOXED:
+            self._introspect_boxed(type_id, symbol)
+        elif fundamental_type_id == cgobject.TYPE_POINTER:
+            # FIXME: Should we do something about these?
+            #        GHashTable, GValue and a few other fundamentals are
+            #        covered here
+            return
         else:
-            print 'unhandled GType: %s' % (cgobject.type_name(type_id), )
+            print 'unhandled GType: %s(%d)' % (cgobject.type_name(type_id),
+                                               type_id)
 
     def _introspect_enum(self, ftype_id, type_id, symbol):
         type_class = cgobject.type_class_ref(type_id)



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