mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
tools/gidlnode.c
2008-06-08 Philip Van Hoof <pvanhoof@gnome.org> * girepository/girepository.c: * girepository/gtypelib.c: * girepository/ginfo.c: * girepository/ginvoke.c: * girepository/girepository.h: * girepository/gtypelib.h: * girepository/gmetadata.c: * girepository/Makefile.am: * girepository/gmetadata.h: * tools/compiler.c: * tools/gidlmodule.c: * tools/gidlnode.c * tools/generate.c: * tools/gidlmodule.h: * tools/gidlparser.c: Renamed GMetadata to GTypelib svn path=/trunk/; revision=288
This commit is contained in:
committed by
Philip Van Hoof
parent
df21818925
commit
776ee5f79e
@@ -8,8 +8,8 @@ noinst_LTLIBRARIES = libgirepository.la
|
|||||||
|
|
||||||
libgirepository_la_SOURCES = \
|
libgirepository_la_SOURCES = \
|
||||||
girepository.c \
|
girepository.c \
|
||||||
gmetadata.h \
|
gtypelib.h \
|
||||||
gmetadata.c \
|
gtypelib.c \
|
||||||
ginfo.c \
|
ginfo.c \
|
||||||
ginvoke.c
|
ginvoke.c
|
||||||
libgirepository_la_CPPFLAGS = $(GIREPO_CFLAGS)
|
libgirepository_la_CPPFLAGS = $(GIREPO_CFLAGS)
|
||||||
|
50
ginfo.c
50
ginfo.c
@@ -24,7 +24,7 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "girepository.h"
|
#include "girepository.h"
|
||||||
#include "gmetadata.h"
|
#include "gtypelib.h"
|
||||||
|
|
||||||
struct _GIBaseInfo
|
struct _GIBaseInfo
|
||||||
{
|
{
|
||||||
@@ -32,7 +32,7 @@ struct _GIBaseInfo
|
|||||||
gint ref_count;
|
gint ref_count;
|
||||||
GIBaseInfo *container;
|
GIBaseInfo *container;
|
||||||
|
|
||||||
GMetadata *metadata;
|
GTypelib *metadata;
|
||||||
guint32 offset;
|
guint32 offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ struct _GIUnionInfo
|
|||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
g_info_new (GIInfoType type,
|
g_info_new (GIInfoType type,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GMetadata *metadata,
|
GTypelib *metadata,
|
||||||
guint32 offset)
|
guint32 offset)
|
||||||
{
|
{
|
||||||
GIBaseInfo *info;
|
GIBaseInfo *info;
|
||||||
@@ -156,18 +156,18 @@ g_info_new (GIInfoType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GIBaseInfo *
|
static GIBaseInfo *
|
||||||
g_info_from_entry (GMetadata *metadata,
|
g_info_from_entry (GTypelib *metadata,
|
||||||
guint16 index)
|
guint16 index)
|
||||||
{
|
{
|
||||||
GIBaseInfo *result;
|
GIBaseInfo *result;
|
||||||
DirEntry *entry = g_metadata_get_dir_entry (metadata, index);
|
DirEntry *entry = g_typelib_get_dir_entry (metadata, index);
|
||||||
|
|
||||||
if (entry->local)
|
if (entry->local)
|
||||||
result = g_info_new (entry->blob_type, NULL, metadata, entry->offset);
|
result = g_info_new (entry->blob_type, NULL, metadata, entry->offset);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const gchar *namespace = g_metadata_get_string (metadata, entry->offset);
|
const gchar *namespace = g_typelib_get_string (metadata, entry->offset);
|
||||||
const gchar *name = g_metadata_get_string (metadata, entry->name);
|
const gchar *name = g_typelib_get_string (metadata, entry->name);
|
||||||
|
|
||||||
GIRepository *repository = g_irepository_get_default ();
|
GIRepository *repository = g_irepository_get_default ();
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
CommonBlob *blob = (CommonBlob *)&info->metadata->data[info->offset];
|
CommonBlob *blob = (CommonBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
ValueBlob *blob = (ValueBlob *)&info->metadata->data[info->offset];
|
ValueBlob *blob = (ValueBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
SignalBlob *blob = (SignalBlob *)&info->metadata->data[info->offset];
|
SignalBlob *blob = (SignalBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
PropertyBlob *blob = (PropertyBlob *)&info->metadata->data[info->offset];
|
PropertyBlob *blob = (PropertyBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
VFuncBlob *blob = (VFuncBlob *)&info->metadata->data[info->offset];
|
VFuncBlob *blob = (VFuncBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
FieldBlob *blob = (FieldBlob *)&info->metadata->data[info->offset];
|
FieldBlob *blob = (FieldBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -288,7 +288,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
{
|
{
|
||||||
ArgBlob *blob = (ArgBlob *)&info->metadata->data[info->offset];
|
ArgBlob *blob = (ArgBlob *)&info->metadata->data[info->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, blob->name);
|
return g_typelib_get_string (info->metadata, blob->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ g_base_info_get_namespace (GIBaseInfo *info)
|
|||||||
return unresolved->namespace;
|
return unresolved->namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_metadata_get_string (info->metadata, header->namespace);
|
return g_typelib_get_string (info->metadata, header->namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -430,9 +430,9 @@ g_base_info_get_annotation (GIBaseInfo *info,
|
|||||||
{
|
{
|
||||||
res = next;
|
res = next;
|
||||||
|
|
||||||
rname = g_metadata_get_string (base->metadata, res->name);
|
rname = g_typelib_get_string (base->metadata, res->name);
|
||||||
if (strcmp (name, rname) == 0)
|
if (strcmp (name, rname) == 0)
|
||||||
return g_metadata_get_string (base->metadata, res->value);
|
return g_typelib_get_string (base->metadata, res->value);
|
||||||
|
|
||||||
next = res += header->annotation_blob_size;
|
next = res += header->annotation_blob_size;
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ g_base_info_get_container (GIBaseInfo *info)
|
|||||||
return info->container;
|
return info->container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GMetadata *
|
GTypelib *
|
||||||
g_base_info_get_metadata (GIBaseInfo *info)
|
g_base_info_get_metadata (GIBaseInfo *info)
|
||||||
{
|
{
|
||||||
return info->metadata;
|
return info->metadata;
|
||||||
@@ -460,7 +460,7 @@ g_function_info_get_symbol (GIFunctionInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
FunctionBlob *blob = (FunctionBlob *)&base->metadata->data[base->offset];
|
FunctionBlob *blob = (FunctionBlob *)&base->metadata->data[base->offset];
|
||||||
|
|
||||||
return g_metadata_get_string (base->metadata, blob->symbol);
|
return g_typelib_get_string (base->metadata, blob->symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIFunctionInfoFlags
|
GIFunctionInfoFlags
|
||||||
@@ -530,7 +530,7 @@ signature_offset (GICallableInfo *info)
|
|||||||
|
|
||||||
GITypeInfo *
|
GITypeInfo *
|
||||||
g_type_info_new (GIBaseInfo *container,
|
g_type_info_new (GIBaseInfo *container,
|
||||||
GMetadata *metadata,
|
GTypelib *metadata,
|
||||||
guint32 offset)
|
guint32 offset)
|
||||||
{
|
{
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&metadata->data[offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&metadata->data[offset];
|
||||||
@@ -874,7 +874,7 @@ g_error_domain_info_get_quark (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 g_metadata_get_string (base->metadata, blob->get_quark);
|
return g_typelib_get_string (base->metadata, blob->get_quark);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIInterfaceInfo *
|
GIInterfaceInfo *
|
||||||
@@ -951,7 +951,7 @@ g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
|
|||||||
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&base->metadata->data[base->offset];
|
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&base->metadata->data[base->offset];
|
||||||
|
|
||||||
if (blob->gtype_name)
|
if (blob->gtype_name)
|
||||||
return g_metadata_get_string (base->metadata, blob->gtype_name);
|
return g_typelib_get_string (base->metadata, blob->gtype_name);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -963,7 +963,7 @@ g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info)
|
|||||||
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&base->metadata->data[base->offset];
|
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&base->metadata->data[base->offset];
|
||||||
|
|
||||||
if (blob->gtype_init)
|
if (blob->gtype_init)
|
||||||
return g_metadata_get_string (base->metadata, blob->gtype_init);
|
return g_typelib_get_string (base->metadata, blob->gtype_init);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1116,7 +1116,7 @@ g_object_info_get_type_name (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];
|
||||||
|
|
||||||
return g_metadata_get_string (base->metadata, blob->gtype_name);
|
return g_typelib_get_string (base->metadata, blob->gtype_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
@@ -1125,7 +1125,7 @@ g_object_info_get_type_init (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];
|
||||||
|
|
||||||
return g_metadata_get_string (base->metadata, blob->gtype_init);
|
return g_typelib_get_string (base->metadata, blob->gtype_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "girepository.h"
|
#include "girepository.h"
|
||||||
#include "gmetadata.h"
|
#include "gtypelib.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
#include "girepository.h"
|
#include "girepository.h"
|
||||||
#include "gmetadata.h"
|
#include "gtypelib.h"
|
||||||
|
|
||||||
static GIRepository *default_repository = NULL;
|
static GIRepository *default_repository = NULL;
|
||||||
static GHashTable *default_metadata = NULL;
|
static GHashTable *default_metadata = NULL;
|
||||||
@@ -34,7 +34,7 @@ static GSList *search_path = NULL;
|
|||||||
|
|
||||||
struct _GIRepositoryPrivate
|
struct _GIRepositoryPrivate
|
||||||
{
|
{
|
||||||
GHashTable *metadata; /* (string) namespace -> GMetadata */
|
GHashTable *metadata; /* (string) namespace -> GTypelib */
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
|
||||||
@@ -70,7 +70,7 @@ g_irepository_class_init (GIRepositoryClass *class)
|
|||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
g_irepository_register (GIRepository *repository,
|
g_irepository_register (GIRepository *repository,
|
||||||
GMetadata *metadata)
|
GTypelib *metadata)
|
||||||
{
|
{
|
||||||
Header *header;
|
Header *header;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
@@ -88,7 +88,7 @@ g_irepository_register (GIRepository *repository,
|
|||||||
if (repository->priv->metadata == NULL)
|
if (repository->priv->metadata == NULL)
|
||||||
repository->priv->metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
|
repository->priv->metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
(GDestroyNotify) NULL,
|
(GDestroyNotify) NULL,
|
||||||
(GDestroyNotify) g_metadata_free);
|
(GDestroyNotify) g_typelib_free);
|
||||||
table = repository->priv->metadata;
|
table = repository->priv->metadata;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -96,11 +96,11 @@ g_irepository_register (GIRepository *repository,
|
|||||||
if (default_metadata == NULL)
|
if (default_metadata == NULL)
|
||||||
default_metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
|
default_metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
(GDestroyNotify) NULL,
|
(GDestroyNotify) NULL,
|
||||||
(GDestroyNotify) g_metadata_free);
|
(GDestroyNotify) g_typelib_free);
|
||||||
table = default_metadata;
|
table = default_metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = g_metadata_get_string (metadata, header->namespace);
|
name = g_typelib_get_string (metadata, header->namespace);
|
||||||
|
|
||||||
if (g_hash_table_lookup (table, name))
|
if (g_hash_table_lookup (table, name))
|
||||||
{
|
{
|
||||||
@@ -158,7 +158,7 @@ g_irepository_get_default (void)
|
|||||||
if (default_metadata == NULL)
|
if (default_metadata == NULL)
|
||||||
default_metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
|
default_metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
(GDestroyNotify) NULL,
|
(GDestroyNotify) NULL,
|
||||||
(GDestroyNotify) g_metadata_free);
|
(GDestroyNotify) g_typelib_free);
|
||||||
default_repository->priv->metadata = default_metadata;
|
default_repository->priv->metadata = default_metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ count_interfaces (gpointer key,
|
|||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
guchar *metadata = ((GMetadata *) value)->data;
|
guchar *metadata = ((GTypelib *) value)->data;
|
||||||
gint *n_interfaces = (gint *)data;
|
gint *n_interfaces = (gint *)data;
|
||||||
|
|
||||||
*n_interfaces += ((Header *)metadata)->n_local_entries;
|
*n_interfaces += ((Header *)metadata)->n_local_entries;
|
||||||
@@ -184,7 +184,7 @@ g_irepository_get_n_infos (GIRepository *repository,
|
|||||||
|
|
||||||
if (namespace)
|
if (namespace)
|
||||||
{
|
{
|
||||||
GMetadata *metadata;
|
GTypelib *metadata;
|
||||||
|
|
||||||
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ find_interface (gpointer key,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
GMetadata *metadata = (GMetadata *)value;
|
GTypelib *metadata = (GTypelib *)value;
|
||||||
IfaceData *iface_data = (IfaceData *)data;
|
IfaceData *iface_data = (IfaceData *)data;
|
||||||
gint index;
|
gint index;
|
||||||
gint n_entries;
|
gint n_entries;
|
||||||
@@ -230,8 +230,8 @@ find_interface (gpointer key,
|
|||||||
{
|
{
|
||||||
for (i = 1; i <= n_entries; i++)
|
for (i = 1; i <= n_entries; i++)
|
||||||
{
|
{
|
||||||
entry = g_metadata_get_dir_entry (metadata, i);
|
entry = g_typelib_get_dir_entry (metadata, i);
|
||||||
name = g_metadata_get_string (metadata, entry->name);
|
name = g_typelib_get_string (metadata, entry->name);
|
||||||
if (strcmp (name, iface_data->name) == 0)
|
if (strcmp (name, iface_data->name) == 0)
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
@@ -243,12 +243,12 @@ find_interface (gpointer key,
|
|||||||
{
|
{
|
||||||
for (i = 1; i <= n_entries; i++)
|
for (i = 1; i <= n_entries; i++)
|
||||||
{
|
{
|
||||||
entry = g_metadata_get_dir_entry (metadata, i);
|
entry = g_typelib_get_dir_entry (metadata, i);
|
||||||
if (entry->blob_type < 4)
|
if (entry->blob_type < 4)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
offset = *(guint32*)&metadata->data[entry->offset + 8];
|
offset = *(guint32*)&metadata->data[entry->offset + 8];
|
||||||
type = g_metadata_get_string (metadata, offset);
|
type = g_typelib_get_string (metadata, offset);
|
||||||
if (strcmp (type, iface_data->type) == 0)
|
if (strcmp (type, iface_data->type) == 0)
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
@@ -266,7 +266,7 @@ find_interface (gpointer key,
|
|||||||
|
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
{
|
{
|
||||||
entry = g_metadata_get_dir_entry (metadata, index);
|
entry = g_typelib_get_dir_entry (metadata, index);
|
||||||
iface_data->iface = g_info_new (entry->blob_type, NULL,
|
iface_data->iface = g_info_new (entry->blob_type, NULL,
|
||||||
metadata, entry->offset);
|
metadata, entry->offset);
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ g_irepository_get_info (GIRepository *repository,
|
|||||||
|
|
||||||
if (namespace)
|
if (namespace)
|
||||||
{
|
{
|
||||||
GMetadata *metadata;
|
GTypelib *metadata;
|
||||||
|
|
||||||
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ g_irepository_find_by_name (GIRepository *repository,
|
|||||||
|
|
||||||
if (namespace)
|
if (namespace)
|
||||||
{
|
{
|
||||||
GMetadata *metadata;
|
GTypelib *metadata;
|
||||||
|
|
||||||
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ const gchar *
|
|||||||
g_irepository_get_shared_library (GIRepository *repository,
|
g_irepository_get_shared_library (GIRepository *repository,
|
||||||
const gchar *namespace)
|
const gchar *namespace)
|
||||||
{
|
{
|
||||||
GMetadata *metadata;
|
GTypelib *metadata;
|
||||||
Header *header;
|
Header *header;
|
||||||
|
|
||||||
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
|
||||||
@@ -382,7 +382,7 @@ g_irepository_get_shared_library (GIRepository *repository,
|
|||||||
return NULL;
|
return NULL;
|
||||||
header = (Header *) metadata->data;
|
header = (Header *) metadata->data;
|
||||||
if (header->shared_library)
|
if (header->shared_library)
|
||||||
return g_metadata_get_string (metadata, header->shared_library);
|
return g_typelib_get_string (metadata, header->shared_library);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ g_irepository_register_file (GIRepository *repository,
|
|||||||
gchar *fname, *full_path;
|
gchar *fname, *full_path;
|
||||||
GMappedFile *mfile;
|
GMappedFile *mfile;
|
||||||
GError *error1 = NULL;
|
GError *error1 = NULL;
|
||||||
GMetadata *metadata = NULL;
|
GTypelib *metadata = NULL;
|
||||||
const gchar *metadata_namespace, *shlib_fname;
|
const gchar *metadata_namespace, *shlib_fname;
|
||||||
GModule *module;
|
GModule *module;
|
||||||
guint32 shlib;
|
guint32 shlib;
|
||||||
@@ -449,8 +449,8 @@ g_irepository_register_file (GIRepository *repository,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
g_free (full_path);
|
g_free (full_path);
|
||||||
metadata = g_metadata_new_from_mapped_file (mfile);
|
metadata = g_typelib_new_from_mapped_file (mfile);
|
||||||
metadata_namespace = g_metadata_get_string (metadata, ((Header *) metadata->data)->namespace);
|
metadata_namespace = g_typelib_get_string (metadata, ((Header *) metadata->data)->namespace);
|
||||||
if (strcmp (metadata_namespace, namespace) != 0) {
|
if (strcmp (metadata_namespace, namespace) != 0) {
|
||||||
g_set_error (error, G_IREPOSITORY_ERROR,
|
g_set_error (error, G_IREPOSITORY_ERROR,
|
||||||
G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
||||||
@@ -472,7 +472,7 @@ g_irepository_register_file (GIRepository *repository,
|
|||||||
/* optionally load shared library and attach it to the metadata */
|
/* optionally load shared library and attach it to the metadata */
|
||||||
shlib = ((Header *) metadata->data)->shared_library;
|
shlib = ((Header *) metadata->data)->shared_library;
|
||||||
if (shlib) {
|
if (shlib) {
|
||||||
shlib_fname = g_metadata_get_string (metadata, shlib);
|
shlib_fname = g_typelib_get_string (metadata, shlib);
|
||||||
module = g_module_open (shlib_fname, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL);
|
module = g_module_open (shlib_fname, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL);
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
g_set_error (error, G_IREPOSITORY_ERROR,
|
g_set_error (error, G_IREPOSITORY_ERROR,
|
||||||
|
@@ -52,7 +52,7 @@ typedef struct _GIArgInfo GIArgInfo;
|
|||||||
typedef struct _GITypeInfo GITypeInfo;
|
typedef struct _GITypeInfo GITypeInfo;
|
||||||
typedef struct _GIErrorDomainInfo GIErrorDomainInfo;
|
typedef struct _GIErrorDomainInfo GIErrorDomainInfo;
|
||||||
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
||||||
typedef struct _GMetadata GMetadata;
|
typedef struct _GTypelib GTypelib;
|
||||||
|
|
||||||
struct _GIRepository
|
struct _GIRepository
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ struct _GIRepositoryClass
|
|||||||
GType g_irepository_get_type (void) G_GNUC_CONST;
|
GType g_irepository_get_type (void) G_GNUC_CONST;
|
||||||
GIRepository *g_irepository_get_default (void);
|
GIRepository *g_irepository_get_default (void);
|
||||||
const gchar * g_irepository_register (GIRepository *repository,
|
const gchar * g_irepository_register (GIRepository *repository,
|
||||||
GMetadata *metadata);
|
GTypelib *metadata);
|
||||||
void g_irepository_unregister (GIRepository *repository,
|
void g_irepository_unregister (GIRepository *repository,
|
||||||
const gchar *namespace);
|
const gchar *namespace);
|
||||||
const gchar * g_irepository_register_file (GIRepository *repository,
|
const gchar * g_irepository_register_file (GIRepository *repository,
|
||||||
@@ -96,15 +96,15 @@ const gchar * g_irepository_get_shared_library (GIRepository *repository,
|
|||||||
const gchar *namespace);
|
const gchar *namespace);
|
||||||
/* Metadata */
|
/* Metadata */
|
||||||
|
|
||||||
GMetadata * g_metadata_new_from_memory (guchar *memory,
|
GTypelib * g_typelib_new_from_memory (guchar *memory,
|
||||||
gsize len);
|
gsize len);
|
||||||
GMetadata * g_metadata_new_from_const_memory (const guchar *memory,
|
GTypelib * g_typelib_new_from_const_memory (const guchar *memory,
|
||||||
gsize len);
|
gsize len);
|
||||||
GMetadata * g_metadata_new_from_mapped_file (GMappedFile *mfile);
|
GTypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile);
|
||||||
void g_metadata_free (GMetadata *metadata);
|
void g_typelib_free (GTypelib *metadata);
|
||||||
void g_metadata_set_module (GMetadata *metadata,
|
void g_typelib_set_module (GTypelib *metadata,
|
||||||
GModule *module);
|
GModule *module);
|
||||||
const gchar * g_metadata_get_namespace (GMetadata *metadata);
|
const gchar * g_typelib_get_namespace (GTypelib *metadata);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -156,11 +156,11 @@ gboolean g_base_info_is_deprecated (GIBaseInfo *info);
|
|||||||
const gchar * g_base_info_get_annotation (GIBaseInfo *info,
|
const gchar * g_base_info_get_annotation (GIBaseInfo *info,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
|
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
|
||||||
GMetadata * g_base_info_get_metadata (GIBaseInfo *info);
|
GTypelib * g_base_info_get_metadata (GIBaseInfo *info);
|
||||||
|
|
||||||
GIBaseInfo * g_info_new (GIInfoType type,
|
GIBaseInfo * g_info_new (GIInfoType type,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GMetadata *metadata,
|
GTypelib *metadata,
|
||||||
guint32 offset);
|
guint32 offset);
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __G_METADATA_H__
|
#ifndef __G_TYPELIB_H__
|
||||||
#define __G_METADATA_H__
|
#define __G_TYPELIB_H__
|
||||||
|
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
#include "girepository.h"
|
#include "girepository.h"
|
||||||
@@ -510,7 +510,7 @@ typedef struct
|
|||||||
} AnnotationBlob;
|
} AnnotationBlob;
|
||||||
|
|
||||||
|
|
||||||
struct _GMetadata {
|
struct _GTypelib {
|
||||||
guchar *data;
|
guchar *data;
|
||||||
gsize len;
|
gsize len;
|
||||||
gboolean owns_memory;
|
gboolean owns_memory;
|
||||||
@@ -518,32 +518,32 @@ struct _GMetadata {
|
|||||||
GModule *module;
|
GModule *module;
|
||||||
};
|
};
|
||||||
|
|
||||||
DirEntry *g_metadata_get_dir_entry (GMetadata *metadata,
|
DirEntry *g_typelib_get_dir_entry (GTypelib *metadata,
|
||||||
guint16 index);
|
guint16 index);
|
||||||
|
|
||||||
void g_metadata_check_sanity (void);
|
void g_typelib_check_sanity (void);
|
||||||
|
|
||||||
#define g_metadata_get_string(metadata,offset) ((const gchar*)&(metadata->data)[(offset)])
|
#define g_typelib_get_string(metadata,offset) ((const gchar*)&(metadata->data)[(offset)])
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
G_METADATA_ERROR_INVALID,
|
G_TYPELIB_ERROR_INVALID,
|
||||||
G_METADATA_ERROR_INVALID_HEADER,
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
G_METADATA_ERROR_INVALID_DIRECTORY,
|
G_TYPELIB_ERROR_INVALID_DIRECTORY,
|
||||||
G_METADATA_ERROR_INVALID_ENTRY,
|
G_TYPELIB_ERROR_INVALID_ENTRY,
|
||||||
G_METADATA_ERROR_INVALID_BLOB
|
G_TYPELIB_ERROR_INVALID_BLOB
|
||||||
} GMetadataError;
|
} GTypelibError;
|
||||||
|
|
||||||
#define G_METADATA_ERROR (g_metadata_error_quark ())
|
#define G_TYPELIB_ERROR (g_typelib_error_quark ())
|
||||||
|
|
||||||
GQuark g_metadata_error_quark (void);
|
GQuark g_typelib_error_quark (void);
|
||||||
|
|
||||||
gboolean g_metadata_validate (GMetadata *metadata,
|
gboolean g_typelib_validate (GTypelib *metadata,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __G_METADATA_H__ */
|
#endif /* __G_TYPELIB_H__ */
|
||||||
|
|
Reference in New Issue
Block a user