+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
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:
<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"
#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;