gobject-introspection r321 - in branches/gir-compiler: tests tools
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r321 - in branches/gir-compiler: tests tools
- Date: Thu, 7 Aug 2008 21:46:00 +0000 (UTC)
Author: johan
Date: Thu Aug 7 21:46:00 2008
New Revision: 321
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=321&view=rev
Log:
Convert object.test. Rename object->class. Add constant parsing
Modified:
branches/gir-compiler/tests/object.test
branches/gir-compiler/tools/girparser.c
Modified: branches/gir-compiler/tests/object.test
==============================================================================
--- branches/gir-compiler/tests/object.test (original)
+++ branches/gir-compiler/tests/object.test Thu Aug 7 21:46:00 2008
@@ -4,40 +4,58 @@
xmlns:c="http://www.gtk.org/introspection/c/1.0"
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
<namespace name="Foo">
- <object name="Object1" parent="Object2" type-name="Object1" get-type="object1_get_type">
+ <class name="Object1" parent="Object2" glib:type-name="Object1" glib:get-type="object1_get_type">
<implements>
<interface name="Iface1" />
</implements>
- <property name="prop1" readable="0" writable="0" type="gint" />
- <signal name="signal1" when="LAST">
- <return-type type="gboolean" />
+ <property name="prop1" readable="0" writable="0">
+ <type name="int" c:type="gint"/>
+ </property>
+ <glib:signal name="signal1" when="LAST">
+ <return-value>
+ <type name="boolean" c:type="gboolean"/>
+ </return-value>
<parameters>
- <parameter name="obj" type="Object1*" transfer="full" direction="in" />
+ <parameter name="obj" transfer="full" direction="in">
+ <type name="Object1" c:type="Object1*"/>
+ </parameter>
</parameters>
- </signal>
- <signal name="signal2" when="FIRST" no-recurse="1" detailed="1" action="1" no-hooks="1">
- <return-type type="void" />
+ </glib:signal>
+ <glib:signal name="signal2" when="FIRST" no-recurse="1" detailed="1" action="1" no-hooks="1">
+ <return-value>
+ <type name="void" c:type="void"/>
+ </return-value>
<parameters>
- <parameter name="obj" type="Object1*" transfer="full" direction="in" />
+ <parameter name="obj" transfer="full" direction="in">
+ <type name="Object1" c:type="Object1*"/>
+ </parameter>
</parameters>
- </signal>
+ </glib:signal>
<vfunc name="vfunc1" offset="20">
- <return-type type="Object2*" transfer="full" />
+ <return-value>
+ <type name="Object2" c:type="Object2*"/>
+ </return-value>
<parameters>
- <parameter name="param1" type="Object1*" transfer="full" direction="in" />
+ <parameter name="param1" transfer="full" direction="in">
+ <type name="Object1" c:type="Object1*"/>
+ </parameter>
</parameters>
</vfunc>
<vfunc name="vfunc2" offset="24">
- <return-type type="Object2*" transfer="full" />
+ <return-value>
+ <type name="Object2" c:type="Object2*"/>
+ </return-value>
<parameters>
- <parameter name="param1" type="Object1*" transfer="full" direction="in" />
+ <parameter name="param1" transfer="full" direction="in">
+ <type name="Object1" c:type="Object1*"/>
+ </parameter>
</parameters>
</vfunc>
- <constant name="constant1" type="gint" value="42" />
- </object>
- <interface name="Iface1" type-name="Iface1" get-type="iface1_get_type">
+ </class>
+ <constant name="constant1" c:type="gint" value="42" />
+ <interface name="Iface1" glib:type-name="Iface1" glib:get-type="iface1_get_type">
</interface>
- <object name="Object2" parent="GObject.GObject" type-name="Object2" get-type="object2_get_type">
- </object>
+ <class name="Object2" parent="GObject.GObject" glib:type-name="Object2" glib:get-type="object2_get_type">
+ </class>
</namespace>
</repository>
Modified: branches/gir-compiler/tools/girparser.c
==============================================================================
--- branches/gir-compiler/tools/girparser.c (original)
+++ branches/gir-compiler/tools/girparser.c Thu Aug 7 21:46:00 2008
@@ -39,9 +39,9 @@
STATE_FUNCTION_RETURN,
STATE_FUNCTION_PARAMETERS,
STATE_FUNCTION_PARAMETER,
- STATE_OBJECT, /* 10 */
- STATE_OBJECT_FIELD,
- STATE_OBJECT_PROPERTY,
+ STATE_CLASS, /* 10 */
+ STATE_CLASS_FIELD,
+ STATE_CLASS_PROPERTY,
STATE_INTERFACE,
STATE_INTERFACE_PROPERTY,
STATE_INTERFACE_FIELD, /* 15 */
@@ -53,6 +53,7 @@
STATE_STRUCT_FIELD,
STATE_ERRORDOMAIN,
STATE_UNION,
+ STATE_CONSTANT
} ParseState;
typedef struct _ParseContext ParseContext;
@@ -471,13 +472,13 @@
if ((ctx->state == STATE_NAMESPACE &&
(strcmp (element_name, "function") == 0 ||
strcmp (element_name, "callback") == 0)) ||
- ((ctx->state == STATE_OBJECT ||
+ ((ctx->state == STATE_CLASS ||
ctx->state == STATE_INTERFACE ||
ctx->state == STATE_BOXED ||
ctx->state == STATE_UNION) &&
(strcmp (element_name, "method") == 0 ||
strcmp (element_name, "callback") == 0)) ||
- ((ctx->state == STATE_OBJECT ||
+ ((ctx->state == STATE_CLASS ||
ctx->state == STATE_BOXED) &&
(strcmp (element_name, "constructor") == 0)) ||
(ctx->state == STATE_STRUCT && strcmp (element_name, "callback") == 0))
@@ -724,7 +725,7 @@
GError **error)
{
if (strcmp (element_name, "field") == 0 &&
- (ctx->state == STATE_OBJECT ||
+ (ctx->state == STATE_CLASS ||
ctx->state == STATE_BOXED ||
ctx->state == STATE_STRUCT ||
ctx->state == STATE_UNION ||
@@ -783,7 +784,7 @@
iface = (GIrNodeInterface *)ctx->current_node;
iface->members = g_list_append (iface->members, field);
- state_switch (ctx, STATE_OBJECT_FIELD);
+ state_switch (ctx, STATE_CLASS_FIELD);
}
break;
case G_IR_NODE_INTERFACE:
@@ -903,7 +904,7 @@
GError **error)
{
if (strcmp (element_name, "property") == 0 &&
- (ctx->state == STATE_OBJECT ||
+ (ctx->state == STATE_CLASS ||
ctx->state == STATE_INTERFACE))
{
const gchar *name;
@@ -950,8 +951,8 @@
iface = (GIrNodeInterface *)ctx->current_node;
iface->members = g_list_append (iface->members, property);
- if (ctx->state == STATE_OBJECT)
- state_switch (ctx, STATE_OBJECT_PROPERTY);
+ if (ctx->state == STATE_CLASS)
+ state_switch (ctx, STATE_CLASS_PROPERTY);
else if (ctx->state == STATE_INTERFACE)
state_switch (ctx, STATE_INTERFACE_PROPERTY);
else
@@ -1042,7 +1043,7 @@
{
if (strcmp (element_name, "constant") == 0 &&
(ctx->state == STATE_NAMESPACE ||
- ctx->state == STATE_OBJECT ||
+ ctx->state == STATE_CLASS ||
ctx->state == STATE_INTERFACE))
{
const gchar *name;
@@ -1090,6 +1091,7 @@
iface = (GIrNodeInterface *)ctx->current_node;
iface->members = g_list_append (iface->members, constant);
}
+ state_switch (ctx, STATE_CONSTANT);
}
return TRUE;
@@ -1251,7 +1253,7 @@
ctx->current_module->entries =
g_list_append (ctx->current_module->entries, iface);
- state_switch (ctx, STATE_OBJECT);
+ state_switch (ctx, STATE_CLASS);
}
return TRUE;
@@ -1274,8 +1276,8 @@
!(ctx->state == STATE_FUNCTION_PARAMETER ||
ctx->state == STATE_FUNCTION_RETURN ||
ctx->state == STATE_STRUCT_FIELD ||
- ctx->state == STATE_OBJECT_PROPERTY ||
- ctx->state == STATE_OBJECT_FIELD ||
+ ctx->state == STATE_CLASS_PROPERTY ||
+ ctx->state == STATE_CLASS_FIELD ||
ctx->state == STATE_INTERFACE_FIELD ||
ctx->state == STATE_BOXED_FIELD
))
@@ -1390,7 +1392,7 @@
GError **error)
{
if (strcmp (element_name, "glib:signal") == 0 &&
- (ctx->state == STATE_OBJECT ||
+ (ctx->state == STATE_CLASS ||
ctx->state == STATE_INTERFACE))
{
const gchar *name;
@@ -1472,7 +1474,7 @@
GError **error)
{
if (strcmp (element_name, "vfunc") == 0 &&
- (ctx->state == STATE_OBJECT ||
+ (ctx->state == STATE_CLASS ||
ctx->state == STATE_INTERFACE))
{
const gchar *name;
@@ -1772,7 +1774,7 @@
ctx, error))
goto out;
if (strcmp (element_name, "implements") == 0 &&
- ctx->state == STATE_OBJECT)
+ ctx->state == STATE_CLASS)
{
state_switch (ctx, STATE_IMPLEMENTS);
@@ -1982,6 +1984,7 @@
"Unexpected end tag '%s' on line %d char %d",
actual_name,
line_number, char_number);
+ backtrace_stderr();
return FALSE;
}
@@ -2058,7 +2061,7 @@
if (ctx->current_node->type == G_IR_NODE_INTERFACE)
state_switch (ctx, STATE_INTERFACE);
else if (ctx->current_node->type == G_IR_NODE_OBJECT)
- state_switch (ctx, STATE_OBJECT);
+ state_switch (ctx, STATE_CLASS);
else if (ctx->current_node->type == G_IR_NODE_BOXED)
state_switch (ctx, STATE_BOXED);
else if (ctx->current_node->type == G_IR_NODE_STRUCT)
@@ -2079,25 +2082,25 @@
}
break;
- case STATE_OBJECT_FIELD:
+ case STATE_CLASS_FIELD:
if (strcmp ("type", element_name) == 0)
break;
if (require_end_element (context, "field", element_name, error))
{
- state_switch (ctx, STATE_OBJECT);
+ state_switch (ctx, STATE_CLASS);
}
break;
- case STATE_OBJECT_PROPERTY:
+ case STATE_CLASS_PROPERTY:
if (strcmp ("type", element_name) == 0)
break;
if (require_end_element (context, "property", element_name, error))
{
- state_switch (ctx, STATE_OBJECT);
+ state_switch (ctx, STATE_CLASS);
}
break;
- case STATE_OBJECT:
+ case STATE_CLASS:
if (require_end_element (context, "class", element_name, error))
{
ctx->current_node = NULL;
@@ -2187,15 +2190,23 @@
state_switch (ctx, STATE_NAMESPACE);
}
break;
-
case STATE_IMPLEMENTS:
+ if (strcmp ("interface", element_name) == 0)
+ break;
if (require_end_element (context, "implements", element_name, error))
- state_switch (ctx, STATE_OBJECT);
+ state_switch (ctx, STATE_CLASS);
break;
case STATE_REQUIRES:
if (require_end_element (context, "requires", element_name, error))
state_switch (ctx, STATE_INTERFACE);
break;
+ case STATE_CONSTANT:
+ if (require_end_element (context, "constant", element_name, error))
+ {
+ ctx->current_node = NULL;
+ state_switch (ctx, STATE_NAMESPACE);
+ }
+ break;
default:
g_error ("Unhandled state %d in end_element_handler\n", ctx->state);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]