glib/girepository/tools/generate.c

1231 lines
32 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 <dlfcn.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 "gmetadata.h"
2005-05-09 16:24:46 +02:00
gboolean raw = FALSE;
gchar **input = NULL;
gchar *output = NULL;
2005-05-13 00:49:59 +02:00
static void
write_type_name (const gchar *namespace,
GIBaseInfo *info,
FILE *file)
{
if (strcmp (namespace, g_base_info_get_namespace (info)) != 0)
g_fprintf (file, "%s.", g_base_info_get_namespace (info));
g_fprintf (file, "%s", g_base_info_get_name (info));
}
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,
FILE *file)
2005-05-09 16:24:46 +02:00
{
gint tag;
gint i;
GITypeInfo *type;
const gchar* basic[] = {
"void",
"gboolean",
"gint8",
"guint8",
"gint16",
"guint16",
"gint32",
"guint32",
"gint64",
"guint64",
2005-05-21 02:08:27 +02:00
"gint",
"guint",
"glong",
"gulong",
"gssize",
"gsize",
2005-05-09 16:24:46 +02:00
"gfloat",
"gdouble",
2005-05-21 02:08:27 +02:00
"utf8",
"filename"
2005-05-09 16:24:46 +02:00
};
tag = g_type_info_get_tag (info);
if (tag < TYPE_TAG_UTF8)
2005-05-13 00:49:59 +02:00
g_fprintf (file, "%s%s", basic[tag], g_type_info_is_pointer (info) ? "*" : "");
else if (tag <= TYPE_TAG_FILENAME)
2005-05-21 02:08:27 +02:00
g_fprintf (file, "%s", basic[tag]);
else if (tag == TYPE_TAG_ARRAY)
2005-05-09 16:24:46 +02:00
{
gint length;
type = g_type_info_get_param_type (info, 0);
2005-05-13 00:49:59 +02:00
write_type_info (namespace, type, file);
g_fprintf (file, "[");
2005-05-09 16:24:46 +02:00
length = g_type_info_get_array_length (info);
if (length >= 0)
2005-05-13 00:49:59 +02:00
g_fprintf (file, "length=%d", length);
2005-05-09 16:24:46 +02:00
if (g_type_info_is_zero_terminated (info))
2005-05-13 00:49:59 +02:00
g_fprintf (file, "%szero-terminated=1", length >= 0 ? "," : "");
2005-05-09 16:24:46 +02:00
2005-05-13 00:49:59 +02:00
g_fprintf (file, "]");
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)type);
}
else if (tag == TYPE_TAG_SYMBOL)
2005-05-09 16:24:46 +02:00
{
GIBaseInfo *iface = g_type_info_get_interface (info);
2005-05-13 00:49:59 +02:00
write_type_name (namespace, iface, file);
if (g_type_info_is_pointer (info))
g_fprintf (file, "*");
2005-05-09 16:24:46 +02:00
g_base_info_unref (iface);
}
else if (tag == TYPE_TAG_LIST)
2005-05-09 16:24:46 +02:00
{
type = g_type_info_get_param_type (info, 0);
g_fprintf (file, "GList");
if (type)
{
g_fprintf (file, "<");
write_type_info (namespace, type, file);
g_fprintf (file, ">");
g_base_info_unref ((GIBaseInfo *)type);
}
g_fprintf (file, "*");
2005-05-09 16:24:46 +02:00
}
else if (tag == TYPE_TAG_SLIST)
2005-05-09 16:24:46 +02:00
{
type = g_type_info_get_param_type (info, 0);
g_fprintf (file, "GSList");
if (type)
{
g_fprintf (file, "<");
write_type_info (namespace, type, file);
g_fprintf (file, ">");
g_base_info_unref ((GIBaseInfo *)type);
}
g_fprintf (file, "*");
2005-05-09 16:24:46 +02:00
}
else if (tag == TYPE_TAG_HASH)
2005-05-09 16:24:46 +02:00
{
type = g_type_info_get_param_type (info, 0);
g_fprintf (file, "GHashTable");
if (type)
{
g_fprintf (file, "<");
write_type_info (namespace, type, file);
g_base_info_unref ((GIBaseInfo *)type);
type = g_type_info_get_param_type (info, 1);
g_fprintf (file, ",");
write_type_info (namespace, type, file);
g_fprintf (file, ">");
g_base_info_unref ((GIBaseInfo *)type);
}
g_fprintf (file, "*");
2005-05-09 16:24:46 +02:00
}
else if (tag == TYPE_TAG_ERROR)
2005-05-09 16:24:46 +02:00
{
gint n;
g_fprintf (file, "GError");
n = g_type_info_get_n_error_domains (info);
if (n > 0)
2005-05-09 16:24:46 +02:00
{
g_fprintf (file, "<");
for (i = 0; i < n; i++)
{
GIErrorDomainInfo *ed = g_type_info_get_error_domain (info, i);
if (i > 0)
g_fprintf (file, ",");
write_type_name (namespace, (GIBaseInfo *)ed, file);
g_base_info_unref ((GIBaseInfo *)ed);
}
g_fprintf (file, ">");
2005-05-09 16:24:46 +02:00
}
g_fprintf (file, "*");
2005-05-09 16:24:46 +02:00
}
}
static void
write_constant_value (const gchar *namespace,
GITypeInfo *info,
GArgument *argument,
FILE *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,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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);
2005-05-13 00:49:59 +02:00
g_fprintf (file,
" <field name=\"%s\" readable=\"%s\" writable=\"%s\" ",
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)
2005-05-13 00:49:59 +02:00
g_fprintf (file, "bits=\"%d\" ", size);
g_fprintf (file, "offset=\"%d\" ", offset);
2005-05-09 16:24:46 +02:00
2005-05-13 00:49:59 +02:00
g_fprintf (file, "type=\"");
2005-05-09 16:24:46 +02:00
type = g_field_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
g_base_info_unref ((GIBaseInfo *)type);
g_fprintf (file, "\"");
if (branch)
{
g_fprintf (file, " branch=\"");
type = g_constant_info_get_type (branch);
g_constant_info_get_value (branch, &value);
write_constant_value (namespace, type, &value, file);
g_fprintf (file, "\"");
}
g_fprintf (file," />\n");
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,
2005-05-09 16:24:46 +02:00
FILE *file,
gint indent)
{
GITypeInfo *type;
gint i;
g_fprintf (file, "%*s <return-type type=\"", indent, "");
type = g_callable_info_get_return_type (info);
2005-05-13 00:49:59 +02:00
write_type_info (namespace, type, file);
2005-05-09 16:24:46 +02:00
2005-05-13 00:49:59 +02:00
g_fprintf (file, "\"");
if (g_type_info_is_pointer (type))
{
switch (g_callable_info_get_caller_owns (info))
{
case GI_TRANSFER_NOTHING:
g_fprintf (file, " transfer=\"none\"");
break;
case GI_TRANSFER_CONTAINER:
g_fprintf (file, " transfer=\"shallow\"");
break;
case GI_TRANSFER_EVERYTHING:
g_fprintf (file, " transfer=\"full\"");
break;
default:
g_assert_not_reached ();
}
}
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_base_info_unref ((GIBaseInfo *)type);
if (g_callable_info_may_return_null (info))
g_fprintf (file, " null-ok=\"1\"");
g_fprintf (file, " />\n");
2005-05-09 16:24:46 +02:00
if (g_callable_info_get_n_args (info) > 0)
{
g_fprintf (file, "%*s <parameters>\n", indent, "");
for (i = 0; i < g_callable_info_get_n_args (info); i++)
{
GIArgInfo *arg = g_callable_info_get_arg (info, i);
g_fprintf (file, "%*s <parameter name=\"%s\" type=\"",
indent, "", g_base_info_get_name ((GIBaseInfo *) arg));
type = g_arg_info_get_type (arg);
2005-05-13 00:49:59 +02:00
write_type_info (namespace, type, file);
2005-05-09 16:24:46 +02:00
g_fprintf (file, "\"");
if (g_type_info_is_pointer (type))
{
switch (g_arg_info_get_ownership_transfer (arg))
{
case GI_TRANSFER_NOTHING:
g_fprintf (file, " transfer=\"none\"");
break;
case GI_TRANSFER_CONTAINER:
g_fprintf (file, " transfer=\"shallow\"");
break;
case GI_TRANSFER_EVERYTHING:
g_fprintf (file, " transfer=\"full\"");
break;
default:
g_assert_not_reached ();
}
}
g_base_info_unref ((GIBaseInfo *)type);
2005-05-09 16:24:46 +02:00
g_fprintf (file, " direction=\"");
switch (g_arg_info_get_direction (arg))
{
case GI_DIRECTION_IN:
g_fprintf (file, "in");
break;
case GI_DIRECTION_OUT:
g_fprintf (file, "out");
break;
case GI_DIRECTION_INOUT:
g_fprintf (file, "inout");
break;
}
g_fprintf (file, "\"");
if (g_arg_info_may_be_null (arg))
g_fprintf (file, " null-ok=\"1\"");
if (g_arg_info_is_dipper (arg))
g_fprintf (file, " dipper=\"1\"");
if (g_arg_info_is_return_value (arg))
g_fprintf (file, " retval=\"1\"");
if (g_arg_info_is_optional (arg))
g_fprintf (file, " optional=\"1\"");
g_fprintf (file, " />\n");
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)arg);
}
g_fprintf (file, "%*s </parameters>\n", indent, "");
}
}
static void
2005-05-13 00:49:59 +02:00
write_function_info (const gchar *namespace,
GIFunctionInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file,
gint indent)
{
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";
g_fprintf (file, "%*s<%s name=\"%s\" symbol=\"%s\"",
indent, "", tag, name, symbol);
2005-05-09 16:24:46 +02:00
if (flags & GI_FUNCTION_IS_SETTER)
g_fprintf (file, " type=\"setter\"");
else if (flags & GI_FUNCTION_IS_GETTER)
g_fprintf (file, " type=\"getter\"");
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
2005-05-13 00:49:59 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file, indent);
2005-05-09 16:24:46 +02:00
g_fprintf (file, "%*s</%s>\n", indent, "", tag);
}
static void
2005-05-13 00:49:59 +02:00
write_callback_info (const gchar *namespace,
GICallbackInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file,
gint indent)
{
const gchar *name;
gboolean deprecated;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
g_fprintf (file, "%*s<callback name=\"%s\"", indent, "", name);
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
2005-05-13 00:49:59 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file, indent);
2005-05-09 16:24:46 +02:00
g_fprintf (file, "%*s</callback>\n", indent, "");
}
static void
2005-05-13 00:49:59 +02:00
write_struct_info (const gchar *namespace,
GIStructInfo *info,
2005-05-09 16:24:46 +02:00
FILE *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);
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
{
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
g_fprintf (file, " <boxed name=\"%s\" type-name=\"%s\" get-type=\"%s\"", name, type_name, type_init);
2005-05-09 16:24:46 +02:00
}
else
g_fprintf (file, " <struct name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
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);
2005-05-09 16:24:46 +02:00
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);
2005-05-13 00:49:59 +02:00
write_function_info (namespace, function, file, 6);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)function);
}
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
g_fprintf (file, " </boxed>\n");
else
g_fprintf (file, " </struct>\n");
}
static void
2005-05-13 00:49:59 +02:00
write_value_info (const gchar *namespace,
GIValueInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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);
g_fprintf (file, " <member name=\"%s\" value=\"%ld\"", name, value);
2005-05-09 16:24:46 +02:00
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
2005-05-13 00:49:59 +02:00
g_fprintf (file, " />\n");
2005-05-09 16:24:46 +02:00
}
static void
write_constant_value (const gchar *namespace,
GITypeInfo *type,
GArgument *value,
FILE *file)
2005-05-09 16:24:46 +02:00
{
switch (g_type_info_get_tag (type))
{
case GI_TYPE_TAG_BOOLEAN:
g_fprintf (file, "%d", value->v_boolean);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT8:
g_fprintf (file, "%d", value->v_int8);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT8:
g_fprintf (file, "%d", value->v_uint8);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT16:
g_fprintf (file, "%" G_GINT16_FORMAT, value->v_int16);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT16:
g_fprintf (file, "%" G_GUINT16_FORMAT, value->v_uint16);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT32:
g_fprintf (file, "%" G_GINT32_FORMAT, value->v_int32);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT32:
g_fprintf (file, "%" G_GUINT32_FORMAT, value->v_uint32);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT64:
g_fprintf (file, "%" G_GINT64_FORMAT, value->v_int64);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT64:
g_fprintf (file, "%" G_GUINT64_FORMAT, value->v_uint64);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_INT:
g_fprintf (file, "%d", value->v_int);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_UINT:
g_fprintf (file, "%d", value->v_uint);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_LONG:
g_fprintf (file, "%ld", value->v_long);
2005-05-09 16:24:46 +02:00
break;
case GI_TYPE_TAG_ULONG:
g_fprintf (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:
g_fprintf (file, "%zd", value->v_ssize);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_SIZE:
g_fprintf (file, "%zd", value->v_size);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_FLOAT:
g_fprintf (file, "%f", value->v_float);
break;
case GI_TYPE_TAG_DOUBLE:
g_fprintf (file, "%f", value->v_double);
2005-05-21 02:08:27 +02:00
break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
g_fprintf (file, "%s", value->v_string);
break;
case GI_TYPE_TAG_SYMBOL:
g_fprintf (file, "%s", value->v_string);
break;
default:
g_warning ("Could not get type tag for constant");
2005-05-09 16:24:46 +02:00
}
}
static void
write_constant_info (const gchar *namespace,
GIConstantInfo *info,
FILE *file,
gint indent)
{
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);
g_fprintf (file, "%*s<constant name=\"%s\" type=\"", indent, "", name);
type = g_constant_info_get_type (info);
write_type_info (namespace, type, file);
g_fprintf (file, "\" value=\"");
g_constant_info_get_value (info, &value);
write_constant_value (namespace, type, &value, file);
2005-05-09 16:24:46 +02:00
g_fprintf (file, "\" />\n");
g_base_info_unref ((GIBaseInfo *)type);
}
static void
2005-05-13 00:49:59 +02:00
write_enum_info (const gchar *namespace,
GIEnumInfo *info,
FILE *file)
2005-05-09 16:24:46 +02:00
{
const gchar *name;
const gchar *type_name = NULL;
const gchar *type_init = NULL;
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);
/* Make sure this is a registered enum before filling out the
* GType information
*/
if (g_enum_info_is_registered ((GIEnumInfo *)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_ENUM)
g_fprintf (file, " <enum ");
else
g_fprintf (file, " <flags ");
g_fprintf (file, "name=\"%s\"", name);
2005-05-09 16:24:46 +02:00
if (type_init)
g_fprintf (file, " type-name=\"%s\" get-type=\"%s\"", type_name, type_init);
2005-05-09 16:24:46 +02:00
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
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);
}
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_ENUM)
g_fprintf (file, " </enum>\n");
else
g_fprintf (file, " </flags>\n");
}
static void
2005-05-13 00:49:59 +02:00
write_signal_info (const gchar *namespace,
GISignalInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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);
g_fprintf (file, " <signal name=\"%s\"", name);
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
if (flags & G_SIGNAL_RUN_FIRST)
g_fprintf (file, " when=\"FIRST\"");
else if (flags & G_SIGNAL_RUN_LAST)
g_fprintf (file, " when=\"LAST\"");
else if (flags & G_SIGNAL_RUN_CLEANUP)
g_fprintf (file, " when=\"CLEANUP\"");
if (flags & G_SIGNAL_NO_RECURSE)
g_fprintf (file, " no-recurse=\"1\"");
if (flags & G_SIGNAL_DETAILED)
g_fprintf (file, " detailed=\"1\"");
if (flags & G_SIGNAL_ACTION)
g_fprintf (file, " action=\"1\"");
if (flags & G_SIGNAL_NO_HOOKS)
g_fprintf (file, " no-hooks=\"1\"");
g_fprintf (file, ">\n");
2005-05-13 00:49:59 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file, 6);
2005-05-09 16:24:46 +02:00
g_fprintf (file, " </signal>\n");
}
static void
2005-05-13 00:49:59 +02:00
write_vfunc_info (const gchar *namespace,
GIVFuncInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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
g_fprintf (file, " <vfunc name=\"%s\"", name);
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
if (flags & GI_VFUNC_MUST_CHAIN_UP)
g_fprintf (file, " must-chain-up=\"1\"");
if (flags & GI_VFUNC_MUST_OVERRIDE)
g_fprintf (file, " override=\"always\"");
else if (flags & GI_VFUNC_MUST_NOT_OVERRIDE)
g_fprintf (file, " override=\"never\"");
g_fprintf (file, " offset=\"%d\"", offset);
2005-05-09 16:24:46 +02:00
g_fprintf (file, ">\n");
2005-05-13 00:49:59 +02:00
write_callable_info (namespace, (GICallableInfo*)info, file, 6);
2005-05-09 16:24:46 +02:00
g_fprintf (file, " </vfunc>\n");
}
static void
2005-05-13 00:49:59 +02:00
write_property_info (const gchar *namespace,
GIPropertyInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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);
g_fprintf (file, " <property name=\"%s\"", name);
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
if (flags & G_PARAM_READABLE)
g_fprintf (file, " readable=\"1\"");
else
g_fprintf (file, " readable=\"0\"");
if (flags & G_PARAM_WRITABLE)
g_fprintf (file, " writable=\"1\"");
else
g_fprintf (file, " writable=\"0\"");
if (flags & G_PARAM_CONSTRUCT)
g_fprintf (file, " construct=\"1\"");
if (flags & G_PARAM_CONSTRUCT_ONLY)
g_fprintf (file, " construct-only=\"1\"");
type = g_property_info_get_type (info);
g_fprintf (file, " type=\"");
2005-05-13 00:49:59 +02:00
write_type_info (namespace, type, file);
2005-05-09 16:24:46 +02:00
g_fprintf (file, "\"");
g_fprintf (file, " />\n");
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,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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);
g_fprintf (file, " <object name=\"%s\"", name);
2005-05-13 00:49:59 +02:00
pnode = g_object_info_get_parent (info);
if (pnode)
{
g_fprintf (file, " parent=\"");
write_type_name (namespace, (GIBaseInfo *)pnode, file);
g_fprintf (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
g_fprintf (file, " type-name=\"%s\" get-type=\"%s\"", type_name, type_init);
2005-05-09 16:24:46 +02:00
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
if (g_object_info_get_n_interfaces (info) > 0)
{
g_fprintf (file, " <implements>\n");
for (i = 0; i < g_object_info_get_n_interfaces (info); i++)
{
GIInterfaceInfo *imp = g_object_info_get_interface (info, i);
2005-05-13 00:49:59 +02:00
g_fprintf (file, " <interface name=\"");
write_type_name (namespace, (GIBaseInfo*)imp, file);
g_fprintf (file,"\" />\n");
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo*)imp);
}
g_fprintf (file, " </implements>\n");
}
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);
2005-05-13 00:49:59 +02:00
write_function_info (namespace, function, file, 6);
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);
2005-05-13 00:49:59 +02:00
write_constant_info (namespace, constant, file, 6);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)constant);
}
g_fprintf (file, " </object>\n");
}
static void
2005-05-13 00:49:59 +02:00
write_interface_info (const gchar *namespace,
GIInterfaceInfo *info,
2005-05-09 16:24:46 +02:00
FILE *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);
g_fprintf (file, " <interface name=\"%s\" type-name=\"%s\" get-type=\"%s\"",
2005-05-09 16:24:46 +02:00
name, type_name, type_init);
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
if (g_interface_info_get_n_prerequisites (info) > 0)
{
g_fprintf (file, " <requires>\n");
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)
2005-05-13 00:49:59 +02:00
g_fprintf (file, " <interface name=\"");
2005-05-09 16:24:46 +02:00
else
2005-05-13 00:49:59 +02:00
g_fprintf (file, " <object name=\"");
write_type_name (namespace, req, file);
g_fprintf (file, "\" />\n");
2005-05-09 16:24:46 +02:00
g_base_info_unref (req);
}
g_fprintf (file, " </requires>\n");
}
for (i = 0; i < g_interface_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = g_interface_info_get_method (info, i);
2005-05-13 00:49:59 +02:00
write_function_info (namespace, function, file, 6);
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);
2005-05-13 00:49:59 +02:00
write_constant_info (namespace, constant, file, 6);
2005-05-09 16:24:46 +02:00
g_base_info_unref ((GIBaseInfo *)constant);
}
g_fprintf (file, " </interface>\n");
}
static void
2005-05-13 00:49:59 +02:00
write_error_domain_info (const gchar *namespace,
GIErrorDomainInfo *info,
2005-05-09 16:24:46 +02:00
FILE *file)
{
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);
g_fprintf (file,
2005-05-13 00:49:59 +02:00
" <errordomain name=\"%s\" get-quark=\"%s\" codes=\"",
name, quark);
write_type_name (namespace, enum_, file);
g_fprintf (file, "\" />\n");
g_base_info_unref (enum_);
2005-05-09 16:24:46 +02:00
}
static void
write_union_info (const gchar *namespace,
GIUnionInfo *info,
FILE *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);
g_fprintf (file, " <union name=\"%s\"", name);
if (type_name)
g_fprintf (file, " type-name=\"%s\" get-type=\"%s\"", type_name, type_init);
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
g_fprintf (file, ">\n");
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);
g_fprintf (file, " <discriminator offset=\"%d\" type=\"", offset);
write_type_info (namespace, type, file);
g_fprintf (file, "\" />\n");
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, 6);
g_base_info_unref ((GIBaseInfo *)function);
}
g_fprintf (file, " </union>\n");
}
2005-05-09 16:24:46 +02:00
static void
write_repository (GIRepository *repository,
gboolean needs_prefix)
{
FILE *file;
gchar **namespaces;
2005-05-13 00:49:59 +02:00
gchar *ns;
2005-05-09 16:24:46 +02:00
gint i, j;
namespaces = g_irepository_get_namespaces (repository);
if (output == NULL)
file = stdout;
else
{
gchar *filename;
if (needs_prefix)
filename = g_strdup_printf ("%s-%s", namespaces[0], output);
else
filename = g_strdup (output);
file = g_fopen (filename, "w");
if (file == NULL)
{
g_fprintf (stderr, "failed to open '%s': %s\n",
filename, g_strerror (errno));
g_free (filename);
return;
}
g_free (filename);
}
g_fprintf (file, "<?xml version=\"1.0\"?>\n");
g_fprintf (file, "<api version=\"1.0\">\n");
for (i = 0; namespaces[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
const gchar *shared_library;
2005-05-13 00:49:59 +02:00
ns = namespaces[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
shared_library = g_irepository_get_shared_library (repository, ns);
if (shared_library)
g_fprintf (file, " <namespace name=\"%s\" shared-library=\"%s\">\n",
ns, shared_library);
else
g_fprintf (file, " <namespace name=\"%s\">\n", ns);
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:
2005-05-13 00:49:59 +02:00
write_function_info (ns, (GIFunctionInfo *)info, file, 4);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_CALLBACK:
2005-05-13 00:49:59 +02:00
write_callback_info (ns, (GICallbackInfo *)info, file, 4);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_BOXED:
2005-05-13 00:49:59 +02:00
write_struct_info (ns, (GIStructInfo *)info, file);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_UNION:
write_union_info (ns, (GIUnionInfo *)info, file);
break;
2005-05-09 16:24:46 +02:00
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
2005-05-13 00:49:59 +02:00
write_enum_info (ns, (GIEnumInfo *)info, file);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_CONSTANT:
2005-05-13 00:49:59 +02:00
write_constant_info (ns, (GIConstantInfo *)info, file, 4);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_OBJECT:
2005-05-13 00:49:59 +02:00
write_object_info (ns, (GIObjectInfo *)info, file);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_INTERFACE:
2005-05-13 00:49:59 +02:00
write_interface_info (ns, (GIInterfaceInfo *)info, file);
2005-05-09 16:24:46 +02:00
break;
case GI_INFO_TYPE_ERROR_DOMAIN:
2005-05-13 00:49:59 +02:00
write_error_domain_info (ns, (GIErrorDomainInfo *)info, file);
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);
}
g_fprintf (file, " </namespace>\n");
}
g_fprintf (file, "</api>\n");
if (output != NULL)
fclose (file);
g_strfreev (namespaces);
}
static GOptionEntry options[] =
{
{ "raw", 0, 0, G_OPTION_ARG_NONE, &raw, "handle raw metadata", NULL },
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
{ NULL, }
};
static const guchar *
load_metadata (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
{
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
guchar *metadata;
gsize *metadata_size;
GModule *handle;
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
handle = g_module_open (filename, G_MODULE_BIND_LOCAL|G_MODULE_BIND_LAZY);
if (!g_module_symbol (handle, "_G_METADATA", (gpointer *) &metadata))
{
g_printerr ("Could not load metadata from '%s': %s\n",
filename, g_module_error ());
return NULL;
}
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
if (!g_module_symbol (handle, "_G_METADATA_SIZE", (gpointer *) &metadata_size))
{
g_printerr ("Could not load metadata from '%s': %s\n",
filename, g_module_error ());
return NULL;
}
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
*len = *metadata_size;
2005-05-09 16:24:46 +02:00
if (dlhandle)
*dlhandle = handle;
return metadata;
}
int
main (int argc, char *argv[])
{
GOptionContext *context;
GError *error = NULL;
gboolean needs_prefix;
gint 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
GMetadata *data;
2005-05-09 16:24:46 +02:00
g_type_init ();
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;
}
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;
2005-05-09 16:24:46 +02:00
const guchar *metadata;
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;
2005-05-09 16:24:46 +02:00
if (raw)
{
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 (!g_file_get_contents (input[i], (gchar **)&metadata, &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
{
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
metadata = load_metadata (input[i], &dlhandle, &len);
2005-05-09 16:24:46 +02:00
if (!metadata)
{
g_fprintf (stderr, "failed to load metadata from '%s'\n",
input[i]);
continue;
}
}
if (input[i + 1] && output)
needs_prefix = TRUE;
else
needs_prefix = FALSE;
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
data = g_metadata_new_from_const_memory (metadata, len);
{
GError *error = NULL;
if (!g_metadata_validate (data, &error)) {
g_printerr ("metadata not valid: %s\n", error->message);
g_clear_error (&error);
}
}
g_irepository_register (g_irepository_get_default (), data);
2005-05-09 16:24:46 +02:00
write_repository (g_irepository_get_default (), needs_prefix);
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_irepository_unregister (g_irepository_get_default (),
g_metadata_get_namespace (data));
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;
}