summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2017-09-12 16:53:07 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2017-09-12 16:53:07 +0200
commit67af488ffd496afd27f3dd0c25c69401a1e95385 (patch)
tree68b35631d1f7254e47cd99358079d9ae7e8dce0b /tools
parent66954ba29fa9c8407d998536f71f4361a330b74b (diff)
downloadglibmm-67af488ffd496afd27f3dd0c25c69401a1e95385.tar.gz
gmmproc: Write signal flags to generated documentation
Bug 785895
Diffstat (limited to 'tools')
-rw-r--r--tools/pm/Function.pm11
-rw-r--r--tools/pm/GtkDefs.pm34
-rw-r--r--tools/pm/Output.pm2
-rw-r--r--tools/pm/WrapParser.pm17
4 files changed, 54 insertions, 10 deletions
diff --git a/tools/pm/Function.pm b/tools/pm/Function.pm
index e0f404c7..37ffdd30 100644
--- a/tools/pm/Function.pm
+++ b/tools/pm/Function.pm
@@ -376,12 +376,12 @@ sub add_parameter($$$)
return $self;
}
-# $string get_refdoc_comment($existing_signal_docs)
+# $string get_refdoc_comment($existing_signal_docs, $signal_flags)
# Generate a readable prototype for signals and merge the prototype into the
# existing Doxygen comment block.
-sub get_refdoc_comment($$)
+sub get_refdoc_comment($$$)
{
- my ($self, $documentation) = @_;
+ my ($self, $documentation, $signal_flags) = @_;
my $str = " /**\n";
@@ -402,6 +402,11 @@ sub get_refdoc_comment($$)
$str .= ")</tt>\n";
$str .= " *\n";
+ if ($signal_flags)
+ {
+ $str .= " * Flags: $signal_flags\n *\n";
+ }
+
if($documentation ne "")
{
# Remove the initial '/** ' from the existing docs and merge it.
diff --git a/tools/pm/GtkDefs.pm b/tools/pm/GtkDefs.pm
index f1234f87..c50af4ae 100644
--- a/tools/pm/GtkDefs.pm
+++ b/tools/pm/GtkDefs.pm
@@ -713,8 +713,9 @@ BEGIN { @GtkDefs::Signal::ISA=qw(GtkDefs::Function); }
#
# string rettype;
#
-# string when. e.g. first, last, or both.
+# string flags. e.g. Run Last, No Hooks
# string entity_type. e.g. vfunc or signal
+# bool detailed; # optional
# bool deprecated; # optional
# }
@@ -741,7 +742,7 @@ sub new
$$self{rettype} = "none";
$$self{param_types} = [];
$$self{param_names} = [];
- $$self{when} = "";
+ $$self{flags} = "";
$$self{class} = "";
# snarf down lisp fields
@@ -760,9 +761,26 @@ sub new
$$self{rettype} =~ s/-/ /g; #e.g. replace const-gchar* with const gchar*. Otherwise it will be used in code.
}
- if($def =~ s/\(when "(\S+)"\)//)
+ if ($def =~ s/\(flags "(.*?)"\)//)
{
- $$self{when} = $1;
+ $$self{flags} = $1;
+ }
+ elsif ($def =~ s/\(when "(\S+)"\)//)
+ {
+ # "when" is a deprecated alternative to "flags".
+ # when eq "none", "first", "last", or "both".
+ if ($1 eq "first")
+ {
+ $$self{flags} = "Run First";
+ }
+ elsif ($1 eq "last")
+ {
+ $$self{flags} = "Run Last";
+ }
+ elsif ($1 eq "both")
+ {
+ $$self{flags} = "Run First, Run Last";
+ }
}
if($$self{rettype} eq "none")
@@ -770,6 +788,7 @@ sub new
$$self{rettype} = "void"
}
+ $$self{detailed} = ($1 eq "#t") if ($def =~ s/\(detailed (\S+)\)//);
$$self{deprecated} = ($1 eq "#t") if ($def =~ s/\(deprecated (\S+)\)//);
# signals always have a parameter
@@ -790,6 +809,13 @@ sub new
return $self;
}
+# bool get_detailed()
+sub get_detailed($)
+{
+ my ($self) = @_;
+ return $$self{detailed}; # undef, 0 or 1
+}
+
# bool get_deprecated()
sub get_deprecated($)
{
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 6e63bb73..1a9e671b 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -630,7 +630,7 @@ sub output_wrap_sig_decl($$$$$$$$$$$$$$)
# Create a merged Doxygen comment block for the signal from the looked up
# docs (the block will also contain a prototype of the slot as an example).
- my $doxycomment = $objCppfunc->get_refdoc_comment($documentation);
+ my $doxycomment = $objCppfunc->get_refdoc_comment($documentation, $$objCSignal{flags});
# If there was already a previous doxygen comment, we want to merge this
# one with the previous so it is one big comment. If
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index 9de213e3..6bec6957 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -1676,7 +1676,7 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$)
$objCSignal = GtkDefs::lookup_signal($$self{c_class}, $signal_name);
# Check for failed lookup.
- if($objCSignal eq 0)
+ if (!$objCSignal)
{
print STDERR "$signal_name\n";
$objOutputter->output_wrap_failed($signal_name,
@@ -1685,6 +1685,19 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$)
}
}
+ # Check detailed.
+ my $defs_detailed = $objCSignal->get_detailed();
+ if ($defs_detailed && !$detail_name)
+ {
+ print STDERR "Warning, $main::source: The $signal_name signal" .
+ " is marked 'detailed' in the .defs file, but not in _WRAP_SIGNAL.\n";
+ }
+ elsif (!$defs_detailed && $detail_name)
+ {
+ print STDERR "Warning, $main::source: The $signal_name signal" .
+ " is marked 'detailed' in _WRAP_SIGNAL, but not in the .defs file.\n";
+ }
+
Output::check_deprecation($$self{deprecated}, $objCSignal->get_deprecated(),
$deprecated, $signal_name, "signal", "SIGNAL");
@@ -1693,7 +1706,7 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$)
$deprecated, $deprecation_docs, $newin, $exceptionHandler,
$detail_name, $bTwoSignalMethods);
- if($bNoDefaultHandler eq 0)
+ if (!$bNoDefaultHandler)
{
$objOutputter->output_wrap_default_signal_handler_h($filename, $line_num,
$objCppSignal, $objCSignal, $ifdef, $deprecated, $exceptionHandler);