[patch] typedef'd arrays and functions



Hello,

I'm trying to get gtk-doc to work with Gimp-Print, but it can't cope
with some of the C constructs we use:

1.  Typedef'd arrays:

--- gtkdoc-scan.orig	Tue Apr  1 16:00:56 2003
+++ gtkdoc-scan	Wed May 21 12:06:44 2003
@@ -297,6 +297,7 @@
 	    } elsif (m/^\s*typedef\s+((const\s+|G_CONST_RETURN\s+)?\w+)\s*(\**)\s*\(\*\s*(\w+)\)\s*\(/) {
 		$ret_type = "$1 $3";
 		$symbol = $4;
+		print "Found: function typedef: $symbol\n";
 		$decl = $';
 		$in_declaration = "user_function";
 
@@ -358,7 +359,9 @@
 		$decl = $_;
 		$in_declaration = "union";
 
-	    } elsif (m/^\s*(G_GNUC_EXTENSION\s+)?typedef\s+(.+[\s\*])(\w\S*);/) {
+	    # ALL OTHER TYPEDEFS
+
+	    } elsif (m/^\s*(G_GNUC_EXTENSION\s+)?typedef\s+(.+[\s\*])(\w+)(\[\w*\])*;/) {
 		if ($2 !~ m/^struct\s/ && $2 !~ m/^union\s/) {
 #		    print "Found typedef: $_";
 		    &AddSymbolToList (\$list, $3);

This just lets the regex know about arrays, so they don't end up as
part of the symbol name, which is incorrect and also makes broken
SGML.


2. Typedef'd functions.

*  typedef void stpi_ditherfunc_t(int, const unsigned short *, int, int);

This isn't detected at all, even though (AFAIK) it's perfectly valid
C, i.e. a typedef'd *function*, not a function *pointer*.


Regards,
Roger


PS.  I've reposted this now I've subscribed to the list.  The original
seems to be stuck in "moderator limbo".


-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848 available on public keyservers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]