gobject-introspection r376 - in trunk: . girepository tests tools
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r376 - in trunk: . girepository tests tools
- Date: Thu, 14 Aug 2008 19:07:34 +0000 (UTC)
Author: johan
Date: Thu Aug 14 19:07:34 2008
New Revision: 376
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=376&view=rev
Log:
2008-08-14 Johan Dahlin <johan gnome org>
* girepository/girparser.c (start_type):
Don't require c:type.
* tests/Makefile.am:
Test boxed.gir
* tests/boxed.gir:
Update, remove parts we don't support yet
* tests/roundtrips.sh:
Remove
* tools/generate.c (write_type_info), (write_field_info),
(write_callable_info), (write_struct_info):
Make it emit proper gir.
Removed:
trunk/tests/roundtrips.sh
Modified:
trunk/ChangeLog
trunk/girepository/girparser.c
trunk/tests/Makefile.am
trunk/tests/boxed.gir
trunk/tools/generate.c
Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c (original)
+++ trunk/girepository/girparser.c Thu Aug 14 19:07:34 2008
@@ -1342,7 +1342,6 @@
GError **error)
{
const gchar *name;
- const gchar *ctype;
if (strcmp (element_name, "type") != 0 ||
!(ctx->state == STATE_FUNCTION_PARAMETER ||
@@ -1366,12 +1365,9 @@
}
name = find_attribute ("name", attribute_names, attribute_values);
- ctype = find_attribute ("c:type", attribute_names, attribute_values);
if (name == NULL)
MISSING_ATTRIBUTE (context, error, element_name, "name");
- if (ctype == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "c:type");
switch (ctx->current_typed->type)
{
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Thu Aug 14 19:07:34 2008
@@ -1,7 +1,6 @@
SUBDIRS = . invoke scanner
EXTRA_DIST = \
- roundtrips.sh \
array.gir \
boxed.gir \
constant.gir \
@@ -17,9 +16,16 @@
xref1.gir \
xref2.gir
-TESTS = #roundtrips.sh
+GIRTESTS = \
+ boxed.gir.test
-check-local:
+%.gir.test: %.gir
+ @echo Testing $<:
+ $(top_builddir)/tools/g-ir-compiler --raw $< > $<.1; \
+ $(top_builddir)/tools/g-ir-generate --raw $<.1 > $<.2; \
+ diff -u $< $<.2; rm $<.1 $<.2
+
+check-local: $(GIRTESTS)
@echo Running PEP8 on Python sources
@find $(top_srcdir)/giscanner -name \*.py | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pep8.py --repeat
@echo Running Pyflakes on Python sources
Modified: trunk/tests/boxed.gir
==============================================================================
--- trunk/tests/boxed.gir (original)
+++ trunk/tests/boxed.gir Thu Aug 14 19:07:34 2008
@@ -6,71 +6,57 @@
<namespace name="Foo">
<glib:boxed glib:name="BoxedType1" glib:type-name="boxed1" glib:get-type="boxed1_get_type" deprecated="1">
<field name="field1" readable="1" writable="1" offset="0">
- <type name="guint32" c:type="guint32"/>
+ <type name="uint32"/>
</field>
<field name="field2" readable="1" writable="1" offset="4">
- <type name="guint32" c:type="guint32"/>
+ <type name="uint32"/>
</field>
<field name="field3" readable="1" writable="1" offset="8">
- <type name="guint32" c:type="guint32"/>
+ <type name="uint32"/>
</field>
<method name="frob_boxed1" c:identifier="frob_boxed1">
<return-value>
- <!-- FIXME: name=void should be none -->
- <type name="void" c:type="void" />
+ <type name="none"/>
</return-value>
<parameters>
- <parameter name="box" transfer="full" direction="in">
- <type name="BoxedType1" c:type="boxed1*"/>
+ <parameter name="box" direction="in">
+ <type name="BoxedType1"/>
</parameter>
- <parameter name="w" transfer="full" direction="in">
- <!-- FIXME: put this in a sub node -->
- <!--
- <type name="sequence" c:type="GList*">
- <type name="boxed2" c:type="boxed2*"/>
- </type>
- -->
- <type name="GList<boxed2*>*" c:type="GList*"/>
+ <parameter name="w" direction="in">
+ <type name="GList<boxed2*>*"/>
</parameter>
<parameter name="t" transfer="full" direction="in">
- <!-- FIXME: put this in a sub node -->
- <!--
- <type name="mapping" c:type="GHashTable*">
- <type name="utf8" c:type="gchar*"/>
- <type name="int64" c:type="gint64"/>
- </type>
- -->
- <type name="GHashTable<utf8,gint64>*" c:type="GHashTable*"/>
+ <type name="GHashTable<utf8,int64>*"/>
</parameter>
<parameter name="e" transfer="full" direction="out">
- <type name="GError" c:type="GError**"/>
+ <type name="GError*"/>
</parameter>
</parameters>
</method>
<method name="lart" c:identifier="lart">
<return-value>
- <type name="boolean" c:type="gboolean"/>
+ <type name="boolean"/>
</return-value>
<parameters>
- <parameter name="box" transfer="full" direction="in">
- <type name="boxed2*" c:type="boxed2*"/>
+ <parameter name="box" direction="in">
+ <type name="boxed2*"/>
</parameter>
<parameter name="val" transfer="full" direction="inout">
- <type name="uint" c:type="guint*"/>
+ <type name="uint"/>
</parameter>
</parameters>
</method>
</glib:boxed>
<function name="freefunc" c:identifier="freefunc" deprecated="1">
- <return-value>
- <type name="boolean" c:type="gboolean"/>
+ <return-value>
+ <type name="boolean"/>
</return-value>
<parameters>
<parameter name="v1" direction="in">
- <type name="int" c:type="gint"/>
+ <type name="int"/>
</parameter>
<parameter name="val2" direction="in">
- <type name="int" c:type="gint"/>
+ <type name="int"/>
</parameter>
</parameters>
</function>
Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c (original)
+++ trunk/tools/generate.c Thu Aug 14 19:07:34 2008
@@ -54,24 +54,24 @@
GITypeInfo *type;
const gchar* basic[] = {
- "void",
- "gboolean",
- "gint8",
- "guint8",
- "gint16",
- "guint16",
- "gint32",
- "guint32",
- "gint64",
- "guint64",
- "gint",
- "guint",
- "glong",
- "gulong",
- "gssize",
- "gsize",
- "gfloat",
- "gdouble",
+ "none",
+ "boolean",
+ "int8",
+ "uint8",
+ "int16",
+ "uint16",
+ "int32",
+ "uint32",
+ "int64",
+ "uint64",
+ "int",
+ "uint",
+ "long",
+ "ulong",
+ "ssize",
+ "size",
+ "float",
+ "double",
"utf8",
"filename"
};
@@ -200,21 +200,16 @@
offset = g_field_info_get_offset (info);
g_fprintf (file,
- " <field name=\"%s\" readable=\"%s\" writable=\"%s\" ",
+ " <field name=\"%s\" readable=\"%s\" writable=\"%s\"",
name,
flags & GI_FIELD_IS_READABLE ? "1" : "0",
flags & GI_FIELD_IS_WRITABLE ? "1" : "0");
if (size)
- g_fprintf (file, "bits=\"%d\" ", size);
- g_fprintf (file, "offset=\"%d\" ", offset);
+ g_fprintf (file, " bits=\"%d\"", size);
- g_fprintf (file, "type=\"");
+ g_fprintf (file, " offset=\"%d\"", offset);
type = g_field_info_get_type (info);
- write_type_info (namespace, type, file);
- g_base_info_unref ((GIBaseInfo *)type);
-
- g_fprintf (file, "\"");
if (branch)
{
@@ -225,7 +220,17 @@
g_fprintf (file, "\"");
}
- g_fprintf (file," />\n");
+ g_fprintf (file,">\n");
+
+ g_fprintf (file, " <type name=\"");
+
+ write_type_info (namespace, type, file);
+ g_base_info_unref ((GIBaseInfo *)type);
+
+ g_fprintf (file, "\"/>\n");
+
+ g_fprintf (file, " </field>\n");
+
}
static void
@@ -237,12 +242,9 @@
GITypeInfo *type;
gint i;
- g_fprintf (file, "%*s <return-type c:type=\"", indent, "");
+ g_fprintf (file, "%*s <return-value>\n", indent, "");
type = g_callable_info_get_return_type (info);
- write_type_info (namespace, type, file);
-
- g_fprintf (file, "\"");
if (g_type_info_is_pointer (type))
{
@@ -265,75 +267,86 @@
if (g_callable_info_may_return_null (info))
g_fprintf (file, " null-ok=\"1\"");
- g_fprintf (file, " />\n");
+ g_fprintf (file, "%*s <type name=\"", indent + 2, "");
+
+ write_type_info (namespace, type, file);
+
+ g_fprintf (file, "\"/>\n");
+
+ g_fprintf (file, "%*s </return-value>\n", indent, "");
- if (g_callable_info_get_n_args (info) > 0)
+ if (g_callable_info_get_n_args (info) <= 0)
+ return;
+
+ g_fprintf (file, "%*s <parameters>\n", indent, "");
+ for (i = 0; i < g_callable_info_get_n_args (info); i++)
{
- g_fprintf (file, "%*s <parameters>\n", indent, "");
- for (i = 0; i < g_callable_info_get_n_args (info); i++)
+ GIArgInfo *arg = g_callable_info_get_arg (info, i);
+
+ g_fprintf (file, "%*s <parameter name=\"%s\"",
+ indent, "", g_base_info_get_name ((GIBaseInfo *) arg));
+
+ if (g_type_info_is_pointer (type))
{
- GIArgInfo *arg = g_callable_info_get_arg (info, i);
-
- g_fprintf (file, "%*s <parameter name=\"%s\" c:type=\"",
- indent, "", g_base_info_get_name ((GIBaseInfo *) arg));
-
- type = g_arg_info_get_type (arg);
- write_type_info (namespace, type, file);
- g_fprintf (file, "\"");
-
- if (g_type_info_is_pointer (type))
- {
- switch (g_arg_info_get_ownership_transfer (arg))
- {
- case GI_TRANSFER_NOTHING:
- g_fprintf (file, " transfer=\"none\"");
- break;
- case GI_TRANSFER_CONTAINER:
- g_fprintf (file, " transfer=\"shallow\"");
- break;
- case GI_TRANSFER_EVERYTHING:
- g_fprintf (file, " transfer=\"full\"");
- break;
- default:
- g_assert_not_reached ();
- }
- }
- g_base_info_unref ((GIBaseInfo *)type);
-
- g_fprintf (file, " direction=\"");
- switch (g_arg_info_get_direction (arg))
+ switch (g_arg_info_get_ownership_transfer (arg))
{
- case GI_DIRECTION_IN:
- g_fprintf (file, "in");
+ case GI_TRANSFER_NOTHING:
+ g_fprintf (file, " transfer=\"none\"");
break;
- case GI_DIRECTION_OUT:
- g_fprintf (file, "out");
+ case GI_TRANSFER_CONTAINER:
+ g_fprintf (file, " transfer=\"shallow\"");
break;
- case GI_DIRECTION_INOUT:
- g_fprintf (file, "inout");
+ case GI_TRANSFER_EVERYTHING:
+ g_fprintf (file, " transfer=\"full\"");
break;
+ default:
+ g_assert_not_reached ();
}
- g_fprintf (file, "\"");
-
- if (g_arg_info_may_be_null (arg))
- g_fprintf (file, " null-ok=\"1\"");
-
- if (g_arg_info_is_dipper (arg))
- g_fprintf (file, " dipper=\"1\"");
-
- if (g_arg_info_is_return_value (arg))
- g_fprintf (file, " retval=\"1\"");
-
- if (g_arg_info_is_optional (arg))
- g_fprintf (file, " optional=\"1\"");
-
- g_fprintf (file, " />\n");
-
- g_base_info_unref ((GIBaseInfo *)arg);
+ }
+ g_base_info_unref ((GIBaseInfo *)type);
+
+ g_fprintf (file, " direction=\"");
+ switch (g_arg_info_get_direction (arg))
+ {
+ case GI_DIRECTION_IN:
+ g_fprintf (file, "in");
+ break;
+ case GI_DIRECTION_OUT:
+ g_fprintf (file, "out");
+ break;
+ case GI_DIRECTION_INOUT:
+ g_fprintf (file, "inout");
+ break;
}
-
- g_fprintf (file, "%*s </parameters>\n", indent, "");
+ g_fprintf (file, "\"");
+
+ if (g_arg_info_may_be_null (arg))
+ g_fprintf (file, " null-ok=\"1\"");
+
+ if (g_arg_info_is_dipper (arg))
+ g_fprintf (file, " dipper=\"1\"");
+
+ if (g_arg_info_is_return_value (arg))
+ g_fprintf (file, " retval=\"1\"");
+
+ if (g_arg_info_is_optional (arg))
+ g_fprintf (file, " optional=\"1\"");
+
+ g_fprintf (file, ">\n");
+
+ g_fprintf (file, "%*s <type name=\"", indent+2, "");
+
+ type = g_arg_info_get_type (arg);
+ write_type_info (namespace, type, file);
+
+ g_fprintf (file, "\"/>\n");
+
+ g_fprintf (file, "%*s </parameter>\n", indent, "");
+
+ g_base_info_unref ((GIBaseInfo *)arg);
}
+
+ g_fprintf (file, "%*s </parameters>\n", indent, "");
}
static void
@@ -417,7 +430,7 @@
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
- g_fprintf (file, " <boxed name=\"%s\" type-name=\"%s\" get-type=\"%s\"", name, type_name, type_init);
+ g_fprintf (file, " <glib:boxed glib:name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"", name, type_name, type_init);
}
else
g_fprintf (file, " <struct name=\"%s\"", name);
@@ -442,7 +455,7 @@
}
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
- g_fprintf (file, " </boxed>\n");
+ g_fprintf (file, " </glib:boxed>\n");
else
g_fprintf (file, " </struct>\n");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]