gobject-introspection r397 - in trunk: . gir giscanner tests/scanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r397 - in trunk: . gir giscanner tests/scanner
- Date: Mon, 18 Aug 2008 18:01:21 +0000 (UTC)
Author: johan
Date: Mon Aug 18 18:01:21 2008
New Revision: 397
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=397&view=rev
Log:
2008-08-18 Johan Dahlin <johan gnome org>
* gir/Makefile.am:
* giscanner/girparser.py:
Set ctype of enums
* giscanner/transformer.py:
Improve enum parsing for enums without a GType.
Make flags/enum references to other girs work
* giscanner/utils.py:
Simplify this a bit
* tests/scanner/Makefile.am:
* tests/scanner/foo-object.h:
* tests/scanner/utility-expected.gir:
* tests/scanner/utility.h:
Add a new test for external enum references
Modified:
trunk/ChangeLog
trunk/gir/Makefile.am
trunk/giscanner/girparser.py
trunk/giscanner/transformer.py
trunk/giscanner/utils.py
trunk/tests/scanner/Makefile.am
trunk/tests/scanner/foo-object.h
trunk/tests/scanner/utility-expected.gir
trunk/tests/scanner/utility.h
Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am (original)
+++ trunk/gir/Makefile.am Mon Aug 18 18:01:21 2008
@@ -49,6 +49,7 @@
-I$(GIO_LIBDIR)/glib-2.0/include \
-DGIO_COMPILATION \
--pkg glib-2.0 \
+ --pkg gobject-2.0 \
$(GLIB_INCLUDEDIR)/gio/*.h
BUILT_SOURCES += gio-2.0.gir
CLEANFILES = $(BUILT_SOURCES)
Modified: trunk/giscanner/girparser.py
==============================================================================
--- trunk/giscanner/girparser.py (original)
+++ trunk/giscanner/girparser.py Mon Aug 18 18:01:21 2008
@@ -158,13 +158,12 @@
def _parse_enumeration_bitfield(self, node):
klass = (GLibFlags if node.tag == _corens('bitfield') else GLibEnum)
-
members = []
for member in node.findall(_corens('member')):
members.append(self._parse_member(member))
- obj = klass(node.attrib.get(_corens('name')),
+ obj = klass(node.attrib.get('name'),
node.attrib.get(_glibns('type-name')),
members,
node.attrib.get(_glibns('get-type')))
-
+ obj.ctype = node.attrib.get(_cns('type'))
self._add_node(obj)
Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py (original)
+++ trunk/giscanner/transformer.py Mon Aug 18 18:01:21 2008
@@ -76,12 +76,12 @@
raise NotImplementedError(filename)
nsname = parser.get_namespace_name()
for node in parser.get_nodes():
- if hasattr(node, 'ctype'):
- self._ctype_names[node.ctype] = (nsname, node)
if 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)
else:
self._type_names[node.name] = (nsname, node)
@@ -157,6 +157,7 @@
enum_name = self.strip_namespace_object(symbol.ident)
enum_name = symbol.ident[-len(enum_name):]
+ enum_name = self._remove_prefix(enum_name)
enum = Enum(enum_name, symbol.ident, members)
self._type_names[symbol.ident] = (None, enum)
return enum
@@ -191,7 +192,7 @@
else:
print 'TRANSFORMER: Unhandled source type %r' % (
source_type, )
- value = '???'
+ value = 'any'
return value
def _create_parameters(self, base_type, options=None):
Modified: trunk/giscanner/utils.py
==============================================================================
--- trunk/giscanner/utils.py (original)
+++ trunk/giscanner/utils.py Mon Aug 18 18:01:21 2008
@@ -48,8 +48,8 @@
def strip_common_prefix(first, second):
- first_underscore = to_underscores(first)
- for i, c in enumerate(first_underscore.upper()):
+ second = second.replace('_', '')
+ for i, c in enumerate(first.upper()):
if c != second[i]:
break
return second[i:]
Modified: trunk/tests/scanner/Makefile.am
==============================================================================
--- trunk/tests/scanner/Makefile.am (original)
+++ trunk/tests/scanner/Makefile.am Mon Aug 18 18:01:21 2008
@@ -22,6 +22,7 @@
utility.gir: libutility.la utility.h $(SCANNER) $(SCANNER_LIBS)
$(CHECK_DEBUG) $(SCANNER) -v \
+ --include=$(top_srcdir)/gir/glib-2.0.gir \
--include=$(top_srcdir)/gir/gobject-2.0.gir \
--library=libutility.la \
--namespace=utility \
@@ -31,6 +32,7 @@
Foo.gir: libfoo.la foo-object.h $(SCANNER) $(SCANNER_LIBS)
$(CHECK_DEBUG) $(SCANNER) -v \
+ --include=$(top_srcdir)/gir/glib-2.0.gir \
--include=$(top_srcdir)/gir/gobject-2.0.gir \
--include=$(top_builddir)/tests/scanner/utility.gir \
--library=libfoo.la \
Modified: trunk/tests/scanner/foo-object.h
==============================================================================
--- trunk/tests/scanner/foo-object.h (original)
+++ trunk/tests/scanner/foo-object.h Mon Aug 18 18:01:21 2008
@@ -150,4 +150,9 @@
gint height;
};
+void
+foo_method_external_references (UtilityObject *object,
+ UtilityEnumType e,
+ UtilityFlagType f);
+
#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 18:01:21 2008
@@ -9,5 +9,15 @@
glib:type-name="UtilityObject"
glib:get-type="utility_object_get_type">
</class>
+ <enumeration name="Enum" c:type="UtilityEnum">
+ <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">
+ <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>
</namespace>
</repository>
Modified: trunk/tests/scanner/utility.h
==============================================================================
--- trunk/tests/scanner/utility.h (original)
+++ trunk/tests/scanner/utility.h Mon Aug 18 18:01:21 2008
@@ -22,4 +22,18 @@
GType utility_object_get_type (void) G_GNUC_CONST;
+typedef enum
+{
+ UTILITY_ENUM_A,
+ UTILITY_ENUM_B,
+ UTILITY_ENUM_C
+} UtilityEnumType;
+
+typedef enum
+{
+ UTILITY_FLAG_A,
+ UTILITY_FLAG_B,
+ UTILITY_FLAG_C
+} UtilityFlagType;
+
#endif /* __UTILITY_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]