2024-01-16 08:21:02 +01:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/* GObject introspection: Typelib compiler
|
2024-01-26 11:24:39 +01:00
|
|
|
*
|
2005-05-09 16:24:46 +02:00
|
|
|
*
|
2024-01-16 08:21:02 +01:00
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
2005-05-09 16:24:46 +02:00
|
|
|
* Copyright (C) 2005 Matthias Clasen
|
2024-01-16 08:21:02 +01:00
|
|
|
* Copyright (C) 2024 GNOME Foundation
|
2005-05-09 16:24:46 +02:00
|
|
|
*
|
|
|
|
* 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
|
2024-01-16 08:21:02 +01:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2005-05-09 16:24:46 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2024-01-16 08:21:02 +01:00
|
|
|
* You should have received a copy of the GNU Lesser General
|
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2005-05-09 16:24:46 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <errno.h>
|
2016-01-11 06:35:34 +01:00
|
|
|
#include <locale.h>
|
Hush compiler warnings about return values, signedness mismatches, unused
* src/compiler.c, src/generate.c, src/gidlnode.c,
src/gidlparser.c, src/ginfo.c, src/girepository.c,
tests/invoke/invoke.c, test/invoke/testfns.c: Hush compiler
warnings about return values, signedness mismatches, unused
variables, and unhandles enum values in switch statements.
* tests/invoke/Makefile.am: Don't install the invoke test program.
Add -I ../../src to the cflags used for the test functions files.
2006-10-03 16:38:07 +02:00
|
|
|
#include <string.h>
|
2005-05-09 16:24:46 +02:00
|
|
|
|
2009-06-09 20:03:47 +02:00
|
|
|
#include <gio/gio.h>
|
2024-01-16 08:21:02 +01:00
|
|
|
#include <girepository.h>
|
2024-01-26 11:24:39 +01:00
|
|
|
#include <glib.h>
|
|
|
|
#include <glib/gstdio.h>
|
2005-05-09 16:24:46 +02:00
|
|
|
|
2008-08-28 18:55:37 +02:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
#include <fcntl.h>
|
2024-01-26 11:24:39 +01:00
|
|
|
#include <io.h>
|
2008-08-28 18:55:37 +02:00
|
|
|
#endif
|
|
|
|
|
2024-01-16 08:21:02 +01:00
|
|
|
#include "girmodule-private.h"
|
|
|
|
#include "girnode-private.h"
|
|
|
|
#include "girparser-private.h"
|
2005-05-09 16:24:46 +02:00
|
|
|
|
2024-02-14 11:23:03 +01:00
|
|
|
static gchar **includedirs = NULL;
|
|
|
|
static gchar **input = NULL;
|
|
|
|
static gchar *output = NULL;
|
|
|
|
static gchar **shlibs = NULL;
|
|
|
|
static gboolean debug = FALSE;
|
|
|
|
static gboolean verbose = FALSE;
|
|
|
|
static gboolean show_version = FALSE;
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
2010-12-22 21:40:53 +01:00
|
|
|
static gboolean
|
2024-01-26 11:24:39 +01:00
|
|
|
write_out_typelib (gchar *prefix,
|
|
|
|
GITypelib *typelib)
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
{
|
|
|
|
FILE *file;
|
2009-02-21 03:58:22 +01:00
|
|
|
gsize written;
|
2009-06-09 20:03:47 +02:00
|
|
|
GFile *file_obj;
|
|
|
|
gchar *filename;
|
|
|
|
GFile *tmp_file_obj;
|
|
|
|
gchar *tmp_filename;
|
|
|
|
GError *error = NULL;
|
2010-12-22 21:40:53 +01:00
|
|
|
gboolean success = FALSE;
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
|
|
|
if (output == NULL)
|
2008-08-28 18:55:37 +02:00
|
|
|
{
|
|
|
|
file = stdout;
|
2009-06-12 17:52:56 +02:00
|
|
|
file_obj = NULL;
|
2009-06-09 20:03:47 +02:00
|
|
|
filename = NULL;
|
|
|
|
tmp_filename = NULL;
|
2009-06-12 17:52:56 +02:00
|
|
|
tmp_file_obj = NULL;
|
2008-08-28 18:55:37 +02:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
setmode (fileno (file), _O_BINARY);
|
|
|
|
#endif
|
|
|
|
}
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (prefix)
|
2024-01-26 11:24:39 +01:00
|
|
|
{
|
|
|
|
filename = g_strdup_printf ("%s-%s", prefix, output);
|
|
|
|
}
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
else
|
2024-01-26 11:24:39 +01:00
|
|
|
{
|
|
|
|
filename = g_strdup (output);
|
|
|
|
}
|
2009-06-09 20:03:47 +02:00
|
|
|
file_obj = g_file_new_for_path (filename);
|
|
|
|
tmp_filename = g_strdup_printf ("%s.tmp", filename);
|
|
|
|
tmp_file_obj = g_file_new_for_path (tmp_filename);
|
|
|
|
file = g_fopen (tmp_filename, "wb");
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
|
|
|
if (file == NULL)
|
2024-01-26 11:24:39 +01:00
|
|
|
{
|
2010-12-22 21:40:53 +01:00
|
|
|
g_fprintf (stderr, "failed to open '%s': %s\n",
|
|
|
|
tmp_filename, g_strerror (errno));
|
|
|
|
goto out;
|
2024-01-26 11:24:39 +01:00
|
|
|
}
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
}
|
|
|
|
|
2010-08-17 18:45:25 +02:00
|
|
|
written = fwrite (typelib->data, 1, typelib->len, file);
|
2024-01-26 11:24:39 +01:00
|
|
|
if (written < typelib->len)
|
|
|
|
{
|
|
|
|
g_fprintf (stderr, "ERROR: Could not write the whole output: %s",
|
|
|
|
strerror (errno));
|
|
|
|
goto out;
|
|
|
|
}
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
|
|
|
if (output != NULL)
|
2009-06-09 20:03:47 +02:00
|
|
|
fclose (file);
|
|
|
|
if (tmp_filename != NULL)
|
|
|
|
{
|
|
|
|
if (!g_file_move (tmp_file_obj, file_obj, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error))
|
|
|
|
{
|
2024-01-26 11:24:39 +01:00
|
|
|
g_fprintf (stderr, "ERROR: failed to rename %s to %s: %s", tmp_filename, filename, error->message);
|
2009-06-09 20:03:47 +02:00
|
|
|
g_clear_error (&error);
|
2024-01-26 11:24:39 +01:00
|
|
|
goto out;
|
2009-06-09 20:03:47 +02:00
|
|
|
}
|
|
|
|
}
|
2010-12-22 21:40:53 +01:00
|
|
|
success = TRUE;
|
2009-06-09 20:03:47 +02:00
|
|
|
out:
|
2021-05-20 14:58:13 +02:00
|
|
|
g_clear_object (&file_obj);
|
|
|
|
g_clear_object (&tmp_file_obj);
|
2009-06-09 20:03:47 +02:00
|
|
|
g_free (filename);
|
|
|
|
g_free (tmp_filename);
|
2010-12-22 21:40:53 +01:00
|
|
|
|
|
|
|
return success;
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
}
|
|
|
|
|
2024-02-14 11:36:23 +01:00
|
|
|
static GLogLevelFlags logged_levels;
|
2005-05-11 21:31:37 +02:00
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
static void
|
|
|
|
log_handler (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *message,
|
|
|
|
gpointer user_data)
|
2005-05-11 21:31:37 +02:00
|
|
|
{
|
|
|
|
if (log_level & logged_levels)
|
|
|
|
g_log_default_handler (log_domain, log_level, message, user_data);
|
|
|
|
}
|
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
static GOptionEntry options[] = {
|
|
|
|
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
|
|
|
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
|
|
|
|
{ "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, "shared library", "FILE" },
|
|
|
|
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "show debug messages", NULL },
|
|
|
|
{ "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", NULL },
|
2018-12-16 13:42:27 +01:00
|
|
|
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "show program's version number and exit", NULL },
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
|
2024-01-16 08:21:02 +01:00
|
|
|
G_OPTION_ENTRY_NULL
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
};
|
|
|
|
|
2005-05-09 16:24:46 +02:00
|
|
|
int
|
2024-01-26 11:24:39 +01:00
|
|
|
main (int argc, char **argv)
|
2005-05-09 16:24:46 +02:00
|
|
|
{
|
|
|
|
GOptionContext *context;
|
|
|
|
GError *error = NULL;
|
2024-01-16 08:21:02 +01:00
|
|
|
GIIrParser *parser;
|
|
|
|
GIIrModule *module;
|
2005-05-09 16:24:46 +02:00
|
|
|
|
2016-01-11 06:35:34 +01:00
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
|
2005-05-09 16:24:46 +02:00
|
|
|
context = g_option_context_new ("");
|
|
|
|
g_option_context_add_main_entries (context, options, NULL);
|
|
|
|
g_option_context_parse (context, &argc, &argv, &error);
|
2005-05-10 05:52:16 +02:00
|
|
|
g_option_context_free (context);
|
2005-05-09 16:24:46 +02:00
|
|
|
|
2015-08-04 04:22:43 +02:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_fprintf (stderr, "error parsing arguments: %s\n", error->message);
|
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
logged_levels = G_LOG_LEVEL_MASK & ~(G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_DEBUG);
|
2005-05-11 21:31:37 +02:00
|
|
|
if (debug)
|
|
|
|
logged_levels = logged_levels | G_LOG_LEVEL_DEBUG;
|
|
|
|
if (verbose)
|
|
|
|
logged_levels = logged_levels | G_LOG_LEVEL_MESSAGE;
|
Merge in the gir-compiler branch. Thanks to Philip and Colin for their
2008-08-08 Johan Dahlin <johan@gnome.org>
* girepository/gtypelib.c (validate_header):
* girepository/gtypelib.h:
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/sourcescanner.c (gi_source_symbol_ref),
(gi_source_symbol_unref):
* tests/array.test:
* tests/boxed.test:
* tests/constant.test:
* tests/enum.test:
* tests/errors.test:
* tests/function.test:
* tests/gobject.test:
* tests/interface.test:
* tests/invoke/Makefile.am:
* tests/invoke/testfns.xml:
* tests/object.test:
* tests/parser/Makefile.am:
* tests/roundtrips.sh:
* tests/struct.test:
* tests/types.test:
* tests/union.test:
* tests/xref1.test:
* tests/xref2.test:
* tools/Makefile.am:
* tools/compiler.c (main):
* tools/generate.c (write_callable_info), (write_function_info),
(write_repository):
* tools/gidlmodule.c:
* tools/gidlmodule.h:
* tools/gidlnode.c:
* tools/gidlnode.h:
* tools/gidlparser.c:
* tools/gidlparser.h:
* tools/gidlwriter.c:
* tools/gidlwriter.h:
* tools/scanner.c (create_node_from_gtype),
(create_node_from_ctype), (g_igenerator_process_properties),
(g_igenerator_process_signals), (g_igenerator_create_object),
(g_igenerator_create_interface), (g_igenerator_create_boxed),
(g_igenerator_create_enum), (g_igenerator_create_flags),
(g_igenerator_process_function_symbol),
(g_igenerator_process_unregistered_struct_typedef),
(g_igenerator_process_struct_typedef),
(g_igenerator_process_union_typedef),
(g_igenerator_process_enum_typedef),
(g_igenerator_process_function_typedef),
(g_igenerator_process_constant), (g_igenerator_process_symbols),
(g_igenerator_add_module), (g_igenerator_add_include_idl):
Merge in the gir-compiler branch.
Thanks to Philip and Colin for their help.
svn path=/trunk/; revision=325
2008-08-08 21:09:17 +02:00
|
|
|
g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);
|
2005-05-11 21:31:37 +02:00
|
|
|
|
2005-05-10 19:43:21 +02:00
|
|
|
g_log_set_default_handler (log_handler, NULL);
|
|
|
|
|
2018-12-16 13:42:27 +01:00
|
|
|
if (show_version)
|
|
|
|
{
|
2024-01-16 08:21:02 +01:00
|
|
|
g_printf ("gi-compile-repository %u.%u.%u\n",
|
|
|
|
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
2018-12-16 13:42:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
if (!input)
|
|
|
|
{
|
|
|
|
g_fprintf (stderr, "no input files\n");
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
2005-05-09 16:24:46 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
g_debug ("[parsing] start, %d includes",
|
|
|
|
includedirs ? g_strv_length (includedirs) : 0);
|
Merge in the gir-compiler branch. Thanks to Philip and Colin for their
2008-08-08 Johan Dahlin <johan@gnome.org>
* girepository/gtypelib.c (validate_header):
* girepository/gtypelib.h:
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/sourcescanner.c (gi_source_symbol_ref),
(gi_source_symbol_unref):
* tests/array.test:
* tests/boxed.test:
* tests/constant.test:
* tests/enum.test:
* tests/errors.test:
* tests/function.test:
* tests/gobject.test:
* tests/interface.test:
* tests/invoke/Makefile.am:
* tests/invoke/testfns.xml:
* tests/object.test:
* tests/parser/Makefile.am:
* tests/roundtrips.sh:
* tests/struct.test:
* tests/types.test:
* tests/union.test:
* tests/xref1.test:
* tests/xref2.test:
* tools/Makefile.am:
* tools/compiler.c (main):
* tools/generate.c (write_callable_info), (write_function_info),
(write_repository):
* tools/gidlmodule.c:
* tools/gidlmodule.h:
* tools/gidlnode.c:
* tools/gidlnode.h:
* tools/gidlparser.c:
* tools/gidlparser.h:
* tools/gidlwriter.c:
* tools/gidlwriter.h:
* tools/scanner.c (create_node_from_gtype),
(create_node_from_ctype), (g_igenerator_process_properties),
(g_igenerator_process_signals), (g_igenerator_create_object),
(g_igenerator_create_interface), (g_igenerator_create_boxed),
(g_igenerator_create_enum), (g_igenerator_create_flags),
(g_igenerator_process_function_symbol),
(g_igenerator_process_unregistered_struct_typedef),
(g_igenerator_process_struct_typedef),
(g_igenerator_process_union_typedef),
(g_igenerator_process_enum_typedef),
(g_igenerator_process_function_typedef),
(g_igenerator_process_constant), (g_igenerator_process_symbols),
(g_igenerator_add_module), (g_igenerator_add_include_idl):
Merge in the gir-compiler branch.
Thanks to Philip and Colin for their help.
svn path=/trunk/; revision=325
2008-08-08 21:09:17 +02:00
|
|
|
|
2024-01-16 08:21:02 +01:00
|
|
|
parser = gi_ir_parser_new ();
|
2024-02-14 11:36:23 +01:00
|
|
|
gi_ir_parser_set_debug (parser, logged_levels);
|
2008-11-12 18:16:42 +01:00
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
gi_ir_parser_set_includes (parser, (const char *const *) includedirs);
|
2008-11-12 18:16:42 +01:00
|
|
|
|
2024-01-16 08:21:02 +01:00
|
|
|
module = gi_ir_parser_parse_file (parser, input[0], &error);
|
2024-01-26 11:24:39 +01:00
|
|
|
if (module == NULL)
|
2005-05-09 16:24:46 +02:00
|
|
|
{
|
2024-01-26 11:24:39 +01:00
|
|
|
g_fprintf (stderr, "error parsing file %s: %s\n",
|
|
|
|
input[0], error->message);
|
|
|
|
|
2010-07-26 22:26:46 +02:00
|
|
|
return 1;
|
2005-05-09 16:24:46 +02:00
|
|
|
}
|
|
|
|
|
Merge in the gir-compiler branch. Thanks to Philip and Colin for their
2008-08-08 Johan Dahlin <johan@gnome.org>
* girepository/gtypelib.c (validate_header):
* girepository/gtypelib.h:
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/sourcescanner.c (gi_source_symbol_ref),
(gi_source_symbol_unref):
* tests/array.test:
* tests/boxed.test:
* tests/constant.test:
* tests/enum.test:
* tests/errors.test:
* tests/function.test:
* tests/gobject.test:
* tests/interface.test:
* tests/invoke/Makefile.am:
* tests/invoke/testfns.xml:
* tests/object.test:
* tests/parser/Makefile.am:
* tests/roundtrips.sh:
* tests/struct.test:
* tests/types.test:
* tests/union.test:
* tests/xref1.test:
* tests/xref2.test:
* tools/Makefile.am:
* tools/compiler.c (main):
* tools/generate.c (write_callable_info), (write_function_info),
(write_repository):
* tools/gidlmodule.c:
* tools/gidlmodule.h:
* tools/gidlnode.c:
* tools/gidlnode.h:
* tools/gidlparser.c:
* tools/gidlparser.h:
* tools/gidlwriter.c:
* tools/gidlwriter.h:
* tools/scanner.c (create_node_from_gtype),
(create_node_from_ctype), (g_igenerator_process_properties),
(g_igenerator_process_signals), (g_igenerator_create_object),
(g_igenerator_create_interface), (g_igenerator_create_boxed),
(g_igenerator_create_enum), (g_igenerator_create_flags),
(g_igenerator_process_function_symbol),
(g_igenerator_process_unregistered_struct_typedef),
(g_igenerator_process_struct_typedef),
(g_igenerator_process_union_typedef),
(g_igenerator_process_enum_typedef),
(g_igenerator_process_function_typedef),
(g_igenerator_process_constant), (g_igenerator_process_symbols),
(g_igenerator_add_module), (g_igenerator_add_include_idl):
Merge in the gir-compiler branch.
Thanks to Philip and Colin for their help.
svn path=/trunk/; revision=325
2008-08-08 21:09:17 +02:00
|
|
|
g_debug ("[parsing] done");
|
|
|
|
|
|
|
|
g_debug ("[building] start");
|
|
|
|
|
2010-07-26 22:26:46 +02:00
|
|
|
{
|
2024-02-07 15:38:05 +01:00
|
|
|
GITypelib *typelib = NULL;
|
2024-01-26 11:24:39 +01:00
|
|
|
|
|
|
|
if (shlibs)
|
|
|
|
{
|
|
|
|
if (module->shared_library)
|
|
|
|
g_free (module->shared_library);
|
|
|
|
module->shared_library = g_strjoinv (",", shlibs);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_debug ("[building] module %s", module->name);
|
|
|
|
|
|
|
|
typelib = gi_ir_module_build_typelib (module);
|
|
|
|
if (typelib == NULL)
|
|
|
|
g_error ("Failed to build typelib for module '%s'\n", module->name);
|
|
|
|
if (!gi_typelib_validate (typelib, &error))
|
|
|
|
g_error ("Invalid typelib for module '%s': %s",
|
|
|
|
module->name, error->message);
|
|
|
|
|
|
|
|
if (!write_out_typelib (NULL, typelib))
|
|
|
|
return 1;
|
2024-02-07 15:38:05 +01:00
|
|
|
|
|
|
|
g_clear_pointer (&typelib, gi_typelib_unref);
|
2024-01-26 11:24:39 +01:00
|
|
|
}
|
Merge in the gir-compiler branch. Thanks to Philip and Colin for their
2008-08-08 Johan Dahlin <johan@gnome.org>
* girepository/gtypelib.c (validate_header):
* girepository/gtypelib.h:
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/sourcescanner.c (gi_source_symbol_ref),
(gi_source_symbol_unref):
* tests/array.test:
* tests/boxed.test:
* tests/constant.test:
* tests/enum.test:
* tests/errors.test:
* tests/function.test:
* tests/gobject.test:
* tests/interface.test:
* tests/invoke/Makefile.am:
* tests/invoke/testfns.xml:
* tests/object.test:
* tests/parser/Makefile.am:
* tests/roundtrips.sh:
* tests/struct.test:
* tests/types.test:
* tests/union.test:
* tests/xref1.test:
* tests/xref2.test:
* tools/Makefile.am:
* tools/compiler.c (main):
* tools/generate.c (write_callable_info), (write_function_info),
(write_repository):
* tools/gidlmodule.c:
* tools/gidlmodule.h:
* tools/gidlnode.c:
* tools/gidlnode.h:
* tools/gidlparser.c:
* tools/gidlparser.h:
* tools/gidlwriter.c:
* tools/gidlwriter.h:
* tools/scanner.c (create_node_from_gtype),
(create_node_from_ctype), (g_igenerator_process_properties),
(g_igenerator_process_signals), (g_igenerator_create_object),
(g_igenerator_create_interface), (g_igenerator_create_boxed),
(g_igenerator_create_enum), (g_igenerator_create_flags),
(g_igenerator_process_function_symbol),
(g_igenerator_process_unregistered_struct_typedef),
(g_igenerator_process_struct_typedef),
(g_igenerator_process_union_typedef),
(g_igenerator_process_enum_typedef),
(g_igenerator_process_function_typedef),
(g_igenerator_process_constant), (g_igenerator_process_symbols),
(g_igenerator_add_module), (g_igenerator_add_include_idl):
Merge in the gir-compiler branch.
Thanks to Philip and Colin for their help.
svn path=/trunk/; revision=325
2008-08-08 21:09:17 +02:00
|
|
|
|
|
|
|
g_debug ("[building] done");
|
|
|
|
|
2008-11-12 18:16:42 +01:00
|
|
|
#if 0
|
|
|
|
/* No point */
|
2024-01-16 08:21:02 +01:00
|
|
|
gi_ir_parser_free (parser);
|
2024-01-26 11:24:39 +01:00
|
|
|
#endif
|
2008-11-12 18:16:42 +01:00
|
|
|
|
2024-01-26 11:24:39 +01:00
|
|
|
return 0;
|
2005-05-09 16:24:46 +02:00
|
|
|
}
|