[gtk-doc] mktmpl: improve return type handling. Fixes #607445
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mktmpl: improve return type handling. Fixes #607445
- Date: Thu, 4 Mar 2010 22:23:42 +0000 (UTC)
commit 30f95dd1913ff2517c196230d51ec813e735fbc3
Author: Stefan Kost <ensonic users sf net>
Date: Fri Mar 5 00:20:39 2010 +0200
mktmpl: improve return type handling. Fixes #607445
Always remove the return tag before pushing it further and then try to parse it.
gtkdoc-mktmpl.in | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc-mktmpl.in b/gtkdoc-mktmpl.in
index 705ec6f..b063db2 100755
--- a/gtkdoc-mktmpl.in
+++ b/gtkdoc-mktmpl.in
@@ -373,10 +373,19 @@ EOF
# For functions and function typedefs we also output the return value.
if ($type eq "FUNCTION" || $type eq "USER_FUNCTION") {
# Take out the return type
- $declaration =~ s/<RETURNS>\s*((const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|struct\s+|enum\s+)*)(\w+)\s*(\**\s*(const|G_CONST_RETURN)?\s*\**\s*(restrict)?\s*)<\/RETURNS>\n//;
- my $ret_type_modifier = defined($1) ? $1 : "";
- my $ret_type = $3;
- my $ret_type_pointer = $4;
+ $declaration =~ s/<RETURNS>\s*(.*?)<\/RETURNS>\n//;
+ my $ret_type_decl = $1;
+ my $ret_type_modifier;
+ my $ret_type;
+ my $ret_type_pointer;
+
+ if ($ret_type_decl =~ m/((const\s+|G_CONST_RETURN\s+|unsigned\s+|signed\s+|long\s+|short\s+|struct\s+|enum\s+)*)(\w+)\s*(\**\s*(const|G_CONST_RETURN)?\s*\**\s*(restrict)?\s*)/) {
+ $ret_type_modifier = defined($1) ? $1 : "";
+ $ret_type = $3;
+ $ret_type_pointer = $4;
+ } else {
+ $ret_type = "void";
+ }
my @fields = ParseFunctionDeclaration($declaration);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]