summaryrefslogtreecommitdiff
path: root/tools/pm
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pm')
-rw-r--r--tools/pm/Output.pm67
-rw-r--r--tools/pm/WrapParser.pm53
2 files changed, 72 insertions, 48 deletions
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 511ea410..b08117dd 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -138,51 +138,58 @@ sub output_wrap_vfunc_h($$$$$$)
# _VFUNC_CC(signame,gtkname,rettype,crettype,`<cppargs>',`<cargs>')
sub output_wrap_vfunc_cc($$$$$$$)
{
- my ($self, $filename, $line_num, $objCppfunc, $objDefsSignal, $ifdef) = @_;
+ my ($self, $filename, $line_num, $objCppfunc, $objCFunc,
+ $custom_vfunc, $custom_vfunc_callback, $ifdef) = @_;
- my $cname = $$objDefsSignal{name};
+ my $cname = $$objCFunc{name};
# e.g. Gtk::Button::draw_indicator:
#Use a different macro for Interfaces, to generate an extra convenience method.
- my $refreturn = "";
- $refreturn = "refreturn" if($$objCppfunc{rettype_needs_ref});
+ if ($custom_vfunc eq 0)
+ {
+ my $refreturn = "";
+ $refreturn = "refreturn" if($$objCppfunc{rettype_needs_ref});
- my $str = sprintf("_VFUNC_CC(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s)dnl\n",
- $$objCppfunc{name},
- $cname,
- $$objCppfunc{rettype},
- $$objDefsSignal{rettype},
- $objCppfunc->args_types_and_names(),
- convert_args_cpp_to_c($objCppfunc, $objDefsSignal, 0, $line_num), #$objCppfunc->args_names_only(),
- $objCppfunc->get_is_const(),
- $refreturn,
- $ifdef);
+ my $str = sprintf("_VFUNC_CC(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s)dnl\n",
+ $$objCppfunc{name},
+ $cname,
+ $$objCppfunc{rettype},
+ $$objCFunc{rettype},
+ $objCppfunc->args_types_and_names(),
+ convert_args_cpp_to_c($objCppfunc, $objCFunc, 0, $line_num), #$objCppfunc->args_names_only(),
+ $objCppfunc->get_is_const(),
+ $refreturn,
+ $ifdef);
- $self->append($str);
+ $self->append($str);
+ }
# e.g. Gtk::ButtonClass::draw_indicator():
- my $refreturn_ctype = "";
- $refreturn_ctype = "refreturn_ctype" if($$objDefsSignal{rettype_needs_ref});
+ if ($custom_vfunc_callback eq 0)
+ {
+ my $refreturn_ctype = "";
+ $refreturn_ctype = "refreturn_ctype" if($$objCFunc{rettype_needs_ref});
- my $str = sprintf("_VFUNC_PCC(%s,%s,%s,%s,\`%s\',\`%s\',\`%s\',%s,%s,%s)dnl\n",
- $$objCppfunc{name},
- $cname,
- $$objCppfunc{rettype},
- $$objDefsSignal{rettype},
- $objDefsSignal->args_types_and_names(),
- $objDefsSignal->args_names_only(),
- convert_args_c_to_cpp($objDefsSignal, $objCppfunc, $line_num),
- ${$objDefsSignal->get_param_names()}[0],
- $refreturn_ctype,
- $ifdef);
+ my $str = sprintf("_VFUNC_PCC(%s,%s,%s,%s,\`%s\',\`%s\',\`%s\',%s,%s,%s)dnl\n",
+ $$objCppfunc{name},
+ $cname,
+ $$objCppfunc{rettype},
+ $$objCFunc{rettype},
+ $objCFunc->args_types_and_names(),
+ $objCFunc->args_names_only(),
+ convert_args_c_to_cpp($objCFunc, $objCppfunc, $line_num),
+ ${$objCFunc->get_param_names()}[0],
+ $refreturn_ctype,
+ $ifdef);
- $self->append($str);
+ $self->append($str);
+ }
}
-### Convert _WRAP to a virtual
+### Convert _WRAP to a signal
# _SIGNAL_H(signame,rettype, ifdef, `<cppargs>')
# _SIGNAL_PH(gtkname,crettype, ifdef, cargs and names)
# void output_wrap_default_signal_handler_h($filename, $line_num, $objCppfunc, $objCDefsFunc, $ifdef. @args)
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index 05f82e15..b4a12c3e 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -1154,8 +1154,9 @@ sub on_wrap_signal($$)
}
}
-
- $self->output_wrap_signal( $argCppDecl, $argCName, $$self{filename}, $$self{line_num}, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn, $ifdef, $merge_doxycomment_with_previous);
+ $self->output_wrap_signal($argCppDecl, $argCName, $$self{filename}, $$self{line_num},
+ $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback,
+ $bRefreturn, $ifdef, $merge_doxycomment_with_previous);
}
# void on_wrap_vfunc()
@@ -1179,25 +1180,40 @@ sub on_wrap_vfunc($)
my $refreturn = 0;
my $refreturn_ctype = 0;
+ my $custom_vfunc = 0;
+ my $custom_vfunc_callback = 0;
my $ifdef = "";
- # Extra ref needed?
- while($#args >= 2) # If the optional ref/err arguments are there.
+ while($#args >= 2) # If optional arguments are there.
{
my $argRef = string_trim(pop @args);
+ # Extra ref needed?
if($argRef eq "refreturn")
- { $refreturn = 1; }
+ {
+ $refreturn = 1;
+ }
elsif($argRef eq "refreturn_ctype")
- { $refreturn_ctype = 1; }
- elsif($argRef =~ /^ifdef(.*)/) #If ifdef is at the start.
+ {
+ $refreturn_ctype = 1;
+ }
+ elsif($argRef eq "custom_vfunc")
+ {
+ $custom_vfunc = 1;
+ }
+ elsif($argRef eq "custom_vfunc_callback")
+ {
+ $custom_vfunc_callback = 1;
+ }
+ elsif($argRef =~ /^ifdef(.*)/) #If ifdef is at the start.
{
$ifdef = $1;
}
}
- $self->output_wrap_vfunc($argCppDecl, $argCName, $refreturn, $refreturn_ctype,
- $$self{filename}, $$self{line_num}, $ifdef);
+ $self->output_wrap_vfunc($argCppDecl, $argCName, $$self{filename}, $$self{line_num},
+ $refreturn, $refreturn_ctype, $custom_vfunc,
+ $custom_vfunc_callback, $ifdef);
}
sub on_wrap_enum($)
@@ -1291,7 +1307,6 @@ sub output_wrap_check($$$$$$)
}
# void output_wrap($CppDecl, $signal_name, $filename, $line_num, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn)
-# Also used for vfunc.
sub output_wrap_signal($$$$$$$$$)
{
my ($self, $CppDecl, $signal_name, $filename, $line_num, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn, $ifdef, $merge_doxycomment_with_previous) = @_;
@@ -1301,7 +1316,7 @@ sub output_wrap_signal($$$$$$$$$)
$filename, $line_num, "_WRAP_SIGNAL"));
# handle first argument
- #Parse the method decaration and build an object that holds the details:
+ #Parse the method declaration and build an object that holds the details:
my $objCppSignal = &Function::new($CppDecl, $self);
$$objCppSignal{class} = $$self{class}; #Remember the class name for use in Outputter::output_wrap_signal().
@@ -1338,18 +1353,19 @@ sub output_wrap_signal($$$$$$$$$)
}
}
-# void output_wrap($CppDecl, $signal_name, $filename, $line_num)
-# Also used for vfunc.
+# void output_wrap($CppDecl, $vfunc_name, $filename, $line_num, $refreturn, $refreturn_ctype,
+# $custom_vfunc, $custom_vfunc_callback, $ifdef)
sub output_wrap_vfunc($$$$$$$$)
{
- my ($self, $CppDecl, $vfunc_name, $refreturn, $refreturn_ctype, $filename, $line_num, $ifdef) = @_;
+ my ($self, $CppDecl, $vfunc_name, $filename, $line_num, $refreturn, $refreturn_ctype,
+ $custom_vfunc, $custom_vfunc_callback, $ifdef) = @_;
#Some checks:
return if ($self->output_wrap_check($CppDecl, $vfunc_name, $filename, $line_num, '_WRAP_VFUNC'));
# handle first argument
- #Parse the method decaration and build an object that holds the details:
+ #Parse the method declaration and build an object that holds the details:
my $objCppVfunc = &Function::new($CppDecl, $self);
@@ -1373,12 +1389,13 @@ sub output_wrap_vfunc($$$$$$$$)
# These macros are defined in vfunc.m4:
$$objCppVfunc{rettype_needs_ref} = $refreturn;
- $$objCppVfunc{name} .= "_vfunc"; #All vfuncs should have the "_vfunc" prefix, and a separate easily-named invoker method.
+ $$objCppVfunc{name} .= "_vfunc"; #All vfuncs should have the "_vfunc" suffix, and a separate easily-named invoker method.
$$objCVfunc{rettype_needs_ref} = $refreturn_ctype;
- $objOutputter->output_wrap_vfunc_h($filename, $line_num, $objCppVfunc, $objCVfunc,$ifdef);
- $objOutputter->output_wrap_vfunc_cc($filename, $line_num, $objCppVfunc, $objCVfunc, $ifdef);
+ $objOutputter->output_wrap_vfunc_h($filename, $line_num, $objCppVfunc, $objCVfunc, $ifdef);
+ $objOutputter->output_wrap_vfunc_cc($filename, $line_num, $objCppVfunc, $objCVfunc,
+ $custom_vfunc, $custom_vfunc_callback, $ifdef);
}
# give some sort of weights to sorting attibutes