gobject-introspection r308 - branches/gir-compiler/tools
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r308 - branches/gir-compiler/tools
- Date: Thu, 7 Aug 2008 03:51:44 +0000 (UTC)
Author: walters
Date: Thu Aug 7 03:51:44 2008
New Revision: 308
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=308&view=rev
Log:
Slowly getting farther...
Modified:
branches/gir-compiler/tools/girparser.c
Modified: branches/gir-compiler/tools/girparser.c
==============================================================================
--- branches/gir-compiler/tools/girparser.c (original)
+++ branches/gir-compiler/tools/girparser.c Thu Aug 7 03:51:44 2008
@@ -44,6 +44,7 @@
STATE_OBJECT_PROPERTY,
STATE_INTERFACE,
STATE_INTERFACE_PROPERTY,
+ STATE_INTERFACE_FIELD,
STATE_IMPLEMENTS, /* 15 */
STATE_REQUIRES,
STATE_BOXED,
@@ -116,7 +117,7 @@
static void
state_switch (ParseContext *ctx, ParseState newstate)
{
- fprintf (stderr, "switching to state: %d from %d\n", newstate, ctx->state);
+ fprintf (stderr, "state %d -> %d\n", ctx->state, newstate);
ctx->prev_state = ctx->state;
ctx->state = newstate;
}
@@ -473,10 +474,11 @@
ctx->state == STATE_INTERFACE ||
ctx->state == STATE_BOXED ||
ctx->state == STATE_UNION) &&
- strcmp (element_name, "method") == 0) ||
+ (strcmp (element_name, "method") == 0 ||
+ strcmp (element_name, "callback") == 0)) ||
((ctx->state == STATE_OBJECT ||
ctx->state == STATE_BOXED) &&
- strcmp (element_name, "constructor") == 0) ||
+ (strcmp (element_name, "constructor") == 0)) ||
(ctx->state == STATE_STRUCT && strcmp (element_name, "callback") == 0))
{
const gchar *name;
@@ -724,7 +726,8 @@
(ctx->state == STATE_OBJECT ||
ctx->state == STATE_BOXED ||
ctx->state == STATE_STRUCT ||
- ctx->state == STATE_UNION))
+ ctx->state == STATE_UNION ||
+ ctx->state == STATE_INTERFACE))
{
const gchar *name;
const gchar *type;
@@ -782,6 +785,15 @@
state_switch (ctx, STATE_OBJECT_FIELD);
}
break;
+ case G_IR_NODE_INTERFACE:
+ {
+ GIrNodeInterface *iface;
+
+ iface = (GIrNodeInterface *)ctx->current_node;
+ iface->members = g_list_append (iface->members, field);
+ state_switch (ctx, STATE_INTERFACE_FIELD);
+ }
+ break;
case G_IR_NODE_BOXED:
{
GIrNodeBoxed *boxed;
@@ -1257,8 +1269,9 @@
const gchar *ctype;
if (strcmp (element_name, "type") != 0 ||
- !(ctx->state == STATE_FUNCTION_PARAMETER || ctx->state == STATE_FUNCTION_RETURN
- || ctx->state == STATE_STRUCT_FIELD || ctx->state == STATE_OBJECT_PROPERTY))
+ !(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_INTERFACE_FIELD))
return FALSE;
if (!ctx->current_typed)
@@ -1365,8 +1378,6 @@
if (name == NULL)
MISSING_ATTRIBUTE (context, error, element_name, "name");
- else if (when == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "when");
else
{
GIrNodeInterface *iface;
@@ -1379,10 +1390,10 @@
signal->run_first = FALSE;
signal->run_last = FALSE;
signal->run_cleanup = FALSE;
- if (strcmp (when, "FIRST") == 0)
- signal->run_first = TRUE;
- else if (strcmp (when, "LAST") == 0)
+ if (when == NULL || strcmp (when, "LAST") == 0)
signal->run_last = TRUE;
+ else if (strcmp (when, "FIRST") == 0)
+ signal->run_first = TRUE;
else
signal->run_cleanup = TRUE;
@@ -1710,6 +1721,13 @@
break;
+ case 'g':
+ if (start_signal (context, element_name,
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
+ break;
+
case 'i':
if (start_interface (context, element_name,
attribute_names, attribute_values,
@@ -1851,13 +1869,6 @@
goto out;
break;
- case 's':
- if (start_signal (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
- break;
-
case 'u':
if (start_union (context, element_name,
attribute_names, attribute_values,
@@ -2005,6 +2016,13 @@
}
break;
+ case STATE_INTERFACE_FIELD:
+ if (strcmp (element_name, "field") == 0)
+ {
+ state_switch (ctx, STATE_INTERFACE);
+ }
+ break;
+
case STATE_INTERFACE:
if (strcmp (element_name, "interface") == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]