summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-04-28 01:21:27 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-04-28 01:21:27 +0000
commitfd3faa5d62cdf5b4108d2cf103d03e0e88baa52f (patch)
tree6664ec8c50fab7b745258678df5f7cb40a16a44d
parent1fdc97d62fd2c523db8a8053f7b6e9af598cde45 (diff)
downloadgobject-introspection-fd3faa5d62cdf5b4108d2cf103d03e0e88baa52f.tar.gz
Switch over to GIR as the default format. Add a simple GIDL parser. Update
2008-04-27 Johan Dahlin <johan@gnome.org> * configure.ac: * giscanner/Makefile.am: * giscanner/girparser.py: * giscanner/glibtransformer.py: * tests/parser/Foo-expected.gidl: * tests/parser/Foo-expected.gir: * tests/parser/Makefile.am: * tests/parser/utility-expected.gidl: * tests/parser/utility-expected.gir: * tools/g-ir-scanner: Switch over to GIR as the default format. Add a simple GIDL parser. Update tests and fix simplify makefiles by depending on GNU make extensions. svn path=/trunk/; revision=237
-rw-r--r--ChangeLog17
-rw-r--r--configure.ac2
-rw-r--r--giscanner/Makefile.am1
-rw-r--r--giscanner/girparser.py57
-rw-r--r--giscanner/glibtransformer.py10
-rw-r--r--tests/parser/Foo-expected.gidl159
-rw-r--r--tests/parser/Foo-expected.gir247
-rw-r--r--tests/parser/Makefile.am44
-rw-r--r--tests/parser/utility-expected.gidl7
-rw-r--r--tests/parser/utility-expected.gir12
-rwxr-xr-xtools/g-ir-scanner2
11 files changed, 370 insertions, 188 deletions
diff --git a/ChangeLog b/ChangeLog
index c53ec133..ea2dcaa2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2008-04-27 Johan Dahlin <johan@gnome.org>
+ * configure.ac:
+ * giscanner/Makefile.am:
+ * giscanner/girparser.py:
+ * giscanner/glibtransformer.py:
+ * tests/parser/Foo-expected.gidl:
+ * tests/parser/Foo-expected.gir:
+ * tests/parser/Makefile.am:
+ * tests/parser/utility-expected.gidl:
+ * tests/parser/utility-expected.gir:
+ * tools/g-ir-scanner:
+ Switch over to GIR as the default format. Add a simple GIDL
+ parser.
+ Update tests and fix simplify makefiles by depending
+ on GNU make extensions.
+
+2008-04-27 Johan Dahlin <johan@gnome.org>
+
* giscanner/xmlwriter.py:
Wrap attributes for lines which are wider than 79 characters
diff --git a/configure.ac b/configure.ac
index 51d44f85..6dcdb516 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ(2.59)
AC_INIT(gobject-introspection, 0.1, http://bugzilla.gnome.org/enter_bug.cgi?product=glib)
-AM_INIT_AUTOMAKE([1.7])
+AM_INIT_AUTOMAKE([1.7 -Wno-portability])
AM_MAINTAINER_MODE
AC_CONFIG_HEADER([config.h])
diff --git a/giscanner/Makefile.am b/giscanner/Makefile.am
index 8dfa3a8b..4b08a07f 100644
--- a/giscanner/Makefile.am
+++ b/giscanner/Makefile.am
@@ -32,6 +32,7 @@ pkgpyexec_PYTHON = \
gidlast.py \
gidlparser.py \
gidlwriter.py \
+ girparser.py \
girwriter.py \
glibtransformer.py \
odict.py \
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
new file mode 100644
index 00000000..ef0c4a8c
--- /dev/null
+++ b/giscanner/girparser.py
@@ -0,0 +1,57 @@
+# -*- Mode: Python -*-
+# GObject-Introspection - a framework for introspecting GObject libraries
+# Copyright (C) 2008 Johan Dahlin
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+from xml.etree.ElementTree import parse
+
+from .glibast import GLibObject
+
+CORE = "{http://www.gtk.org/introspection/core/1.0}"
+GLIB = "{http://www.gtk.org/introspection/glib/1.0}"
+
+
+class GIRParser(object):
+ def __init__(self, filename):
+ self._nodes = []
+ self._namespace_name = None
+
+ tree = parse(filename)
+ self._parse_api(tree.getroot())
+
+ def _parse_api(self, root):
+ assert root.tag == '%srepository' % (CORE,), root
+ ns = root.find('%snamespace' % (CORE,))
+ self._namespace_name = ns.attrib['name']
+ for child in ns.getchildren():
+ if child.tag == '%sclass' % (CORE,):
+ self._parse_object(child)
+ else:
+ print 'PARSER: Unhandled %s' % (child.tag,)
+
+ def _parse_object(self, node):
+ gobj = GLibObject(node.attrib['name'],
+ node.attrib.get('parent'),
+ node.attrib['%stype-name' % (GLIB,)],
+ node.attrib['%sget-type' % (GLIB,)])
+ self._nodes.append(gobj)
+
+ def get_namespace_name(self):
+ return self._namespace_name
+
+ def get_nodes(self):
+ return self._nodes
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index 3812939a..47ebe2dc 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -82,8 +82,14 @@ class GLibTransformer(object):
self._pair_class_struct(node)
def register_include(self, filename):
- from .gidlparser import GIDLParser
- parser = GIDLParser(filename)
+ if filename.endswith('.gir'):
+ from .girparser import GIRParser
+ parser = GIRParser(filename)
+ elif filename.endswith('.gidl'):
+ from .gidlparser import GIDLParser
+ parser = GIDLParser(filename)
+ else:
+ raise NotImplementedError(filename)
nsname = parser.get_namespace_name()
for node in parser.get_nodes():
self._type_names[node.type_name] = (nsname, node)
diff --git a/tests/parser/Foo-expected.gidl b/tests/parser/Foo-expected.gidl
deleted file mode 100644
index 8e9547d3..00000000
--- a/tests/parser/Foo-expected.gidl
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0"?>
-<api version="1.0">
- <namespace name="Foo">
- <function name="enum_type_method" symbol="foo_enum_type_method">
- <return-type type="int"/>
- <parameters>
- <parameter name="foo_enum" type="FooEnumType"/>
- </parameters>
- </function>
- <function name="init" symbol="foo_init">
- <return-type type="gint"/>
- </function>
- <callback name="FooCallback">
- <return-type type="gboolean"/>
- <parameters>
- <parameter name="foo" type="FooObject*"/>
- <parameter name="b" type="gboolean"/>
- <parameter name="data" type="gpointer"/>
- </parameters>
- </callback>
- <boxed name="FooBoxed" type-name="FooBoxed" get-type="foo_boxed_get_type">
- <method name="method" symbol="foo_boxed_method">
- <return-type type="void"/>
- <parameters>
- <parameter name="boxed" type="FooBoxed*"/>
- </parameters>
- </method>
- <constructor name="new" symbol="foo_boxed_new">
- <return-type type="FooBoxed*"/>
- </constructor>
- </boxed>
- <enum name="FooEnumNoType">
- <member name="FOO_ENUM_UN" value="1"/>
- <member name="FOO_ENUM_DEUX" value="2"/>
- <member name="FOO_ENUM_TROIS" value="3"/>
- </enum>
- <enum name="FooEnumType" type-name="FooEnumType" get-type="foo_enum_type_get_type">
- <member name="FOO_ENUM_ALPHA" value="0"/>
- <member name="FOO_ENUM_BETA" value="1"/>
- <member name="FOO_ENUM_DELTA" value="2"/>
- </enum>
- <flags name="FooFlagsType" type-name="FooFlagsType" get-type="foo_flags_type_get_type">
- <member name="FOO_FLAGS_FIRST" value="1"/>
- <member name="FOO_FLAGS_SECOND" value="2"/>
- <member name="FOO_FLAGS_THIRD" value="4"/>
- </flags>
- <object name="FooObject" parent="GLib.Object" type-name="FooObject" get-type="foo_object_get_type">
- <method name="calleeowns" symbol="foo_object_calleeowns">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="toown" type="GObject*" transfer="full"/>
- </parameters>
- </method>
- <method name="calleesowns" symbol="foo_object_calleesowns">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="toown1" type="GObject*" transfer="full"/>
- <parameter name="toown2" type="GObject*" transfer="full"/>
- </parameters>
- </method>
- <method name="create_object" symbol="foo_object_create_object">
- <return-type type="GObject*" transfer="full"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- </parameters>
- </method>
- <method name="external_type" symbol="foo_object_external_type">
- <return-type type="UtilityObject*"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- </parameters>
- </method>
- <method name="get_objects" symbol="foo_object_get_objects">
- <return-type type="GSList*"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- </parameters>
- </method>
- <method name="get_strings" symbol="foo_object_get_strings">
- <return-type type="GList*"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- </parameters>
- </method>
- <method name="in" symbol="foo_object_in">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="inarg" type="int*"/>
- </parameters>
- </method>
- <method name="inout" symbol="foo_object_inout">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="inoutarg" type="int*" direction="in-out"/>
- </parameters>
- </method>
- <method name="inout2" symbol="foo_object_inout2">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="inoutarg" type="int*"/>
- </parameters>
- </method>
- <method name="inout3" symbol="foo_object_inout3">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="inoutarg" type="int*" direction="in-out"/>
- </parameters>
- </method>
- <method name="method" symbol="foo_object_method">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- </parameters>
- </method>
- <constructor name="new" symbol="foo_object_new">
- <return-type type="FooObject*"/>
- </constructor>
- <method name="out" symbol="foo_object_out">
- <return-type type="gint"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="outarg" type="int*" direction="out"/>
- </parameters>
- </method>
- <property name="string" type="char*" readable="1" writable="1" construct="1" construct-only="0"/>
- <signal name="signal" when="LAST">
- <return-type type="char*"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="p0" type="GObject*"/>
- <parameter name="p1" type="gpointer"/>
- </parameters>
- </signal>
- <vfunc name="virtual_method">
- <return-type type="gboolean"/>
- <parameters>
- <parameter name="object" type="FooObject*"/>
- <parameter name="first_param" type="int"/>
- </parameters>
- </vfunc>
- </object>
- <object name="FooSubobject" parent="FooObject" type-name="FooSubobject" get-type="foo_subobject_get_type">
- <constructor name="new" symbol="foo_subobject_new">
- <return-type type="FooSubobject*"/>
- </constructor>
- </object>
- <interface name="FooInterface" type-name="FooInterface" get-type="foo_interface_get_type">
- <requires>
- <interface name="GObject"/>
- </requires>
- </interface>
- </namespace>
-</api>
diff --git a/tests/parser/Foo-expected.gir b/tests/parser/Foo-expected.gir
new file mode 100644
index 00000000..6dee16a7
--- /dev/null
+++ b/tests/parser/Foo-expected.gir
@@ -0,0 +1,247 @@
+<repository version="1.0"
+ xmlns="http://www.gtk.org/introspection/core/1.0"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0"
+ xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+ <namespace name="Foo">
+ <interface name="Interface"
+ glib:type-name="FooInterface"
+ glib:get-type="foo_interface_get_type">
+ </interface>
+ <function name="init" c:identifier="foo_init">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ </function>
+ <class name="Object"
+ parent="GLib.Object"
+ glib:type-name="FooObject"
+ glib:get-type="foo_object_get_type">
+ <constructor name="new" c:identifier="foo_object_new">
+ <return-value c:identifer="Object*">
+ <type name="Object*"/>
+ </return-value>
+ </constructor>
+ <method name="method" c:identifier="foo_object_method">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="external_type" c:identifier="foo_object_external_type">
+ <return-value c:identifer="utility.Object*">
+ <type name="utility.Object*"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="out" c:identifier="foo_object_out">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="outarg" direction="out">
+ <type name="int*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="create_object" c:identifier="foo_object_create_object">
+ <return-value c:identifer="GLib.Object*">
+ <type name="GLib.Object*"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="inout" c:identifier="foo_object_inout">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="inoutarg" direction="inout">
+ <type name="int*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="inout2" c:identifier="foo_object_inout2">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="inoutarg">
+ <type name="int*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="inout3" c:identifier="foo_object_inout3">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="inoutarg" direction="inout">
+ <type name="int*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="in" c:identifier="foo_object_in">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="inarg">
+ <type name="int*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="calleeowns" c:identifier="foo_object_calleeowns">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="toown" transfer="full">
+ <type name="GLib.Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="calleesowns" c:identifier="foo_object_calleesowns">
+ <return-value c:identifer="gint">
+ <type name="gint"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ <parameter name="toown1" transfer="full">
+ <type name="GLib.Object*"/>
+ </parameter>
+ <parameter name="toown2" transfer="full">
+ <type name="GLib.Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="get_strings" c:identifier="foo_object_get_strings">
+ <return-value c:identifer="GList*">
+ <sequence c:owner="caller">
+ <element-type c:identifier="char*"/>
+ </sequence>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <method name="get_objects" c:identifier="foo_object_get_objects">
+ <return-value c:identifer="GSList*">
+ <sequence c:owner="caller">
+ <element-type c:identifier="FooObject*"/>
+ </sequence>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object*"/>
+ </parameter>
+ </parameters>
+ </method>
+ <property name="string" prop="gchararray"/>
+ </class>
+ <class name="Subobject"
+ parent="Object"
+ glib:type-name="FooSubobject"
+ glib:get-type="foo_subobject_get_type">
+ <constructor name="new" c:identifier="foo_subobject_new">
+ <return-value c:identifer="Subobject*">
+ <type name="Subobject*"/>
+ </return-value>
+ </constructor>
+ </class>
+ <enumeration name="EnumType"
+ glib:type-name="FooEnumType"
+ glib:get-type="foo_enum_type_get_type">
+ <member name="FOO_ENUM_ALPHA" value="0" glib:nick="alpha"/>
+ <member name="FOO_ENUM_BETA" value="1" glib:nick="beta"/>
+ <member name="FOO_ENUM_DELTA" value="2" glib:nick="delta"/>
+ </enumeration>
+ <function name="enum_type_method" c:identifier="foo_enum_type_method">
+ <return-value c:identifer="int">
+ <type name="int"/>
+ </return-value>
+ <parameters>
+ <parameter name="foo_enum">
+ <type name="EnumType"/>
+ </parameter>
+ </parameters>
+ </function>
+ <bitfield name="FlagsType"
+ glib:type-name="FooFlagsType"
+ glib:get-type="foo_flags_type_get_type">
+ <member name="FOO_FLAGS_FIRST" value="1" glib:nick="first"/>
+ <member name="FOO_FLAGS_SECOND" value="2" glib:nick="second"/>
+ <member name="FOO_FLAGS_THIRD" value="4" glib:nick="third"/>
+ </bitfield>
+ <enumeration name="EnumNoType">
+ <member name="FOO_ENUM_UN" value="1"/>
+ <member name="FOO_ENUM_DEUX" value="2"/>
+ <member name="FOO_ENUM_TROIS" value="3"/>
+ </enumeration>
+ <glib:boxed glib:name="Boxed" glib:type-name="FooBoxed" glib:get-type="foo_boxed_get_type">
+ <constructor name="new" c:identifier="foo_boxed_new">
+ <return-value c:identifer="Boxed*">
+ <type name="Boxed*"/>
+ </return-value>
+ </constructor>
+ <method name="method" c:identifier="foo_boxed_method">
+ <return-value c:identifer="void">
+ <type name="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="boxed">
+ <type name="Boxed*"/>
+ </parameter>
+ </parameters>
+ </method>
+ </glib:boxed>
+ <callback name="FooCallback">
+ <return-value c:identifer="gboolean">
+ <type name="gboolean"/>
+ </return-value>
+ <parameters>
+ <parameter name="foo">
+ <type name="FooObject*"/>
+ </parameter>
+ <parameter name="b">
+ <type name="gboolean"/>
+ </parameter>
+ <parameter name="data">
+ <type name="gpointer"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </namespace>
+</repository>
diff --git a/tests/parser/Makefile.am b/tests/parser/Makefile.am
index 0b83b562..69a2bf79 100644
--- a/tests/parser/Makefile.am
+++ b/tests/parser/Makefile.am
@@ -12,29 +12,37 @@ libutility_la_CFLAGS = $(GOBJECT_CFLAGS)
libutility_la_LDFLAGS = -module -avoid-version
libutility_la_LIBADD = $(GOBJECT_LIBS)
-CLEANFILES = utility.gidl Foo.gidl
-EXTRA_DIST = utility-expected.gidl Foo-expected.gidl
+CLEANFILES = utility.gir Foo.gir
+EXTRA_DIST = utility-expected.gir Foo-expected.gir
-utility.gidl: libutility.la utility.h $(top_builddir)/tools/g-idl-scanner
- G_DEBUG=fatal_warnings $(top_builddir)/tools/g-idl-scanner -v \
+SCANNER = $(top_builddir)/tools/g-ir-scanner
+utility.gir: libutility.la utility.h $(SCANNER)
+ @PYTHONPATH=$(top_srcdir) $(SCANNER) -v \
+ --include=$(top_srcdir)/gidl/gobject-2.0.gidl \
+ --library=libutility.la \
--namespace=utility \
- --include-idl=$(top_srcdir)/gidl/gobject-2.0.gidl \
- $(libutility_la_SOURCES) -I$(srcdir) $(GOBJECT_CFLAGS) \
- libutility.la --output $@
+ --pkg gobject-2.0 \
+ $(libutility_la_SOURCES) --output $@
-Foo.gidl: libfoo.la foo-object.h $(top_builddir)/tools/g-idl-scanner
- G_DEBUG=fatal_warnings $(top_builddir)/tools/g-idl-scanner -v \
+Foo.gir: libfoo.la foo-object.h $(SCANNER)
+ @PYTHONPATH=$(top_srcdir) $(SCANNER) -v \
+ --include=$(top_srcdir)/gidl/gobject-2.0.gidl \
+ --include=$(srcdir)/utility.gir \
--namespace=Foo \
- --include-idl=$(top_srcdir)/gidl/gobject-2.0.gidl \
- --include-idl=$(srcdir)/utility.gidl \
- $(libfoo_la_SOURCES) -I$(srcdir) $(GOBJECT_CFLAGS) \
- libfoo.la --output $@
-
-check-local: utility.gidl Foo.gidl
- @diff -u -U 10 $(srcdir)/utility-expected.gidl utility.gidl && echo "utility.gidl"
- @diff -u -U 10 $(srcdir)/Foo-expected.gidl Foo.gidl && echo "Foo.gidl"
+ --library=libfoo.la \
+ --pkg gobject-2.0 \
+ $(libfoo_la_SOURCES) \
+ --output $@
+
+check-%.gir: %.gir
+ @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "* $*.gir"
+
+pre-check:
+ @echo "Running parser checks..."
+
+check-local: pre-check check-utility.gir check-Foo.gir
@echo "======================="
@echo "All parser tests passed"
@echo "======================="
-.PHONY: Foo.gidl
+.PHONY: utility.gir Foo.gir
diff --git a/tests/parser/utility-expected.gidl b/tests/parser/utility-expected.gidl
deleted file mode 100644
index c7a85200..00000000
--- a/tests/parser/utility-expected.gidl
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<api version="1.0">
- <namespace name="utility">
- <object name="UtilityObject" parent="GLib.Object" type-name="UtilityObject" get-type="utility_object_get_type">
- </object>
- </namespace>
-</api>
diff --git a/tests/parser/utility-expected.gir b/tests/parser/utility-expected.gir
new file mode 100644
index 00000000..6240c9e1
--- /dev/null
+++ b/tests/parser/utility-expected.gir
@@ -0,0 +1,12 @@
+<repository version="1.0"
+ xmlns="http://www.gtk.org/introspection/core/1.0"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0"
+ xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+ <namespace name="utility">
+ <class name="Object"
+ parent="GLib.Object"
+ glib:type-name="UtilityObject"
+ glib:get-type="utility_object_get_type">
+ </class>
+ </namespace>
+</repository>
diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner
index 3b1ca02c..f9f2680a 100755
--- a/tools/g-ir-scanner
+++ b/tools/g-ir-scanner
@@ -33,7 +33,7 @@ def main(args):
parser = optparse.OptionParser('%prog [options] sources')
parser.add_option("", "--format",
action="store", dest="format",
- default="gidl",
+ default="gir",
help="format to use, one of gidl, gir")
parser.add_option("-i", "--include",
action="append", dest="includes", default=[],