mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
[girepository] Remove trailing whitespace
This commit is contained in:
parent
a837d99ee6
commit
6b0463dd16
6
gdump.c
6
gdump.c
@ -158,7 +158,7 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out)
|
|||||||
GString *parent_str;
|
GString *parent_str;
|
||||||
GType parent;
|
GType parent;
|
||||||
gboolean first = TRUE;
|
gboolean first = TRUE;
|
||||||
|
|
||||||
parent = type;
|
parent = type;
|
||||||
parent_str = g_string_new ("");
|
parent_str = g_string_new ("");
|
||||||
do
|
do
|
||||||
@ -170,9 +170,9 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out)
|
|||||||
g_string_append_c (parent_str, ',');
|
g_string_append_c (parent_str, ',');
|
||||||
g_string_append (parent_str, g_type_name (parent));
|
g_string_append (parent_str, g_type_name (parent));
|
||||||
} while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID);
|
} while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID);
|
||||||
|
|
||||||
escaped_printf (out, " parents=\"%s\"", parent_str->str);
|
escaped_printf (out, " parents=\"%s\"", parent_str->str);
|
||||||
|
|
||||||
g_string_free (parent_str, TRUE);
|
g_string_free (parent_str, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
318
ginfo.c
318
ginfo.c
@ -48,10 +48,10 @@ struct _GIRealInfo
|
|||||||
|
|
||||||
GTypelib *typelib;
|
GTypelib *typelib;
|
||||||
guint32 offset;
|
guint32 offset;
|
||||||
|
|
||||||
guint32 type_is_embedded : 1; /* Used by GITypeInfo */
|
guint32 type_is_embedded : 1; /* Used by GITypeInfo */
|
||||||
guint32 reserved : 31;
|
guint32 reserved : 31;
|
||||||
|
|
||||||
gpointer reserved2[4];
|
gpointer reserved2[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ g_info_init (GIRealInfo *info,
|
|||||||
GIInfoType type,
|
GIInfoType type,
|
||||||
GIRepository *repository,
|
GIRepository *repository,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GTypelib *typelib,
|
GTypelib *typelib,
|
||||||
guint32 offset)
|
guint32 offset)
|
||||||
{
|
{
|
||||||
memset (info, 0, sizeof (GIRealInfo));
|
memset (info, 0, sizeof (GIRealInfo));
|
||||||
@ -100,7 +100,7 @@ GIBaseInfo *
|
|||||||
g_info_new_full (GIInfoType type,
|
g_info_new_full (GIInfoType type,
|
||||||
GIRepository *repository,
|
GIRepository *repository,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GTypelib *typelib,
|
GTypelib *typelib,
|
||||||
guint32 offset)
|
guint32 offset)
|
||||||
{
|
{
|
||||||
GIRealInfo *info;
|
GIRealInfo *info;
|
||||||
@ -108,7 +108,7 @@ g_info_new_full (GIInfoType type,
|
|||||||
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
|
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
|
||||||
|
|
||||||
info = g_new (GIRealInfo, 1);
|
info = g_new (GIRealInfo, 1);
|
||||||
|
|
||||||
g_info_init (info, type, repository, container, typelib, offset);
|
g_info_init (info, type, repository, container, typelib, offset);
|
||||||
info->ref_count = 1;
|
info->ref_count = 1;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ g_info_new_full (GIInfoType type,
|
|||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
g_info_new (GIInfoType type,
|
g_info_new (GIInfoType type,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GTypelib *typelib,
|
GTypelib *typelib,
|
||||||
guint32 offset)
|
guint32 offset)
|
||||||
{
|
{
|
||||||
return g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
|
return g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
|
||||||
@ -201,7 +201,7 @@ g_base_info_unref (GIBaseInfo *info)
|
|||||||
GIInfoType
|
GIInfoType
|
||||||
g_base_info_get_type (GIBaseInfo *info)
|
g_base_info_get_type (GIBaseInfo *info)
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((GIRealInfo*)info)->type;
|
return ((GIRealInfo*)info)->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
case GI_INFO_TYPE_FIELD:
|
case GI_INFO_TYPE_FIELD:
|
||||||
{
|
{
|
||||||
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -273,7 +273,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
case GI_INFO_TYPE_ARG:
|
case GI_INFO_TYPE_ARG:
|
||||||
{
|
{
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -304,14 +304,14 @@ g_base_info_get_namespace (GIBaseInfo *info)
|
|||||||
if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
|
if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
|
||||||
{
|
{
|
||||||
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
|
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
|
||||||
|
|
||||||
return unresolved->namespace;
|
return unresolved->namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, header->namespace);
|
return g_typelib_get_string (rinfo->typelib, header->namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
g_base_info_is_deprecated (GIBaseInfo *info)
|
g_base_info_is_deprecated (GIBaseInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*) info;
|
GIRealInfo *rinfo = (GIRealInfo*) info;
|
||||||
@ -365,7 +365,7 @@ g_base_info_is_deprecated (GIBaseInfo *info)
|
|||||||
default: ;
|
default: ;
|
||||||
/* no deprecation flag for these */
|
/* no deprecation flag for these */
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ cmp_attribute (const void *av,
|
|||||||
{
|
{
|
||||||
const AttributeBlob *a = av;
|
const AttributeBlob *a = av;
|
||||||
const AttributeBlob *b = bv;
|
const AttributeBlob *b = bv;
|
||||||
|
|
||||||
if (a->offset < b->offset)
|
if (a->offset < b->offset)
|
||||||
return -1;
|
return -1;
|
||||||
else if (a->offset == b->offset)
|
else if (a->offset == b->offset)
|
||||||
@ -415,7 +415,7 @@ find_first_attribute (GIRealInfo *rinfo)
|
|||||||
AttributeBlob blob, *first, *res, *previous;
|
AttributeBlob blob, *first, *res, *previous;
|
||||||
|
|
||||||
blob.offset = rinfo->offset;
|
blob.offset = rinfo->offset;
|
||||||
|
|
||||||
first = (AttributeBlob *) &rinfo->typelib->data[header->attributes];
|
first = (AttributeBlob *) &rinfo->typelib->data[header->attributes];
|
||||||
|
|
||||||
res = bsearch (&blob, first, header->n_attributes,
|
res = bsearch (&blob, first, header->n_attributes,
|
||||||
@ -545,13 +545,13 @@ g_function_info_get_flags (GIFunctionInfo *info)
|
|||||||
GIFunctionInfoFlags flags;
|
GIFunctionInfoFlags flags;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
|
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
/* Make sure we don't flag Constructors as methods */
|
/* Make sure we don't flag Constructors as methods */
|
||||||
if (!blob->constructor && !blob->is_static)
|
if (!blob->constructor && !blob->is_static)
|
||||||
flags = flags | GI_FUNCTION_IS_METHOD;
|
flags = flags | GI_FUNCTION_IS_METHOD;
|
||||||
|
|
||||||
if (blob->constructor)
|
if (blob->constructor)
|
||||||
flags = flags | GI_FUNCTION_IS_CONSTRUCTOR;
|
flags = flags | GI_FUNCTION_IS_CONSTRUCTOR;
|
||||||
|
|
||||||
@ -576,8 +576,8 @@ g_function_info_get_property (GIFunctionInfo *info)
|
|||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
|
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
|
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
|
||||||
|
|
||||||
return g_interface_info_get_property (container, blob->index);
|
return g_interface_info_get_property (container, blob->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
@ -586,8 +586,8 @@ g_function_info_get_vfunc (GIFunctionInfo *info)
|
|||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
|
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
|
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
|
||||||
|
|
||||||
return g_interface_info_get_vfunc (container, blob->index);
|
return g_interface_info_get_vfunc (container, blob->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GICallableInfo functions */
|
/* GICallableInfo functions */
|
||||||
@ -636,7 +636,7 @@ g_type_info_init (GIBaseInfo *info,
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)container;
|
GIRealInfo *rinfo = (GIRealInfo*)container;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
|
|
||||||
g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
|
g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
|
||||||
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
|
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
|
||||||
}
|
}
|
||||||
@ -734,7 +734,7 @@ g_callable_info_get_caller_owns (GICallableInfo *info)
|
|||||||
*
|
*
|
||||||
* Returns: The number of arguments this callable expects.
|
* Returns: The number of arguments this callable expects.
|
||||||
*/
|
*/
|
||||||
gint
|
gint
|
||||||
g_callable_info_get_n_args (GICallableInfo *info)
|
g_callable_info_get_n_args (GICallableInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -765,8 +765,8 @@ g_callable_info_get_arg (GICallableInfo *info,
|
|||||||
gint offset;
|
gint offset;
|
||||||
|
|
||||||
offset = signature_offset (info);
|
offset = signature_offset (info);
|
||||||
|
|
||||||
return (GIArgInfo *) g_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
|
return (GIArgInfo *) g_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
|
||||||
offset + header->signature_blob_size + n * header->arg_blob_size);
|
offset + header->signature_blob_size + n * header->arg_blob_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,9 +792,9 @@ g_callable_info_load_arg (GICallableInfo *info,
|
|||||||
gint offset;
|
gint offset;
|
||||||
|
|
||||||
offset = signature_offset (info);
|
offset = signature_offset (info);
|
||||||
|
|
||||||
g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
|
g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
|
||||||
offset + header->signature_blob_size + n * header->arg_blob_size);
|
offset + header->signature_blob_size + n * header->arg_blob_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GIArgInfo function */
|
/* GIArgInfo function */
|
||||||
@ -803,7 +803,7 @@ g_arg_info_get_direction (GIArgInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->in && blob->out)
|
if (blob->in && blob->out)
|
||||||
return GI_DIRECTION_INOUT;
|
return GI_DIRECTION_INOUT;
|
||||||
else if (blob->out)
|
else if (blob->out)
|
||||||
@ -817,7 +817,7 @@ g_arg_info_is_return_value (GIArgInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->return_value;
|
return blob->return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ g_arg_info_is_dipper (GIArgInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->dipper;
|
return blob->dipper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +835,7 @@ g_arg_info_is_optional (GIArgInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->optional;
|
return blob->optional;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ g_arg_info_may_be_null (GIArgInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->allow_none;
|
return blob->allow_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,7 +899,7 @@ GITypeInfo *
|
|||||||
g_arg_info_get_type (GIArgInfo *info)
|
g_arg_info_get_type (GIArgInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
|
||||||
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
|
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,7 +919,7 @@ g_arg_info_load_type (GIArgInfo *info,
|
|||||||
GITypeInfo *type)
|
GITypeInfo *type)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*) info;
|
GIRealInfo *rinfo = (GIRealInfo*) info;
|
||||||
g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
|
g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GITypeInfo functions */
|
/* GITypeInfo functions */
|
||||||
@ -928,13 +928,13 @@ g_type_info_is_pointer (GITypeInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
||||||
return type->flags.pointer;
|
return type->flags.pointer;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return iface->pointer;
|
return iface->pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -963,14 +963,14 @@ g_type_info_get_param_type (GITypeInfo *info,
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ParamTypeBlob *param = (ParamTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ParamTypeBlob *param = (ParamTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
switch (param->tag)
|
switch (param->tag)
|
||||||
{
|
{
|
||||||
case GI_TYPE_TAG_ARRAY:
|
case GI_TYPE_TAG_ARRAY:
|
||||||
case GI_TYPE_TAG_GLIST:
|
case GI_TYPE_TAG_GLIST:
|
||||||
case GI_TYPE_TAG_GSLIST:
|
case GI_TYPE_TAG_GSLIST:
|
||||||
case GI_TYPE_TAG_GHASH:
|
case GI_TYPE_TAG_GHASH:
|
||||||
@ -1041,7 +1041,7 @@ g_type_info_get_array_length (GITypeInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -1061,7 +1061,7 @@ g_type_info_get_array_fixed_size (GITypeInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -1081,7 +1081,7 @@ g_type_info_is_zero_terminated (GITypeInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -1098,7 +1098,7 @@ g_type_info_get_n_error_domains (GITypeInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -1116,7 +1116,7 @@ g_type_info_get_error_domain (GITypeInfo *info,
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -1146,13 +1146,13 @@ g_error_domain_info_get_codes (GIErrorDomainInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ErrorDomainBlob *blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
|
ErrorDomainBlob *blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return (GIInterfaceInfo *) g_info_from_entry (rinfo->repository,
|
return (GIInterfaceInfo *) g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->error_codes);
|
rinfo->typelib, blob->error_codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* GIValueInfo functions */
|
/* GIValueInfo functions */
|
||||||
glong
|
glong
|
||||||
g_value_info_get_value (GIValueInfo *info)
|
g_value_info_get_value (GIValueInfo *info)
|
||||||
{
|
{
|
||||||
@ -1187,7 +1187,7 @@ g_field_info_get_size (GIFieldInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->bits;
|
return blob->bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,7 +1196,7 @@ g_field_info_get_offset (GIFieldInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->struct_offset;
|
return blob->struct_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1253,19 +1253,19 @@ g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info)
|
|||||||
GType (* get_type_func) (void);
|
GType (* get_type_func) (void);
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
|
|
||||||
type_init = g_registered_type_info_get_type_init (info);
|
type_init = g_registered_type_info_get_type_init (info);
|
||||||
|
|
||||||
if (type_init == NULL)
|
if (type_init == NULL)
|
||||||
return G_TYPE_NONE;
|
return G_TYPE_NONE;
|
||||||
else if (!strcmp (type_init, "intern"))
|
else if (!strcmp (type_init, "intern"))
|
||||||
return G_TYPE_OBJECT;
|
return G_TYPE_OBJECT;
|
||||||
|
|
||||||
get_type_func = NULL;
|
get_type_func = NULL;
|
||||||
if (!g_typelib_symbol (rinfo->typelib,
|
if (!g_typelib_symbol (rinfo->typelib,
|
||||||
type_init,
|
type_init,
|
||||||
(void**) &get_type_func))
|
(void**) &get_type_func))
|
||||||
return G_TYPE_NONE;
|
return G_TYPE_NONE;
|
||||||
|
|
||||||
return (* get_type_func) ();
|
return (* get_type_func) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,7 +1275,7 @@ g_struct_info_get_n_fields (GIStructInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_fields;
|
return blob->n_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1305,8 +1305,8 @@ g_struct_info_get_field (GIStructInfo *info,
|
|||||||
gint n)
|
gint n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
|
||||||
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
||||||
g_struct_get_field_offset (info, n));
|
g_struct_get_field_offset (info, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1315,7 +1315,7 @@ g_struct_info_get_n_methods (GIStructInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_methods;
|
return blob->n_methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1325,11 +1325,11 @@ g_struct_info_get_method (GIStructInfo *info,
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
gint offset;
|
||||||
|
|
||||||
offset = g_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
|
offset = g_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
|
||||||
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1341,7 +1341,7 @@ find_method (GIBaseInfo *base,
|
|||||||
{
|
{
|
||||||
/* FIXME hash */
|
/* FIXME hash */
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)base;
|
GIRealInfo *rinfo = (GIRealInfo*)base;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < n_methods; i++)
|
for (i = 0; i < n_methods; i++)
|
||||||
@ -1350,12 +1350,12 @@ find_method (GIBaseInfo *base,
|
|||||||
const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
|
const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
|
||||||
|
|
||||||
if (strcmp (name, fname) == 0)
|
if (strcmp (name, fname) == 0)
|
||||||
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, base,
|
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, base,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
|
|
||||||
offset += header->function_blob_size;
|
offset += header->function_blob_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1365,7 +1365,7 @@ g_struct_info_find_method (GIStructInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->struct_blob_size
|
offset = rinfo->offset + header->struct_blob_size
|
||||||
@ -1395,7 +1395,7 @@ g_struct_info_get_alignment (GIStructInfo *info)
|
|||||||
/**
|
/**
|
||||||
* g_struct_info_is_gtype_struct:
|
* g_struct_info_is_gtype_struct:
|
||||||
* @info: GIStructInfo
|
* @info: GIStructInfo
|
||||||
*
|
*
|
||||||
* Return true if this structure represents the "class structure" for some
|
* Return true if this structure represents the "class structure" for some
|
||||||
* #GObject or #GInterface. This function is mainly useful to hide this kind of structure
|
* #GObject or #GInterface. This function is mainly useful to hide this kind of structure
|
||||||
* from generated public APIs.
|
* from generated public APIs.
|
||||||
@ -1425,10 +1425,10 @@ g_enum_info_get_value (GIEnumInfo *info,
|
|||||||
gint n)
|
gint n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
gint offset;
|
||||||
|
|
||||||
offset = rinfo->offset + header->enum_blob_size
|
offset = rinfo->offset + header->enum_blob_size
|
||||||
+ n * header->value_blob_size;
|
+ n * header->value_blob_size;
|
||||||
return (GIValueInfo *) g_info_new (GI_INFO_TYPE_VALUE, (GIBaseInfo*)info, rinfo->typelib, offset);
|
return (GIValueInfo *) g_info_new (GI_INFO_TYPE_VALUE, (GIBaseInfo*)info, rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
@ -1530,13 +1530,13 @@ g_object_info_get_field (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
||||||
+ n * header->field_blob_size;
|
+ n * header->field_blob_size;
|
||||||
|
|
||||||
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
|
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,7 +1546,7 @@ g_object_info_get_n_properties (GIObjectInfo *info)
|
|||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_properties;
|
return blob->n_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
GIPropertyInfo *
|
GIPropertyInfo *
|
||||||
@ -1555,15 +1555,15 @@ g_object_info_get_property (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ n * header->property_blob_size;
|
+ n * header->property_blob_size;
|
||||||
|
|
||||||
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
|
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,17 +1582,17 @@ g_object_info_get_method (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ n * header->function_blob_size;
|
+ n * header->function_blob_size;
|
||||||
|
|
||||||
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
@ -1601,7 +1601,7 @@ g_object_info_find_method (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
@ -1627,18 +1627,18 @@ g_object_info_get_signal (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ blob->n_methods * header->function_blob_size
|
+ blob->n_methods * header->function_blob_size
|
||||||
+ n * header->signal_blob_size;
|
+ n * header->signal_blob_size;
|
||||||
|
|
||||||
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
|
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
@ -1646,7 +1646,7 @@ g_object_info_get_n_vfuncs (GIObjectInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_vfuncs;
|
return blob->n_vfuncs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1656,19 +1656,19 @@ g_object_info_get_vfunc (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ blob->n_methods * header->function_blob_size
|
+ blob->n_methods * header->function_blob_size
|
||||||
+ blob->n_signals * header->signal_blob_size
|
+ blob->n_signals * header->signal_blob_size
|
||||||
+ n * header->vfunc_blob_size;
|
+ n * header->vfunc_blob_size;
|
||||||
|
|
||||||
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
|
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GIVFuncInfo *
|
static GIVFuncInfo *
|
||||||
@ -1733,7 +1733,7 @@ g_object_info_get_n_constants (GIObjectInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_constants;
|
return blob->n_constants;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1743,26 +1743,26 @@ g_object_info_get_constant (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ blob->n_methods * header->function_blob_size
|
+ blob->n_methods * header->function_blob_size
|
||||||
+ blob->n_signals * header->signal_blob_size
|
+ blob->n_signals * header->signal_blob_size
|
||||||
+ blob->n_vfuncs * header->vfunc_blob_size
|
+ blob->n_vfuncs * header->vfunc_blob_size
|
||||||
+ n * header->constant_blob_size;
|
+ n * header->constant_blob_size;
|
||||||
|
|
||||||
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_object_info_get_class_struct:
|
* g_object_info_get_class_struct:
|
||||||
* @info: A #GIObjectInfo to query
|
* @info: A #GIObjectInfo to query
|
||||||
*
|
*
|
||||||
* Every #GObject has two structures; an instance structure and a class
|
* Every #GObject has two structures; an instance structure and a class
|
||||||
* structure. This function returns the metadata for the class structure.
|
* structure. This function returns the metadata for the class structure.
|
||||||
*
|
*
|
||||||
@ -1809,7 +1809,7 @@ g_interface_info_get_n_properties (GIInterfaceInfo *info)
|
|||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_properties;
|
return blob->n_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
GIPropertyInfo *
|
GIPropertyInfo *
|
||||||
@ -1818,14 +1818,14 @@ g_interface_info_get_property (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->interface_blob_size
|
offset = rinfo->offset + header->interface_blob_size
|
||||||
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
||||||
+ n * header->property_blob_size;
|
+ n * header->property_blob_size;
|
||||||
|
|
||||||
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
|
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1844,16 +1844,16 @@ g_interface_info_get_method (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->interface_blob_size
|
offset = rinfo->offset + header->interface_blob_size
|
||||||
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ n * header->function_blob_size;
|
+ n * header->function_blob_size;
|
||||||
|
|
||||||
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
@ -1862,7 +1862,7 @@ g_interface_info_find_method (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->interface_blob_size
|
offset = rinfo->offset + header->interface_blob_size
|
||||||
@ -1887,17 +1887,17 @@ g_interface_info_get_signal (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->interface_blob_size
|
offset = rinfo->offset + header->interface_blob_size
|
||||||
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ blob->n_methods * header->function_blob_size
|
+ blob->n_methods * header->function_blob_size
|
||||||
+ n * header->signal_blob_size;
|
+ n * header->signal_blob_size;
|
||||||
|
|
||||||
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
|
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
@ -1915,18 +1915,18 @@ g_interface_info_get_vfunc (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->interface_blob_size
|
offset = rinfo->offset + header->interface_blob_size
|
||||||
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ blob->n_methods * header->function_blob_size
|
+ blob->n_methods * header->function_blob_size
|
||||||
+ blob->n_signals * header->signal_blob_size
|
+ blob->n_signals * header->signal_blob_size
|
||||||
+ n * header->vfunc_blob_size;
|
+ n * header->vfunc_blob_size;
|
||||||
|
|
||||||
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
|
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1962,7 +1962,7 @@ g_interface_info_get_n_constants (GIInterfaceInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_constants;
|
return blob->n_constants;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1972,19 +1972,19 @@ g_interface_info_get_constant (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
gint offset;
|
gint offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
offset = rinfo->offset + header->interface_blob_size
|
offset = rinfo->offset + header->interface_blob_size
|
||||||
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
|
||||||
+ blob->n_properties * header->property_blob_size
|
+ blob->n_properties * header->property_blob_size
|
||||||
+ blob->n_methods * header->function_blob_size
|
+ blob->n_methods * header->function_blob_size
|
||||||
+ blob->n_signals * header->signal_blob_size
|
+ blob->n_signals * header->signal_blob_size
|
||||||
+ blob->n_vfuncs * header->vfunc_blob_size
|
+ blob->n_vfuncs * header->vfunc_blob_size
|
||||||
+ n * header->constant_blob_size;
|
+ n * header->constant_blob_size;
|
||||||
|
|
||||||
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2015,7 +2015,7 @@ g_property_info_get_flags (GIPropertyInfo *info)
|
|||||||
GParamFlags flags;
|
GParamFlags flags;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
|
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
if (blob->readable)
|
if (blob->readable)
|
||||||
@ -2126,7 +2126,7 @@ g_vfunc_info_get_offset (GIVFuncInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->struct_offset;
|
return blob->struct_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2138,7 +2138,7 @@ g_vfunc_info_get_signal (GIVFuncInfo *info)
|
|||||||
|
|
||||||
if (blob->class_closure)
|
if (blob->class_closure)
|
||||||
return g_interface_info_get_signal ((GIInterfaceInfo *)rinfo->container, blob->signal);
|
return g_interface_info_get_signal ((GIInterfaceInfo *)rinfo->container, blob->signal);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2179,12 +2179,12 @@ GITypeInfo *
|
|||||||
g_constant_info_get_type (GIConstantInfo *info)
|
g_constant_info_get_type (GIConstantInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
|
||||||
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
|
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_constant_info_get_value (GIConstantInfo *info,
|
g_constant_info_get_value (GIConstantInfo *info,
|
||||||
GArgument *value)
|
GArgument *value)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -2266,7 +2266,7 @@ g_union_info_get_n_fields (GIUnionInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_fields;
|
return blob->n_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2275,10 +2275,10 @@ g_union_info_get_field (GIUnionInfo *info,
|
|||||||
gint n)
|
gint n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
|
||||||
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
||||||
rinfo->offset + header->union_blob_size +
|
rinfo->offset + header->union_blob_size +
|
||||||
n * header->field_blob_size);
|
n * header->field_blob_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2287,7 +2287,7 @@ g_union_info_get_n_methods (GIUnionInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->n_functions;
|
return blob->n_functions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2297,13 +2297,13 @@ g_union_info_get_method (GIUnionInfo *info,
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
gint offset;
|
||||||
|
|
||||||
offset = rinfo->offset + header->union_blob_size
|
offset = rinfo->offset + header->union_blob_size
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ n * header->function_blob_size;
|
+ n * header->function_blob_size;
|
||||||
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2312,7 +2312,7 @@ g_union_info_is_discriminated (GIUnionInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->discriminated;
|
return blob->discriminated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2321,7 +2321,7 @@ g_union_info_get_discriminator_offset (GIUnionInfo *info)
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return blob->discriminator_offset;
|
return blob->discriminator_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2329,7 +2329,7 @@ GITypeInfo *
|
|||||||
g_union_info_get_discriminator_type (GIUnionInfo *info)
|
g_union_info_get_discriminator_type (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
|
||||||
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
|
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2339,19 +2339,19 @@ g_union_info_get_discriminator (GIUnionInfo *info,
|
|||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->discriminated)
|
if (blob->discriminated)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
gint offset;
|
||||||
|
|
||||||
offset = rinfo->offset + header->union_blob_size
|
offset = rinfo->offset + header->union_blob_size
|
||||||
+ blob->n_fields * header->field_blob_size
|
+ blob->n_fields * header->field_blob_size
|
||||||
+ blob->n_functions * header->function_blob_size
|
+ blob->n_functions * header->function_blob_size
|
||||||
+ n * header->constant_blob_size;
|
+ n * header->constant_blob_size;
|
||||||
|
|
||||||
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
44
ginvoke.c
44
ginvoke.c
@ -40,31 +40,31 @@ g_invoke_error_quark (void)
|
|||||||
/**
|
/**
|
||||||
* g_function_info_invoke:
|
* g_function_info_invoke:
|
||||||
* @info: a #GIFunctionInfo describing the function to invoke
|
* @info: a #GIFunctionInfo describing the function to invoke
|
||||||
* @in_args: an array of #GArgument<!-- -->s, one for each in
|
* @in_args: an array of #GArgument<!-- -->s, one for each in
|
||||||
* parameter of @info. If there are no in parameter, @in_args
|
* parameter of @info. If there are no in parameter, @in_args
|
||||||
* can be %NULL
|
* can be %NULL
|
||||||
* @n_in_args: the length of the @in_args array
|
* @n_in_args: the length of the @in_args array
|
||||||
* @out_args: an array of #GArgument<!-- -->s, one for each out
|
* @out_args: an array of #GArgument<!-- -->s, one for each out
|
||||||
* parameter of @info. If there are no out parameters, @out_args
|
* parameter of @info. If there are no out parameters, @out_args
|
||||||
* may be %NULL
|
* may be %NULL
|
||||||
* @n_out_args: the length of the @out_args array
|
* @n_out_args: the length of the @out_args array
|
||||||
* @return_value: return location for the return value of the
|
* @return_value: return location for the return value of the
|
||||||
* function. If the function returns void, @return_value may be
|
* function. If the function returns void, @return_value may be
|
||||||
* %NULL
|
* %NULL
|
||||||
* @error: return location for detailed error information, or %NULL
|
* @error: return location for detailed error information, or %NULL
|
||||||
*
|
*
|
||||||
* Invokes the function described in @info with the given
|
* Invokes the function described in @info with the given
|
||||||
* arguments. Note that inout parameters must appear in both
|
* arguments. Note that inout parameters must appear in both
|
||||||
* argument lists. This function uses dlsym() to obtain a pointer
|
* argument lists. This function uses dlsym() to obtain a pointer
|
||||||
* to the function, so the library or shared object containing the
|
* to the function, so the library or shared object containing the
|
||||||
* described function must either be linked to the caller, or must
|
* described function must either be linked to the caller, or must
|
||||||
* have been dlopen()<!-- -->ed before calling this function.
|
* have been dlopen()<!-- -->ed before calling this function.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the function has been invoked, %FALSE if an
|
* Returns: %TRUE if the function has been invoked, %FALSE if an
|
||||||
* error occurred.
|
* error occurred.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
g_function_info_invoke (GIFunctionInfo *info,
|
g_function_info_invoke (GIFunctionInfo *info,
|
||||||
const GArgument *in_args,
|
const GArgument *in_args,
|
||||||
int n_in_args,
|
int n_in_args,
|
||||||
const GArgument *out_args,
|
const GArgument *out_args,
|
||||||
@ -134,7 +134,7 @@ g_function_info_invoke (GIFunctionInfo *info,
|
|||||||
|
|
||||||
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
|
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
|
||||||
args = g_alloca (sizeof (gpointer) * n_invoke_args);
|
args = g_alloca (sizeof (gpointer) * n_invoke_args);
|
||||||
|
|
||||||
if (is_method)
|
if (is_method)
|
||||||
{
|
{
|
||||||
atypes[0] = &ffi_type_pointer;
|
atypes[0] = &ffi_type_pointer;
|
||||||
@ -162,7 +162,7 @@ g_function_info_invoke (GIFunctionInfo *info,
|
|||||||
|
|
||||||
args[i+offset] = (gpointer)&in_args[in_pos];
|
args[i+offset] = (gpointer)&in_args[in_pos];
|
||||||
in_pos++;
|
in_pos++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GI_DIRECTION_OUT:
|
case GI_DIRECTION_OUT:
|
||||||
atypes[i+offset] = &ffi_type_pointer;
|
atypes[i+offset] = &ffi_type_pointer;
|
||||||
@ -172,12 +172,12 @@ g_function_info_invoke (GIFunctionInfo *info,
|
|||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_INVOKE_ERROR,
|
G_INVOKE_ERROR,
|
||||||
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
|
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
|
||||||
"Too few \"out\" arguments (handling out)");
|
"Too few \"out\" arguments (handling out)");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i+offset] = (gpointer)&out_args[out_pos];
|
args[i+offset] = (gpointer)&out_args[out_pos];
|
||||||
out_pos++;
|
out_pos++;
|
||||||
break;
|
break;
|
||||||
case GI_DIRECTION_INOUT:
|
case GI_DIRECTION_INOUT:
|
||||||
atypes[i+offset] = &ffi_type_pointer;
|
atypes[i+offset] = &ffi_type_pointer;
|
||||||
@ -196,13 +196,13 @@ g_function_info_invoke (GIFunctionInfo *info,
|
|||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_INVOKE_ERROR,
|
G_INVOKE_ERROR,
|
||||||
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
|
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
|
||||||
"Too few \"out\" arguments (handling inout)");
|
"Too few \"out\" arguments (handling inout)");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i+offset] = (gpointer)&in_args[in_pos];
|
args[i+offset] = (gpointer)&in_args[in_pos];
|
||||||
in_pos++;
|
in_pos++;
|
||||||
out_pos++;
|
out_pos++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -229,7 +229,7 @@ g_function_info_invoke (GIFunctionInfo *info,
|
|||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_INVOKE_ERROR,
|
G_INVOKE_ERROR,
|
||||||
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
|
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
|
||||||
"Too many \"out\" arguments (at end)");
|
"Too many \"out\" arguments (at end)");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,17 +382,17 @@ gi_cclosure_marshal_generic (GClosure *closure,
|
|||||||
ffi_cif cif;
|
ffi_cif cif;
|
||||||
GCClosure *cc = (GCClosure*) closure;
|
GCClosure *cc = (GCClosure*) closure;
|
||||||
|
|
||||||
if (return_gvalue && G_VALUE_TYPE (return_gvalue))
|
if (return_gvalue && G_VALUE_TYPE (return_gvalue))
|
||||||
{
|
{
|
||||||
rtype = value_to_ffi_type (return_gvalue, &rvalue);
|
rtype = value_to_ffi_type (return_gvalue, &rvalue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rtype = &ffi_type_void;
|
rtype = &ffi_type_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
rvalue = g_alloca (MAX (rtype->size, sizeof (ffi_arg)));
|
rvalue = g_alloca (MAX (rtype->size, sizeof (ffi_arg)));
|
||||||
|
|
||||||
n_args = n_param_values + 1;
|
n_args = n_param_values + 1;
|
||||||
atypes = g_alloca (sizeof (ffi_type *) * n_args);
|
atypes = g_alloca (sizeof (ffi_type *) * n_args);
|
||||||
args = g_alloca (sizeof (gpointer) * n_args);
|
args = g_alloca (sizeof (gpointer) * n_args);
|
||||||
@ -401,7 +401,7 @@ gi_cclosure_marshal_generic (GClosure *closure,
|
|||||||
{
|
{
|
||||||
if (G_CCLOSURE_SWAP_DATA (closure))
|
if (G_CCLOSURE_SWAP_DATA (closure))
|
||||||
{
|
{
|
||||||
atypes[n_args-1] = value_to_ffi_type (param_values + 0,
|
atypes[n_args-1] = value_to_ffi_type (param_values + 0,
|
||||||
&args[n_args-1]);
|
&args[n_args-1]);
|
||||||
atypes[0] = &ffi_type_pointer;
|
atypes[0] = &ffi_type_pointer;
|
||||||
args[0] = &closure->data;
|
args[0] = &closure->data;
|
||||||
|
110
girepository.c
110
girepository.c
@ -40,7 +40,7 @@ static GIRepository *default_repository = NULL;
|
|||||||
static GSList *search_path = NULL;
|
static GSList *search_path = NULL;
|
||||||
static GSList *override_search_path = NULL;
|
static GSList *override_search_path = NULL;
|
||||||
|
|
||||||
struct _GIRepositoryPrivate
|
struct _GIRepositoryPrivate
|
||||||
{
|
{
|
||||||
GHashTable *typelibs; /* (string) namespace -> GTypelib */
|
GHashTable *typelibs; /* (string) namespace -> GTypelib */
|
||||||
GHashTable *lazy_typelibs; /* (string) namespace-version -> GTypelib */
|
GHashTable *lazy_typelibs; /* (string) namespace-version -> GTypelib */
|
||||||
@ -49,16 +49,16 @@ struct _GIRepositoryPrivate
|
|||||||
|
|
||||||
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_irepository_init (GIRepository *repository)
|
g_irepository_init (GIRepository *repository)
|
||||||
{
|
{
|
||||||
repository->priv = G_TYPE_INSTANCE_GET_PRIVATE (repository, G_TYPE_IREPOSITORY,
|
repository->priv = G_TYPE_INSTANCE_GET_PRIVATE (repository, G_TYPE_IREPOSITORY,
|
||||||
GIRepositoryPrivate);
|
GIRepositoryPrivate);
|
||||||
repository->priv->typelibs
|
repository->priv->typelibs
|
||||||
= g_hash_table_new_full (g_str_hash, g_str_equal,
|
= g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
(GDestroyNotify) NULL,
|
(GDestroyNotify) NULL,
|
||||||
(GDestroyNotify) g_typelib_free);
|
(GDestroyNotify) g_typelib_free);
|
||||||
repository->priv->lazy_typelibs
|
repository->priv->lazy_typelibs
|
||||||
= g_hash_table_new (g_str_hash, g_str_equal);
|
= g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
repository->priv->info_by_gtype
|
repository->priv->info_by_gtype
|
||||||
= g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
= g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||||
@ -74,7 +74,7 @@ g_irepository_finalize (GObject *object)
|
|||||||
g_hash_table_destroy (repository->priv->typelibs);
|
g_hash_table_destroy (repository->priv->typelibs);
|
||||||
g_hash_table_destroy (repository->priv->lazy_typelibs);
|
g_hash_table_destroy (repository->priv->lazy_typelibs);
|
||||||
g_hash_table_destroy (repository->priv->info_by_gtype);
|
g_hash_table_destroy (repository->priv->info_by_gtype);
|
||||||
|
|
||||||
(* G_OBJECT_CLASS (g_irepository_parent_class)->finalize) (G_OBJECT (repository));
|
(* G_OBJECT_CLASS (g_irepository_parent_class)->finalize) (G_OBJECT (repository));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ g_irepository_class_init (GIRepositoryClass *class)
|
|||||||
|
|
||||||
gobject_class->finalize = g_irepository_finalize;
|
gobject_class->finalize = g_irepository_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (class, sizeof (GIRepositoryPrivate));
|
g_type_class_add_private (class, sizeof (GIRepositoryPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -170,11 +170,11 @@ GSList *
|
|||||||
build_search_path_with_overrides (void)
|
build_search_path_with_overrides (void)
|
||||||
{
|
{
|
||||||
GSList *result;
|
GSList *result;
|
||||||
if (override_search_path != NULL)
|
if (override_search_path != NULL)
|
||||||
{
|
{
|
||||||
result = g_slist_copy (override_search_path);
|
result = g_slist_copy (override_search_path);
|
||||||
g_slist_last (result)->next = g_slist_copy (search_path);
|
g_slist_last (result)->next = g_slist_copy (search_path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = g_slist_copy (search_path);
|
result = g_slist_copy (search_path);
|
||||||
return result;
|
return result;
|
||||||
@ -216,7 +216,7 @@ get_repository (GIRepository *repository)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GTypelib *
|
static GTypelib *
|
||||||
check_version_conflict (GTypelib *typelib,
|
check_version_conflict (GTypelib *typelib,
|
||||||
const gchar *namespace,
|
const gchar *namespace,
|
||||||
const gchar *expected_version,
|
const gchar *expected_version,
|
||||||
char **version_conflict)
|
char **version_conflict)
|
||||||
@ -230,11 +230,11 @@ check_version_conflict (GTypelib *typelib,
|
|||||||
*version_conflict = NULL;
|
*version_conflict = NULL;
|
||||||
return typelib;
|
return typelib;
|
||||||
}
|
}
|
||||||
|
|
||||||
header = (Header*)typelib->data;
|
header = (Header*)typelib->data;
|
||||||
loaded_version = g_typelib_get_string (typelib, header->nsversion);
|
loaded_version = g_typelib_get_string (typelib, header->nsversion);
|
||||||
g_assert (loaded_version != NULL);
|
g_assert (loaded_version != NULL);
|
||||||
|
|
||||||
if (strcmp (expected_version, loaded_version) != 0)
|
if (strcmp (expected_version, loaded_version) != 0)
|
||||||
{
|
{
|
||||||
if (version_conflict)
|
if (version_conflict)
|
||||||
@ -259,7 +259,7 @@ get_registered_status (GIRepository *repository,
|
|||||||
if (lazy_status)
|
if (lazy_status)
|
||||||
*lazy_status = FALSE;
|
*lazy_status = FALSE;
|
||||||
typelib = g_hash_table_lookup (repository->priv->typelibs, namespace);
|
typelib = g_hash_table_lookup (repository->priv->typelibs, namespace);
|
||||||
if (typelib)
|
if (typelib)
|
||||||
return check_version_conflict (typelib, namespace, version, version_conflict);
|
return check_version_conflict (typelib, namespace, version, version_conflict);
|
||||||
typelib = g_hash_table_lookup (repository->priv->lazy_typelibs, namespace);
|
typelib = g_hash_table_lookup (repository->priv->lazy_typelibs, namespace);
|
||||||
if (!typelib)
|
if (!typelib)
|
||||||
@ -291,7 +291,7 @@ load_dependencies_recurse (GIRepository *repository,
|
|||||||
if (dependencies != NULL)
|
if (dependencies != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; dependencies[i]; i++)
|
for (i = 0; dependencies[i]; i++)
|
||||||
{
|
{
|
||||||
char *dependency = dependencies[i];
|
char *dependency = dependencies[i];
|
||||||
@ -302,7 +302,7 @@ load_dependencies_recurse (GIRepository *repository,
|
|||||||
last_dash = strrchr (dependency, '-');
|
last_dash = strrchr (dependency, '-');
|
||||||
dependency_namespace = g_strndup (dependency, last_dash - dependency);
|
dependency_namespace = g_strndup (dependency, last_dash - dependency);
|
||||||
dependency_version = last_dash+1;
|
dependency_version = last_dash+1;
|
||||||
|
|
||||||
if (!g_irepository_require (repository, dependency_namespace, dependency_version,
|
if (!g_irepository_require (repository, dependency_namespace, dependency_version,
|
||||||
0, error))
|
0, error))
|
||||||
{
|
{
|
||||||
@ -329,7 +329,7 @@ register_internal (GIRepository *repository,
|
|||||||
const gchar *version;
|
const gchar *version;
|
||||||
|
|
||||||
g_return_val_if_fail (typelib != NULL, FALSE);
|
g_return_val_if_fail (typelib != NULL, FALSE);
|
||||||
|
|
||||||
header = (Header *)typelib->data;
|
header = (Header *)typelib->data;
|
||||||
|
|
||||||
g_return_val_if_fail (header != NULL, FALSE);
|
g_return_val_if_fail (header != NULL, FALSE);
|
||||||
@ -339,9 +339,9 @@ register_internal (GIRepository *repository,
|
|||||||
|
|
||||||
if (lazy)
|
if (lazy)
|
||||||
{
|
{
|
||||||
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
|
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
|
||||||
namespace));
|
namespace));
|
||||||
g_hash_table_insert (repository->priv->lazy_typelibs,
|
g_hash_table_insert (repository->priv->lazy_typelibs,
|
||||||
build_typelib_key (namespace, source), (void *)typelib);
|
build_typelib_key (namespace, source), (void *)typelib);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -352,9 +352,9 @@ register_internal (GIRepository *repository,
|
|||||||
/* First, try loading all the dependencies */
|
/* First, try loading all the dependencies */
|
||||||
if (!load_dependencies_recurse (repository, typelib, error))
|
if (!load_dependencies_recurse (repository, typelib, error))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Check if we are transitioning from lazily loaded state */
|
/* Check if we are transitioning from lazily loaded state */
|
||||||
if (g_hash_table_lookup_extended (repository->priv->lazy_typelibs,
|
if (g_hash_table_lookup_extended (repository->priv->lazy_typelibs,
|
||||||
namespace,
|
namespace,
|
||||||
(gpointer)&key, &value))
|
(gpointer)&key, &value))
|
||||||
g_hash_table_remove (repository->priv->lazy_typelibs, key);
|
g_hash_table_remove (repository->priv->lazy_typelibs, key);
|
||||||
@ -416,7 +416,7 @@ g_irepository_load_typelib (GIRepository *repository,
|
|||||||
namespace = g_typelib_get_string (typelib, header->namespace);
|
namespace = g_typelib_get_string (typelib, header->namespace);
|
||||||
nsversion = g_typelib_get_string (typelib, header->nsversion);
|
nsversion = g_typelib_get_string (typelib, header->nsversion);
|
||||||
|
|
||||||
if (get_registered_status (repository, namespace, nsversion, allow_lazy,
|
if (get_registered_status (repository, namespace, nsversion, allow_lazy,
|
||||||
&is_lazy, &version_conflict))
|
&is_lazy, &version_conflict))
|
||||||
{
|
{
|
||||||
if (version_conflict != NULL)
|
if (version_conflict != NULL)
|
||||||
@ -429,7 +429,7 @@ g_irepository_load_typelib (GIRepository *repository,
|
|||||||
}
|
}
|
||||||
return namespace;
|
return namespace;
|
||||||
}
|
}
|
||||||
return register_internal (repository, "<builtin>",
|
return register_internal (repository, "<builtin>",
|
||||||
allow_lazy, typelib, error);
|
allow_lazy, typelib, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,11 +445,11 @@ g_irepository_load_typelib (GIRepository *repository,
|
|||||||
* metadata in the namespace, you should call #g_irepository_require
|
* metadata in the namespace, you should call #g_irepository_require
|
||||||
* instead which will ensure the namespace is loaded, and return as
|
* instead which will ensure the namespace is loaded, and return as
|
||||||
* quickly as this function will if it has already been loaded.
|
* quickly as this function will if it has already been loaded.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if namespace-version is loaded, %FALSE otherwise
|
* Returns: %TRUE if namespace-version is loaded, %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
g_irepository_is_registered (GIRepository *repository,
|
g_irepository_is_registered (GIRepository *repository,
|
||||||
const gchar *namespace,
|
const gchar *namespace,
|
||||||
const gchar *version)
|
const gchar *version)
|
||||||
{
|
{
|
||||||
@ -470,10 +470,10 @@ g_irepository_is_registered (GIRepository *repository,
|
|||||||
* All methods on #GIRepository also accept %NULL as an instance
|
* All methods on #GIRepository also accept %NULL as an instance
|
||||||
* parameter to mean this default repository, which is usually more
|
* parameter to mean this default repository, which is usually more
|
||||||
* convenient for C.
|
* convenient for C.
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): The global singleton #GIRepository
|
* Returns: (transfer none): The global singleton #GIRepository
|
||||||
*/
|
*/
|
||||||
GIRepository *
|
GIRepository *
|
||||||
g_irepository_get_default (void)
|
g_irepository_get_default (void)
|
||||||
{
|
{
|
||||||
return get_repository (NULL);
|
return get_repository (NULL);
|
||||||
@ -490,7 +490,7 @@ g_irepository_get_default (void)
|
|||||||
*
|
*
|
||||||
* Returns: number of metadata entries
|
* Returns: number of metadata entries
|
||||||
*/
|
*/
|
||||||
gint
|
gint
|
||||||
g_irepository_get_n_infos (GIRepository *repository,
|
g_irepository_get_n_infos (GIRepository *repository,
|
||||||
const gchar *namespace)
|
const gchar *namespace)
|
||||||
{
|
{
|
||||||
@ -500,7 +500,7 @@ g_irepository_get_n_infos (GIRepository *repository,
|
|||||||
g_return_val_if_fail (namespace != NULL, -1);
|
g_return_val_if_fail (namespace != NULL, -1);
|
||||||
|
|
||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
|
|
||||||
typelib = get_registered (repository, namespace, NULL);
|
typelib = get_registered (repository, namespace, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (typelib != NULL, -1);
|
g_return_val_if_fail (typelib != NULL, -1);
|
||||||
@ -533,7 +533,7 @@ find_interface (gpointer key,
|
|||||||
gint n_entries;
|
gint n_entries;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
const gchar *type;
|
const gchar *type;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
n_entries = ((Header *)typelib->data)->n_local_entries;
|
n_entries = ((Header *)typelib->data)->n_local_entries;
|
||||||
@ -624,7 +624,7 @@ find_interface (gpointer key,
|
|||||||
*
|
*
|
||||||
* Returns: #GIBaseInfo containing metadata
|
* Returns: #GIBaseInfo containing metadata
|
||||||
*/
|
*/
|
||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
g_irepository_get_info (GIRepository *repository,
|
g_irepository_get_info (GIRepository *repository,
|
||||||
const gchar *namespace,
|
const gchar *namespace,
|
||||||
gint index)
|
gint index)
|
||||||
@ -643,12 +643,12 @@ g_irepository_get_info (GIRepository *repository,
|
|||||||
data.iface = NULL;
|
data.iface = NULL;
|
||||||
|
|
||||||
typelib = get_registered (repository, namespace, NULL);
|
typelib = get_registered (repository, namespace, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (typelib != NULL, NULL);
|
g_return_val_if_fail (typelib != NULL, NULL);
|
||||||
|
|
||||||
find_interface ((void *)namespace, typelib, &data);
|
find_interface ((void *)namespace, typelib, &data);
|
||||||
|
|
||||||
return data.iface;
|
return data.iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -665,7 +665,7 @@ g_irepository_get_info (GIRepository *repository,
|
|||||||
*
|
*
|
||||||
* Returns: #GIBaseInfo representing metadata about @type, or %NULL
|
* Returns: #GIBaseInfo representing metadata about @type, or %NULL
|
||||||
*/
|
*/
|
||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
g_irepository_find_by_gtype (GIRepository *repository,
|
g_irepository_find_by_gtype (GIRepository *repository,
|
||||||
GType gtype)
|
GType gtype)
|
||||||
{
|
{
|
||||||
@ -718,7 +718,7 @@ g_irepository_find_by_gtype (GIRepository *repository,
|
|||||||
*
|
*
|
||||||
* Returns: #GIBaseInfo representing metadata about @name, or %NULL
|
* Returns: #GIBaseInfo representing metadata about @name, or %NULL
|
||||||
*/
|
*/
|
||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
g_irepository_find_by_name (GIRepository *repository,
|
g_irepository_find_by_name (GIRepository *repository,
|
||||||
const gchar *namespace,
|
const gchar *namespace,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
@ -737,7 +737,7 @@ g_irepository_find_by_name (GIRepository *repository,
|
|||||||
data.iface = NULL;
|
data.iface = NULL;
|
||||||
|
|
||||||
typelib = get_registered (repository, namespace, NULL);
|
typelib = get_registered (repository, namespace, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (typelib != NULL, NULL);
|
g_return_val_if_fail (typelib != NULL, NULL);
|
||||||
|
|
||||||
find_interface ((void *)namespace, typelib, &data);
|
find_interface ((void *)namespace, typelib, &data);
|
||||||
@ -763,7 +763,7 @@ collect_namespaces (gpointer key,
|
|||||||
*
|
*
|
||||||
* Returns: (utf8) (transfer full): List of namespaces
|
* Returns: (utf8) (transfer full): List of namespaces
|
||||||
*/
|
*/
|
||||||
gchar **
|
gchar **
|
||||||
g_irepository_get_loaded_namespaces (GIRepository *repository)
|
g_irepository_get_loaded_namespaces (GIRepository *repository)
|
||||||
{
|
{
|
||||||
GList *l, *list = NULL;
|
GList *l, *list = NULL;
|
||||||
@ -778,7 +778,7 @@ g_irepository_get_loaded_namespaces (GIRepository *repository)
|
|||||||
names = g_malloc0 (sizeof (gchar *) * (g_list_length (list) + 1));
|
names = g_malloc0 (sizeof (gchar *) * (g_list_length (list) + 1));
|
||||||
i = 0;
|
i = 0;
|
||||||
for (l = list; l; l = l->next)
|
for (l = list; l; l = l->next)
|
||||||
names[i++] = g_strdup (l->data);
|
names[i++] = g_strdup (l->data);
|
||||||
g_list_free (list);
|
g_list_free (list);
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
@ -895,14 +895,14 @@ g_irepository_get_c_prefix (GIRepository *repository,
|
|||||||
* @namespace_: GI namespace to use, e.g. "Gtk"
|
* @namespace_: GI namespace to use, e.g. "Gtk"
|
||||||
*
|
*
|
||||||
* If namespace @namespace_ is loaded, return the full path to the
|
* If namespace @namespace_ is loaded, return the full path to the
|
||||||
* .typelib file it was loaded from. If the typelib for
|
* .typelib file it was loaded from. If the typelib for
|
||||||
* namespace @namespace_ was included in a shared library, return
|
* namespace @namespace_ was included in a shared library, return
|
||||||
* the special string "$lt;builtin$gt;".
|
* the special string "$lt;builtin$gt;".
|
||||||
*
|
*
|
||||||
* Returns: Filesystem path (or $lt;builtin$gt;) if successful, %NULL if namespace is not loaded
|
* Returns: Filesystem path (or $lt;builtin$gt;) if successful, %NULL if namespace is not loaded
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
g_irepository_get_typelib_path (GIRepository *repository,
|
g_irepository_get_typelib_path (GIRepository *repository,
|
||||||
const gchar *namespace)
|
const gchar *namespace)
|
||||||
{
|
{
|
||||||
@ -915,7 +915,7 @@ g_irepository_get_typelib_path (GIRepository *repository,
|
|||||||
{
|
{
|
||||||
if (!g_hash_table_lookup_extended (repository->priv->lazy_typelibs, namespace,
|
if (!g_hash_table_lookup_extended (repository->priv->lazy_typelibs, namespace,
|
||||||
&orig_key, &value))
|
&orig_key, &value))
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return ((char*)orig_key) + strlen ((char *) orig_key) + 1;
|
return ((char*)orig_key) + strlen ((char *) orig_key) + 1;
|
||||||
@ -933,14 +933,14 @@ find_namespace_version (const gchar *namespace,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GMappedFile *mfile = NULL;
|
GMappedFile *mfile = NULL;
|
||||||
char *fname;
|
char *fname;
|
||||||
|
|
||||||
fname = g_strdup_printf ("%s-%s.typelib", namespace, version);
|
fname = g_strdup_printf ("%s-%s.typelib", namespace, version);
|
||||||
|
|
||||||
tmp_path = build_search_path_with_overrides ();
|
tmp_path = build_search_path_with_overrides ();
|
||||||
for (ldir = tmp_path; ldir; ldir = ldir->next)
|
for (ldir = tmp_path; ldir; ldir = ldir->next)
|
||||||
{
|
{
|
||||||
char *path = g_build_filename (ldir->data, fname, NULL);
|
char *path = g_build_filename (ldir->data, fname, NULL);
|
||||||
|
|
||||||
mfile = g_mapped_file_new (path, FALSE, &error);
|
mfile = g_mapped_file_new (path, FALSE, &error);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@ -1022,7 +1022,7 @@ compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
|
|||||||
return -1;
|
return -1;
|
||||||
else if (result < 0)
|
else if (result < 0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Now check the path index, which says how early in the search path
|
/* Now check the path index, which says how early in the search path
|
||||||
* we found it. This ensures that of equal version targets, we
|
* we found it. This ensures that of equal version targets, we
|
||||||
@ -1067,7 +1067,7 @@ find_namespace_latest (const gchar *namespace,
|
|||||||
namespace_typelib = g_strdup_printf ("%s.typelib", namespace);
|
namespace_typelib = g_strdup_printf ("%s.typelib", namespace);
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
tmp_path = build_search_path_with_overrides ();
|
tmp_path = build_search_path_with_overrides ();
|
||||||
for (ldir = tmp_path; ldir; ldir = ldir->next)
|
for (ldir = tmp_path; ldir; ldir = ldir->next)
|
||||||
{
|
{
|
||||||
GDir *dir;
|
GDir *dir;
|
||||||
@ -1078,7 +1078,7 @@ find_namespace_latest (const gchar *namespace,
|
|||||||
dir = g_dir_open (dirname, 0, NULL);
|
dir = g_dir_open (dirname, 0, NULL);
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
continue;
|
continue;
|
||||||
while ((entry = g_dir_read_name (dir)) != NULL)
|
while ((entry = g_dir_read_name (dir)) != NULL)
|
||||||
{
|
{
|
||||||
GMappedFile *mfile;
|
GMappedFile *mfile;
|
||||||
char *path, *version;
|
char *path, *version;
|
||||||
@ -1086,7 +1086,7 @@ find_namespace_latest (const gchar *namespace,
|
|||||||
|
|
||||||
if (!g_str_has_suffix (entry, ".typelib"))
|
if (!g_str_has_suffix (entry, ".typelib"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (g_str_has_prefix (entry, namespace_dash))
|
if (g_str_has_prefix (entry, namespace_dash))
|
||||||
{
|
{
|
||||||
const char *last_dash;
|
const char *last_dash;
|
||||||
@ -1126,21 +1126,21 @@ find_namespace_latest (const gchar *namespace,
|
|||||||
{
|
{
|
||||||
struct NamespaceVersionCandidadate *elected;
|
struct NamespaceVersionCandidadate *elected;
|
||||||
candidates = g_slist_sort (candidates, (GCompareFunc) compare_candidate_reverse);
|
candidates = g_slist_sort (candidates, (GCompareFunc) compare_candidate_reverse);
|
||||||
|
|
||||||
elected = (struct NamespaceVersionCandidadate *) candidates->data;
|
elected = (struct NamespaceVersionCandidadate *) candidates->data;
|
||||||
/* Remove the elected one so we don't try to free its contents */
|
/* Remove the elected one so we don't try to free its contents */
|
||||||
candidates = g_slist_delete_link (candidates, candidates);
|
candidates = g_slist_delete_link (candidates, candidates);
|
||||||
|
|
||||||
result = elected->mfile;
|
result = elected->mfile;
|
||||||
*path_ret = elected->path;
|
*path_ret = elected->path;
|
||||||
*version_ret = elected->version;
|
*version_ret = elected->version;
|
||||||
g_free (elected); /* just free the container */
|
g_free (elected); /* just free the container */
|
||||||
g_slist_foreach (candidates, (GFunc) free_candidate, NULL);
|
g_slist_foreach (candidates, (GFunc) free_candidate, NULL);
|
||||||
g_slist_free (candidates);
|
g_slist_free (candidates);
|
||||||
}
|
}
|
||||||
g_free (namespace_dash);
|
g_free (namespace_dash);
|
||||||
g_free (namespace_typelib);
|
g_free (namespace_typelib);
|
||||||
g_slist_free (tmp_path);
|
g_slist_free (tmp_path);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1182,7 +1182,7 @@ g_irepository_require (GIRepository *repository,
|
|||||||
|
|
||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
|
|
||||||
typelib = get_registered_status (repository, namespace, version, allow_lazy,
|
typelib = get_registered_status (repository, namespace, version, allow_lazy,
|
||||||
&is_lazy, &version_conflict);
|
&is_lazy, &version_conflict);
|
||||||
if (typelib)
|
if (typelib)
|
||||||
return typelib;
|
return typelib;
|
||||||
@ -1205,7 +1205,7 @@ g_irepository_require (GIRepository *repository,
|
|||||||
{
|
{
|
||||||
mfile = find_namespace_latest (namespace, &tmp_version, &path);
|
mfile = find_namespace_latest (namespace, &tmp_version, &path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mfile == NULL)
|
if (mfile == NULL)
|
||||||
{
|
{
|
||||||
if (version != NULL)
|
if (version != NULL)
|
||||||
@ -1225,7 +1225,7 @@ g_irepository_require (GIRepository *repository,
|
|||||||
header = (Header *) typelib->data;
|
header = (Header *) typelib->data;
|
||||||
typelib_namespace = g_typelib_get_string (typelib, header->namespace);
|
typelib_namespace = g_typelib_get_string (typelib, header->namespace);
|
||||||
typelib_version = g_typelib_get_string (typelib, header->nsversion);
|
typelib_version = g_typelib_get_string (typelib, header->nsversion);
|
||||||
|
|
||||||
if (strcmp (typelib_namespace, namespace) != 0)
|
if (strcmp (typelib_namespace, namespace) != 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IREPOSITORY_ERROR,
|
g_set_error (error, G_IREPOSITORY_ERROR,
|
||||||
@ -1245,7 +1245,7 @@ g_irepository_require (GIRepository *repository,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!register_internal (repository, path, allow_lazy,
|
if (!register_internal (repository, path, allow_lazy,
|
||||||
typelib, error))
|
typelib, error))
|
||||||
{
|
{
|
||||||
g_typelib_free (typelib);
|
g_typelib_free (typelib);
|
||||||
@ -1255,7 +1255,7 @@ g_irepository_require (GIRepository *repository,
|
|||||||
out:
|
out:
|
||||||
g_free (tmp_version);
|
g_free (tmp_version);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -34,9 +34,9 @@ G_BEGIN_DECLS
|
|||||||
#define G_IS_IREPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
|
#define G_IS_IREPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
|
||||||
#define G_IREPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
|
#define G_IREPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
|
||||||
|
|
||||||
typedef struct _GIRepository GIRepository;
|
typedef struct _GIRepository GIRepository;
|
||||||
typedef struct _GIRepositoryClass GIRepositoryClass;
|
typedef struct _GIRepositoryClass GIRepositoryClass;
|
||||||
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
|
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
|
||||||
|
|
||||||
typedef struct _GIBaseInfoStub GIBaseInfo;
|
typedef struct _GIBaseInfoStub GIBaseInfo;
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ typedef GIBaseInfo GIErrorDomainInfo;
|
|||||||
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
||||||
typedef struct _GTypelib GTypelib;
|
typedef struct _GTypelib GTypelib;
|
||||||
|
|
||||||
struct _GIRepository
|
struct _GIRepository
|
||||||
{
|
{
|
||||||
GObject parent;
|
GObject parent;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
@ -82,8 +82,8 @@ struct _GIRepository
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct _GIRepositoryClass
|
struct _GIRepositoryClass
|
||||||
{
|
{
|
||||||
GObjectClass parent;
|
GObjectClass parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -173,7 +173,7 @@ void gi_cclosure_marshal_generic (GClosure *closure,
|
|||||||
|
|
||||||
/* Types of objects registered in the repository */
|
/* Types of objects registered in the repository */
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GI_INFO_TYPE_INVALID,
|
GI_INFO_TYPE_INVALID,
|
||||||
GI_INFO_TYPE_FUNCTION,
|
GI_INFO_TYPE_FUNCTION,
|
||||||
@ -226,7 +226,7 @@ gboolean g_base_info_equal (GIBaseInfo *info1,
|
|||||||
|
|
||||||
GIBaseInfo * g_info_new (GIInfoType type,
|
GIBaseInfo * g_info_new (GIInfoType type,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GTypelib *typelib,
|
GTypelib *typelib,
|
||||||
guint32 offset);
|
guint32 offset);
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info);
|
|||||||
GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info);
|
GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info);
|
||||||
GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
|
GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
gboolean v_boolean;
|
gboolean v_boolean;
|
||||||
gint8 v_int8;
|
gint8 v_int8;
|
||||||
@ -282,7 +282,7 @@ typedef enum
|
|||||||
G_INVOKE_ERROR_ARGUMENT_MISMATCH
|
G_INVOKE_ERROR_ARGUMENT_MISMATCH
|
||||||
} GInvokeError;
|
} GInvokeError;
|
||||||
|
|
||||||
gboolean g_function_info_invoke (GIFunctionInfo *info,
|
gboolean g_function_info_invoke (GIFunctionInfo *info,
|
||||||
const GArgument *in_args,
|
const GArgument *in_args,
|
||||||
int n_in_args,
|
int n_in_args,
|
||||||
const GArgument *out_args,
|
const GArgument *out_args,
|
||||||
@ -323,8 +323,8 @@ typedef enum {
|
|||||||
GI_SCOPE_TYPE_INVALID, /* The argument is not of callback type */
|
GI_SCOPE_TYPE_INVALID, /* The argument is not of callback type */
|
||||||
GI_SCOPE_TYPE_CALL, /* The callback and associated user_data is only used during the
|
GI_SCOPE_TYPE_CALL, /* The callback and associated user_data is only used during the
|
||||||
call to this function */
|
call to this function */
|
||||||
GI_SCOPE_TYPE_ASYNC, /* The callback and associated user_data is
|
GI_SCOPE_TYPE_ASYNC, /* The callback and associated user_data is
|
||||||
only used until the callback is invoked, and the callback
|
only used until the callback is invoked, and the callback
|
||||||
is invoked always exactly once. */
|
is invoked always exactly once. */
|
||||||
GI_SCOPE_TYPE_NOTIFIED /* The callback and and associated user_data is
|
GI_SCOPE_TYPE_NOTIFIED /* The callback and and associated user_data is
|
||||||
used until the caller is notfied via the destroy_notify */
|
used until the caller is notfied via the destroy_notify */
|
||||||
@ -353,7 +353,7 @@ typedef enum {
|
|||||||
GI_TYPE_TAG_INT8 = 2,
|
GI_TYPE_TAG_INT8 = 2,
|
||||||
GI_TYPE_TAG_UINT8 = 3,
|
GI_TYPE_TAG_UINT8 = 3,
|
||||||
GI_TYPE_TAG_INT16 = 4,
|
GI_TYPE_TAG_INT16 = 4,
|
||||||
GI_TYPE_TAG_UINT16 = 5,
|
GI_TYPE_TAG_UINT16 = 5,
|
||||||
GI_TYPE_TAG_INT32 = 6,
|
GI_TYPE_TAG_INT32 = 6,
|
||||||
GI_TYPE_TAG_UINT32 = 7,
|
GI_TYPE_TAG_UINT32 = 7,
|
||||||
GI_TYPE_TAG_INT64 = 8,
|
GI_TYPE_TAG_INT64 = 8,
|
||||||
@ -407,7 +407,7 @@ GIInterfaceInfo * g_error_domain_info_get_codes (GIErrorDomainInfo *in
|
|||||||
|
|
||||||
|
|
||||||
/* GIValueInfo */
|
/* GIValueInfo */
|
||||||
|
|
||||||
glong g_value_info_get_value (GIValueInfo *info);
|
glong g_value_info_get_value (GIValueInfo *info);
|
||||||
|
|
||||||
|
|
||||||
@ -477,8 +477,8 @@ GITypeTag g_enum_info_get_storage_type (GIEnumInfo *in
|
|||||||
|
|
||||||
/* GIObjectInfo */
|
/* GIObjectInfo */
|
||||||
|
|
||||||
const gchar * g_object_info_get_type_name (GIObjectInfo *info);
|
const gchar * g_object_info_get_type_name (GIObjectInfo *info);
|
||||||
const gchar * g_object_info_get_type_init (GIObjectInfo *info);
|
const gchar * g_object_info_get_type_init (GIObjectInfo *info);
|
||||||
gboolean g_object_info_get_abstract (GIObjectInfo *info);
|
gboolean g_object_info_get_abstract (GIObjectInfo *info);
|
||||||
GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info);
|
GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info);
|
||||||
gint g_object_info_get_n_interfaces (GIObjectInfo *info);
|
gint g_object_info_get_n_interfaces (GIObjectInfo *info);
|
||||||
@ -508,7 +508,7 @@ GIConstantInfo * g_object_info_get_constant (GIObjectInfo *in
|
|||||||
gint n);
|
gint n);
|
||||||
GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
|
GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
|
||||||
|
|
||||||
|
|
||||||
/* GIInterfaceInfo */
|
/* GIInterfaceInfo */
|
||||||
|
|
||||||
gint g_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
|
gint g_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
|
||||||
@ -521,7 +521,7 @@ gint g_interface_info_get_n_methods (GIInterfaceInfo *in
|
|||||||
GIFunctionInfo * g_interface_info_get_method (GIInterfaceInfo *info,
|
GIFunctionInfo * g_interface_info_get_method (GIInterfaceInfo *info,
|
||||||
gint n);
|
gint n);
|
||||||
GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
|
GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
|
gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
|
||||||
GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
|
GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
|
||||||
gint n);
|
gint n);
|
||||||
|
26
girffi.c
26
girffi.c
@ -114,7 +114,7 @@ g_ir_ffi_get_ffi_type (GITypeTag tag,
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_type_info_get_ffi_type:
|
* g_type_info_get_ffi_type:
|
||||||
@ -140,13 +140,13 @@ g_callable_info_get_ffi_arg_types (GICallableInfo *callable_info)
|
|||||||
{
|
{
|
||||||
ffi_type **arg_types;
|
ffi_type **arg_types;
|
||||||
gint n_args, i;
|
gint n_args, i;
|
||||||
|
|
||||||
g_return_val_if_fail (callable_info != NULL, NULL);
|
g_return_val_if_fail (callable_info != NULL, NULL);
|
||||||
|
|
||||||
n_args = g_callable_info_get_n_args (callable_info);
|
n_args = g_callable_info_get_n_args (callable_info);
|
||||||
|
|
||||||
arg_types = (ffi_type **) g_new0 (ffi_type *, n_args + 1);
|
arg_types = (ffi_type **) g_new0 (ffi_type *, n_args + 1);
|
||||||
|
|
||||||
for (i = 0; i < n_args; ++i)
|
for (i = 0; i < n_args; ++i)
|
||||||
{
|
{
|
||||||
GIArgInfo *arg_info = g_callable_info_get_arg (callable_info, i);
|
GIArgInfo *arg_info = g_callable_info_get_arg (callable_info, i);
|
||||||
@ -181,7 +181,7 @@ g_callable_info_get_ffi_return_type (GICallableInfo *callable_info)
|
|||||||
type_tag = g_type_info_get_tag (return_type);
|
type_tag = g_type_info_get_tag (return_type);
|
||||||
return_ffi_type = g_type_info_get_ffi_type (return_type);
|
return_ffi_type = g_type_info_get_ffi_type (return_type);
|
||||||
g_base_info_unref((GIBaseInfo*)return_type);
|
g_base_info_unref((GIBaseInfo*)return_type);
|
||||||
|
|
||||||
return return_ffi_type;
|
return return_ffi_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,12 +212,12 @@ g_function_info_prep_invoker (GIFunctionInfo *info,
|
|||||||
gboolean is_method;
|
gboolean is_method;
|
||||||
gboolean throws;
|
gboolean throws;
|
||||||
gint n_args, n_invoke_args, i;
|
gint n_args, n_invoke_args, i;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, FALSE);
|
g_return_val_if_fail (info != NULL, FALSE);
|
||||||
g_return_val_if_fail (invoker != NULL, FALSE);
|
g_return_val_if_fail (invoker != NULL, FALSE);
|
||||||
|
|
||||||
symbol = g_function_info_get_symbol ((GIFunctionInfo*) info);
|
symbol = g_function_info_get_symbol ((GIFunctionInfo*) info);
|
||||||
|
|
||||||
if (!g_typelib_symbol (g_base_info_get_typelib((GIBaseInfo *) info),
|
if (!g_typelib_symbol (g_base_info_get_typelib((GIBaseInfo *) info),
|
||||||
symbol, &(invoker->native_address)))
|
symbol, &(invoker->native_address)))
|
||||||
{
|
{
|
||||||
@ -249,7 +249,7 @@ g_function_info_prep_invoker (GIFunctionInfo *info,
|
|||||||
|
|
||||||
/* TODO: avoid malloc here? */
|
/* TODO: avoid malloc here? */
|
||||||
atypes = g_malloc0 (sizeof (ffi_type*) * n_invoke_args);
|
atypes = g_malloc0 (sizeof (ffi_type*) * n_invoke_args);
|
||||||
|
|
||||||
if (is_method)
|
if (is_method)
|
||||||
{
|
{
|
||||||
atypes[0] = &ffi_type_pointer;
|
atypes[0] = &ffi_type_pointer;
|
||||||
@ -286,7 +286,7 @@ g_function_info_prep_invoker (GIFunctionInfo *info,
|
|||||||
/**
|
/**
|
||||||
* g_function_info_invoker_destroy:
|
* g_function_info_invoker_destroy:
|
||||||
* @invoker: A #GIFunctionInvoker
|
* @invoker: A #GIFunctionInvoker
|
||||||
*
|
*
|
||||||
* Release all resources allocated for the internals of @invoker; callers
|
* Release all resources allocated for the internals of @invoker; callers
|
||||||
* are responsible for freeing any resources allocated for the structure
|
* are responsible for freeing any resources allocated for the structure
|
||||||
* itself however.
|
* itself however.
|
||||||
@ -320,11 +320,11 @@ g_callable_info_prepare_closure (GICallableInfo *callable_info,
|
|||||||
{
|
{
|
||||||
ffi_closure *closure;
|
ffi_closure *closure;
|
||||||
ffi_status status;
|
ffi_status status;
|
||||||
|
|
||||||
g_return_val_if_fail (callable_info != NULL, FALSE);
|
g_return_val_if_fail (callable_info != NULL, FALSE);
|
||||||
g_return_val_if_fail (cif != NULL, FALSE);
|
g_return_val_if_fail (cif != NULL, FALSE);
|
||||||
g_return_val_if_fail (callback != NULL, FALSE);
|
g_return_val_if_fail (callback != NULL, FALSE);
|
||||||
|
|
||||||
closure = mmap (NULL, sizeof (ffi_closure),
|
closure = mmap (NULL, sizeof (ffi_closure),
|
||||||
PROT_EXEC | PROT_READ | PROT_WRITE,
|
PROT_EXEC | PROT_READ | PROT_WRITE,
|
||||||
MAP_ANON | MAP_PRIVATE, -1, sysconf (_SC_PAGE_SIZE));
|
MAP_ANON | MAP_PRIVATE, -1, sysconf (_SC_PAGE_SIZE));
|
||||||
@ -359,7 +359,7 @@ g_callable_info_prepare_closure (GICallableInfo *callable_info,
|
|||||||
munmap(closure, sizeof (closure));
|
munmap(closure, sizeof (closure));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return closure;
|
return closure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
girffi.h
4
girffi.h
@ -36,7 +36,7 @@ typedef struct _GIFunctionInvoker GIFunctionInvoker;
|
|||||||
struct _GIFunctionInvoker {
|
struct _GIFunctionInvoker {
|
||||||
ffi_cif cif;
|
ffi_cif cif;
|
||||||
gpointer native_address;
|
gpointer native_address;
|
||||||
|
|
||||||
gpointer padding[3];
|
gpointer padding[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ ffi_type * g_type_info_get_ffi_type (GITypeInfo *info);
|
|||||||
gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
|
gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
|
||||||
GIFunctionInvoker *invoker,
|
GIFunctionInvoker *invoker,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void g_function_invoker_destroy (GIFunctionInvoker *invoker);
|
void g_function_invoker_destroy (GIFunctionInvoker *invoker);
|
||||||
|
|
||||||
|
|
||||||
|
30
girmodule.c
30
girmodule.c
@ -1,4 +1,4 @@
|
|||||||
/* GObject introspection: Typelib creation
|
/* GObject introspection: Typelib creation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 Matthias Clasen
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
*
|
*
|
||||||
@ -30,13 +30,13 @@
|
|||||||
|
|
||||||
|
|
||||||
GIrModule *
|
GIrModule *
|
||||||
g_ir_module_new (const gchar *name,
|
g_ir_module_new (const gchar *name,
|
||||||
const gchar *version,
|
const gchar *version,
|
||||||
const gchar *shared_library,
|
const gchar *shared_library,
|
||||||
const gchar *c_prefix)
|
const gchar *c_prefix)
|
||||||
{
|
{
|
||||||
GIrModule *module;
|
GIrModule *module;
|
||||||
|
|
||||||
module = g_new0 (GIrModule, 1);
|
module = g_new0 (GIrModule, 1);
|
||||||
|
|
||||||
module->name = g_strdup (name);
|
module->name = g_strdup (name);
|
||||||
@ -94,18 +94,18 @@ g_ir_module_fatal (GIrModule *module,
|
|||||||
char *formatted;
|
char *formatted;
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start (args, msg);
|
va_start (args, msg);
|
||||||
|
|
||||||
formatted = g_strdup_vprintf (msg, args);
|
formatted = g_strdup_vprintf (msg, args);
|
||||||
|
|
||||||
if (line)
|
if (line)
|
||||||
g_printerr ("%s-%s.gir:%d: error: %s\n", module->name, module->version, line, formatted);
|
g_printerr ("%s-%s.gir:%d: error: %s\n", module->name, module->version, line, formatted);
|
||||||
else
|
else
|
||||||
g_printerr ("%s-%s.gir: error: %s\n", module->name, module->version, formatted);
|
g_printerr ("%s-%s.gir: error: %s\n", module->name, module->version, formatted);
|
||||||
|
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
|
|
||||||
g_message ("%d entries (%d local), %d dependencies\n", n_entries, n_local_entries,
|
g_message ("%d entries (%d local), %d dependencies\n", n_entries, n_local_entries,
|
||||||
g_list_length (module->dependencies));
|
g_list_length (module->dependencies));
|
||||||
|
|
||||||
dir_size = n_entries * sizeof (DirEntry);
|
dir_size = n_entries * sizeof (DirEntry);
|
||||||
size = header_size + dir_size;
|
size = header_size + dir_size;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
for (e = module->entries; e; e = e->next)
|
for (e = module->entries; e; e = e->next)
|
||||||
{
|
{
|
||||||
GIrNode *node = e->data;
|
GIrNode *node = e->data;
|
||||||
|
|
||||||
size += g_ir_node_get_full_size (node);
|
size += g_ir_node_get_full_size (node);
|
||||||
size += g_ir_node_get_attribute_size (node);
|
size += g_ir_node_get_attribute_size (node);
|
||||||
|
|
||||||
@ -266,14 +266,14 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
|
|
||||||
/* Adjust size for strings allocated in header below specially */
|
/* Adjust size for strings allocated in header below specially */
|
||||||
size += ALIGN_VALUE (strlen (module->name) + 1, 4);
|
size += ALIGN_VALUE (strlen (module->name) + 1, 4);
|
||||||
if (module->shared_library)
|
if (module->shared_library)
|
||||||
size += ALIGN_VALUE (strlen (module->shared_library) + 1, 4);
|
size += ALIGN_VALUE (strlen (module->shared_library) + 1, 4);
|
||||||
if (dependencies != NULL)
|
if (dependencies != NULL)
|
||||||
size += ALIGN_VALUE (strlen (dependencies) + 1, 4);
|
size += ALIGN_VALUE (strlen (dependencies) + 1, 4);
|
||||||
if (module->c_prefix != NULL)
|
if (module->c_prefix != NULL)
|
||||||
size += ALIGN_VALUE (strlen (module->c_prefix) + 1, 4);
|
size += ALIGN_VALUE (strlen (module->c_prefix) + 1, 4);
|
||||||
|
|
||||||
g_message ("allocating %d bytes (%d header, %d directory, %d entries)\n",
|
g_message ("allocating %d bytes (%d header, %d directory, %d entries)\n",
|
||||||
size, header_size, dir_size, size - header_size - dir_size);
|
size, header_size, dir_size, size - header_size - dir_size);
|
||||||
|
|
||||||
data = g_malloc0 (size);
|
data = g_malloc0 (size);
|
||||||
@ -361,13 +361,13 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
|
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = offset2;
|
offset = offset2;
|
||||||
|
|
||||||
if (node->type == G_IR_NODE_XREF)
|
if (node->type == G_IR_NODE_XREF)
|
||||||
{
|
{
|
||||||
const char *namespace = ((GIrNodeXRef*)node)->namespace;
|
const char *namespace = ((GIrNodeXRef*)node)->namespace;
|
||||||
|
|
||||||
entry->blob_type = 0;
|
entry->blob_type = 0;
|
||||||
entry->local = FALSE;
|
entry->local = FALSE;
|
||||||
entry->offset = write_string (namespace, strings, data, &offset2);
|
entry->offset = write_string (namespace, strings, data, &offset2);
|
||||||
@ -419,7 +419,7 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
|
|
||||||
write_attributes (module, node, strings, data, &offset, &offset2);
|
write_attributes (module, node, strings, data, &offset, &offset2);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_message ("reallocating to %d bytes", offset2);
|
g_message ("reallocating to %d bytes", offset2);
|
||||||
|
|
||||||
data = g_realloc (data, offset2);
|
data = g_realloc (data, offset2);
|
||||||
|
@ -30,7 +30,7 @@ G_BEGIN_DECLS
|
|||||||
typedef struct _GIrModule GIrModule;
|
typedef struct _GIrModule GIrModule;
|
||||||
|
|
||||||
struct _GIrModule
|
struct _GIrModule
|
||||||
{
|
{
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *version;
|
gchar *version;
|
||||||
gchar *shared_library;
|
gchar *shared_library;
|
||||||
|
246
girnode.c
246
girnode.c
@ -213,7 +213,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_CALLBACK:
|
case G_IR_NODE_CALLBACK:
|
||||||
{
|
{
|
||||||
GIrNodeFunction *function = (GIrNodeFunction *)node;
|
GIrNodeFunction *function = (GIrNodeFunction *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (function->symbol);
|
g_free (function->symbol);
|
||||||
g_ir_node_free ((GIrNode *)function->result);
|
g_ir_node_free ((GIrNode *)function->result);
|
||||||
@ -226,7 +226,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_TYPE:
|
case G_IR_NODE_TYPE:
|
||||||
{
|
{
|
||||||
GIrNodeType *type = (GIrNodeType *)node;
|
GIrNodeType *type = (GIrNodeType *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_ir_node_free ((GIrNode *)type->parameter_type1);
|
g_ir_node_free ((GIrNode *)type->parameter_type1);
|
||||||
g_ir_node_free ((GIrNode *)type->parameter_type2);
|
g_ir_node_free ((GIrNode *)type->parameter_type2);
|
||||||
@ -240,7 +240,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_PARAM:
|
case G_IR_NODE_PARAM:
|
||||||
{
|
{
|
||||||
GIrNodeParam *param = (GIrNodeParam *)node;
|
GIrNodeParam *param = (GIrNodeParam *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_ir_node_free ((GIrNode *)param->type);
|
g_ir_node_free ((GIrNode *)param->type);
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_PROPERTY:
|
case G_IR_NODE_PROPERTY:
|
||||||
{
|
{
|
||||||
GIrNodeProperty *property = (GIrNodeProperty *)node;
|
GIrNodeProperty *property = (GIrNodeProperty *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_ir_node_free ((GIrNode *)property->type);
|
g_ir_node_free ((GIrNode *)property->type);
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_SIGNAL:
|
case G_IR_NODE_SIGNAL:
|
||||||
{
|
{
|
||||||
GIrNodeSignal *signal = (GIrNodeSignal *)node;
|
GIrNodeSignal *signal = (GIrNodeSignal *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
for (l = signal->parameters; l; l = l->next)
|
for (l = signal->parameters; l; l = l->next)
|
||||||
g_ir_node_free ((GIrNode *)l->data);
|
g_ir_node_free ((GIrNode *)l->data);
|
||||||
@ -270,7 +270,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_VFUNC:
|
case G_IR_NODE_VFUNC:
|
||||||
{
|
{
|
||||||
GIrNodeVFunc *vfunc = (GIrNodeVFunc *)node;
|
GIrNodeVFunc *vfunc = (GIrNodeVFunc *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (vfunc->invoker);
|
g_free (vfunc->invoker);
|
||||||
for (l = vfunc->parameters; l; l = l->next)
|
for (l = vfunc->parameters; l; l = l->next)
|
||||||
@ -283,7 +283,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_FIELD:
|
case G_IR_NODE_FIELD:
|
||||||
{
|
{
|
||||||
GIrNodeField *field = (GIrNodeField *)node;
|
GIrNodeField *field = (GIrNodeField *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_ir_node_free ((GIrNode *)field->type);
|
g_ir_node_free ((GIrNode *)field->type);
|
||||||
g_ir_node_free ((GIrNode *)field->callback);
|
g_ir_node_free ((GIrNode *)field->callback);
|
||||||
@ -294,7 +294,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_INTERFACE:
|
case G_IR_NODE_INTERFACE:
|
||||||
{
|
{
|
||||||
GIrNodeInterface *iface = (GIrNodeInterface *)node;
|
GIrNodeInterface *iface = (GIrNodeInterface *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (iface->gtype_name);
|
g_free (iface->gtype_name);
|
||||||
g_free (iface->gtype_init);
|
g_free (iface->gtype_init);
|
||||||
@ -313,7 +313,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_VALUE:
|
case G_IR_NODE_VALUE:
|
||||||
{
|
{
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
@ -324,7 +324,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_FLAGS:
|
case G_IR_NODE_FLAGS:
|
||||||
{
|
{
|
||||||
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (enum_->gtype_name);
|
g_free (enum_->gtype_name);
|
||||||
g_free (enum_->gtype_init);
|
g_free (enum_->gtype_init);
|
||||||
@ -338,7 +338,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_BOXED:
|
case G_IR_NODE_BOXED:
|
||||||
{
|
{
|
||||||
GIrNodeBoxed *boxed = (GIrNodeBoxed *)node;
|
GIrNodeBoxed *boxed = (GIrNodeBoxed *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (boxed->gtype_name);
|
g_free (boxed->gtype_name);
|
||||||
g_free (boxed->gtype_init);
|
g_free (boxed->gtype_init);
|
||||||
@ -366,7 +366,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_CONSTANT:
|
case G_IR_NODE_CONSTANT:
|
||||||
{
|
{
|
||||||
GIrNodeConstant *constant = (GIrNodeConstant *)node;
|
GIrNodeConstant *constant = (GIrNodeConstant *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (constant->value);
|
g_free (constant->value);
|
||||||
g_ir_node_free ((GIrNode *)constant->type);
|
g_ir_node_free ((GIrNode *)constant->type);
|
||||||
@ -376,7 +376,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_ERROR_DOMAIN:
|
case G_IR_NODE_ERROR_DOMAIN:
|
||||||
{
|
{
|
||||||
GIrNodeErrorDomain *domain = (GIrNodeErrorDomain *)node;
|
GIrNodeErrorDomain *domain = (GIrNodeErrorDomain *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (domain->getquark);
|
g_free (domain->getquark);
|
||||||
g_free (domain->codes);
|
g_free (domain->codes);
|
||||||
@ -386,7 +386,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
{
|
{
|
||||||
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (xref->namespace);
|
g_free (xref->namespace);
|
||||||
}
|
}
|
||||||
@ -395,7 +395,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
case G_IR_NODE_UNION:
|
case G_IR_NODE_UNION:
|
||||||
{
|
{
|
||||||
GIrNodeUnion *union_ = (GIrNodeUnion *)node;
|
GIrNodeUnion *union_ = (GIrNodeUnion *)node;
|
||||||
|
|
||||||
g_free (node->name);
|
g_free (node->name);
|
||||||
g_free (union_->gtype_name);
|
g_free (union_->gtype_name);
|
||||||
g_free (union_->gtype_init);
|
g_free (union_->gtype_init);
|
||||||
@ -411,7 +411,7 @@ g_ir_node_free (GIrNode *node)
|
|||||||
default:
|
default:
|
||||||
g_error ("Unhandled node type %d\n", node->type);
|
g_error ("Unhandled node type %d\n", node->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hash_table_destroy (node->attributes);
|
g_hash_table_destroy (node->attributes);
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ g_ir_node_get_size (GIrNode *node)
|
|||||||
case G_IR_NODE_FLAGS:
|
case G_IR_NODE_FLAGS:
|
||||||
{
|
{
|
||||||
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
||||||
|
|
||||||
size = sizeof (EnumBlob);
|
size = sizeof (EnumBlob);
|
||||||
for (l = enum_->values; l; l = l->next)
|
for (l = enum_->values; l; l = l->next)
|
||||||
size += g_ir_node_get_size ((GIrNode *)l->data);
|
size += g_ir_node_get_size ((GIrNode *)l->data);
|
||||||
@ -549,7 +549,7 @@ g_ir_node_get_size (GIrNode *node)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_error ("Unhandled node type '%s'\n",
|
g_error ("Unhandled node type '%s'\n",
|
||||||
g_ir_node_type_to_string (node->type));
|
g_ir_node_type_to_string (node->type));
|
||||||
size = 0;
|
size = 0;
|
||||||
@ -617,12 +617,12 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
case G_IR_NODE_PARAM:
|
case G_IR_NODE_PARAM:
|
||||||
{
|
{
|
||||||
GIrNodeParam *param = (GIrNodeParam *)node;
|
GIrNodeParam *param = (GIrNodeParam *)node;
|
||||||
|
|
||||||
/* See the comment in the G_IR_NODE_PARAM/ArgBlob writing below */
|
/* See the comment in the G_IR_NODE_PARAM/ArgBlob writing below */
|
||||||
size = sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
|
size = sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
|
||||||
if (node->name)
|
if (node->name)
|
||||||
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
||||||
size += g_ir_node_get_full_size_internal (node, (GIrNode *)param->type);
|
size += g_ir_node_get_full_size_internal (node, (GIrNode *)param->type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
case GI_TYPE_TAG_ERROR:
|
case GI_TYPE_TAG_ERROR:
|
||||||
{
|
{
|
||||||
gint n;
|
gint n;
|
||||||
|
|
||||||
if (type->errors)
|
if (type->errors)
|
||||||
n = g_strv_length (type->errors);
|
n = g_strv_length (type->errors);
|
||||||
else
|
else
|
||||||
@ -719,7 +719,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
case G_IR_NODE_FLAGS:
|
case G_IR_NODE_FLAGS:
|
||||||
{
|
{
|
||||||
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
||||||
|
|
||||||
size = sizeof (EnumBlob);
|
size = sizeof (EnumBlob);
|
||||||
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
||||||
if (enum_->gtype_name)
|
if (enum_->gtype_name)
|
||||||
@ -729,7 +729,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (l = enum_->values; l; l = l->next)
|
for (l = enum_->values; l; l = l->next)
|
||||||
size += g_ir_node_get_full_size_internal (node, (GIrNode *)l->data);
|
size += g_ir_node_get_full_size_internal (node, (GIrNode *)l->data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -774,10 +774,10 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
case G_IR_NODE_PROPERTY:
|
case G_IR_NODE_PROPERTY:
|
||||||
{
|
{
|
||||||
GIrNodeProperty *prop = (GIrNodeProperty *)node;
|
GIrNodeProperty *prop = (GIrNodeProperty *)node;
|
||||||
|
|
||||||
size = sizeof (PropertyBlob);
|
size = sizeof (PropertyBlob);
|
||||||
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
||||||
size += g_ir_node_get_full_size_internal (node, (GIrNode *)prop->type);
|
size += g_ir_node_get_full_size_internal (node, (GIrNode *)prop->type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
||||||
/* FIXME non-string values */
|
/* FIXME non-string values */
|
||||||
size += ALIGN_VALUE (strlen (constant->value) + 1, 4);
|
size += ALIGN_VALUE (strlen (constant->value) + 1, 4);
|
||||||
size += g_ir_node_get_full_size_internal (node, (GIrNode *)constant->type);
|
size += g_ir_node_get_full_size_internal (node, (GIrNode *)constant->type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -843,7 +843,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
{
|
{
|
||||||
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
||||||
size += ALIGN_VALUE (strlen (xref->namespace) + 1, 4);
|
size += ALIGN_VALUE (strlen (xref->namespace) + 1, 4);
|
||||||
@ -867,7 +867,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_error ("Unknown type tag %d\n", node->type);
|
g_error ("Unknown type tag %d\n", node->type);
|
||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
@ -947,7 +947,7 @@ g_ir_node_add_member (GIrNode *node,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (node != NULL);
|
g_return_if_fail (node != NULL);
|
||||||
g_return_if_fail (member != NULL);
|
g_return_if_fail (member != NULL);
|
||||||
|
|
||||||
switch (node->type)
|
switch (node->type)
|
||||||
{
|
{
|
||||||
case G_IR_NODE_OBJECT:
|
case G_IR_NODE_OBJECT:
|
||||||
@ -1026,7 +1026,7 @@ parse_boolean_value (const gchar *str)
|
|||||||
{
|
{
|
||||||
if (strcmp (str, "TRUE") == 0)
|
if (strcmp (str, "TRUE") == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (strcmp (str, "FALSE") == 0)
|
if (strcmp (str, "FALSE") == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -1048,31 +1048,31 @@ find_entry_node (GIrModule *module,
|
|||||||
|
|
||||||
g_assert (name != NULL);
|
g_assert (name != NULL);
|
||||||
g_assert (strlen (name) > 0);
|
g_assert (strlen (name) > 0);
|
||||||
|
|
||||||
names = g_strsplit (name, ".", 0);
|
names = g_strsplit (name, ".", 0);
|
||||||
n_names = g_strv_length (names);
|
n_names = g_strv_length (names);
|
||||||
if (n_names > 2)
|
if (n_names > 2)
|
||||||
g_error ("Too many name parts");
|
g_error ("Too many name parts");
|
||||||
|
|
||||||
for (l = module->entries, i = 1; l; l = l->next, i++)
|
for (l = module->entries, i = 1; l; l = l->next, i++)
|
||||||
{
|
{
|
||||||
GIrNode *node = (GIrNode *)l->data;
|
GIrNode *node = (GIrNode *)l->data;
|
||||||
|
|
||||||
if (n_names > 1)
|
if (n_names > 1)
|
||||||
{
|
{
|
||||||
if (node->type != G_IR_NODE_XREF)
|
if (node->type != G_IR_NODE_XREF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (((GIrNodeXRef *)node)->namespace == NULL ||
|
if (((GIrNodeXRef *)node)->namespace == NULL ||
|
||||||
strcmp (((GIrNodeXRef *)node)->namespace, names[0]) != 0)
|
strcmp (((GIrNodeXRef *)node)->namespace, names[0]) != 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp (node->name, names[n_names - 1]) == 0)
|
if (strcmp (node->name, names[n_names - 1]) == 0)
|
||||||
{
|
{
|
||||||
if (idx)
|
if (idx)
|
||||||
*idx = i;
|
*idx = i;
|
||||||
|
|
||||||
result = node;
|
result = node;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1084,9 +1084,9 @@ find_entry_node (GIrModule *module,
|
|||||||
|
|
||||||
((GIrNodeXRef *)node)->namespace = g_strdup (names[0]);
|
((GIrNodeXRef *)node)->namespace = g_strdup (names[0]);
|
||||||
node->name = g_strdup (names[1]);
|
node->name = g_strdup (names[1]);
|
||||||
|
|
||||||
module->entries = g_list_append (module->entries, node);
|
module->entries = g_list_append (module->entries, node);
|
||||||
|
|
||||||
if (idx)
|
if (idx)
|
||||||
*idx = g_list_length (module->entries);
|
*idx = g_list_length (module->entries);
|
||||||
|
|
||||||
@ -1229,23 +1229,23 @@ get_index_of_member_type (GIrNodeInterface *node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
serialize_type (GIrModule *module,
|
serialize_type (GIrModule *module,
|
||||||
GList *modules,
|
GList *modules,
|
||||||
GIrNodeType *node,
|
GIrNodeType *node,
|
||||||
GString *str)
|
GString *str)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
const gchar* basic[] = {
|
const gchar* basic[] = {
|
||||||
"void",
|
"void",
|
||||||
"boolean",
|
"boolean",
|
||||||
"int8",
|
"int8",
|
||||||
"uint8",
|
"uint8",
|
||||||
"int16",
|
"int16",
|
||||||
"uint16",
|
"uint16",
|
||||||
"int32",
|
"int32",
|
||||||
"uint32",
|
"uint32",
|
||||||
"int64",
|
"int64",
|
||||||
"uint64",
|
"uint64",
|
||||||
"short",
|
"short",
|
||||||
"ushort",
|
"ushort",
|
||||||
"int",
|
"int",
|
||||||
@ -1254,14 +1254,14 @@ serialize_type (GIrModule *module,
|
|||||||
"ulong",
|
"ulong",
|
||||||
"ssize",
|
"ssize",
|
||||||
"size",
|
"size",
|
||||||
"float",
|
"float",
|
||||||
"double",
|
"double",
|
||||||
"time_t",
|
"time_t",
|
||||||
"GType",
|
"GType",
|
||||||
"utf8",
|
"utf8",
|
||||||
"filename",
|
"filename",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (node->tag < GI_TYPE_TAG_ARRAY)
|
if (node->tag < GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
g_string_append_printf (str, "%s%s", basic[node->tag],
|
g_string_append_printf (str, "%s%s", basic[node->tag],
|
||||||
@ -1276,11 +1276,11 @@ serialize_type (GIrModule *module,
|
|||||||
g_string_append_printf (str, "length=%d", node->length);
|
g_string_append_printf (str, "length=%d", node->length);
|
||||||
else if (node->has_size)
|
else if (node->has_size)
|
||||||
g_string_append_printf (str, "fixed-size=%d", node->size);
|
g_string_append_printf (str, "fixed-size=%d", node->size);
|
||||||
|
|
||||||
if (node->zero_terminated)
|
if (node->zero_terminated)
|
||||||
g_string_append_printf (str, "%szero-terminated=1",
|
g_string_append_printf (str, "%szero-terminated=1",
|
||||||
node->has_length ? "," : "");
|
node->has_length ? "," : "");
|
||||||
|
|
||||||
g_string_append (str, "]");
|
g_string_append (str, "]");
|
||||||
}
|
}
|
||||||
else if (node->tag == GI_TYPE_TAG_INTERFACE)
|
else if (node->tag == GI_TYPE_TAG_INTERFACE)
|
||||||
@ -1309,9 +1309,9 @@ serialize_type (GIrModule *module,
|
|||||||
g_string_append (str, "GList");
|
g_string_append (str, "GList");
|
||||||
if (node->parameter_type1)
|
if (node->parameter_type1)
|
||||||
{
|
{
|
||||||
g_string_append (str, "<");
|
g_string_append (str, "<");
|
||||||
serialize_type (module, modules, node->parameter_type1, str);
|
serialize_type (module, modules, node->parameter_type1, str);
|
||||||
g_string_append (str, ">");
|
g_string_append (str, ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (node->tag == GI_TYPE_TAG_GSLIST)
|
else if (node->tag == GI_TYPE_TAG_GSLIST)
|
||||||
@ -1319,9 +1319,9 @@ serialize_type (GIrModule *module,
|
|||||||
g_string_append (str, "GSList");
|
g_string_append (str, "GSList");
|
||||||
if (node->parameter_type1)
|
if (node->parameter_type1)
|
||||||
{
|
{
|
||||||
g_string_append (str, "<");
|
g_string_append (str, "<");
|
||||||
serialize_type (module, modules, node->parameter_type1, str);
|
serialize_type (module, modules, node->parameter_type1, str);
|
||||||
g_string_append (str, ">");
|
g_string_append (str, ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (node->tag == GI_TYPE_TAG_GHASH)
|
else if (node->tag == GI_TYPE_TAG_GHASH)
|
||||||
@ -1329,11 +1329,11 @@ serialize_type (GIrModule *module,
|
|||||||
g_string_append (str, "GHashTable<");
|
g_string_append (str, "GHashTable<");
|
||||||
if (node->parameter_type1)
|
if (node->parameter_type1)
|
||||||
{
|
{
|
||||||
g_string_append (str, "<");
|
g_string_append (str, "<");
|
||||||
serialize_type (module, modules, node->parameter_type1, str);
|
serialize_type (module, modules, node->parameter_type1, str);
|
||||||
g_string_append (str, ",");
|
g_string_append (str, ",");
|
||||||
serialize_type (module, modules, node->parameter_type2, str);
|
serialize_type (module, modules, node->parameter_type2, str);
|
||||||
g_string_append (str, ">");
|
g_string_append (str, ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (node->tag == GI_TYPE_TAG_ERROR)
|
else if (node->tag == GI_TYPE_TAG_ERROR)
|
||||||
@ -1341,14 +1341,14 @@ serialize_type (GIrModule *module,
|
|||||||
g_string_append (str, "GError");
|
g_string_append (str, "GError");
|
||||||
if (node->errors)
|
if (node->errors)
|
||||||
{
|
{
|
||||||
g_string_append (str, "<");
|
g_string_append (str, "<");
|
||||||
for (i = 0; node->errors[i]; i++)
|
for (i = 0; node->errors[i]; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
g_string_append (str, ",");
|
g_string_append (str, ",");
|
||||||
g_string_append (str, node->errors[i]);
|
g_string_append (str, node->errors[i]);
|
||||||
}
|
}
|
||||||
g_string_append (str, ">");
|
g_string_append (str, ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1450,27 +1450,27 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
SimpleTypeBlob *blob = (SimpleTypeBlob *)&data[*offset];
|
SimpleTypeBlob *blob = (SimpleTypeBlob *)&data[*offset];
|
||||||
|
|
||||||
*offset += sizeof (SimpleTypeBlob);
|
*offset += sizeof (SimpleTypeBlob);
|
||||||
|
|
||||||
if (type->tag < GI_TYPE_TAG_ARRAY ||
|
if (type->tag < GI_TYPE_TAG_ARRAY ||
|
||||||
type->tag == GI_TYPE_TAG_UTF8 ||
|
type->tag == GI_TYPE_TAG_UTF8 ||
|
||||||
type->tag == GI_TYPE_TAG_FILENAME)
|
type->tag == GI_TYPE_TAG_FILENAME)
|
||||||
{
|
{
|
||||||
blob->flags.reserved = 0;
|
blob->flags.reserved = 0;
|
||||||
blob->flags.reserved2 = 0;
|
blob->flags.reserved2 = 0;
|
||||||
blob->flags.pointer = type->is_pointer;
|
blob->flags.pointer = type->is_pointer;
|
||||||
blob->flags.reserved3 = 0;
|
blob->flags.reserved3 = 0;
|
||||||
blob->flags.tag = type->tag;
|
blob->flags.tag = type->tag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GString *str;
|
GString *str;
|
||||||
gchar *s;
|
gchar *s;
|
||||||
gpointer value;
|
gpointer value;
|
||||||
|
|
||||||
str = g_string_new (0);
|
str = g_string_new (0);
|
||||||
serialize_type (module, modules, type, str);
|
serialize_type (module, modules, type, str);
|
||||||
s = g_string_free (str, FALSE);
|
s = g_string_free (str, FALSE);
|
||||||
|
|
||||||
types_count += 1;
|
types_count += 1;
|
||||||
value = g_hash_table_lookup (types, s);
|
value = g_hash_table_lookup (types, s);
|
||||||
if (value)
|
if (value)
|
||||||
@ -1482,7 +1482,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
{
|
{
|
||||||
unique_types_count += 1;
|
unique_types_count += 1;
|
||||||
g_hash_table_insert (types, s, GUINT_TO_POINTER(*offset2));
|
g_hash_table_insert (types, s, GUINT_TO_POINTER(*offset2));
|
||||||
|
|
||||||
blob->offset = *offset2;
|
blob->offset = *offset2;
|
||||||
switch (type->tag)
|
switch (type->tag)
|
||||||
{
|
{
|
||||||
@ -1490,7 +1490,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
{
|
{
|
||||||
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
|
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
|
||||||
guint32 pos;
|
guint32 pos;
|
||||||
|
|
||||||
array->pointer = 1;
|
array->pointer = 1;
|
||||||
array->reserved = 0;
|
array->reserved = 0;
|
||||||
array->tag = type->tag;
|
array->tag = type->tag;
|
||||||
@ -1504,15 +1504,15 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
array->dimensions.size = type->size;
|
array->dimensions.size = type->size;
|
||||||
else
|
else
|
||||||
array->dimensions.length = -1;
|
array->dimensions.length = -1;
|
||||||
|
|
||||||
pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
|
pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
|
||||||
*offset2 += sizeof (ArrayTypeBlob);
|
*offset2 += sizeof (ArrayTypeBlob);
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
|
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
|
||||||
node, build, &pos, offset2);
|
node, build, &pos, offset2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GI_TYPE_TAG_INTERFACE:
|
case GI_TYPE_TAG_INTERFACE:
|
||||||
{
|
{
|
||||||
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
|
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
|
||||||
@ -1526,69 +1526,69 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GI_TYPE_TAG_GLIST:
|
case GI_TYPE_TAG_GLIST:
|
||||||
case GI_TYPE_TAG_GSLIST:
|
case GI_TYPE_TAG_GSLIST:
|
||||||
{
|
{
|
||||||
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
||||||
guint32 pos;
|
guint32 pos;
|
||||||
|
|
||||||
param->pointer = 1;
|
param->pointer = 1;
|
||||||
param->reserved = 0;
|
param->reserved = 0;
|
||||||
param->tag = type->tag;
|
param->tag = type->tag;
|
||||||
param->reserved2 = 0;
|
param->reserved2 = 0;
|
||||||
param->n_types = 1;
|
param->n_types = 1;
|
||||||
|
|
||||||
pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
|
pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
|
||||||
*offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob);
|
*offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob);
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
|
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
|
||||||
node, build, &pos, offset2);
|
node, build, &pos, offset2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GI_TYPE_TAG_GHASH:
|
case GI_TYPE_TAG_GHASH:
|
||||||
{
|
{
|
||||||
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
||||||
guint32 pos;
|
guint32 pos;
|
||||||
|
|
||||||
param->pointer = 1;
|
param->pointer = 1;
|
||||||
param->reserved = 0;
|
param->reserved = 0;
|
||||||
param->tag = type->tag;
|
param->tag = type->tag;
|
||||||
param->reserved2 = 0;
|
param->reserved2 = 0;
|
||||||
param->n_types = 2;
|
param->n_types = 2;
|
||||||
|
|
||||||
pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
|
pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
|
||||||
*offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob)*2;
|
*offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob)*2;
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
|
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
|
||||||
node, build, &pos, offset2);
|
node, build, &pos, offset2);
|
||||||
g_ir_node_build_typelib ((GIrNode *)type->parameter_type2,
|
g_ir_node_build_typelib ((GIrNode *)type->parameter_type2,
|
||||||
node, build, &pos, offset2);
|
node, build, &pos, offset2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GI_TYPE_TAG_ERROR:
|
case GI_TYPE_TAG_ERROR:
|
||||||
{
|
{
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
blob->pointer = 1;
|
blob->pointer = 1;
|
||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
blob->tag = type->tag;
|
blob->tag = type->tag;
|
||||||
blob->reserved2 = 0;
|
blob->reserved2 = 0;
|
||||||
if (type->errors)
|
if (type->errors)
|
||||||
blob->n_domains = g_strv_length (type->errors);
|
blob->n_domains = g_strv_length (type->errors);
|
||||||
else
|
else
|
||||||
blob->n_domains = 0;
|
blob->n_domains = 0;
|
||||||
|
|
||||||
*offset2 = ALIGN_VALUE (*offset2 + G_STRUCT_OFFSET (ErrorTypeBlob, domains)
|
*offset2 = ALIGN_VALUE (*offset2 + G_STRUCT_OFFSET (ErrorTypeBlob, domains)
|
||||||
+ 2 * blob->n_domains, 4);
|
+ 2 * blob->n_domains, 4);
|
||||||
for (i = 0; i < blob->n_domains; i++)
|
for (i = 0; i < blob->n_domains; i++)
|
||||||
blob->domains[i] = find_entry (module, modules, type->errors[i]);
|
blob->domains[i] = find_entry (module, modules, type->errors[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_error ("Unknown type tag %d\n", type->tag);
|
g_error ("Unknown type tag %d\n", type->tag);
|
||||||
break;
|
break;
|
||||||
@ -1649,7 +1649,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->construct_only = prop->construct_only;
|
blob->construct_only = prop->construct_only;
|
||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)prop->type,
|
g_ir_node_build_typelib ((GIrNode *)prop->type,
|
||||||
node, build, offset, offset2);
|
node, build, offset, offset2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1683,7 +1683,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
|
|
||||||
g_debug ("building function '%s'", function->symbol);
|
g_debug ("building function '%s'", function->symbol);
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)function->result->type,
|
g_ir_node_build_typelib ((GIrNode *)function->result->type,
|
||||||
node, build, &signature, offset2);
|
node, build, &signature, offset2);
|
||||||
|
|
||||||
blob2->may_return_null = function->result->allow_none;
|
blob2->may_return_null = function->result->allow_none;
|
||||||
@ -1693,7 +1693,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob2->n_arguments = n;
|
blob2->n_arguments = n;
|
||||||
|
|
||||||
signature += 4;
|
signature += 4;
|
||||||
|
|
||||||
for (l = function->parameters; l; l = l->next)
|
for (l = function->parameters; l; l = l->next)
|
||||||
{
|
{
|
||||||
GIrNode *param = (GIrNode *)l->data;
|
GIrNode *param = (GIrNode *)l->data;
|
||||||
@ -1723,8 +1723,8 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
blob->name = write_string (node->name, strings, data, offset2);
|
blob->name = write_string (node->name, strings, data, offset2);
|
||||||
blob->signature = signature;
|
blob->signature = signature;
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)function->result->type,
|
g_ir_node_build_typelib ((GIrNode *)function->result->type,
|
||||||
node, build, &signature, offset2);
|
node, build, &signature, offset2);
|
||||||
|
|
||||||
blob2->may_return_null = function->result->allow_none;
|
blob2->may_return_null = function->result->allow_none;
|
||||||
@ -1734,7 +1734,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob2->n_arguments = n;
|
blob2->n_arguments = n;
|
||||||
|
|
||||||
signature += 4;
|
signature += 4;
|
||||||
|
|
||||||
for (l = function->parameters; l; l = l->next)
|
for (l = function->parameters; l; l = l->next)
|
||||||
{
|
{
|
||||||
GIrNode *param = (GIrNode *)l->data;
|
GIrNode *param = (GIrNode *)l->data;
|
||||||
@ -1772,8 +1772,8 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->class_closure = 0; /* FIXME */
|
blob->class_closure = 0; /* FIXME */
|
||||||
blob->name = write_string (node->name, strings, data, offset2);
|
blob->name = write_string (node->name, strings, data, offset2);
|
||||||
blob->signature = signature;
|
blob->signature = signature;
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)signal->result->type,
|
g_ir_node_build_typelib ((GIrNode *)signal->result->type,
|
||||||
node, build, &signature, offset2);
|
node, build, &signature, offset2);
|
||||||
|
|
||||||
blob2->may_return_null = signal->result->allow_none;
|
blob2->may_return_null = signal->result->allow_none;
|
||||||
@ -1783,7 +1783,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob2->n_arguments = n;
|
blob2->n_arguments = n;
|
||||||
|
|
||||||
signature += 4;
|
signature += 4;
|
||||||
|
|
||||||
for (l = signal->parameters; l; l = l->next)
|
for (l = signal->parameters; l; l = l->next)
|
||||||
{
|
{
|
||||||
GIrNode *param = (GIrNode *)l->data;
|
GIrNode *param = (GIrNode *)l->data;
|
||||||
@ -1829,8 +1829,8 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->struct_offset = vfunc->offset;
|
blob->struct_offset = vfunc->offset;
|
||||||
blob->reserved2 = 0;
|
blob->reserved2 = 0;
|
||||||
blob->signature = signature;
|
blob->signature = signature;
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)vfunc->result->type,
|
g_ir_node_build_typelib ((GIrNode *)vfunc->result->type,
|
||||||
node, build, &signature, offset2);
|
node, build, &signature, offset2);
|
||||||
|
|
||||||
blob2->may_return_null = vfunc->result->allow_none;
|
blob2->may_return_null = vfunc->result->allow_none;
|
||||||
@ -1840,7 +1840,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob2->n_arguments = n;
|
blob2->n_arguments = n;
|
||||||
|
|
||||||
signature += 4;
|
signature += 4;
|
||||||
|
|
||||||
for (l = vfunc->parameters; l; l = l->next)
|
for (l = vfunc->parameters; l; l = l->next)
|
||||||
{
|
{
|
||||||
GIrNode *param = (GIrNode *)l->data;
|
GIrNode *param = (GIrNode *)l->data;
|
||||||
@ -1873,7 +1873,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
blob->closure = param->closure;
|
blob->closure = param->closure;
|
||||||
blob->destroy = param->destroy;
|
blob->destroy = param->destroy;
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)param->type, node, build, offset, offset2);
|
g_ir_node_build_typelib ((GIrNode *)param->type, node, build, offset, offset2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1883,7 +1883,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
StructBlob *blob = (StructBlob *)&data[*offset];
|
StructBlob *blob = (StructBlob *)&data[*offset];
|
||||||
GIrNodeStruct *struct_ = (GIrNodeStruct *)node;
|
GIrNodeStruct *struct_ = (GIrNodeStruct *)node;
|
||||||
GList *members;
|
GList *members;
|
||||||
|
|
||||||
blob->blob_type = BLOB_TYPE_STRUCT;
|
blob->blob_type = BLOB_TYPE_STRUCT;
|
||||||
blob->deprecated = struct_->deprecated;
|
blob->deprecated = struct_->deprecated;
|
||||||
blob->is_gtype_struct = struct_->is_gtype_struct;
|
blob->is_gtype_struct = struct_->is_gtype_struct;
|
||||||
@ -1995,7 +1995,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
{
|
{
|
||||||
*offset += 28;
|
*offset += 28;
|
||||||
blob->discriminated = TRUE;
|
blob->discriminated = TRUE;
|
||||||
g_ir_node_build_typelib ((GIrNode *)union_->discriminator_type,
|
g_ir_node_build_typelib ((GIrNode *)union_->discriminator_type,
|
||||||
build, offset, offset2);
|
build, offset, offset2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2004,7 +2004,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
*offset += sizeof (UnionBlob);
|
*offset += sizeof (UnionBlob);
|
||||||
blob->discriminated = FALSE;
|
blob->discriminated = FALSE;
|
||||||
blob->discriminator_type.offset = 0;
|
blob->discriminator_type.offset = 0;
|
||||||
|
|
||||||
members = g_list_copy (union_->members);
|
members = g_list_copy (union_->members);
|
||||||
|
|
||||||
g_ir_node_build_members (&members, G_IR_NODE_FIELD, &blob->n_fields,
|
g_ir_node_build_members (&members, G_IR_NODE_FIELD, &blob->n_fields,
|
||||||
@ -2022,7 +2022,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
for (l = union_->discriminators; l; l = l->next)
|
for (l = union_->discriminators; l; l = l->next)
|
||||||
{
|
{
|
||||||
GIrNode *member = (GIrNode *)l->data;
|
GIrNode *member = (GIrNode *)l->data;
|
||||||
|
|
||||||
g_ir_node_build_typelib (member, node, build, offset, offset2);
|
g_ir_node_build_typelib (member, node, build, offset, offset2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2035,13 +2035,13 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
EnumBlob *blob = (EnumBlob *)&data[*offset];
|
EnumBlob *blob = (EnumBlob *)&data[*offset];
|
||||||
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
|
||||||
|
|
||||||
*offset += sizeof (EnumBlob);
|
*offset += sizeof (EnumBlob);
|
||||||
|
|
||||||
if (node->type == G_IR_NODE_ENUM)
|
if (node->type == G_IR_NODE_ENUM)
|
||||||
blob->blob_type = BLOB_TYPE_ENUM;
|
blob->blob_type = BLOB_TYPE_ENUM;
|
||||||
else
|
else
|
||||||
blob->blob_type = BLOB_TYPE_FLAGS;
|
blob->blob_type = BLOB_TYPE_FLAGS;
|
||||||
|
|
||||||
blob->deprecated = enum_->deprecated;
|
blob->deprecated = enum_->deprecated;
|
||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
blob->storage_type = enum_->storage_type;
|
blob->storage_type = enum_->storage_type;
|
||||||
@ -2071,7 +2071,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_OBJECT:
|
case G_IR_NODE_OBJECT:
|
||||||
{
|
{
|
||||||
ObjectBlob *blob = (ObjectBlob *)&data[*offset];
|
ObjectBlob *blob = (ObjectBlob *)&data[*offset];
|
||||||
@ -2101,7 +2101,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->n_signals = 0;
|
blob->n_signals = 0;
|
||||||
blob->n_vfuncs = 0;
|
blob->n_vfuncs = 0;
|
||||||
blob->n_constants = 0;
|
blob->n_constants = 0;
|
||||||
|
|
||||||
*offset += sizeof(ObjectBlob);
|
*offset += sizeof(ObjectBlob);
|
||||||
for (l = object->interfaces; l; l = l->next)
|
for (l = object->interfaces; l; l = l->next)
|
||||||
{
|
{
|
||||||
@ -2109,7 +2109,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
*(guint16*)&data[*offset] = find_entry (module, modules, (gchar *)l->data);
|
*(guint16*)&data[*offset] = find_entry (module, modules, (gchar *)l->data);
|
||||||
*offset += 2;
|
*offset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
members = g_list_copy (object->members);
|
members = g_list_copy (object->members);
|
||||||
|
|
||||||
*offset = ALIGN_VALUE (*offset, 4);
|
*offset = ALIGN_VALUE (*offset, 4);
|
||||||
@ -2164,7 +2164,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
blob->n_signals = 0;
|
blob->n_signals = 0;
|
||||||
blob->n_vfuncs = 0;
|
blob->n_vfuncs = 0;
|
||||||
blob->n_constants = 0;
|
blob->n_constants = 0;
|
||||||
|
|
||||||
*offset += sizeof (InterfaceBlob);
|
*offset += sizeof (InterfaceBlob);
|
||||||
for (l = iface->prerequisites; l; l = l->next)
|
for (l = iface->prerequisites; l; l = l->next)
|
||||||
{
|
{
|
||||||
@ -2172,7 +2172,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
*(guint16*)&data[*offset] = find_entry (module, modules, (gchar *)l->data);
|
*(guint16*)&data[*offset] = find_entry (module, modules, (gchar *)l->data);
|
||||||
*offset += 2;
|
*offset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
members = g_list_copy (iface->members);
|
members = g_list_copy (iface->members);
|
||||||
|
|
||||||
*offset = ALIGN_VALUE (*offset, 4);
|
*offset = ALIGN_VALUE (*offset, 4);
|
||||||
@ -2306,7 +2306,7 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), glong);
|
DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), glong);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_SIZE: /* FIXME */
|
case GI_TYPE_TAG_SIZE: /* FIXME */
|
||||||
case GI_TYPE_TAG_TIME_T:
|
case GI_TYPE_TAG_TIME_T:
|
||||||
case GI_TYPE_TAG_ULONG:
|
case GI_TYPE_TAG_ULONG:
|
||||||
blob->size = sizeof (gulong);
|
blob->size = sizeof (gulong);
|
||||||
DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), gulong);
|
DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), gulong);
|
||||||
@ -2326,14 +2326,14 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*offset2 += ALIGN_VALUE (blob->size, 4);
|
*offset2 += ALIGN_VALUE (blob->size, 4);
|
||||||
|
|
||||||
g_ir_node_build_typelib ((GIrNode *)constant->type, node, build, &pos, offset2);
|
g_ir_node_build_typelib ((GIrNode *)constant->type, node, build, &pos, offset2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug ("node %s%s%s%p type '%s', offset %d -> %d, offset2 %d -> %d",
|
g_debug ("node %s%s%s%p type '%s', offset %d -> %d, offset2 %d -> %d",
|
||||||
node->name ? "'" : "",
|
node->name ? "'" : "",
|
||||||
node->name ? node->name : "",
|
node->name ? node->name : "",
|
||||||
@ -2347,12 +2347,12 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if str is already in the pool, return previous location, otherwise write str
|
/* if str is already in the pool, return previous location, otherwise write str
|
||||||
* to the typelib at offset, put it in the pool and update offset. If the
|
* to the typelib at offset, put it in the pool and update offset. If the
|
||||||
* typelib is not large enough to hold the string, reallocate it.
|
* typelib is not large enough to hold the string, reallocate it.
|
||||||
*/
|
*/
|
||||||
guint32
|
guint32
|
||||||
write_string (const gchar *str,
|
write_string (const gchar *str,
|
||||||
GHashTable *strings,
|
GHashTable *strings,
|
||||||
guchar *data,
|
guchar *data,
|
||||||
guint32 *offset)
|
guint32 *offset)
|
||||||
{
|
{
|
||||||
@ -2363,7 +2363,7 @@ write_string (const gchar *str,
|
|||||||
string_size += strlen (str);
|
string_size += strlen (str);
|
||||||
|
|
||||||
value = g_hash_table_lookup (strings, str);
|
value = g_hash_table_lookup (strings, str);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
return GPOINTER_TO_UINT (value);
|
return GPOINTER_TO_UINT (value);
|
||||||
|
|
||||||
@ -2376,7 +2376,7 @@ write_string (const gchar *str,
|
|||||||
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);
|
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);
|
||||||
|
|
||||||
strcpy ((gchar*)&data[start], str);
|
strcpy ((gchar*)&data[start], str);
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
62
girnode.h
62
girnode.h
@ -28,7 +28,7 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _GIrTypelibBuild GIrTypelibBuild;
|
typedef struct _GIrTypelibBuild GIrTypelibBuild;
|
||||||
typedef struct _GIrNode GIrNode;
|
typedef struct _GIrNode GIrNode;
|
||||||
typedef struct _GIrNodeFunction GIrNodeFunction;
|
typedef struct _GIrNodeFunction GIrNodeFunction;
|
||||||
typedef struct _GIrNodeParam GIrNodeParam;
|
typedef struct _GIrNodeParam GIrNodeParam;
|
||||||
typedef struct _GIrNodeType GIrNodeType;
|
typedef struct _GIrNodeType GIrNodeType;
|
||||||
@ -53,10 +53,10 @@ struct _GIrTypelibBuild {
|
|||||||
GHashTable *types;
|
GHashTable *types;
|
||||||
GList *offset_ordered_nodes;
|
GList *offset_ordered_nodes;
|
||||||
guint32 n_attributes;
|
guint32 n_attributes;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
G_IR_NODE_INVALID = 0,
|
G_IR_NODE_INVALID = 0,
|
||||||
G_IR_NODE_FUNCTION = 1,
|
G_IR_NODE_FUNCTION = 1,
|
||||||
@ -64,7 +64,7 @@ typedef enum
|
|||||||
G_IR_NODE_STRUCT = 3,
|
G_IR_NODE_STRUCT = 3,
|
||||||
G_IR_NODE_BOXED = 4,
|
G_IR_NODE_BOXED = 4,
|
||||||
G_IR_NODE_ENUM = 5,
|
G_IR_NODE_ENUM = 5,
|
||||||
G_IR_NODE_FLAGS = 6,
|
G_IR_NODE_FLAGS = 6,
|
||||||
G_IR_NODE_OBJECT = 7,
|
G_IR_NODE_OBJECT = 7,
|
||||||
G_IR_NODE_INTERFACE = 8,
|
G_IR_NODE_INTERFACE = 8,
|
||||||
G_IR_NODE_CONSTANT = 9,
|
G_IR_NODE_CONSTANT = 9,
|
||||||
@ -102,7 +102,7 @@ struct _GIrNodeFunction
|
|||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
gboolean is_varargs; /* Not in typelib yet */
|
gboolean is_varargs; /* Not in typelib yet */
|
||||||
|
|
||||||
gboolean is_method;
|
gboolean is_method;
|
||||||
gboolean is_setter;
|
gboolean is_setter;
|
||||||
@ -117,7 +117,7 @@ struct _GIrNodeFunction
|
|||||||
GList *parameters;
|
GList *parameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIrNodeType
|
struct _GIrNodeType
|
||||||
{
|
{
|
||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
@ -138,15 +138,15 @@ struct _GIrNodeType
|
|||||||
gint length;
|
gint length;
|
||||||
gboolean has_size;
|
gboolean has_size;
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
GIrNodeType *parameter_type1;
|
GIrNodeType *parameter_type1;
|
||||||
GIrNodeType *parameter_type2;
|
GIrNodeType *parameter_type2;
|
||||||
|
|
||||||
gchar *interface;
|
gchar *interface;
|
||||||
gchar **errors;
|
gchar **errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIrNodeParam
|
struct _GIrNodeParam
|
||||||
{
|
{
|
||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
@ -159,10 +159,10 @@ struct _GIrNodeParam
|
|||||||
gboolean transfer;
|
gboolean transfer;
|
||||||
gboolean shallow_transfer;
|
gboolean shallow_transfer;
|
||||||
GIScopeType scope;
|
GIScopeType scope;
|
||||||
|
|
||||||
gint8 closure;
|
gint8 closure;
|
||||||
gint8 destroy;
|
gint8 destroy;
|
||||||
|
|
||||||
GIrNodeType *type;
|
GIrNodeType *type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -177,11 +177,11 @@ struct _GIrNodeProperty
|
|||||||
gboolean writable;
|
gboolean writable;
|
||||||
gboolean construct;
|
gboolean construct;
|
||||||
gboolean construct_only;
|
gboolean construct_only;
|
||||||
|
|
||||||
GIrNodeType *type;
|
GIrNodeType *type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIrNodeSignal
|
struct _GIrNodeSignal
|
||||||
{
|
{
|
||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
@ -194,30 +194,30 @@ struct _GIrNodeSignal
|
|||||||
gboolean detailed;
|
gboolean detailed;
|
||||||
gboolean action;
|
gboolean action;
|
||||||
gboolean no_hooks;
|
gboolean no_hooks;
|
||||||
|
|
||||||
gboolean has_class_closure;
|
gboolean has_class_closure;
|
||||||
gboolean true_stops_emit;
|
gboolean true_stops_emit;
|
||||||
|
|
||||||
gint class_closure;
|
gint class_closure;
|
||||||
|
|
||||||
GList *parameters;
|
GList *parameters;
|
||||||
GIrNodeParam *result;
|
GIrNodeParam *result;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIrNodeVFunc
|
struct _GIrNodeVFunc
|
||||||
{
|
{
|
||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
gboolean is_varargs; /* Not in typelib yet */
|
gboolean is_varargs; /* Not in typelib yet */
|
||||||
gboolean must_chain_up;
|
gboolean must_chain_up;
|
||||||
gboolean must_be_implemented;
|
gboolean must_be_implemented;
|
||||||
gboolean must_not_be_implemented;
|
gboolean must_not_be_implemented;
|
||||||
gboolean is_class_closure;
|
gboolean is_class_closure;
|
||||||
|
|
||||||
char *invoker;
|
char *invoker;
|
||||||
|
|
||||||
GList *parameters;
|
GList *parameters;
|
||||||
GIrNodeParam *result;
|
GIrNodeParam *result;
|
||||||
|
|
||||||
gint offset;
|
gint offset;
|
||||||
};
|
};
|
||||||
@ -231,7 +231,7 @@ struct _GIrNodeField
|
|||||||
gint bits;
|
gint bits;
|
||||||
gint offset;
|
gint offset;
|
||||||
GIrNodeFunction *callback;
|
GIrNodeFunction *callback;
|
||||||
|
|
||||||
GIrNodeType *type;
|
GIrNodeType *type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,13 +247,13 @@ struct _GIrNodeInterface
|
|||||||
|
|
||||||
gchar *parent;
|
gchar *parent;
|
||||||
gchar *glib_type_struct;
|
gchar *glib_type_struct;
|
||||||
|
|
||||||
GList *interfaces;
|
GList *interfaces;
|
||||||
GList *prerequisites;
|
GList *prerequisites;
|
||||||
|
|
||||||
gint alignment;
|
gint alignment;
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ struct _GIrNodeConstant
|
|||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
GIrNodeType *type;
|
GIrNodeType *type;
|
||||||
|
|
||||||
gchar *value;
|
gchar *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ struct _GIrNodeEnum
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct _GIrNodeBoxed
|
struct _GIrNodeBoxed
|
||||||
{
|
{
|
||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
@ -301,7 +301,7 @@ struct _GIrNodeBoxed
|
|||||||
|
|
||||||
gint alignment;
|
gint alignment;
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ struct _GIrNodeStruct
|
|||||||
|
|
||||||
gint alignment;
|
gint alignment;
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ struct _GIrNodeUnion
|
|||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
GList *discriminators;
|
GList *discriminators;
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ struct _GIrNodeErrorDomain
|
|||||||
GIrNode node;
|
GIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *getquark;
|
gchar *getquark;
|
||||||
gchar *codes;
|
gchar *codes;
|
||||||
@ -370,7 +370,7 @@ gboolean g_ir_node_can_have_member (GIrNode *node);
|
|||||||
void g_ir_node_add_member (GIrNode *node,
|
void g_ir_node_add_member (GIrNode *node,
|
||||||
GIrNodeFunction *member);
|
GIrNodeFunction *member);
|
||||||
guint32 write_string (const gchar *str,
|
guint32 write_string (const gchar *str,
|
||||||
GHashTable *strings,
|
GHashTable *strings,
|
||||||
guchar *data,
|
guchar *data,
|
||||||
guint32 *offset);
|
guint32 *offset);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ get_type_size_alignment (GIrNodeType *type,
|
|||||||
if (type->tag == GI_TYPE_TAG_ARRAY)
|
if (type->tag == GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
gint elt_size, elt_alignment;
|
gint elt_size, elt_alignment;
|
||||||
|
|
||||||
if (!type->has_size
|
if (!type->has_size
|
||||||
|| !get_type_size_alignment(type->parameter_type1, module, modules,
|
|| !get_type_size_alignment(type->parameter_type1, module, modules,
|
||||||
&elt_size, &elt_alignment, who))
|
&elt_size, &elt_alignment, who))
|
||||||
@ -244,10 +244,10 @@ get_type_size_alignment (GIrNodeType *type,
|
|||||||
*alignment = -1;
|
*alignment = -1;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = type->size * elt_size;
|
*size = type->size * elt_size;
|
||||||
*alignment = elt_alignment;
|
*alignment = elt_alignment;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (type->is_pointer)
|
else if (type->is_pointer)
|
||||||
@ -300,7 +300,7 @@ get_field_size_alignment (GIrNodeField *field,
|
|||||||
{
|
{
|
||||||
gchar *who;
|
gchar *who;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
who = g_strdup_printf ("field %s.%s.%s", module->name, parent_node->name, ((GIrNode *)field)->name);
|
who = g_strdup_printf ("field %s.%s.%s", module->name, parent_node->name, ((GIrNode *)field)->name);
|
||||||
|
|
||||||
if (field->callback)
|
if (field->callback)
|
||||||
|
456
girparser.c
456
girparser.c
File diff suppressed because it is too large
Load Diff
@ -170,7 +170,7 @@ function_generate (GIdlWriter * writer, GIdlNodeFunction * node)
|
|||||||
{
|
{
|
||||||
GIdlNodeParam *param = l->data;
|
GIdlNodeParam *param = l->data;
|
||||||
const gchar *direction = g_idl_node_param_direction_string (param);
|
const gchar *direction = g_idl_node_param_direction_string (param);
|
||||||
|
|
||||||
markup_s = g_string_new ("<parameter");
|
markup_s = g_string_new ("<parameter");
|
||||||
|
|
||||||
g_string_append_printf (markup_s, " name=\"%s\"", param->node.name);
|
g_string_append_printf (markup_s, " name=\"%s\"", param->node.name);
|
||||||
@ -186,7 +186,7 @@ function_generate (GIdlWriter * writer, GIdlNodeFunction * node)
|
|||||||
if (param->allow_none)
|
if (param->allow_none)
|
||||||
g_string_append (markup_s,
|
g_string_append (markup_s,
|
||||||
g_markup_printf_escaped (" allow-none=\"1\""));
|
g_markup_printf_escaped (" allow-none=\"1\""));
|
||||||
|
|
||||||
if (strcmp (direction, "in") != 0)
|
if (strcmp (direction, "in") != 0)
|
||||||
g_string_append (markup_s,
|
g_string_append (markup_s,
|
||||||
g_markup_printf_escaped (" direction=\"%s\"",
|
g_markup_printf_escaped (" direction=\"%s\"",
|
||||||
|
336
gtypelib.c
336
gtypelib.c
@ -1,4 +1,4 @@
|
|||||||
/* GObject introspection: typelib validation, auxiliary functions
|
/* GObject introspection: typelib validation, auxiliary functions
|
||||||
* related to the binary typelib format
|
* related to the binary typelib format
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 Matthias Clasen
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
@ -46,7 +46,7 @@ static void
|
|||||||
pop_context (ValidateContext *ctx)
|
pop_context (ValidateContext *ctx)
|
||||||
{
|
{
|
||||||
g_assert (ctx->context_stack != NULL);
|
g_assert (ctx->context_stack != NULL);
|
||||||
ctx->context_stack = g_slist_delete_link (ctx->context_stack,
|
ctx->context_stack = g_slist_delete_link (ctx->context_stack,
|
||||||
ctx->context_stack);
|
ctx->context_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ get_dir_entry_checked (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid directory index %d", index);
|
"Invalid directory index %d", index);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = header->directory + (index - 1) * header->entry_blob_size;
|
offset = header->directory + (index - 1) * header->entry_blob_size;
|
||||||
@ -139,7 +139,7 @@ g_typelib_get_dir_entry (GTypelib *typelib,
|
|||||||
return (DirEntry *)&typelib->data[header->directory + (index - 1) * header->entry_blob_size];
|
return (DirEntry *)&typelib->data[header->directory + (index - 1) * header->entry_blob_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
g_typelib_check_sanity (void)
|
g_typelib_check_sanity (void)
|
||||||
{
|
{
|
||||||
/* Check that struct layout is as we expect */
|
/* Check that struct layout is as we expect */
|
||||||
@ -161,7 +161,7 @@ g_typelib_check_sanity (void)
|
|||||||
*
|
*
|
||||||
* Everything else in the code however should be using sizeof().
|
* Everything else in the code however should be using sizeof().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CHECK_SIZE (Header, 112);
|
CHECK_SIZE (Header, 112);
|
||||||
CHECK_SIZE (DirEntry, 12);
|
CHECK_SIZE (DirEntry, 12);
|
||||||
CHECK_SIZE (SimpleTypeBlob, 4);
|
CHECK_SIZE (SimpleTypeBlob, 4);
|
||||||
@ -237,7 +237,7 @@ validate_name (GTypelib *typelib,
|
|||||||
if (!name)
|
if (!name)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!memchr (name, '\0', MAX_NAME_LEN))
|
if (!memchr (name, '\0', MAX_NAME_LEN))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
@ -246,8 +246,8 @@ validate_name (GTypelib *typelib,
|
|||||||
msg, name);
|
msg, name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strspn (name, G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_") < strlen (name))
|
if (strspn (name, G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_") < strlen (name))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
@ -256,11 +256,11 @@ validate_name (GTypelib *typelib,
|
|||||||
msg, name);
|
msg, name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_header (ValidateContext *ctx,
|
validate_header (ValidateContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -285,7 +285,7 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Magic string not found");
|
"Magic string not found");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header->major_version != 2 || header->minor_version != 0)
|
if (header->major_version != 2 || header->minor_version != 0)
|
||||||
@ -295,7 +295,7 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Version mismatch");
|
"Version mismatch");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header->n_entries < header->n_local_entries)
|
if (header->n_entries < header->n_local_entries)
|
||||||
@ -304,7 +304,7 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Inconsistent entry counts");
|
"Inconsistent entry counts");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header->size != typelib->len)
|
if (header->size != typelib->len)
|
||||||
@ -313,12 +313,12 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Typelib size mismatch");
|
"Typelib size mismatch");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a sanity check for a specific typelib; it
|
/* This is a sanity check for a specific typelib; it
|
||||||
* prevents us from loading an incompatible typelib.
|
* prevents us from loading an incompatible typelib.
|
||||||
*
|
*
|
||||||
* The hardcoded checks in g_typelib_check_sanity to
|
* The hardcoded checks in g_typelib_check_sanity to
|
||||||
* protect against inadvertent or buggy changes to the typelib format
|
* protect against inadvertent or buggy changes to the typelib format
|
||||||
* itself.
|
* itself.
|
||||||
@ -347,7 +347,7 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Blob size mismatch");
|
"Blob size mismatch");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_aligned (header->directory))
|
if (!is_aligned (header->directory))
|
||||||
@ -356,7 +356,7 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Misaligned directory");
|
"Misaligned directory");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_aligned (header->attributes))
|
if (!is_aligned (header->attributes))
|
||||||
@ -365,7 +365,7 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Misaligned attributes");
|
"Misaligned attributes");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header->attributes == 0 && header->n_attributes > 0)
|
if (header->attributes == 0 && header->n_attributes > 0)
|
||||||
@ -374,11 +374,11 @@ validate_header (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Wrong number of attributes");
|
"Wrong number of attributes");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "namespace", typelib->data, header->namespace, error))
|
if (!validate_name (typelib, "namespace", typelib->data, header->namespace, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ validate_array_type_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Pointer type exected for tag %d", blob->tag);
|
"Pointer type exected for tag %d", blob->tag);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME validate length */
|
/* FIXME validate length */
|
||||||
@ -460,18 +460,18 @@ validate_param_type_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Pointer type exected for tag %d", blob->tag);
|
"Pointer type exected for tag %d", blob->tag);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blob->n_types != n_params)
|
if (blob->n_types != n_params)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Parameter type number mismatch");
|
"Parameter type number mismatch");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n_params; i++)
|
for (i = 0; i < n_params; i++)
|
||||||
{
|
{
|
||||||
if (!validate_type_blob (typelib,
|
if (!validate_type_blob (typelib,
|
||||||
@ -506,9 +506,9 @@ validate_error_type_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Pointer type exected for tag %d", blob->tag);
|
"Pointer type exected for tag %d", blob->tag);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_domains; i++)
|
for (i = 0; i < blob->n_domains; i++)
|
||||||
{
|
{
|
||||||
if (blob->domains[i] == 0 || blob->domains[i] > header->n_entries)
|
if (blob->domains[i] == 0 || blob->domains[i] > header->n_entries)
|
||||||
@ -517,7 +517,7 @@ validate_error_type_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid directory index %d", blob->domains[i]);
|
"Invalid directory index %d", blob->domains[i]);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = g_typelib_get_dir_entry (typelib, blob->domains[i]);
|
entry = g_typelib_get_dir_entry (typelib, blob->domains[i]);
|
||||||
@ -529,7 +529,7 @@ validate_error_type_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Wrong blob type");
|
"Wrong blob type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,10 +545,10 @@ validate_type_blob (GTypelib *typelib,
|
|||||||
{
|
{
|
||||||
SimpleTypeBlob *simple;
|
SimpleTypeBlob *simple;
|
||||||
InterfaceTypeBlob *iface;
|
InterfaceTypeBlob *iface;
|
||||||
|
|
||||||
simple = (SimpleTypeBlob *)&typelib->data[offset];
|
simple = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
|
|
||||||
if (simple->flags.reserved == 0 &&
|
if (simple->flags.reserved == 0 &&
|
||||||
simple->flags.reserved2 == 0)
|
simple->flags.reserved2 == 0)
|
||||||
{
|
{
|
||||||
if (simple->flags.tag >= GI_TYPE_TAG_ARRAY)
|
if (simple->flags.tag >= GI_TYPE_TAG_ARRAY)
|
||||||
@ -559,7 +559,7 @@ validate_type_blob (GTypelib *typelib,
|
|||||||
"Wrong tag in simple type");
|
"Wrong tag in simple type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simple->flags.tag >= GI_TYPE_TAG_UTF8 &&
|
if (simple->flags.tag >= GI_TYPE_TAG_UTF8 &&
|
||||||
!simple->flags.pointer)
|
!simple->flags.pointer)
|
||||||
{
|
{
|
||||||
@ -567,7 +567,7 @@ validate_type_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Pointer type exected for tag %d", simple->flags.tag);
|
"Pointer type exected for tag %d", simple->flags.tag);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -578,28 +578,28 @@ validate_type_blob (GTypelib *typelib,
|
|||||||
switch (iface->tag)
|
switch (iface->tag)
|
||||||
{
|
{
|
||||||
case GI_TYPE_TAG_ARRAY:
|
case GI_TYPE_TAG_ARRAY:
|
||||||
if (!validate_array_type_blob (typelib, simple->offset,
|
if (!validate_array_type_blob (typelib, simple->offset,
|
||||||
signature_offset, return_type, error))
|
signature_offset, return_type, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INTERFACE:
|
case GI_TYPE_TAG_INTERFACE:
|
||||||
if (!validate_iface_type_blob (typelib, simple->offset,
|
if (!validate_iface_type_blob (typelib, simple->offset,
|
||||||
signature_offset, return_type, error))
|
signature_offset, return_type, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_GLIST:
|
case GI_TYPE_TAG_GLIST:
|
||||||
case GI_TYPE_TAG_GSLIST:
|
case GI_TYPE_TAG_GSLIST:
|
||||||
if (!validate_param_type_blob (typelib, simple->offset,
|
if (!validate_param_type_blob (typelib, simple->offset,
|
||||||
signature_offset, return_type, 1, error))
|
signature_offset, return_type, 1, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_GHASH:
|
case GI_TYPE_TAG_GHASH:
|
||||||
if (!validate_param_type_blob (typelib, simple->offset,
|
if (!validate_param_type_blob (typelib, simple->offset,
|
||||||
signature_offset, return_type, 2, error))
|
signature_offset, return_type, 2, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_ERROR:
|
case GI_TYPE_TAG_ERROR:
|
||||||
if (!validate_error_type_blob (typelib, simple->offset,
|
if (!validate_error_type_blob (typelib, simple->offset,
|
||||||
signature_offset, return_type, error))
|
signature_offset, return_type, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
@ -634,10 +634,10 @@ validate_arg_blob (GTypelib *typelib,
|
|||||||
blob = (ArgBlob*) &typelib->data[offset];
|
blob = (ArgBlob*) &typelib->data[offset];
|
||||||
|
|
||||||
if (!validate_name (typelib, "argument", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "argument", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_type_blob (typelib,
|
if (!validate_type_blob (typelib,
|
||||||
offset + G_STRUCT_OFFSET (ArgBlob, arg_type),
|
offset + G_STRUCT_OFFSET (ArgBlob, arg_type),
|
||||||
signature_offset, FALSE, error))
|
signature_offset, FALSE, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -693,18 +693,18 @@ validate_signature_blob (GTypelib *typelib,
|
|||||||
|
|
||||||
if (blob->return_type.offset != 0)
|
if (blob->return_type.offset != 0)
|
||||||
{
|
{
|
||||||
if (!validate_type_blob (typelib,
|
if (!validate_type_blob (typelib,
|
||||||
offset + G_STRUCT_OFFSET (SignatureBlob, return_type),
|
offset + G_STRUCT_OFFSET (SignatureBlob, return_type),
|
||||||
offset, TRUE, error))
|
offset, TRUE, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_arguments; i++)
|
for (i = 0; i < blob->n_arguments; i++)
|
||||||
{
|
{
|
||||||
if (!validate_arg_blob (typelib,
|
if (!validate_arg_blob (typelib,
|
||||||
offset + sizeof (SignatureBlob) +
|
offset + sizeof (SignatureBlob) +
|
||||||
i * sizeof (ArgBlob),
|
i * sizeof (ArgBlob),
|
||||||
offset,
|
offset,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -746,12 +746,12 @@ validate_function_blob (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "function", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "function", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
if (!validate_name (typelib, "function symbol", typelib->data, blob->symbol, error))
|
if (!validate_name (typelib, "function symbol", typelib->data, blob->symbol, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
switch (container_type)
|
switch (container_type)
|
||||||
{
|
{
|
||||||
@ -765,7 +765,7 @@ validate_function_blob (ValidateContext *ctx,
|
|||||||
default:
|
default:
|
||||||
is_method = FALSE;
|
is_method = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blob->constructor)
|
if (blob->constructor)
|
||||||
{
|
{
|
||||||
switch (container_type)
|
switch (container_type)
|
||||||
@ -820,7 +820,7 @@ validate_function_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
sigblob = (SignatureBlob*) &typelib->data[blob->signature];
|
sigblob = (SignatureBlob*) &typelib->data[blob->signature];
|
||||||
|
|
||||||
if (blob->constructor)
|
if (blob->constructor)
|
||||||
{
|
{
|
||||||
SimpleTypeBlob *simple = return_type_from_signature (typelib,
|
SimpleTypeBlob *simple = return_type_from_signature (typelib,
|
||||||
blob->signature,
|
blob->signature,
|
||||||
@ -877,15 +877,15 @@ validate_callback_blob (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "callback", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "callback", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
if (!validate_signature_blob (typelib, blob->signature, error))
|
if (!validate_signature_blob (typelib, blob->signature, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pop_context (ctx);
|
pop_context (ctx);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,9 +950,9 @@ validate_constant_blob (GTypelib *typelib,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "constant", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "constant", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_type_blob (typelib, offset + G_STRUCT_OFFSET (ConstantBlob, type),
|
if (!validate_type_blob (typelib, offset + G_STRUCT_OFFSET (ConstantBlob, type),
|
||||||
0, FALSE, error))
|
0, FALSE, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -964,7 +964,7 @@ validate_constant_blob (GTypelib *typelib,
|
|||||||
"Misaligned constant value");
|
"Misaligned constant value");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
|
type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
|
||||||
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
||||||
{
|
{
|
||||||
@ -1011,8 +1011,8 @@ validate_value_blob (GTypelib *typelib,
|
|||||||
blob = (ValueBlob*) &typelib->data[offset];
|
blob = (ValueBlob*) &typelib->data[offset];
|
||||||
|
|
||||||
if (!validate_name (typelib, "value", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "value", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1035,9 +1035,9 @@ validate_field_blob (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
blob = (FieldBlob*) &typelib->data[offset];
|
blob = (FieldBlob*) &typelib->data[offset];
|
||||||
|
|
||||||
if (!validate_name (typelib, "field", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "field", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (blob->has_embedded_type)
|
if (blob->has_embedded_type)
|
||||||
{
|
{
|
||||||
@ -1045,7 +1045,7 @@ validate_field_blob (ValidateContext *ctx,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else if (!validate_type_blob (typelib,
|
else if (!validate_type_blob (typelib,
|
||||||
offset + G_STRUCT_OFFSET (FieldBlob, type),
|
offset + G_STRUCT_OFFSET (FieldBlob, type),
|
||||||
0, FALSE, error))
|
0, FALSE, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -1069,12 +1069,12 @@ validate_property_blob (GTypelib *typelib,
|
|||||||
}
|
}
|
||||||
|
|
||||||
blob = (PropertyBlob*) &typelib->data[offset];
|
blob = (PropertyBlob*) &typelib->data[offset];
|
||||||
|
|
||||||
if (!validate_name (typelib, "property", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "property", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_type_blob (typelib,
|
if (!validate_type_blob (typelib,
|
||||||
offset + G_STRUCT_OFFSET (PropertyBlob, type),
|
offset + G_STRUCT_OFFSET (PropertyBlob, type),
|
||||||
0, FALSE, error))
|
0, FALSE, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -1102,17 +1102,17 @@ validate_signal_blob (GTypelib *typelib,
|
|||||||
blob = (SignalBlob*) &typelib->data[offset];
|
blob = (SignalBlob*) &typelib->data[offset];
|
||||||
|
|
||||||
if (!validate_name (typelib, "signal", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "signal", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ((blob->run_first != 0) +
|
if ((blob->run_first != 0) +
|
||||||
(blob->run_last != 0) +
|
(blob->run_last != 0) +
|
||||||
(blob->run_cleanup != 0) != 1)
|
(blob->run_cleanup != 0) != 1)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid signal run flags");
|
"Invalid signal run flags");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blob->has_class_closure)
|
if (blob->has_class_closure)
|
||||||
@ -1122,15 +1122,15 @@ validate_signal_blob (GTypelib *typelib,
|
|||||||
ObjectBlob *object;
|
ObjectBlob *object;
|
||||||
|
|
||||||
object = (ObjectBlob*)&typelib->data[container_offset];
|
object = (ObjectBlob*)&typelib->data[container_offset];
|
||||||
|
|
||||||
n_signals = object->n_signals;
|
n_signals = object->n_signals;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterfaceBlob *iface;
|
InterfaceBlob *iface;
|
||||||
|
|
||||||
iface = (InterfaceBlob*)&typelib->data[container_offset];
|
iface = (InterfaceBlob*)&typelib->data[container_offset];
|
||||||
|
|
||||||
n_signals = iface->n_signals;
|
n_signals = iface->n_signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1140,13 +1140,13 @@ validate_signal_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid class closure index");
|
"Invalid class closure index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_signature_blob (typelib, blob->signature, error))
|
if (!validate_signature_blob (typelib, blob->signature, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1171,8 +1171,8 @@ validate_vfunc_blob (GTypelib *typelib,
|
|||||||
blob = (VFuncBlob*) &typelib->data[offset];
|
blob = (VFuncBlob*) &typelib->data[offset];
|
||||||
|
|
||||||
if (!validate_name (typelib, "vfunc", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "vfunc", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (blob->class_closure)
|
if (blob->class_closure)
|
||||||
{
|
{
|
||||||
if (((CommonBlob*)&typelib->data[container_offset])->blob_type == BLOB_TYPE_OBJECT)
|
if (((CommonBlob*)&typelib->data[container_offset])->blob_type == BLOB_TYPE_OBJECT)
|
||||||
@ -1180,15 +1180,15 @@ validate_vfunc_blob (GTypelib *typelib,
|
|||||||
ObjectBlob *object;
|
ObjectBlob *object;
|
||||||
|
|
||||||
object = (ObjectBlob*)&typelib->data[container_offset];
|
object = (ObjectBlob*)&typelib->data[container_offset];
|
||||||
|
|
||||||
n_vfuncs = object->n_vfuncs;
|
n_vfuncs = object->n_vfuncs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterfaceBlob *iface;
|
InterfaceBlob *iface;
|
||||||
|
|
||||||
iface = (InterfaceBlob*)&typelib->data[container_offset];
|
iface = (InterfaceBlob*)&typelib->data[container_offset];
|
||||||
|
|
||||||
n_vfuncs = iface->n_vfuncs;
|
n_vfuncs = iface->n_vfuncs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1198,13 +1198,13 @@ validate_vfunc_blob (GTypelib *typelib,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid class closure index");
|
"Invalid class closure index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_signature_blob (typelib, blob->signature, error))
|
if (!validate_signature_blob (typelib, blob->signature, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1240,17 +1240,17 @@ validate_struct_blob (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "struct", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "struct", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
if (!blob->unregistered)
|
if (!blob->unregistered)
|
||||||
{
|
{
|
||||||
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_name, error))
|
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_init, error))
|
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_init, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1260,11 +1260,11 @@ validate_struct_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Gtype data in struct");
|
"Gtype data in struct");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (StructBlob) +
|
if (typelib->len < offset + sizeof (StructBlob) +
|
||||||
blob->n_fields * sizeof (FieldBlob) +
|
blob->n_fields * sizeof (FieldBlob) +
|
||||||
blob->n_methods * sizeof (FunctionBlob))
|
blob->n_methods * sizeof (FunctionBlob))
|
||||||
{
|
{
|
||||||
@ -1292,9 +1292,9 @@ validate_struct_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
for (i = 0; i < blob->n_methods; i++)
|
for (i = 0; i < blob->n_methods; i++)
|
||||||
{
|
{
|
||||||
if (!validate_function_blob (ctx,
|
if (!validate_function_blob (ctx,
|
||||||
field_offset +
|
field_offset +
|
||||||
i * sizeof (FunctionBlob),
|
i * sizeof (FunctionBlob),
|
||||||
blob_type,
|
blob_type,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1334,14 +1334,14 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
"Wrong blob type");
|
"Wrong blob type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!blob->unregistered)
|
if (!blob->unregistered)
|
||||||
{
|
{
|
||||||
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_name, error))
|
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_init, error))
|
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_init, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1351,14 +1351,14 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Gtype data in unregistered enum");
|
"Gtype data in unregistered enum");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "enum", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "enum", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (EnumBlob) +
|
if (typelib->len < offset + sizeof (EnumBlob) +
|
||||||
blob->n_values * sizeof (ValueBlob))
|
blob->n_values * sizeof (ValueBlob))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@ -1369,21 +1369,21 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
for (i = 0; i < blob->n_values; i++)
|
for (i = 0; i < blob->n_values; i++)
|
||||||
{
|
{
|
||||||
if (!validate_value_blob (typelib,
|
if (!validate_value_blob (typelib,
|
||||||
offset + sizeof (EnumBlob) +
|
offset + sizeof (EnumBlob) +
|
||||||
i * sizeof (ValueBlob),
|
i * sizeof (ValueBlob),
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
v1 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
|
v1 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
|
||||||
i * sizeof (ValueBlob)];
|
i * sizeof (ValueBlob)];
|
||||||
for (j = 0; j < i; j++)
|
for (j = 0; j < i; j++)
|
||||||
{
|
{
|
||||||
v2 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
|
v2 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
|
||||||
j * sizeof (ValueBlob)];
|
j * sizeof (ValueBlob)];
|
||||||
|
|
||||||
if (v1->value == v2->value)
|
if (v1->value == v2->value)
|
||||||
@ -1397,11 +1397,11 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_context (ctx);
|
pop_context (ctx);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1437,15 +1437,15 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
"Wrong blob type");
|
"Wrong blob type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "object", typelib->data, blob->gtype_name, error))
|
if (!validate_name (typelib, "object", typelib->data, blob->gtype_name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_name (typelib, "object", typelib->data, blob->gtype_init, error))
|
if (!validate_name (typelib, "object", typelib->data, blob->gtype_init, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_name (typelib, "object", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "object", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (blob->parent > header->n_entries)
|
if (blob->parent > header->n_entries)
|
||||||
{
|
{
|
||||||
@ -1453,7 +1453,7 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid parent index");
|
"Invalid parent index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blob->parent != 0)
|
if (blob->parent != 0)
|
||||||
@ -1470,10 +1470,10 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Parent not object");
|
"Parent not object");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blob->gtype_struct != 0)
|
if (blob->gtype_struct != 0)
|
||||||
{
|
{
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
@ -1487,11 +1487,11 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Class struct invalid type or not local");
|
"Class struct invalid type or not local");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (ObjectBlob) +
|
if (typelib->len < offset + sizeof (ObjectBlob) +
|
||||||
(blob->n_interfaces + blob->n_interfaces % 2) * 2 +
|
(blob->n_interfaces + blob->n_interfaces % 2) * 2 +
|
||||||
blob->n_fields * sizeof (FieldBlob) +
|
blob->n_fields * sizeof (FieldBlob) +
|
||||||
blob->n_properties * sizeof (PropertyBlob) +
|
blob->n_properties * sizeof (PropertyBlob) +
|
||||||
@ -1499,7 +1499,7 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
blob->n_signals * sizeof (SignalBlob) +
|
blob->n_signals * sizeof (SignalBlob) +
|
||||||
blob->n_vfuncs * sizeof (VFuncBlob) +
|
blob->n_vfuncs * sizeof (VFuncBlob) +
|
||||||
blob->n_constants * sizeof (ConstantBlob))
|
blob->n_constants * sizeof (ConstantBlob))
|
||||||
|
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
@ -1522,9 +1522,9 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid interface index");
|
"Invalid interface index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = get_dir_entry_checked (typelib, iface, error);
|
entry = get_dir_entry_checked (typelib, iface, error);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1536,14 +1536,14 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Not an interface");
|
"Not an interface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset2 += 2 * (blob->n_interfaces %2);
|
offset2 += 2 * (blob->n_interfaces %2);
|
||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
for (i = 0; i < blob->n_fields; i++, offset2 += sizeof (FieldBlob))
|
for (i = 0; i < blob->n_fields; i++, offset2 += sizeof (FieldBlob))
|
||||||
{
|
{
|
||||||
if (!validate_field_blob (ctx, offset2, error))
|
if (!validate_field_blob (ctx, offset2, error))
|
||||||
@ -1595,7 +1595,7 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
gint i;
|
gint i;
|
||||||
guint32 offset2;
|
guint32 offset2;
|
||||||
|
|
||||||
header = (Header *)typelib->data;
|
header = (Header *)typelib->data;
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (InterfaceBlob))
|
if (typelib->len < offset + sizeof (InterfaceBlob))
|
||||||
@ -1617,24 +1617,24 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
"Wrong blob type; expected interface, got %d", blob->blob_type);
|
"Wrong blob type; expected interface, got %d", blob->blob_type);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "interface", typelib->data, blob->gtype_name, error))
|
if (!validate_name (typelib, "interface", typelib->data, blob->gtype_name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_name (typelib, "interface", typelib->data, blob->gtype_init, error))
|
if (!validate_name (typelib, "interface", typelib->data, blob->gtype_init, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!validate_name (typelib, "interface", typelib->data, blob->name, error))
|
if (!validate_name (typelib, "interface", typelib->data, blob->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (InterfaceBlob) +
|
if (typelib->len < offset + sizeof (InterfaceBlob) +
|
||||||
(blob->n_prerequisites + blob->n_prerequisites % 2) * 2 +
|
(blob->n_prerequisites + blob->n_prerequisites % 2) * 2 +
|
||||||
blob->n_properties * sizeof (PropertyBlob) +
|
blob->n_properties * sizeof (PropertyBlob) +
|
||||||
blob->n_methods * sizeof (FunctionBlob) +
|
blob->n_methods * sizeof (FunctionBlob) +
|
||||||
blob->n_signals * sizeof (SignalBlob) +
|
blob->n_signals * sizeof (SignalBlob) +
|
||||||
blob->n_vfuncs * sizeof (VFuncBlob) +
|
blob->n_vfuncs * sizeof (VFuncBlob) +
|
||||||
blob->n_constants * sizeof (ConstantBlob))
|
blob->n_constants * sizeof (ConstantBlob))
|
||||||
|
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
@ -1657,7 +1657,7 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Invalid prerequisite index");
|
"Invalid prerequisite index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = g_typelib_get_dir_entry (typelib, req);
|
entry = g_typelib_get_dir_entry (typelib, req);
|
||||||
@ -1669,14 +1669,14 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Not an interface or object");
|
"Not an interface or object");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset2 += 2 * (blob->n_prerequisites % 2);
|
offset2 += 2 * (blob->n_prerequisites % 2);
|
||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
for (i = 0; i < blob->n_properties; i++, offset2 += sizeof (PropertyBlob))
|
for (i = 0; i < blob->n_properties; i++, offset2 += sizeof (PropertyBlob))
|
||||||
{
|
{
|
||||||
if (!validate_property_blob (typelib, offset2, error))
|
if (!validate_property_blob (typelib, offset2, error))
|
||||||
@ -1688,13 +1688,13 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_INTERFACE, error))
|
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_INTERFACE, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_signals; i++, offset2 += sizeof (SignalBlob))
|
for (i = 0; i < blob->n_signals; i++, offset2 += sizeof (SignalBlob))
|
||||||
{
|
{
|
||||||
if (!validate_signal_blob (typelib, offset2, offset, error))
|
if (!validate_signal_blob (typelib, offset2, offset, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_vfuncs; i++, offset2 += sizeof (VFuncBlob))
|
for (i = 0; i < blob->n_vfuncs; i++, offset2 += sizeof (VFuncBlob))
|
||||||
{
|
{
|
||||||
if (!validate_vfunc_blob (typelib, offset2, offset, error))
|
if (!validate_vfunc_blob (typelib, offset2, offset, error))
|
||||||
@ -1746,7 +1746,7 @@ validate_blob (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
common = (CommonBlob*)&typelib->data[offset];
|
common = (CommonBlob*)&typelib->data[offset];
|
||||||
|
|
||||||
switch (common->blob_type)
|
switch (common->blob_type)
|
||||||
{
|
{
|
||||||
case BLOB_TYPE_FUNCTION:
|
case BLOB_TYPE_FUNCTION:
|
||||||
@ -1788,7 +1788,7 @@ validate_blob (ValidateContext *ctx,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_ENTRY,
|
G_TYPELIB_ERROR_INVALID_ENTRY,
|
||||||
"Invalid blob type");
|
"Invalid blob type");
|
||||||
@ -1798,7 +1798,7 @@ validate_blob (ValidateContext *ctx,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_directory (ValidateContext *ctx,
|
validate_directory (ValidateContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1806,7 +1806,7 @@ validate_directory (ValidateContext *ctx,
|
|||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry))
|
if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@ -1821,8 +1821,8 @@ validate_directory (ValidateContext *ctx,
|
|||||||
entry = g_typelib_get_dir_entry (typelib, i + 1);
|
entry = g_typelib_get_dir_entry (typelib, i + 1);
|
||||||
|
|
||||||
if (!validate_name (typelib, "entry", typelib->data, entry->name, error))
|
if (!validate_name (typelib, "entry", typelib->data, entry->name, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ((entry->local && entry->blob_type == BLOB_TYPE_INVALID) ||
|
if ((entry->local && entry->blob_type == BLOB_TYPE_INVALID) ||
|
||||||
entry->blob_type > BLOB_TYPE_UNION)
|
entry->blob_type > BLOB_TYPE_UNION)
|
||||||
{
|
{
|
||||||
@ -1830,7 +1830,7 @@ validate_directory (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_DIRECTORY,
|
G_TYPELIB_ERROR_INVALID_DIRECTORY,
|
||||||
"Invalid entry type");
|
"Invalid entry type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < header->n_local_entries)
|
if (i < header->n_local_entries)
|
||||||
@ -1868,7 +1868,7 @@ validate_directory (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_name (typelib, "namespace", typelib->data, entry->offset, error))
|
if (!validate_name (typelib, "namespace", typelib->data, entry->offset, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1888,9 +1888,9 @@ validate_attributes (ValidateContext *ctx,
|
|||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID,
|
G_TYPELIB_ERROR_INVALID,
|
||||||
"The buffer is too short");
|
"The buffer is too short");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1902,7 +1902,7 @@ prefix_with_context (GError **error,
|
|||||||
GString *str = g_string_new (NULL);
|
GString *str = g_string_new (NULL);
|
||||||
GSList *link;
|
GSList *link;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
link = ctx->context_stack;
|
link = ctx->context_stack;
|
||||||
if (!link)
|
if (!link)
|
||||||
{
|
{
|
||||||
@ -1922,7 +1922,7 @@ prefix_with_context (GError **error,
|
|||||||
g_free (buf);
|
g_free (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
g_typelib_validate (GTypelib *typelib,
|
g_typelib_validate (GTypelib *typelib,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1965,7 +1965,7 @@ _g_typelib_do_dlopen (GTypelib *typelib)
|
|||||||
{
|
{
|
||||||
Header *header;
|
Header *header;
|
||||||
const char *shlib_str;
|
const char *shlib_str;
|
||||||
|
|
||||||
header = (Header *) typelib->data;
|
header = (Header *) typelib->data;
|
||||||
/* note that NULL shlib means to open the main app, which is allowed */
|
/* note that NULL shlib means to open the main app, which is allowed */
|
||||||
if (header->shared_library)
|
if (header->shared_library)
|
||||||
@ -2059,11 +2059,11 @@ _g_typelib_ensure_open (GTypelib *typelib)
|
|||||||
* g_typelib_new_from_memory:
|
* g_typelib_new_from_memory:
|
||||||
* @memory: address of memory chunk containing the typelib
|
* @memory: address of memory chunk containing the typelib
|
||||||
* @len: length of memory chunk containing the typelib
|
* @len: length of memory chunk containing the typelib
|
||||||
*
|
*
|
||||||
* Creates a new #GTypelib from a memory location. The memory block
|
* Creates a new #GTypelib from a memory location. The memory block
|
||||||
* pointed to by @typelib will be automatically g_free()d when the
|
* pointed to by @typelib will be automatically g_free()d when the
|
||||||
* repository is destroyed.
|
* repository is destroyed.
|
||||||
*
|
*
|
||||||
* Return value: the new #GTypelib
|
* Return value: the new #GTypelib
|
||||||
**/
|
**/
|
||||||
GTypelib *
|
GTypelib *
|
||||||
@ -2084,9 +2084,9 @@ g_typelib_new_from_memory (guchar *memory, gsize len)
|
|||||||
* g_typelib_new_from_const_memory:
|
* g_typelib_new_from_const_memory:
|
||||||
* @memory: address of memory chunk containing the typelib
|
* @memory: address of memory chunk containing the typelib
|
||||||
* @len: length of memory chunk containing the typelib
|
* @len: length of memory chunk containing the typelib
|
||||||
*
|
*
|
||||||
* Creates a new #GTypelib from a memory location.
|
* Creates a new #GTypelib from a memory location.
|
||||||
*
|
*
|
||||||
* Return value: the new #GTypelib
|
* Return value: the new #GTypelib
|
||||||
**/
|
**/
|
||||||
GTypelib *
|
GTypelib *
|
||||||
@ -2106,9 +2106,9 @@ g_typelib_new_from_const_memory (const guchar *memory, gsize len)
|
|||||||
/**
|
/**
|
||||||
* g_typelib_new_from_mapped_file:
|
* g_typelib_new_from_mapped_file:
|
||||||
* @mfile: a #GMappedFile, that will be free'd when the repository is destroyed
|
* @mfile: a #GMappedFile, that will be free'd when the repository is destroyed
|
||||||
*
|
*
|
||||||
* Creates a new #GTypelib from a #GMappedFile.
|
* Creates a new #GTypelib from a #GMappedFile.
|
||||||
*
|
*
|
||||||
* Return value: the new #GTypelib
|
* Return value: the new #GTypelib
|
||||||
**/
|
**/
|
||||||
GTypelib *
|
GTypelib *
|
||||||
@ -2128,7 +2128,7 @@ g_typelib_new_from_mapped_file (GMappedFile *mfile)
|
|||||||
/**
|
/**
|
||||||
* g_typelib_free:
|
* g_typelib_free:
|
||||||
* @typelib: a #GTypelib
|
* @typelib: a #GTypelib
|
||||||
*
|
*
|
||||||
* Free a #GTypelib.
|
* Free a #GTypelib.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
@ -2167,7 +2167,7 @@ gboolean
|
|||||||
g_typelib_symbol (GTypelib *typelib, const char *symbol_name, gpointer *symbol)
|
g_typelib_symbol (GTypelib *typelib, const char *symbol_name, gpointer *symbol)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
_g_typelib_ensure_open (typelib);
|
_g_typelib_ensure_open (typelib);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2177,9 +2177,9 @@ g_typelib_symbol (GTypelib *typelib, const char *symbol_name, gpointer *symbol)
|
|||||||
* will be the custom one, which overrides the main one. A bit
|
* will be the custom one, which overrides the main one. A bit
|
||||||
* inefficient, but the problem will go away when gir-repository
|
* inefficient, but the problem will go away when gir-repository
|
||||||
* does.
|
* does.
|
||||||
*
|
*
|
||||||
* For modules with no shared library, we dlopen'd the current
|
* For modules with no shared library, we dlopen'd the current
|
||||||
* process above.
|
* process above.
|
||||||
*/
|
*/
|
||||||
for (l = typelib->modules; l; l = l->next)
|
for (l = typelib->modules; l; l = l->next)
|
||||||
{
|
{
|
||||||
|
252
gtypelib.h
252
gtypelib.h
@ -35,21 +35,21 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* The "typelib" is a binary, readonly, memory-mappable database
|
* The "typelib" is a binary, readonly, memory-mappable database
|
||||||
* containing reflective information about a GObject library.
|
* containing reflective information about a GObject library.
|
||||||
*
|
*
|
||||||
* The format of GObject typelib is strongly influenced by the Mozilla XPCOM
|
* The format of GObject typelib is strongly influenced by the Mozilla XPCOM
|
||||||
* format.
|
* format.
|
||||||
*
|
*
|
||||||
* Some of the differences to XPCOM include:
|
* Some of the differences to XPCOM include:
|
||||||
* - Type information is stored not quite as compactly (XPCOM stores it inline
|
* - Type information is stored not quite as compactly (XPCOM stores it inline
|
||||||
* in function descriptions in variable-sized blobs of 1 to n bytes. We store
|
* in function descriptions in variable-sized blobs of 1 to n bytes. We store
|
||||||
* 16 bits of type information for each parameter, which is enough to encode
|
* 16 bits of type information for each parameter, which is enough to encode
|
||||||
* simple types inline. Complex (e.g. recursive) types are stored out of line
|
* simple types inline. Complex (e.g. recursive) types are stored out of line
|
||||||
* in a separate list of types.
|
* in a separate list of types.
|
||||||
* - String and complex type data is stored outside of typelib entry blobs,
|
* - String and complex type data is stored outside of typelib entry blobs,
|
||||||
* references are stored as offsets relative to the start of the typelib.
|
* references are stored as offsets relative to the start of the typelib.
|
||||||
* One possibility is to store the strings and types in a pools at the end
|
* One possibility is to store the strings and types in a pools at the end
|
||||||
* of the typelib.
|
* of the typelib.
|
||||||
*
|
*
|
||||||
* The typelib has the following general format.
|
* The typelib has the following general format.
|
||||||
*
|
*
|
||||||
* typelib ::= header, directory, blobs, attributes, attributedata
|
* typelib ::= header, directory, blobs, attributes, attributedata
|
||||||
@ -63,8 +63,8 @@ G_BEGIN_DECLS
|
|||||||
* attributedata ::= string data for attributes
|
* attributedata ::= string data for attributes
|
||||||
*
|
*
|
||||||
* Details
|
* Details
|
||||||
*
|
*
|
||||||
* We describe the fragments that make up the typelib in the form of C structs
|
* We describe the fragments that make up the typelib in the form of C structs
|
||||||
* (although some fall short of being valid C structs since they contain multiple
|
* (although some fall short of being valid C structs since they contain multiple
|
||||||
* flexible arrays).
|
* flexible arrays).
|
||||||
*/
|
*/
|
||||||
@ -113,11 +113,11 @@ Changes since 0.1:
|
|||||||
- use 'blob' as collective name for the various blob types
|
- use 'blob' as collective name for the various blob types
|
||||||
- rename 'type' field in blobs to 'blob_type'
|
- rename 'type' field in blobs to 'blob_type'
|
||||||
- rename 'type_name' and 'type_init' fields to 'gtype_name', 'gtype_init'
|
- rename 'type_name' and 'type_init' fields to 'gtype_name', 'gtype_init'
|
||||||
- shrink directory entries to 12 bytes
|
- shrink directory entries to 12 bytes
|
||||||
- merge struct and boxed blobs
|
- merge struct and boxed blobs
|
||||||
- split interface blobs into enum, object and interface blobs
|
- split interface blobs into enum, object and interface blobs
|
||||||
- add an 'unregistered' flag to struct and enum blobs
|
- add an 'unregistered' flag to struct and enum blobs
|
||||||
- add a 'wraps_vfunc' flag to function blobs and link them to
|
- add a 'wraps_vfunc' flag to function blobs and link them to
|
||||||
the vfuncs they wrap
|
the vfuncs they wrap
|
||||||
- restrict value blobs to only occur inside enums and flags again
|
- restrict value blobs to only occur inside enums and flags again
|
||||||
- add constant blobs, allow them toplevel, in interfaces and in objects
|
- add constant blobs, allow them toplevel, in interfaces and in objects
|
||||||
@ -133,8 +133,8 @@ Changes since 0.1:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* G_IR_MAGIC:
|
* G_IR_MAGIC:
|
||||||
*
|
*
|
||||||
* Identifying prefix for the typelib. This was inspired by XPCOM,
|
* Identifying prefix for the typelib. This was inspired by XPCOM,
|
||||||
* which in turn borrowed from PNG.
|
* which in turn borrowed from PNG.
|
||||||
*/
|
*/
|
||||||
#define G_IR_MAGIC "GOBJ\nMETADATA\r\n\032"
|
#define G_IR_MAGIC "GOBJ\nMETADATA\r\n\032"
|
||||||
@ -153,7 +153,7 @@ Changes since 0.1:
|
|||||||
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
|
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
|
||||||
* @BLOB_TYPE_ERROR_DOMAIN: A #ErrorDomainBlob
|
* @BLOB_TYPE_ERROR_DOMAIN: A #ErrorDomainBlob
|
||||||
* @BLOB_TYPE_UNION: A #UnionBlob
|
* @BLOB_TYPE_UNION: A #UnionBlob
|
||||||
*
|
*
|
||||||
* The integral value of this enumeration appears in each "Blob"
|
* The integral value of this enumeration appears in each "Blob"
|
||||||
* component of a typelib to identify its type.
|
* component of a typelib to identify its type.
|
||||||
*/
|
*/
|
||||||
@ -182,8 +182,8 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* Header:
|
* Header:
|
||||||
* @magic: See #G_IR_MAGIC.
|
* @magic: See #G_IR_MAGIC.
|
||||||
* @major_version: The version of the typelib format. Minor version changes indicate
|
* @major_version: The version of the typelib format. Minor version changes indicate
|
||||||
* compatible changes and should still allow the typelib to be parsed
|
* compatible changes and should still allow the typelib to be parsed
|
||||||
* by a parser designed for the same major_version.
|
* by a parser designed for the same major_version.
|
||||||
* @minor_version: See major_version.
|
* @minor_version: See major_version.
|
||||||
* @n_entries: The number of entries in the directory.
|
* @n_entries: The number of entries in the directory.
|
||||||
@ -197,7 +197,7 @@ typedef enum {
|
|||||||
* dependencies are required in order to avoid having programs
|
* dependencies are required in order to avoid having programs
|
||||||
* consuming a typelib check for an "Unresolved" type return
|
* consuming a typelib check for an "Unresolved" type return
|
||||||
* from every API call.
|
* from every API call.
|
||||||
* @size: The size in bytes of the typelib.
|
* @size: The size in bytes of the typelib.
|
||||||
* @namespace: Offset of the namespace string in the typelib.
|
* @namespace: Offset of the namespace string in the typelib.
|
||||||
* @nsversion: Offset of the namespace version string in the typelib.
|
* @nsversion: Offset of the namespace version string in the typelib.
|
||||||
* @shared_library: This field is the set of shared libraries associated
|
* @shared_library: This field is the set of shared libraries associated
|
||||||
@ -222,13 +222,13 @@ typedef enum {
|
|||||||
* @struct_blob_size: See above.
|
* @struct_blob_size: See above.
|
||||||
* @error_domain_blob_size: See above.
|
* @error_domain_blob_size: See above.
|
||||||
* @interface_blob_size: For variable-size blobs, the size of the struct up to the first
|
* @interface_blob_size: For variable-size blobs, the size of the struct up to the first
|
||||||
* flexible array member. Recording this information here allows to
|
* flexible array member. Recording this information here allows to
|
||||||
* write parser which continue to work if the format is extended by
|
* write parser which continue to work if the format is extended by
|
||||||
* adding new fields before the first flexible array member in
|
* adding new fields before the first flexible array member in
|
||||||
* variable-size blobs.
|
* variable-size blobs.
|
||||||
*
|
*
|
||||||
* The header structure appears exactly once at the beginning of a typelib. It is a
|
* The header structure appears exactly once at the beginning of a typelib. It is a
|
||||||
* collection of meta-information, such as the number of entries and dependencies.
|
* collection of meta-information, such as the number of entries and dependencies.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar magic[16];
|
gchar magic[16];
|
||||||
@ -268,7 +268,7 @@ typedef struct {
|
|||||||
guint16 object_blob_size;
|
guint16 object_blob_size;
|
||||||
guint16 interface_blob_size;
|
guint16 interface_blob_size;
|
||||||
guint16 union_blob_size;
|
guint16 union_blob_size;
|
||||||
|
|
||||||
guint16 padding[7];
|
guint16 padding[7];
|
||||||
} Header;
|
} Header;
|
||||||
|
|
||||||
@ -280,10 +280,10 @@ typedef struct {
|
|||||||
* @offset: If is_local is set, this is the offset of the blob in the typelib.
|
* @offset: If is_local is set, this is the offset of the blob in the typelib.
|
||||||
* Otherwise, it is the offset of the namespace in which the blob has
|
* Otherwise, it is the offset of the namespace in which the blob has
|
||||||
* to be looked up by name.
|
* to be looked up by name.
|
||||||
*
|
*
|
||||||
* References to directory entries are stored as 1-based 16-bit indexes.
|
* References to directory entries are stored as 1-based 16-bit indexes.
|
||||||
*
|
*
|
||||||
* All blobs pointed to by a directory entry start with the same layout for
|
* All blobs pointed to by a directory entry start with the same layout for
|
||||||
* the first 8 bytes (the reserved flags may be used by some blob types)
|
* the first 8 bytes (the reserved flags may be used by some blob types)
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -298,9 +298,9 @@ typedef struct {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* SimpleTypeBlob:
|
* SimpleTypeBlob:
|
||||||
* @is_pointer: Indicates whether the type is passed by reference.
|
* @is_pointer: Indicates whether the type is passed by reference.
|
||||||
* @tag: A #GITypeTag
|
* @tag: A #GITypeTag
|
||||||
* @offset: Offset relative to header->types that points to a TypeBlob.
|
* @offset: Offset relative to header->types that points to a TypeBlob.
|
||||||
* Unlike other offsets, this is in words (ie 32bit units) rather
|
* Unlike other offsets, this is in words (ie 32bit units) rather
|
||||||
* than bytes.
|
* than bytes.
|
||||||
*
|
*
|
||||||
@ -320,53 +320,53 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
guint reserved : 8;
|
guint reserved : 8;
|
||||||
guint reserved2 :16;
|
guint reserved2 :16;
|
||||||
guint pointer : 1;
|
guint pointer : 1;
|
||||||
guint reserved3 : 2;
|
guint reserved3 : 2;
|
||||||
guint tag : 5;
|
guint tag : 5;
|
||||||
} flags;
|
} flags;
|
||||||
guint32 offset;
|
guint32 offset;
|
||||||
} SimpleTypeBlob;
|
} SimpleTypeBlob;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ArgBlob:
|
* ArgBlob:
|
||||||
* @name: A suggested name for the parameter.
|
* @name: A suggested name for the parameter.
|
||||||
* @in: The parameter is an input to the function
|
* @in: The parameter is an input to the function
|
||||||
* @out: The parameter is used to return an output of the function.
|
* @out: The parameter is used to return an output of the function.
|
||||||
* Parameters can be both in and out. Out parameters implicitly
|
* Parameters can be both in and out. Out parameters implicitly
|
||||||
* add another level of indirection to the parameter type. Ie if
|
* add another level of indirection to the parameter type. Ie if
|
||||||
* the type is uint32 in an out parameter, the function actually
|
* the type is uint32 in an out parameter, the function actually
|
||||||
* takes an uint32*.
|
* takes an uint32*.
|
||||||
* @dipper: The parameter is a pointer to a struct or object that will
|
* @dipper: The parameter is a pointer to a struct or object that will
|
||||||
* receive an output of the function.
|
* receive an output of the function.
|
||||||
* @allow_none: Only meaningful for types which are passed as pointers.
|
* @allow_none: Only meaningful for types which are passed as pointers.
|
||||||
* For an in parameter, indicates if it is ok to pass NULL in, for
|
* For an in parameter, indicates if it is ok to pass NULL in, for
|
||||||
* an out parameter, whether it may return NULL. Note that NULL is a
|
* an out parameter, whether it may return NULL. Note that NULL is a
|
||||||
* valid GList and GSList value, thus allow_none will normally be set
|
* valid GList and GSList value, thus allow_none will normally be set
|
||||||
* for parameters of these types.
|
* for parameters of these types.
|
||||||
* @optional: For an out parameter, indicates that NULL may be passed in
|
* @optional: For an out parameter, indicates that NULL may be passed in
|
||||||
* if the value is not needed.
|
* if the value is not needed.
|
||||||
* @transfer_ownership: For an in parameter, indicates that the function takes over
|
* @transfer_ownership: For an in parameter, indicates that the function takes over
|
||||||
* ownership of the parameter value. For an out parameter, it
|
* ownership of the parameter value. For an out parameter, it
|
||||||
* indicates that the caller is responsible for freeing the return
|
* indicates that the caller is responsible for freeing the return
|
||||||
* value.
|
* value.
|
||||||
* @transfer_container_ownership: For container types, indicates that the
|
* @transfer_container_ownership: For container types, indicates that the
|
||||||
* ownership of the container, but not of its contents is transferred. This is typically the case
|
* ownership of the container, but not of its contents is transferred. This is typically the case
|
||||||
* for out parameters returning lists of statically allocated things.
|
* for out parameters returning lists of statically allocated things.
|
||||||
* @is_return_value: The parameter should be considered the return value of the function.
|
* @is_return_value: The parameter should be considered the return value of the function.
|
||||||
* Only out parameters can be marked as return value, and there can be
|
* Only out parameters can be marked as return value, and there can be
|
||||||
* at most one per function call. If an out parameter is marked as
|
* at most one per function call. If an out parameter is marked as
|
||||||
* return value, the actual return value of the function should be
|
* return value, the actual return value of the function should be
|
||||||
* either void or a boolean indicating the success of the call.
|
* either void or a boolean indicating the success of the call.
|
||||||
* @scope: A #GIScopeType. If the parameter is of a callback type, this denotes the scope
|
* @scope: A #GIScopeType. If the parameter is of a callback type, this denotes the scope
|
||||||
* of the user_data and the callback function pointer itself
|
* of the user_data and the callback function pointer itself
|
||||||
* (for languages that emit code at run-time).
|
* (for languages that emit code at run-time).
|
||||||
* @closure: Index of the closure (user_data) parameter associated with the callback,
|
* @closure: Index of the closure (user_data) parameter associated with the callback,
|
||||||
* or -1.
|
* or -1.
|
||||||
* @destroy: Index of the destroy notfication callback parameter associated with
|
* @destroy: Index of the destroy notfication callback parameter associated with
|
||||||
* the callback, or -1.
|
* the callback, or -1.
|
||||||
* @arg_type: Describes the type of the parameter. See details below.
|
* @arg_type: Describes the type of the parameter. See details below.
|
||||||
*
|
*
|
||||||
@ -402,9 +402,9 @@ typedef struct {
|
|||||||
* @caller_owns_return_value: If set, the caller is responsible for freeing the return value
|
* @caller_owns_return_value: If set, the caller is responsible for freeing the return value
|
||||||
* if it is no longer needed.
|
* if it is no longer needed.
|
||||||
* @caller_owns_return_container: This flag is only relevant if the return type is a container type.
|
* @caller_owns_return_container: This flag is only relevant if the return type is a container type.
|
||||||
* If the flag is set, the caller is resonsible for freeing the
|
* If the flag is set, the caller is resonsible for freeing the
|
||||||
* container, but not its contents.
|
* container, but not its contents.
|
||||||
* @n_arguments: The number of arguments that this function expects, also the length
|
* @n_arguments: The number of arguments that this function expects, also the length
|
||||||
* of the array of ArgBlobs.
|
* of the array of ArgBlobs.
|
||||||
* @arguments: An array of ArgBlob for the arguments of the function.
|
* @arguments: An array of ArgBlob for the arguments of the function.
|
||||||
*/
|
*/
|
||||||
@ -426,9 +426,9 @@ typedef struct {
|
|||||||
* @blob_type: A #GTypelibBlobType
|
* @blob_type: A #GTypelibBlobType
|
||||||
* @deprecated: Whether the blob is deprecated.
|
* @deprecated: Whether the blob is deprecated.
|
||||||
* @name: The name of the blob.
|
* @name: The name of the blob.
|
||||||
*
|
*
|
||||||
* The #CommonBlob is shared between #FunctionBlob,
|
* The #CommonBlob is shared between #FunctionBlob,
|
||||||
* #CallbackBlob, #SignalBlob.
|
* #CallbackBlob, #SignalBlob.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type; /* 1 */
|
guint16 blob_type; /* 1 */
|
||||||
@ -442,22 +442,22 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* FunctionBlob:
|
* FunctionBlob:
|
||||||
* @blob_Type: #BLOB_TYPE_FUNCTION
|
* @blob_Type: #BLOB_TYPE_FUNCTION
|
||||||
* @symbol: The symbol which can be used to obtain the function pointer with
|
* @symbol: The symbol which can be used to obtain the function pointer with
|
||||||
* dlsym().
|
* dlsym().
|
||||||
* @deprecated: The function is deprecated.
|
* @deprecated: The function is deprecated.
|
||||||
* @setter: The function is a setter for a property. Language bindings may
|
* @setter: The function is a setter for a property. Language bindings may
|
||||||
* prefer to not bind individual setters and rely on the generic
|
* prefer to not bind individual setters and rely on the generic
|
||||||
* g_object_set().
|
* g_object_set().
|
||||||
* @getter: The function is a getter for a property. Language bindings may
|
* @getter: The function is a getter for a property. Language bindings may
|
||||||
* prefer to not bind individual getters and rely on the generic
|
* prefer to not bind individual getters and rely on the generic
|
||||||
* g_object_get().
|
* g_object_get().
|
||||||
* @constructor:The function acts as a constructor for the object it is contained
|
* @constructor:The function acts as a constructor for the object it is contained
|
||||||
* in.
|
* in.
|
||||||
* @wraps_vfunc: The function is a simple wrapper for a virtual function.
|
* @wraps_vfunc: The function is a simple wrapper for a virtual function.
|
||||||
* @index: Index of the property that this function is a setter or getter of
|
* @index: Index of the property that this function is a setter or getter of
|
||||||
* in the array of properties of the containing interface, or index
|
* in the array of properties of the containing interface, or index
|
||||||
* of the virtual function that this function wraps.
|
* of the virtual function that this function wraps.
|
||||||
* @signature: Offset of the SignatureBlob describing the parameter types and the
|
* @signature: Offset of the SignatureBlob describing the parameter types and the
|
||||||
* return value type.
|
* return value type.
|
||||||
* @is_static: The function is a "static method"; in other words it's a pure
|
* @is_static: The function is a "static method"; in other words it's a pure
|
||||||
* function whose name is conceptually scoped to the object.
|
* function whose name is conceptually scoped to the object.
|
||||||
@ -487,7 +487,7 @@ typedef struct {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CallbackBlob:
|
* CallbackBlob:
|
||||||
* @signature: Offset of the #SignatureBlob describing the parameter types and the
|
* @signature: Offset of the #SignatureBlob describing the parameter types and the
|
||||||
* return value type.
|
* return value type.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -505,36 +505,36 @@ typedef struct {
|
|||||||
* @pointer: Whether this type represents an indirection
|
* @pointer: Whether this type represents an indirection
|
||||||
* @tag: A #GITypeTag
|
* @tag: A #GITypeTag
|
||||||
* @interface: Index of the directory entry for the interface.
|
* @interface: Index of the directory entry for the interface.
|
||||||
*
|
*
|
||||||
* If the interface is an enum of flags type, is_pointer is 0, otherwise it is 1.
|
* If the interface is an enum of flags type, is_pointer is 0, otherwise it is 1.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
guint8 pointer :1;
|
||||||
guint8 reserved :2;
|
guint8 reserved :2;
|
||||||
guint8 tag :5;
|
guint8 tag :5;
|
||||||
guint8 reserved2;
|
guint8 reserved2;
|
||||||
guint16 interface;
|
guint16 interface;
|
||||||
} InterfaceTypeBlob;
|
} InterfaceTypeBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayTypeBlob:
|
* ArrayTypeBlob:
|
||||||
* @zero_terminated: Indicates that the array must be terminated by a suitable #NULL
|
* @zero_terminated: Indicates that the array must be terminated by a suitable #NULL
|
||||||
* value.
|
* value.
|
||||||
* @has_length: Indicates that length points to a parameter specifying the length
|
* @has_length: Indicates that length points to a parameter specifying the length
|
||||||
* 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.
|
||||||
* @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.
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 pointer :1;
|
guint16 pointer :1;
|
||||||
guint16 reserved :2;
|
guint16 reserved :2;
|
||||||
guint16 tag :5;
|
guint16 tag :5;
|
||||||
|
|
||||||
guint16 zero_terminated :1;
|
guint16 zero_terminated :1;
|
||||||
guint16 has_length :1;
|
guint16 has_length :1;
|
||||||
@ -553,12 +553,12 @@ typedef struct {
|
|||||||
* ParamTypeBlob:
|
* ParamTypeBlob:
|
||||||
* @n_types: The number of parameter types to follow.
|
* @n_types: The number of parameter types to follow.
|
||||||
* @type: Describes the type of the list elements.
|
* @type: Describes the type of the list elements.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
guint8 pointer :1;
|
||||||
guint8 reserved :2;
|
guint8 reserved :2;
|
||||||
guint8 tag :5;
|
guint8 tag :5;
|
||||||
|
|
||||||
guint8 reserved2;
|
guint8 reserved2;
|
||||||
guint16 n_types;
|
guint16 n_types;
|
||||||
@ -574,7 +574,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
guint8 pointer :1;
|
||||||
guint8 reserved :2;
|
guint8 reserved :2;
|
||||||
guint8 tag :5;
|
guint8 tag :5;
|
||||||
|
|
||||||
guint8 reserved2;
|
guint8 reserved2;
|
||||||
guint16 n_domains;
|
guint16 n_domains;
|
||||||
@ -584,7 +584,7 @@ typedef struct {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ErrorDomainBlob:
|
* ErrorDomainBlob:
|
||||||
* @get_quark: The symbol name of the function which must be called to obtain the
|
* @get_quark: The symbol name of the function which must be called to obtain the
|
||||||
* GQuark for the error domain.
|
* GQuark for the error domain.
|
||||||
* @error_codes: Index of the InterfaceBlob describing the enumeration which lists
|
* @error_codes: Index of the InterfaceBlob describing the enumeration which lists
|
||||||
* the possible error codes.
|
* the possible error codes.
|
||||||
@ -594,7 +594,7 @@ typedef struct {
|
|||||||
|
|
||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 reserved :15;
|
guint16 reserved :15;
|
||||||
|
|
||||||
guint32 name;
|
guint32 name;
|
||||||
|
|
||||||
guint32 get_quark;
|
guint32 get_quark;
|
||||||
@ -607,7 +607,7 @@ typedef struct {
|
|||||||
* @deprecated: Whether this value is deprecated
|
* @deprecated: Whether this value is deprecated
|
||||||
* @value: The numerical value
|
* @value: The numerical value
|
||||||
* @name: Name of blob
|
* @name: Name of blob
|
||||||
*
|
*
|
||||||
* Values commonly occur in enums and flags.
|
* Values commonly occur in enums and flags.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -633,7 +633,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 name;
|
guint32 name;
|
||||||
|
|
||||||
guint8 readable :1;
|
guint8 readable :1;
|
||||||
guint8 writable :1;
|
guint8 writable :1;
|
||||||
guint8 has_embedded_type :1;
|
guint8 has_embedded_type :1;
|
||||||
guint8 reserved :5;
|
guint8 reserved :5;
|
||||||
@ -652,11 +652,11 @@ typedef struct {
|
|||||||
* @gtype_init: The symbol name of the get_type() function which registers the type.
|
* @gtype_init: The symbol name of the get_type() function which registers the type.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
guint16 blob_type;
|
||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
guint16 unregistered : 1;
|
||||||
guint16 reserved :14;
|
guint16 reserved :14;
|
||||||
guint32 name;
|
guint32 name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
guint32 gtype_name;
|
||||||
guint32 gtype_init;
|
guint32 gtype_init;
|
||||||
@ -672,10 +672,10 @@ typedef struct {
|
|||||||
* @size: The size of the struct in bytes.
|
* @size: The size of the struct in bytes.
|
||||||
* @gtype_name: String name of the associated #GType
|
* @gtype_name: String name of the associated #GType
|
||||||
* @gtype_init: String naming the symbol which gets the runtime #GType
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
||||||
* @n_fields:
|
* @n_fields:
|
||||||
* @n_functions: The lengths of the arrays.
|
* @n_functions: The lengths of the arrays.
|
||||||
* @fields: An array of n_fields FieldBlobs.
|
* @fields: An array of n_fields FieldBlobs.
|
||||||
* @functions: An array of n_functions FunctionBlobs. The described functions
|
* @functions: An array of n_functions FunctionBlobs. The described functions
|
||||||
* should be considered as methods of the struct.
|
* should be considered as methods of the struct.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -684,7 +684,7 @@ typedef struct {
|
|||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
guint16 unregistered : 1;
|
||||||
guint16 is_gtype_struct : 1;
|
guint16 is_gtype_struct : 1;
|
||||||
guint16 alignment : 6;
|
guint16 alignment : 6;
|
||||||
guint16 reserved : 7;
|
guint16 reserved : 7;
|
||||||
|
|
||||||
guint32 name;
|
guint32 name;
|
||||||
@ -702,7 +702,7 @@ typedef struct {
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* variable-length parts of the blob */
|
/* variable-length parts of the blob */
|
||||||
FieldBlob fields[];
|
FieldBlob fields[];
|
||||||
FunctionBlob methods[];
|
FunctionBlob methods[];
|
||||||
#endif
|
#endif
|
||||||
} StructBlob;
|
} StructBlob;
|
||||||
@ -720,12 +720,12 @@ typedef struct {
|
|||||||
* discriminator of a discriminated union is located.
|
* discriminator of a discriminated union is located.
|
||||||
* The value 0xFFFF indicates that the discriminator offset
|
* The value 0xFFFF indicates that the discriminator offset
|
||||||
* is unknown.
|
* is unknown.
|
||||||
* @discriminator_type: Type of the discriminator
|
* @discriminator_type: Type of the discriminator
|
||||||
* @discriminator_values: On discriminator value per field
|
* @discriminator_values: On discriminator value per field
|
||||||
* @fields: Array of FieldBlobs describing the alternative branches of the union
|
* @fields: Array of FieldBlobs describing the alternative branches of the union
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
guint16 blob_type;
|
||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
guint16 unregistered : 1;
|
||||||
guint16 discriminated : 1;
|
guint16 discriminated : 1;
|
||||||
@ -744,12 +744,12 @@ typedef struct {
|
|||||||
guint32 reserved2;
|
guint32 reserved2;
|
||||||
guint32 reserved3;
|
guint32 reserved3;
|
||||||
|
|
||||||
gint32 discriminator_offset;
|
gint32 discriminator_offset;
|
||||||
SimpleTypeBlob discriminator_type;
|
SimpleTypeBlob discriminator_type;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
FieldBlob fields[];
|
FieldBlob fields[];
|
||||||
FunctionBlob functions[];
|
FunctionBlob functions[];
|
||||||
ConstantBlob discriminator_values[]
|
ConstantBlob discriminator_values[]
|
||||||
#endif
|
#endif
|
||||||
} UnionBlob;
|
} UnionBlob;
|
||||||
@ -762,17 +762,17 @@ typedef struct {
|
|||||||
* @gtype_name: String name of the associated #GType
|
* @gtype_name: String name of the associated #GType
|
||||||
* @gtype_init: String naming the symbol which gets the runtime #GType
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
||||||
* @n_values: The lengths of the values arrays.
|
* @n_values: The lengths of the values arrays.
|
||||||
* @values: Describes the enum values.
|
* @values: Describes the enum values.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
guint16 blob_type;
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
guint16 unregistered : 1;
|
||||||
guint16 storage_type : 5;
|
guint16 storage_type : 5;
|
||||||
guint16 reserved : 9;
|
guint16 reserved : 9;
|
||||||
|
|
||||||
guint32 name;
|
guint32 name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
guint32 gtype_name;
|
||||||
guint32 gtype_init;
|
guint32 gtype_init;
|
||||||
@ -782,15 +782,15 @@ typedef struct {
|
|||||||
|
|
||||||
guint32 reserved3;
|
guint32 reserved3;
|
||||||
|
|
||||||
ValueBlob values[];
|
ValueBlob values[];
|
||||||
} EnumBlob;
|
} EnumBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PropertyBlob:
|
* PropertyBlob:
|
||||||
* @name: The name of the property.
|
* @name: The name of the property.
|
||||||
* @readable:
|
* @readable:
|
||||||
* @writable:
|
* @writable:
|
||||||
* @construct:
|
* @construct:
|
||||||
* @construct_only: The ParamFlags used when registering the property.
|
* @construct_only: The ParamFlags used when registering the property.
|
||||||
* @type: Describes the type of the property.
|
* @type: Describes the type of the property.
|
||||||
*/
|
*/
|
||||||
@ -823,7 +823,7 @@ typedef struct {
|
|||||||
* @true_stops_emit: Whether the signal has true-stops-emit semantics
|
* @true_stops_emit: Whether the signal has true-stops-emit semantics
|
||||||
* @class_closure: The index of the class closure in the list of virtual functions
|
* @class_closure: The index of the class closure in the list of virtual functions
|
||||||
* of the object or interface on which the signal is defined.
|
* of the object or interface on which the signal is defined.
|
||||||
* @signature: Offset of the SignatureBlob describing the parameter types and the
|
* @signature: Offset of the SignatureBlob describing the parameter types and the
|
||||||
* return value type.
|
* return value type.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -852,19 +852,19 @@ typedef struct {
|
|||||||
* VFuncBlob:
|
* VFuncBlob:
|
||||||
* @name: The name of the virtual function.
|
* @name: The name of the virtual function.
|
||||||
* @must_chain_up: If set, every implementation of this virtual function must
|
* @must_chain_up: If set, every implementation of this virtual function must
|
||||||
* chain up to the implementation of the parent class.
|
* chain up to the implementation of the parent class.
|
||||||
* @must_be_implemented: If set, every derived class must override this virtual function.
|
* @must_be_implemented: If set, every derived class must override this virtual function.
|
||||||
* @must_not_be_implemented: If set, derived class must not override this virtual function.
|
* @must_not_be_implemented: If set, derived class must not override this virtual function.
|
||||||
* @class_closure: Set if this virtual function is the class closure of a signal.
|
* @class_closure: Set if this virtual function is the class closure of a signal.
|
||||||
* @signal: The index of the signal in the list of signals of the object or
|
* @signal: The index of the signal in the list of signals of the object or
|
||||||
* interface to which this virtual function belongs.
|
* interface to which this virtual function belongs.
|
||||||
* @struct_offset: The offset of the function pointer in the class struct. The value
|
* @struct_offset: The offset of the function pointer in the class struct. The value
|
||||||
* 0xFFFF indicates that the struct offset is unknown.
|
* 0xFFFF indicates that the struct offset is unknown.
|
||||||
* @invoker: If a method invoker for this virtual exists, this is the offset in the
|
* @invoker: If a method invoker for this virtual exists, this is the offset in the
|
||||||
* class structure of the method. If no method is known, this value will be 0x3ff.
|
* class structure of the method. If no method is known, this value will be 0x3ff.
|
||||||
* @signature:
|
* @signature:
|
||||||
* Offset of the SignatureBlob describing the parameter types and the
|
* Offset of the SignatureBlob describing the parameter types and the
|
||||||
* return value type.
|
* return value type.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 name;
|
guint32 name;
|
||||||
@ -889,19 +889,19 @@ typedef struct {
|
|||||||
* @blob_type: #BLOB_TYPE_OBJECT
|
* @blob_type: #BLOB_TYPE_OBJECT
|
||||||
* @gtype_name: String name of the associated #GType
|
* @gtype_name: String name of the associated #GType
|
||||||
* @gtype_init: String naming the symbol which gets the runtime #GType
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
||||||
* @parent: The directory index of the parent type. This is only set for
|
* @parent: The directory index of the parent type. This is only set for
|
||||||
* objects. If an object does not have a parent, it is zero.
|
* objects. If an object does not have a parent, it is zero.
|
||||||
* @n_interfaces:
|
* @n_interfaces:
|
||||||
* @n_fields:
|
* @n_fields:
|
||||||
* @n_properties:
|
* @n_properties:
|
||||||
* @n_methods:
|
* @n_methods:
|
||||||
* @n_signals:
|
* @n_signals:
|
||||||
* @n_vfuncs:
|
* @n_vfuncs:
|
||||||
* @n_constants: The lengths of the arrays.Up to 16bits of padding may be inserted
|
* @n_constants: The lengths of the arrays.Up to 16bits of padding may be inserted
|
||||||
* between the arrays to ensure that they start on a 32bit boundary.
|
* between the arrays to ensure that they start on a 32bit boundary.
|
||||||
* @interfaces: An array of indices of directory entries for the implemented
|
* @interfaces: An array of indices of directory entries for the implemented
|
||||||
* interfaces.
|
* interfaces.
|
||||||
* @fields: Describes the fields.
|
* @fields: Describes the fields.
|
||||||
* @methods: Describes the methods, constructors, setters and getters.
|
* @methods: Describes the methods, constructors, setters and getters.
|
||||||
* @properties: Describes the properties.
|
* @properties: Describes the properties.
|
||||||
* @signals: Describes the signals.
|
* @signals: Describes the signals.
|
||||||
@ -934,7 +934,7 @@ typedef struct {
|
|||||||
guint32 reserved4;
|
guint32 reserved4;
|
||||||
|
|
||||||
guint16 interfaces[];
|
guint16 interfaces[];
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* variable-length parts of the blob */
|
/* variable-length parts of the blob */
|
||||||
FieldBlob fields[];
|
FieldBlob fields[];
|
||||||
@ -965,10 +965,10 @@ typedef struct {
|
|||||||
* @constants: Describes the constants.
|
* @constants: Describes the constants.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
guint16 blob_type;
|
||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 reserved :15;
|
guint16 reserved :15;
|
||||||
guint32 name;
|
guint32 name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
guint32 gtype_name;
|
||||||
guint32 gtype_init;
|
guint32 gtype_init;
|
||||||
@ -979,14 +979,14 @@ typedef struct {
|
|||||||
guint16 n_methods;
|
guint16 n_methods;
|
||||||
guint16 n_signals;
|
guint16 n_signals;
|
||||||
guint16 n_vfuncs;
|
guint16 n_vfuncs;
|
||||||
guint16 n_constants;
|
guint16 n_constants;
|
||||||
|
|
||||||
guint32 reserved2;
|
guint32 reserved2;
|
||||||
guint32 reserved3;
|
guint32 reserved3;
|
||||||
|
|
||||||
guint16 prerequisites[];
|
guint16 prerequisites[];
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* variable-length parts of the blob */
|
/* variable-length parts of the blob */
|
||||||
PropertyBlob properties[];
|
PropertyBlob properties[];
|
||||||
FunctionBlob methods[];
|
FunctionBlob methods[];
|
||||||
@ -1005,9 +1005,9 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
guint16 blob_type;
|
||||||
guint16 deprecated : 1;
|
guint16 deprecated : 1;
|
||||||
guint16 reserved :15;
|
guint16 reserved :15;
|
||||||
guint32 name;
|
guint32 name;
|
||||||
|
|
||||||
SimpleTypeBlob type;
|
SimpleTypeBlob type;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user