X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=build%2Fdoc-extract;h=2ef86026c50243f7244acf70f7e16b3a6695c62a;hb=403227fe2c782c1b675852ca88db3ea8be5db996;hp=9ce8a3c5e06547e7cf6ae35e8404cabc16b25b9c;hpb=62d6af595070a89b1a686797d1893156d4245fd7;p=libucw.git diff --git a/build/doc-extract b/build/doc-extract index 9ce8a3c5..2ef86026 100755 --- a/build/doc-extract +++ b/build/doc-extract @@ -24,19 +24,21 @@ if( defined $defdump ) { sub detect( $ ) { ( $_ ) = @_; - return( 'struct', 1, $1, "typedef struct { ... } $1;" ) if( /^\s*typedef\s+struct\s*{.*}\s*(\w+)\s*;\s*$/s ); - return( 'enum', 1, $1, "typedef enum { ... } $1;" ) if( /^\s*typedef\s+enum\s*{.*}\s*(\w+)\s*;\s*$/s ); + return( 'struct', 1, $1, "typedef struct { ... } $1;" ) if /^\s*typedef\s+struct\s*{.*}\s*(\w+)\s*;\s*$/s; + return( 'enum', 1, $1, "typedef enum { ... } $1;" ) if /^\s*typedef\s+enum\s*{.*}\s*(\w+)\s*;\s*$/s; my $l = length; s/\n.*//s; - return( 'struct', 0, $1, $_ ) if( /struct\s+(\w+)\s+{/ ); - return( 'enum', 0, $1, $_ ) if( /enum\s+(\w+)\s+{/ ); + return( 'struct', 0, $1, $_ ) if /struct\s+(\w+)\s+{/; + return( 'enum', 0, $1, $_ ) if /enum\s+(\w+)\s+{/; if( $l > length ) { warn( "Unknown statement $_\n" ); return( '', 0, $_, $_ ); } - return( 'def', 0, $1, $_ ) if( /#define\s+(\w+)/ ); - return( 'fun', 1, $2, $1 ) if( /^(.*?(\w+)\([^{]*\)[^{]*)/ ); - return( 'var', 1, $1, $_ ) if( /\s(\w+);/ ); + return( 'def', 0, $1, $_ ) if /#define\s+(\w+)/; + return( 'type', 1, $2, $_ ) if /^\s*typedef[^()]+?(\(\s*?\*\s*?)?(\w+)(\s*\))?\s*\(.*\)/; + return( 'fun', 1, $2, $1 ) if /^(.*?(\w+)\([^{]*\)[^{]*)/; + return( 'type', 1, $1, $_ ) if /^\s*typedef.*?(\w+);/; + return( 'var', 1, $1, $_ ) if /\s(\w+);/; warn( "Unknown statement $_\n" ); return( '', 0, $_, $_ ); } @@ -56,13 +58,10 @@ sub formatNote( $$ ) { $head =~ s/;?\s*$/;/ if( $semicolon ); $head =~ s/(\.\.\.)/\\$1/g; print OUT "[[${type}_$name]]\n"; - if( $type eq 'fun' ) { - print OUT "!!f!$head!!!\n\n"; - } else { - print OUT "..................\n"; - print OUT "$head\n"; - print OUT "..................\n\n"; - } + $head = $oneline if $type eq 'fun';#Remove { from inline functions + print OUT "..................\n"; + print OUT "$head\n"; + print OUT "..................\n\n"; if( $hasdump ) { print DUMP "$outname,${type}_$name,$type,$name,$oneline\n"; $id ++;