[gtk-doc] scan, mkdb: more improvements on extern and global variable parsing
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] scan, mkdb: more improvements on extern and global variable parsing
- Date: Mon, 22 Aug 2011 11:47:07 +0000 (UTC)
commit 9a501f713ec52e3f38484d817b1e0a1e0ee41660
Author: Stefan Kost <ensonic users sf net>
Date: Mon Aug 22 13:46:05 2011 +0200
scan,mkdb: more improvements on extern and global variable parsing
Don't drop type details in gtkdoc-mkdb. Improve the layout and add more tests.
gtkdoc-mkdb.in | 15 ++++++++++++---
gtkdoc-scan.in | 18 +++++++++++++++---
tests/bugs/docs/tester-sections.txt | 5 ++++-
tests/bugs/src/tester.h | 19 +++++++++++++++++--
4 files changed, 48 insertions(+), 9 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 7592293..5245a48 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -1914,13 +1914,22 @@ sub OutputVariable {
my ($symbol, $declaration) = @_;
my $id = &CreateValidSGMLID ($symbol);
my $condition = &MakeConditionDescription ($symbol);
+
+ @TRACE@("ouputing variable: '$symbol' '$declaration'");
my $synop;
- if ($declaration =~ m/^\s*extern\s+((const\s+|signed\s+|unsigned\s+)*\w+)(\s+\*+|\*+|\s)(\s*)([A-Za-z]\w*)\s*;/) {
- my $mod = defined ($1) ? $1 : "";
+ if ($declaration =~ m/^\s*extern\s+((const\s+|signed\s+|unsigned\s+)*\w+)(\s+\*+|\*+|\s)(\s*)(const\s+)*([A-Za-z]\w*)\s*;/) {
+ my $mod1 = defined ($1) ? $1 : "";
my $ptr = defined ($3) ? $3 : "";
my $space = defined ($4) ? $4 : "";
- $synop = &MakeReturnField("extern") . "$mod$ptr$space<link linkend=\"$id\">$symbol</link>;\n";
+ my $mod2 = defined ($5) ? $5 : "";
+ $synop = &MakeReturnField("extern $mod1$ptr$space$mod2") . "<link linkend=\"$id\">$symbol</link>;\n";
+ } elsif ($declaration =~ m/^\s*((const\s+|signed\s+|unsigned\s+)*\w+)(\s+\*+|\*+|\s)(\s*)(const\s+)*([A-Za-z]\w*)\s*=/) {
+ my $mod1 = defined ($1) ? $1 : "";
+ my $ptr = defined ($3) ? $3 : "";
+ my $space = defined ($4) ? $4 : "";
+ my $mod2 = defined ($5) ? $5 : "";
+ $synop = &MakeReturnField("$mod1$ptr$space$mod2") . "<link linkend=\"$id\">$symbol</link>;\n";
} else {
$synop = &MakeReturnField("extern") . "<link linkend=\"$id\">$symbol</link>;\n";
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index f05dd9b..7a7e4d9 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -504,7 +504,7 @@ sub ScanHeader {
} elsif (m/^\s*typedef\s+(struct|union)\s*\w*\s*{/) {
$symbol = "";
- $decl = $_;
+ $decl = $_;
$level = 0;
$in_declaration = $1;
@TRACE@("typedef struct/union $1");
@@ -533,9 +533,21 @@ sub ScanHeader {
} elsif (m/^\s*(extern|[A-Za-z_]+VAR)\s+((const\s+|signed\s+|unsigned\s+)*\w+)(\s+\*+|\*+|\s)\s*(const\s+)*([A-Za-z]\w*)\s*;/) {
$symbol = $6;
s/^\s*([A-Za-z_]+VAR)\b/extern/;
- @TRACE@("Possible extern $6: $_");
+ $decl = $_;
+ @TRACE@("Possible extern var $6: $decl");
+ if (&AddSymbolToList (\$list, $symbol)) {
+ print DECL "<VARIABLE>\n<NAME>$symbol</NAME>\n$deprecated$decl</VARIABLE>\n";
+ }
+
+
+ # VARIABLES
+
+ } elsif (m/^\s*((const\s+|signed\s+|unsigned\s+)*\w+)(\s+\*+|\*+|\s)\s*(const\s+)*([A-Za-z]\w*)\s*\=/) {
+ $symbol = $5;
+ $decl = $_;
+ @TRACE@("Possible global var $5: $decl");
if (&AddSymbolToList (\$list, $symbol)) {
- print DECL "<VARIABLE>\n<NAME>$symbol</NAME>\n$deprecated$_</VARIABLE>\n";
+ print DECL "<VARIABLE>\n<NAME>$symbol</NAME>\n$deprecated$decl</VARIABLE>\n";
}
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index fc4335d..45b3a8b 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -37,6 +37,7 @@ bug_552602
bug_554833
bug_574654a
bug_574654b
+bug_574654c
bug_580300a_get_type
bug_580300b_get_type
bug_580300c_get_type
@@ -53,7 +54,9 @@ bug_623968c
bug_624200a
bug_624200b
bug_638330
-BUG_656773
+BUG_656773a
+BUG_656773b
+BUG_656773c
gst_play_marshal_BUFFER__BOXED
<SUBSECTION Standard>
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index ad68d01..74928c4 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -433,10 +433,25 @@ gst_play_marshal_BUFFER__BOXED (gint * closure,
/**
- * BUG_656773:
+ * BUG_656773a:
*
* https://bugzilla.gnome.org/show_bug.cgi?id=656773
*/
-extern const char* const BUG_656773;
+extern const char* const BUG_656773a;
+
+/**
+ * BUG_656773b:
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=656773
+ */
+extern const char* BUG_656773b;
+
+/**
+ * BUG_656773c:
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=656773
+ */
+const char* const BUG_656773c = "bug";
+
#endif // GTKDOC_TESTER_H
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]