gobject-introspection r347 - in trunk: . girepository
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r347 - in trunk: . girepository
- Date: Tue, 12 Aug 2008 15:34:27 +0000 (UTC)
Author: walters
Date: Tue Aug 12 15:34:27 2008
New Revision: 347
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=347&view=rev
Log:
2008-08-12 Colin Walters <walters verbum org>
* girepository/girparser.c, girepository/gtypelib.c,
girepository/gtypelib.h, girepository/girnode.c:
Remove usage of (GAPI-oriented) TypeTag in favor of
GITypeTag from girepository.h.
Modified:
trunk/ChangeLog
trunk/girepository/girnode.c
trunk/girepository/girparser.c
trunk/girepository/gtypelib.c
trunk/girepository/gtypelib.h
Modified: trunk/girepository/girnode.c
==============================================================================
--- trunk/girepository/girnode.c (original)
+++ trunk/girepository/girnode.c Tue Aug 12 15:34:27 2008
@@ -650,7 +650,7 @@
case G_IR_NODE_TYPE:
{
GIrNodeType *type = (GIrNodeType *)node;
- if (type->tag < TYPE_TAG_ARRAY)
+ if (type->tag < GI_TYPE_TAG_ARRAY)
size = 4;
else
{
@@ -659,28 +659,28 @@
switch (type->tag)
{
- case TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_ARRAY:
size = 4 + 4;
if (type->parameter_type1)
size += g_ir_node_get_full_size_internal (node, (GIrNode *)type->parameter_type1);
break;
- case TYPE_TAG_INTERFACE:
+ case GI_TYPE_TAG_INTERFACE:
size = 4 + 4;
break;
- case TYPE_TAG_LIST:
- case TYPE_TAG_SLIST:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
size = 4 + 4;
if (type->parameter_type1)
size += g_ir_node_get_full_size_internal (node, (GIrNode *)type->parameter_type1);
break;
- case TYPE_TAG_HASH:
+ case GI_TYPE_TAG_GHASH:
size = 4 + 4 + 4;
if (type->parameter_type1)
size += g_ir_node_get_full_size_internal (node, (GIrNode *)type->parameter_type1);
if (type->parameter_type2)
size += g_ir_node_get_full_size_internal (node, (GIrNode *)type->parameter_type2);
break;
- case TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_ERROR:
{
gint n;
@@ -1224,7 +1224,8 @@
g_assert (node != NULL);
- g_debug ("build_typelib (%s)",
+ g_debug ("build_typelib: %s (%s)",
+ node->name,
g_ir_node_type_to_string (node->type));
switch (node->type)
@@ -1236,9 +1237,8 @@
*offset += 4;
- if (type->tag < TYPE_TAG_ARRAY ||
- type->tag == TYPE_TAG_STRING ||
- type->tag == TYPE_TAG_ANY)
+ if (type->tag < GI_TYPE_TAG_ARRAY ||
+ type->tag == GI_TYPE_TAG_UTF8)
{
blob->reserved = 0;
blob->reserved2 = 0;
@@ -1271,7 +1271,7 @@
blob->offset = *offset2;
switch (type->tag)
{
- case TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_ARRAY:
{
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
guint32 pos;
@@ -1293,7 +1293,7 @@
}
break;
- case TYPE_TAG_INTERFACE:
+ case GI_TYPE_TAG_INTERFACE:
{
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
*offset2 += 4;
@@ -1307,8 +1307,8 @@
}
break;
- case TYPE_TAG_LIST:
- case TYPE_TAG_SLIST:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
{
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
guint32 pos;
@@ -1328,7 +1328,7 @@
}
break;
- case TYPE_TAG_HASH:
+ case GI_TYPE_TAG_GHASH:
{
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
guint32 pos;
@@ -1351,7 +1351,7 @@
}
break;
- case TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_ERROR:
{
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
gint i;
@@ -2095,70 +2095,70 @@
blob->offset = *offset2;
switch (constant->type->tag)
{
- case TYPE_TAG_BOOLEAN:
+ case GI_TYPE_TAG_BOOLEAN:
blob->size = 4;
*(gboolean*)&data[blob->offset] = parse_boolean_value (constant->value);
break;
- case TYPE_TAG_INT8:
+ case GI_TYPE_TAG_INT8:
blob->size = 1;
*(gint8*)&data[blob->offset] = (gint8) parse_int_value (constant->value);
break;
- case TYPE_TAG_UINT8:
+ case GI_TYPE_TAG_UINT8:
blob->size = 1;
*(guint8*)&data[blob->offset] = (guint8) parse_uint_value (constant->value);
break;
- case TYPE_TAG_INT16:
+ case GI_TYPE_TAG_INT16:
blob->size = 2;
*(gint16*)&data[blob->offset] = (gint16) parse_int_value (constant->value);
break;
- case TYPE_TAG_UINT16:
+ case GI_TYPE_TAG_UINT16:
blob->size = 2;
*(guint16*)&data[blob->offset] = (guint16) parse_uint_value (constant->value);
break;
- case TYPE_TAG_INT32:
+ case GI_TYPE_TAG_INT32:
blob->size = 4;
*(gint32*)&data[blob->offset] = (gint32) parse_int_value (constant->value);
break;
- case TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_UINT32:
blob->size = 4;
*(guint32*)&data[blob->offset] = (guint32) parse_uint_value (constant->value);
break;
- case TYPE_TAG_INT64:
+ case GI_TYPE_TAG_INT64:
blob->size = 8;
*(gint64*)&data[blob->offset] = (gint64) parse_int_value (constant->value);
break;
- case TYPE_TAG_UINT64:
+ case GI_TYPE_TAG_UINT64:
blob->size = 8;
*(guint64*)&data[blob->offset] = (guint64) parse_uint_value (constant->value);
break;
- case TYPE_TAG_INT:
+ case GI_TYPE_TAG_INT:
blob->size = sizeof (gint);
*(gint*)&data[blob->offset] = (gint) parse_int_value (constant->value);
break;
- case TYPE_TAG_UINT:
+ case GI_TYPE_TAG_UINT:
blob->size = sizeof (guint);
*(gint*)&data[blob->offset] = (guint) parse_uint_value (constant->value);
break;
- case TYPE_TAG_SSIZE: /* FIXME */
- case TYPE_TAG_LONG:
+ case GI_TYPE_TAG_SSIZE: /* FIXME */
+ case GI_TYPE_TAG_LONG:
blob->size = sizeof (glong);
*(glong*)&data[blob->offset] = (glong) parse_int_value (constant->value);
break;
- case TYPE_TAG_SIZE: /* FIXME */
- case TYPE_TAG_ULONG:
+ case GI_TYPE_TAG_SIZE: /* FIXME */
+ case GI_TYPE_TAG_ULONG:
blob->size = sizeof (gulong);
*(gulong*)&data[blob->offset] = (gulong) parse_uint_value (constant->value);
break;
- case TYPE_TAG_FLOAT:
+ case GI_TYPE_TAG_FLOAT:
blob->size = sizeof (gfloat);
*(gfloat*)&data[blob->offset] = (gfloat) parse_float_value (constant->value);
break;
- case TYPE_TAG_DOUBLE:
+ case GI_TYPE_TAG_DOUBLE:
blob->size = sizeof (gdouble);
*(gdouble*)&data[blob->offset] = (gdouble) parse_float_value (constant->value);
break;
- case TYPE_TAG_UTF8:
- case TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
blob->size = strlen (constant->value) + 1;
memcpy (&data[blob->offset], constant->value, blob->size);
break;
Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c (original)
+++ trunk/girepository/girparser.c Tue Aug 12 15:34:27 2008
@@ -133,59 +133,60 @@
gint tag;
gboolean pointer;
} basic[] = {
- { "void", TYPE_TAG_VOID, 0 },
- { "gpointer", TYPE_TAG_VOID, 1 },
- { "bool", TYPE_TAG_BOOLEAN, 0 },
- { "gboolean", TYPE_TAG_BOOLEAN, 0 },
-#if 0
- { "char", TYPE_TAG_INT8, 0 },
- { "gchar", TYPE_TAG_INT8, 0 },
- { "guchar", TYPE_TAG_UINT8, 0 },
-#endif
- { "int8_t", TYPE_TAG_INT8, 0 },
- { "int8", TYPE_TAG_INT8, 0 },
- { "gint8", TYPE_TAG_INT8, 0 },
- { "uint8_t", TYPE_TAG_UINT8, 0 },
- { "uint8", TYPE_TAG_UINT8, 0 },
- { "guint8", TYPE_TAG_UINT8, 0 },
- { "int16_t", TYPE_TAG_INT16, 0 },
- { "int16", TYPE_TAG_INT16, 0 },
- { "gint16", TYPE_TAG_INT16, 0 },
- { "uint16_t", TYPE_TAG_UINT16, 0 },
- { "uint16", TYPE_TAG_UINT16, 0 },
- { "guint16", TYPE_TAG_UINT16, 0 },
- { "int32_t", TYPE_TAG_INT32, 0 },
- { "int32", TYPE_TAG_INT32, 0 },
- { "gint32", TYPE_TAG_INT32, 0 },
- { "uint32_t", TYPE_TAG_UINT32, 0 },
- { "uint32", TYPE_TAG_UINT32, 0 },
- { "guint32", TYPE_TAG_UINT32, 0 },
- { "int64_t", TYPE_TAG_INT64, 0 },
- { "int64", TYPE_TAG_INT64, 0 },
- { "gint64", TYPE_TAG_INT64, 0 },
- { "uint64_t", TYPE_TAG_UINT64, 0 },
- { "uint64", TYPE_TAG_UINT64, 0 },
- { "guint64", TYPE_TAG_UINT64, 0 },
- { "int", TYPE_TAG_INT, 0 },
- { "gint", TYPE_TAG_INT, 0 },
- { "uint", TYPE_TAG_UINT, 0 },
- { "guint", TYPE_TAG_UINT, 0 },
- { "long", TYPE_TAG_LONG, 0 },
- { "glong", TYPE_TAG_LONG, 0 },
- { "ulong", TYPE_TAG_ULONG, 0 },
- { "gulong", TYPE_TAG_ULONG, 0 },
- { "ssize_t", TYPE_TAG_SSIZE, 0 },
- { "gssize", TYPE_TAG_SSIZE, 0 },
- { "size_t", TYPE_TAG_SIZE, 0 },
- { "gsize", TYPE_TAG_SIZE, 0 },
- { "float", TYPE_TAG_FLOAT, 0 },
- { "gfloat", TYPE_TAG_FLOAT, 0 },
- { "double", TYPE_TAG_DOUBLE, 0 },
- { "gdouble", TYPE_TAG_DOUBLE, 0 },
- { "utf8", TYPE_TAG_UTF8, 1 },
- { "gchar*", TYPE_TAG_UTF8, 1 },
- { "filename", TYPE_TAG_FILENAME,1 },
- { "string", TYPE_TAG_STRING, 1 }
+ { "void", GI_TYPE_TAG_VOID, 0 },
+ { "none", GI_TYPE_TAG_VOID, 0 },
+ { "gpointer", GI_TYPE_TAG_VOID, 1 },
+ { "bool", GI_TYPE_TAG_BOOLEAN, 0 },
+ { "gboolean", GI_TYPE_TAG_BOOLEAN, 0 },
+ { "char", GI_TYPE_TAG_INT8, 0 },
+ { "gchar", GI_TYPE_TAG_INT8, 0 },
+ { "guchar", GI_TYPE_TAG_UINT8, 0 },
+ { "gunichar", GI_TYPE_TAG_UINT32, 0 },
+ { "int8_t", GI_TYPE_TAG_INT8, 0 },
+ { "int8", GI_TYPE_TAG_INT8, 0 },
+ { "gint8", GI_TYPE_TAG_INT8, 0 },
+ { "uint8_t", GI_TYPE_TAG_UINT8, 0 },
+ { "uint8", GI_TYPE_TAG_UINT8, 0 },
+ { "guint8", GI_TYPE_TAG_UINT8, 0 },
+ { "int16_t", GI_TYPE_TAG_INT16, 0 },
+ { "int16", GI_TYPE_TAG_INT16, 0 },
+ { "gint16", GI_TYPE_TAG_INT16, 0 },
+ { "uint16_t", GI_TYPE_TAG_UINT16, 0 },
+ { "uint16", GI_TYPE_TAG_UINT16, 0 },
+ { "guint16", GI_TYPE_TAG_UINT16, 0 },
+ { "int32_t", GI_TYPE_TAG_INT32, 0 },
+ { "int32", GI_TYPE_TAG_INT32, 0 },
+ { "gint32", GI_TYPE_TAG_INT32, 0 },
+ { "uint32_t", GI_TYPE_TAG_UINT32, 0 },
+ { "uint32", GI_TYPE_TAG_UINT32, 0 },
+ { "guint32", GI_TYPE_TAG_UINT32, 0 },
+ { "int64_t", GI_TYPE_TAG_INT64, 0 },
+ { "int64", GI_TYPE_TAG_INT64, 0 },
+ { "gint64", GI_TYPE_TAG_INT64, 0 },
+ { "uint64_t", GI_TYPE_TAG_UINT64, 0 },
+ { "uint64", GI_TYPE_TAG_UINT64, 0 },
+ { "guint64", GI_TYPE_TAG_UINT64, 0 },
+ { "int", GI_TYPE_TAG_INT, 0 },
+ { "gint", GI_TYPE_TAG_INT, 0 },
+ { "uint", GI_TYPE_TAG_UINT, 0 },
+ { "guint", GI_TYPE_TAG_UINT, 0 },
+ { "long", GI_TYPE_TAG_LONG, 0 },
+ { "glong", GI_TYPE_TAG_LONG, 0 },
+ { "ulong", GI_TYPE_TAG_ULONG, 0 },
+ { "gulong", GI_TYPE_TAG_ULONG, 0 },
+ { "ssize_t", GI_TYPE_TAG_SSIZE, 0 },
+ { "gssize", GI_TYPE_TAG_SSIZE, 0 },
+ { "size_t", GI_TYPE_TAG_SIZE, 0 },
+ { "gsize", GI_TYPE_TAG_SIZE, 0 },
+ { "float", GI_TYPE_TAG_FLOAT, 0 },
+ { "gfloat", GI_TYPE_TAG_FLOAT, 0 },
+ { "double", GI_TYPE_TAG_DOUBLE, 0 },
+ { "gdouble", GI_TYPE_TAG_DOUBLE, 0 },
+ { "utf8", GI_TYPE_TAG_UTF8, 1 },
+ { "gchar*", GI_TYPE_TAG_UTF8, 1 },
+ { "filename", GI_TYPE_TAG_FILENAME,1 },
+ // FIXME merge - do we still want this?
+ { "string", GI_TYPE_TAG_UTF8, 1 }
};
gint n_basic = G_N_ELEMENTS (basic);
@@ -227,14 +228,14 @@
{
if (g_str_has_prefix (*rest, "GList"))
{
- type->tag = TYPE_TAG_LIST;
+ type->tag = GI_TYPE_TAG_GLIST;
type->is_glist = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GList");
}
else
{
- type->tag = TYPE_TAG_SLIST;
+ type->tag = GI_TYPE_TAG_GSLIST;
type->is_gslist = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GSList");
@@ -259,7 +260,7 @@
}
else if (g_str_has_prefix (*rest, "GHashTable"))
{
- type->tag = TYPE_TAG_HASH;
+ type->tag = GI_TYPE_TAG_GHASH;
type->is_ghashtable = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GHashTable");
@@ -291,7 +292,7 @@
}
else if (g_str_has_prefix (*rest, "GError"))
{
- type->tag = TYPE_TAG_ERROR;
+ type->tag = GI_TYPE_TAG_ERROR;
type->is_error = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GError");
@@ -312,7 +313,7 @@
}
else
{
- type->tag = TYPE_TAG_INTERFACE;
+ type->tag = GI_TYPE_TAG_INTERFACE;
type->is_interface = TRUE;
start = *rest;
@@ -341,7 +342,7 @@
array = (GIrNodeType *)g_ir_node_new (G_IR_NODE_TYPE);
- array->tag = TYPE_TAG_ARRAY;
+ array->tag = GI_TYPE_TAG_ARRAY;
array->is_pointer = TRUE;
array->is_array = TRUE;
@@ -385,6 +386,7 @@
type = array;
}
+ g_assert (type->tag >= 0 && type->tag <= GI_TYPE_TAG_ERROR);
return type;
error:
@@ -625,6 +627,7 @@
param = (GIrNodeParam *)g_ir_node_new (G_IR_NODE_PARAM);
ctx->current_typed = (GIrNode*) param;
+ ctx->current_typed->name = g_strdup (name);
state_switch (ctx, STATE_FUNCTION_PARAMETER);
Modified: trunk/girepository/gtypelib.c
==============================================================================
--- trunk/girepository/gtypelib.c (original)
+++ trunk/girepository/gtypelib.c Tue Aug 12 15:34:27 2008
@@ -388,7 +388,7 @@
if (simple->reserved == 0 &&
simple->reserved2 == 0)
{
- if (simple->tag >= TYPE_TAG_ARRAY)
+ if (simple->tag >= GI_TYPE_TAG_ARRAY)
{
g_set_error (error,
G_TYPELIB_ERROR,
@@ -397,7 +397,7 @@
return FALSE;
}
- if (simple->tag >= TYPE_TAG_UTF8 &&
+ if (simple->tag >= GI_TYPE_TAG_UTF8 &&
!simple->pointer)
{
g_set_error (error,
@@ -414,28 +414,28 @@
switch (iface->tag)
{
- case TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_ARRAY:
if (!validate_array_type_blob (typelib, simple->offset,
signature_offset, return_type, error))
return FALSE;
break;
- case TYPE_TAG_INTERFACE:
+ case GI_TYPE_TAG_INTERFACE:
if (!validate_iface_type_blob (typelib, simple->offset,
signature_offset, return_type, error))
return FALSE;
break;
- case TYPE_TAG_LIST:
- case TYPE_TAG_SLIST:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
if (!validate_param_type_blob (typelib, simple->offset,
signature_offset, return_type, 1, error))
return FALSE;
break;
- case TYPE_TAG_HASH:
+ case GI_TYPE_TAG_GHASH:
if (!validate_param_type_blob (typelib, simple->offset,
signature_offset, return_type, 2, error))
return FALSE;
break;
- case TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_ERROR:
if (!validate_error_type_blob (typelib, simple->offset,
signature_offset, return_type, error))
return FALSE;
Modified: trunk/girepository/gtypelib.h
==============================================================================
--- trunk/girepository/gtypelib.h (original)
+++ trunk/girepository/gtypelib.h Tue Aug 12 15:34:27 2008
@@ -96,42 +96,6 @@
} DirEntry;
-#define TYPE_POINTER_MASK 1 << 7
-#define TYPE_TAG_MASK 63
-
-typedef enum
-{
- TYPE_TAG_VOID = 0,
- TYPE_TAG_BOOLEAN = 1,
- TYPE_TAG_INT8 = 2,
- TYPE_TAG_UINT8 = 3,
- TYPE_TAG_INT16 = 4,
- TYPE_TAG_UINT16 = 5,
- TYPE_TAG_INT32 = 6,
- TYPE_TAG_UINT32 = 7,
- TYPE_TAG_INT64 = 8,
- TYPE_TAG_UINT64 = 9,
- TYPE_TAG_INT = 10,
- TYPE_TAG_UINT = 11,
- TYPE_TAG_LONG = 12,
- TYPE_TAG_ULONG = 13,
- TYPE_TAG_SSIZE = 14,
- TYPE_TAG_SIZE = 15,
- TYPE_TAG_FLOAT = 16,
- TYPE_TAG_DOUBLE = 17,
- TYPE_TAG_UTF8 = 18,
- TYPE_TAG_FILENAME = 19,
- TYPE_TAG_ARRAY = 20,
- TYPE_TAG_INTERFACE = 21,
- TYPE_TAG_LIST = 22,
- TYPE_TAG_SLIST = 23,
- TYPE_TAG_HASH = 24,
- TYPE_TAG_ERROR = 25,
- TYPE_TAG_STRING = 26,
- TYPE_TAG_SEQUENCE = 27,
- TYPE_TAG_ANY = 28
-} TypeTag;
-
typedef union
{
struct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]