mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-28 13:12:10 +01:00
girepository/ginfo.c
2008-02-21 Mark Doffman <mark.doffman@codethink.co.uk> * girepository/ginfo.c Add the ability to get the value of a constant of type TYPE_TAG_SYMBOL. In the case of a symbol the value is provided as a string. This would deal properly with: typedef char* random; const random = "A string"; WARNING: This commit does not compile. It is a partial change. svn path=/trunk/; revision=133
This commit is contained in:
parent
4ab667b160
commit
7cd41630af
34
ginfo.c
34
ginfo.c
@ -862,7 +862,10 @@ g_error_domain_info_get_codes (GIErrorDomainInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
ErrorDomainBlob *blob = (ErrorDomainBlob *)&base->metadata->data[base->offset];
|
ErrorDomainBlob *blob = (ErrorDomainBlob *)&base->metadata->data[base->offset];
|
||||||
|
|
||||||
return (GIInterfaceInfo *) g_info_from_entry (base->metadata,
|
/* FIXME need to check if blob really is an enum */
|
||||||
|
return (GIInterfaceInfo *) g_info_new (BLOB_TYPE_ENUM,
|
||||||
|
NULL,
|
||||||
|
base->metadata,
|
||||||
blob->error_codes);
|
blob->error_codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,9 +1117,11 @@ g_object_info_get_interface (GIObjectInfo *info,
|
|||||||
{
|
{
|
||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&base->metadata->data[base->offset];
|
ObjectBlob *blob = (ObjectBlob *)&base->metadata->data[base->offset];
|
||||||
|
guint16 *interface;
|
||||||
|
|
||||||
return (GIInterfaceInfo *) g_info_from_entry (base->metadata,
|
interface = (guint16 *)&base->metadata->data[base->offset + sizeof(ObjectBlob)];
|
||||||
blob->interfaces[n]);
|
|
||||||
|
return (GIInterfaceInfo *) g_info_from_entry (base->metadata, interface[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
@ -1324,8 +1329,11 @@ g_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
|||||||
{
|
{
|
||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&base->metadata->data[base->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&base->metadata->data[base->offset];
|
||||||
|
guint16 *prerequisite;
|
||||||
|
|
||||||
return g_info_from_entry (base->metadata, blob->prerequisites[n]);
|
prerequisite = (guint16 *)&base->metadata->data[base->offset + sizeof(InterfaceBlob)];
|
||||||
|
|
||||||
|
return g_info_from_entry (base->metadata, prerequisite[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1639,15 +1647,11 @@ g_constant_info_get_value (GIConstantInfo *info,
|
|||||||
{
|
{
|
||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
ConstantBlob *blob = (ConstantBlob *)&base->metadata->data[base->offset];
|
ConstantBlob *blob = (ConstantBlob *)&base->metadata->data[base->offset];
|
||||||
|
TypeHeader *header = (TypeHeader*) &blob->type;
|
||||||
|
|
||||||
/* FIXME non-basic types ? */
|
if (TYPE_IS_SIMPLE (header->tag))
|
||||||
if (blob->type.reserved == 0)
|
|
||||||
{
|
{
|
||||||
if (blob->type.pointer)
|
switch (header->tag)
|
||||||
value->v_pointer = g_memdup (&base->metadata->data[blob->offset], blob->size);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (blob->type.tag)
|
|
||||||
{
|
{
|
||||||
case GI_TYPE_TAG_BOOLEAN:
|
case GI_TYPE_TAG_BOOLEAN:
|
||||||
value->v_boolean = *(gboolean*)&base->metadata->data[blob->offset];
|
value->v_boolean = *(gboolean*)&base->metadata->data[blob->offset];
|
||||||
@ -1696,6 +1700,14 @@ g_constant_info_get_value (GIConstantInfo *info,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (header->tag)
|
||||||
|
{
|
||||||
|
case GI_TYPE_TAG_SYMBOL:
|
||||||
|
value->v_string = *(gchar**)&base->metadata->data[blob->offset];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return blob->size;
|
return blob->size;
|
||||||
|
14
gmetadata.h
14
gmetadata.h
@ -174,7 +174,9 @@ typedef struct
|
|||||||
|
|
||||||
guint16 n_arguments;
|
guint16 n_arguments;
|
||||||
|
|
||||||
|
#if 0
|
||||||
ArgBlob arguments[];
|
ArgBlob arguments[];
|
||||||
|
#endif
|
||||||
} SignatureBlob;
|
} SignatureBlob;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -233,8 +235,9 @@ typedef struct
|
|||||||
|
|
||||||
guint8 reserved2;
|
guint8 reserved2;
|
||||||
guint16 n_types;
|
guint16 n_types;
|
||||||
|
#if 0
|
||||||
SimpleTypeBlob type[];
|
SimpleTypeBlob type[];
|
||||||
|
#endif
|
||||||
} ParamTypeBlob;
|
} ParamTypeBlob;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -243,7 +246,9 @@ typedef struct
|
|||||||
|
|
||||||
guint16 n_domains;
|
guint16 n_domains;
|
||||||
|
|
||||||
|
#if 0
|
||||||
guint16 domains[];
|
guint16 domains[];
|
||||||
|
#endif
|
||||||
} ErrorTypeBlob;
|
} ErrorTypeBlob;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -357,7 +362,9 @@ typedef struct
|
|||||||
guint16 n_values;
|
guint16 n_values;
|
||||||
guint16 reserved2;
|
guint16 reserved2;
|
||||||
|
|
||||||
|
#if 0
|
||||||
ValueBlob values[];
|
ValueBlob values[];
|
||||||
|
#endif
|
||||||
} EnumBlob;
|
} EnumBlob;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -432,10 +439,9 @@ typedef struct
|
|||||||
guint16 n_vfuncs;
|
guint16 n_vfuncs;
|
||||||
guint16 n_constants;
|
guint16 n_constants;
|
||||||
|
|
||||||
guint16 interfaces[];
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* variable-length parts of the blob */
|
/* variable-length parts of the blob */
|
||||||
|
guint16 interfaces[];
|
||||||
FieldBlob fields[];
|
FieldBlob fields[];
|
||||||
PropertyBlob properties[];
|
PropertyBlob properties[];
|
||||||
FunctionBlob methods[];
|
FunctionBlob methods[];
|
||||||
@ -462,10 +468,10 @@ typedef struct
|
|||||||
guint16 n_vfuncs;
|
guint16 n_vfuncs;
|
||||||
guint16 n_constants;
|
guint16 n_constants;
|
||||||
|
|
||||||
guint16 prerequisites[];
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* variable-length parts of the blob */
|
/* variable-length parts of the blob */
|
||||||
|
guint16 prerequisites[];
|
||||||
PropertyBlob properties[];
|
PropertyBlob properties[];
|
||||||
FunctionBlob methods[];
|
FunctionBlob methods[];
|
||||||
SignalBlob signals[];
|
SignalBlob signals[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user