>From f3894f803b417bbfc19d282fda348ff9e0d6ce26 Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Wed, 14 Dec 2011 13:23:12 -0600 Subject: [PATCH] Don't assume struct names are prefixed with '_'. --- gtkdoc-mkdb.in | 4 ++-- gtkdoc-scan.in | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in index 339203e..096266d 100755 --- a/gtkdoc-mkdb.in +++ b/gtkdoc-mkdb.in @@ -1489,7 +1489,7 @@ sub OutputStruct { my $decl_out = ""; if ($declaration =~ m/^\s*$/) { #print "Found opaque struct: $symbol\n"; - $decl_out = "typedef struct _$symbol $symbol;"; + $decl_out = "typedef struct _?$symbol $symbol;"; } elsif ($declaration =~ m/^\s*struct\s+\w+\s*;\s*$/) { #print "Found opaque struct: $symbol\n"; $decl_out = "struct $symbol;"; @@ -1535,7 +1535,7 @@ sub OutputStruct { # empty struct declaration. if ($decl_out eq "") { if ($has_typedef) { - $decl_out = "typedef struct _$symbol $symbol;"; + $decl_out = "typedef struct _?$symbol $symbol;"; } else { $decl_out = "struct $symbol;"; } diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in index 04bfb4a..b435a20 100755 --- a/gtkdoc-scan.in +++ b/gtkdoc-scan.in @@ -461,7 +461,7 @@ sub ScanHeader { # ENUMS - } elsif (s/^\s*enum\s+_(\w+)\s+\{/enum $1 {/) { + } elsif (s/^\s*enum\s+_?(\w+)\s+\{/enum $1 {/) { # We assume that 'enum _ {' is really the # declaration of enum . $symbol = $1; @@ -483,7 +483,7 @@ sub ScanHeader { # STRUCTS AND UNIONS - } elsif (m/^\s*typedef\s+(struct|union)\s+_(\w+)\s+\2\s*;/) { + } elsif (m/^\s*typedef\s+(struct|union)\s+_?(\w+)\s+\2\s*;/) { # We've found a 'typedef struct _ ;' # This could be an opaque data structure, so we output an # empty declaration. If the structure is actually found that @@ -492,11 +492,11 @@ sub ScanHeader { @TRACE@("$structsym typedef: $2"); $forward_decls{$2} = "<$structsym>\n$2\n$deprecated\n" - } elsif (m/^\s*(?:struct|union)\s+_(\w+)\s*;/) { + } elsif (m/^\s*(?:struct|union)\s+_?(\w+)\s*;/) { # Skip private structs/unions. @TRACE@("private struct/union"); - } elsif (m/^\s*(struct|union)\s+(\w+)\s*;/) { + } elsif (m/^\s*(struct|union)\s+_?(\w+)\s*;/) { # Do a similar thing for normal structs as for typedefs above. # But we output the declaration as well in this case, so we # can differentiate it from a typedef. @@ -504,7 +504,7 @@ sub ScanHeader { @TRACE@("$structsym: $2"); $forward_decls{$2} = "<$structsym>\n$2\n$_$deprecated\n"; - } elsif (m/^\s*typedef\s+(struct|union)\s*\w*\s*{/) { + } elsif (m/^\s*typedef\s+(struct|union)\s*_?\w*\s*{/) { $symbol = ""; $decl = $_; $level = 0; @@ -659,11 +659,11 @@ sub ScanHeader { # STRUCTS - } elsif (m/^\s*struct\s+_(\w+)\s*\*/) { + } elsif (m/^\s*struct\s+_?(\w+)\s*\*/) { # Skip 'struct _ *', since it could be a # return type on its own line. - } elsif (m/^\s*struct\s+_(\w+)/) { + } elsif (m/^\s*struct\s+_?(\w+)/) { # We assume that 'struct _' is really the # declaration of struct . $symbol = $1; @@ -676,9 +676,9 @@ sub ScanHeader { # UNIONS - } elsif (m/^\s*union\s+_(\w+)\s*\*/) { + } elsif (m/^\s*union\s+_?(\w+)\s*\*/) { # Skip 'union _ *' (see above) - } elsif (m/^\s*union\s+_(\w+)/) { + } elsif (m/^\s*union\s+_?(\w+)/) { $symbol = $1; $decl = $_; $level = 0; -- 1.7.4.1