mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
Revert "Add support for GArrays: add g_type_info_get_array_type() and properly scan GArray args"
This reverts commit 87291e08b0fd34b62e1ad9811c174108b38311a9.
This commit is contained in:
parent
e12cea0a53
commit
1301850f3d
17
ginfo.c
17
ginfo.c
@ -1093,23 +1093,6 @@ g_type_info_is_zero_terminated (GITypeInfo *info)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GIArrayType
|
|
||||||
g_type_info_get_array_type (GITypeInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
|
||||||
{
|
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
g_return_val_if_fail (blob->tag == GI_TYPE_TAG_ARRAY, -1);
|
|
||||||
|
|
||||||
return blob->array_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_type_info_get_n_error_domains (GITypeInfo *info)
|
g_type_info_get_n_error_domains (GITypeInfo *info)
|
||||||
{
|
{
|
||||||
|
@ -383,13 +383,6 @@ typedef enum {
|
|||||||
* See docs/typelib-format.txt SimpleTypeBlob definition */
|
* See docs/typelib-format.txt SimpleTypeBlob definition */
|
||||||
} GITypeTag;
|
} GITypeTag;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GI_ARRAY_TYPE_C,
|
|
||||||
GI_ARRAY_TYPE_ARRAY,
|
|
||||||
GI_ARRAY_TYPE_PTR_ARRAY,
|
|
||||||
GI_ARRAY_TYPE_BYTE_ARRAY
|
|
||||||
} GIArrayType;
|
|
||||||
|
|
||||||
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY)
|
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY)
|
||||||
|
|
||||||
const gchar* g_type_tag_to_string (GITypeTag type);
|
const gchar* g_type_tag_to_string (GITypeTag type);
|
||||||
@ -402,7 +395,6 @@ GIBaseInfo * g_type_info_get_interface (GITypeInfo *info);
|
|||||||
gint g_type_info_get_array_length (GITypeInfo *info);
|
gint g_type_info_get_array_length (GITypeInfo *info);
|
||||||
gint g_type_info_get_array_fixed_size(GITypeInfo *info);
|
gint g_type_info_get_array_fixed_size(GITypeInfo *info);
|
||||||
gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
|
gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
|
||||||
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
|
|
||||||
|
|
||||||
gint g_type_info_get_n_error_domains (GITypeInfo *info);
|
gint g_type_info_get_n_error_domains (GITypeInfo *info);
|
||||||
GIErrorDomainInfo *g_type_info_get_error_domain (GITypeInfo *info,
|
GIErrorDomainInfo *g_type_info_get_error_domain (GITypeInfo *info,
|
||||||
|
@ -1497,7 +1497,6 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
array->zero_terminated = type->zero_terminated;
|
array->zero_terminated = type->zero_terminated;
|
||||||
array->has_length = type->has_length;
|
array->has_length = type->has_length;
|
||||||
array->has_size = type->has_size;
|
array->has_size = type->has_size;
|
||||||
array->array_type = type->array_type;
|
|
||||||
array->reserved2 = 0;
|
array->reserved2 = 0;
|
||||||
if (array->has_length)
|
if (array->has_length)
|
||||||
array->dimensions.length = type->length;
|
array->dimensions.length = type->length;
|
||||||
|
@ -138,7 +138,6 @@ struct _GIrNodeType
|
|||||||
gint length;
|
gint length;
|
||||||
gboolean has_size;
|
gboolean has_size;
|
||||||
gint size;
|
gint size;
|
||||||
gint array_type;
|
|
||||||
|
|
||||||
GIrNodeType *parameter_type1;
|
GIrNodeType *parameter_type1;
|
||||||
GIrNodeType *parameter_type2;
|
GIrNodeType *parameter_type2;
|
||||||
|
44
girparser.c
44
girparser.c
@ -1717,40 +1717,22 @@ start_type (GMarkupParseContext *context,
|
|||||||
typenode->is_pointer = TRUE;
|
typenode->is_pointer = TRUE;
|
||||||
typenode->is_array = TRUE;
|
typenode->is_array = TRUE;
|
||||||
|
|
||||||
ctype = find_attribute ("c:type", attribute_names, attribute_values);
|
zero = find_attribute ("zero-terminated", attribute_names, attribute_values);
|
||||||
if (g_str_has_prefix (ctype, "GArray")) {
|
len = find_attribute ("length", attribute_names, attribute_values);
|
||||||
typenode->array_type = GI_ARRAY_TYPE_ARRAY;
|
size = find_attribute ("fixed-size", attribute_names, attribute_values);
|
||||||
} else if (g_str_has_prefix (ctype, "GByteArray")) {
|
|
||||||
typenode->array_type = GI_ARRAY_TYPE_BYTE_ARRAY;
|
|
||||||
} else if (g_str_has_prefix (ctype, "GPtrArray")) {
|
|
||||||
typenode->array_type = GI_ARRAY_TYPE_PTR_ARRAY;
|
|
||||||
} else {
|
|
||||||
typenode->array_type = GI_ARRAY_TYPE_C;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typenode->array_type == GI_ARRAY_TYPE_C) {
|
typenode->zero_terminated = !(zero && strcmp (zero, "1") != 0);
|
||||||
zero = find_attribute ("zero-terminated", attribute_names, attribute_values);
|
typenode->has_length = len != NULL;
|
||||||
len = find_attribute ("length", attribute_names, attribute_values);
|
typenode->length = typenode->has_length ? atoi (len) : -1;
|
||||||
size = find_attribute ("fixed-size", attribute_names, attribute_values);
|
|
||||||
|
|
||||||
typenode->has_length = len != NULL;
|
typenode->has_size = size != NULL;
|
||||||
typenode->length = typenode->has_length ? atoi (len) : -1;
|
typenode->size = typenode->has_size ? atoi (size) : -1;
|
||||||
|
|
||||||
typenode->has_size = size != NULL;
|
if (zero)
|
||||||
typenode->size = typenode->has_size ? atoi (size) : -1;
|
typenode->zero_terminated = strcmp(zero, "1") == 0;
|
||||||
|
else
|
||||||
if (zero)
|
/* If neither zero-terminated nor length nor fixed-size is given, assume zero-terminated. */
|
||||||
typenode->zero_terminated = strcmp(zero, "1") == 0;
|
typenode->zero_terminated = !(typenode->has_length || typenode->has_size);
|
||||||
else
|
|
||||||
/* If neither zero-terminated nor length nor fixed-size is given, assume zero-terminated. */
|
|
||||||
typenode->zero_terminated = !(typenode->has_length || typenode->has_size);
|
|
||||||
} else {
|
|
||||||
typenode->zero_terminated = FALSE;
|
|
||||||
typenode->has_length = FALSE;
|
|
||||||
typenode->length = -1;
|
|
||||||
typenode->has_size = FALSE;
|
|
||||||
typenode->size = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -524,14 +524,9 @@ typedef struct {
|
|||||||
* of the array. If both has_length and zero_terminated are set, the
|
* of the array. If both has_length and zero_terminated are set, the
|
||||||
* convention is to pass -1 for the length if the array is
|
* convention is to pass -1 for the length if the array is
|
||||||
* zero-terminated.
|
* zero-terminated.
|
||||||
* @has_size: Indicates that size is the fixed size of the array.
|
|
||||||
* @array_type: Indicates whether this is a C array, GArray, GPtrArray, or
|
|
||||||
* GByteArray. If something other than a C array, the length and element size
|
|
||||||
* are implicit in the structure.
|
|
||||||
* @length: The index of the parameter which is used to pass the length of the
|
* @length: The index of the parameter which is used to pass the length of the
|
||||||
* array. The parameter must be an integer type and have the same
|
* array. The parameter must be an integer type and have the same
|
||||||
* direction as this one.
|
* direction as this one.
|
||||||
* @size: The fixed size of the array.
|
|
||||||
* @type: The type of the array elements.
|
* @type: The type of the array elements.
|
||||||
*
|
*
|
||||||
* Arrays are passed by reference, thus is_pointer is always 1.
|
* Arrays are passed by reference, thus is_pointer is always 1.
|
||||||
@ -544,8 +539,7 @@ typedef struct {
|
|||||||
guint16 zero_terminated :1;
|
guint16 zero_terminated :1;
|
||||||
guint16 has_length :1;
|
guint16 has_length :1;
|
||||||
guint16 has_size :1;
|
guint16 has_size :1;
|
||||||
guint16 array_type :2;
|
guint16 reserved2 :5;
|
||||||
guint16 reserved2 :3;
|
|
||||||
|
|
||||||
union {
|
union {
|
||||||
guint16 length;
|
guint16 length;
|
||||||
|
Loading…
Reference in New Issue
Block a user