<type name="int" c:type="int"/>
</return-value>
<parameters>
- <parameter name="somestr" transfer-ownership="none">
+ <parameter name="somestr"
+ transfer-ownership="none"
+ doc="Meaningless string">
<type name="utf8" c:type="char*"/>
</parameter>
</parameters>
<type name="int" c:type="int"/>
</return-value>
<parameters>
- <parameter name="somestr" transfer-ownership="none">
+ <parameter name="somestr"
+ transfer-ownership="none"
+ doc="Meaningless string">
<type name="utf8" c:type="char*"/>
</parameter>
</parameters>
<parameter name="obj" transfer-ownership="none">
<type name="TestObj" c:type="TestObj*"/>
</parameter>
- <parameter name="somestr" transfer-ownership="none">
+ <parameter name="somestr"
+ transfer-ownership="none"
+ doc="Meaningless string">
<type name="utf8" c:type="char*"/>
</parameter>
</parameters>
</function>
<function name="test_array_fixed_size_int_in"
c:identifier="test_array_fixed_size_int_in">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none"
+ doc="the sum of the items in @ints">
<type name="int" c:type="int"/>
</return-value>
<parameters>
</parameters>
</function>
<function name="test_array_gtype_in" c:identifier="test_array_gtype_in">
- <return-value transfer-ownership="full">
+ <return-value transfer-ownership="full"
+ doc="string representation of provided types">
<type name="utf8" c:type="char*"/>
</return-value>
<parameters>
<parameter name="len"
direction="out"
caller-allocates="0"
- transfer-ownership="full">
+ transfer-ownership="full"
+ doc="length of the returned array.">
<type name="int" c:type="int*"/>
</parameter>
</parameters>
<parameter name="len"
direction="out"
caller-allocates="0"
- transfer-ownership="full">
+ transfer-ownership="full"
+ doc="length of the returned array.">
<type name="int" c:type="int*"/>
</parameter>
</parameters>
<type name="int"/>
</array>
</parameter>
- <parameter name="len" transfer-ownership="none">
+ <parameter name="len" transfer-ownership="none" doc="length">
<type name="int" c:type="int"/>
</parameter>
</parameters>
direction="out"
caller-allocates="0"
transfer-ownership="full"
- doc=": length">
+ doc="length">
<type name="int" c:type="int*"/>
</parameter>
</parameters>
doc="Invokes all callbacks installed by #test_callback_destroy_notify(),
adding up their return values, and removes them, invoking the
corresponding destroy notfications.">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none"
+ doc="Sum of the return values of the invoked callbacks.">
<type name="int" c:type="int"/>
</return-value>
</function>
</parameters>
</function>
<function name="test_ghash_nested_everything_return"
- c:identifier="test_ghash_nested_everything_return">
+ c:identifier="test_ghash_nested_everything_return"
+ doc="Specify nested parameterized types directly with the (type ) annotation.">
<return-value transfer-ownership="full">
<type name="GLib.HashTable" c:type="GHashTable*">
<type name="utf8"/>
</return-value>
</function>
<function name="test_ghash_nested_everything_return2"
- c:identifier="test_ghash_nested_everything_return2">
+ c:identifier="test_ghash_nested_everything_return2"
+ doc="element-type annotation.">
<return-value transfer-ownership="full">
<type name="GLib.HashTable" c:type="GHashTable*">
<type name="utf8"/>
</function>
<function name="test_utf8_const_return"
c:identifier="test_utf8_const_return">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none"
+ doc="<const char*> UTF-8 string">
<type name="utf8" c:type="char*"/>
</return-value>
</function>
</function>
<function name="test_utf8_nonconst_return"
c:identifier="test_utf8_nonconst_return">
- <return-value transfer-ownership="full">
+ <return-value transfer-ownership="full" doc="<char*> UTF-8 string">
<type name="utf8" c:type="char*"/>
</return-value>
</function>
<type name="GObject.Value" c:type="GValue*"/>
</return-value>
<parameters>
- <parameter name="i" transfer-ownership="none">
+ <parameter name="i" transfer-ownership="none" doc="an int">
<type name="int" c:type="int"/>
</parameter>
</parameters>
</function>
<function name="gstrv_return"
c:identifier="g_i_marshalling_tests_gstrv_return">
- <return-value transfer-ownership="full">
+ <return-value transfer-ownership="full" doc="an array of strings">
<array c:type="GStrv">
<type name="utf8"/>
</array>
/**
* test_ghash_free:
- * @in: (transfer full) (element-type utf8 utf8)
+ * @in: (transfer full) (element-type utf8 utf8):
*/
void test_ghash_free (GHashTable *in)
{
/**
* test_object_null_in:
- * @obj: (allow-none) A #TestObj
+ * @obj: (allow-none): A #TestObj
*/
void
test_object_null_in (TestObj *obj)
/**
* test_object_null_out:
- * @obj: (allow-none) (out) A #TestObj
+ * @obj: (allow-none) (out): A #TestObj
*/
void
test_object_null_out (TestObj **obj)
/**
* g_i_marshalling_tests_boolean_out_true:
- * bool_: (out):
+ * @bool_: (out):
*/
void
g_i_marshalling_tests_boolean_out_true (gboolean *bool_)
/**
* g_i_marshalling_tests_boolean_out_false:
- * bool_: (out):
+ * @bool_: (out):
*/
void
g_i_marshalling_tests_boolean_out_false (gboolean *bool_)
/**
* g_i_marshalling_tests_boolean_inout_true_false:
- * bool_: (inout):
+ * @bool_: (inout):
*/
void
g_i_marshalling_tests_boolean_inout_true_false (gboolean *bool_)
/**
* g_i_marshalling_tests_boolean_inout_false_true:
- * bool_: (inout):
+ * @bool_: (inout):
*/
void
g_i_marshalling_tests_boolean_inout_false_true (gboolean *bool_)
/**
* g_i_marshalling_tests_int8_out_max:
- * int8: (out):
+ * @int8: (out):
*/
void
g_i_marshalling_tests_int8_out_max (gint8 *int8)
/**
* g_i_marshalling_tests_int8_out_min:
- * int8: (out):
+ * @int8: (out):
*/
void
g_i_marshalling_tests_int8_out_min (gint8 *int8)
/**
* g_i_marshalling_tests_int8_inout_max_min:
- * int8: (inout):
+ * @int8: (inout):
*/
void
g_i_marshalling_tests_int8_inout_max_min (gint8 *int8)
/**
* g_i_marshalling_tests_int8_inout_min_max:
- * int8: (inout):
+ * @int8: (inout):
*/
void
g_i_marshalling_tests_int8_inout_min_max (gint8 *int8)
/**
* g_i_marshalling_tests_uint8_out:
- * uint8: (out):
+ * @uint8: (out):
*/
void
g_i_marshalling_tests_uint8_out (guint8 *uint8)
/**
* g_i_marshalling_tests_uint8_inout:
- * uint8: (inout):
+ * @uint8: (inout):
*/
void
g_i_marshalling_tests_uint8_inout (guint8 *uint8)
/**
* g_i_marshalling_tests_int16_out_max:
- * int16: (out):
+ * @int16: (out):
*/
void
g_i_marshalling_tests_int16_out_max (gint16 *int16)
/**
* g_i_marshalling_tests_int16_out_min:
- * int16: (out):
+ * @int16: (out):
*/
void
g_i_marshalling_tests_int16_out_min (gint16 *int16)
/**
* g_i_marshalling_tests_int16_inout_max_min:
- * int16: (inout):
+ * @int16: (inout):
*/
void
g_i_marshalling_tests_int16_inout_max_min (gint16 *int16)
/**
* g_i_marshalling_tests_int16_inout_min_max:
- * int16: (inout):
+ * @int16: (inout):
*/
void
g_i_marshalling_tests_int16_inout_min_max (gint16 *int16)
/**
* g_i_marshalling_tests_uint16_out:
- * uint16: (out):
+ * @uint16: (out):
*/
void
g_i_marshalling_tests_uint16_out (guint16 *uint16)
/**
* g_i_marshalling_tests_uint16_inout:
- * uint16: (inout):
+ * @uint16: (inout):
*/
void
g_i_marshalling_tests_uint16_inout (guint16 *uint16)
/**
* g_i_marshalling_tests_int32_out_max:
- * int32: (out):
+ * @int32: (out):
*/
void
g_i_marshalling_tests_int32_out_max (gint32 *int32)
/**
* g_i_marshalling_tests_int32_out_min:
- * int32: (out):
+ * @int32: (out):
*/
void
g_i_marshalling_tests_int32_out_min (gint32 *int32)
/**
* g_i_marshalling_tests_int32_inout_max_min:
- * int32: (inout):
+ * @int32: (inout):
*/
void
g_i_marshalling_tests_int32_inout_max_min (gint32 *int32)
/**
* g_i_marshalling_tests_int32_inout_min_max:
- * int32: (inout):
+ * @int32: (inout):
*/
void
g_i_marshalling_tests_int32_inout_min_max (gint32 *int32)
/**
* g_i_marshalling_tests_uint32_out:
- * uint32: (out):
+ * @uint32: (out):
*/
void
g_i_marshalling_tests_uint32_out (guint32 *uint32)
/**
* g_i_marshalling_tests_uint32_inout:
- * uint32: (inout):
+ * @uint32: (inout):
*/
void
g_i_marshalling_tests_uint32_inout (guint32 *uint32)
/**
* g_i_marshalling_tests_int64_out_max:
- * int64: (out):
+ * @int64: (out):
*/
void
g_i_marshalling_tests_int64_out_max (gint64 *int64)
/**
* g_i_marshalling_tests_int64_out_min:
- * int64: (out):
+ * @int64: (out):
*/
void
g_i_marshalling_tests_int64_out_min (gint64 *int64)
/**
* g_i_marshalling_tests_int64_inout_max_min:
- * int64: (inout):
+ * @int64: (inout):
*/
void
g_i_marshalling_tests_int64_inout_max_min (gint64 *int64)
/**
* g_i_marshalling_tests_int64_inout_min_max:
- * int64: (inout):
+ * @int64: (inout):
*/
void
g_i_marshalling_tests_int64_inout_min_max (gint64 *int64)
/**
* g_i_marshalling_tests_uint64_out:
- * uint64: (out):
+ * @uint64: (out):
*/
void
g_i_marshalling_tests_uint64_out (guint64 *uint64)
/**
* g_i_marshalling_tests_uint64_inout:
- * uint64: (inout):
+ * @uint64: (inout):
*/
void
g_i_marshalling_tests_uint64_inout (guint64 *uint64)
/**
* g_i_marshalling_tests_short_out_max:
- * short_: (out):
+ * @short_: (out):
*/
void
g_i_marshalling_tests_short_out_max (gshort *short_)
/**
* g_i_marshalling_tests_short_out_min:
- * short_: (out):
+ * @short_: (out):
*/
void
g_i_marshalling_tests_short_out_min (gshort *short_)
/**
* g_i_marshalling_tests_short_inout_max_min:
- * short_: (inout):
+ * @short_: (inout):
*/
void
g_i_marshalling_tests_short_inout_max_min (gshort *short_)
/**
* g_i_marshalling_tests_short_inout_min_max:
- * short_: (inout):
+ * @short_: (inout):
*/
void
g_i_marshalling_tests_short_inout_min_max (gshort *short_)
/**
* g_i_marshalling_tests_ushort_out:
- * ushort: (out):
+ * @ushort: (out):
*/
void
g_i_marshalling_tests_ushort_out (gushort *ushort)
/**
* g_i_marshalling_tests_ushort_inout:
- * ushort: (inout):
+ * @ushort: (inout):
*/
void
g_i_marshalling_tests_ushort_inout (gushort *ushort)
/**
* g_i_marshalling_tests_int_out_max:
- * int_: (out):
+ * @int_: (out):
*/
void
g_i_marshalling_tests_int_out_max (gint *int_)
/**
* g_i_marshalling_tests_int_out_min:
- * int_: (out):
+ * @int_: (out):
*/
void
g_i_marshalling_tests_int_out_min (gint *int_)
/**
* g_i_marshalling_tests_int_inout_max_min:
- * int_: (inout):
+ * @int_: (inout):
*/
void
g_i_marshalling_tests_int_inout_max_min (gint *int_)
/**
* g_i_marshalling_tests_int_inout_min_max:
- * int_: (inout):
+ * @int_: (inout):
*/
void
g_i_marshalling_tests_int_inout_min_max (gint *int_)
/**
* g_i_marshalling_tests_uint_out:
- * uint: (out):
+ * @uint: (out):
*/
void
g_i_marshalling_tests_uint_out (guint *uint)
/**
* g_i_marshalling_tests_uint_inout:
- * uint: (inout):
+ * @uint: (inout):
*/
void
g_i_marshalling_tests_uint_inout (guint *uint)
/**
* g_i_marshalling_tests_long_out_max:
- * long_: (out):
+ * @long_: (out):
*/
void
g_i_marshalling_tests_long_out_max (glong *long_)
/**
* g_i_marshalling_tests_long_out_min:
- * long_: (out):
+ * @long_: (out):
*/
void
g_i_marshalling_tests_long_out_min (glong *long_)
/**
* g_i_marshalling_tests_long_inout_max_min:
- * long_: (inout):
+ * @long_: (inout):
*/
void
g_i_marshalling_tests_long_inout_max_min (glong *long_)
/**
* g_i_marshalling_tests_long_inout_min_max:
- * long_: (inout):
+ * @long_: (inout):
*/
void
g_i_marshalling_tests_long_inout_min_max (glong *long_)
/**
* g_i_marshalling_tests_ulong_out:
- * ulong: (out):
+ * @ulong: (out):
*/
void
g_i_marshalling_tests_ulong_out (gulong *ulong)
/**
* g_i_marshalling_tests_ulong_inout:
- * ulong: (inout):
+ * @ulong: (inout):
*/
void
g_i_marshalling_tests_ulong_inout (gulong *ulong)
/**
* g_i_marshalling_tests_ssize_out_max:
- * ssize: (out):
+ * @ssize: (out):
*/
void
g_i_marshalling_tests_ssize_out_max (gssize *ssize)
/**
* g_i_marshalling_tests_ssize_out_min:
- * ssize: (out):
+ * @ssize: (out):
*/
void
g_i_marshalling_tests_ssize_out_min (gssize *ssize)
/**
* g_i_marshalling_tests_ssize_inout_max_min:
- * ssize: (inout):
+ * @ssize: (inout):
*/
void
g_i_marshalling_tests_ssize_inout_max_min (gssize *ssize)
/**
* g_i_marshalling_tests_ssize_inout_min_max:
- * ssize: (inout):
+ * @ssize: (inout):
*/
void
g_i_marshalling_tests_ssize_inout_min_max (gssize *ssize)
/**
* g_i_marshalling_tests_size_out:
- * size: (out):
+ * @size: (out):
*/
void
g_i_marshalling_tests_size_out (gsize *size)
/**
* g_i_marshalling_tests_size_inout:
- * size: (inout):
+ * @size: (inout):
*/
void
g_i_marshalling_tests_size_inout (gsize *size)
/**
* g_i_marshalling_tests_float_out:
- * float_: (out):
+ * @float_: (out):
*/
void
g_i_marshalling_tests_float_out (gfloat *float_)
/**
* g_i_marshalling_tests_float_inout:
- * float_: (inout):
+ * @float_: (inout):
*/
void
g_i_marshalling_tests_float_inout (gfloat *float_)
/**
* g_i_marshalling_tests_double_out:
- * double_: (out):
+ * @double_: (out):
*/
void
g_i_marshalling_tests_double_out (gdouble *double_)
/**
* g_i_marshalling_tests_double_inout:
- * double_: (inout):
+ * @double_: (inout):
*/
void
g_i_marshalling_tests_double_inout (gdouble *double_)
/**
* g_i_marshalling_tests_time_t_out:
- * time_t_: (out):
+ * @time_t_: (out):
*/
void
g_i_marshalling_tests_time_t_out (time_t *time_t_)
/**
* g_i_marshalling_tests_time_t_inout:
- * time_t_: (inout):
+ * @time_t_: (inout):
*/
void
g_i_marshalling_tests_time_t_inout (time_t *time_t_)
/**
* g_i_marshalling_tests_gtype_out:
- * gtype: (out):
+ * @gtype: (out):
*/
void
g_i_marshalling_tests_gtype_out (GType *gtype)
/**
* g_i_marshalling_tests_gtype_inout:
- * gtype: (inout):
+ * @gtype: (inout):
*/
void
g_i_marshalling_tests_gtype_inout (GType *gtype)
/**
* g_i_marshalling_tests_utf8_none_out:
- * utf8: (out) (transfer none):
+ * @utf8: (out) (transfer none):
*/
void
g_i_marshalling_tests_utf8_none_out (gchar **utf8)
/**
* g_i_marshalling_tests_utf8_full_out:
- * utf8: (out) (transfer full):
+ * @utf8: (out) (transfer full):
*/
void
g_i_marshalling_tests_utf8_full_out (gchar **utf8)
/**
* g_i_marshalling_tests_utf8_dangling_out:
- * utf8: (out) (transfer full):
+ * @utf8: (out) (transfer full):
*/
void
g_i_marshalling_tests_utf8_dangling_out (gchar **utf8)
/**
* g_i_marshalling_tests_utf8_none_inout:
- * utf8: (inout) (transfer none):
+ * @utf8: (inout) (transfer none):
*/
void
g_i_marshalling_tests_utf8_none_inout (gchar **utf8)
/**
* g_i_marshalling_tests_utf8_full_inout:
- * utf8: (inout) (transfer full):
+ * @utf8: (inout) (transfer full):
*/
void
g_i_marshalling_tests_utf8_full_inout (gchar **utf8)
/**
* g_i_marshalling_tests_gstrv_return:
- * Returns:
+ *
+ * Returns: an array of strings
*/
GStrv
g_i_marshalling_tests_gstrv_return (void)
/**
* g_i_marshalling_tests_int_out_out:
- * int0: (out):
- * int1: (out):
+ * @int0: (out):
+ * @int1: (out):
*/
void
g_i_marshalling_tests_int_out_out (gint *int0, gint *int1)
/**
* g_i_marshalling_tests_int_return_out:
- * int_: (out):
+ * @int_: (out):
*/
gint
g_i_marshalling_tests_int_return_out (gint *int_)
# AnnotationParser - parses gtk-doc annotations
import re
-import sys
from .ast import (Array, Bitfield, Callback, Class, Enum, Field, Function,
Interface, List, Map, Parameter, Property, Record, Return,
TAG_SINCE = 'since'
TAG_DEPRECATED = 'deprecated'
TAG_RETURNS = 'returns'
-TAG_RETURNS_ALT = 'return value'
TAG_ATTRIBUTES = 'attributes'
TAG_RENAME_TO = 'rename to'
TAG_TYPE = 'type'
return '<DocBlock %r %r>' % (self.name, self.options)
def get(self, name):
- if name == TAG_RETURNS:
- value = self.tags.get(name)
- if value is None:
- return self.tags.get(TAG_RETURNS_ALT)
- else:
- return value
- else:
- return self.tags.get(name)
+ return self.tags.get(name)
class DocTag(object):
class AnnotationParser(object):
+ WHITESPACE_RE = re.compile(r'^\s*$')
+ ASCII_TEXT_RE = re.compile(r'\s*[A-Za-z]+')
+ OPTION_RE = re.compile(r'\([A-Za-z]+[^(]*\)')
+ RETURNS_RE = re.compile(r'^return(s?)( value)?:', re.IGNORECASE)
def __init__(self, namespace, source_scanner, transformer):
self._blocks = {}
cpos = block_header.find(': ')
if cpos:
block_name = block_header[:cpos]
- block_options, rest = self._parse_options(block_header[cpos+2:])
- if rest:
- return
+ block_options = self.parse_options(block_header[cpos+2:])
else:
block_name, block_options = block_header, {}
block = DocBlock(block_name, block_options)
+ debug = block_name == 'annotation_object_compute_sum_n'
comment_lines = []
- parse_parameters = True
- canon_name = ''
+ parsing_parameters = True
+ last_param_tag = None
+
+ # Second phase: parse parameters, return values, Tag: format
+ # annotations.
+ #
+ # Valid lines look like:
+ # * @foo: some comment here
+ # * @baz: (inout): This has an annotation
+ # * @bar: (out) (allow-none): this is a long parameter comment
+ # * that gets wrapped to the next line.
+ # *
+ # * Some documentation for the function.
+ # *
+ # * Returns: (transfer none): A value
for line in comment[pos+1:].split('\n'):
line = line.lstrip()
- line = line[2:].strip() # Skip ' *'
- if not line:
- if parse_parameters:
- parse_parameters = False
+ if (not line.startswith('*') or
+ self.WHITESPACE_RE.match(line[1:])):
+ # As soon as we find a line that's just whitespace,
+ # we're done parsing the parameters.
+ parsing_parameters = False
continue
- if line.startswith('@'):
- line = line[1:]
- elif not ': ' in line:
- if parse_parameters and line:
- if canon_name != '' and canon_name in block.tags:
- block.tags[canon_name].comment += ' ' + line
+
+ line = line[1:].lstrip()
+
+ # Look for a parameter or return value. Both of these can
+ # have parenthesized options.
+ first_colonspace_index = line.find(': ')
+ is_parameter = line.startswith('@')
+ is_return_value = self.RETURNS_RE.search(line)
+ if ((is_parameter or is_return_value)
+ and first_colonspace_index > 0):
+ if is_parameter:
+ argname = line[1:first_colonspace_index]
+ else:
+ argname = TAG_RETURNS
+ tag = DocTag(argname)
+ second_colon_index = line.rfind(':')
+ found_options = False
+ if second_colon_index > first_colonspace_index:
+ value_line = \
+ line[first_colonspace_index+2:second_colon_index]
+ if self.OPTION_RE.search(value_line):
+ # The OPTION_RE is a little bit heuristic. If
+ # we found two colons, we scan inside for something
+ # that looks like (foo).
+ # *Ideally* we'd change the gtk-doc format to
+ # require double colons, and then there'd be
+ # no ambiguity. I.e.:
+ # @foo:: Some documentation here
+ # But that'd be a rather incompatible change.
+ found_options = True
+ tag.comment = line[second_colon_index+1:].strip()
+ tag.options = self.parse_options(value_line)
+ if not found_options:
+ # We didn't find any options, so just take the whole thing
+ # as documentation.
+ tag.comment = line[first_colonspace_index+2:].strip()
+ block.tags[argname] = tag
+ last_param_tag = tag
+ elif (not is_parameter) and parsing_parameters and last_param_tag:
+ # We need to handle continuation lines on parameters. The
+ # conditional above - if a line doesn't start with '@', we're
+ # not yet in the documentation block for the whole function,
+ # and we've seen at least one parameter.
+ last_param_tag.comment += (' ' + line.strip())
+ elif first_colonspace_index > 0:
+ # The line is of the form "Tag: some value here", like:
+ # Since: 0.8
+ tag_name = line[:first_colonspace_index]
+ if self.ASCII_TEXT_RE.match(tag_name):
+ tag_name = tag_name.lower()
+ tag = DocTag(tag_name)
+ tag.value = line[first_colonspace_index+2:]
+ block.tags[tag_name] = tag
else:
comment_lines.append(line)
- continue
- tag_name, value = self._split_tag_namevalue(line)
- canon_name = tag_name.lower()
- if canon_name in block.tags:
- print >> sys.stderr, (
- "Symbol %s has multiple definition of tag %r" % (
- block_name, canon_name, ))
- block.tags[canon_name] = self._create_tag(canon_name, value)
+ elif (not is_parameter):
+ comment_lines.append(line)
block.comment = '\n'.join(comment_lines)
self._blocks[block.name] = block
- def _split_tag_namevalue(self, raw):
- """Split a line into tag name and value"""
- parts = raw.split(': ', 1)
- if len(parts) == 1:
- tag_name = parts[0]
- value = ''
- if tag_name.endswith(':'):
- tag_name = tag_name[:-1]
- else:
- tag_name, value = parts
- return (tag_name, value)
-
- def _create_tag(self, tag_name, value):
- # Tag: bar
- # Tag: bar opt1 opt2
- tag = DocTag(tag_name)
- tag.value = value
- options, rest = self._parse_options(tag.value)
- tag.options = options
- tag.comment = rest or ''
- return tag
-
- def _parse_options(self, value):
+ @classmethod
+ def parse_options(cls, value):
# (foo)
# (bar opt1 opt2...)
opened = -1
last = i + 2
opened = -1
- if last is not None:
- rest = value[last:].strip()
- else:
- rest = None
- return options, rest
+ return options
class AnnotationApplier(object):
annos_tag = self._get_tag(block, TAG_ATTRIBUTES)
if annos_tag is None:
return
- for key, value in annos_tag.options.iteritems():
+ options = AnnotationParser.parse_options(annos_tag.value)
+ for key, value in options.iteritems():
if value:
node.attributes.append((key, value.one()))
glib:type-struct="ObjectClass">
<attribute name="org.example.Test" value="cows"/>
<method name="method" c:identifier="annotation_object_method">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
</method>
<method name="out"
c:identifier="annotation_object_out"
doc="This is a test for out arguments">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<method name="inout"
c:identifier="annotation_object_inout"
doc="This is a test for out arguments">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<method name="inout2"
c:identifier="annotation_object_inout2"
doc="This is a second test for out arguments">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<method name="inout3"
c:identifier="annotation_object_inout3"
doc="This is a 3th test for out arguments">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<method name="in"
c:identifier="annotation_object_in"
doc="This is a test for in arguments">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<method name="calleeowns"
c:identifier="annotation_object_calleeowns"
doc="This is a test for out arguments; GObject defaults to transfer">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<method name="calleesowns"
c:identifier="annotation_object_calleesowns"
doc="This is a test for out arguments, one transferred, other not">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="an int">
<type name="int" c:type="gint"/>
</return-value>
<parameters>
<type name="int"/>
</array>
</parameter>
- <parameter name="n_nums" transfer-ownership="none">
+ <parameter name="n_nums"
+ transfer-ownership="none"
+ doc="Length of number array">
<type name="int" c:type="int"/>
</parameter>
</parameters>
<type name="int"/>
</array>
</parameter>
- <parameter name="n_nums" transfer-ownership="none">
+ <parameter name="n_nums"
+ transfer-ownership="none"
+ doc="Length of number array">
<type name="int" c:type="int"/>
</parameter>
</parameters>
<method name="string_out"
c:identifier="annotation_object_string_out"
doc="Test returning a string as an out parameter">
- <return-value transfer-ownership="none">
+ <return-value transfer-ownership="none" doc="some boolean">
<type name="boolean" c:type="gboolean"/>
</return-value>
<parameters>
doc="Callback to invoke">
<type name="ForeachFunc" c:type="AnnotationForeachFunc"/>
</parameter>
- <parameter name="user_data" transfer-ownership="none">
+ <parameter name="user_data"
+ transfer-ownership="none"
+ doc="Callback user data">
<type name="any" c:type="gpointer"/>
</parameter>
</parameters>
<type name="uint8"/>
</array>
</parameter>
- <parameter name="length" transfer-ownership="none">
+ <parameter name="length"
+ transfer-ownership="none"
+ doc="Length of the data">
<type name="size_t" c:type="gsize"/>
</parameter>
</parameters>
<type name="int8"/>
</array>
</parameter>
- <parameter name="length" transfer-ownership="none">
+ <parameter name="length"
+ transfer-ownership="none"
+ doc="Length of the data">
<type name="size_t" c:type="gsize"/>
</parameter>
</parameters>
<type name="uint8"/>
</array>
</parameter>
- <parameter name="length" transfer-ownership="none">
+ <parameter name="length"
+ transfer-ownership="none"
+ doc="Length of the data">
<type name="size_t" c:type="gsize"/>
</parameter>
</parameters>
transfer-ownership="none"
scope="notified"
closure="2"
- destroy="3">
+ destroy="3"
+ doc="The callback">
<type name="ForeachFunc" c:type="AnnotationForeachFunc"/>
</parameter>
- <parameter name="user_data" transfer-ownership="none">
+ <parameter name="user_data"
+ transfer-ownership="none"
+ doc="The callback data">
<type name="any" c:type="gpointer"/>
</parameter>
- <parameter name="destroy" transfer-ownership="none" scope="call">
+ <parameter name="destroy"
+ transfer-ownership="none"
+ scope="call"
+ doc="Destroy notification">
<type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
</parameter>
</parameters>
<type name="none" c:type="void"/>
</return-value>
<parameters>
- <parameter name="arg1" transfer-ownership="none">
+ <parameter name="object" transfer-ownership="none">
<type name="any" c:type="gpointer"/>
</parameter>
</parameters>
<type name="int" c:type="gint"/>
</return-value>
<parameters>
- <parameter name="object" transfer-ownership="none">
+ <parameter name="object"
+ transfer-ownership="none"
+ doc="A #AnnotationObject.">
<type name="Object" c:type="AnnotationObject*"/>
</parameter>
<parameter name="data" transfer-ownership="none" doc="Some data.">
</parameter>
</parameters>
</function>
+ <function name="invalid_annotation"
+ c:identifier="annotation_invalid_annotation">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="foo"
+ transfer-ownership="none"
+ doc="some text (e.g. example) or else">
+ <type name="int" c:type="int"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="ptr_array" c:identifier="annotation_ptr_array">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
<type name="none"/>
</return-value>
<parameters>
- <parameter name="arg1" transfer-ownership="none">
+ <parameter name="object" transfer-ownership="none">
<type name="any"/>
</parameter>
</parameters>
</parameter>
</parameters>
</function>
+ <function name="invalid_annotation" c:identifier="annotation_invalid_annotation">
+ <return-value transfer-ownership="none">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <parameter name="foo" transfer-ownership="none">
+ <type name="int"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="ptr_array" c:identifier="annotation_ptr_array">
<return-value transfer-ownership="none">
<type name="none"/>
/**
* annotation_string_zero_terminated_out:
- * @out: (array zero-terminated=1) (inout)
+ * @out: (array zero-terminated=1) (inout):
**/
void
annotation_string_zero_terminated_out (char ***out)
return 42;
}
+/**
+ * annotation_invalid_annotation:
+ * @foo: some text (e.g. example) or else
+ */
+void
+annotation_invalid_annotation (int foo)
+{
+
+}
+
+
char backslash_parsing_tester_2 = '\\';
gint annotation_attribute_func (AnnotationObject *object,
const gchar *data);
+void annotation_invalid_annotation (int foo);
+
/**
* AnnotationStruct:
*
<type name="none" c:type="void"/>
</return-value>
<parameters>
- <parameter name="offset" transfer-ownership="none">
+ <parameter name="offset" transfer-ownership="none" doc="offset">
<type name="int" c:type="int"/>
</parameter>
- <parameter name="length" transfer-ownership="none">
+ <parameter name="length" transfer-ownership="none" doc="length">
<type name="int" c:type="int"/>
</parameter>
</parameters>
<type name="none" c:type="void"/>
</return-value>
<parameters>
- <parameter name="offset" transfer-ownership="none">
+ <parameter name="offset" transfer-ownership="none" doc="offset">
<type name="int" c:type="int"/>
</parameter>
- <parameter name="length" transfer-ownership="none">
+ <parameter name="length" transfer-ownership="none" doc="length">
<type name="int" c:type="int"/>
</parameter>
</parameters>
<parameter name="object" transfer-ownership="none">
<type name="Object" c:type="FooObject*"/>
</parameter>
- <parameter name="offset" transfer-ownership="none">
+ <parameter name="offset" transfer-ownership="none" doc="offset">
<type name="int" c:type="int"/>
</parameter>
- <parameter name="length" transfer-ownership="none">
+ <parameter name="length" transfer-ownership="none" doc="length">
<type name="int" c:type="int"/>
</parameter>
</parameters>
<type name="none" c:type="void"/>
</return-value>
<parameters>
- <parameter name="r2" transfer-ownership="none">
+ <parameter name="r2"
+ transfer-ownership="none"
+ doc="source rectangle">
<type name="Rectangle" c:type="FooRectangle*"/>
</parameter>
</parameters>
<type name="none" c:type="void"/>
</return-value>
<parameters>
- <parameter name="fs" transfer-ownership="none">
+ <parameter name="fs" transfer-ownership="none" doc="a #FooSkippable">
<type name="Skippable" c:type="FooSkippable"/>
</parameter>
</parameters>