[glibmm/gmmproc-refactor] A bunch of changes.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/gmmproc-refactor] A bunch of changes.
- Date: Sun, 24 Jun 2012 19:51:01 +0000 (UTC)
commit 412b2958883df9cb4f7358d7f79faedc38858c47
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Mon Jun 11 23:37:59 2012 +0200
A bunch of changes.
There are too many of them and they are too interleaved to be splitted
into separate commits. Changes are:
1. Added Common::Shared::cleanup_tokens function removing all
undefined and empty tokens from a list. It is mainly for cases when
a function uses split with /()/ regexp. It is used in several
places.
2. Removed commented out/dead code.
3. Made Common::Shared::extract_bracketed_text() string-aware.
4. Fixed operator foo detection in
Common::Shared::parse_function_declaration().
5. Renamed split_cpp_type_to_sub_types to
split_cxx_type_to_sub_types() in Common::Shared. Possibly this
function will be moved to TypeInfo::Global in the future because it
is used only there.
tools/pm/Common/Gmmproc.pm | 6 +-
tools/pm/Common/Shared.pm | 423 +++++++++++++++++------------------
tools/pm/Common/TypeDetails.pm | 2 +-
tools/pm/Common/TypeDetails/Base.pm | 11 +-
tools/pm/Common/TypeInfo/Global.pm | 246 +--------------------
tools/pm/Common/WrapParser.pm | 3 +-
6 files changed, 209 insertions(+), 482 deletions(-)
---
diff --git a/tools/pm/Common/Gmmproc.pm b/tools/pm/Common/Gmmproc.pm
index 556852a..30b8f40 100644
--- a/tools/pm/Common/Gmmproc.pm
+++ b/tools/pm/Common/Gmmproc.pm
@@ -50,10 +50,8 @@ sub _tokenize_contents_ ($)
# - any char proceeded by \
# - symbols ;{}"`'():
# - newline
- my @tokens = split(/([#A-Za-z0-9_]+)|(\/\*[*!]?)|(\*\/)|(\/\/[\/!]?)|(\\.)|([:;{}"'`()])|(\n)/,
- $contents);
-# my @tokens = split(/([#A-Za-z0-9_]+)|(\/\**)|(\/\*!)|(\/\*)|(\*\/)|(\/\/\/)|(\/\/!)|(\/\/)|(\\.)|([:;{}"'`()])|(\n)/,
-# $contents);
+ my @tokens = Common::Shared::cleanup_tokens (split(/([#A-Za-z0-9_]+)|(\/\*[*!]?)|(\*\/)|(\/\/[\/!]?)|(\\.)|([:;{}"'`()])|(\n)/,
+ $contents));
return \ tokens;
}
diff --git a/tools/pm/Common/Shared.pm b/tools/pm/Common/Shared.pm
index cadae47..2aa22ca 100644
--- a/tools/pm/Common/Shared.pm
+++ b/tools/pm/Common/Shared.pm
@@ -24,15 +24,6 @@ use strict;
use warnings;
use feature ':5.10';
-use constant
-{
- 'GEN_NONE' => 0,
- 'GEN_NORMAL' => (1 << 0),
- 'GEN_REF' => (1 << 1),
- 'GEN_PTR' => (1 << 2),
- 'GEN_CONST' => (1 << 3)
-};
-
use Common::Util;
sub extract_token ($)
@@ -44,9 +35,6 @@ sub extract_token ($)
{
my $token = shift @{$tokens};
- # skip empty tokens
- next if (not defined $token or $token eq '');
-
if ($token =~ /\n/)
{
++$line_change;
@@ -55,7 +43,12 @@ sub extract_token ($)
return [$token, $line_change];
}
- return ['', $line_change];
+ return [undef, $line_change];
+}
+
+sub cleanup_tokens
+{
+ return grep { defined and $_ ne '' } @_;
}
sub extract_bracketed_text ($)
@@ -76,6 +69,10 @@ sub extract_bracketed_text ($)
last if ($token eq '(');
}
+ my $escape = 0;
+ my $sq = 0;
+ my $dq = 0;
+
# Concatenate until the corresponding ")":
while (@{$tokens})
{
@@ -84,38 +81,12 @@ sub extract_bracketed_text ($)
my $add_to_line = $result->[1];
$line_change += $add_to_line;
- ++$level if ($token eq '(');
- --$level if ($token eq ')');
-
- return [$str, $line_change] unless $level;
- $str .= $token;
- }
-
- return undef;
-}
-
-sub string_split_commas ($)
-{
- my ($in) = @_;
- my @out = ();
- my $level = 0;
- my $str = '';
- my @tokens = split(/([,()"'\\])/, $in);
- my $sq = 0;
- my $dq = 0;
- my $escape = 0;
-
- while (@tokens)
- {
- my $token = shift @tokens;
-
- next if ($token eq '');
-
if ($escape)
{
# do nothing
+ $escape = 0;
}
- if ($sq)
+ elsif ($sq)
{
if ($token eq '\'')
{
@@ -141,114 +112,181 @@ sub string_split_commas ($)
{
$dq = 1;
}
- elsif ($token eq '(')
- {
- ++$level;
- }
- elsif ($token eq ')')
- {
- --$level;
- }
- elsif ($token eq ',' and not $level)
+ else
{
- push @out, Common::Util::string_trim $str;
- $str = '';
- next;
+ ++$level if ($token eq '(');
+ --$level if ($token eq ')');
}
+ return [$str, $line_change] unless $level;
$str .= $token;
}
- push @out, Common::Util::string_trim $str;
- return @out;
+ return undef;
}
-sub string_split_func_params ($)
+sub string_split_commas ($)
{
my ($in) = @_;
my @out = ();
- my $level = 0;
- my $str = '';
- my @tokens = split (/([,()"'\\<>{}])/, $in);
- my $sq = 0;
- my $dq = 0;
- my $escape = 0;
- my @close_stack = ();
- my %closes = ('(' => ')', '<' => '>', '{' => '}');
+ my @tokens = cleanup_tokens (split (/([,()"'\\])/, $in));
- while (@tokens)
+ if (@tokens)
{
- my $token = shift @tokens;
+ my $level = 0;
+ my $str = '';
+ my $sq = 0;
+ my $dq = 0;
+ my $escape = 0;
- next if ($token eq '');
-
- if ($sq)
+ while (@tokens)
{
+ my $token = shift @tokens;
+
if ($escape)
{
+ # do nothing
$escape = 0;
}
- elsif ($token eq '\'')
+ elsif ($sq)
{
- $sq = 0;
+ if ($token eq '\'')
+ {
+ $sq = 0;
+ }
+ }
+ elsif ($dq)
+ {
+ if ($token eq '"')
+ {
+ $dq = 0;
+ }
}
elsif ($token eq '\\')
{
$escape = 1;
}
- }
- elsif ($dq)
- {
- if ($escape)
+ elsif ($token eq '\'')
{
- $escape = 0;
+ $sq = 1;
}
elsif ($token eq '"')
{
- $dq = 0;
+ $dq = 1;
}
- elsif ($token eq '\\')
+ elsif ($token eq '(')
{
- $escape = 1;
+ ++$level;
}
- }
- elsif ($token eq '\'')
- {
- $sq = 1;
- }
- elsif ($token eq '"')
- {
- $dq = 1;
- }
- elsif ($token eq '(' or $token eq '<' or $token eq '{')
- {
- ++$level;
- push @close_stack, $closes{$token};
- }
- elsif ($token eq ')' or $token eq '>' or $token eq '}')
- {
- my $expected = pop @close_stack;
-
- if ($expected eq $token)
+ elsif ($token eq ')')
{
--$level;
}
- else
+ elsif ($token eq ',' and not $level)
{
- return [];
+ push @out, Common::Util::string_trim $str;
+ $str = '';
+ next;
}
+
+ $str .= $token;
}
- elsif ($token eq ',' and not $level)
+
+ push (@out, Common::Util::string_trim $str);
+ }
+ return @out;
+}
+
+sub string_split_func_params ($)
+{
+ my ($in) = @_;
+ my @out = ();
+ my @tokens = cleanup_tokens (split(/([,()"'\\<>{}])/, $in));
+
+ if (@tokens)
+ {
+ my $level = 0;
+ my $str = '';
+ my $sq = 0;
+ my $dq = 0;
+ my $escape = 0;
+ my @close_stack = ();
+ my %pairs = ('(' => ')', '<' => '>', '{' => '}');
+ my @opens = keys (%pairs);
+ my @closes = values (%pairs);
+
+ while (@tokens)
{
- push @out, $str;
- $str = '';
- next;
+ my $token = shift @tokens;
+
+ if ($sq)
+ {
+ if ($escape)
+ {
+ $escape = 0;
+ }
+ elsif ($token eq '\'')
+ {
+ $sq = 0;
+ }
+ elsif ($token eq '\\')
+ {
+ $escape = 1;
+ }
+ }
+ elsif ($dq)
+ {
+ if ($escape)
+ {
+ $escape = 0;
+ }
+ elsif ($token eq '"')
+ {
+ $dq = 0;
+ }
+ elsif ($token eq '\\')
+ {
+ $escape = 1;
+ }
+ }
+ elsif ($token eq '\'')
+ {
+ $sq = 1;
+ }
+ elsif ($token eq '"')
+ {
+ $dq = 1;
+ }
+ elsif ($token ~~ @opens)
+ {
+ ++$level;
+ push @close_stack, $pairs{$token};
+ }
+ elsif ($token ~~ @closes)
+ {
+ my $expected = pop @close_stack;
+
+ if ($expected eq $token)
+ {
+ --$level;
+ }
+ else
+ {
+ return [];
+ }
+ }
+ elsif ($token eq ',' and not $level)
+ {
+ push @out, Common::Util::string_trim ($str);
+ $str = '';
+ next;
+ }
+
+ $str .= $token;
}
- $str .= $token;
+ push @out, Common::Util::string_trim ($str);
}
-
- push @out, $str;
return \ out;
}
@@ -375,18 +413,14 @@ sub parse_function_declaration ($)
$line = Common::Util::string_simplify ($line);
- my @tokens = split /([\s(),"'\\])/, $line;
+ my @tokens = cleanup_tokens (split (/([\s(),"'\\]|\w+)/, $line));
# get before
while (@tokens)
{
- my $token = shift @tokens;
-
- next unless ($token);
-
- $token = Common::Util::string_trim ($token);
+ my $token = Common::Util::string_trim (shift (@tokens));
- next unless ($token);
+ next if ($token eq '');
if ($token eq 'static')
{
@@ -408,8 +442,11 @@ sub parse_function_declaration ($)
{
my $token = shift @tokens;
- next unless ($token);
- last if ($token eq ')');
+ if ($token eq ')')
+ {
+ unshift (@tokens, $token);
+ last;
+ }
push @after_parts, $token;
}
@@ -421,26 +458,45 @@ sub parse_function_declaration ($)
}
@after_parts = undef;
+ while (@tokens)
+ {
+ my $token = Common::Util::string_trim (shift (@tokens));
+
+ if ($token ne '')
+ {
+ unshift (@tokens, $token);
+ last;
+ }
+ }
+
#get params
- my @params_parts = (')');
- my $level = 1;
+ my @params_parts = ();
+ my $level = 0;
my $maybe_dq_change = 0;
my $dq = 0;
my $maybe_sq_change = 0;
my $sq = 0;
+ my $no_push = 0;
while (@tokens)
{
my $token = shift @tokens;
- next unless ($token);
- push @params_parts, $token;
+ if ($no_push)
+ {
+ $no_push = 0;
+ }
+ else
+ {
+ push @params_parts, $token;
+ }
if ($maybe_dq_change)
{
$maybe_dq_change = 0;
if ($token ne '\\')
{
$dq = 0;
+ $no_push = 1;
unshift @tokens, $token;
}
}
@@ -457,6 +513,7 @@ sub parse_function_declaration ($)
if ($token ne '\\')
{
$sq = 0;
+ $no_push = 1;
unshift @tokens, $token;
}
}
@@ -489,66 +546,43 @@ sub parse_function_declaration ($)
}
}
- # TODO: this is probably not what we want for string default values.
- # TODO continued: not sure if we should care about that.
- # TODO continued: if string parameter's default value holds several consecutive whitespaces
- # TODO continued: then those ones are going to be changed into single space.
- my $params = Common::Util::string_trim (join '', reverse @params_parts);
+ my $params = Common::Util::string_trim (join ('', reverse @params_parts));
@params_parts = undef;
# get rid of whitespaces
while (@tokens)
{
- my $token = shift @tokens;
-
- next unless ($token);
-
- $token = Common::Util::string_trim ($token);
+ my $token = Common::Util::string_trim (shift (@tokens));
- next unless ($token);
+ next if ($token eq '');
unshift @tokens, $token;
last;
}
my @name_parts = ();
- my $try_operator = 0;
+ my $try_operator = join ('', reverse (@tokens)) =~ /\boperator\b/;
-# TODO: this part needs testing
- while (@tokens)
+ if ($try_operator)
{
- my $token = shift @tokens;
-
- next unless ($token);
+ while (@tokens)
+ {
+ my $token = shift (@tokens);
- my $trimmed_token = Common::Util::string_trim ($token);
+ push (@name_parts, $token);
- if ($try_operator)
- {
- if ($trimmed_token)
- {
- if ($trimmed_token eq 'operator')
- {
- push @name_parts, $trimmed_token . ' ';
- }
- else
- {
- unshift @tokens, $token . ' ';
- }
- last;
- }
+ last if ($token =~ '\boperator\b');
}
- elsif ($trimmed_token)
- {
- push @name_parts, $trimmed_token;
- }
- else
+ }
+ else
+ {
+ if (@tokens)
{
- $try_operator = 1;
+ push (@name_parts, shift (@tokens));
}
}
- my $name = Common::Util::string_simplify (join '', reverse @name_parts);
+ my $name = Common::Util::string_simplify (join ('', reverse (@name_parts)));
my $ret_type = Common::Util::string_simplify (join '', reverse @tokens);
$ret_type = _type_fixup $ret_type;
@@ -556,72 +590,20 @@ sub parse_function_declaration ($)
return [$before, $ret_type, $name, $params, $after];
}
-sub split_cpp_type_to_sub_types ($)
+sub split_cxx_type_to_sub_types ($)
{
- my ($cpp_type) = @_;
- my @cpp_parts = split '::', $cpp_type;
- my @cpp_sub_types = ();
+ my ($cxx_type) = @_;
+ my @cxx_parts = split '::', $cxx_type;
+ my @cxx_sub_types = ();
- for (my $iter = 0; $iter < @cpp_parts; ++$iter)
+ for (my $iter = 0; $iter < @cxx_parts; ++$iter)
{
- my $cpp_sub_type = join '::', @cpp_parts[$iter .. $#cpp_parts];
+ my $cxx_sub_type = join '::', @cxx_parts[$iter .. $#cxx_parts];
- push @cpp_sub_types, $cpp_sub_type;
+ push @cxx_sub_types, $cxx_sub_type;
}
- return \ cpp_sub_types;
-}
-
-# prototype needed, because it is recursively called.
-sub gen_cpp_types ($$);
-
-sub gen_cpp_types ($$)
-{
- my ($all_cpp_types, $flags) = @_;
-
- if (@{$all_cpp_types} > 0 and $flags != GEN_NONE)
- {
- my $outermost_type = $all_cpp_types->[0];
- my $sub_types = split_cpp_type_to_sub_types ($outermost_type);
- my @gen_types = ();
-
- if (@{$all_cpp_types} > 1)
- {
- my @further_types = @{$all_cpp_types}[1 .. $#{$all_cpp_types}];
- my $child_sub_types = gen_cpp_types (\ further_types, $flags);
-
- @further_types = ();
- foreach my $sub_type (@{$sub_types})
- {
- push @gen_types, map { $sub_type . '< ' . $_ . ' >'} @{$child_sub_types};
- }
- }
- else
- {
- push @gen_types, @{$sub_types};
- }
-
- my @ret_types = ();
-
- if ($flags & GEN_NORMAL == GEN_NORMAL)
- {
- push @ret_types, @gen_types;
- }
- if ($flags & GEN_REF == GEN_REF)
- {
- push @ret_types, map { $_ . '&' } @gen_types;
- }
- if ($flags & GEN_PTR == GEN_PTR)
- {
- push @ret_types, map { $_ . '*' } @gen_types;
- }
- if ($flags & GEN_CONST == GEN_CONST)
- {
- push @ret_types, map { 'const ' . $_ } @ret_types;
- }
- return \ ret_types;
- }
- return [];
+ return \ cxx_sub_types;
}
sub get_args ($$)
@@ -652,7 +634,6 @@ sub get_args ($$)
# TODO: programming error - throw an exception
die;
}
-
}
my $errors = [];
@@ -660,7 +641,7 @@ sub get_args ($$)
foreach my $arg (@{$args})
{
- my ($param, $possible_value) = split /[\s]+/, $arg, 2;
+ my ($param, $possible_value) = split /\s+/, $arg, 2;
unless ($param =~ /^[\w-]+$/)
{
diff --git a/tools/pm/Common/TypeDetails.pm b/tools/pm/Common/TypeDetails.pm
index 2825109..dd40c9a 100644
--- a/tools/pm/Common/TypeDetails.pm
+++ b/tools/pm/Common/TypeDetails.pm
@@ -49,7 +49,7 @@ sub disassemble_type ($)
unless ($parameter_ref)
{
# string was passed
- my @temp_parts = reverse split /(\w+|[()*&<>,`']|::)/, $cxx_type_or_array_ref;
+ my @temp_parts = reverse (Common::Shared::cleanup_tokens (split (/(\w+|[()*&<>,`']|::)/, $cxx_type_or_array_ref)));
$parts = \ temp_parts;
}
diff --git a/tools/pm/Common/TypeDetails/Base.pm b/tools/pm/Common/TypeDetails/Base.pm
index 6b2fa6a..eb80db6 100644
--- a/tools/pm/Common/TypeDetails/Base.pm
+++ b/tools/pm/Common/TypeDetails/Base.pm
@@ -48,16 +48,7 @@ sub _tokenize ($$)
{
my ($self, $match) = @_;
my $split_values = $self->_get_split_values ();
- my @preliminary_tokens = split (/([$split_values])/, $match);
- my @final_tokens = ();
-
- foreach my $token (@preliminary_tokens)
- {
- if (defined $token and $token ne '')
- {
- unshift (@final_tokens, $token);
- }
- }
+ my @final_tokens = reverse (Common::Shared::cleanup_tokens (split (/([$split_values])/, $match)));
return \ final_tokens;
}
diff --git a/tools/pm/Common/TypeInfo/Global.pm b/tools/pm/Common/TypeInfo/Global.pm
index b993aa6..072f006 100644
--- a/tools/pm/Common/TypeInfo/Global.pm
+++ b/tools/pm/Common/TypeInfo/Global.pm
@@ -22,7 +22,6 @@ package Common::TypeInfo::Global;
use strict;
use warnings;
-#use feature ':5.10';
use v5.10;
use constant
@@ -131,54 +130,6 @@ sub _get_cxx_container_types ($)
return $self->{'cxx_container_types'};
}
-#sub _do_c_cxx_container_check ($$$)
-#{
-# my ($self, $c_value, $cxx_value) = @_;
-# my $cxx_value_iter = $cxx_value;
-# my $cxx_base = undef;
-# my $c_base = $c_value->get_base ();
-#
-# until (defined $cxx_base)
-# {
-# my $templates = $cxx_value_iter->get_templates ();
-#
-# if (@{$templates} == 1)
-# {
-# if ($templates->[0]->match_sigil ('', Common::TypeDetails::Base::NONE))
-# {
-# $cxx_value_iter = $templates->[0];
-# }
-# else
-# {
-# return 0;
-# }
-# }
-# elsif (@{$templates} == 0)
-# {
-# $cxx_base = $cxx_value_iter->get_base ();
-# }
-# }
-#
-# my $cxx_test = $self->c_to_cxx ($c_base);
-#
-# if (defined $cxx_test)
-# {
-# my $sub_types = Common::Shared::split_cpp_type_to_sub_types $cxx_test;
-#
-## TODO: think if there are cases that need checking
-## TODO continued: correspondence in another direction.
-# foreach my $sub_type (@{$sub_types})
-# {
-# if ($sub_type eq $cxx_base)
-# {
-# return 1;
-# }
-# }
-# }
-#
-# return 0;
-#}
-
sub _get_cxx_pointer_types ($)
{
my ($self) = @_;
@@ -186,141 +137,6 @@ sub _get_cxx_pointer_types ($)
return $self->{'cxx_pointer_types'};
}
-#sub check_conversion_type ($$$)
-#{
-# my ($self, $from_details, $to_details) = @_;
-# my $c_container_types = $self->_get_c_container_types ();
-# my $cxx_container_types = $self->_get_cxx_container_types ();
-# my $conversion_type = SINGLE;
-# my $from_value = $from_details->get_value_details ();
-# my $to_value = $to_details->get_value_details ();
-# my $from_base = $from_value->get_base ();
-# my $to_base = $to_value->get_base ();
-# my @tuples =
-# (
-# [$from_details, $to_details, CXX_C_CONTAINER, CXX_C_CONTAINER_CHECK, $from_base, $to_base],
-# [$to_details, $from_details, C_CXX_CONTAINER, C_CXX_CONTAINER_CHECK, $to_base, $from_base]
-# );
-#
-# foreach my $tuple (@tuples)
-# {
-# my ($first_details, $second_details, $current_type, $current_check_type, $first_base, $second_base) = @{$tuple};
-# my $first_cxx_container = exists $cxx_container_types->{$first_base};
-# my $second_c_container = exists $c_container_types->{$second_base};
-#
-# if ($first_cxx_container)
-# {
-# print "$first_base is a C++ container\n";
-#
-# if ($second_c_container)
-# {
-# print "$second_base is a C container\n";
-# $conversion_type = $current_type;
-# }
-# elsif ($second_details->match_sigil (['*', '**'], Common::TypeDetails::Base::NONE))
-# {
-# $conversion_type = $current_check_type;
-# }
-# else
-# {
-# $conversion_type = UNKNOWN;
-# }
-#
-# last;
-# }
-# elsif ($second_c_container)
-# {
-## TODO: should we treat Gtk::Widget** as container type? I
-## TODO continued: guess not, just use vector.
-# $conversion_type = UNKNOWN;
-# last;
-# }
-# }
-#
-# given ($conversion_type)
-# {
-# when (C_CXX_CONTAINER_CHECK)
-# {
-# if ($self->_do_c_cxx_container_check ($from_value, $to_value))
-# {
-# $conversion_type = C_CXX_CONTAINER;
-# }
-# else
-# {
-# $conversion_type = UNKNOWN;
-# }
-# }
-# when (CXX_C_CONTAINER_CHECK)
-# {
-# if ($self->_do_c_cxx_container_check ($to_value, $from_value))
-# {
-# $conversion_type = CXX_C_CONTAINER;
-# }
-# else
-# {
-# $conversion_type = UNKNOWN;
-# }
-# }
-# when (SINGLE)
-# {
-# my $selected_from_base = undef;
-# my $selected_to_base = undef;
-# my $cxx_pointer_types = $self->_get_cxx_pointer_types ();
-#
-# if (exists ($cxx_pointer_types->{$from_base}))
-# {
-# $selected_from_base = $from_value->get_templates ()->[0]->get_value_details ()->get_base ();
-# $selected_to_base = $to_base;
-# }
-# elsif (exists ($cxx_pointer_types->{$to_base}))
-# {
-# $selected_from_base = $from_base;
-# $selected_to_base = $to_value->get_templates ()->[0]->get_value_details ()->get_base ();
-# }
-# else
-# {
-# $selected_from_base = $from_base;
-# $selected_to_base = $to_base;
-# }
-#
-# my @another_tuples =
-# (
-# [$selected_from_base, $selected_to_base, C_CXX],
-# [$selected_to_base, $selected_from_base, CXX_C]
-# );
-#
-# foreach my $tuple (@another_tuples)
-# {
-# my ($first_base, $second_base, $current_type) = @{$tuple};
-# my $cxx_test = $self->c_to_cxx ($first_base);
-#
-# if (defined $cxx_test)
-# {
-# my $sub_types = Common::Shared::split_cpp_type_to_sub_types $cxx_test;
-#
-## TODO: think if there are cases that need checking
-## TODO continued: correspondence in another direction.
-# foreach my $sub_type (@{$sub_types})
-# {
-# if ($sub_type eq $second_base)
-# {
-# $conversion_type = $current_type;
-# last;
-# }
-# }
-# }
-# }
-#
-# if ($conversion_type == SINGLE)
-# {
-# $conversion_type = UNKNOWN;
-# }
-# }
-# }
-#
-# return $conversion_type;
-#}
-
sub _get_generated_type_infos_basename ($)
{
my ($self) = @_;
@@ -575,7 +391,7 @@ sub _add_info_to_general_conversions ($$$$$$$)
}
my $conversions = $self->_get_general_conversions ($which);
- my $cxx_sub_types = Common::Shared::split_cpp_type_to_sub_types $cxx_stuff;
+ my $cxx_sub_types = Common::Shared::split_cxx_type_to_sub_types $cxx_stuff;
my $from_c_conversions = $conversions->{'c'};
if (exists $from_c_conversions->{$c_stuff})
@@ -762,23 +578,6 @@ sub _get_unambiguous_tuples ($)
return \ tuples;
}
-#sub _get_stuff_from ($$$)
-#{
-# my ($self, $stuff, $mapping_getter) = @_;
-#
-# foreach my $which (_desired_order ())
-# {
-# my $mapping = $self->$mapping_getter ($which);
-#
-# if (exists $mapping->{$stuff})
-# {
-# return $mapping->{$stuff};
-# }
-# }
-#
-# return undef;
-#}
-
sub _get_mm_module ($)
{
my ($self) = @_;
@@ -800,45 +599,6 @@ sub _get_read_files ($)
return $self->{'read_files'};
}
-#sub _get_common ($$$)
-#{
-# my ($self, $which, $what) = @_;
-# my $name = '';
-#
-# given ($which)
-# {
-# when (FROM_FILES)
-# {
-# $name = 'from_files';
-# }
-# when (GENERATED)
-# {
-# $name = 'generated';
-# }
-# default
-# {
-## TODO: throw internal error.
-# die;
-# }
-# }
-#
-# return $self->{$name}{$what};
-#}
-
-#sub _get_c_to_cxx ($$)
-#{
-# my ($self, $which) = @_;
-#
-# return $self->_get_common ($which, 'c_to_cxx');
-#}
-
-#sub _get_cxx_to_c ($$)
-#{
-# my ($self, $which) = @_;
-#
-# return $self->_get_common ($which, 'cxx_to_c');
-#}
-
sub _get_conversions ($$)
{
my ($self, $which) = @_;
@@ -922,8 +682,6 @@ sub new ($$$)
};
my $self =
{
-# 'generated' => $generated,
-# 'from_files' => $from_files,
'mm_module' => $mm_module,
'include_paths' => $include_paths,
'read_files' => {},
@@ -931,8 +689,8 @@ sub new ($$$)
'cxx_container_types' => $cxx_container_types,
'cxx_pointer_types' => $cxx_pointer_types
};
- map { $self->{ _which_to_string ($_)} = _create_hierarchy (); } (_desired_order ());
+ map { $self->{ _which_to_string ($_)} = _create_hierarchy (); } (_desired_order ());
$self = bless ($self, $class);
my $convertors =
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index 78dce33..856a04d 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -22,6 +22,7 @@ package Common::WrapParser;
use strict;
use warnings;
+use v5.10;
use IO::File;
@@ -2315,8 +2316,6 @@ sub _on_namespace_keyword ($)
# declaration this is.
foreach my $token (@{$tokens})
{
- next if (not defined $token or $token eq '');
-
if ($in_s_comment)
{
if ($token eq "\n")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]