mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Add support for gunichar in typelib
Some API such as gtk_text_iter_get_char returns an individual "gunichar"; we should support this. https://bugzilla.gnome.org/show_bug.cgi?id=633197
This commit is contained in:
parent
30d5255a03
commit
f9a3bb7300
@ -220,6 +220,7 @@ g_field_info_get_field (GIFieldInfo *field_info,
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
@ -399,6 +400,7 @@ g_field_info_set_field (GIFieldInfo *field_info,
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32;
|
||||
result = TRUE;
|
||||
break;
|
||||
|
@ -1408,6 +1408,8 @@ g_type_tag_to_string (GITypeTag type)
|
||||
return "gfloat";
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
return "gdouble";
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
return "gunichar";
|
||||
case GI_TYPE_TAG_GTYPE:
|
||||
return "GType";
|
||||
case GI_TYPE_TAG_UTF8:
|
||||
|
1
girffi.c
1
girffi.c
@ -56,6 +56,7 @@ gi_type_tag_get_ffi_type (GITypeTag tag,
|
||||
case GI_TYPE_TAG_INT32:
|
||||
return &ffi_type_sint32;
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
return &ffi_type_uint32;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
return &ffi_type_sint64;
|
||||
|
@ -1415,7 +1415,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
||||
|
||||
*offset += sizeof (SimpleTypeBlob);
|
||||
|
||||
if (G_TYPE_TAG_IS_BASIC(type->tag))
|
||||
if (G_TYPE_TAG_IS_BASIC (type->tag))
|
||||
{
|
||||
blob->flags.reserved = 0;
|
||||
blob->flags.reserved2 = 0;
|
||||
|
@ -396,6 +396,7 @@ static BasicTypeInfo basic_types[] = {
|
||||
{ "GType", GI_TYPE_TAG_GTYPE, 0 },
|
||||
{ "utf8", GI_TYPE_TAG_UTF8, 1 },
|
||||
{ "filename", GI_TYPE_TAG_FILENAME,1 },
|
||||
{ "gunichar", GI_TYPE_TAG_UNICHAR, 0 },
|
||||
};
|
||||
|
||||
static const BasicTypeInfo *
|
||||
@ -579,7 +580,7 @@ parse_type_internal (GIrModule *module,
|
||||
|
||||
if (next)
|
||||
*next = (char*)str;
|
||||
g_assert (type->tag >= 0 && type->tag <= GI_TYPE_TAG_ERROR);
|
||||
g_assert (type->tag >= 0 && type->tag < GI_TYPE_TAG_N_TYPES);
|
||||
g_free (temporary_type);
|
||||
return type;
|
||||
|
||||
|
@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
||||
#define GI_IS_TYPE_INFO(info) \
|
||||
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_TYPE)
|
||||
|
||||
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY)
|
||||
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY || tag == GI_TYPE_TAG_UNICHAR)
|
||||
|
||||
const gchar* g_type_tag_to_string (GITypeTag type);
|
||||
const gchar* g_info_type_to_string (GIInfoType type);
|
||||
|
@ -652,6 +652,7 @@ validate_type_blob (GITypelib *typelib,
|
||||
}
|
||||
|
||||
if (simple->flags.tag >= GI_TYPE_TAG_UTF8 &&
|
||||
simple->flags.tag != GI_TYPE_TAG_UNICHAR &&
|
||||
!simple->flags.pointer)
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -1010,11 +1011,12 @@ validate_constant_blob (GITypelib *typelib,
|
||||
0, /* GSLIST */
|
||||
0, /* GHASH */
|
||||
0, /* ERROR */
|
||||
4 /* UNICHAR */
|
||||
};
|
||||
ConstantBlob *blob;
|
||||
SimpleTypeBlob *type;
|
||||
|
||||
g_assert (G_N_ELEMENTS (value_size) == GI_TYPE_TAG_ERROR + 1);
|
||||
g_assert (G_N_ELEMENTS (value_size) == GI_TYPE_TAG_N_TYPES);
|
||||
|
||||
if (typelib->len < offset + sizeof (ConstantBlob))
|
||||
{
|
||||
|
@ -322,6 +322,7 @@ typedef enum {
|
||||
* @GI_TYPE_TAG_UINT64: 64-bit unsigned integer
|
||||
* @GI_TYPE_TAG_FLOAT: float
|
||||
* @GI_TYPE_TAG_DOUBLE: double floating point
|
||||
* @GI_TYPE_TAG_UNICHAR: Unicode character
|
||||
* @GI_TYPE_TAG_GTYPE: a #GType
|
||||
* @GI_TYPE_TAG_UTF8: a UTF-8 encoded string
|
||||
* @GI_TYPE_TAG_FILENAME: a filename, encoded in the same encoding
|
||||
@ -352,18 +353,20 @@ typedef enum {
|
||||
GI_TYPE_TAG_GTYPE = 12,
|
||||
GI_TYPE_TAG_UTF8 = 13,
|
||||
GI_TYPE_TAG_FILENAME = 14,
|
||||
/* Non-basic types */
|
||||
/* Non-basic types; compare with G_TYPE_TAG_IS_BASIC */
|
||||
GI_TYPE_TAG_ARRAY = 15,
|
||||
GI_TYPE_TAG_INTERFACE = 16,
|
||||
GI_TYPE_TAG_GLIST = 17,
|
||||
GI_TYPE_TAG_GSLIST = 18,
|
||||
GI_TYPE_TAG_GHASH = 19,
|
||||
GI_TYPE_TAG_ERROR = 20
|
||||
GI_TYPE_TAG_ERROR = 20,
|
||||
/* Another basic type */
|
||||
GI_TYPE_TAG_UNICHAR = 21
|
||||
/* Note - there is only room currently for 32 tags.
|
||||
* See docs/typelib-format.txt SimpleTypeBlob definition */
|
||||
} GITypeTag;
|
||||
|
||||
#define GI_TYPE_TAG_N_TYPES (GI_TYPE_TAG_ERROR+1)
|
||||
#define GI_TYPE_TAG_N_TYPES (GI_TYPE_TAG_UNICHAR+1)
|
||||
|
||||
/* These were removed and no longer appear in the typelib;
|
||||
* instead, the machine-specific versions like INT32 are
|
||||
|
Loading…
Reference in New Issue
Block a user