gobject-introspection r291 - in trunk: . giscanner tests/parser
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r291 - in trunk: . giscanner tests/parser
- Date: Fri, 20 Jun 2008 22:27:07 +0000 (UTC)
Author: johan
Date: Fri Jun 20 22:27:07 2008
New Revision: 291
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=291&view=rev
Log:
2008-06-20 Johan Dahlin <jdahlin async com br>
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/transformer.py:
* tests/parser/Foo-expected.gir:
* tests/parser/foo-object.h:
* tests/parser/foo.c (foo_object_allow_none):
Add support for gtk-doc annotations for allow-none.
Add test case.
Modified:
trunk/ChangeLog
trunk/giscanner/ast.py
trunk/giscanner/girwriter.py
trunk/giscanner/transformer.py
trunk/tests/parser/Foo-expected.gir
trunk/tests/parser/foo-object.h
trunk/tests/parser/foo.c
Modified: trunk/giscanner/ast.py
==============================================================================
--- trunk/giscanner/ast.py (original)
+++ trunk/giscanner/ast.py Fri Jun 20 22:27:07 2008
@@ -142,6 +142,7 @@
self.type = typenode
self.direction = PARAM_DIRECTION_IN
self.transfer = False
+ self.allow_none = False
def __repr__(self):
return 'Parameter(%r, %r)' % (self.name, self.type)
Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py (original)
+++ trunk/giscanner/girwriter.py Fri Jun 20 22:27:07 2008
@@ -110,6 +110,8 @@
if parameter.transfer:
attrs.append(('transfer-ownership',
str(int(parameter.transfer))))
+ if parameter.allow_none:
+ attrs.append(('allow-none', '1'))
with self.tagcontext('parameter', attrs):
self._write_type(parameter.type)
Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py (original)
+++ trunk/giscanner/transformer.py Fri Jun 20 22:27:07 2008
@@ -221,6 +221,8 @@
param.direction = 'out'
elif option == 'callee-owns':
param.transfer = True
+ elif option == 'allow-none':
+ param.allow_none = True
else:
print 'Unhandled parameter annotation option: %s' % (
option,)
Modified: trunk/tests/parser/Foo-expected.gir
==============================================================================
--- trunk/tests/parser/Foo-expected.gir (original)
+++ trunk/tests/parser/Foo-expected.gir Fri Jun 20 22:27:07 2008
@@ -66,6 +66,19 @@
</parameter>
</parameters>
</method>
+ <method name="allow_none" c:identifier="foo_object_allow_none">
+ <return-value>
+ <type name="GLib.Object" c:type="GObject*"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object" c:type="FooObject*"/>
+ </parameter>
+ <parameter name="allow_none" allow-none="1">
+ <type name="string" c:type="gchar*"/>
+ </parameter>
+ </parameters>
+ </method>
<method name="inout" c:identifier="foo_object_inout">
<return-value>
<type name="int32" c:type="gint"/>
Modified: trunk/tests/parser/foo-object.h
==============================================================================
--- trunk/tests/parser/foo-object.h (original)
+++ trunk/tests/parser/foo-object.h Fri Jun 20 22:27:07 2008
@@ -51,6 +51,7 @@
gint foo_object_out (FooObject *object,
int *outarg);
GObject* foo_object_create_object (FooObject *object);
+GObject* foo_object_allow_none (FooObject *object, gchar *allow_none);
gint foo_object_inout (FooObject *object, int *inoutarg);
gint foo_object_inout2 (FooObject *object, int *inoutarg);
gint foo_object_inout3 (FooObject *object, int *inoutarg);
Modified: trunk/tests/parser/foo.c
==============================================================================
--- trunk/tests/parser/foo.c (original)
+++ trunk/tests/parser/foo.c Fri Jun 20 22:27:07 2008
@@ -201,7 +201,7 @@
*
* This is a 3th test for out arguments
*
- * @inoutarg: (in-out): This is an argument test
+ * @inoutarg: (in-out) (allow-none): This is an argument test
* Return value: an int
*/
gint
@@ -293,6 +293,16 @@
return g_object_ref (object);
}
+/**
+ * foo_object_allow_none:
+ * @object: a #GObject
+ * @allow_none: (allow-none):
+ **/
+GObject*
+foo_object_allow_none (FooObject *object, gchar *allow_none)
+{
+}
+
G_DEFINE_TYPE (FooSubobject, foo_subobject, FOO_TYPE_OBJECT);
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]