glib/girepository/tools/generate.c

1399 lines
36 KiB
C
Raw Normal View History

reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
/* -*- Mode: C; c-file-style: "gnu"; -*- */
2005-05-09 16:24:46 +02:00
/* GObject introspection: IDL generator
*
* Copyright (C) 2005 Matthias Clasen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <errno.h>
#include <string.h>
2005-05-09 16:24:46 +02:00
#include <glib.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include "girepository.h"
#include "gtypelib.h"
2005-05-09 16:24:46 +02:00
/* FIXME: Avoid global */
static gchar *output = NULL;
gchar **includedirs = NULL;
2005-05-09 16:24:46 +02:00
typedef struct {
FILE *file;
GSList *stack;
} Xml;
typedef struct {
char *name;
guint has_children : 1;
} XmlElement;
static XmlElement *
xml_element_new (const char *name)
{
XmlElement *elem;
elem = g_new (XmlElement, 1);
elem->name = g_strdup (name);
elem->has_children = FALSE;
return elem;
}
static void
xml_element_free (XmlElement *elem)
{
g_free (elem->name);
g_free (elem);
}
static void
xml_printf (Xml *xml, const char *fmt, ...)
{
va_list ap;
char *s;
va_start (ap, fmt);
s = g_markup_vprintf_escaped (fmt, ap);
fputs (s, xml->file);
g_free (s);
va_end (ap);
}
static void
xml_start_element (Xml *xml, const char *element_name)
{
XmlElement *parent = NULL;
if (xml->stack)
{
parent = xml->stack->data;
if (!parent->has_children)
xml_printf (xml, ">\n");
parent->has_children = TRUE;
}
xml_printf (xml, "%*s<%s", g_slist_length(xml->stack)*2, "", element_name);
xml->stack = g_slist_prepend (xml->stack, xml_element_new (element_name));
}
static void
xml_end_element (Xml *xml, const char *name)
{
XmlElement *elem;
g_assert (xml->stack != NULL);
elem = xml->stack->data;
xml->stack = g_slist_delete_link (xml->stack, xml->stack);
if (name != NULL)
g_assert_cmpstr (name, ==, elem->name);
if (elem->has_children)
xml_printf (xml, "%*s</%s>\n", g_slist_length (xml->stack)*2, "", elem->name);
else
xml_printf (xml, "/>\n");
xml_element_free (elem);
}
static void
xml_end_element_unchecked (Xml *xml)
{
xml_end_element (xml, NULL);
}
static Xml *
xml_open (FILE *file)
{
Xml *xml;
xml = g_new (Xml, 1);
xml->file = file;
xml->stack = NULL;
return xml;
}
static void
xml_close (Xml *xml)
{
g_assert (xml->stack == NULL);
if (xml->file != NULL)
{
fflush (xml->file);
if (xml->file != stdout)
fclose (xml->file);
xml->file = NULL;
}
}
static void
xml_free (Xml *xml)
{
xml_close (xml);
g_free (xml);
}
static void
check_unresolved (GIBaseInfo *info)
{
if (g_base_info_get_type (info) != GI_INFO_TYPE_UNRESOLVED)
return;
g_critical ("Found unresolved type '%s' '%s'\n",
g_base_info_get_name (info), g_base_info_get_namespace (info));
}
2005-05-13 00:49:59 +02:00
static void
write_type_name (const gchar *namespace,
GIBaseInfo *info,
Xml *file)
2005-05-13 00:49:59 +02:00
{
Revert revisions 157,149-148,136-129 and 120. Move back to using 2008-04-22 Johan Dahlin <johan@gnome.org> * girepository/ginfo.c (g_info_from_entry), (g_type_info_new), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_codes), (g_enum_info_get_value), (g_object_info_get_interface), (g_object_info_get_field), (g_interface_info_get_prerequisite), (g_signal_info_get_class_closure), (g_constant_info_get_value): * girepository/ginvoke.c (get_ffi_type): * girepository/girepository.h: * girepository/gmetadata.c (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_constant_blob), (validate_struct_blob), (validate_enum_blob): * girepository/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke.c (main): * tests/roundtrips.sh: * tools/Makefile.am: * tools/compiler.c (format_output), (write_out_metadata), (main): * tools/generate.c (write_type_name), (write_type_info), (write_constant_value), (write_enum_info), (load_metadata), (main): * tools/gidlcompilercontext.c: * tools/gidlcompilercontext.h: * tools/gidlcompilerentrynode.c: * tools/gidlcompilerentrynode.h: * tools/gidlcompilertypenode.c: * tools/gidlcompilertypenode.h: * tools/gidlmodule.c (g_idl_module_build_metadata): * tools/gidlmodule.h: * tools/gidlnode.c (init_stats), (dump_stats), (g_idl_node_get_size), (g_idl_node_get_full_size), (g_idl_node_cmp), (g_idl_node_can_have_member), (g_idl_node_add_member), (g_idl_node_param_direction_string), (parse_int_value), (parse_uint_value), (parse_float_value), (parse_boolean_value), (find_entry_node), (find_entry), (serialize_type), (g_idl_node_build_metadata), (write_string): * tools/gidlnode.h: * tools/gidlparser.c (parse_type_internal): * tools/quote-file.sh: Revert revisions 157,149-148,136-129 and 120. Move back to using g-idl-generate to generate the metadata and avoids dependency on a c compiler. svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
if (strcmp (namespace, g_base_info_get_namespace (info)) != 0)
xml_printf (file, "%s.", g_base_info_get_namespace (info));
2005-05-13 00:49:59 +02:00
xml_printf (file, "%s", g_base_info_get_name (info));
2005-05-13 00:49:59 +02:00
}
static void
write_type_name_attribute (const gchar *namespace,
GIBaseInfo *info,
const char *attr_name,
Xml *file)
{
xml_printf (file, " %s=\"", attr_name);
write_type_name (namespace, info, file);
xml_printf (file, "\"");
}
2005-05-09 16:24:46 +02:00
static void
2005-05-13 00:49:59 +02:00
write_type_info (const gchar *namespace,
GITypeInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
gint tag;
gint i;
GITypeInfo *type;
gboolean is_pointer;
2005-05-09 16:24:46 +02:00
check_unresolved ((GIBaseInfo*)info);
2005-05-09 16:24:46 +02:00
tag = g_type_info_get_tag (info);
is_pointer = g_type_info_is_pointer (info);
2005-05-09 16:24:46 +02:00
if (tag == GI_TYPE_TAG_VOID)
{
xml_start_element (file, "type");
xml_printf (file, " name=\"%s\"", is_pointer ? "any" : "none");
xml_end_element (file, "type");
}
else if (G_TYPE_TAG_IS_BASIC (tag))
{
xml_start_element (file, "type");
xml_printf (file, " name=\"%s\"", g_type_tag_to_string (tag));
xml_end_element (file, "type");
}
else if (tag == GI_TYPE_TAG_ARRAY)
2005-05-09 16:24:46 +02:00
{
gint length;
xml_start_element (file, "array");
2005-05-09 16:24:46 +02:00
type = g_type_info_get_param_type (info, 0);
length = g_type_info_get_array_length (info);
if (length >= 0)
xml_printf (file, " length=\"%d\"", length);
2005-05-09 16:24:46 +02:00
if (g_type_info_is_zero_terminated (info))
xml_printf (file, " zero-terminated=\"1\"");
write_type_info (namespace, type, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)type);
xml_end_element (file, "array");
2005-05-09 16:24:46 +02:00
}
else if (tag == GI_TYPE_TAG_INTERFACE)
2005-05-09 16:24:46 +02:00
{
GIBaseInfo *iface = g_type_info_get_interface (info);
xml_start_element (file, "type");
write_type_name_attribute (namespace, iface, "name", file);
xml_end_element (file, "type");
2005-05-09 16:24:46 +02:00
g_base_info_unref (iface);
}
else if (tag == GI_TYPE_TAG_GLIST)
2005-05-09 16:24:46 +02:00
{
xml_start_element (file, "type");
xml_printf (file, " name=\"GLib.List\"");
2005-05-09 16:24:46 +02:00
type = g_type_info_get_param_type (info, 0);
if (type)
{
write_type_info (namespace, type, file);
g_base_info_unref ((GIBaseInfo *)type);
}
xml_end_element (file, "type");
2005-05-09 16:24:46 +02:00
}
else if (tag == GI_TYPE_TAG_GSLIST)
2005-05-09 16:24:46 +02:00
{
xml_start_element (file, "type");
xml_printf (file, " name=\"GLib.SList\"");
2005-05-09 16:24:46 +02:00
type = g_type_info_get_param_type (info, 0);
if (type)
{
write_type_info (namespace, type, file);
g_base_info_unref ((GIBaseInfo *)type);
}
xml_end_element (file, "type");
2005-05-09 16:24:46 +02:00
}
else if (tag == GI_TYPE_TAG_GHASH)
2005-05-09 16:24:46 +02:00
{
xml_start_element (file, "type");
xml_printf (file, " name=\"GLib.HashTable\"");
2005-05-09 16:24:46 +02:00
type = g_type_info_get_param_type (info, 0);
if (type)
{
write_type_info (namespace, type, file);
g_base_info_unref ((GIBaseInfo *)type);
type = g_type_info_get_param_type (info, 1);
write_type_info (namespace, type, file);
g_base_info_unref ((GIBaseInfo *)type);
}
xml_end_element (file, "type");
2005-05-09 16:24:46 +02:00
}
else if (tag == GI_TYPE_TAG_ERROR)
2005-05-09 16:24:46 +02:00
{
gint n;
xml_start_element (file, "type");
xml_printf (file, " name=\"GLib.Error\"");
n = g_type_info_get_n_error_domains (info);
if (n > 0)
2005-05-09 16:24:46 +02:00
{
for (i = 0; i < n; i++)
{
GIErrorDomainInfo *ed = g_type_info_get_error_domain (info, i);
xml_start_element (file, "type");
write_type_name_attribute (namespace, (GIBaseInfo *)ed, "name", file);
xml_end_element (file, "type");
g_base_info_unref ((GIBaseInfo *)ed);
}
2005-05-09 16:24:46 +02:00
}
xml_end_element (file, "type");
2005-05-09 16:24:46 +02:00
}
else
{
g_printerr ("Unhandled type tag %d\n", tag);
g_assert_not_reached ();
}
2005-05-09 16:24:46 +02:00
}
static void
write_constant_value (const gchar *namespace,
GITypeInfo *info,
GArgument *argument,
Xml *file);
2005-05-09 16:24:46 +02:00
static void
2005-05-13 00:49:59 +02:00
write_field_info (const gchar *namespace,
GIFieldInfo *info,
GIConstantInfo *branch,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
GIFieldInfoFlags flags;
gint size;
gint offset;
GITypeInfo *type;
GArgument value;
2005-05-09 16:24:46 +02:00
name = g_base_info_get_name ((GIBaseInfo *)info);
flags = g_field_info_get_flags (info);
size = g_field_info_get_size (info);
offset = g_field_info_get_offset (info);
xml_start_element (file, "field");
xml_printf (file, " name=\"%s\" readable=\"%s\" writable=\"%s\"",
2005-05-13 00:49:59 +02:00
name,
flags & GI_FIELD_IS_READABLE ? "1" : "0",
flags & GI_FIELD_IS_WRITABLE ? "1" : "0");
2005-05-09 16:24:46 +02:00
if (size)
xml_printf (file, " bits=\"%d\"", size);
2005-05-09 16:24:46 +02:00
xml_printf (file, " offset=\"%d\"", offset);
2005-05-09 16:24:46 +02:00
type = g_field_info_get_type (info);
if (branch)
{
xml_printf (file, " branch=\"");
type = g_constant_info_get_type (branch);
g_constant_info_get_value (branch, &value);
write_constant_value (namespace, type, &value, file);
xml_printf (file, "\"");
}
write_type_info (namespace, type, file);
g_base_info_unref ((GIBaseInfo *)type);
xml_end_element (file, "field");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_callable_info (const gchar *namespace,
GICallableInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
GITypeInfo *type;
gint i;
type = g_callable_info_get_return_type (info);
2005-05-13 00:49:59 +02:00
xml_start_element (file, "return-value");
2005-05-13 00:49:59 +02:00
if (g_type_info_is_pointer (type))
{
switch (g_callable_info_get_caller_owns (info))
{
case GI_TRANSFER_NOTHING:
break;
case GI_TRANSFER_CONTAINER:
xml_printf (file, " transfer-ownership=\"container\"");
2005-05-13 00:49:59 +02:00
break;
case GI_TRANSFER_EVERYTHING:
xml_printf (file, " transfer-ownership=\"full\"");
2005-05-13 00:49:59 +02:00
break;
default:
g_assert_not_reached ();
}
}
if (g_callable_info_may_return_null (info))
xml_printf (file, " null-ok=\"1\"");
write_type_info (namespace, type, file);
xml_end_element (file, "return-value");
2005-05-09 16:24:46 +02:00
if (g_callable_info_get_n_args (info) <= 0)
return;
xml_start_element (file, "parameters");
for (i = 0; i < g_callable_info_get_n_args (info); i++)
2005-05-09 16:24:46 +02:00
{
GIArgInfo *arg = g_callable_info_get_arg (info, i);
xml_start_element (file, "parameter");
xml_printf (file, " name=\"%s\"",
g_base_info_get_name ((GIBaseInfo *) arg));
switch (g_arg_info_get_ownership_transfer (arg))
2005-05-09 16:24:46 +02:00
{
case GI_TRANSFER_NOTHING:
break;
case GI_TRANSFER_CONTAINER:
xml_printf (file, " transfer=\"container\"");
break;
case GI_TRANSFER_EVERYTHING:
xml_printf (file, " transfer=\"full\"");
break;
default:
g_assert_not_reached ();
}
xml_printf (file, " direction=\"");
switch (g_arg_info_get_direction (arg))
{
case GI_DIRECTION_IN:
xml_printf (file, "in");
break;
case GI_DIRECTION_OUT:
xml_printf (file, "out");
break;
case GI_DIRECTION_INOUT:
xml_printf (file, "inout");
break;
2005-05-09 16:24:46 +02:00
}
xml_printf (file, "\"");
if (g_arg_info_may_be_null (arg))
xml_printf (file, " null-ok=\"1\"");
if (g_arg_info_is_dipper (arg))
xml_printf (file, " dipper=\"1\"");
if (g_arg_info_is_return_value (arg))
xml_printf (file, " retval=\"1\"");
if (g_arg_info_is_optional (arg))
xml_printf (file, " optional=\"1\"");
type = g_arg_info_get_type (arg);
write_type_info (namespace, type, file);
xml_end_element (file, "parameter");
g_base_info_unref ((GIBaseInfo *)arg);
2005-05-09 16:24:46 +02:00
}
xml_end_element (file, "parameters");
g_base_info_unref ((GIBaseInfo *)type);
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_function_info (const gchar *namespace,
GIFunctionInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
GIFunctionInfoFlags flags;
const gchar *tag;
const gchar *name;
const gchar *symbol;
2005-05-09 16:24:46 +02:00
gboolean deprecated;
flags = g_function_info_get_flags (info);
name = g_base_info_get_name ((GIBaseInfo *)info);
symbol = g_function_info_get_symbol (info);
2005-05-09 16:24:46 +02:00
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
tag = "constructor";
else if (flags & GI_FUNCTION_IS_METHOD)
tag = "method";
else
tag = "function";
xml_start_element (file, tag);
xml_printf (file, " name=\"%s\" c:identifier=\"%s\"",
name, symbol);
2005-05-09 16:24:46 +02:00
if (flags & GI_FUNCTION_IS_SETTER)
xml_printf (file, " type=\"setter\"");
2005-05-09 16:24:46 +02:00
else if (flags & GI_FUNCTION_IS_GETTER)
xml_printf (file, " type=\"getter\"");
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
write_callable_info (namespace, (GICallableInfo*)info, file);
xml_end_element (file, tag);
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_callback_info (const gchar *namespace,
GICallbackInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
gboolean deprecated;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
xml_start_element (file, "callback");
xml_printf (file, " name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file);
xml_end_element (file, "callback");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_struct_info (const gchar *namespace,
GIStructInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
const gchar *type_name;
const gchar *type_init;
gboolean deprecated;
gint i;
int n_elts;
2005-05-09 16:24:46 +02:00
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
2005-05-09 16:24:46 +02:00
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
{
xml_start_element (file, "glib:boxed");
xml_printf (file, " glib:name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
}
else
{
xml_start_element (file, "record");
xml_printf (file, " name=\"%s\"", name);
}
if (type_name != NULL)
xml_printf (file, " glib:type-name=\"%s\" glib:get-type=\"%s\"", type_name, type_init);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
n_elts = g_struct_info_get_n_fields (info) + g_struct_info_get_n_methods (info);
if (n_elts > 0)
2005-05-09 16:24:46 +02:00
{
for (i = 0; i < g_struct_info_get_n_fields (info); i++)
{
GIFieldInfo *field = g_struct_info_get_field (info, i);
write_field_info (namespace, field, NULL, file);
g_base_info_unref ((GIBaseInfo *)field);
}
for (i = 0; i < g_struct_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = g_struct_info_get_method (info, i);
write_function_info (namespace, function, file);
g_base_info_unref ((GIBaseInfo *)function);
}
}
xml_end_element_unchecked (file);
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_value_info (const gchar *namespace,
GIValueInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
glong value;
gboolean deprecated;
name = g_base_info_get_name ((GIBaseInfo *)info);
value = g_value_info_get_value (info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
xml_start_element (file, "member");
xml_printf (file, " name=\"%s\" value=\"%ld\"", name, value);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
xml_end_element (file, "member");
2005-05-09 16:24:46 +02:00
}
static void
write_constant_value (const gchar *namespace,
GITypeInfo *type,
GArgument *value,
Xml *file)
2005-05-09 16:24:46 +02:00
{
switch (g_type_info_get_tag (type))
{
case GI_TYPE_TAG_BOOLEAN:
xml_printf (file, "%d", value->v_boolean);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT8:
xml_printf (file, "%d", value->v_int8);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT8:
xml_printf (file, "%d", value->v_uint8);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT16:
xml_printf (file, "%" G_GINT16_FORMAT, value->v_int16);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT16:
xml_printf (file, "%" G_GUINT16_FORMAT, value->v_uint16);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT32:
xml_printf (file, "%" G_GINT32_FORMAT, value->v_int32);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT32:
xml_printf (file, "%" G_GUINT32_FORMAT, value->v_uint32);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT64:
xml_printf (file, "%" G_GINT64_FORMAT, value->v_int64);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT64:
xml_printf (file, "%" G_GUINT64_FORMAT, value->v_uint64);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT:
xml_printf (file, "%d", value->v_int);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT:
xml_printf (file, "%d", value->v_uint);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_LONG:
xml_printf (file, "%ld", value->v_long);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_ULONG:
xml_printf (file, "%ld", value->v_ulong);
2005-05-09 16:24:46 +02:00
break;
2005-05-21 02:08:27 +02:00
case GI_TYPE_TAG_SSIZE:
xml_printf (file, "%zd", value->v_ssize);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_SIZE:
xml_printf (file, "%zd", value->v_size);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_FLOAT:
xml_printf (file, "%f", value->v_float);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_DOUBLE:
xml_printf (file, "%f", value->v_double);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
xml_printf (file, "%s", value->v_string);
2005-05-21 02:08:27 +02:00
break;
default:
Revert revisions 157,149-148,136-129 and 120. Move back to using 2008-04-22 Johan Dahlin <johan@gnome.org> * girepository/ginfo.c (g_info_from_entry), (g_type_info_new), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_codes), (g_enum_info_get_value), (g_object_info_get_interface), (g_object_info_get_field), (g_interface_info_get_prerequisite), (g_signal_info_get_class_closure), (g_constant_info_get_value): * girepository/ginvoke.c (get_ffi_type): * girepository/girepository.h: * girepository/gmetadata.c (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_constant_blob), (validate_struct_blob), (validate_enum_blob): * girepository/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke.c (main): * tests/roundtrips.sh: * tools/Makefile.am: * tools/compiler.c (format_output), (write_out_metadata), (main): * tools/generate.c (write_type_name), (write_type_info), (write_constant_value), (write_enum_info), (load_metadata), (main): * tools/gidlcompilercontext.c: * tools/gidlcompilercontext.h: * tools/gidlcompilerentrynode.c: * tools/gidlcompilerentrynode.h: * tools/gidlcompilertypenode.c: * tools/gidlcompilertypenode.h: * tools/gidlmodule.c (g_idl_module_build_metadata): * tools/gidlmodule.h: * tools/gidlnode.c (init_stats), (dump_stats), (g_idl_node_get_size), (g_idl_node_get_full_size), (g_idl_node_cmp), (g_idl_node_can_have_member), (g_idl_node_add_member), (g_idl_node_param_direction_string), (parse_int_value), (parse_uint_value), (parse_float_value), (parse_boolean_value), (find_entry_node), (find_entry), (serialize_type), (g_idl_node_build_metadata), (write_string): * tools/gidlnode.h: * tools/gidlparser.c (parse_type_internal): * tools/quote-file.sh: Revert revisions 157,149-148,136-129 and 120. Move back to using g-idl-generate to generate the metadata and avoids dependency on a c compiler. svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
g_assert_not_reached ();
2005-05-09 16:24:46 +02:00
}
}
static void
write_constant_info (const gchar *namespace,
GIConstantInfo *info,
Xml *file)
{
GITypeInfo *type;
const gchar *name;
gboolean deprecated;
GArgument value;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
xml_start_element (file, "constant");
xml_printf (file, " name=\"%s\"", name);
type = g_constant_info_get_type (info);
xml_printf (file, " value=\"");
g_constant_info_get_value (info, &value);
write_constant_value (namespace, type, &value, file);
xml_printf (file, "\"");
write_type_info (namespace, type, file);
xml_end_element (file, "constant");
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)type);
}
static void
2005-05-13 00:49:59 +02:00
write_enum_info (const gchar *namespace,
GIEnumInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
Revert revisions 157,149-148,136-129 and 120. Move back to using 2008-04-22 Johan Dahlin <johan@gnome.org> * girepository/ginfo.c (g_info_from_entry), (g_type_info_new), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_codes), (g_enum_info_get_value), (g_object_info_get_interface), (g_object_info_get_field), (g_interface_info_get_prerequisite), (g_signal_info_get_class_closure), (g_constant_info_get_value): * girepository/ginvoke.c (get_ffi_type): * girepository/girepository.h: * girepository/gmetadata.c (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_constant_blob), (validate_struct_blob), (validate_enum_blob): * girepository/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke.c (main): * tests/roundtrips.sh: * tools/Makefile.am: * tools/compiler.c (format_output), (write_out_metadata), (main): * tools/generate.c (write_type_name), (write_type_info), (write_constant_value), (write_enum_info), (load_metadata), (main): * tools/gidlcompilercontext.c: * tools/gidlcompilercontext.h: * tools/gidlcompilerentrynode.c: * tools/gidlcompilerentrynode.h: * tools/gidlcompilertypenode.c: * tools/gidlcompilertypenode.h: * tools/gidlmodule.c (g_idl_module_build_metadata): * tools/gidlmodule.h: * tools/gidlnode.c (init_stats), (dump_stats), (g_idl_node_get_size), (g_idl_node_get_full_size), (g_idl_node_cmp), (g_idl_node_can_have_member), (g_idl_node_add_member), (g_idl_node_param_direction_string), (parse_int_value), (parse_uint_value), (parse_float_value), (parse_boolean_value), (find_entry_node), (find_entry), (serialize_type), (g_idl_node_build_metadata), (write_string): * tools/gidlnode.h: * tools/gidlparser.c (parse_type_internal): * tools/quote-file.sh: Revert revisions 157,149-148,136-129 and 120. Move back to using g-idl-generate to generate the metadata and avoids dependency on a c compiler. svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
const gchar *type_name;
const gchar *type_init;
2005-05-09 16:24:46 +02:00
gboolean deprecated;
gint i;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
Revert revisions 157,149-148,136-129 and 120. Move back to using 2008-04-22 Johan Dahlin <johan@gnome.org> * girepository/ginfo.c (g_info_from_entry), (g_type_info_new), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_codes), (g_enum_info_get_value), (g_object_info_get_interface), (g_object_info_get_field), (g_interface_info_get_prerequisite), (g_signal_info_get_class_closure), (g_constant_info_get_value): * girepository/ginvoke.c (get_ffi_type): * girepository/girepository.h: * girepository/gmetadata.c (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_constant_blob), (validate_struct_blob), (validate_enum_blob): * girepository/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke.c (main): * tests/roundtrips.sh: * tools/Makefile.am: * tools/compiler.c (format_output), (write_out_metadata), (main): * tools/generate.c (write_type_name), (write_type_info), (write_constant_value), (write_enum_info), (load_metadata), (main): * tools/gidlcompilercontext.c: * tools/gidlcompilercontext.h: * tools/gidlcompilerentrynode.c: * tools/gidlcompilerentrynode.h: * tools/gidlcompilertypenode.c: * tools/gidlcompilertypenode.h: * tools/gidlmodule.c (g_idl_module_build_metadata): * tools/gidlmodule.h: * tools/gidlnode.c (init_stats), (dump_stats), (g_idl_node_get_size), (g_idl_node_get_full_size), (g_idl_node_cmp), (g_idl_node_can_have_member), (g_idl_node_add_member), (g_idl_node_param_direction_string), (parse_int_value), (parse_uint_value), (parse_float_value), (parse_boolean_value), (find_entry_node), (find_entry), (serialize_type), (g_idl_node_build_metadata), (write_string): * tools/gidlnode.h: * tools/gidlparser.c (parse_type_internal): * tools/quote-file.sh: Revert revisions 157,149-148,136-129 and 120. Move back to using g-idl-generate to generate the metadata and avoids dependency on a c compiler. svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
2005-05-09 16:24:46 +02:00
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_ENUM)
xml_start_element (file, "enumeration");
2005-05-09 16:24:46 +02:00
else
xml_start_element (file, "bitfield");
xml_printf (file, " name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (type_init)
xml_printf (file, " glib:type-name=\"%s\" glib:get-type=\"%s\"", type_name, type_init);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
for (i = 0; i < g_enum_info_get_n_values (info); i++)
{
GIValueInfo *value = g_enum_info_get_value (info, i);
2005-05-13 00:49:59 +02:00
write_value_info (namespace, value, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)value);
}
xml_end_element_unchecked (file);
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_signal_info (const gchar *namespace,
GISignalInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
GSignalFlags flags;
const gchar *name;
gboolean deprecated;
name = g_base_info_get_name ((GIBaseInfo *)info);
flags = g_signal_info_get_flags (info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
xml_start_element (file, "glib:signal");
xml_printf (file, " name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & G_SIGNAL_RUN_FIRST)
xml_printf (file, " when=\"FIRST\"");
2005-05-09 16:24:46 +02:00
else if (flags & G_SIGNAL_RUN_LAST)
xml_printf (file, " when=\"LAST\"");
2005-05-09 16:24:46 +02:00
else if (flags & G_SIGNAL_RUN_CLEANUP)
xml_printf (file, " when=\"CLEANUP\"");
2005-05-09 16:24:46 +02:00
if (flags & G_SIGNAL_NO_RECURSE)
xml_printf (file, " no-recurse=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & G_SIGNAL_DETAILED)
xml_printf (file, " detailed=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & G_SIGNAL_ACTION)
xml_printf (file, " action=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & G_SIGNAL_NO_HOOKS)
xml_printf (file, " no-hooks=\"1\"");
2005-05-09 16:24:46 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file);
xml_end_element (file, "glib:signal");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_vfunc_info (const gchar *namespace,
GIVFuncInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
GIVFuncInfoFlags flags;
const gchar *name;
gboolean deprecated;
gint offset;
2005-05-09 16:24:46 +02:00
name = g_base_info_get_name ((GIBaseInfo *)info);
flags = g_vfunc_info_get_flags (info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
offset = g_vfunc_info_get_offset (info);
2005-05-09 16:24:46 +02:00
xml_start_element (file, "vfunc");
xml_printf (file, " name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & GI_VFUNC_MUST_CHAIN_UP)
xml_printf (file, " must-chain-up=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & GI_VFUNC_MUST_OVERRIDE)
xml_printf (file, " override=\"always\"");
2005-05-09 16:24:46 +02:00
else if (flags & GI_VFUNC_MUST_NOT_OVERRIDE)
xml_printf (file, " override=\"never\"");
2005-05-09 16:24:46 +02:00
xml_printf (file, " offset=\"%d\"", offset);
2005-05-09 16:24:46 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file);
xml_end_element (file, "vfunc");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_property_info (const gchar *namespace,
GIPropertyInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
GParamFlags flags;
const gchar *name;
gboolean deprecated;
GITypeInfo *type;
name = g_base_info_get_name ((GIBaseInfo *)info);
flags = g_property_info_get_flags (info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
xml_start_element (file, "property");
xml_printf (file, " name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & G_PARAM_READABLE)
xml_printf (file, " readable=\"1\"");
2005-05-09 16:24:46 +02:00
else
xml_printf (file, " readable=\"0\"");
2005-05-09 16:24:46 +02:00
if (flags & G_PARAM_WRITABLE)
xml_printf (file, " writable=\"1\"");
2005-05-09 16:24:46 +02:00
else
xml_printf (file, " writable=\"0\"");
2005-05-09 16:24:46 +02:00
if (flags & G_PARAM_CONSTRUCT)
xml_printf (file, " construct=\"1\"");
2005-05-09 16:24:46 +02:00
if (flags & G_PARAM_CONSTRUCT_ONLY)
xml_printf (file, " construct-only=\"1\"");
2005-05-09 16:24:46 +02:00
type = g_property_info_get_type (info);
2005-05-13 00:49:59 +02:00
write_type_info (namespace, type, file);
2005-05-09 16:24:46 +02:00
xml_end_element (file, "property");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_object_info (const gchar *namespace,
GIObjectInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
const gchar *type_name;
const gchar *type_init;
gboolean deprecated;
GIObjectInfo *pnode;
gint i;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
xml_start_element (file, "class");
xml_printf (file, " name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
2005-05-13 00:49:59 +02:00
pnode = g_object_info_get_parent (info);
if (pnode)
{
write_type_name_attribute (namespace, (GIBaseInfo *)pnode, "parent", file);
2005-05-24 22:45:26 +02:00
g_base_info_unref ((GIBaseInfo *)pnode);
2005-05-13 00:49:59 +02:00
}
2005-05-09 16:24:46 +02:00
xml_printf (file, " glib:type-name=\"%s\" glib:get-type=\"%s\"", type_name, type_init);
2005-05-09 16:24:46 +02:00
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
if (g_object_info_get_n_interfaces (info) > 0)
{
for (i = 0; i < g_object_info_get_n_interfaces (info); i++)
{
GIInterfaceInfo *imp = g_object_info_get_interface (info, i);
xml_start_element (file, "implements");
write_type_name_attribute (namespace, (GIBaseInfo *)imp, "name", file);
xml_end_element (file, "implements");
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo*)imp);
}
}
for (i = 0; i < g_object_info_get_n_fields (info); i++)
{
GIFieldInfo *field = g_object_info_get_field (info, i);
write_field_info (namespace, field, NULL, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)field);
}
for (i = 0; i < g_object_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = g_object_info_get_method (info, i);
write_function_info (namespace, function, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)function);
}
for (i = 0; i < g_object_info_get_n_properties (info); i++)
{
GIPropertyInfo *prop = g_object_info_get_property (info, i);
2005-05-13 00:49:59 +02:00
write_property_info (namespace, prop, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)prop);
}
for (i = 0; i < g_object_info_get_n_signals (info); i++)
{
GISignalInfo *signal = g_object_info_get_signal (info, i);
2005-05-13 00:49:59 +02:00
write_signal_info (namespace, signal, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)signal);
}
for (i = 0; i < g_object_info_get_n_vfuncs (info); i++)
{
GIVFuncInfo *vfunc = g_object_info_get_vfunc (info, i);
2005-05-13 00:49:59 +02:00
write_vfunc_info (namespace, vfunc, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)vfunc);
}
for (i = 0; i < g_object_info_get_n_constants (info); i++)
{
GIConstantInfo *constant = g_object_info_get_constant (info, i);
write_constant_info (namespace, constant, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)constant);
}
xml_end_element (file, "class");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_interface_info (const gchar *namespace,
GIInterfaceInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
const gchar *type_name;
const gchar *type_init;
gboolean deprecated;
gint i;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
xml_start_element (file, "interface");
xml_printf (file, " name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"",
2005-05-09 16:24:46 +02:00
name, type_name, type_init);
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
2005-05-09 16:24:46 +02:00
if (g_interface_info_get_n_prerequisites (info) > 0)
{
xml_start_element (file, "requires");
2005-05-09 16:24:46 +02:00
for (i = 0; i < g_interface_info_get_n_prerequisites (info); i++)
{
GIBaseInfo *req = g_interface_info_get_prerequisite (info, i);
if (g_base_info_get_type (req) == GI_INFO_TYPE_INTERFACE)
xml_start_element (file, "interface");
2005-05-09 16:24:46 +02:00
else
xml_start_element (file, "object");
write_type_name_attribute (namespace, req, "name", file);
xml_end_element_unchecked (file);
2005-05-09 16:24:46 +02:00
g_base_info_unref (req);
}
xml_end_element (file, "requires");
2005-05-09 16:24:46 +02:00
}
for (i = 0; i < g_interface_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = g_interface_info_get_method (info, i);
write_function_info (namespace, function, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)function);
}
for (i = 0; i < g_interface_info_get_n_properties (info); i++)
{
GIPropertyInfo *prop = g_interface_info_get_property (info, i);
2005-05-13 00:49:59 +02:00
write_property_info (namespace, prop, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)prop);
}
for (i = 0; i < g_interface_info_get_n_signals (info); i++)
{
GISignalInfo *signal = g_interface_info_get_signal (info, i);
2005-05-13 00:49:59 +02:00
write_signal_info (namespace, signal, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)signal);
}
for (i = 0; i < g_interface_info_get_n_vfuncs (info); i++)
{
GIVFuncInfo *vfunc = g_interface_info_get_vfunc (info, i);
2005-05-13 00:49:59 +02:00
write_vfunc_info (namespace, vfunc, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)vfunc);
}
for (i = 0; i < g_interface_info_get_n_constants (info); i++)
{
GIConstantInfo *constant = g_interface_info_get_constant (info, i);
write_constant_info (namespace, constant, file);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)constant);
}
xml_end_element (file, "interface");
2005-05-09 16:24:46 +02:00
}
static void
2005-05-13 00:49:59 +02:00
write_error_domain_info (const gchar *namespace,
GIErrorDomainInfo *info,
Xml *file)
2005-05-09 16:24:46 +02:00
{
GIBaseInfo *enum_;
2005-05-13 00:49:59 +02:00
const gchar *name, *quark;
2005-05-09 16:24:46 +02:00
name = g_base_info_get_name ((GIBaseInfo *)info);
quark = g_error_domain_info_get_quark (info);
enum_ = (GIBaseInfo *)g_error_domain_info_get_codes (info);
xml_start_element (file, "errordomain");
xml_printf (file, " name=\"%s\" get-quark=\"%s\"",
name, quark);
write_type_name_attribute (namespace, enum_, "codes", file);
xml_end_element (file, "errordomain");
2005-05-13 00:49:59 +02:00
g_base_info_unref (enum_);
2005-05-09 16:24:46 +02:00
}
static void
write_union_info (const gchar *namespace,
GIUnionInfo *info,
Xml *file)
{
const gchar *name;
const gchar *type_name;
const gchar *type_init;
gboolean deprecated;
gint i;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
xml_start_element (file, "union");
xml_printf (file, " name=\"%s\"", name);
if (type_name)
xml_printf (file, " type-name=\"%s\" get-type=\"%s\"", type_name, type_init);
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
if (g_union_info_is_discriminated (info))
{
gint offset;
GITypeInfo *type;
offset = g_union_info_get_discriminator_offset (info);
type = g_union_info_get_discriminator_type (info);
xml_start_element (file, "discriminator");
xml_printf (file, " offset=\"%d\" type=\"", offset);
write_type_info (namespace, type, file);
xml_end_element (file, "discriminator");
g_base_info_unref ((GIBaseInfo *)type);
}
for (i = 0; i < g_union_info_get_n_fields (info); i++)
{
GIFieldInfo *field = g_union_info_get_field (info, i);
GIConstantInfo *constant = g_union_info_get_discriminator (info, i);
write_field_info (namespace, field, constant, file);
g_base_info_unref ((GIBaseInfo *)field);
if (constant)
g_base_info_unref ((GIBaseInfo *)constant);
}
for (i = 0; i < g_union_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = g_union_info_get_method (info, i);
write_function_info (namespace, function, file);
g_base_info_unref ((GIBaseInfo *)function);
}
xml_end_element (file, "union");
}
2005-05-09 16:24:46 +02:00
static void
write_repository (const char *namespace,
2005-05-09 16:24:46 +02:00
gboolean needs_prefix)
{
FILE *ofile;
2005-05-09 16:24:46 +02:00
gint i, j;
char **dependencies;
GIRepository *repository;
Xml *xml;
2005-05-09 16:24:46 +02:00
repository = g_irepository_get_default ();
2005-05-09 16:24:46 +02:00
if (output == NULL)
ofile = stdout;
2005-05-09 16:24:46 +02:00
else
{
gchar *filename;
if (needs_prefix)
filename = g_strdup_printf ("%s-%s", namespace, output);
2005-05-09 16:24:46 +02:00
else
filename = g_strdup (output);
ofile = g_fopen (filename, "w");
2005-05-09 16:24:46 +02:00
if (ofile == NULL)
2005-05-09 16:24:46 +02:00
{
g_fprintf (stderr, "failed to open '%s': %s\n",
filename, g_strerror (errno));
g_free (filename);
return;
}
g_free (filename);
}
xml = xml_open (ofile);
2005-05-09 16:24:46 +02:00
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\"");
2005-05-09 16:24:46 +02:00
dependencies = g_irepository_get_dependencies (repository,
namespace);
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);
}
}
if (TRUE)
2005-05-09 16:24:46 +02:00
{
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
const gchar *shared_library;
const char *ns = namespace;
const char *version;
version = g_irepository_get_version (repository, ns);
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
shared_library = g_irepository_get_shared_library (repository, ns);
xml_start_element (xml, "namespace");
xml_printf (xml, " name=\"%s\" version=\"%s\"", ns, version);
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
if (shared_library)
xml_printf (xml, " shared-library=\"%s\"", shared_library);
2005-05-09 16:24:46 +02:00
2005-05-13 00:49:59 +02:00
for (j = 0; j < g_irepository_get_n_infos (repository, ns); j++)
2005-05-09 16:24:46 +02:00
{
2005-05-13 00:49:59 +02:00
GIBaseInfo *info = g_irepository_get_info (repository, ns, j);
2005-05-09 16:24:46 +02:00
switch (g_base_info_get_type (info))
{
case GI_INFO_TYPE_FUNCTION:
write_function_info (ns, (GIFunctionInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_CALLBACK:
write_callback_info (ns, (GICallbackInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_BOXED:
write_struct_info (ns, (GIStructInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_UNION:
write_union_info (ns, (GIUnionInfo *)info, xml);
break;
2005-05-09 16:24:46 +02:00
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
write_enum_info (ns, (GIEnumInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_CONSTANT:
write_constant_info (ns, (GIConstantInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_OBJECT:
write_object_info (ns, (GIObjectInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_INTERFACE:
write_interface_info (ns, (GIInterfaceInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_ERROR_DOMAIN:
write_error_domain_info (ns, (GIErrorDomainInfo *)info, xml);
2005-05-09 16:24:46 +02:00
break;
default:
g_error ("unknown info type %d\n", g_base_info_get_type (info));
2005-05-09 16:24:46 +02:00
}
g_base_info_unref (info);
}
xml_end_element (xml, "namespace");
2005-05-09 16:24:46 +02:00
}
xml_end_element (xml, "repository");
2005-05-09 16:24:46 +02:00
xml_free (xml);
2005-05-09 16:24:46 +02:00
}
static const guchar *
load_typelib (const gchar *filename,
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
GModule **dlhandle,
gsize *len)
2005-05-09 16:24:46 +02:00
{
guchar *typelib;
gsize *typelib_size;
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
GModule *handle;
2005-05-09 16:24:46 +02:00
Revert revisions 157,149-148,136-129 and 120. Move back to using 2008-04-22 Johan Dahlin <johan@gnome.org> * girepository/ginfo.c (g_info_from_entry), (g_type_info_new), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_codes), (g_enum_info_get_value), (g_object_info_get_interface), (g_object_info_get_field), (g_interface_info_get_prerequisite), (g_signal_info_get_class_closure), (g_constant_info_get_value): * girepository/ginvoke.c (get_ffi_type): * girepository/girepository.h: * girepository/gmetadata.c (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_constant_blob), (validate_struct_blob), (validate_enum_blob): * girepository/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke.c (main): * tests/roundtrips.sh: * tools/Makefile.am: * tools/compiler.c (format_output), (write_out_metadata), (main): * tools/generate.c (write_type_name), (write_type_info), (write_constant_value), (write_enum_info), (load_metadata), (main): * tools/gidlcompilercontext.c: * tools/gidlcompilercontext.h: * tools/gidlcompilerentrynode.c: * tools/gidlcompilerentrynode.h: * tools/gidlcompilertypenode.c: * tools/gidlcompilertypenode.h: * tools/gidlmodule.c (g_idl_module_build_metadata): * tools/gidlmodule.h: * tools/gidlnode.c (init_stats), (dump_stats), (g_idl_node_get_size), (g_idl_node_get_full_size), (g_idl_node_cmp), (g_idl_node_can_have_member), (g_idl_node_add_member), (g_idl_node_param_direction_string), (parse_int_value), (parse_uint_value), (parse_float_value), (parse_boolean_value), (find_entry_node), (find_entry), (serialize_type), (g_idl_node_build_metadata), (write_string): * tools/gidlnode.h: * tools/gidlparser.c (parse_type_internal): * tools/quote-file.sh: Revert revisions 157,149-148,136-129 and 120. Move back to using g-idl-generate to generate the metadata and avoids dependency on a c compiler. svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
handle = g_module_open (filename, G_MODULE_BIND_LOCAL|G_MODULE_BIND_LAZY);
if (handle == NULL)
{
g_printerr ("Could not load typelib from '%s': %s\n",
filename, g_module_error ());
return NULL;
}
if (!g_module_symbol (handle, "_G_TYPELIB", (gpointer *) &typelib))
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
{
g_printerr ("Could not load typelib from '%s': %s\n",
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
filename, g_module_error ());
return NULL;
}
2005-05-09 16:24:46 +02:00
if (!g_module_symbol (handle, "_G_TYPELIB_SIZE", (gpointer *) &typelib_size))
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
{
g_printerr ("Could not load typelib from '%s': %s\n",
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
filename, g_module_error ());
return NULL;
}
2005-05-09 16:24:46 +02:00
*len = *typelib_size;
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
2005-05-09 16:24:46 +02:00
if (dlhandle)
*dlhandle = handle;
return typelib;
2005-05-09 16:24:46 +02:00
}
int
main (int argc, char *argv[])
{
gboolean shlib = FALSE;
gchar **input = NULL;
2005-05-09 16:24:46 +02:00
GOptionContext *context;
GError *error = NULL;
gboolean needs_prefix;
gint i;
GTypelib *data;
GOptionEntry options[] =
{
{ "shlib", 0, 0, G_OPTION_ARG_NONE, &shlib, "handle typelib embedded in shlib", NULL },
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
{ NULL, }
};
2005-05-09 16:24:46 +02:00
g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);
2005-05-09 16:24:46 +02:00
g_type_init ();
g_typelib_check_sanity ();
Revert revisions 157,149-148,136-129 and 120. Move back to using 2008-04-22 Johan Dahlin <johan@gnome.org> * girepository/ginfo.c (g_info_from_entry), (g_type_info_new), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_codes), (g_enum_info_get_value), (g_object_info_get_interface), (g_object_info_get_field), (g_interface_info_get_prerequisite), (g_signal_info_get_class_closure), (g_constant_info_get_value): * girepository/ginvoke.c (get_ffi_type): * girepository/girepository.h: * girepository/gmetadata.c (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_constant_blob), (validate_struct_blob), (validate_enum_blob): * girepository/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke.c (main): * tests/roundtrips.sh: * tools/Makefile.am: * tools/compiler.c (format_output), (write_out_metadata), (main): * tools/generate.c (write_type_name), (write_type_info), (write_constant_value), (write_enum_info), (load_metadata), (main): * tools/gidlcompilercontext.c: * tools/gidlcompilercontext.h: * tools/gidlcompilerentrynode.c: * tools/gidlcompilerentrynode.h: * tools/gidlcompilertypenode.c: * tools/gidlcompilertypenode.h: * tools/gidlmodule.c (g_idl_module_build_metadata): * tools/gidlmodule.h: * tools/gidlnode.c (init_stats), (dump_stats), (g_idl_node_get_size), (g_idl_node_get_full_size), (g_idl_node_cmp), (g_idl_node_can_have_member), (g_idl_node_add_member), (g_idl_node_param_direction_string), (parse_int_value), (parse_uint_value), (parse_float_value), (parse_boolean_value), (find_entry_node), (find_entry), (serialize_type), (g_idl_node_build_metadata), (write_string): * tools/gidlnode.h: * tools/gidlparser.c (parse_type_internal): * tools/quote-file.sh: Revert revisions 157,149-148,136-129 and 120. Move back to using g-idl-generate to generate the metadata and avoids dependency on a c compiler. svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
2005-05-09 16:24:46 +02:00
context = g_option_context_new ("");
g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, &error);
if (!input)
{
g_fprintf (stderr, "no input files\n");
return 1;
}
if (includedirs != NULL)
for (i = 0; includedirs[i]; i++)
g_irepository_prepend_search_path (includedirs[i]);
2005-05-09 16:24:46 +02:00
for (i = 0; input[i]; i++)
{
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
GModule *dlhandle = NULL;
const guchar *typelib;
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
gsize len;
const char *namespace;
2005-05-09 16:24:46 +02:00
if (!shlib)
2005-05-09 16:24:46 +02:00
{
if (!g_file_get_contents (input[i], (gchar **)&typelib, &len, &error))
2005-05-09 16:24:46 +02:00
{
g_fprintf (stderr, "failed to read '%s': %s\n",
input[i], error->message);
g_clear_error (&error);
continue;
}
}
else
{
typelib = load_typelib (input[i], &dlhandle, &len);
if (!typelib)
2005-05-09 16:24:46 +02:00
{
g_fprintf (stderr, "failed to load typelib from '%s'\n",
2005-05-09 16:24:46 +02:00
input[i]);
continue;
}
}
if (input[i + 1] && output)
needs_prefix = TRUE;
else
needs_prefix = FALSE;
data = g_typelib_new_from_const_memory (typelib, len);
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
{
GError *error = NULL;
if (!g_typelib_validate (data, &error)) {
g_printerr ("typelib not valid: %s\n", error->message);
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
g_clear_error (&error);
return 1;
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
}
}
namespace = g_irepository_load_typelib (g_irepository_get_default (), data, 0,
&error);
if (namespace == NULL)
{
g_printerr ("failed to load typelib: %s\n", error->message);
return 1;
}
write_repository (namespace, needs_prefix);
2005-05-09 16:24:46 +02:00
if (dlhandle)
{
reviewed by: Johan Dahlin <johan@gnome.org> 2007-12-06 Gustavo J. A. M. Carneiro <gjc@gnome.org> reviewed by: Johan Dahlin <johan@gnome.org> * configure.ac: * gobject-introspection.pc.in: * src/Makefile.am: * src/compiler.c: (format_output), (write_out_metadata), (main): * src/gen-introspect.c: (main): * src/gen-introspect.h: * src/generate.c: (write_callable_info), (write_repository), (load_metadata), (main): * src/gidlmodule.c: (g_idl_module_new), (g_idl_module_build_metadata): * src/gidlmodule.h: * src/gidlparser.c: (start_element_handler): * src/ginfo.c: (g_info_new), (g_info_from_entry), (g_base_info_get_name), (g_base_info_get_namespace), (g_base_info_is_deprecated), (g_base_info_get_annotation), (g_base_info_get_metadata), (g_function_info_get_symbol), (g_function_info_get_flags), (g_function_info_get_property), (g_function_info_get_vfunc), (signature_offset), (g_type_info_new), (g_callable_info_may_return_null), (g_callable_info_get_caller_owns), (g_callable_info_get_n_args), (g_callable_info_get_arg), (g_arg_info_get_direction), (g_arg_info_is_return_value), (g_arg_info_is_dipper), (g_arg_info_is_optional), (g_arg_info_may_be_null), (g_arg_info_get_ownership_transfer), (g_type_info_is_pointer), (g_type_info_get_tag), (g_type_info_get_param_type), (g_type_info_get_interface), (g_type_info_get_array_length), (g_type_info_is_zero_terminated), (g_type_info_get_n_error_domains), (g_type_info_get_error_domain), (g_error_domain_info_get_quark), (g_error_domain_info_get_codes), (g_value_info_get_value), (g_field_info_get_flags), (g_field_info_get_size), (g_field_info_get_offset), (g_registered_type_info_get_type_name), (g_registered_type_info_get_type_init), (g_struct_info_get_n_fields), (g_struct_info_get_field), (g_struct_info_get_n_methods), (g_struct_info_get_method), (find_method), (g_struct_info_find_method), (g_enum_info_get_n_values), (g_enum_info_get_value), (g_object_info_get_parent), (g_object_info_get_type_name), (g_object_info_get_type_init), (g_object_info_get_n_interfaces), (g_object_info_get_interface), (g_object_info_get_n_fields), (g_object_info_get_field), (g_object_info_get_n_properties), (g_object_info_get_property), (g_object_info_get_n_methods), (g_object_info_get_method), (g_object_info_find_method), (g_object_info_get_n_signals), (g_object_info_get_signal), (g_object_info_get_n_vfuncs), (g_object_info_get_vfunc), (g_object_info_get_n_constants), (g_object_info_get_constant), (g_interface_info_get_n_prerequisites), (g_interface_info_get_prerequisite), (g_interface_info_get_n_properties), (g_interface_info_get_property), (g_interface_info_get_n_methods), (g_interface_info_get_method), (g_interface_info_find_method), (g_interface_info_get_n_signals), (g_interface_info_get_signal), (g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc), (g_interface_info_get_n_constants), (g_interface_info_get_constant), (g_property_info_get_flags), (g_signal_info_get_flags), (g_signal_info_get_class_closure), (g_signal_info_true_stops_emit), (g_vfunc_info_get_flags), (g_vfunc_info_get_offset), (g_vfunc_info_get_signal), (g_constant_info_get_value), (g_union_info_get_n_fields), (g_union_info_get_field), (g_union_info_get_n_methods), (g_union_info_get_method), (g_union_info_is_discriminated), (g_union_info_get_discriminator_offset), (g_union_info_get_discriminator): * src/ginvoke.c: (g_function_info_invoke): * src/girepository.c: (g_irepository_register), (g_irepository_unregister), (g_irepository_get_default), (count_interfaces), (g_irepository_get_n_infos), (find_interface), (g_irepository_get_info), (g_irepository_find_by_name), (g_irepository_get_shared_library), (g_irepository_build_search_path), (g_irepository_register_file), (g_irepository_error_quark): * src/girepository.h: * src/gmetadata.c: (g_metadata_get_dir_entry), (g_metadata_check_sanity), (validate_header), (validate_array_type_blob), (validate_iface_type_blob), (validate_param_type_blob), (validate_error_type_blob), (validate_type_blob), (validate_arg_blob), (validate_signature_blob), (validate_function_blob), (validate_callback_blob), (validate_constant_blob), (validate_value_blob), (validate_field_blob), (validate_property_blob), (validate_signal_blob), (validate_vfunc_blob), (validate_struct_blob), (validate_enum_blob), (validate_object_blob), (validate_interface_blob), (validate_errordomain_blob), (validate_union_blob), (validate_blob), (validate_directory), (validate_annotations), (g_metadata_validate), (_g_metadata_init), (g_metadata_new_from_memory), (g_metadata_new_from_const_memory), (g_metadata_new_from_mapped_file), (g_metadata_free), (g_metadata_set_module), (g_metadata_get_namespace): * src/gmetadata.h: * tests/Makefile.am: * tests/invoke/Makefile.am: * tests/invoke/invoke-namespace-find.sh: * tests/invoke/invoke.c: (main): Add a namespace/shared library mapping. fixes #313268. svn path=/trunk/; revision=66
2007-12-06 01:16:15 +01:00
g_module_close (dlhandle);
2005-05-09 16:24:46 +02:00
dlhandle = NULL;
}
/* when writing to stdout, stop after the first module */
if (input[i + 1] && !output)
{
g_fprintf (stderr, "warning, %d modules omitted\n",
g_strv_length (input) - 1);
break;
}
}
return 0;
}