summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2005-05-21 00:08:27 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-05-21 00:08:27 +0000
commitc29c7874a2ce197ff9b728dc79fce609b7230d3d (patch)
tree0ba4fa328dc6b70d4a8053440cf03525bb486ae3
parenta58b29dbb8fe7bc393f20b8b4e81a09852918b08 (diff)
downloadgobject-introspection-c29c7874a2ce197ff9b728dc79fce609b7230d3d.tar.gz
Basic type cleanup
-rw-r--r--ChangeLog7
-rw-r--r--TODO8
-rw-r--r--examples/gdk-pixbuf.gidl16
-rw-r--r--metadata-format.txt31
-rw-r--r--src/generate.c43
-rw-r--r--src/gidlnode.c102
-rw-r--r--src/gidlparser.c103
-rw-r--r--src/ginvoke.c22
-rw-r--r--src/girepository.h20
-rw-r--r--src/gmetadata.h30
-rw-r--r--tests/array.test6
-rw-r--r--tests/boxed.test6
-rw-r--r--tests/errors.test2
13 files changed, 230 insertions, 166 deletions
diff --git a/ChangeLog b/ChangeLog
index 88500288..1b025d64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-05-20 Matthias Clasen <mclasen@redhat.com>
+ * TODO: Updates.
+
+ * metadata-format.txt: Cleanup basic types.
+ * src/*: Adapt to the changes.
+ * tests/*: Adapt to the changes.
+ * examples/gdk-pixbuf.gidl: Adapt to the changes.
+
* src/gidlnode.c (g_idl_node_get_size): Report the correct
size for enum blobs.
(g_idl_node_get_full_size): Report the correct size for
diff --git a/TODO b/TODO
index 9fa3a856..df5d8e46 100644
--- a/TODO
+++ b/TODO
@@ -11,14 +11,6 @@ XML format
Binary format
-------------
-- Type cleanup:
- + for integral types, we just need to discriminate types by width
- and signedness, but keep separate types for platform-dependent types
- like short, int, long, size_t. We should not try to capture different
- type names like guchar vs guint8 vs int8_t.
- + there should probably not be a char type
- + for strings, we need "UTF-8-encoded 0-terminated string and
- "0-terminated byte array", possibly with annotation for encoding
- Sort arrays so that we can use bsearch for lookup
- Maybe add hashes to lookup interfaces and functions in interfaces
- Add default values
diff --git a/examples/gdk-pixbuf.gidl b/examples/gdk-pixbuf.gidl
index 67aed771..52fadee1 100644
--- a/examples/gdk-pixbuf.gidl
+++ b/examples/gdk-pixbuf.gidl
@@ -82,7 +82,7 @@
<constructor name="new_from_file_at_size" symbol="gdk_pixbuf_new_from_file_at_size">
<return-type type="GdkPixbuf*" transfer="full" />
<parameters>
- <parameter name="filename" type="gchar*" transfer="none" direction="in" />
+ <parameter name="filename" type="filename" transfer="none" direction="in" />
<parameter name="width" type="gint" direction="in" />
<parameter name="height" type="gint" direction="in" />
<parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" />
@@ -91,7 +91,7 @@
<constructor name="new_from_file_at_scale" symbol="gdk_pixbuf_new_from_file_at_scale">
<return-type type="GdkPixbuf*" transfer="full" />
<parameters>
- <parameter name="filename" type="gchar*" transfer="none" direction="in" />
+ <parameter name="filename" type="filename" transfer="none" direction="in" />
<parameter name="width" type="gint" direction="in" />
<parameter name="height" type="gint" direction="in" />
<parameter name="preserve_aspect_ratio" type="gboolean" direction="in" />
@@ -138,7 +138,7 @@
<return-type type="gboolean" />
<parameters>
<parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" />
- <parameter name="filename" type="gchar*" transfer="none" direction="in" />
+ <parameter name="filename" type="filename" transfer="none" direction="in" />
<parameter name="type" type="guint8*" transfer="none" direction="in" />
<parameter name="option_keys" type="guint8*[zero-terminated=1]" transfer="none" direction="in" />
<parameter name="option_values" type="guint8*[zero-terminated=1]" transfer="none" direction="in" />
@@ -312,7 +312,7 @@
<constructor name="new_from_file" symbol="gdk_pixbuf_animation_new_from_file">
<return-type type="GdkPixbufAnimation*" transfer="full" />
<parameters>
- <parameter name="filename" type="gchar*" transfer="none" direction="in" />
+ <parameter name="filename" type="filename" transfer="none" direction="in" />
<parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" />
</parameters>
</constructor>
@@ -410,13 +410,13 @@
</object>
<struct name="GdkPixbufFormat">
<method name="get_name" symbol="gdk_pixbuf_format_get_name">
- <return-type type="gchar*" transfer="full" />
+ <return-type type="utf8" transfer="full" />
<parameters>
<parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" />
</parameters>
</method>
<method name="get_description" symbol="gdk_pixbuf_format_get_description">
- <return-type type="gchar*" transfer="full" />
+ <return-type type="utf8" transfer="full" />
<parameters>
<parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" />
</parameters>
@@ -459,7 +459,7 @@
</parameters>
</method>
<method name="get_license" symbol="gdk_pixbuf_format_get_license">
- <return-type type="gchar*" transfer="full" />
+ <return-type type="utf8" transfer="full" />
<parameters>
<parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" />
</parameters>
@@ -471,7 +471,7 @@
<function name="get_file_info" symbol="gdk_pixbuf_format_get_file_info">
<return-type type="GdkPixbufFormat*" transfer="none" />
<parameters>
- <parameter name="filename" type="gchar*" transfer="none" direction="in" />
+ <parameter name="filename" type="filename" transfer="none" direction="in" />
<parameter name="width" type="gint" direction="out" />
<parameter name="height" type="gint" direction="out" />
</parameters>
diff --git a/metadata-format.txt b/metadata-format.txt
index 5b00fca4..da0ed0f3 100644
--- a/metadata-format.txt
+++ b/metadata-format.txt
@@ -1,13 +1,19 @@
GObject binary metadata for introspection
-----------------------------------------
-Version 0.5
+Version 0.6
+
+Changes since 0.5:
+- basic type cleanup:
+ + remove GString
+ + add [u]int, [u]long, [s]size_t
+ + rename string to utf8, add filename
Changes since 0.4:
- add a UnionBlob
Changes since 0.3:
-- drop short_name for ValueBlob.
+- drop short_name for ValueBlob
Changes since 0.2:
- make inline types 4 bytes after all, remove header->types and allow
@@ -441,13 +447,20 @@ tag: specifies what kind of type is described, as follows:
7 uint32
8 int64
9 uint64
- 10 float
- 11 double
- 12 string (these are zero-terminated char* and assumed to be
- in UTF-8, for other data, use uint8[])
- 13 GString
-
- For string and GString, is_pointer will always be set.
+ 10 int
+ 11 uint
+ 12 long
+ 13 ulong
+ 14 ssize_t
+ 15 size_t
+ 16 float
+ 17 double
+ 18 utf8 (these are zero-terminated char[] and assumed to be
+ in UTF-8)
+ 19 filename (these are zero-terminated char[] and assumed to be
+ in the GLib filename encoding)
+
+ For utf8 and filename is_pointer will always be set.
offset: Offset relative to header->types that points to a TypeBlob.
Unlike other offsets, this is in words (ie 32bit units) rather
diff --git a/src/generate.c b/src/generate.c
index 121a61c8..dac7c65c 100644
--- a/src/generate.c
+++ b/src/generate.c
@@ -62,20 +62,24 @@ write_type_info (const gchar *namespace,
"guint32",
"gint64",
"guint64",
+ "gint",
+ "guint",
+ "glong",
+ "gulong",
+ "gssize",
+ "gsize",
"gfloat",
"gdouble",
- "gchar",
- "GString",
- "gint",
- "guint",
- "glong",
- "gulong"
+ "utf8",
+ "filename"
};
tag = g_type_info_get_tag (info);
- if (tag < 20)
+ if (tag < 18)
g_fprintf (file, "%s%s", basic[tag], g_type_info_is_pointer (info) ? "*" : "");
+ else if (tag < 20)
+ g_fprintf (file, "%s", basic[tag]);
else if (tag == 20)
{
gint length;
@@ -499,15 +503,6 @@ write_constant_value (const gchar *namespace,
case GI_TYPE_TAG_UINT64:
g_fprintf (file, "%" G_GUINT64_FORMAT, value->v_uint64);
break;
- case GI_TYPE_TAG_FLOAT:
- g_fprintf (file, "%f", value->v_float);
- break;
- case GI_TYPE_TAG_DOUBLE:
- g_fprintf (file, "%Lf", value->v_double);
- break;
- case GI_TYPE_TAG_STRING:
- g_fprintf (file, "%s", value->v_string);
- break;
case GI_TYPE_TAG_INT:
g_fprintf (file, "%d", value->v_int);
break;
@@ -520,6 +515,22 @@ write_constant_value (const gchar *namespace,
case GI_TYPE_TAG_ULONG:
g_fprintf (file, "%ld", value->v_ulong);
break;
+ case GI_TYPE_TAG_SSIZE:
+ g_fprintf (file, "%z", value->v_ssize);
+ break;
+ case GI_TYPE_TAG_SIZE:
+ g_fprintf (file, "%z", value->v_size);
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ g_fprintf (file, "%f", value->v_float);
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ g_fprintf (file, "%Lf", value->v_double);
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ g_fprintf (file, "%s", value->v_string);
+ break;
}
}
diff --git a/src/gidlnode.c b/src/gidlnode.c
index 7a0a4278..b2495ae1 100644
--- a/src/gidlnode.c
+++ b/src/gidlnode.c
@@ -532,34 +532,34 @@ g_idl_node_get_full_size (GIdlNode *node)
case G_IDL_NODE_TYPE:
{
GIdlNodeType *type = (GIdlNodeType *)node;
- if (type->tag < 20)
+ if (type->tag < TYPE_TAG_ARRAY)
size = 4;
else
{
switch (type->tag)
{
- case 20:
+ case TYPE_TAG_ARRAY:
size = 4 + 4;
if (type->parameter_type1)
size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1);
break;
- case 21:
+ case TYPE_TAG_INTERFACE:
size = 4 + 4;
break;
- case 22:
- case 23:
+ case TYPE_TAG_LIST:
+ case TYPE_TAG_SLIST:
size = 4 + 4;
if (type->parameter_type1)
size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1);
break;
- case 24:
+ case TYPE_TAG_HASH:
size = 4 + 4 + 4;
if (type->parameter_type1)
size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1);
if (type->parameter_type2)
size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type2);
break;
- case 25:
+ case TYPE_TAG_ERROR:
{
gint n;
@@ -883,7 +883,6 @@ serialize_type (GIdlModule *module,
GString *str)
{
gint i;
-
const gchar* basic[] = {
"void",
"gboolean",
@@ -895,16 +894,18 @@ serialize_type (GIdlModule *module,
"guint32",
"gint64",
"guint64",
+ "gint",
+ "guint",
+ "glong",
+ "gulong",
+ "gssize",
+ "gsize",
"gfloat",
"gdouble",
- "gchar",
- "GString",
- "gint",
- "guint",
- "glong",
- "gulong"
+ "utf8",
+ "filename"
};
-
+
if (node->tag < 20)
{
g_string_append_printf (str, "%s%s",
@@ -1012,7 +1013,7 @@ g_idl_node_build_metadata (GIdlNode *node,
*offset += 4;
- if (type->tag < 20)
+ if (type->tag < TYPE_TAG_ARRAY)
{
blob->reserved = 0;
blob->reserved2 = 0;
@@ -1045,7 +1046,7 @@ g_idl_node_build_metadata (GIdlNode *node,
blob->offset = *offset2;
switch (type->tag)
{
- case 20:
+ case TYPE_TAG_ARRAY:
{
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
guint32 pos;
@@ -1067,7 +1068,7 @@ g_idl_node_build_metadata (GIdlNode *node,
}
break;
- case 21:
+ case TYPE_TAG_INTERFACE:
{
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
*offset2 += 4;
@@ -1081,8 +1082,8 @@ g_idl_node_build_metadata (GIdlNode *node,
}
break;
- case 22:
- case 23:
+ case TYPE_TAG_LIST:
+ case TYPE_TAG_SLIST:
{
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
guint32 pos;
@@ -1102,7 +1103,7 @@ g_idl_node_build_metadata (GIdlNode *node,
}
break;
- case 24:
+ case TYPE_TAG_HASH:
{
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
guint32 pos;
@@ -1125,7 +1126,7 @@ g_idl_node_build_metadata (GIdlNode *node,
}
break;
- case 25:
+ case TYPE_TAG_ERROR:
{
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
gint i, domain;
@@ -1872,70 +1873,73 @@ g_idl_node_build_metadata (GIdlNode *node,
blob->offset = *offset2;
switch (constant->type->tag)
{
- case 1:
+ case TYPE_TAG_BOOLEAN:
blob->size = 4;
*(gboolean*)&data[blob->offset] = parse_boolean_value (constant->value);
break;
- case 2:
+ case TYPE_TAG_INT8:
blob->size = 1;
*(gint8*)&data[blob->offset] = (gint8) parse_int_value (constant->value);
break;
- case 3:
+ case TYPE_TAG_UINT8:
blob->size = 1;
*(guint8*)&data[blob->offset] = (guint8) parse_uint_value (constant->value);
break;
- case 4:
+ case TYPE_TAG_INT16:
blob->size = 2;
*(gint16*)&data[blob->offset] = (gint16) parse_int_value (constant->value);
break;
- case 5:
+ case TYPE_TAG_UINT16:
blob->size = 2;
*(guint16*)&data[blob->offset] = (guint16) parse_uint_value (constant->value);
break;
- case 6:
+ case TYPE_TAG_INT32:
blob->size = 4;
*(gint32*)&data[blob->offset] = (gint32) parse_int_value (constant->value);
break;
- case 7:
+ case TYPE_TAG_UINT32:
blob->size = 4;
*(guint32*)&data[blob->offset] = (guint32) parse_uint_value (constant->value);
break;
- case 8:
+ case TYPE_TAG_INT64:
blob->size = 8;
- *(gint32*)&data[blob->offset] = (gint64) parse_int_value (constant->value);
+ *(gint64*)&data[blob->offset] = (gint64) parse_int_value (constant->value);
break;
- case 9:
+ case TYPE_TAG_UINT64:
blob->size = 8;
- *(guint32*)&data[blob->offset] = (guint64) parse_uint_value (constant->value);
- break;
- case 10:
- blob->size = sizeof (gfloat);
- *(gfloat*)&data[blob->offset] = (gfloat) parse_float_value (constant->value);
+ *(guint64*)&data[blob->offset] = (guint64) parse_uint_value (constant->value);
break;
- case 11:
- blob->size = sizeof (gdouble);
- *(gdouble*)&data[blob->offset] = (gdouble) parse_float_value (constant->value);
- break;
- case 12:
- blob->size = strlen (constant->value) + 1;
- memcpy (&data[blob->offset], constant->value, blob->size);
- break;
- case 14:
+ case TYPE_TAG_INT:
blob->size = sizeof (gint);
*(gint*)&data[blob->offset] = (gint) parse_int_value (constant->value);
break;
- case 15:
+ case TYPE_TAG_UINT:
blob->size = sizeof (guint);
*(gint*)&data[blob->offset] = (guint) parse_uint_value (constant->value);
break;
- case 16:
+ case TYPE_TAG_SSIZE: /* FIXME */
+ case TYPE_TAG_LONG:
blob->size = sizeof (glong);
*(glong*)&data[blob->offset] = (glong) parse_int_value (constant->value);
break;
- case 17:
+ case TYPE_TAG_SIZE: /* FIXME */
+ case TYPE_TAG_ULONG:
blob->size = sizeof (gulong);
*(gulong*)&data[blob->offset] = (gulong) parse_uint_value (constant->value);
break;
+ case TYPE_TAG_FLOAT:
+ blob->size = sizeof (gfloat);
+ *(gfloat*)&data[blob->offset] = (gfloat) parse_float_value (constant->value);
+ break;
+ case 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:
+ blob->size = strlen (constant->value) + 1;
+ memcpy (&data[blob->offset], constant->value, blob->size);
+ break;
}
*offset2 += ALIGN_VALUE (blob->size, 4);
diff --git a/src/gidlparser.c b/src/gidlparser.c
index c179ce55..9945802a 100644
--- a/src/gidlparser.c
+++ b/src/gidlparser.c
@@ -22,6 +22,7 @@
#include <glib.h>
#include "gidlmodule.h"
#include "gidlnode.h"
+#include "gmetadata.h"
typedef enum
{
@@ -86,48 +87,52 @@ parse_type_internal (gchar *str, gchar **rest)
gint tag;
gboolean pointer;
} basic[] = {
- { "void", 0, 0 },
- { "gpointer", 0, 1 },
- { "gboolean", 1, 0 },
- { "int8_t", 2, 0 },
- { "int8", 2, 0 },
- { "gint8", 2, 0 },
- { "uint8_t", 3, 0 },
- { "uint8", 3, 0 },
- { "guint8", 3, 0 },
- { "int16_t", 4, 0 },
- { "int16", 4, 0 },
- { "gint16", 4, 0 },
- { "uint16_t", 5, 0 },
- { "uint16", 5, 0 },
- { "guint16", 5, 0 },
- { "int32_t", 6, 0 },
- { "int32", 6, 0 },
- { "gint32", 6, 0 },
- { "uint32_t", 7, 0 },
- { "uint32", 7, 0 },
- { "guint32", 7, 0 },
- { "int64_t", 8, 0 },
- { "int64", 8, 0 },
- { "gint64", 8, 0 },
- { "uint64_t", 9, 0 },
- { "uint64", 9, 0 },
- { "guint64", 9, 0 },
- { "float", 10, 0 },
- { "gfloat", 10, 0 },
- { "double", 11, 0 },
- { "gdouble", 11, 0 },
- { "gchar", 12, 0 },
- { "char", 12, 0 },
- { "GString", 13, 1 },
- { "int", 14, 0 },
- { "gint", 14, 0 },
- { "uint", 15, 0 },
- { "guint", 15, 0 },
- { "long", 16, 0 },
- { "glong", 16, 0 },
- { "ulong", 17, 0 },
- { "gulong", 17, 0 }
+ { "void", TYPE_TAG_VOID, 0 },
+ { "gpointer", TYPE_TAG_VOID, 1 },
+ { "gboolean", TYPE_TAG_BOOLEAN, 0 },
+ { "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 }
};
gint n_basic = G_N_ELEMENTS (basic);
@@ -152,7 +157,7 @@ parse_type_internal (gchar *str, gchar **rest)
*rest += strlen(basic[i].str);
*rest = g_strchug (*rest);
- if (**rest == '*')
+ if (**rest == '*' && !type->is_pointer)
{
type->is_pointer = TRUE;
(*rest)++;
@@ -169,14 +174,14 @@ parse_type_internal (gchar *str, gchar **rest)
{
if (g_str_has_prefix (*rest, "GList"))
{
- type->tag = 22;
+ type->tag = TYPE_TAG_LIST;
type->is_glist = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GList");
}
else
{
- type->tag = 23;
+ type->tag = TYPE_TAG_SLIST;
type->is_gslist = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GSList");
@@ -201,7 +206,7 @@ parse_type_internal (gchar *str, gchar **rest)
}
else if (g_str_has_prefix (*rest, "GHashTable"))
{
- type->tag = 24;
+ type->tag = TYPE_TAG_HASH;
type->is_ghashtable = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GHashTable");
@@ -233,7 +238,7 @@ parse_type_internal (gchar *str, gchar **rest)
}
else if (g_str_has_prefix (*rest, "GError"))
{
- type->tag = 25;
+ type->tag = TYPE_TAG_ERROR;
type->is_error = TRUE;
type->is_pointer = TRUE;
*rest += strlen ("GError");
@@ -254,7 +259,7 @@ parse_type_internal (gchar *str, gchar **rest)
}
else
{
- type->tag = 21;
+ type->tag = TYPE_TAG_INTERFACE;
type->is_interface = TRUE;
start = *rest;
@@ -283,7 +288,7 @@ parse_type_internal (gchar *str, gchar **rest)
array = (GIdlNodeType *)g_idl_node_new (G_IDL_NODE_TYPE);
- array->tag = 20;
+ array->tag = TYPE_TAG_ARRAY;
array->is_pointer = TRUE;
array->is_array = TRUE;
diff --git a/src/ginvoke.c b/src/ginvoke.c
index f1161bf3..fd05c89f 100644
--- a/src/ginvoke.c
+++ b/src/ginvoke.c
@@ -80,30 +80,28 @@ get_ffi_type (GITypeInfo *info)
case GI_TYPE_TAG_UINT64:
rettype = &ffi_type_uint64;
break;
- case GI_TYPE_TAG_FLOAT:
- rettype = &ffi_type_float;
- break;
- case GI_TYPE_TAG_DOUBLE:
- rettype = &ffi_type_double;
- break;
- case GI_TYPE_TAG_STRING:
- rettype = &ffi_type_pointer;
- break;
- case GI_TYPE_TAG_GSTRING:
- rettype = &ffi_type_pointer;
- break;
case GI_TYPE_TAG_INT:
rettype = &ffi_type_sint;
break;
case GI_TYPE_TAG_UINT:
rettype = &ffi_type_uint;
break;
+ case GI_TYPE_TAG_SSIZE: /* FIXME */
case GI_TYPE_TAG_LONG:
rettype = &ffi_type_slong;
break;
+ case GI_TYPE_TAG_SIZE: /* FIXME */
case GI_TYPE_TAG_ULONG:
rettype = &ffi_type_ulong;
break;
+ case GI_TYPE_TAG_FLOAT:
+ rettype = &ffi_type_float;
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ rettype = &ffi_type_double;
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_INTERFACE:
case GI_TYPE_TAG_GLIST:
diff --git a/src/girepository.h b/src/girepository.h
index 8839d5c1..4185da98 100644
--- a/src/girepository.h
+++ b/src/girepository.h
@@ -166,6 +166,8 @@ typedef union
guint v_uint;
glong v_long;
gulong v_ulong;
+ gssize v_ssize;
+ gsize v_size;
gchar * v_string;
gpointer v_pointer;
} GArgument;
@@ -233,14 +235,16 @@ typedef enum {
GI_TYPE_TAG_UINT32 = 7,
GI_TYPE_TAG_INT64 = 8,
GI_TYPE_TAG_UINT64 = 9,
- GI_TYPE_TAG_FLOAT = 10,
- GI_TYPE_TAG_DOUBLE = 11,
- GI_TYPE_TAG_STRING = 12,
- GI_TYPE_TAG_GSTRING = 13,
- GI_TYPE_TAG_INT = 14,
- GI_TYPE_TAG_UINT = 15,
- GI_TYPE_TAG_LONG = 16,
- GI_TYPE_TAG_ULONG = 17,
+ GI_TYPE_TAG_INT = 10,
+ GI_TYPE_TAG_UINT = 11,
+ GI_TYPE_TAG_LONG = 12,
+ GI_TYPE_TAG_ULONG = 13,
+ GI_TYPE_TAG_SSIZE = 14,
+ GI_TYPE_TAG_SIZE = 15,
+ GI_TYPE_TAG_FLOAT = 16,
+ GI_TYPE_TAG_DOUBLE = 17,
+ GI_TYPE_TAG_UTF8 = 18,
+ GI_TYPE_TAG_FILENAME = 19,
GI_TYPE_TAG_ARRAY = 20,
GI_TYPE_TAG_INTERFACE = 21,
GI_TYPE_TAG_GLIST = 22,
diff --git a/src/gmetadata.h b/src/gmetadata.h
index c09a6b1a..b20cade2 100644
--- a/src/gmetadata.h
+++ b/src/gmetadata.h
@@ -95,6 +95,36 @@ typedef struct
#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
+} TypeTag;
+
typedef union
{
struct
diff --git a/tests/array.test b/tests/array.test
index 671f8dcf..f204389b 100644
--- a/tests/array.test
+++ b/tests/array.test
@@ -4,7 +4,7 @@
<function name="test1" symbol="test1">
<return-type type="gboolean" />
<parameters>
- <parameter name="p1" type="gchar*[length=1,zero-terminated=1]" transfer="full" direction="in" />
+ <parameter name="p1" type="guint8[length=1,zero-terminated=1]" transfer="full" direction="in" />
<parameter name="p2" type="gint" direction="in" />
</parameters>
</function>
@@ -12,13 +12,13 @@
<return-type type="gboolean" />
<parameters>
<parameter name="p2" type="gint" direction="out" />
- <parameter name="p1" type="gchar*[length=0]" transfer="full" direction="out" />
+ <parameter name="p1" type="guint8[length=0]" transfer="full" direction="out" />
</parameters>
</function>
<function name="test3" symbol="test3">
<return-type type="gboolean" />
<parameters>
- <parameter name="p1" type="gchar*[zero-terminated=1]" transfer="full" direction="in" />
+ <parameter name="p1" type="guint8[zero-terminated=1]" transfer="full" direction="in" />
</parameters>
</function>
</namespace>
diff --git a/tests/boxed.test b/tests/boxed.test
index 1c312f7b..54c4436c 100644
--- a/tests/boxed.test
+++ b/tests/boxed.test
@@ -7,9 +7,9 @@
<return-type type="void" />
<parameters>
<parameter name="box" type="boxed1*" transfer="full" direction="in" />
- <parameter name="w" type="GList<boxed2*>" transfer="full" direction="in" />
- <parameter name="t" type="GHashTable<gchar*,gint64>" transfer="full" direction="in" />
- <parameter name="e" type="GError<>" transfer="full" direction="out" />
+ <parameter name="w" type="GList<boxed2*>*" transfer="full" direction="in" />
+ <parameter name="t" type="GHashTable<utf8,gint64>*" transfer="full" direction="in" />
+ <parameter name="e" type="GError*" transfer="full" direction="out" />
</parameters>
</method>
<method name="lart" symbol="lart">
diff --git a/tests/errors.test b/tests/errors.test
index f36f862c..ac67c369 100644
--- a/tests/errors.test
+++ b/tests/errors.test
@@ -15,7 +15,7 @@
<return-type type="gboolean" />
<parameters>
<parameter name="p1" type="gint" direction="in" null-ok="1" />
- <parameter name="p2" type="GError<Errors1,Errors2>" transfer="full" direction="out" />
+ <parameter name="p2" type="GError<Errors1,Errors2>*" transfer="full" direction="out" />
</parameters>
</function>
</namespace>