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:
Philip Van Hoof 2008-06-08 14:37:30 +00:00 committed by Philip Van Hoof
parent df21818925
commit 776ee5f79e
7 changed files with 344 additions and 344 deletions

View File

@ -8,8 +8,8 @@ noinst_LTLIBRARIES = libgirepository.la
libgirepository_la_SOURCES = \
girepository.c \
gmetadata.h \
gmetadata.c \
gtypelib.h \
gtypelib.c \
ginfo.c \
ginvoke.c
libgirepository_la_CPPFLAGS = $(GIREPO_CFLAGS)

50
ginfo.c
View File

@ -24,7 +24,7 @@
#include <glib-object.h>
#include "girepository.h"
#include "gmetadata.h"
#include "gtypelib.h"
struct _GIBaseInfo
{
@ -32,7 +32,7 @@ struct _GIBaseInfo
gint ref_count;
GIBaseInfo *container;
GMetadata *metadata;
GTypelib *metadata;
guint32 offset;
};
@ -136,7 +136,7 @@ struct _GIUnionInfo
GIBaseInfo *
g_info_new (GIInfoType type,
GIBaseInfo *container,
GMetadata *metadata,
GTypelib *metadata,
guint32 offset)
{
GIBaseInfo *info;
@ -156,18 +156,18 @@ g_info_new (GIInfoType type,
}
static GIBaseInfo *
g_info_from_entry (GMetadata *metadata,
g_info_from_entry (GTypelib *metadata,
guint16 index)
{
GIBaseInfo *result;
DirEntry *entry = g_metadata_get_dir_entry (metadata, index);
DirEntry *entry = g_typelib_get_dir_entry (metadata, index);
if (entry->local)
result = g_info_new (entry->blob_type, NULL, metadata, entry->offset);
else
{
const gchar *namespace = g_metadata_get_string (metadata, entry->offset);
const gchar *name = g_metadata_get_string (metadata, entry->name);
const gchar *namespace = g_typelib_get_string (metadata, entry->offset);
const gchar *name = g_typelib_get_string (metadata, entry->name);
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];
return g_metadata_get_string (info->metadata, blob->name);
return g_typelib_get_string (info->metadata, blob->name);
}
break;
@ -248,7 +248,7 @@ g_base_info_get_name (GIBaseInfo *info)
{
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;
@ -256,7 +256,7 @@ g_base_info_get_name (GIBaseInfo *info)
{
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;
@ -264,7 +264,7 @@ g_base_info_get_name (GIBaseInfo *info)
{
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;
@ -272,7 +272,7 @@ g_base_info_get_name (GIBaseInfo *info)
{
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;
@ -280,7 +280,7 @@ g_base_info_get_name (GIBaseInfo *info)
{
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;
@ -288,7 +288,7 @@ g_base_info_get_name (GIBaseInfo *info)
{
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;
@ -320,7 +320,7 @@ g_base_info_get_namespace (GIBaseInfo *info)
return unresolved->namespace;
}
return g_metadata_get_string (info->metadata, header->namespace);
return g_typelib_get_string (info->metadata, header->namespace);
}
gboolean
@ -430,9 +430,9 @@ g_base_info_get_annotation (GIBaseInfo *info,
{
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)
return g_metadata_get_string (base->metadata, res->value);
return g_typelib_get_string (base->metadata, res->value);
next = res += header->annotation_blob_size;
}
@ -447,7 +447,7 @@ g_base_info_get_container (GIBaseInfo *info)
return info->container;
}
GMetadata *
GTypelib *
g_base_info_get_metadata (GIBaseInfo *info)
{
return info->metadata;
@ -460,7 +460,7 @@ g_function_info_get_symbol (GIFunctionInfo *info)
GIBaseInfo *base = (GIBaseInfo *)info;
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
@ -530,7 +530,7 @@ signature_offset (GICallableInfo *info)
GITypeInfo *
g_type_info_new (GIBaseInfo *container,
GMetadata *metadata,
GTypelib *metadata,
guint32 offset)
{
SimpleTypeBlob *type = (SimpleTypeBlob *)&metadata->data[offset];
@ -874,7 +874,7 @@ g_error_domain_info_get_quark (GIErrorDomainInfo *info)
GIBaseInfo *base = (GIBaseInfo *)info;
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 *
@ -951,7 +951,7 @@ g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&base->metadata->data[base->offset];
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;
}
@ -963,7 +963,7 @@ g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info)
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&base->metadata->data[base->offset];
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;
}
@ -1116,7 +1116,7 @@ g_object_info_get_type_name (GIObjectInfo *info)
GIBaseInfo *base = (GIBaseInfo *)info;
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 *
@ -1125,7 +1125,7 @@ g_object_info_get_type_init (GIObjectInfo *info)
GIBaseInfo *base = (GIBaseInfo *)info;
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

View File

@ -24,7 +24,7 @@
#include <glib-object.h>
#include "girepository.h"
#include "gmetadata.h"
#include "gtypelib.h"
#include "config.h"
GQuark

View File

@ -26,7 +26,7 @@
#include <glib/gprintf.h>
#include <gmodule.h>
#include "girepository.h"
#include "gmetadata.h"
#include "gtypelib.h"
static GIRepository *default_repository = NULL;
static GHashTable *default_metadata = NULL;
@ -34,7 +34,7 @@ static GSList *search_path = NULL;
struct _GIRepositoryPrivate
{
GHashTable *metadata; /* (string) namespace -> GMetadata */
GHashTable *metadata; /* (string) namespace -> GTypelib */
};
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
@ -70,7 +70,7 @@ g_irepository_class_init (GIRepositoryClass *class)
const gchar *
g_irepository_register (GIRepository *repository,
GMetadata *metadata)
GTypelib *metadata)
{
Header *header;
const gchar *name;
@ -88,7 +88,7 @@ g_irepository_register (GIRepository *repository,
if (repository->priv->metadata == NULL)
repository->priv->metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) g_metadata_free);
(GDestroyNotify) g_typelib_free);
table = repository->priv->metadata;
}
else
@ -96,11 +96,11 @@ g_irepository_register (GIRepository *repository,
if (default_metadata == NULL)
default_metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) g_metadata_free);
(GDestroyNotify) g_typelib_free);
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))
{
@ -158,7 +158,7 @@ g_irepository_get_default (void)
if (default_metadata == NULL)
default_metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) g_metadata_free);
(GDestroyNotify) g_typelib_free);
default_repository->priv->metadata = default_metadata;
}
@ -170,7 +170,7 @@ count_interfaces (gpointer key,
gpointer value,
gpointer data)
{
guchar *metadata = ((GMetadata *) value)->data;
guchar *metadata = ((GTypelib *) value)->data;
gint *n_interfaces = (gint *)data;
*n_interfaces += ((Header *)metadata)->n_local_entries;
@ -184,7 +184,7 @@ g_irepository_get_n_infos (GIRepository *repository,
if (namespace)
{
GMetadata *metadata;
GTypelib *metadata;
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
@ -214,7 +214,7 @@ find_interface (gpointer key,
gpointer data)
{
gint i;
GMetadata *metadata = (GMetadata *)value;
GTypelib *metadata = (GTypelib *)value;
IfaceData *iface_data = (IfaceData *)data;
gint index;
gint n_entries;
@ -230,8 +230,8 @@ find_interface (gpointer key,
{
for (i = 1; i <= n_entries; i++)
{
entry = g_metadata_get_dir_entry (metadata, i);
name = g_metadata_get_string (metadata, entry->name);
entry = g_typelib_get_dir_entry (metadata, i);
name = g_typelib_get_string (metadata, entry->name);
if (strcmp (name, iface_data->name) == 0)
{
index = i;
@ -243,12 +243,12 @@ find_interface (gpointer key,
{
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)
continue;
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)
{
index = i;
@ -266,7 +266,7 @@ find_interface (gpointer key,
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,
metadata, entry->offset);
}
@ -286,7 +286,7 @@ g_irepository_get_info (GIRepository *repository,
if (namespace)
{
GMetadata *metadata;
GTypelib *metadata;
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
@ -329,7 +329,7 @@ g_irepository_find_by_name (GIRepository *repository,
if (namespace)
{
GMetadata *metadata;
GTypelib *metadata;
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
@ -374,7 +374,7 @@ const gchar *
g_irepository_get_shared_library (GIRepository *repository,
const gchar *namespace)
{
GMetadata *metadata;
GTypelib *metadata;
Header *header;
metadata = g_hash_table_lookup (repository->priv->metadata, namespace);
@ -382,7 +382,7 @@ g_irepository_get_shared_library (GIRepository *repository,
return NULL;
header = (Header *) metadata->data;
if (header->shared_library)
return g_metadata_get_string (metadata, header->shared_library);
return g_typelib_get_string (metadata, header->shared_library);
else
return NULL;
}
@ -418,7 +418,7 @@ g_irepository_register_file (GIRepository *repository,
gchar *fname, *full_path;
GMappedFile *mfile;
GError *error1 = NULL;
GMetadata *metadata = NULL;
GTypelib *metadata = NULL;
const gchar *metadata_namespace, *shlib_fname;
GModule *module;
guint32 shlib;
@ -449,8 +449,8 @@ g_irepository_register_file (GIRepository *repository,
continue;
}
g_free (full_path);
metadata = g_metadata_new_from_mapped_file (mfile);
metadata_namespace = g_metadata_get_string (metadata, ((Header *) metadata->data)->namespace);
metadata = g_typelib_new_from_mapped_file (mfile);
metadata_namespace = g_typelib_get_string (metadata, ((Header *) metadata->data)->namespace);
if (strcmp (metadata_namespace, namespace) != 0) {
g_set_error (error, G_IREPOSITORY_ERROR,
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 */
shlib = ((Header *) metadata->data)->shared_library;
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);
if (module == NULL) {
g_set_error (error, G_IREPOSITORY_ERROR,

View File

@ -52,7 +52,7 @@ typedef struct _GIArgInfo GIArgInfo;
typedef struct _GITypeInfo GITypeInfo;
typedef struct _GIErrorDomainInfo GIErrorDomainInfo;
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
typedef struct _GMetadata GMetadata;
typedef struct _GTypelib GTypelib;
struct _GIRepository
{
@ -73,7 +73,7 @@ struct _GIRepositoryClass
GType g_irepository_get_type (void) G_GNUC_CONST;
GIRepository *g_irepository_get_default (void);
const gchar * g_irepository_register (GIRepository *repository,
GMetadata *metadata);
GTypelib *metadata);
void g_irepository_unregister (GIRepository *repository,
const gchar *namespace);
const gchar * g_irepository_register_file (GIRepository *repository,
@ -96,15 +96,15 @@ const gchar * g_irepository_get_shared_library (GIRepository *repository,
const gchar *namespace);
/* Metadata */
GMetadata * g_metadata_new_from_memory (guchar *memory,
GTypelib * g_typelib_new_from_memory (guchar *memory,
gsize len);
GMetadata * g_metadata_new_from_const_memory (const guchar *memory,
GTypelib * g_typelib_new_from_const_memory (const guchar *memory,
gsize len);
GMetadata * g_metadata_new_from_mapped_file (GMappedFile *mfile);
void g_metadata_free (GMetadata *metadata);
void g_metadata_set_module (GMetadata *metadata,
GTypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile);
void g_typelib_free (GTypelib *metadata);
void g_typelib_set_module (GTypelib *metadata,
GModule *module);
const gchar * g_metadata_get_namespace (GMetadata *metadata);
const gchar * g_typelib_get_namespace (GTypelib *metadata);
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 *name);
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 *container,
GMetadata *metadata,
GTypelib *metadata,
guint32 offset);

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,8 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __G_METADATA_H__
#define __G_METADATA_H__
#ifndef __G_TYPELIB_H__
#define __G_TYPELIB_H__
#include <gmodule.h>
#include "girepository.h"
@ -510,7 +510,7 @@ typedef struct
} AnnotationBlob;
struct _GMetadata {
struct _GTypelib {
guchar *data;
gsize len;
gboolean owns_memory;
@ -518,32 +518,32 @@ struct _GMetadata {
GModule *module;
};
DirEntry *g_metadata_get_dir_entry (GMetadata *metadata,
DirEntry *g_typelib_get_dir_entry (GTypelib *metadata,
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
{
G_METADATA_ERROR_INVALID,
G_METADATA_ERROR_INVALID_HEADER,
G_METADATA_ERROR_INVALID_DIRECTORY,
G_METADATA_ERROR_INVALID_ENTRY,
G_METADATA_ERROR_INVALID_BLOB
} GMetadataError;
G_TYPELIB_ERROR_INVALID,
G_TYPELIB_ERROR_INVALID_HEADER,
G_TYPELIB_ERROR_INVALID_DIRECTORY,
G_TYPELIB_ERROR_INVALID_ENTRY,
G_TYPELIB_ERROR_INVALID_BLOB
} 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);
G_END_DECLS
#endif /* __G_METADATA_H__ */
#endif /* __G_TYPELIB_H__ */