mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-05 17:06:18 +01:00
girepository: Replace tabs with spaces in indentation
We don't use tabs anywhere and the mixed setup just makes many editors to cry. So let's just replace the tabs with 8 spaces.
This commit is contained in:
parent
35fe0d0bba
commit
91fc45ea57
@ -143,9 +143,9 @@ invoke_get_type (GModule *self, const char *symbol, GError **error)
|
||||
if (!g_module_symbol (self, symbol, (void**)&sym))
|
||||
{
|
||||
g_set_error (error,
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"Failed to find symbol '%s'", symbol);
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"Failed to find symbol '%s'", symbol);
|
||||
return G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
@ -153,9 +153,9 @@ invoke_get_type (GModule *self, const char *symbol, GError **error)
|
||||
if (ret == G_TYPE_INVALID)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"Function '%s' returned G_TYPE_INVALID", symbol);
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"Function '%s' returned G_TYPE_INVALID", symbol);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -168,9 +168,9 @@ invoke_error_quark (GModule *self, const char *symbol, GError **error)
|
||||
if (!g_module_symbol (self, symbol, (void**)&sym))
|
||||
{
|
||||
g_set_error (error,
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"Failed to find symbol '%s'", symbol);
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"Failed to find symbol '%s'", symbol);
|
||||
return G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ dump_properties (GType type, FILE *out)
|
||||
|
||||
prop = props[i];
|
||||
if (prop->owner_type != type)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
const GValue *v = g_param_spec_get_default_value (prop);
|
||||
char *default_value = value_to_string (v);
|
||||
@ -318,7 +318,7 @@ dump_signals (GType type, FILE *out)
|
||||
g_signal_query (sigid, &query);
|
||||
|
||||
escaped_printf (out, " <signal name=\"%s\" return=\"%s\"",
|
||||
query.signal_name, g_type_name (query.return_type));
|
||||
query.signal_name, g_type_name (query.return_type));
|
||||
|
||||
if (query.signal_flags & G_SIGNAL_RUN_FIRST)
|
||||
escaped_printf (out, " when=\"first\"");
|
||||
@ -343,10 +343,10 @@ dump_signals (GType type, FILE *out)
|
||||
goutput_write (out, ">\n");
|
||||
|
||||
for (j = 0; j < query.n_params; j++)
|
||||
{
|
||||
escaped_printf (out, " <param type=\"%s\"/>\n",
|
||||
g_type_name (query.param_types[j]));
|
||||
}
|
||||
{
|
||||
escaped_printf (out, " <param type=\"%s\"/>\n",
|
||||
g_type_name (query.param_types[j]));
|
||||
}
|
||||
goutput_write (out, " </signal>\n");
|
||||
}
|
||||
g_free (sig_ids);
|
||||
@ -360,7 +360,7 @@ dump_object_type (GType type, const char *symbol, FILE *out)
|
||||
GType *interfaces;
|
||||
|
||||
escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"",
|
||||
g_type_name (type), symbol);
|
||||
g_type_name (type), symbol);
|
||||
if (type != G_TYPE_OBJECT)
|
||||
{
|
||||
GString *parent_str;
|
||||
@ -397,7 +397,7 @@ dump_object_type (GType type, const char *symbol, FILE *out)
|
||||
{
|
||||
GType itype = interfaces[i];
|
||||
escaped_printf (out, " <implements name=\"%s\"/>\n",
|
||||
g_type_name (itype));
|
||||
g_type_name (itype));
|
||||
}
|
||||
g_free (interfaces);
|
||||
|
||||
@ -414,23 +414,23 @@ dump_interface_type (GType type, const char *symbol, FILE *out)
|
||||
GType *interfaces;
|
||||
|
||||
escaped_printf (out, " <interface name=\"%s\" get-type=\"%s\">\n",
|
||||
g_type_name (type), symbol);
|
||||
g_type_name (type), symbol);
|
||||
|
||||
interfaces = g_type_interface_prerequisites (type, &n_interfaces);
|
||||
for (i = 0; i < n_interfaces; i++)
|
||||
{
|
||||
GType itype = interfaces[i];
|
||||
if (itype == G_TYPE_OBJECT)
|
||||
{
|
||||
/* Treat this as implicit for now; in theory GInterfaces are
|
||||
* supported on things like GstMiniObject, but right now
|
||||
* the introspection system only supports GObject.
|
||||
* http://bugzilla.gnome.org/show_bug.cgi?id=559706
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
{
|
||||
/* Treat this as implicit for now; in theory GInterfaces are
|
||||
* supported on things like GstMiniObject, but right now
|
||||
* the introspection system only supports GObject.
|
||||
* http://bugzilla.gnome.org/show_bug.cgi?id=559706
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
escaped_printf (out, " <prerequisite name=\"%s\"/>\n",
|
||||
g_type_name (itype));
|
||||
g_type_name (itype));
|
||||
}
|
||||
g_free (interfaces);
|
||||
|
||||
@ -443,7 +443,7 @@ static void
|
||||
dump_boxed_type (GType type, const char *symbol, FILE *out)
|
||||
{
|
||||
escaped_printf (out, " <boxed name=\"%s\" get-type=\"%s\"/>\n",
|
||||
g_type_name (type), symbol);
|
||||
g_type_name (type), symbol);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -454,14 +454,14 @@ dump_flags_type (GType type, const char *symbol, FILE *out)
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
escaped_printf (out, " <flags name=\"%s\" get-type=\"%s\">\n",
|
||||
g_type_name (type), symbol);
|
||||
g_type_name (type), symbol);
|
||||
|
||||
for (i = 0; i < klass->n_values; i++)
|
||||
{
|
||||
GFlagsValue *value = &(klass->values[i]);
|
||||
|
||||
escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%u\"/>\n",
|
||||
value->value_name, value->value_nick, value->value);
|
||||
value->value_name, value->value_nick, value->value);
|
||||
}
|
||||
goutput_write (out, " </flags>\n");
|
||||
}
|
||||
@ -474,14 +474,14 @@ dump_enum_type (GType type, const char *symbol, FILE *out)
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
escaped_printf (out, " <enum name=\"%s\" get-type=\"%s\">\n",
|
||||
g_type_name (type), symbol);
|
||||
g_type_name (type), symbol);
|
||||
|
||||
for (i = 0; i < klass->n_values; i++)
|
||||
{
|
||||
GEnumValue *value = &(klass->values[i]);
|
||||
|
||||
escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%d\"/>\n",
|
||||
value->value_name, value->value_nick, value->value);
|
||||
value->value_name, value->value_nick, value->value);
|
||||
}
|
||||
goutput_write (out, " </enum>");
|
||||
}
|
||||
@ -498,7 +498,7 @@ dump_fundamental_type (GType type, const char *symbol, FILE *out)
|
||||
|
||||
|
||||
escaped_printf (out, " <fundamental name=\"%s\" get-type=\"%s\"",
|
||||
g_type_name (type), symbol);
|
||||
g_type_name (type), symbol);
|
||||
|
||||
if (G_TYPE_IS_ABSTRACT (type))
|
||||
escaped_printf (out, " abstract=\"1\"");
|
||||
@ -534,7 +534,7 @@ dump_fundamental_type (GType type, const char *symbol, FILE *out)
|
||||
{
|
||||
GType itype = interfaces[i];
|
||||
escaped_printf (out, " <implements name=\"%s\"/>\n",
|
||||
g_type_name (itype));
|
||||
g_type_name (itype));
|
||||
}
|
||||
g_free (interfaces);
|
||||
goutput_write (out, " </fundamental>\n");
|
||||
@ -573,7 +573,7 @@ static void
|
||||
dump_error_quark (GQuark quark, const char *symbol, FILE *out)
|
||||
{
|
||||
escaped_printf (out, " <error-quark function=\"%s\" domain=\"%s\"/>\n",
|
||||
symbol, g_quark_to_string (quark));
|
||||
symbol, g_quark_to_string (quark));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -622,10 +622,10 @@ gi_repository_dump (const char *input_filename,
|
||||
if (!self)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"failed to open self: %s",
|
||||
g_module_error ());
|
||||
G_FILE_ERROR,
|
||||
G_FILE_ERROR_FAILED,
|
||||
"failed to open self: %s",
|
||||
g_module_error ());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -41,12 +41,12 @@ main (int argc,
|
||||
|
||||
type = invoke_get_type (self, argv[i], &error);
|
||||
if (!type)
|
||||
{
|
||||
g_printerr ("%s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
{
|
||||
g_printerr ("%s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
dump_type (type, argv[i], stdout);
|
||||
dump_type (type, argv[i], stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -428,7 +428,7 @@ gi_info_from_entry (GIRepository *repository,
|
||||
unresolved->namespace = namespace;
|
||||
|
||||
return (GIBaseInfo *)unresolved;
|
||||
}
|
||||
}
|
||||
return (GIBaseInfo *)result;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ typedef struct {
|
||||
gpointer data4;
|
||||
} GIAttributeIter;
|
||||
|
||||
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
|
||||
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
|
||||
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
|
@ -40,7 +40,7 @@ G_BEGIN_DECLS
|
||||
*
|
||||
* Since: 2.80
|
||||
*/
|
||||
#define GI_IS_CALLABLE_INFO(info) \
|
||||
#define GI_IS_CALLABLE_INFO(info) \
|
||||
((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION) || \
|
||||
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) || \
|
||||
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL) || \
|
||||
|
@ -39,7 +39,7 @@ G_BEGIN_DECLS
|
||||
*
|
||||
* Since: 2.80
|
||||
*/
|
||||
#define GI_IS_CALLBACK_INFO(info) \
|
||||
#define GI_IS_CALLBACK_INFO(info) \
|
||||
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK)
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -135,49 +135,49 @@ gi_constant_info_get_value (GIConstantInfo *info,
|
||||
{
|
||||
gsize blob_size = blob->size;
|
||||
|
||||
value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size);
|
||||
value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (blob->type.flags.tag)
|
||||
{
|
||||
case GI_TYPE_TAG_BOOLEAN:
|
||||
value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT8:
|
||||
value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64);
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64);
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat);
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
{
|
||||
switch (blob->type.flags.tag)
|
||||
{
|
||||
case GI_TYPE_TAG_BOOLEAN:
|
||||
value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT8:
|
||||
value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64);
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64);
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat);
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blob->size;
|
||||
|
@ -211,151 +211,151 @@ gi_field_info_get_field (GIFieldInfo *field_info,
|
||||
else
|
||||
{
|
||||
switch (gi_type_info_get_tag (type_info))
|
||||
{
|
||||
case GI_TYPE_TAG_VOID:
|
||||
g_warning("Field %s: should not be have void type",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info));
|
||||
break;
|
||||
case GI_TYPE_TAG_BOOLEAN:
|
||||
value->v_boolean = G_STRUCT_MEMBER (gboolean, mem, offset) != FALSE;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
value->v_uint8 = G_STRUCT_MEMBER (guint8, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
value->v_uint16 = G_STRUCT_MEMBER (guint16, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
value->v_uint64 = G_STRUCT_MEMBER (guint64, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_GTYPE:
|
||||
value->v_size = G_STRUCT_MEMBER (gsize, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
value->v_float = G_STRUCT_MEMBER (gfloat, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_ARRAY:
|
||||
/* We don't check the array type and that it is fixed-size,
|
||||
we trust g-ir-compiler to do the right thing */
|
||||
value->v_pointer = G_STRUCT_MEMBER_P (mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_UTF8:
|
||||
case GI_TYPE_TAG_FILENAME:
|
||||
case GI_TYPE_TAG_GLIST:
|
||||
case GI_TYPE_TAG_GSLIST:
|
||||
case GI_TYPE_TAG_GHASH:
|
||||
g_warning("Field %s: type %s should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
|
||||
break;
|
||||
case GI_TYPE_TAG_ERROR:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_TYPE_TAG_INTERFACE:
|
||||
{
|
||||
GIBaseInfo *interface = gi_type_info_get_interface (type_info);
|
||||
switch (gi_base_info_get_info_type (interface))
|
||||
{
|
||||
case GI_INFO_TYPE_STRUCT:
|
||||
case GI_INFO_TYPE_UNION:
|
||||
case GI_INFO_TYPE_BOXED:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
break;
|
||||
case GI_INFO_TYPE_ENUM:
|
||||
case GI_INFO_TYPE_FLAGS:
|
||||
{
|
||||
/* FIXME: there's a mismatch here between the value->v_int we use
|
||||
* here and the gint64 result returned from gi_value_info_get_value().
|
||||
* But to switch this to gint64, we'd have to make gi_function_info_invoke()
|
||||
* translate value->v_int64 to the proper ABI for an enum function
|
||||
* call parameter, which will usually be int, and then fix up language
|
||||
* bindings.
|
||||
*/
|
||||
GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
|
||||
switch (storage_type)
|
||||
{
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint8, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint16, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint32, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint64, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_warning("Field %s: Unexpected enum storage type %s",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (storage_type));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GI_INFO_TYPE_VFUNC:
|
||||
case GI_INFO_TYPE_CALLBACK:
|
||||
g_warning("Field %s: Interface type %d should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
case GI_INFO_TYPE_INVALID:
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
case GI_INFO_TYPE_FUNCTION:
|
||||
case GI_INFO_TYPE_CONSTANT:
|
||||
case GI_INFO_TYPE_VALUE:
|
||||
case GI_INFO_TYPE_SIGNAL:
|
||||
case GI_INFO_TYPE_PROPERTY:
|
||||
case GI_INFO_TYPE_FIELD:
|
||||
case GI_INFO_TYPE_ARG:
|
||||
case GI_INFO_TYPE_TYPE:
|
||||
case GI_INFO_TYPE_UNRESOLVED:
|
||||
g_warning("Field %s: Interface type %d not expected",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
{
|
||||
case GI_TYPE_TAG_VOID:
|
||||
g_warning("Field %s: should not be have void type",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info));
|
||||
break;
|
||||
case GI_TYPE_TAG_BOOLEAN:
|
||||
value->v_boolean = G_STRUCT_MEMBER (gboolean, mem, offset) != FALSE;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
value->v_uint8 = G_STRUCT_MEMBER (guint8, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
value->v_uint16 = G_STRUCT_MEMBER (guint16, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
value->v_uint64 = G_STRUCT_MEMBER (guint64, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_GTYPE:
|
||||
value->v_size = G_STRUCT_MEMBER (gsize, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
value->v_float = G_STRUCT_MEMBER (gfloat, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_ARRAY:
|
||||
/* We don't check the array type and that it is fixed-size,
|
||||
we trust g-ir-compiler to do the right thing */
|
||||
value->v_pointer = G_STRUCT_MEMBER_P (mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_UTF8:
|
||||
case GI_TYPE_TAG_FILENAME:
|
||||
case GI_TYPE_TAG_GLIST:
|
||||
case GI_TYPE_TAG_GSLIST:
|
||||
case GI_TYPE_TAG_GHASH:
|
||||
g_warning("Field %s: type %s should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
|
||||
break;
|
||||
case GI_TYPE_TAG_ERROR:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_TYPE_TAG_INTERFACE:
|
||||
{
|
||||
GIBaseInfo *interface = gi_type_info_get_interface (type_info);
|
||||
switch (gi_base_info_get_info_type (interface))
|
||||
{
|
||||
case GI_INFO_TYPE_STRUCT:
|
||||
case GI_INFO_TYPE_UNION:
|
||||
case GI_INFO_TYPE_BOXED:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
break;
|
||||
case GI_INFO_TYPE_ENUM:
|
||||
case GI_INFO_TYPE_FLAGS:
|
||||
{
|
||||
/* FIXME: there's a mismatch here between the value->v_int we use
|
||||
* here and the gint64 result returned from gi_value_info_get_value().
|
||||
* But to switch this to gint64, we'd have to make gi_function_info_invoke()
|
||||
* translate value->v_int64 to the proper ABI for an enum function
|
||||
* call parameter, which will usually be int, and then fix up language
|
||||
* bindings.
|
||||
*/
|
||||
GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
|
||||
switch (storage_type)
|
||||
{
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint8, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint16, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint32, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
value->v_int = (gint)G_STRUCT_MEMBER (guint64, mem, offset);
|
||||
result = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_warning("Field %s: Unexpected enum storage type %s",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (storage_type));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GI_INFO_TYPE_VFUNC:
|
||||
case GI_INFO_TYPE_CALLBACK:
|
||||
g_warning("Field %s: Interface type %d should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
case GI_INFO_TYPE_INVALID:
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
case GI_INFO_TYPE_FUNCTION:
|
||||
case GI_INFO_TYPE_CONSTANT:
|
||||
case GI_INFO_TYPE_VALUE:
|
||||
case GI_INFO_TYPE_SIGNAL:
|
||||
case GI_INFO_TYPE_PROPERTY:
|
||||
case GI_INFO_TYPE_FIELD:
|
||||
case GI_INFO_TYPE_ARG:
|
||||
case GI_INFO_TYPE_TYPE:
|
||||
case GI_INFO_TYPE_UNRESOLVED:
|
||||
g_warning("Field %s: Interface type %d not expected",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gi_base_info_unref ((GIBaseInfo *)interface);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo *)interface);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gi_base_info_unref ((GIBaseInfo *)type_info);
|
||||
@ -402,163 +402,163 @@ gi_field_info_set_field (GIFieldInfo *field_info,
|
||||
if (!gi_type_info_is_pointer (type_info))
|
||||
{
|
||||
switch (gi_type_info_get_tag (type_info))
|
||||
{
|
||||
case GI_TYPE_TAG_VOID:
|
||||
g_warning("Field %s: should not be have void type",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info));
|
||||
break;
|
||||
case GI_TYPE_TAG_BOOLEAN:
|
||||
G_STRUCT_MEMBER (gboolean, mem, offset) = value->v_boolean != FALSE;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
G_STRUCT_MEMBER (guint8, mem, offset) = value->v_uint8;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
G_STRUCT_MEMBER (guint16, mem, offset) = value->v_uint16;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
G_STRUCT_MEMBER (guint64, mem, offset) = value->v_uint64;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_GTYPE:
|
||||
G_STRUCT_MEMBER (gsize, mem, offset) = value->v_size;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
G_STRUCT_MEMBER (gfloat, mem, offset) = value->v_float;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
G_STRUCT_MEMBER (gdouble, mem, offset)= value->v_double;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_UTF8:
|
||||
case GI_TYPE_TAG_FILENAME:
|
||||
case GI_TYPE_TAG_ARRAY:
|
||||
case GI_TYPE_TAG_GLIST:
|
||||
case GI_TYPE_TAG_GSLIST:
|
||||
case GI_TYPE_TAG_GHASH:
|
||||
g_warning("Field %s: type %s should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
|
||||
break;
|
||||
case GI_TYPE_TAG_ERROR:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_TYPE_TAG_INTERFACE:
|
||||
{
|
||||
GIBaseInfo *interface = gi_type_info_get_interface (type_info);
|
||||
switch (gi_base_info_get_info_type (interface))
|
||||
{
|
||||
case GI_INFO_TYPE_STRUCT:
|
||||
case GI_INFO_TYPE_UNION:
|
||||
case GI_INFO_TYPE_BOXED:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
break;
|
||||
case GI_INFO_TYPE_ENUM:
|
||||
case GI_INFO_TYPE_FLAGS:
|
||||
{
|
||||
/* See FIXME above
|
||||
*/
|
||||
GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
|
||||
switch (storage_type)
|
||||
{
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
G_STRUCT_MEMBER (guint8, mem, offset) = (guint8)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
G_STRUCT_MEMBER (guint16, mem, offset) = (guint16)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
G_STRUCT_MEMBER (guint32, mem, offset) = (guint32)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
G_STRUCT_MEMBER (guint64, mem, offset) = (guint64)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_warning("Field %s: Unexpected enum storage type %s",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (storage_type));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GI_INFO_TYPE_VFUNC:
|
||||
case GI_INFO_TYPE_CALLBACK:
|
||||
g_warning("Field%s: Interface type %d should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
case GI_INFO_TYPE_INVALID:
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
case GI_INFO_TYPE_FUNCTION:
|
||||
case GI_INFO_TYPE_CONSTANT:
|
||||
case GI_INFO_TYPE_VALUE:
|
||||
case GI_INFO_TYPE_SIGNAL:
|
||||
case GI_INFO_TYPE_PROPERTY:
|
||||
case GI_INFO_TYPE_FIELD:
|
||||
case GI_INFO_TYPE_ARG:
|
||||
case GI_INFO_TYPE_TYPE:
|
||||
case GI_INFO_TYPE_UNRESOLVED:
|
||||
g_warning("Field %s: Interface type %d not expected",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
{
|
||||
case GI_TYPE_TAG_VOID:
|
||||
g_warning("Field %s: should not be have void type",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info));
|
||||
break;
|
||||
case GI_TYPE_TAG_BOOLEAN:
|
||||
G_STRUCT_MEMBER (gboolean, mem, offset) = value->v_boolean != FALSE;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
G_STRUCT_MEMBER (guint8, mem, offset) = value->v_uint8;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
G_STRUCT_MEMBER (guint16, mem, offset) = value->v_uint16;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
case GI_TYPE_TAG_UNICHAR:
|
||||
G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
G_STRUCT_MEMBER (guint64, mem, offset) = value->v_uint64;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_GTYPE:
|
||||
G_STRUCT_MEMBER (gsize, mem, offset) = value->v_size;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
G_STRUCT_MEMBER (gfloat, mem, offset) = value->v_float;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
G_STRUCT_MEMBER (gdouble, mem, offset)= value->v_double;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_UTF8:
|
||||
case GI_TYPE_TAG_FILENAME:
|
||||
case GI_TYPE_TAG_ARRAY:
|
||||
case GI_TYPE_TAG_GLIST:
|
||||
case GI_TYPE_TAG_GSLIST:
|
||||
case GI_TYPE_TAG_GHASH:
|
||||
g_warning("Field %s: type %s should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
|
||||
break;
|
||||
case GI_TYPE_TAG_ERROR:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_TYPE_TAG_INTERFACE:
|
||||
{
|
||||
GIBaseInfo *interface = gi_type_info_get_interface (type_info);
|
||||
switch (gi_base_info_get_info_type (interface))
|
||||
{
|
||||
case GI_INFO_TYPE_STRUCT:
|
||||
case GI_INFO_TYPE_UNION:
|
||||
case GI_INFO_TYPE_BOXED:
|
||||
/* Needs to be handled by the language binding directly */
|
||||
break;
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
break;
|
||||
case GI_INFO_TYPE_ENUM:
|
||||
case GI_INFO_TYPE_FLAGS:
|
||||
{
|
||||
/* See FIXME above
|
||||
*/
|
||||
GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
|
||||
switch (storage_type)
|
||||
{
|
||||
case GI_TYPE_TAG_INT8:
|
||||
case GI_TYPE_TAG_UINT8:
|
||||
G_STRUCT_MEMBER (guint8, mem, offset) = (guint8)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT16:
|
||||
case GI_TYPE_TAG_UINT16:
|
||||
G_STRUCT_MEMBER (guint16, mem, offset) = (guint16)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT32:
|
||||
case GI_TYPE_TAG_UINT32:
|
||||
G_STRUCT_MEMBER (guint32, mem, offset) = (guint32)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
G_STRUCT_MEMBER (guint64, mem, offset) = (guint64)value->v_int;
|
||||
result = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_warning("Field %s: Unexpected enum storage type %s",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_type_tag_to_string (storage_type));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GI_INFO_TYPE_VFUNC:
|
||||
case GI_INFO_TYPE_CALLBACK:
|
||||
g_warning("Field%s: Interface type %d should have is_pointer set",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
case GI_INFO_TYPE_INVALID:
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
case GI_INFO_TYPE_FUNCTION:
|
||||
case GI_INFO_TYPE_CONSTANT:
|
||||
case GI_INFO_TYPE_VALUE:
|
||||
case GI_INFO_TYPE_SIGNAL:
|
||||
case GI_INFO_TYPE_PROPERTY:
|
||||
case GI_INFO_TYPE_FIELD:
|
||||
case GI_INFO_TYPE_ARG:
|
||||
case GI_INFO_TYPE_TYPE:
|
||||
case GI_INFO_TYPE_UNRESOLVED:
|
||||
g_warning("Field %s: Interface type %d not expected",
|
||||
gi_base_info_get_name ((GIBaseInfo *)field_info),
|
||||
gi_base_info_get_info_type (interface));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gi_base_info_unref ((GIBaseInfo *)interface);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo *)interface);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (gi_type_info_get_tag (type_info))
|
||||
{
|
||||
case GI_TYPE_TAG_INTERFACE:
|
||||
{
|
||||
GIBaseInfo *interface = gi_type_info_get_interface (type_info);
|
||||
switch (gi_base_info_get_info_type (interface))
|
||||
GIBaseInfo *interface = gi_type_info_get_interface (type_info);
|
||||
switch (gi_base_info_get_info_type (interface))
|
||||
{
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
G_STRUCT_MEMBER (gpointer, mem, offset) = (gpointer)value->v_pointer;
|
||||
result = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo *)interface);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,8 +121,8 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
|
||||
*/
|
||||
static ffi_type *
|
||||
g_value_to_ffi_return_type (const GValue *gvalue,
|
||||
const GIArgument *ffi_value,
|
||||
gpointer *value)
|
||||
const GIArgument *ffi_value,
|
||||
gpointer *value)
|
||||
{
|
||||
ffi_type *rettype = NULL;
|
||||
GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
|
||||
@ -246,7 +246,7 @@ g_value_from_ffi_value (GValue *gvalue,
|
||||
break;
|
||||
default:
|
||||
g_warning ("Unsupported fundamental type: %s",
|
||||
g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
|
||||
g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
|
||||
}
|
||||
|
||||
}
|
||||
@ -288,7 +288,7 @@ gi_cclosure_marshal_generic (GClosure *closure,
|
||||
if (return_gvalue && G_VALUE_TYPE (return_gvalue))
|
||||
{
|
||||
rtype = g_value_to_ffi_return_type (return_gvalue, &return_ffi_value,
|
||||
&rvalue);
|
||||
&rvalue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -528,20 +528,20 @@ gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
|
||||
|
||||
n_interfaces = gi_object_info_get_n_interfaces (info);
|
||||
for (i = 0; i < n_interfaces; ++i)
|
||||
{
|
||||
GIInterfaceInfo *iface_info;
|
||||
{
|
||||
GIInterfaceInfo *iface_info;
|
||||
|
||||
iface_info = gi_object_info_get_interface (info, i);
|
||||
iface_info = gi_object_info_get_interface (info, i);
|
||||
|
||||
result = gi_interface_info_find_method (iface_info, name);
|
||||
result = gi_interface_info_find_method (iface_info, name);
|
||||
|
||||
if (result != NULL)
|
||||
{
|
||||
implementor_result = (GIObjectInfo *) iface_info;
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo*) iface_info);
|
||||
}
|
||||
if (result != NULL)
|
||||
{
|
||||
implementor_result = (GIObjectInfo *) iface_info;
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo*) iface_info);
|
||||
}
|
||||
}
|
||||
if (implementor)
|
||||
*implementor = implementor_result;
|
||||
@ -637,10 +637,10 @@ gi_object_info_find_signal (GIObjectInfo *info,
|
||||
GISignalInfo *siginfo = gi_object_info_get_signal (info, i);
|
||||
|
||||
if (g_strcmp0 (gi_base_info_get_name ((GIBaseInfo *) siginfo), name) != 0)
|
||||
{
|
||||
gi_base_info_unref ((GIBaseInfo*)siginfo);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
gi_base_info_unref ((GIBaseInfo*)siginfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
return siginfo;
|
||||
}
|
||||
@ -801,20 +801,20 @@ gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
|
||||
|
||||
n_interfaces = gi_object_info_get_n_interfaces (info);
|
||||
for (i = 0; i < n_interfaces; ++i)
|
||||
{
|
||||
GIInterfaceInfo *iface_info;
|
||||
{
|
||||
GIInterfaceInfo *iface_info;
|
||||
|
||||
iface_info = gi_object_info_get_interface (info, i);
|
||||
iface_info = gi_object_info_get_interface (info, i);
|
||||
|
||||
result = gi_interface_info_find_vfunc (iface_info, name);
|
||||
result = gi_interface_info_find_vfunc (iface_info, name);
|
||||
|
||||
if (result != NULL)
|
||||
{
|
||||
implementor_result = (GIObjectInfo *) iface_info;
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo*) iface_info);
|
||||
}
|
||||
if (result != NULL)
|
||||
{
|
||||
implementor_result = (GIObjectInfo *) iface_info;
|
||||
break;
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo*) iface_info);
|
||||
}
|
||||
}
|
||||
if (implementor)
|
||||
*implementor = implementor_result;
|
||||
|
@ -88,7 +88,7 @@ typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
|
||||
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
const gchar * gi_object_info_get_type_name (GIObjectInfo *info);
|
||||
const gchar * gi_object_info_get_type_name (GIObjectInfo *info);
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
const gchar * gi_object_info_get_type_init_function_name (GIObjectInfo *info);
|
||||
@ -135,7 +135,7 @@ GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info,
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
GIFunctionInfo * gi_object_info_find_method (GIObjectInfo *info,
|
||||
const gchar *name);
|
||||
const gchar *name);
|
||||
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
|
@ -111,8 +111,8 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain (HINSTANCE hinstDLL,
|
||||
DWORD fdwReason,
|
||||
LPVOID lpvReserved)
|
||||
DWORD fdwReason,
|
||||
LPVOID lpvReserved)
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
girepository_dll = hinstDLL;
|
||||
@ -129,8 +129,8 @@ DllMain (HINSTANCE hinstDLL,
|
||||
*/
|
||||
#define GOBJECT_INTROSPECTION_LIBDIR \
|
||||
g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \
|
||||
"lib", \
|
||||
NULL)
|
||||
"lib", \
|
||||
NULL)
|
||||
|
||||
#endif
|
||||
|
||||
@ -140,8 +140,8 @@ gi_repository_init (GIRepository *repository)
|
||||
repository->priv = gi_repository_get_instance_private (repository);
|
||||
repository->priv->typelibs
|
||||
= g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) gi_typelib_free);
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) gi_typelib_free);
|
||||
repository->priv->lazy_typelibs
|
||||
= g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
@ -324,9 +324,9 @@ get_repository (GIRepository *repository)
|
||||
|
||||
static GITypelib *
|
||||
check_version_conflict (GITypelib *typelib,
|
||||
const gchar *namespace,
|
||||
const gchar *expected_version,
|
||||
char **version_conflict)
|
||||
const gchar *namespace,
|
||||
const gchar *expected_version,
|
||||
char **version_conflict)
|
||||
{
|
||||
Header *header;
|
||||
const char *loaded_version;
|
||||
@ -334,7 +334,7 @@ check_version_conflict (GITypelib *typelib,
|
||||
if (expected_version == NULL)
|
||||
{
|
||||
if (version_conflict)
|
||||
*version_conflict = NULL;
|
||||
*version_conflict = NULL;
|
||||
return typelib;
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ check_version_conflict (GITypelib *typelib,
|
||||
if (strcmp (expected_version, loaded_version) != 0)
|
||||
{
|
||||
if (version_conflict)
|
||||
*version_conflict = (char*)loaded_version;
|
||||
*version_conflict = (char*)loaded_version;
|
||||
return NULL;
|
||||
}
|
||||
if (version_conflict)
|
||||
@ -355,11 +355,11 @@ check_version_conflict (GITypelib *typelib,
|
||||
|
||||
static GITypelib *
|
||||
get_registered_status (GIRepository *repository,
|
||||
const char *namespace,
|
||||
const char *version,
|
||||
gboolean allow_lazy,
|
||||
gboolean *lazy_status,
|
||||
char **version_conflict)
|
||||
const char *namespace,
|
||||
const char *version,
|
||||
gboolean allow_lazy,
|
||||
gboolean *lazy_status,
|
||||
char **version_conflict)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
repository = get_repository (repository);
|
||||
@ -380,16 +380,16 @@ get_registered_status (GIRepository *repository,
|
||||
|
||||
static GITypelib *
|
||||
get_registered (GIRepository *repository,
|
||||
const char *namespace,
|
||||
const char *version)
|
||||
const char *namespace,
|
||||
const char *version)
|
||||
{
|
||||
return get_registered_status (repository, namespace, version, TRUE, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_dependencies_recurse (GIRepository *repository,
|
||||
GITypelib *typelib,
|
||||
GError **error)
|
||||
GITypelib *typelib,
|
||||
GError **error)
|
||||
{
|
||||
char **dependencies;
|
||||
|
||||
@ -400,25 +400,25 @@ load_dependencies_recurse (GIRepository *repository,
|
||||
int i;
|
||||
|
||||
for (i = 0; dependencies[i]; i++)
|
||||
{
|
||||
char *dependency = dependencies[i];
|
||||
const char *last_dash;
|
||||
char *dependency_namespace;
|
||||
const char *dependency_version;
|
||||
{
|
||||
char *dependency = dependencies[i];
|
||||
const char *last_dash;
|
||||
char *dependency_namespace;
|
||||
const char *dependency_version;
|
||||
|
||||
last_dash = strrchr (dependency, '-');
|
||||
dependency_namespace = g_strndup (dependency, last_dash - dependency);
|
||||
dependency_version = last_dash+1;
|
||||
last_dash = strrchr (dependency, '-');
|
||||
dependency_namespace = g_strndup (dependency, last_dash - dependency);
|
||||
dependency_version = last_dash+1;
|
||||
|
||||
if (!gi_repository_require (repository, dependency_namespace, dependency_version,
|
||||
0, error))
|
||||
{
|
||||
g_free (dependency_namespace);
|
||||
g_strfreev (dependencies);
|
||||
return FALSE;
|
||||
}
|
||||
g_free (dependency_namespace);
|
||||
}
|
||||
if (!gi_repository_require (repository, dependency_namespace, dependency_version,
|
||||
0, error))
|
||||
{
|
||||
g_free (dependency_namespace);
|
||||
g_strfreev (dependencies);
|
||||
return FALSE;
|
||||
}
|
||||
g_free (dependency_namespace);
|
||||
}
|
||||
g_strfreev (dependencies);
|
||||
}
|
||||
return TRUE;
|
||||
@ -426,10 +426,10 @@ load_dependencies_recurse (GIRepository *repository,
|
||||
|
||||
static const char *
|
||||
register_internal (GIRepository *repository,
|
||||
const char *source,
|
||||
gboolean lazy,
|
||||
GITypelib *typelib,
|
||||
GError **error)
|
||||
const char *source,
|
||||
gboolean lazy,
|
||||
GITypelib *typelib,
|
||||
GError **error)
|
||||
{
|
||||
Header *header;
|
||||
const gchar *namespace;
|
||||
@ -445,9 +445,9 @@ register_internal (GIRepository *repository,
|
||||
if (lazy)
|
||||
{
|
||||
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
|
||||
namespace));
|
||||
namespace));
|
||||
g_hash_table_insert (repository->priv->lazy_typelibs,
|
||||
build_typelib_key (namespace, source), (void *)typelib);
|
||||
build_typelib_key (namespace, source), (void *)typelib);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -456,15 +456,15 @@ register_internal (GIRepository *repository,
|
||||
|
||||
/* First, try loading all the dependencies */
|
||||
if (!load_dependencies_recurse (repository, typelib, error))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
/* Check if we are transitioning from lazily loaded state */
|
||||
if (g_hash_table_lookup_extended (repository->priv->lazy_typelibs,
|
||||
namespace,
|
||||
(gpointer)&key, &value))
|
||||
g_hash_table_remove (repository->priv->lazy_typelibs, key);
|
||||
namespace,
|
||||
(gpointer)&key, &value))
|
||||
g_hash_table_remove (repository->priv->lazy_typelibs, key);
|
||||
else
|
||||
key = build_typelib_key (namespace, source);
|
||||
key = build_typelib_key (namespace, source);
|
||||
|
||||
g_hash_table_insert (repository->priv->typelibs,
|
||||
g_steal_pointer (&key),
|
||||
@ -584,7 +584,7 @@ get_typelib_dependencies_transitive (GIRepository *repository,
|
||||
*/
|
||||
char **
|
||||
gi_repository_get_dependencies (GIRepository *repository,
|
||||
const char *namespace)
|
||||
const char *namespace)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
GHashTable *transitive_dependencies; /* set of owned utf8 */
|
||||
@ -636,9 +636,9 @@ gi_repository_get_dependencies (GIRepository *repository,
|
||||
*/
|
||||
const char *
|
||||
gi_repository_load_typelib (GIRepository *repository,
|
||||
GITypelib *typelib,
|
||||
GIRepositoryLoadFlags flags,
|
||||
GError **error)
|
||||
GITypelib *typelib,
|
||||
GIRepositoryLoadFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
Header *header;
|
||||
const char *namespace;
|
||||
@ -654,20 +654,20 @@ gi_repository_load_typelib (GIRepository *repository,
|
||||
nsversion = gi_typelib_get_string (typelib, header->nsversion);
|
||||
|
||||
if (get_registered_status (repository, namespace, nsversion, allow_lazy,
|
||||
&is_lazy, &version_conflict))
|
||||
&is_lazy, &version_conflict))
|
||||
{
|
||||
if (version_conflict != NULL)
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
|
||||
"Attempting to load namespace '%s', version '%s', but '%s' is already loaded",
|
||||
namespace, nsversion, version_conflict);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
|
||||
"Attempting to load namespace '%s', version '%s', but '%s' is already loaded",
|
||||
namespace, nsversion, version_conflict);
|
||||
return NULL;
|
||||
}
|
||||
return namespace;
|
||||
}
|
||||
return register_internal (repository, "<builtin>",
|
||||
allow_lazy, typelib, error);
|
||||
allow_lazy, typelib, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -691,8 +691,8 @@ gi_repository_load_typelib (GIRepository *repository,
|
||||
*/
|
||||
gboolean
|
||||
gi_repository_is_registered (GIRepository *repository,
|
||||
const gchar *namespace,
|
||||
const gchar *version)
|
||||
const gchar *namespace,
|
||||
const gchar *version)
|
||||
{
|
||||
repository = get_repository (repository);
|
||||
return get_registered (repository, namespace, version) != NULL;
|
||||
@ -755,7 +755,7 @@ gi_repository_new (void)
|
||||
*/
|
||||
guint
|
||||
gi_repository_get_n_infos (GIRepository *repository,
|
||||
const gchar *namespace)
|
||||
const gchar *namespace)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
guint n_interfaces = 0;
|
||||
@ -793,8 +793,8 @@ gi_repository_get_n_infos (GIRepository *repository,
|
||||
*/
|
||||
GIBaseInfo *
|
||||
gi_repository_get_info (GIRepository *repository,
|
||||
const gchar *namespace,
|
||||
guint idx)
|
||||
const gchar *namespace,
|
||||
guint idx)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
DirEntry *entry;
|
||||
@ -879,7 +879,7 @@ gi_repository_find_by_gtype (GIRepository *repository,
|
||||
repository = get_repository (repository);
|
||||
|
||||
cached = g_hash_table_lookup (repository->priv->info_by_gtype,
|
||||
(gpointer)gtype);
|
||||
(gpointer)gtype);
|
||||
|
||||
if (cached != NULL)
|
||||
return gi_base_info_ref (cached);
|
||||
@ -918,8 +918,8 @@ gi_repository_find_by_gtype (GIRepository *repository,
|
||||
NULL, data.result_typelib, entry->offset);
|
||||
|
||||
g_hash_table_insert (repository->priv->info_by_gtype,
|
||||
(gpointer) gtype,
|
||||
gi_base_info_ref (cached));
|
||||
(gpointer) gtype,
|
||||
gi_base_info_ref (cached));
|
||||
return cached;
|
||||
}
|
||||
else
|
||||
@ -948,8 +948,8 @@ gi_repository_find_by_gtype (GIRepository *repository,
|
||||
*/
|
||||
GIBaseInfo *
|
||||
gi_repository_find_by_name (GIRepository *repository,
|
||||
const gchar *namespace,
|
||||
const gchar *name)
|
||||
const gchar *namespace,
|
||||
const gchar *name)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
DirEntry *entry;
|
||||
@ -978,8 +978,8 @@ typedef struct {
|
||||
|
||||
static void
|
||||
find_by_error_domain_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer datap)
|
||||
gpointer value,
|
||||
gpointer datap)
|
||||
{
|
||||
GITypelib *typelib = (GITypelib*)value;
|
||||
FindByErrorDomainData *data = datap;
|
||||
@ -1011,7 +1011,7 @@ find_by_error_domain_foreach (gpointer key,
|
||||
*/
|
||||
GIEnumInfo *
|
||||
gi_repository_find_by_error_domain (GIRepository *repository,
|
||||
GQuark domain)
|
||||
GQuark domain)
|
||||
{
|
||||
FindByErrorDomainData data;
|
||||
GIEnumInfo *cached;
|
||||
@ -1019,7 +1019,7 @@ gi_repository_find_by_error_domain (GIRepository *repository,
|
||||
repository = get_repository (repository);
|
||||
|
||||
cached = g_hash_table_lookup (repository->priv->info_by_error_domain,
|
||||
GUINT_TO_POINTER (domain));
|
||||
GUINT_TO_POINTER (domain));
|
||||
|
||||
if (cached != NULL)
|
||||
return (GIEnumInfo *) gi_base_info_ref ((GIBaseInfo *)cached);
|
||||
@ -1040,8 +1040,8 @@ gi_repository_find_by_error_domain (GIRepository *repository,
|
||||
NULL, data.result_typelib, data.result->offset);
|
||||
|
||||
g_hash_table_insert (repository->priv->info_by_error_domain,
|
||||
GUINT_TO_POINTER (domain),
|
||||
gi_base_info_ref ((GIBaseInfo *) cached));
|
||||
GUINT_TO_POINTER (domain),
|
||||
gi_base_info_ref ((GIBaseInfo *) cached));
|
||||
return cached;
|
||||
}
|
||||
return NULL;
|
||||
@ -1130,8 +1130,8 @@ gi_repository_get_object_gtype_interfaces (GIRepository *repository,
|
||||
|
||||
static void
|
||||
collect_namespaces (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
{
|
||||
GList **list = data;
|
||||
|
||||
@ -1188,7 +1188,7 @@ gi_repository_get_loaded_namespaces (GIRepository *repository)
|
||||
*/
|
||||
const gchar *
|
||||
gi_repository_get_version (GIRepository *repository,
|
||||
const gchar *namespace)
|
||||
const gchar *namespace)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
Header *header;
|
||||
@ -1331,19 +1331,19 @@ gi_repository_get_c_prefix (GIRepository *repository,
|
||||
*/
|
||||
const gchar *
|
||||
gi_repository_get_typelib_path (GIRepository *repository,
|
||||
const gchar *namespace)
|
||||
const gchar *namespace)
|
||||
{
|
||||
gpointer orig_key, value;
|
||||
|
||||
repository = get_repository (repository);
|
||||
|
||||
if (!g_hash_table_lookup_extended (repository->priv->typelibs, namespace,
|
||||
&orig_key, &value))
|
||||
&orig_key, &value))
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -1379,11 +1379,11 @@ find_namespace_version (const char *namespace,
|
||||
|
||||
mfile = g_mapped_file_new (path, FALSE, &error);
|
||||
if (error)
|
||||
{
|
||||
g_free (path);
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
g_free (path);
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
}
|
||||
*path_ret = path;
|
||||
break;
|
||||
}
|
||||
@ -1393,8 +1393,8 @@ find_namespace_version (const char *namespace,
|
||||
|
||||
static gboolean
|
||||
parse_version (const char *version,
|
||||
int *major,
|
||||
int *minor)
|
||||
int *major,
|
||||
int *minor)
|
||||
{
|
||||
const char *dot;
|
||||
char *end;
|
||||
@ -1416,7 +1416,7 @@ parse_version (const char *version,
|
||||
|
||||
static int
|
||||
compare_version (const char *v1,
|
||||
const char *v2)
|
||||
const char *v2)
|
||||
{
|
||||
gboolean success;
|
||||
int v1_major, v1_minor;
|
||||
@ -1452,7 +1452,7 @@ struct NamespaceVersionCandidadate
|
||||
|
||||
static int
|
||||
compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
|
||||
struct NamespaceVersionCandidadate *c2)
|
||||
struct NamespaceVersionCandidadate *c2)
|
||||
{
|
||||
int result = compare_version (c1->version, c2->version);
|
||||
/* First, check the version */
|
||||
@ -1467,11 +1467,11 @@ compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
|
||||
* pick the earlier one.
|
||||
*/
|
||||
if (c1->path_index == c2->path_index)
|
||||
return 0;
|
||||
return 0;
|
||||
else if (c1->path_index > c2->path_index)
|
||||
return 1;
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1509,66 +1509,66 @@ enumerate_namespace_versions (const char *namespace,
|
||||
dirname = search_paths[i];
|
||||
dir = g_dir_open (dirname, 0, NULL);
|
||||
if (dir == NULL)
|
||||
continue;
|
||||
continue;
|
||||
while ((entry = g_dir_read_name (dir)) != NULL)
|
||||
{
|
||||
GMappedFile *mfile;
|
||||
char *path, *version;
|
||||
struct NamespaceVersionCandidadate *candidate;
|
||||
{
|
||||
GMappedFile *mfile;
|
||||
char *path, *version;
|
||||
struct NamespaceVersionCandidadate *candidate;
|
||||
|
||||
if (!g_str_has_suffix (entry, ".typelib"))
|
||||
continue;
|
||||
if (!g_str_has_suffix (entry, ".typelib"))
|
||||
continue;
|
||||
|
||||
if (g_str_has_prefix (entry, namespace_dash))
|
||||
{
|
||||
const char *last_dash;
|
||||
const char *name_end;
|
||||
int major, minor;
|
||||
if (g_str_has_prefix (entry, namespace_dash))
|
||||
{
|
||||
const char *last_dash;
|
||||
const char *name_end;
|
||||
int major, minor;
|
||||
|
||||
if (g_str_equal (namespace, GIREPOSITORY_TYPELIB_NAME) &&
|
||||
!g_str_equal (entry, GIREPOSITORY_TYPELIB_FILENAME))
|
||||
{
|
||||
g_debug ("Ignoring %s because this libgirepository "
|
||||
"corresponds to %s",
|
||||
entry, GIREPOSITORY_TYPELIB_FILENAME);
|
||||
continue;
|
||||
}
|
||||
if (g_str_equal (namespace, GIREPOSITORY_TYPELIB_NAME) &&
|
||||
!g_str_equal (entry, GIREPOSITORY_TYPELIB_FILENAME))
|
||||
{
|
||||
g_debug ("Ignoring %s because this libgirepository "
|
||||
"corresponds to %s",
|
||||
entry, GIREPOSITORY_TYPELIB_FILENAME);
|
||||
continue;
|
||||
}
|
||||
|
||||
name_end = strrchr (entry, '.');
|
||||
last_dash = strrchr (entry, '-');
|
||||
version = g_strndup (last_dash+1, name_end-(last_dash+1));
|
||||
if (!parse_version (version, &major, &minor))
|
||||
{
|
||||
g_free (version);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
continue;
|
||||
name_end = strrchr (entry, '.');
|
||||
last_dash = strrchr (entry, '-');
|
||||
version = g_strndup (last_dash+1, name_end-(last_dash+1));
|
||||
if (!parse_version (version, &major, &minor))
|
||||
{
|
||||
g_free (version);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
if (g_hash_table_lookup (found_versions, version) != NULL)
|
||||
{
|
||||
g_free (version);
|
||||
continue;
|
||||
}
|
||||
if (g_hash_table_lookup (found_versions, version) != NULL)
|
||||
{
|
||||
g_free (version);
|
||||
continue;
|
||||
}
|
||||
|
||||
path = g_build_filename (dirname, entry, NULL);
|
||||
mfile = g_mapped_file_new (path, FALSE, &error);
|
||||
if (mfile == NULL)
|
||||
{
|
||||
g_free (path);
|
||||
g_free (version);
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
}
|
||||
candidate = g_slice_new0 (struct NamespaceVersionCandidadate);
|
||||
candidate->mfile = mfile;
|
||||
candidate->path_index = index;
|
||||
candidate->path = path;
|
||||
candidate->version = version;
|
||||
candidates = g_slist_prepend (candidates, candidate);
|
||||
g_hash_table_add (found_versions, version);
|
||||
}
|
||||
path = g_build_filename (dirname, entry, NULL);
|
||||
mfile = g_mapped_file_new (path, FALSE, &error);
|
||||
if (mfile == NULL)
|
||||
{
|
||||
g_free (path);
|
||||
g_free (version);
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
}
|
||||
candidate = g_slice_new0 (struct NamespaceVersionCandidadate);
|
||||
candidate->mfile = mfile;
|
||||
candidate->path_index = index;
|
||||
candidate->path = path;
|
||||
candidate->version = version;
|
||||
candidates = g_slist_prepend (candidates, candidate);
|
||||
g_hash_table_add (found_versions, version);
|
||||
}
|
||||
g_dir_close (dir);
|
||||
index++;
|
||||
}
|
||||
@ -1708,9 +1708,9 @@ require_internal (GIRepository *repository,
|
||||
if (version_conflict != NULL)
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
|
||||
"Requiring namespace '%s' version '%s', but '%s' is already loaded",
|
||||
namespace, version, version_conflict);
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
|
||||
"Requiring namespace '%s' version '%s', but '%s' is already loaded",
|
||||
namespace, version, version_conflict);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1729,15 +1729,15 @@ require_internal (GIRepository *repository,
|
||||
if (mfile == NULL)
|
||||
{
|
||||
if (version != NULL)
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||
"Typelib file for namespace '%s', version '%s' not found",
|
||||
namespace, version);
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||
"Typelib file for namespace '%s', version '%s' not found",
|
||||
namespace, version);
|
||||
else
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||
"Typelib file for namespace '%s' (any version) not found",
|
||||
namespace);
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||
"Typelib file for namespace '%s' (any version) not found",
|
||||
namespace);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1746,12 +1746,12 @@ require_internal (GIRepository *repository,
|
||||
typelib = gi_typelib_new_from_mapped_file (mfile, &temp_error);
|
||||
if (!typelib)
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||
"Failed to load typelib file '%s' for namespace '%s': %s",
|
||||
path, namespace, temp_error->message);
|
||||
g_clear_error (&temp_error);
|
||||
goto out;
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||
"Failed to load typelib file '%s' for namespace '%s': %s",
|
||||
path, namespace, temp_error->message);
|
||||
g_clear_error (&temp_error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
header = (Header *) typelib->data;
|
||||
@ -1761,26 +1761,26 @@ require_internal (GIRepository *repository,
|
||||
if (strcmp (typelib_namespace, namespace) != 0)
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
||||
"Typelib file %s for namespace '%s' contains "
|
||||
"namespace '%s' which doesn't match the file name",
|
||||
path, namespace, typelib_namespace);
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
||||
"Typelib file %s for namespace '%s' contains "
|
||||
"namespace '%s' which doesn't match the file name",
|
||||
path, namespace, typelib_namespace);
|
||||
gi_typelib_free (typelib);
|
||||
goto out;
|
||||
}
|
||||
if (version != NULL && strcmp (typelib_version, version) != 0)
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
||||
"Typelib file %s for namespace '%s' contains "
|
||||
"version '%s' which doesn't match the expected version '%s'",
|
||||
path, namespace, typelib_version, version);
|
||||
GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
||||
"Typelib file %s for namespace '%s' contains "
|
||||
"version '%s' which doesn't match the expected version '%s'",
|
||||
path, namespace, typelib_version, version);
|
||||
gi_typelib_free (typelib);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!register_internal (repository, path, allow_lazy,
|
||||
typelib, error))
|
||||
typelib, error))
|
||||
{
|
||||
gi_typelib_free (typelib);
|
||||
goto out;
|
||||
@ -1814,10 +1814,10 @@ require_internal (GIRepository *repository,
|
||||
*/
|
||||
GITypelib *
|
||||
gi_repository_require (GIRepository *repository,
|
||||
const gchar *namespace,
|
||||
const gchar *version,
|
||||
GIRepositoryLoadFlags flags,
|
||||
GError **error)
|
||||
const gchar *namespace,
|
||||
const gchar *version,
|
||||
GIRepositoryLoadFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
|
||||
@ -1853,11 +1853,11 @@ gi_repository_require (GIRepository *repository,
|
||||
*/
|
||||
GITypelib *
|
||||
gi_repository_require_private (GIRepository *repository,
|
||||
const gchar *typelib_dir,
|
||||
const gchar *namespace,
|
||||
const gchar *version,
|
||||
GIRepositoryLoadFlags flags,
|
||||
GError **error)
|
||||
const gchar *typelib_dir,
|
||||
const gchar *namespace,
|
||||
const gchar *version,
|
||||
GIRepositoryLoadFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
const char * const search_path[] = { typelib_dir, NULL };
|
||||
|
||||
@ -1867,9 +1867,9 @@ gi_repository_require_private (GIRepository *repository,
|
||||
|
||||
static gboolean
|
||||
gi_repository_introspect_cb (const char *option_name,
|
||||
const char *value,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
const char *value,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
GError *tmp_error = NULL;
|
||||
char **args;
|
||||
@ -1879,7 +1879,7 @@ gi_repository_introspect_cb (const char *option_name,
|
||||
if (!gi_repository_dump (args[0], args[1], &tmp_error))
|
||||
{
|
||||
g_error ("Failed to extract GType data: %s",
|
||||
tmp_error->message);
|
||||
tmp_error->message);
|
||||
exit (1);
|
||||
}
|
||||
exit (0);
|
||||
|
@ -38,7 +38,7 @@
|
||||
static ffi_type *
|
||||
gi_type_tag_get_ffi_type_internal (GITypeTag tag,
|
||||
gboolean is_pointer,
|
||||
gboolean is_enum)
|
||||
gboolean is_enum)
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
@ -83,13 +83,13 @@ gi_type_tag_get_ffi_type_internal (GITypeTag tag,
|
||||
return &ffi_type_pointer;
|
||||
case GI_TYPE_TAG_INTERFACE:
|
||||
{
|
||||
/* We need to handle enums specially:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=665150
|
||||
*/
|
||||
/* We need to handle enums specially:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=665150
|
||||
*/
|
||||
if (!is_enum)
|
||||
return &ffi_type_pointer;
|
||||
else
|
||||
return &ffi_type_sint32;
|
||||
else
|
||||
return &ffi_type_sint32;
|
||||
}
|
||||
case GI_TYPE_TAG_VOID:
|
||||
if (is_pointer)
|
||||
@ -118,7 +118,7 @@ gi_type_tag_get_ffi_type_internal (GITypeTag tag,
|
||||
*/
|
||||
ffi_type *
|
||||
gi_type_tag_get_ffi_type (GITypeTag type_tag,
|
||||
gboolean is_pointer)
|
||||
gboolean is_pointer)
|
||||
{
|
||||
return gi_type_tag_get_ffi_type_internal (type_tag, is_pointer, FALSE);
|
||||
}
|
||||
|
@ -122,16 +122,16 @@ gi_ir_module_fatal (GIIrTypelibBuild *build,
|
||||
GIIrNode *node = link->data;
|
||||
const char *name = node->name;
|
||||
if (name)
|
||||
g_string_append (context, name);
|
||||
g_string_append (context, name);
|
||||
if (link->prev)
|
||||
g_string_append (context, ".");
|
||||
g_string_append (context, ".");
|
||||
}
|
||||
if (build->stack)
|
||||
g_string_append (context, ": ");
|
||||
|
||||
g_printerr ("%s-%s.gir:%serror: %s\n", build->module->name,
|
||||
build->module->version,
|
||||
context->str, formatted);
|
||||
build->module->version,
|
||||
context->str, formatted);
|
||||
g_string_free (context, TRUE);
|
||||
|
||||
exit (1);
|
||||
@ -141,8 +141,8 @@ gi_ir_module_fatal (GIIrTypelibBuild *build,
|
||||
|
||||
static void
|
||||
add_alias_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
{
|
||||
GIIrModule *module = data;
|
||||
|
||||
@ -161,8 +161,8 @@ add_pointer_structure_foreach (gpointer key,
|
||||
|
||||
static void
|
||||
add_disguised_structure_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
{
|
||||
GIIrModule *module = data;
|
||||
|
||||
@ -174,18 +174,18 @@ gi_ir_module_add_include_module (GIIrModule *module,
|
||||
GIIrModule *include_module)
|
||||
{
|
||||
module->include_modules = g_list_prepend (module->include_modules,
|
||||
include_module);
|
||||
include_module);
|
||||
|
||||
g_hash_table_foreach (include_module->aliases,
|
||||
add_alias_foreach,
|
||||
module);
|
||||
add_alias_foreach,
|
||||
module);
|
||||
|
||||
g_hash_table_foreach (include_module->pointer_structures,
|
||||
add_pointer_structure_foreach,
|
||||
module);
|
||||
add_pointer_structure_foreach,
|
||||
module);
|
||||
g_hash_table_foreach (include_module->disguised_structures,
|
||||
add_disguised_structure_foreach,
|
||||
module);
|
||||
add_disguised_structure_foreach,
|
||||
module);
|
||||
}
|
||||
|
||||
struct AttributeWriteData
|
||||
@ -256,11 +256,11 @@ alloc_section (guint8 *data, SectionType section_id, guint32 offset)
|
||||
for (i = 0; i < NUM_SECTIONS; i++)
|
||||
{
|
||||
if (section_data->id == GI_SECTION_END)
|
||||
{
|
||||
section_data->id = section_id;
|
||||
section_data->offset = offset;
|
||||
return;
|
||||
}
|
||||
{
|
||||
section_data->id = section_id;
|
||||
section_data->offset = offset;
|
||||
return;
|
||||
}
|
||||
section_data++;
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
@ -346,18 +346,18 @@ gi_ir_module_build_typelib (GIIrModule *module)
|
||||
GList *link;
|
||||
for (link = module->dependencies; link; link = link->next)
|
||||
{
|
||||
const char *dependency = link->data;
|
||||
if (!strcmp (dependency, module->name))
|
||||
continue;
|
||||
g_string_append (dependencies_str, dependency);
|
||||
if (link->next)
|
||||
g_string_append_c (dependencies_str, '|');
|
||||
const char *dependency = link->data;
|
||||
if (!strcmp (dependency, module->name))
|
||||
continue;
|
||||
g_string_append (dependencies_str, dependency);
|
||||
if (link->next)
|
||||
g_string_append_c (dependencies_str, '|');
|
||||
}
|
||||
dependencies = g_string_free (dependencies_str, FALSE);
|
||||
if (!dependencies[0])
|
||||
{
|
||||
g_free (dependencies);
|
||||
dependencies = NULL;
|
||||
g_free (dependencies);
|
||||
dependencies = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ gi_ir_module_build_typelib (GIIrModule *module)
|
||||
n_entries = g_list_length (module->entries);
|
||||
|
||||
g_message ("%d entries (%d local), %d dependencies", n_entries, n_local_entries,
|
||||
g_list_length (module->dependencies));
|
||||
g_list_length (module->dependencies));
|
||||
|
||||
dir_size = n_entries * sizeof (DirEntry);
|
||||
size = header_size + dir_size;
|
||||
@ -398,7 +398,7 @@ gi_ir_module_build_typelib (GIIrModule *module)
|
||||
size += sizeof (Section) * NUM_SECTIONS;
|
||||
|
||||
g_message ("allocating %d bytes (%d header, %d directory, %d entries)",
|
||||
size, header_size, dir_size, size - header_size - dir_size);
|
||||
size, header_size, dir_size, size - header_size - dir_size);
|
||||
|
||||
data = g_malloc0 (size);
|
||||
|
||||
@ -476,67 +476,67 @@ gi_ir_module_build_typelib (GIIrModule *module)
|
||||
|
||||
if (strchr (node->name, '.'))
|
||||
{
|
||||
g_error ("Names may not contain '.'");
|
||||
}
|
||||
g_error ("Names may not contain '.'");
|
||||
}
|
||||
|
||||
/* we picked up implicit xref nodes, start over */
|
||||
if (i == n_entries)
|
||||
{
|
||||
GList *link;
|
||||
g_message ("Found implicit cross references, starting over");
|
||||
{
|
||||
GList *link;
|
||||
g_message ("Found implicit cross references, starting over");
|
||||
|
||||
g_hash_table_destroy (strings);
|
||||
g_hash_table_destroy (types);
|
||||
g_hash_table_destroy (strings);
|
||||
g_hash_table_destroy (types);
|
||||
|
||||
/* Reset the cached offsets */
|
||||
for (link = nodes_with_attributes; link; link = link->next)
|
||||
((GIIrNode *) link->data)->offset = 0;
|
||||
/* Reset the cached offsets */
|
||||
for (link = nodes_with_attributes; link; link = link->next)
|
||||
((GIIrNode *) link->data)->offset = 0;
|
||||
|
||||
g_list_free (nodes_with_attributes);
|
||||
strings = NULL;
|
||||
g_list_free (nodes_with_attributes);
|
||||
strings = NULL;
|
||||
|
||||
g_free (data);
|
||||
data = NULL;
|
||||
g_free (data);
|
||||
data = NULL;
|
||||
|
||||
goto restart;
|
||||
}
|
||||
goto restart;
|
||||
}
|
||||
|
||||
offset = offset2;
|
||||
|
||||
if (node->type == GI_IR_NODE_XREF)
|
||||
{
|
||||
const char *namespace = ((GIIrNodeXRef*)node)->namespace;
|
||||
{
|
||||
const char *namespace = ((GIIrNodeXRef*)node)->namespace;
|
||||
|
||||
entry->blob_type = 0;
|
||||
entry->local = FALSE;
|
||||
entry->offset = gi_ir_write_string (namespace, strings, data, &offset2);
|
||||
entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
|
||||
}
|
||||
entry->blob_type = 0;
|
||||
entry->local = FALSE;
|
||||
entry->offset = gi_ir_write_string (namespace, strings, data, &offset2);
|
||||
entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
|
||||
}
|
||||
else
|
||||
{
|
||||
old_offset = offset;
|
||||
offset2 = offset + gi_ir_node_get_size (node);
|
||||
{
|
||||
old_offset = offset;
|
||||
offset2 = offset + gi_ir_node_get_size (node);
|
||||
|
||||
entry->blob_type = node->type;
|
||||
entry->local = TRUE;
|
||||
entry->offset = offset;
|
||||
entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
|
||||
entry->blob_type = node->type;
|
||||
entry->local = TRUE;
|
||||
entry->offset = offset;
|
||||
entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
|
||||
|
||||
memset (&build, 0, sizeof (build));
|
||||
build.module = module;
|
||||
build.strings = strings;
|
||||
build.types = types;
|
||||
build.nodes_with_attributes = nodes_with_attributes;
|
||||
build.n_attributes = header->n_attributes;
|
||||
build.data = data;
|
||||
gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL);
|
||||
memset (&build, 0, sizeof (build));
|
||||
build.module = module;
|
||||
build.strings = strings;
|
||||
build.types = types;
|
||||
build.nodes_with_attributes = nodes_with_attributes;
|
||||
build.n_attributes = header->n_attributes;
|
||||
build.data = data;
|
||||
gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL);
|
||||
|
||||
nodes_with_attributes = build.nodes_with_attributes;
|
||||
header->n_attributes = build.n_attributes;
|
||||
nodes_with_attributes = build.nodes_with_attributes;
|
||||
header->n_attributes = build.n_attributes;
|
||||
|
||||
if (offset2 > old_offset + gi_ir_node_get_full_size (node))
|
||||
g_error ("left a hole of %d bytes", offset2 - old_offset - gi_ir_node_get_full_size (node));
|
||||
}
|
||||
if (offset2 > old_offset + gi_ir_node_get_full_size (node))
|
||||
g_error ("left a hole of %d bytes", offset2 - old_offset - gi_ir_node_get_full_size (node));
|
||||
}
|
||||
|
||||
entry++;
|
||||
}
|
||||
@ -572,7 +572,7 @@ gi_ir_module_build_typelib (GIIrModule *module)
|
||||
if (!typelib)
|
||||
{
|
||||
g_error ("error building typelib: %s",
|
||||
error->message);
|
||||
error->message);
|
||||
}
|
||||
|
||||
g_hash_table_destroy (strings);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -95,44 +95,44 @@ compute_enum_storage_type (GIIrNodeEnum *enum_node)
|
||||
signed_type = TRUE;
|
||||
|
||||
if (min_value > -128 && max_value <= 127)
|
||||
width = sizeof(Enum7);
|
||||
width = sizeof(Enum7);
|
||||
else if (min_value >= G_MINSHORT && max_value <= G_MAXSHORT)
|
||||
width = sizeof(Enum8);
|
||||
width = sizeof(Enum8);
|
||||
else
|
||||
width = sizeof(Enum9);
|
||||
width = sizeof(Enum9);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (max_value <= 127)
|
||||
{
|
||||
width = sizeof (Enum1);
|
||||
signed_type = (gint64)(Enum1)(-1) < 0;
|
||||
}
|
||||
{
|
||||
width = sizeof (Enum1);
|
||||
signed_type = (gint64)(Enum1)(-1) < 0;
|
||||
}
|
||||
else if (max_value <= 255)
|
||||
{
|
||||
width = sizeof (Enum2);
|
||||
signed_type = (gint64)(Enum2)(-1) < 0;
|
||||
}
|
||||
{
|
||||
width = sizeof (Enum2);
|
||||
signed_type = (gint64)(Enum2)(-1) < 0;
|
||||
}
|
||||
else if (max_value <= G_MAXSHORT)
|
||||
{
|
||||
width = sizeof (Enum3);
|
||||
signed_type = (gint64)(Enum3)(-1) < 0;
|
||||
}
|
||||
{
|
||||
width = sizeof (Enum3);
|
||||
signed_type = (gint64)(Enum3)(-1) < 0;
|
||||
}
|
||||
else if (max_value <= G_MAXUSHORT)
|
||||
{
|
||||
width = sizeof (Enum4);
|
||||
signed_type = (gint64)(Enum4)(-1) < 0;
|
||||
}
|
||||
{
|
||||
width = sizeof (Enum4);
|
||||
signed_type = (gint64)(Enum4)(-1) < 0;
|
||||
}
|
||||
else if (max_value <= G_MAXINT)
|
||||
{
|
||||
width = sizeof (Enum5);
|
||||
signed_type = (gint64)(Enum5)(-1) < 0;
|
||||
}
|
||||
{
|
||||
width = sizeof (Enum5);
|
||||
signed_type = (gint64)(Enum5)(-1) < 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = sizeof (Enum6);
|
||||
signed_type = (gint64)(Enum6)(-1) < 0;
|
||||
}
|
||||
{
|
||||
width = sizeof (Enum6);
|
||||
signed_type = (gint64)(Enum6)(-1) < 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (width == 1)
|
||||
@ -176,7 +176,7 @@ get_enum_size_alignment (GIIrNodeEnum *enum_node,
|
||||
break;
|
||||
default:
|
||||
g_error ("Unexpected enum storage type %s",
|
||||
gi_type_tag_to_string (enum_node->storage_type));
|
||||
gi_type_tag_to_string (enum_node->storage_type));
|
||||
}
|
||||
|
||||
*size = type_ffi->size;
|
||||
@ -209,53 +209,53 @@ get_interface_size_alignment (GIIrTypelibBuild *build,
|
||||
{
|
||||
case GI_IR_NODE_BOXED:
|
||||
{
|
||||
GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)iface;
|
||||
*size = boxed->size;
|
||||
*alignment = boxed->alignment;
|
||||
break;
|
||||
GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)iface;
|
||||
*size = boxed->size;
|
||||
*alignment = boxed->alignment;
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_STRUCT:
|
||||
{
|
||||
GIIrNodeStruct *struct_ = (GIIrNodeStruct *)iface;
|
||||
*size = struct_->size;
|
||||
*alignment = struct_->alignment;
|
||||
break;
|
||||
GIIrNodeStruct *struct_ = (GIIrNodeStruct *)iface;
|
||||
*size = struct_->size;
|
||||
*alignment = struct_->alignment;
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_OBJECT:
|
||||
case GI_IR_NODE_INTERFACE:
|
||||
{
|
||||
GIIrNodeInterface *interface = (GIIrNodeInterface *)iface;
|
||||
*size = interface->size;
|
||||
*alignment = interface->alignment;
|
||||
break;
|
||||
GIIrNodeInterface *interface = (GIIrNodeInterface *)iface;
|
||||
*size = interface->size;
|
||||
*alignment = interface->alignment;
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_UNION:
|
||||
{
|
||||
GIIrNodeUnion *union_ = (GIIrNodeUnion *)iface;
|
||||
*size = union_->size;
|
||||
*alignment = union_->alignment;
|
||||
break;
|
||||
GIIrNodeUnion *union_ = (GIIrNodeUnion *)iface;
|
||||
*size = union_->size;
|
||||
*alignment = union_->alignment;
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_ENUM:
|
||||
case GI_IR_NODE_FLAGS:
|
||||
{
|
||||
return get_enum_size_alignment ((GIIrNodeEnum *)iface,
|
||||
size, alignment);
|
||||
return get_enum_size_alignment ((GIIrNodeEnum *)iface,
|
||||
size, alignment);
|
||||
}
|
||||
case GI_IR_NODE_CALLBACK:
|
||||
{
|
||||
*size = ffi_type_pointer.size;
|
||||
*alignment = ffi_type_pointer.alignment;
|
||||
break;
|
||||
*size = ffi_type_pointer.size;
|
||||
*alignment = ffi_type_pointer.alignment;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
g_warning ("%s has is not a pointer and is of type %s",
|
||||
g_warning ("%s has is not a pointer and is of type %s",
|
||||
who,
|
||||
gi_ir_node_type_to_string (iface->type));
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
break;
|
||||
gi_ir_node_type_to_string (iface->type));
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,30 +296,30 @@ get_type_size_alignment (GIIrTypelibBuild *build,
|
||||
else
|
||||
{
|
||||
if (type->tag == GI_TYPE_TAG_INTERFACE)
|
||||
{
|
||||
return get_interface_size_alignment (build, type, size, alignment, who);
|
||||
}
|
||||
{
|
||||
return get_interface_size_alignment (build, type, size, alignment, who);
|
||||
}
|
||||
else
|
||||
{
|
||||
type_ffi = gi_type_tag_get_ffi_type (type->tag, type->is_pointer);
|
||||
{
|
||||
type_ffi = gi_type_tag_get_ffi_type (type->tag, type->is_pointer);
|
||||
|
||||
if (type_ffi == &ffi_type_void)
|
||||
{
|
||||
g_warning ("%s has void type", who);
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
return FALSE;
|
||||
}
|
||||
else if (type_ffi == &ffi_type_pointer)
|
||||
{
|
||||
g_warning ("%s has is not a pointer and is of type %s",
|
||||
if (type_ffi == &ffi_type_void)
|
||||
{
|
||||
g_warning ("%s has void type", who);
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
return FALSE;
|
||||
}
|
||||
else if (type_ffi == &ffi_type_pointer)
|
||||
{
|
||||
g_warning ("%s has is not a pointer and is of type %s",
|
||||
who,
|
||||
gi_type_tag_to_string (type->tag));
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
gi_type_tag_to_string (type->tag));
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_assert (type_ffi);
|
||||
@ -376,35 +376,35 @@ compute_struct_field_offsets (GIIrTypelibBuild *build,
|
||||
GIIrNode *member = (GIIrNode *)l->data;
|
||||
|
||||
if (member->type == GI_IR_NODE_FIELD)
|
||||
{
|
||||
GIIrNodeField *field = (GIIrNodeField *)member;
|
||||
{
|
||||
GIIrNodeField *field = (GIIrNodeField *)member;
|
||||
|
||||
if (!have_error)
|
||||
{
|
||||
int member_size;
|
||||
int member_alignment;
|
||||
if (!have_error)
|
||||
{
|
||||
int member_size;
|
||||
int member_alignment;
|
||||
|
||||
if (get_field_size_alignment (build, field, node,
|
||||
&member_size, &member_alignment))
|
||||
{
|
||||
size = GI_ALIGN (size, member_alignment);
|
||||
alignment = MAX (alignment, member_alignment);
|
||||
field->offset = size;
|
||||
size += member_size;
|
||||
}
|
||||
else
|
||||
have_error = TRUE;
|
||||
}
|
||||
if (get_field_size_alignment (build, field, node,
|
||||
&member_size, &member_alignment))
|
||||
{
|
||||
size = GI_ALIGN (size, member_alignment);
|
||||
alignment = MAX (alignment, member_alignment);
|
||||
field->offset = size;
|
||||
size += member_size;
|
||||
}
|
||||
else
|
||||
have_error = TRUE;
|
||||
}
|
||||
|
||||
if (have_error)
|
||||
field->offset = -1;
|
||||
}
|
||||
if (have_error)
|
||||
field->offset = -1;
|
||||
}
|
||||
else if (member->type == GI_IR_NODE_CALLBACK)
|
||||
{
|
||||
{
|
||||
size = GI_ALIGN (size, ffi_type_pointer.alignment);
|
||||
alignment = MAX (alignment, ffi_type_pointer.alignment);
|
||||
size += ffi_type_pointer.size;
|
||||
}
|
||||
size += ffi_type_pointer.size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Structs are tail-padded out to a multiple of their alignment */
|
||||
@ -443,24 +443,24 @@ compute_union_field_offsets (GIIrTypelibBuild *build,
|
||||
GIIrNode *member = (GIIrNode *)l->data;
|
||||
|
||||
if (member->type == GI_IR_NODE_FIELD)
|
||||
{
|
||||
GIIrNodeField *field = (GIIrNodeField *)member;
|
||||
{
|
||||
GIIrNodeField *field = (GIIrNodeField *)member;
|
||||
|
||||
if (!have_error)
|
||||
{
|
||||
int member_size;
|
||||
int member_alignment;
|
||||
if (!have_error)
|
||||
{
|
||||
int member_size;
|
||||
int member_alignment;
|
||||
|
||||
if (get_field_size_alignment (build,field, node,
|
||||
&member_size, &member_alignment))
|
||||
{
|
||||
size = MAX (size, member_size);
|
||||
alignment = MAX (alignment, member_alignment);
|
||||
}
|
||||
else
|
||||
have_error = TRUE;
|
||||
}
|
||||
}
|
||||
if (get_field_size_alignment (build,field, node,
|
||||
&member_size, &member_alignment))
|
||||
{
|
||||
size = MAX (size, member_size);
|
||||
alignment = MAX (alignment, member_alignment);
|
||||
}
|
||||
else
|
||||
have_error = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Unions are tail-padded out to a multiple of their alignment */
|
||||
@ -495,7 +495,7 @@ check_needs_computation (GIIrTypelibBuild *build,
|
||||
if (alignment == -2)
|
||||
{
|
||||
g_warning ("Recursion encountered when computing the size of %s.%s",
|
||||
module->name, node->name);
|
||||
module->name, node->name);
|
||||
}
|
||||
|
||||
return alignment == 0;
|
||||
@ -529,60 +529,60 @@ gi_ir_node_compute_offsets (GIIrTypelibBuild *build,
|
||||
{
|
||||
case GI_IR_NODE_BOXED:
|
||||
{
|
||||
GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
|
||||
GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
|
||||
|
||||
if (!check_needs_computation (build, node, boxed->alignment))
|
||||
return;
|
||||
if (!check_needs_computation (build, node, boxed->alignment))
|
||||
return;
|
||||
|
||||
compute_struct_field_offsets (build, node, boxed->members,
|
||||
&boxed->size, &boxed->alignment);
|
||||
break;
|
||||
compute_struct_field_offsets (build, node, boxed->members,
|
||||
&boxed->size, &boxed->alignment);
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_STRUCT:
|
||||
{
|
||||
GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
|
||||
GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
|
||||
|
||||
if (!check_needs_computation (build, node, struct_->alignment))
|
||||
return;
|
||||
if (!check_needs_computation (build, node, struct_->alignment))
|
||||
return;
|
||||
|
||||
compute_struct_field_offsets (build, node, struct_->members,
|
||||
&struct_->size, &struct_->alignment);
|
||||
break;
|
||||
compute_struct_field_offsets (build, node, struct_->members,
|
||||
&struct_->size, &struct_->alignment);
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_OBJECT:
|
||||
case GI_IR_NODE_INTERFACE:
|
||||
{
|
||||
GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
|
||||
GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
|
||||
|
||||
if (!check_needs_computation (build, node, iface->alignment))
|
||||
return;
|
||||
if (!check_needs_computation (build, node, iface->alignment))
|
||||
return;
|
||||
|
||||
compute_struct_field_offsets (build, node, iface->members,
|
||||
&iface->size, &iface->alignment);
|
||||
break;
|
||||
compute_struct_field_offsets (build, node, iface->members,
|
||||
&iface->size, &iface->alignment);
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_UNION:
|
||||
{
|
||||
GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
|
||||
GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
|
||||
|
||||
if (!check_needs_computation (build, node, union_->alignment))
|
||||
return;
|
||||
if (!check_needs_computation (build, node, union_->alignment))
|
||||
return;
|
||||
|
||||
compute_union_field_offsets (build, (GIIrNode*)union_, union_->members,
|
||||
&union_->size, &union_->alignment);
|
||||
break;
|
||||
compute_union_field_offsets (build, (GIIrNode*)union_, union_->members,
|
||||
&union_->size, &union_->alignment);
|
||||
break;
|
||||
}
|
||||
case GI_IR_NODE_ENUM:
|
||||
case GI_IR_NODE_FLAGS:
|
||||
{
|
||||
GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
|
||||
GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
|
||||
|
||||
if (enum_->storage_type != GI_TYPE_TAG_VOID) /* already done */
|
||||
return;
|
||||
if (enum_->storage_type != GI_TYPE_TAG_VOID) /* already done */
|
||||
return;
|
||||
|
||||
compute_enum_storage_type (enum_);
|
||||
compute_enum_storage_type (enum_);
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -169,13 +169,13 @@ check_unresolved (GIBaseInfo *info)
|
||||
return;
|
||||
|
||||
g_critical ("Found unresolved type '%s' '%s'",
|
||||
gi_base_info_get_name (info), gi_base_info_get_namespace (info));
|
||||
gi_base_info_get_name (info), gi_base_info_get_namespace (info));
|
||||
}
|
||||
|
||||
static void
|
||||
write_type_name (const gchar *ns,
|
||||
GIBaseInfo *info,
|
||||
Xml *file)
|
||||
GIBaseInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
if (strcmp (ns, gi_base_info_get_namespace (info)) != 0)
|
||||
xml_printf (file, "%s.", gi_base_info_get_namespace (info));
|
||||
@ -185,9 +185,9 @@ write_type_name (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_type_name_attribute (const gchar *ns,
|
||||
GIBaseInfo *info,
|
||||
const char *attr_name,
|
||||
Xml *file)
|
||||
GIBaseInfo *info,
|
||||
const char *attr_name,
|
||||
Xml *file)
|
||||
{
|
||||
xml_printf (file, " %s=\"", attr_name);
|
||||
write_type_name (ns, info, file);
|
||||
@ -216,8 +216,8 @@ write_ownership_transfer (GITransfer transfer,
|
||||
|
||||
static void
|
||||
write_type_info (const gchar *ns,
|
||||
GITypeInfo *info,
|
||||
Xml *file)
|
||||
GITypeInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
gint tag;
|
||||
GITypeInfo *type;
|
||||
@ -280,7 +280,7 @@ write_type_info (const gchar *ns,
|
||||
xml_printf (file, " fixed-size=\"%" G_GSSIZE_FORMAT "\"", size);
|
||||
|
||||
if (gi_type_info_is_zero_terminated (info))
|
||||
xml_printf (file, " zero-terminated=\"1\"");
|
||||
xml_printf (file, " zero-terminated=\"1\"");
|
||||
|
||||
write_type_info (ns, type, file);
|
||||
|
||||
@ -302,10 +302,10 @@ write_type_info (const gchar *ns,
|
||||
xml_printf (file, " name=\"GLib.List\"");
|
||||
type = gi_type_info_get_param_type (info, 0);
|
||||
if (type)
|
||||
{
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
}
|
||||
{
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
}
|
||||
xml_end_element (file, "type");
|
||||
}
|
||||
else if (tag == GI_TYPE_TAG_GSLIST)
|
||||
@ -314,10 +314,10 @@ write_type_info (const gchar *ns,
|
||||
xml_printf (file, " name=\"GLib.SList\"");
|
||||
type = gi_type_info_get_param_type (info, 0);
|
||||
if (type)
|
||||
{
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
}
|
||||
{
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
}
|
||||
xml_end_element (file, "type");
|
||||
}
|
||||
else if (tag == GI_TYPE_TAG_GHASH)
|
||||
@ -326,13 +326,13 @@ write_type_info (const gchar *ns,
|
||||
xml_printf (file, " name=\"GLib.HashTable\"");
|
||||
type = gi_type_info_get_param_type (info, 0);
|
||||
if (type)
|
||||
{
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
type = gi_type_info_get_param_type (info, 1);
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
}
|
||||
{
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
type = gi_type_info_get_param_type (info, 1);
|
||||
write_type_info (ns, type, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)type);
|
||||
}
|
||||
xml_end_element (file, "type");
|
||||
}
|
||||
else if (tag == GI_TYPE_TAG_ERROR)
|
||||
@ -380,20 +380,20 @@ write_return_value_attributes (Xml *file,
|
||||
|
||||
static void
|
||||
write_constant_value (const gchar *ns,
|
||||
GITypeInfo *info,
|
||||
GIArgument *argument,
|
||||
Xml *file);
|
||||
GITypeInfo *info,
|
||||
GIArgument *argument,
|
||||
Xml *file);
|
||||
|
||||
static void
|
||||
write_callback_info (const gchar *ns,
|
||||
GICallbackInfo *info,
|
||||
Xml *file);
|
||||
GICallbackInfo *info,
|
||||
Xml *file);
|
||||
|
||||
static void
|
||||
write_field_info (const gchar *ns,
|
||||
GIFieldInfo *info,
|
||||
GIConstantInfo *branch,
|
||||
Xml *file)
|
||||
GIFieldInfo *info,
|
||||
GIConstantInfo *branch,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
GIFieldInfoFlags flags;
|
||||
@ -458,8 +458,8 @@ write_field_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_callable_info (const gchar *ns,
|
||||
GICallableInfo *info,
|
||||
Xml *file)
|
||||
GICallableInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
GITypeInfo *type;
|
||||
|
||||
@ -501,28 +501,28 @@ write_callable_info (const gchar *ns,
|
||||
write_ownership_transfer (gi_arg_info_get_ownership_transfer (arg), file);
|
||||
|
||||
switch (gi_arg_info_get_direction (arg))
|
||||
{
|
||||
case GI_DIRECTION_IN:
|
||||
break;
|
||||
case GI_DIRECTION_OUT:
|
||||
xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"",
|
||||
gi_arg_info_is_caller_allocates (arg) ? "1" : "0");
|
||||
break;
|
||||
case GI_DIRECTION_INOUT:
|
||||
xml_printf (file, " direction=\"inout\"");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
{
|
||||
case GI_DIRECTION_IN:
|
||||
break;
|
||||
case GI_DIRECTION_OUT:
|
||||
xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"",
|
||||
gi_arg_info_is_caller_allocates (arg) ? "1" : "0");
|
||||
break;
|
||||
case GI_DIRECTION_INOUT:
|
||||
xml_printf (file, " direction=\"inout\"");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (gi_arg_info_may_be_null (arg))
|
||||
xml_printf (file, " allow-none=\"1\"");
|
||||
xml_printf (file, " allow-none=\"1\"");
|
||||
|
||||
if (gi_arg_info_is_return_value (arg))
|
||||
xml_printf (file, " retval=\"1\"");
|
||||
xml_printf (file, " retval=\"1\"");
|
||||
|
||||
if (gi_arg_info_is_optional (arg))
|
||||
xml_printf (file, " optional=\"1\"");
|
||||
xml_printf (file, " optional=\"1\"");
|
||||
|
||||
switch (gi_arg_info_get_scope (arg))
|
||||
{
|
||||
@ -569,8 +569,8 @@ write_callable_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_function_info (const gchar *ns,
|
||||
GIFunctionInfo *info,
|
||||
Xml *file)
|
||||
GIFunctionInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
GIFunctionInfoFlags flags;
|
||||
const gchar *tag;
|
||||
@ -620,8 +620,8 @@ write_function_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_callback_info (const gchar *ns,
|
||||
GICallbackInfo *info,
|
||||
Xml *file)
|
||||
GICallbackInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
gboolean deprecated;
|
||||
@ -641,8 +641,8 @@ write_callback_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_struct_info (const gchar *ns,
|
||||
GIStructInfo *info,
|
||||
Xml *file)
|
||||
GIStructInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *type_name;
|
||||
@ -703,18 +703,18 @@ write_struct_info (const gchar *ns,
|
||||
if (n_elts > 0)
|
||||
{
|
||||
for (guint i = 0; i < gi_struct_info_get_n_fields (info); i++)
|
||||
{
|
||||
GIFieldInfo *field = gi_struct_info_get_field (info, i);
|
||||
write_field_info (ns, field, NULL, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)field);
|
||||
}
|
||||
{
|
||||
GIFieldInfo *field = gi_struct_info_get_field (info, i);
|
||||
write_field_info (ns, field, NULL, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)field);
|
||||
}
|
||||
|
||||
for (guint i = 0; i < gi_struct_info_get_n_methods (info); i++)
|
||||
{
|
||||
GIFunctionInfo *function = gi_struct_info_get_method (info, i);
|
||||
write_function_info (ns, function, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)function);
|
||||
}
|
||||
{
|
||||
GIFunctionInfo *function = gi_struct_info_get_method (info, i);
|
||||
write_function_info (ns, function, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)function);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -723,8 +723,8 @@ write_struct_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_value_info (const gchar *ns,
|
||||
GIValueInfo *info,
|
||||
Xml *file)
|
||||
GIValueInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
gint64 value;
|
||||
@ -750,9 +750,9 @@ write_value_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_constant_value (const gchar *ns,
|
||||
GITypeInfo *type,
|
||||
GIArgument *value,
|
||||
Xml *file)
|
||||
GITypeInfo *type,
|
||||
GIArgument *value,
|
||||
Xml *file)
|
||||
{
|
||||
switch (gi_type_info_get_tag (type))
|
||||
{
|
||||
@ -800,8 +800,8 @@ write_constant_value (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_constant_info (const gchar *ns,
|
||||
GIConstantInfo *info,
|
||||
Xml *file)
|
||||
GIConstantInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
GITypeInfo *type;
|
||||
const gchar *name;
|
||||
@ -831,8 +831,8 @@ write_constant_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_enum_info (const gchar *ns,
|
||||
GIEnumInfo *info,
|
||||
Xml *file)
|
||||
GIEnumInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *type_name;
|
||||
@ -875,8 +875,8 @@ write_enum_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_signal_info (const gchar *ns,
|
||||
GISignalInfo *info,
|
||||
Xml *file)
|
||||
GISignalInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
GSignalFlags flags;
|
||||
const gchar *name;
|
||||
@ -918,8 +918,8 @@ write_signal_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_vfunc_info (const gchar *ns,
|
||||
GIVFuncInfo *info,
|
||||
Xml *file)
|
||||
GIVFuncInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
GIVFuncInfoFlags flags;
|
||||
const gchar *name;
|
||||
@ -962,8 +962,8 @@ write_vfunc_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_property_info (const gchar *ns,
|
||||
GIPropertyInfo *info,
|
||||
Xml *file)
|
||||
GIPropertyInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
GParamFlags flags;
|
||||
const gchar *name;
|
||||
@ -1027,8 +1027,8 @@ write_property_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_object_info (const gchar *ns,
|
||||
GIObjectInfo *info,
|
||||
Xml *file)
|
||||
GIObjectInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *type_name;
|
||||
@ -1101,13 +1101,13 @@ write_object_info (const gchar *ns,
|
||||
if (gi_object_info_get_n_interfaces (info) > 0)
|
||||
{
|
||||
for (guint i = 0; i < gi_object_info_get_n_interfaces (info); i++)
|
||||
{
|
||||
GIInterfaceInfo *imp = gi_object_info_get_interface (info, i);
|
||||
{
|
||||
GIInterfaceInfo *imp = gi_object_info_get_interface (info, i);
|
||||
xml_start_element (file, "implements");
|
||||
write_type_name_attribute (ns, (GIBaseInfo *)imp, "name", file);
|
||||
write_type_name_attribute (ns, (GIBaseInfo *)imp, "name", file);
|
||||
xml_end_element (file, "implements");
|
||||
gi_base_info_unref ((GIBaseInfo*)imp);
|
||||
}
|
||||
gi_base_info_unref ((GIBaseInfo*)imp);
|
||||
}
|
||||
}
|
||||
|
||||
for (guint i = 0; i < gi_object_info_get_n_fields (info); i++)
|
||||
@ -1157,8 +1157,8 @@ write_object_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_interface_info (const gchar *ns,
|
||||
GIInterfaceInfo *info,
|
||||
Xml *file)
|
||||
GIInterfaceInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *type_name;
|
||||
@ -1173,7 +1173,7 @@ write_interface_info (const gchar *ns,
|
||||
type_init = gi_registered_type_info_get_type_init_function_name ((GIRegisteredTypeInfo*)info);
|
||||
xml_start_element (file, "interface");
|
||||
xml_printf (file, " name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"",
|
||||
name, type_name, type_init);
|
||||
name, type_name, type_init);
|
||||
|
||||
class_struct = gi_interface_info_get_iface_struct (info);
|
||||
if (class_struct)
|
||||
@ -1190,15 +1190,15 @@ write_interface_info (const gchar *ns,
|
||||
if (gi_interface_info_get_n_prerequisites (info) > 0)
|
||||
{
|
||||
for (guint i = 0; i < gi_interface_info_get_n_prerequisites (info); i++)
|
||||
{
|
||||
GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i);
|
||||
{
|
||||
GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i);
|
||||
|
||||
xml_start_element (file, "prerequisite");
|
||||
write_type_name_attribute (ns, req, "name", file);
|
||||
xml_start_element (file, "prerequisite");
|
||||
write_type_name_attribute (ns, req, "name", file);
|
||||
|
||||
xml_end_element_unchecked (file);
|
||||
gi_base_info_unref (req);
|
||||
}
|
||||
gi_base_info_unref (req);
|
||||
}
|
||||
}
|
||||
|
||||
for (guint i = 0; i < gi_interface_info_get_n_methods (info); i++)
|
||||
@ -1241,8 +1241,8 @@ write_interface_info (const gchar *ns,
|
||||
|
||||
static void
|
||||
write_union_info (const gchar *ns,
|
||||
GIUnionInfo *info,
|
||||
Xml *file)
|
||||
GIUnionInfo *info,
|
||||
Xml *file)
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *type_name;
|
||||
@ -1302,7 +1302,7 @@ write_union_info (const gchar *ns,
|
||||
write_field_info (ns, field, constant, file);
|
||||
gi_base_info_unref ((GIBaseInfo *)field);
|
||||
if (constant)
|
||||
gi_base_info_unref ((GIBaseInfo *)constant);
|
||||
gi_base_info_unref ((GIBaseInfo *)constant);
|
||||
}
|
||||
|
||||
for (guint i = 0; i < gi_union_info_get_n_methods (info); i++)
|
||||
@ -1349,19 +1349,19 @@ gi_ir_writer_write (const char *filename,
|
||||
gchar *full_filename;
|
||||
|
||||
if (needs_prefix)
|
||||
full_filename = g_strdup_printf ("%s-%s", ns, filename);
|
||||
full_filename = g_strdup_printf ("%s-%s", ns, filename);
|
||||
else
|
||||
full_filename = g_strdup (filename);
|
||||
full_filename = g_strdup (filename);
|
||||
ofile = g_fopen (filename, "w");
|
||||
|
||||
if (ofile == NULL)
|
||||
{
|
||||
g_fprintf (stderr, "failed to open '%s': %s\n",
|
||||
full_filename, g_strerror (errno));
|
||||
g_free (full_filename);
|
||||
{
|
||||
g_fprintf (stderr, "failed to open '%s': %s\n",
|
||||
full_filename, g_strerror (errno));
|
||||
g_free (full_filename);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (full_filename);
|
||||
}
|
||||
@ -1371,21 +1371,21 @@ gi_ir_writer_write (const char *filename,
|
||||
xml_printf (xml, "<?xml version=\"1.0\"?>\n");
|
||||
xml_start_element (xml, "repository");
|
||||
xml_printf (xml, " version=\"1.0\"\n"
|
||||
" xmlns=\"http://www.gtk.org/introspection/core/1.0\"\n"
|
||||
" xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"\n"
|
||||
" xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\"");
|
||||
" xmlns=\"http://www.gtk.org/introspection/core/1.0\"\n"
|
||||
" xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"\n"
|
||||
" xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\"");
|
||||
|
||||
dependencies = gi_repository_get_immediate_dependencies (repository, ns);
|
||||
if (dependencies != NULL)
|
||||
{
|
||||
for (i = 0; dependencies[i]; i++)
|
||||
{
|
||||
char **parts = g_strsplit (dependencies[i], "-", 2);
|
||||
xml_start_element (xml, "include");
|
||||
xml_printf (xml, " name=\"%s\" version=\"%s\"", parts[0], parts[1]);
|
||||
xml_end_element (xml, "include");
|
||||
g_strfreev (parts);
|
||||
}
|
||||
{
|
||||
char **parts = g_strsplit (dependencies[i], "-", 2);
|
||||
xml_start_element (xml, "include");
|
||||
xml_printf (xml, " name=\"%s\" version=\"%s\"", parts[0], parts[1]);
|
||||
xml_end_element (xml, "include");
|
||||
g_strfreev (parts);
|
||||
}
|
||||
}
|
||||
|
||||
if (TRUE)
|
||||
@ -1413,50 +1413,50 @@ gi_ir_writer_write (const char *filename,
|
||||
|
||||
n_infos = gi_repository_get_n_infos (repository, cur_ns);
|
||||
for (j = 0; j < n_infos; j++)
|
||||
{
|
||||
GIBaseInfo *info = gi_repository_get_info (repository, cur_ns, j);
|
||||
switch (gi_base_info_get_info_type (info))
|
||||
{
|
||||
case GI_INFO_TYPE_FUNCTION:
|
||||
write_function_info (ns, (GIFunctionInfo *)info, xml);
|
||||
break;
|
||||
{
|
||||
GIBaseInfo *info = gi_repository_get_info (repository, cur_ns, j);
|
||||
switch (gi_base_info_get_info_type (info))
|
||||
{
|
||||
case GI_INFO_TYPE_FUNCTION:
|
||||
write_function_info (ns, (GIFunctionInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_CALLBACK:
|
||||
write_callback_info (ns, (GICallbackInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_CALLBACK:
|
||||
write_callback_info (ns, (GICallbackInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_STRUCT:
|
||||
case GI_INFO_TYPE_BOXED:
|
||||
write_struct_info (ns, (GIStructInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_STRUCT:
|
||||
case GI_INFO_TYPE_BOXED:
|
||||
write_struct_info (ns, (GIStructInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_UNION:
|
||||
write_union_info (ns, (GIUnionInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_UNION:
|
||||
write_union_info (ns, (GIUnionInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_ENUM:
|
||||
case GI_INFO_TYPE_FLAGS:
|
||||
write_enum_info (ns, (GIEnumInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_ENUM:
|
||||
case GI_INFO_TYPE_FLAGS:
|
||||
write_enum_info (ns, (GIEnumInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_CONSTANT:
|
||||
write_constant_info (ns, (GIConstantInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_CONSTANT:
|
||||
write_constant_info (ns, (GIConstantInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
write_object_info (ns, (GIObjectInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_OBJECT:
|
||||
write_object_info (ns, (GIObjectInfo *)info, xml);
|
||||
break;
|
||||
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
write_interface_info (ns, (GIInterfaceInfo *)info, xml);
|
||||
break;
|
||||
case GI_INFO_TYPE_INTERFACE:
|
||||
write_interface_info (ns, (GIInterfaceInfo *)info, xml);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_error ("unknown info type %d", gi_base_info_get_info_type (info));
|
||||
}
|
||||
default:
|
||||
g_error ("unknown info type %d", gi_base_info_get_info_type (info));
|
||||
}
|
||||
|
||||
gi_base_info_unref (info);
|
||||
}
|
||||
gi_base_info_unref (info);
|
||||
}
|
||||
|
||||
xml_end_element (xml, "namespace");
|
||||
}
|
||||
|
@ -257,10 +257,10 @@ gi_type_info_get_array_length_index (GITypeInfo *info)
|
||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
||||
{
|
||||
if (blob->has_length)
|
||||
return blob->dimensions.length;
|
||||
}
|
||||
{
|
||||
if (blob->has_length)
|
||||
return blob->dimensions.length;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -293,10 +293,10 @@ gi_type_info_get_array_fixed_size (GITypeInfo *info)
|
||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
||||
{
|
||||
if (blob->has_size)
|
||||
return blob->dimensions.size;
|
||||
}
|
||||
{
|
||||
if (blob->has_size)
|
||||
return blob->dimensions.size;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -329,7 +329,7 @@ gi_type_info_is_zero_terminated (GITypeInfo *info)
|
||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
||||
return blob->zero_terminated;
|
||||
return blob->zero_terminated;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -735,12 +735,12 @@ typedef struct {
|
||||
* Since: 2.80
|
||||
*/
|
||||
typedef struct {
|
||||
guint8 pointer :1;
|
||||
guint8 reserved :2;
|
||||
guint8 tag :5;
|
||||
guint8 pointer :1;
|
||||
guint8 reserved :2;
|
||||
guint8 tag :5;
|
||||
|
||||
guint8 reserved2;
|
||||
guint16 n_types;
|
||||
guint8 reserved2;
|
||||
guint16 n_types;
|
||||
|
||||
SimpleTypeBlob type[];
|
||||
} ParamTypeBlob;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -213,9 +213,9 @@ gi_union_info_get_discriminator (GIUnionInfo *info,
|
||||
gint offset;
|
||||
|
||||
offset = rinfo->offset + header->union_blob_size
|
||||
+ blob->n_fields * header->field_blob_size
|
||||
+ blob->n_functions * header->function_blob_size
|
||||
+ n * header->constant_blob_size;
|
||||
+ blob->n_fields * header->field_blob_size
|
||||
+ blob->n_functions * header->function_blob_size
|
||||
+ n * header->constant_blob_size;
|
||||
|
||||
return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
|
||||
rinfo->typelib, offset);
|
||||
|
@ -72,7 +72,7 @@ GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info,
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info,
|
||||
const gchar *name);
|
||||
const gchar *name);
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
gsize gi_union_info_get_size (GIUnionInfo *info);
|
||||
|
@ -39,7 +39,7 @@ G_BEGIN_DECLS
|
||||
*
|
||||
* Since: 2.80
|
||||
*/
|
||||
#define GI_IS_UNRESOLVED_INFO(info) \
|
||||
#define GI_IS_UNRESOLVED_INFO(info) \
|
||||
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNRESOLVED)
|
||||
|
||||
G_END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user