gobject-introspection r398 - in trunk: . giscanner tests/scanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r398 - in trunk: . giscanner tests/scanner
- Date: Mon, 18 Aug 2008 20:16:57 +0000 (UTC)
Author: johan
Date: Mon Aug 18 20:16:57 2008
New Revision: 398
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=398&view=rev
Log:
2008-08-18 Johan Dahlin <johan gnome org>
* giscanner/ast.py:
* giscanner/girparser.py:
* giscanner/girwriter.py:
* giscanner/glibast.py:
* giscanner/glibtransformer.py:
* giscanner/transformer.py:
* tests/scanner/Foo-expected.gir:
* tests/scanner/foo-object.h:
* tests/scanner/utility-expected.gir:
* tests/scanner/utility.h:
Redo type resolving and validation.
Add a couple of new tests.
Patch mostly written by Colin.
Modified:
trunk/ChangeLog
trunk/giscanner/ast.py
trunk/giscanner/girparser.py
trunk/giscanner/girwriter.py
trunk/giscanner/glibast.py
trunk/giscanner/glibtransformer.py
trunk/giscanner/transformer.py
trunk/tests/scanner/Foo-expected.gir
trunk/tests/scanner/foo-object.h
trunk/tests/scanner/utility-expected.gir
trunk/tests/scanner/utility.h
Modified: trunk/giscanner/ast.py
==============================================================================
--- trunk/giscanner/ast.py (original)
+++ trunk/giscanner/ast.py Mon Aug 18 20:16:57 2008
@@ -35,12 +35,14 @@
TYPE_UINT8 = 'uint8'
TYPE_INT16 = 'int16'
TYPE_UINT16 = 'uint16'
+TYPE_INT = 'int'
+TYPE_UINT = 'uint'
TYPE_INT32 = 'int32'
TYPE_UINT32 = 'uint32'
-TYPE_INT64 = 'int64'
-TYPE_UINT64 = 'uint64'
TYPE_LONG = 'long'
TYPE_ULONG = 'ulong'
+TYPE_INT64 = 'int64'
+TYPE_UINT64 = 'uint64'
# Floating-point
TYPE_FLOAT = 'float'
@@ -91,6 +93,13 @@
type_names['size_t'] = TYPE_SIZE
type_names['ssize_t'] = TYPE_SSIZE
+# GIR names
+type_names['none'] = TYPE_NONE
+type_names['string'] = TYPE_STRING
+type_names['int32'] = TYPE_INT32
+type_names['uint32'] = TYPE_UINT32
+type_names['any'] = TYPE_ANY
+
def type_name_from_ctype(ctype):
return type_names.get(ctype, ctype)
@@ -278,10 +287,11 @@
class Callback(Node):
- def __init__(self, name, retval, parameters):
+ def __init__(self, name, retval, parameters, ctype=None):
Node.__init__(self, name)
self.retval = retval
self.parameters = parameters
+ self.ctype = ctype
def __repr__(self):
return 'Callback(%r, %r, %r)' % (
Modified: trunk/giscanner/girparser.py
==============================================================================
--- trunk/giscanner/girparser.py (original)
+++ trunk/giscanner/girparser.py Mon Aug 18 20:16:57 2008
@@ -91,7 +91,8 @@
def _parse_alias(self, node):
return Alias(node.attrib['name'],
- node.attrib['target'])
+ node.attrib['target'],
+ node.attrib.get(_cns('type')))
def _parse_object_interface(self, node):
if node.tag == _corens('interface'):
@@ -121,7 +122,8 @@
parameters.append(Parameter(paramnode.attrib['name'],
self._parse_type(paramnode)))
if klass is Callback:
- return klass(name, retval, parameters)
+ return klass(name, retval, parameters,
+ node.attrib.get(_cns('type')))
else:
identifier = node.attrib.get(_cns('identifier'))
return klass(name, retval, parameters, identifier)
Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py (original)
+++ trunk/giscanner/girwriter.py Mon Aug 18 20:16:57 2008
@@ -209,7 +209,7 @@
def _write_callback(self, callback):
# FIXME: reuse _write_function
- attrs = [('name', callback.name)]
+ attrs = [('name', callback.name), ('c:type', callback.ctype)]
with self.tagcontext('callback', attrs):
self._write_return_type(callback.retval)
self._write_parameters(callback.parameters)
Modified: trunk/giscanner/glibast.py
==============================================================================
--- trunk/giscanner/glibast.py (original)
+++ trunk/giscanner/glibast.py Mon Aug 18 20:16:57 2008
@@ -22,7 +22,8 @@
from .ast import (
type_names,
TYPE_STRING, TYPE_INT8, TYPE_UINT8, TYPE_INT16, TYPE_UINT16,
- TYPE_UINT32, TYPE_INT32, TYPE_LONG, TYPE_ULONG, TYPE_FLOAT,
+ TYPE_UINT32, TYPE_INT32, TYPE_LONG, TYPE_ULONG, TYPE_INT64,
+ TYPE_UINT64, TYPE_FLOAT, TYPE_INT, TYPE_UINT,
TYPE_DOUBLE, TYPE_BOOLEAN, TYPE_ANY, TYPE_SIZE, TYPE_SSIZE)
# Glib type names
@@ -31,12 +32,14 @@
type_names['guint8'] = TYPE_UINT8
type_names['gint16'] = TYPE_INT16
type_names['guint16'] = TYPE_UINT16
-type_names['gint'] = TYPE_INT32
-type_names['guint'] = TYPE_UINT32
+type_names['gint'] = TYPE_INT
+type_names['guint'] = TYPE_UINT
type_names['gint32'] = TYPE_INT32
type_names['guint32'] = TYPE_UINT32
type_names['glong'] = TYPE_LONG
type_names['gulong'] = TYPE_ULONG
+type_names['gint64'] = TYPE_INT64
+type_names['guint64'] = TYPE_UINT64
type_names['gfloat'] = TYPE_FLOAT
type_names['gdouble'] = TYPE_DOUBLE
type_names['gchar*'] = TYPE_STRING
Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py (original)
+++ trunk/giscanner/glibtransformer.py Mon Aug 18 20:16:57 2008
@@ -19,13 +19,14 @@
#
import ctypes
+import sys
from . import cgobject
from .odict import odict
from .ast import (Callback, Enum, Function, Member, Namespace, Parameter,
Property, Return, Struct, Type, Alias, type_name_from_ctype)
from .glibast import (GLibBoxed, GLibEnum, GLibEnumMember, GLibFlags,
- GLibInterface, GLibObject, GLibSignal)
+ GLibInterface, GLibObject, GLibSignal, type_names)
from .utils import extract_libtool, to_underscores
@@ -37,7 +38,9 @@
self._aliases = []
self._output_ns = odict()
self._libraries = []
+ self._failed_types = {}
self._internal_types = {}
+ self._validating = False
# Public API
@@ -56,17 +59,21 @@
# Introspection is done from within parsing
- # Second pass, resolving types; we need to create
- # a new list here because we're removing things
- # as we iterate.
- for node in list(self._output_ns.itervalues()):
+ # Second pass, delete class structures, resolve
+ # all types we now know about
+ nodes = list(self._output_ns.itervalues())
+ for node in nodes:
+ self._resolve_node(node)
# associate GtkButtonClass with GtkButton
if isinstance(node, Struct):
self._pair_class_struct(node)
- self._resolve_node(node)
for alias in self._aliases:
self._resolve_alias(alias)
+ # Third pass; ensure all types are known
+ if 0:
+ self._validate(nodes)
+
# Create a new namespace with what we found
namespace = Namespace(namespace.name)
namespace.nodes = self._aliases + list(self._output_ns.itervalues())
@@ -94,6 +101,7 @@
def _create_type(self, type_id):
ctype = cgobject.type_name(type_id)
type_name = type_name_from_ctype(ctype)
+ type_name = self._resolve_type_name(type_name)
return Type(type_name, ctype)
def _create_gobject(self, node):
@@ -153,9 +161,14 @@
if not symbol.endswith('_get_type'):
return False
# GType *_get_type(void)
- if func.retval.type.name not in ['GType', 'GObject.GType']:
- print ("Warning: *_get_type function returns '%r'" + \
- ", not GObject.GType") % (func.retval.type.name, )
+ # This is a bit fishy, why do we need all these aliases?
+ if func.retval.type.name not in ['Type',
+ 'GType',
+ 'Object.Type',
+ 'GObject.Type',
+ 'GObject.GType']:
+ print ("Warning: *_get_type function returns '%r'"
+ ", not GObject.Type") % (func.retval.type.name, )
return False
if func.parameters:
return False
@@ -172,6 +185,8 @@
continue
else:
print 'Warning: could not find symbol: %s' % symbol
+ name = symbol.replace('_get_type', '')
+ self._failed_types[name] = True
return False
func.restype = cgobject.GType
@@ -182,7 +197,7 @@
def _name_is_internal_gtype(self, giname):
try:
- node = self._internal_types[giname]
+ node = self._get_attribute(giname)
return isinstance(node, (GLibObject, GLibInterface, GLibBoxed,
GLibEnum, GLibFlags))
except KeyError, e:
@@ -191,47 +206,34 @@
def _parse_method(self, func):
if not func.parameters:
return False
-
- # FIXME: This is hackish, we should preserve the pointer structures
- # here, so we can find pointers to objects and not just
- # pointers to anything
- first_arg = func.parameters[0].type.name
- if not self._name_is_internal_gtype(first_arg):
- return False
-
- object_name = first_arg.replace('*', '')
- return self._parse_method_common(func, object_name, is_method=True)
+ return self._parse_method_common(func, True)
def _parse_constructor(self, func):
- # FIXME: This is hackish, we should preserve the pointer structures
- # here, so we can find pointers to objects and not just
- # pointers to anything
- rtype = func.retval.type.name
- if not self._name_is_internal_gtype(rtype):
- return False
+ return self._parse_method_common(func, False)
- object_name = rtype.replace('*', '')
- return self._parse_method_common(func, object_name, is_method=False)
-
- def _parse_method_common(self, func, object_name, is_method):
- orig_name = object_name
- if object_name.lower().startswith(self._namespace_name.lower()):
- object_name = object_name[len(self._namespace_name):]
- class_ = self._get_attribute(object_name)
- if class_ is None or not isinstance(class_, (GLibObject, GLibBoxed)):
+ def _parse_method_common(self, func, is_method):
+ if not is_method:
+ target_arg = func.retval
+ else:
+ target_arg = func.parameters[0]
+ klass = self._get_attribute(target_arg.type.name)
+ if klass is None or not isinstance(klass, (GLibObject, GLibBoxed)):
return False
- # GtkButton -> gtk_button_, so we can figure out the method name
- prefix = to_underscores(orig_name).lower() + '_'
+ # Look at the original C type (before namespace stripping), without
+ # pointers: GtkButton -> gtk_button_, so we can figure out the
+ # method name
+ orig_type = target_arg.type.ctype.replace('*', '')
+ prefix = to_underscores(orig_type).lower() + '_'
if not func.symbol.startswith(prefix):
return False
# Strip namespace and object prefix: gtk_window_new -> new
func.name = func.symbol[len(prefix):]
if is_method:
- class_.methods.append(func)
+ klass.methods.append(func)
else:
- class_.constructors.append(func)
+ klass.constructors.append(func)
return True
def _parse_struct(self, struct):
@@ -254,26 +256,48 @@
def _parse_callback(self, callback):
self._add_attribute(callback)
- def _pair_class_struct(self, maybe_class):
- name = maybe_class.name
+ def _strip_class_suffix(self, name):
if (name.endswith('Class') or
name.endswith('Iface')):
- name = name[:-5]
+ return name[:-5]
elif name.endswith('Interface'):
- name = name[:-9]
+ return name[:-9]
else:
+ return name
+
+ def _arg_is_failed(self, param):
+ ctype = self._transformer.ctype_of(param).replace('*', '')
+ uscored = to_underscores(self._strip_class_suffix(ctype)).lower()
+ if uscored in self._failed_types:
+ print >> sys.stderr, "failed type: %r" % (param, )
+ return True
+ return False
+
+ def _pair_class_struct(self, maybe_class):
+ name = self._strip_class_suffix(maybe_class.name)
+ if name == maybe_class.name:
return
+
+ if self._arg_is_failed(maybe_class):
+ print "WARNING: deleting no-type %r" % (maybe_class.name, )
+ del self._output_ns[maybe_class.name]
+ return
+
name = self._resolve_type_name(name)
resolved = self._transformer.strip_namespace_object(name)
pair_class = self._output_ns.get(resolved)
- if pair_class:
+ if pair_class and isinstance(pair_class,
+ (GLibObject, GLibBoxed, GLibInterface)):
+
del self._output_ns[maybe_class.name]
for field in maybe_class.fields[1:]:
pair_class.fields.append(field)
return
name = self._transformer.strip_namespace_object(maybe_class.name)
pair_class = self._output_ns.get(name)
- if pair_class:
+ if pair_class and isinstance(pair_class,
+ (GLibObject, GLibBoxed, GLibInterface)):
+
del self._output_ns[maybe_class.name]
# Introspection
@@ -328,12 +352,7 @@
type_name, symbol)
self._introspect_properties(node, type_id)
self._introspect_signals(node, type_id)
- self._add_attribute(node)
- try:
- self._remove_attribute(type_name)
- except KeyError:
- print 'Warning: could not remove %s' % type_name
- pass
+ self._add_attribute(node, replace=True)
self._register_internal_type(type_name, node)
def _introspect_interface(self, type_id, symbol):
@@ -345,19 +364,14 @@
type_name, symbol)
self._introspect_properties(node, type_id)
self._introspect_signals(node, type_id)
- self._add_attribute(node)
+ self._add_attribute(node, replace=True)
self._register_internal_type(type_name, node)
def _introspect_boxed(self, type_id, symbol):
type_name = cgobject.type_name(type_id)
node = GLibBoxed(self._transformer.strip_namespace_object(type_name),
type_name, symbol)
- self._add_attribute(node)
- # GdkEvent raises KeyError, FooBoxed ends up duplicated if we don't
- try:
- self._remove_attribute(type_name)
- except KeyError:
- pass
+ self._add_attribute(node, replace=True)
self._register_internal_type(type_name, node)
def _introspect_properties(self, node, type_id):
@@ -406,6 +420,19 @@
return possible_node.name
return type_name
+ def _validate_type(self, name):
+ if name in type_names:
+ return True
+ if name.find('.') >= 0:
+ return True
+ if name in self._internal_types:
+ return True
+ if name in self._aliases:
+ return True
+ if name in self._output_ns:
+ return True
+ return False
+
def _resolve_param_type(self, ptype):
ptype.name = ptype.name.replace('*', '')
type_name = ptype.name
@@ -414,6 +441,8 @@
ptype.name = possible_node.name
else:
ptype = self._transformer.resolve_param_type(ptype)
+ if self._validating and not self._validate_type(ptype.name):
+ raise ValueError("Unknown type %r" % (ptype.name, ))
return ptype
def _resolve_node(self, node):
@@ -484,3 +513,24 @@
def _resolve_alias(self, field):
field.target = self._resolve_type_name(field.target)
+
+ # Validation
+
+ def _validate(self, nodes):
+ nodes = list(self._output_ns.itervalues())
+ i = 0
+ self._validating = True
+ while True:
+ print "Type resolution; pass=%d" % (i, )
+ initlen = len(nodes)
+ nodes = list(self._output_ns.itervalues())
+ for node in nodes:
+ try:
+ self._resolve_node(node)
+ except ValueError, e:
+ print "WARNING: %s: Deleting %r" % (e, node)
+ self._remove_attribute(node.name)
+ if len(nodes) == initlen:
+ break
+ i += 1
+ self._validating = False
Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py (original)
+++ trunk/giscanner/transformer.py Mon Aug 18 20:16:57 2008
@@ -76,12 +76,14 @@
raise NotImplementedError(filename)
nsname = parser.get_namespace_name()
for node in parser.get_nodes():
- if isinstance(node, (GLibBoxed, Interface, Class)):
+ if isinstance(node, Alias):
+ self._alias_names[node.ctype] = (nsname, node)
+ elif isinstance(node, (GLibBoxed, Interface, Class)):
self._type_names[node.type_name] = (nsname, node)
- elif isinstance(node, Alias):
- self._alias_names[node.name] = (nsname, node)
elif hasattr(node, 'ctype'):
self._ctype_names[node.ctype] = (nsname, node)
+ elif hasattr(node, 'symbol'):
+ self._ctype_names[node.symbol] = (nsname, node)
else:
self._type_names[node.name] = (nsname, node)
@@ -89,7 +91,7 @@
prefix = self._namespace.name.lower()
if len(name) > len(prefix) and name.lower().startswith(prefix):
return name[len(prefix):]
- return name
+ return self._remove_prefix(name)
# Private
@@ -102,12 +104,10 @@
self._output_ns[node.name] = node
def _strip_namespace_func(self, name):
- orig_name = name
prefix = self._namespace.name.lower() + '_'
- name = name.lower()
- if name.startswith(prefix):
- name = orig_name[len(prefix):]
- return name
+ if name.lower().startswith(prefix):
+ name = name[len(prefix):]
+ return self._remove_prefix(name)
def _remove_prefix(self, name):
# when --strip-prefix=g:
@@ -227,7 +227,9 @@
CTYPE_UNION,
CTYPE_VOID):
if symbol.base_type.name:
- return Alias(symbol.ident, symbol.base_type.name)
+ name = self.strip_namespace_object(symbol.ident)
+ target = self.strip_namespace_object(symbol.base_type.name)
+ return Alias(name, target, ctype=symbol.ident)
return None
else:
raise NotImplementedError(
@@ -289,6 +291,7 @@
def _create_typedef_struct(self, symbol):
name = self._remove_prefix(symbol.ident)
+ name = self.strip_namespace_object(name)
struct = Struct(name, symbol.ident)
self._typedefs_ns[symbol.ident] = struct
return struct
@@ -296,7 +299,15 @@
def _create_struct(self, symbol):
struct = self._typedefs_ns.get(symbol.ident, None)
if struct is None:
- name = self._remove_prefix(symbol.ident)
+ # This is a bit of a hack; really we should try
+ # to resolve through the typedefs to find the real
+ # name
+ if symbol.ident.startswith('_'):
+ name = symbol.ident[1:]
+ else:
+ name = symbol.ident
+ name = self._remove_prefix(name)
+ name = self.strip_namespace_object(name)
name = self.resolve_type_name(name)
struct = Struct(name, symbol.ident)
@@ -310,7 +321,8 @@
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)
- return Callback(symbol.ident, retval, list(parameters))
+ name = self.strip_namespace_object(symbol.ident)
+ return Callback(name, retval, list(parameters), symbol.ident)
def _parse_type_annotation(self, annotation):
if (annotation[0] == "[" and
@@ -324,30 +336,31 @@
return item.name
return '%s.%s' % (nsname, item.name)
- def resolve_type_name(self, type_name):
+ def resolve_type_name(self, type_name, ctype=None):
type_name = type_name.replace('*', '')
- resolved = self._type_names.get(type_name)
- if resolved:
- return self._typepair_to_str(resolved)
+ type_name = self.strip_namespace_object(type_name)
resolved = self._alias_names.get(type_name)
if resolved:
return self._typepair_to_str(resolved)
- return type_name
-
- def resolve_param_type(self, ptype):
- type_name = ptype.name.replace('*', '')
resolved = self._type_names.get(type_name)
if resolved:
- ptype.name = self._typepair_to_str(resolved)
- return ptype
- if hasattr(ptype, 'ctype'):
- ctype = ptype.ctype
+ return self._typepair_to_str(resolved)
+ if ctype:
+ ctype = ctype.replace('*', '')
resolved = self._ctype_names.get(ctype)
if resolved:
- ptype.name = self._typepair_to_str(resolved)
- return ptype
- resolved = self._alias_names.get(type_name)
- if resolved:
- ptype.name = self._typepair_to_str(resolved)
- return ptype
+ return self._typepair_to_str(resolved)
+ return type_name
+
+ def ctype_of(self, obj):
+ if hasattr(obj, 'ctype'):
+ return obj.ctype
+ elif hasattr(obj, 'symbol'):
+ return obj.symbol
+ else:
+ return None
+
+ def resolve_param_type(self, ptype):
+ ptype.name = self.resolve_type_name(ptype.name,
+ self.ctype_of(ptype))
return ptype
Modified: trunk/tests/scanner/Foo-expected.gir
==============================================================================
--- trunk/tests/scanner/Foo-expected.gir (original)
+++ trunk/tests/scanner/Foo-expected.gir Mon Aug 18 20:16:57 2008
@@ -3,17 +3,12 @@
xmlns:c="http://www.gtk.org/introspection/c/1.0"
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
<namespace name="Foo">
- <alias name="FooList" target="GSList"/>
+ <alias name="List" target="GSList" c:type="FooList"/>
<interface name="Interface"
c:type="FooInterface"
glib:type-name="FooInterface"
glib:get-type="foo_interface_get_type">
</interface>
- <function name="init" c:identifier="foo_init">
- <return-value>
- <type name="int32" c:type="gint"/>
- </return-value>
- </function>
<class name="Object"
c:type="FooObject"
parent="GObject.Object"
@@ -26,7 +21,7 @@
</constructor>
<method name="method" c:identifier="foo_object_method">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -46,7 +41,7 @@
</method>
<method name="out" c:identifier="foo_object_out">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -82,7 +77,7 @@
</method>
<method name="inout" c:identifier="foo_object_inout">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -95,7 +90,7 @@
</method>
<method name="inout2" c:identifier="foo_object_inout2">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -108,7 +103,7 @@
</method>
<method name="inout3" c:identifier="foo_object_inout3">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -121,7 +116,7 @@
</method>
<method name="in" c:identifier="foo_object_in">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -134,7 +129,7 @@
</method>
<method name="calleeowns" c:identifier="foo_object_calleeowns">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -147,7 +142,7 @@
</method>
<method name="calleesowns" c:identifier="foo_object_calleesowns">
<return-value>
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</return-value>
<parameters>
<parameter name="object">
@@ -197,7 +192,7 @@
<type name="any" c:type="void*"/>
</parameter>
<parameter name="some_type">
- <type name="GObject.GType" c:type="GType"/>
+ <type name="GObject.Type" c:type="GType"/>
</parameter>
</parameters>
</method>
@@ -210,14 +205,14 @@
<type name="Object" c:type="FooObject*"/>
</parameter>
<parameter name="blah">
- <type name="FooList" c:type="FooList*"/>
+ <type name="List" c:type="FooList*"/>
</parameter>
</parameters>
</method>
<property name="string">
<type name="string" c:type="gchararray"/>
</property>
- <callback name="virtual_method">
+ <callback name="virtual_method" c:type="virtual_method">
<return-value>
<type name="boolean" c:type="gboolean"/>
</return-value>
@@ -255,6 +250,11 @@
</return-value>
</constructor>
</class>
+ <function name="init" c:identifier="foo_init">
+ <return-value>
+ <type name="int" c:type="gint"/>
+ </return-value>
+ </function>
<enumeration name="EnumType"
c:type="FooEnumType"
glib:type-name="FooEnumType"
@@ -334,7 +334,7 @@
</parameters>
</method>
</glib:boxed>
- <callback name="FooCallback">
+ <callback name="Callback" c:type="FooCallback">
<return-value>
<type name="boolean" c:type="gboolean"/>
</return-value>
@@ -350,28 +350,61 @@
</parameter>
</parameters>
</callback>
- <record name="FooStruct" c:type="FooStruct">
+ <record name="Struct" c:type="FooStruct">
<field name="priv">
- <type name="FooStructPrivate" c:type="FooStructPrivate*"/>
+ <type name="StructPrivate" c:type="FooStructPrivate*"/>
</field>
<field name="member">
<type name="int32" c:type="int"/>
</field>
</record>
- <record name="FooStructPrivate" c:type="FooStructPrivate"/>
- <record name="FooRectangle" c:type="FooRectangle">
+ <record name="StructPrivate" c:type="FooStructPrivate"/>
+ <record name="Rectangle" c:type="FooRectangle">
<field name="x">
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</field>
<field name="y">
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</field>
<field name="width">
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</field>
<field name="height">
- <type name="int32" c:type="gint"/>
+ <type name="int" c:type="gint"/>
</field>
</record>
+ <function name="method_external_references"
+ c:identifier="foo_method_external_references">
+ <return-value>
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="utility.Object" c:type="UtilityObject*"/>
+ </parameter>
+ <parameter name="e">
+ <type name="utility.EnumType" c:type="UtilityEnumType"/>
+ </parameter>
+ <parameter name="f">
+ <type name="utility.FlagType" c:type="UtilityFlagType"/>
+ </parameter>
+ <parameter name="s">
+ <type name="utility.Struct" c:type="UtilityStruct"/>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="rectangle_add" c:identifier="foo_rectangle_add">
+ <return-value>
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="r1">
+ <type name="Rectangle" c:type="FooRectangle*"/>
+ </parameter>
+ <parameter name="r2">
+ <type name="Rectangle" c:type="FooRectangle*"/>
+ </parameter>
+ </parameters>
+ </function>
</namespace>
</repository>
Modified: trunk/tests/scanner/foo-object.h
==============================================================================
--- trunk/tests/scanner/foo-object.h (original)
+++ trunk/tests/scanner/foo-object.h Mon Aug 18 20:16:57 2008
@@ -153,6 +153,9 @@
void
foo_method_external_references (UtilityObject *object,
UtilityEnumType e,
- UtilityFlagType f);
+ UtilityFlagType f,
+ UtilityStruct s);
+
+void foo_rectangle_add(FooRectangle *r1, const FooRectangle *r2);
#endif /* __FOO_OBJECT_H__ */
Modified: trunk/tests/scanner/utility-expected.gir
==============================================================================
--- trunk/tests/scanner/utility-expected.gir (original)
+++ trunk/tests/scanner/utility-expected.gir Mon Aug 18 20:16:57 2008
@@ -9,15 +9,16 @@
glib:type-name="UtilityObject"
glib:get-type="utility_object_get_type">
</class>
- <enumeration name="Enum" c:type="UtilityEnum">
+ <enumeration name="EnumType" c:type="UtilityEnumType">
<member name="a" value="0" c:identifier="UTILITY_ENUM_A"/>
<member name="b" value="1" c:identifier="UTILITY_ENUM_B"/>
<member name="c" value="2" c:identifier="UTILITY_ENUM_C"/>
</enumeration>
- <enumeration name="Flag" c:type="UtilityFlag">
+ <enumeration name="FlagType" c:type="UtilityFlagType">
<member name="a" value="0" c:identifier="UTILITY_FLAG_A"/>
<member name="b" value="1" c:identifier="UTILITY_FLAG_B"/>
<member name="c" value="2" c:identifier="UTILITY_FLAG_C"/>
</enumeration>
+ <record name="Struct" c:type="UtilityStruct"/>
</namespace>
</repository>
Modified: trunk/tests/scanner/utility.h
==============================================================================
--- trunk/tests/scanner/utility.h (original)
+++ trunk/tests/scanner/utility.h Mon Aug 18 20:16:57 2008
@@ -36,4 +36,9 @@
UTILITY_FLAG_C
} UtilityFlagType;
+typedef struct
+{
+ int field;
+} UtilityStruct;
+
#endif /* __UTILITY_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]