Bug 557092 – Callback annotations not used
authorTommi Komulainen <tommi.komulainen@iki.fi>
Wed, 22 Oct 2008 10:46:22 +0000 (10:46 +0000)
committerTommi Komulainen <tko@src.gnome.org>
Wed, 22 Oct 2008 10:46:22 +0000 (10:46 +0000)
2008-10-22  Tommi Komulainen  <tommi.komulainen@iki.fi>

* giscanner/transformer.py (_create_callback): use annotations
for callbacks
* tests/scanner/annotation.h
* tests/scanner/annotation-1.0-expected.gir: add tests

svn path=/trunk/; revision=781

ChangeLog
giscanner/transformer.py
tests/scanner/annotation-1.0-expected.gir
tests/scanner/annotation.h

index f5ab64e3281ec6ef78ce97465f6da52db8bc088f..f98b78355f2b5a0347cf851ff4dd97e8ffec55b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-10-22  Tommi Komulainen  <tommi.komulainen@iki.fi>
+
+       Bug 557092 – Callback annotations not used
+
+       * giscanner/transformer.py (_create_callback): use annotations
+       for callbacks
+       * tests/scanner/annotation.h
+       * tests/scanner/annotation-1.0-expected.gir: add tests
+
 2008-10-21  Colin Walters  <walters@verbum.org>
 
        * giscanner/scannerlexer.l: Don't require trailing whitespace after
index 75ede5955ec1bc6d8f75cb32f98fbd0ca95fd99b..7e74f4d8242ee4f7b4b8877e02cf44dcf6534dfe 100644 (file)
@@ -542,8 +542,11 @@ class Transformer(object):
         return union
 
     def _create_callback(self, symbol):
-        parameters = self._create_parameters(symbol.base_type.base_type)
-        retval = self._create_return(symbol.base_type.base_type.base_type)
+        directives = symbol.directives()
+        parameters = self._create_parameters(symbol.base_type.base_type,
+            directives)
+        retval = self._create_return(symbol.base_type.base_type.base_type,
+            directives.get('return', {}))
         if symbol.ident.find('_') > 0:
             name = self.remove_prefix(symbol.ident, True)
         else:
index 69325745281c841dbf1f7d521d1559dc20c5de0a..0bd230f0ca847d466ec03df9b374167b71440670 100644 (file)
@@ -7,6 +7,30 @@
   <include name="GObject" version="2.0"/>
   <include name="utility" version="1.0"/>
   <namespace name="annotation" version="1.0" shared-library="annotation">
+    <callback name="Callback" c:type="AnnotationCallback">
+      <return-value transfer-ownership="none">
+        <type name="int" c:type="gint*"/>
+      </return-value>
+      <parameters>
+        <parameter name="in" transfer-ownership="none">
+          <type name="int" c:type="gint*"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <callback name="ListCallback" c:type="AnnotationListCallback">
+      <return-value transfer-ownership="container">
+        <type name="GLib.List" c:type="GList*">
+          <type name="utf8"/>
+        </type>
+      </return-value>
+      <parameters>
+        <parameter name="in" transfer-ownership="none">
+          <type name="GLib.List" c:type="GList*">
+            <type name="utf8"/>
+          </type>
+        </parameter>
+      </parameters>
+    </callback>
     <class name="Object"
            c:type="AnnotationObject"
            parent="GObject.Object"
index c15d578d3354bd5468d01d1dc8b5a86d03770716..ea78786a4a7208cfaa1c53d966355048c3fe8af1 100644 (file)
@@ -3,6 +3,22 @@
 
 #include <glib-object.h>
 
+/**
+ * AnnotationCallback:
+ * @in: (in) (transfer none): array of ints
+ *
+ * Return value: (transfer none): array of ints
+ */
+typedef const gint* (*AnnotationCallback) (const gint *in);
+
+/**
+ * AnnotationListCallback:
+ * @in: (in) (transfer none) (element-type utf8): list of strings
+ *
+ * Return value: (transfer container) (element-type utf8): list of strings
+ */
+typedef GList* (*AnnotationListCallback) (GList *in);
+
 typedef struct _AnnotationObject          AnnotationObject;
 typedef struct _AnnotationObjectClass     AnnotationObjectClass;