Commit 1edeccd2 authored by Tomeu Vizoso's avatar Tomeu Vizoso

Add support for the 'foreign' annotation to g-i-scanner

https://bugzilla.gnome.org/show_bug.cgi?id=619450
parent f05406e9
......@@ -67,6 +67,7 @@ OPT_TYPE = 'type'
OPT_CLOSURE = 'closure'
OPT_DESTROY = 'destroy'
OPT_SKIP = 'skip'
OPT_FOREIGN = 'foreign'
# Specific option values
OPT_VAL_BITFIELD = 'bitfield'
......@@ -787,6 +788,7 @@ class AnnotationApplier(object):
self._parse_deprecated(node, block)
self._parse_attributes(node, block)
self._parse_skip(node, block)
self._parse_foreign(node, block)
def _parse_version(self, node, block):
since_tag = self._get_tag(block, TAG_SINCE)
......@@ -821,6 +823,11 @@ class AnnotationApplier(object):
if OPT_SKIP in block.options:
node.skip = True
def _parse_foreign(self, node, block):
if block is not None:
if OPT_FOREIGN in block.options:
node.foreign = True
def _parse_rename_to_func(self, node, block):
rename_to_tag = self._get_tag(block, TAG_RENAME_TO)
if rename_to_tag is None:
......
......@@ -176,6 +176,7 @@ class Node(object):
self.deprecated = None
self.deprecated_version = None
self.version = None
self.foreign = False
def __cmp__(self, other):
return cmp(self.name, other.name)
......
......@@ -427,6 +427,8 @@ and/or use gtk-doc annotations. ''')
attrs.append(('c:type', record.symbol))
if record.disguised:
attrs.append(('disguised', '1'))
if record.foreign:
attrs.append(('foreign', '1'))
if isinstance(record, GLibRecord):
if record.is_gtype_struct_for:
is_gtype_struct = True
......
......@@ -241,6 +241,11 @@ and/or use gtk-doc annotations. -->
c:identifier="FOO_FLAGS_THIRD"
glib:nick="third"/>
</bitfield>
<record name="ForeignStruct" c:type="FooForeignStruct" foreign="1">
<field name="foo" writable="1">
<type name="int" c:type="int"/>
</field>
</record>
<interface name="Interface"
c:type="FooInterface"
glib:type-name="FooInterface"
......
......@@ -170,6 +170,11 @@
<member name="second" value="2"/>
<member name="third" value="4"/>
</bitfield>
<record name="ForeignStruct" foreign="1">
<field name="foo" writable="1">
<type name="int"/>
</field>
</record>
<interface name="Interface" glib:type-name="FooInterface" glib:get-type="foo_interface_get_type" glib:type-struct="InterfaceIface">
<method name="do_foo" c:identifier="foo_interface_do_foo">
<return-value transfer-ownership="none">
......
......@@ -621,3 +621,8 @@ void
foo_skip_me (FooSkippable fs)
{
}
/**
* FooForeignStruct: (foreign)
*
*/
......@@ -393,5 +393,12 @@ typedef enum {
} FooSkippable;
void foo_skip_me (FooSkippable fs);
typedef struct _FooForeignStruct FooForeignStruct;
struct _FooForeignStruct
{
int foo;
};
#endif /* __FOO_OBJECT_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment