[glibmm/gmmproc-refactor] Add wrap_init.cc generation.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/gmmproc-refactor] Add wrap_init.cc generation.
- Date: Sun, 24 Jun 2012 19:52:17 +0000 (UTC)
commit 16ccfd4bb15ec0083c28fb028e0d3c51b43fa31a
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Mon Jun 25 01:13:33 2012 +0200
Add wrap_init.cc generation.
tools/gmmproc.in | 11 ++-
tools/pm/Common/Gmmproc.pm | 161 ++++++++++++++++++++++++++++++++++-
tools/pm/Common/TokensStore.pm | 17 ++++-
tools/pm/Common/WrapInit.pm | 27 ++++++
tools/pm/Common/WrapInit/Base.pm | 107 +++++++++++++++++++++++
tools/pm/Common/WrapInit/GError.pm | 48 ++++++++++
tools/pm/Common/WrapInit/GObject.pm | 57 ++++++++++++
tools/pm/Common/WrapParser.pm | 155 +++++++++++++++++++++++++++++++++-
8 files changed, 575 insertions(+), 8 deletions(-)
---
diff --git a/tools/gmmproc.in b/tools/gmmproc.in
index db310ca..8e61482 100644
--- a/tools/gmmproc.in
+++ b/tools/gmmproc.in
@@ -89,6 +89,10 @@ Options:
-m module
--mm-module module Specify a name of mm module. Examples: glibmm, gtkmm.
+ -w namespace
+ --wrap-init-namespace Specify a namespace in which wrap_init() resides.
+ Examples: Gtk, Gnome::Canvas
+
This will read template files from source directory and generate files
to destination directory:
(srcdir/template.{h,cc}g => destdir/{template.{h,cc},private/template_p.h}).
@@ -114,6 +118,7 @@ sub main ()
my $include_paths = [];
my $debug = (exists $ENV{'GMMPROC_DEBUG'}) ? $ENV{'GMMPROC_DEBUG'} : 0;
my $mm_module = undef;
+ my $wrap_init_namespace = undef;
my $opt_parse_result = GetOptions
(
'help|h' => \&print_help,
@@ -125,13 +130,14 @@ sub main ()
'include|i=s@' => \$include_paths,
'debug|g' => \$debug,
'mm-module|m=s' => \$mm_module,
+ 'wrap-init-namespace|w=s' => \$wrap_init_namespace,
'<>' => sub { add_file_to_list ($templates, shift); }
);
# TODO: print what is wrong.
if (not $opt_parse_result or not $source_dir or not $destination_dir or
not $mm_module or @{$templates} < 1 or not $gir_basename or
- @{$include_paths} < 1)
+ @{$include_paths} < 1 or not $wrap_init_namespace)
{
print_usage;
exit 1;
@@ -144,8 +150,9 @@ sub main ()
$gir_parser->parse_file ($gir_basename);
my $repositories = $gir_parser->get_repositories;
- my $gmmproc = Common::Gmmproc->new ($repositories, $mm_module, $include_paths);
+ my $gmmproc = Common::Gmmproc->new ($repositories, $mm_module, $include_paths, $wrap_init_namespace);
+# TODO: move it to constructor.
$gmmproc->set_source_dir ($source_dir);
$gmmproc->set_destination_dir ($destination_dir);
diff --git a/tools/pm/Common/Gmmproc.pm b/tools/pm/Common/Gmmproc.pm
index 30b8f40..691c3b9 100644
--- a/tools/pm/Common/Gmmproc.pm
+++ b/tools/pm/Common/Gmmproc.pm
@@ -165,9 +165,154 @@ sub _parse_all_bases ($)
$wrap_parser->parse;
$tokens_store->set_section_manager ($wrap_parser->get_section_manager);
+ $tokens_store->set_wrap_init_entries ($wrap_parser->get_wrap_init_entries ());
}
}
+sub _generate_wrap_init
+{
+ my ($self) = @_;
+ my $bases = $self->get_bases ();
+ my %total_c_includes = ();
+ my %total_cxx_includes = ();
+ my %total_entries = ();
+
+ foreach my $base (sort (keys (%{$bases})))
+ {
+ my $tokens_store = $bases->{$base};
+ my $wrap_init_entries = $tokens_store->get_wrap_init_entries ();
+
+ foreach my $entry (@{$wrap_init_entries})
+ {
+ my $deprecated = $entry->get_deprecated ();
+ my $not_for_windows = $entry->get_not_for_windows ();
+ my $c_includes = $entry->get_c_includes ();
+ my $cxx_includes = $entry->get_cxx_includes ();
+ my $ref = ref ($entry);
+
+ if (exists ($total_entries{$ref}))
+ {
+ push (@{$total_entries{$ref}}, $entry);
+ }
+ else
+ {
+ $total_entries{$ref} = [$entry];
+ }
+
+ foreach my $pair ([$c_includes, \%total_c_includes], [$cxx_includes, \%total_cxx_includes])
+ {
+ my $includes = $pair->[0];
+ my $total = $pair->[1];
+
+ foreach my $include (@{$includes})
+ {
+ if (exists ($total->{$include}))
+ {
+ my $include_entry = $total->{$include};
+
+ foreach my $another_pair ([0, $deprecated], [1, $not_for_windows])
+ {
+ my $index = $another_pair->[0];
+ my $trait = $another_pair->[1];
+
+ if ($include_entry->[$index] and not $trait)
+ {
+ $include_entry->[$index] = 0;
+ }
+ }
+ }
+ else
+ {
+ $total->{$include} = [$deprecated, $not_for_windows];
+ }
+ }
+ }
+ }
+ }
+
+ my $destination_dir = $self->get_destination_dir ();
+ my $wrap_init_cc = IO::File->new ($destination_dir . '/wrap_init.cc', 'w');
+ my $mm_module = $self->get_mm_module ();
+ my $deprecation_guard = uc ($mm_module) . '_DISABLE_DEPRECATED';
+
+ die unless (defined ($wrap_init_cc));
+
+ $wrap_init_cc->say ('// generated by gmmproc');
+ $wrap_init_cc->say ();
+ $wrap_init_cc->say ('// general includes');
+ $wrap_init_cc->say ('#include <glibmm/error.h>');
+ $wrap_init_cc->say ('#include <glibmm/object.h>');
+ $wrap_init_cc->say ();
+
+ foreach my $pair (['C includes', \%total_c_includes], ['C++ includes', \%total_cxx_includes])
+ {
+ my $comment = '// ' . $pair->[0];
+ my $includes = $pair->[1];
+
+ $wrap_init_cc->say ($comment);
+ foreach my $include (sort (keys (%{$includes})))
+ {
+ my $traits = $includes->{$include};
+ my $deprecated = $traits->[0];
+ my $not_for_windows = $traits->[1];
+
+ if ($deprecated)
+ {
+ $wrap_init_cc->say ('#ifndef ' . $deprecation_guard);
+ }
+ if ($not_for_windows)
+ {
+ $wrap_init_cc->say ('#ifndef G_OS_WIN32');
+ }
+ $wrap_init_cc->say ('#include ' . $include);
+ if ($not_for_windows)
+ {
+ $wrap_init_cc->say ('#endif // G_OS_WIN32');
+ }
+ if ($deprecated)
+ {
+ $wrap_init_cc->say ('#endif // ' . $deprecation_guard);
+ }
+ }
+ $wrap_init_cc->say ();
+ }
+
+ my @namespaces = split (/::/, $self->get_wrap_init_namespace ());
+
+ foreach my $namespace (@namespaces)
+ {
+ $wrap_init_cc->say (join ('', 'namespace ', $namespace));
+ $wrap_init_cc->say ('{');
+ $wrap_init_cc->say ();
+ }
+
+ $wrap_init_cc->say ('void wrap_init()');
+ $wrap_init_cc->say ('{');
+
+ foreach my $entry_type (sort (keys (%total_entries)))
+ {
+ my $entries = $total_entries{$entry_type};
+ my $comment = join ('', ' // ', (split (/::/, $entry_type))[-1]);
+
+ $wrap_init_cc->say ($comment);
+ foreach my $entry (@{$entries})
+ {
+ $wrap_init_cc->say ($entry->get_main_line ());
+ }
+ }
+
+ $wrap_init_cc->say ('}');
+ $wrap_init_cc->say ();
+
+ foreach my $namespace (reverse (@namespaces))
+ {
+ $wrap_init_cc->say (join ('', '} // namespace ', $namespace));
+ $wrap_init_cc->say ();
+ }
+ $wrap_init_cc->say ('// end of generated file');
+ $wrap_init_cc->close();
+}
+
sub _generate_all_bases ($)
{
my ($self) = @_;
@@ -187,6 +332,8 @@ sub _generate_all_bases ($)
$section_manager->write_main_section_to_file (Common::Sections::CC, $cc_file);
$section_manager->write_main_section_to_file (Common::Sections::P_H, $p_h_file);
}
+
+ $self->_generate_wrap_init ();
}
sub _finish ($)
@@ -197,9 +344,9 @@ sub _finish ($)
$type_info_global->write_generated_infos_to_file ();
}
-sub new ($$$$)
+sub new
{
- my ($type, $repositories, $mm_module, $include_paths) = @_;
+ my ($type, $repositories, $mm_module, $include_paths, $wrap_init_namespace) = @_;
my $class = (ref $type or $type or 'Common::Gmmproc');
my $self =
{
@@ -209,7 +356,8 @@ sub new ($$$$)
'destination_dir' => '.',
'type_info_global' => Common::TypeInfo::Global->new ($mm_module, $include_paths),
'mm_module' => $mm_module,
- 'include_paths' => $include_paths
+ 'include_paths' => $include_paths,
+ 'wrap_init_namespace' => $wrap_init_namespace
};
return bless $self, $class;
@@ -300,6 +448,13 @@ sub get_mm_module ($)
return $self->{'mm_module'};
}
+sub get_wrap_init_namespace
+{
+ my ($self) = @_;
+
+ return $self->{'wrap_init_namespace'};
+}
+
sub parse_and_generate ($)
{
my ($self) = @_;
diff --git a/tools/pm/Common/TokensStore.pm b/tools/pm/Common/TokensStore.pm
index 078c1c1..eab2af4 100644
--- a/tools/pm/Common/TokensStore.pm
+++ b/tools/pm/Common/TokensStore.pm
@@ -32,7 +32,8 @@ sub new ($)
'tuples' => [],
'section_manager' => undef,
'tokens_hg' => undef,
- 'tokens_ccg' => undef
+ 'tokens_ccg' => undef,
+ 'wrap_init_entries' => undef
};
return bless $self, $class;
@@ -94,4 +95,18 @@ sub get_ccg_tokens ($)
return $self->{'tokens_ccg'};
}
+sub set_wrap_init_entries
+{
+ my ($self, $wrap_init_entries) = @_;
+
+ $self->{'wrap_init_entries'} = $wrap_init_entries;
+}
+
+sub get_wrap_init_entries
+{
+ my ($self) = @_;
+
+ return $self->{'wrap_init_entries'};
+}
+
1; # indicate proper module load.
diff --git a/tools/pm/Common/WrapInit.pm b/tools/pm/Common/WrapInit.pm
new file mode 100644
index 0000000..83db483
--- /dev/null
+++ b/tools/pm/Common/WrapInit.pm
@@ -0,0 +1,27 @@
+# -*- mode: perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
+# gmmproc - Common::WrapParser module
+#
+# Copyright 2011, 2012 glibmm development team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#
+
+package Common::WrapInit;
+
+use Common::WrapInit::Base;
+use Common::WrapInit::GError;
+use Common::WrapInit::GObject;
+
+1; # indicate proper module load.
diff --git a/tools/pm/Common/WrapInit/Base.pm b/tools/pm/Common/WrapInit/Base.pm
new file mode 100644
index 0000000..d784367
--- /dev/null
+++ b/tools/pm/Common/WrapInit/Base.pm
@@ -0,0 +1,107 @@
+# -*- mode: perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
+# gmmproc - Common::WrapInit::Base module
+#
+# Copyright 2012 glibmm development team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#
+
+package Common::WrapInit::Base;
+
+use strict;
+use warnings;
+
+sub _get_line
+{
+# TODO: error - not implemented.
+ die;
+}
+
+sub new
+{
+ my ($type, $c_includes, $cxx_includes, $deprecated, $not_for_windows, $mm_module) = @_;
+ my $class = (ref $type or $type or 'Common::WrapInit::Base');
+ my $self =
+ {
+ 'c_includes' => $c_includes,
+ 'cxx_includes' => $cxx_includes,
+ 'deprecated' => $deprecated,
+ 'not_for_windows' => $not_for_windows,
+ 'mm_module' => $mm_module
+ };
+
+ return bless $self, $class;
+}
+
+sub get_c_includes
+{
+ my ($self) = @_;
+
+ return $self->{'c_includes'};
+}
+
+sub get_cxx_includes
+{
+ my ($self) = @_;
+
+ return $self->{'cxx_includes'};
+}
+
+sub get_deprecated
+{
+ my ($self) = @_;
+
+ return $self->{'deprecated'};
+}
+
+sub get_not_for_windows
+{
+ my ($self) = @_;
+
+ return $self->{'not_for_windows'};
+}
+
+sub get_main_line
+{
+ my ($self) = @_;
+ my $deprecated = $self->get_deprecated ();
+ my $not_for_windows = $self->get_not_for_windows ();
+ my $mm_module = $self->{'mm_module'};
+ my $deprecation_macro = join ('', uc ($mm_module), '_DISABLE_DEPRECATED');
+ my @lines = ();
+ my $main_line = '';
+
+ if ($deprecated)
+ {
+ push (@lines, join ('', '#ifndef ', $deprecation_macro, "\n"));
+ }
+ if ($not_for_windows)
+ {
+ push (@lines, '#ifndef G_OS_WIN32');
+ }
+ push (@lines, $self->_get_line ());
+ if ($not_for_windows)
+ {
+ push (@lines, '#endif // G_OS_WIN32');
+ }
+ if ($deprecated)
+ {
+ push (@lines, join ('', '#endif // ', $deprecation_macro));
+ }
+
+ return join ("\n", @lines);
+}
+
+1; # indicate proper module load.
diff --git a/tools/pm/Common/WrapInit/GError.pm b/tools/pm/Common/WrapInit/GError.pm
new file mode 100644
index 0000000..21c10b3
--- /dev/null
+++ b/tools/pm/Common/WrapInit/GError.pm
@@ -0,0 +1,48 @@
+# -*- mode: perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
+# gmmproc - Common::WrapInit::GError module
+#
+# Copyright 2012 glibmm development team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#
+
+package Common::WrapInit::GError;
+
+use strict;
+use warnings;
+
+use parent qw(Common::WrapInit::Base);
+
+sub _get_line
+{
+ my ($self) = @_;
+ my $cxx_type = $self->{'cxx_type'};
+ my $error_domain = $self->{'error_domain'};
+
+ return join ('', ' Glib::Error::register_domain(g_quark_from_static_string("', $error_domain, '"), &::', $cxx_type, '::throw_func);');
+}
+
+sub new
+{
+ my ($type, $c_includes, $cxx_includes, $deprecated, $not_for_windows, $mm_module, $cxx_type, $error_domain) = @_;
+ my $class = (ref $type or $type or 'Common::WrapInit::GError');
+ my $self = $class->SUPER::new ($c_includes, $cxx_includes, $deprecated, $not_for_windows, $mm_module);
+
+ $self->{'cxx_type'} = $cxx_type;
+ $self->{'error_domain'} = $error_domain;
+ return bless $self, $class;
+}
+
+1; # indicate proper module load.
diff --git a/tools/pm/Common/WrapInit/GObject.pm b/tools/pm/Common/WrapInit/GObject.pm
new file mode 100644
index 0000000..ae64299
--- /dev/null
+++ b/tools/pm/Common/WrapInit/GObject.pm
@@ -0,0 +1,57 @@
+# -*- mode: perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
+# gmmproc - Common::WrapInit::GObject module
+#
+# Copyright 2012 glibmm development team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#
+
+package Common::WrapInit::GObject;
+
+use strict;
+use warnings;
+
+use parent qw(Common::WrapInit::Base);
+
+sub _get_line
+{
+ my ($self) = @_;
+ my $get_type_func = $self->{'get_type_func'};
+ my $cxx_class_type = $self->{'cxx_class_type'};
+ my $cxx_type = $self->{'cxx_type'};
+ my @lines =
+ (
+ join ('', ' Glib::wrap_register(', $get_type_func, '(), &::', $cxx_class_type, '::wrap_new);'),
+# TODO: use the g_ensure_registered or something from GLib.
+ join ('', ' ', $cxx_type, '::get_type();')
+ );
+
+ return join ("\n", @lines);
+}
+
+sub new
+{
+ my ($type, $c_includes, $cxx_includes, $deprecated, $not_for_windows, $mm_module, $get_type_func, $cxx_class_type, $cxx_type) = @_;
+ my $class = (ref $type or $type or 'Common::WrapInit::GObject');
+ my $self = $class->SUPER::new ($c_includes, $cxx_includes, $deprecated, $not_for_windows, $mm_module);
+
+ $self->{'get_type_func'} = $get_type_func;
+ $self->{'cxx_class_type'} = $cxx_class_type;
+ $self->{'cxx_type'} = $cxx_type;
+
+ return bless $self, $class;
+}
+
+1; # indicate proper module load.
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index e942c67..174f5f2 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -34,6 +34,7 @@ use Common::SectionManager;
use Common::Shared;
use Common::Output;
use Common::TypeInfo::Local;
+use Common::WrapInit;
use constant
{
'STAGE_HG' => 0,
@@ -473,6 +474,14 @@ sub _on_open_brace ($)
$section_manager->append_string_to_section ('{', $main_section);
}
+sub add_wrap_init_entry
+{
+ my ($self, $entry) = @_;
+ my $wrap_init_entries = $self->get_wrap_init_entries ();
+
+ push (@{$wrap_init_entries}, $entry);
+}
+
sub _on_close_brace ($)
{
my ($self) = @_;
@@ -497,6 +506,30 @@ sub _on_close_brace ($)
$section_manager->append_section_to_section ($section, $main_section);
}
+ my $temp_wrap_init_stack = $self->_get_temp_wrap_init_stack ();
+
+ # check if we are closing the class brace which had temporary wrap init
+ if (@{$temp_wrap_init_stack})
+ {
+ my $temp_wrap_init = $temp_wrap_init_stack->[-1];
+ my $wrap_init_level = $temp_wrap_init->[0];
+
+ if ($wrap_init_level == $level)
+ {
+ shift (@{$temp_wrap_init});
+ pop (@{$temp_wrap_init_stack});
+
+ my $wrap_init_entry = Common::WrapInit::GObject->new (@{$temp_wrap_init});
+
+ $self->add_wrap_init_entry ($wrap_init_entry);
+ }
+ elsif ($wrap_init_level > $level)
+ {
+# TODO: internal error I guess. This wrap init should already be popped.
+ die;
+ }
+ }
+
pop @{$class_levels};
pop @{$classes};
$self->_pop_gir_entity;
@@ -1247,6 +1280,24 @@ sub _on_wrap_enum ($)
Common::Output::Enum::output ($self, $cxx_type, $members, $flags, $gir_gtype);
}
+# TODO: move it outside handlers section
+sub _get_c_includes ($)
+{
+ my ($repository) = @_;
+ my $c_includes_count = $repository->get_g_c_include_count ();
+ my $c_includes = [];
+
+ foreach my $index (0 .. ($c_includes_count - 1))
+ {
+ my $gir_c_include = $repository->get_g_c_include_by_index ($index);
+ my $include = join ('', '<', $gir_c_include->get_a_name (), '>');
+
+ push (@{$c_includes}, $include);
+ }
+
+ return $c_includes;
+}
+
sub _on_wrap_gerror ($)
{
my ($self) = @_;
@@ -1310,6 +1361,23 @@ sub _on_wrap_gerror ($)
my $members = _extract_members $enum, \ substs;
Common::Output::GError::output $self, $cxx_type, $members, $gir_domain, $gir_gtype;
+
+ my $c_includes = _get_c_includes ($repository);
+ my $cxx_includes = [join ('', '"', $self->get_base (), '.h"')];
+# TODO: Add deprecated option to _WRAP_GERROR
+ my $deprecated = 0;
+# TODO: Add "not for windows" option to _WRAP_GERROR
+ my $not_for_windows = 0;
+ my $complete_cxx_type = Common::Output::Shared::get_complete_cxx_type ($self);
+ my $wrap_init_entry = Common::WrapInit::GError->new ($c_includes,
+ $cxx_includes,
+ $deprecated,
+ $not_for_windows,
+ $self->get_mm_module (),
+ $gir_domain,
+ $complete_cxx_type);
+
+ $self->add_wrap_init_entry ($wrap_init_entry);
}
sub _on_implements_interface ($)
@@ -1379,6 +1447,40 @@ sub _on_class_generic ($)
Common::Output::Generic::output ($self, $c_type, $cxx_type);
}
+sub _get_temp_wrap_init_stack
+{
+ my ($self) = @_;
+
+ return $self->{'temp_wrap_init_stack'};
+}
+
+sub push_temp_wrap_init
+{
+ my ($self, $repository, $get_type_func) = @_;
+ my $level = $self->get_level ();
+ my $c_includes = _get_c_includes ($repository);
+ my $cxx_includes = [join ('', '"', $self->get_base (), '.h"'), join ('', '"private/', $self->get_base (), '_p.h"')];
+ my $deprecated = 0;
+ my $not_for_windows = 0;
+ my $mm_module = $self->get_mm_module ();
+ my $complete_cxx_class_type = Common::Output::Shared::get_complete_cxx_class_type ($self);
+ my $complete_cxx_type = Common::Output::Shared::get_complete_cxx_type ($self);
+ my $temp_wrap_init_stack = $self->_get_temp_wrap_init_stack ();
+
+ push (@{$temp_wrap_init_stack},
+ [
+ $level,
+ $c_includes,
+ $cxx_includes,
+ $deprecated,
+ $not_for_windows,
+ $mm_module,
+ $get_type_func,
+ $complete_cxx_class_type,
+ $complete_cxx_type
+ ]);
+}
+
sub _on_class_g_object ($)
{
my ($self) = @_;
@@ -1583,6 +1685,8 @@ sub _on_class_g_object ($)
$get_type_func,
$cxx_type,
$cxx_parent_type;
+
+ $self->push_temp_wrap_init ($repository, $get_type_func);
}
# TODO: set current gir_class.
@@ -1974,6 +2078,7 @@ sub _on_class_interface ($)
$cxx_type,
$cxx_parent_type,
$get_type_func;
+ $self->push_temp_wrap_init ($repository, $get_type_func);
}
# TODO: some of the code here duplicates the code in next
@@ -2628,6 +2733,41 @@ sub _on_add_conversion ($)
$transfer_full);
}
+# TODO: this should put some ifdefs around either class or file
+sub _on_is_deprecated
+{
+ my ($self) = @_;
+ my $temp_wrap_init_stack = $self->_get_temp_wrap_init_stack ();
+
+ if (@{$temp_wrap_init_stack})
+ {
+ my $temp_wrap_init = $temp_wrap_init_stack->[-1];
+ my $level = $self->get_level ();
+
+ if ($temp_wrap_init->[0] == $level)
+ {
+ $temp_wrap_init->[3] = 1;
+ }
+ }
+}
+
+sub _on_gtkmmproc_win32_no_wrap
+{
+ my ($self) = @_;
+ my $temp_wrap_init_stack = $self->_get_temp_wrap_init_stack ();
+
+ if (@{$temp_wrap_init_stack})
+ {
+ my $temp_wrap_init = $temp_wrap_init_stack->[-1];
+ my $level = $self->get_level ();
+
+ if ($temp_wrap_init->[0] == $level)
+ {
+ $temp_wrap_init->[4] = 1;
+ }
+ }
+}
+
###
### HANDLERS ABOVE
###
@@ -2729,7 +2869,9 @@ sub new ($$$$$$)
'c_stack' => [],
'mm_module' => $mm_module,
'base' => $base,
- 'filename' => undef
+ 'filename' => undef,
+ 'wrap_init_entries' => [],
+ 'temp_wrap_init_stack' => []
};
$self = bless $self, $class;
@@ -2779,12 +2921,21 @@ sub new ($$$$$$)
'_PINCLUDE' => [$self, \&_on_pinclude],
'_PUSH_NAMED_CONV' => [$self, \&_on_push_named_conv],
'_POP_NAMED_CONV' => [$self, \&_on_pop_named_conv],
- '_ADD_CONVERSION' => [$self, \&_on_add_conversion]
+ '_ADD_CONVERSION' => [$self, \&_on_add_conversion],
+ '_IS_DEPRECATED' => [$self, \&_on_is_deprecated],
+ '_GTKMMPROC_WIN32_NO_WRAP' => [$self, \&_on_gtkmmproc_win32_no_wrap]
};
return $self;
}
+sub get_wrap_init_entries
+{
+ my ($self) = @_;
+
+ return $self->{'wrap_init_entries'};
+}
+
sub get_type_info_local ($)
{
my ($self) = @_;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]