diff --git a/ChangeLog b/ChangeLog index b364ead82..169f860e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-11-19 Mike Kestner + + * parser/gapi_pp.pl : handle files and dirs in ARGV. + * parser/gapi2xml.pl : deal with struct keyword in param decls + * parser/gapi-parser : handle elements. + 2003-11-18 Mike Kestner * configure.in : tagged for 0.14 and bumping VERSION. diff --git a/parser/gapi-parser b/parser/gapi-parser index 4ca219a48..403ed1613 100755 --- a/parser/gapi-parser +++ b/parser/gapi-parser @@ -48,13 +48,26 @@ for ($apinode = $root->firstChild; $apinode; $apinode = $apinode->nextSibling () } } + my @files = (); for ($srcnode = $nsnode->firstChild; $srcnode; $srcnode = $srcnode->nextSibling ()) { - next if ($srcnode->nodeName ne "dir"); - my ($dir); - $dir = $srcnode->firstChild->nodeValue; - print "$dir\n"; - `ls $dir`; - system ("gapi_pp.pl $dir | gapi2xml.pl $ns $outfile.pre $lib"); + next if ($srcnode->nodeName ne "dir" && $srcnode->nodeName ne "file"); + + if ($srcnode->nodeName eq "dir") { + my ($dir); + $dir = $srcnode->firstChild->nodeValue; + print "$dir\n"; + system ("gapi_pp.pl $dir | gapi2xml.pl $ns $outfile.pre $lib"); + } elsif ($srcnode->nodeName eq "file") { + @files = (@files, $srcnode->firstChild->nodeValue); + } else { + die "Unexpected source $srcnode->nodeName \n"; + } + + } + if ($#files >= 0) { + $pp_args = join (" ", @files); + print "$pp_args\n"; + system ("gapi_pp.pl $pp_args | gapi2xml.pl $ns $outfile.pre $lib"); } } } diff --git a/parser/gapi2xml.pl b/parser/gapi2xml.pl index 2b2172719..40d9763bd 100755 --- a/parser/gapi2xml.pl +++ b/parser/gapi2xml.pl @@ -674,7 +674,10 @@ sub addParamsElem $parm_elem = $doc->createElement('parameter'); $parms_elem->appendChild($parm_elem); my $name = ""; - if ($parm =~ /(\S+)\s+(\S+)/) { + if ($parm =~ /struct\s+(\S+)\s+(\S+)/) { + $parm_elem->setAttribute('type', $1); + $name = $2; + }elsif ($parm =~ /(\S+)\s+(\S+)/) { $parm_elem->setAttribute('type', $1); $name = $2; } elsif ($parm =~ /(\S+)/) { diff --git a/parser/gapi_pp.pl b/parser/gapi_pp.pl index 939c7bd9e..d37f7375e 100755 --- a/parser/gapi_pp.pl +++ b/parser/gapi_pp.pl @@ -8,12 +8,21 @@ # # 2001 Mike Kestner # 2003 Martin Willemoes Hansen +# 2003 Novell, Inc. $eatit_regex = "^#if.*(__cplusplus|DEBUG|DISABLE_(DEPRECATED|COMPAT)|ENABLE_BROKEN|COMPILATION)"; $ignoreit_regex = '^\s+\*|#\s*include|#\s*else|#\s*endif|#\s*undef|G_(BEGIN|END)_DECLS|extern|GDKVAR|GTKVAR|GTKMAIN_C_VAR|GTKTYPEUTILS_VAR|VARIABLE|GTKTYPEBUILTIN'; -foreach $dir (@ARGV) { - @hdrs = (@hdrs, `ls $dir/*.h`); +foreach $arg (@ARGV) { + if (-d $arg && -e $arg) { + @hdrs = (@hdrs, `ls $arg/*.h`); + @srcs = (@srcs, `ls $arg/*.c`); + } elsif (-f $arg && -e $arg) { + @hdrs = (@hdrs, $arg) if ($arg =~ /\.h$/); + @srcs = (@srcs, $arg) if ($arg =~ /\.c$/); + } else { + die "unable to process arg: $arg"; + } } foreach $fname (@hdrs) { @@ -110,7 +119,7 @@ foreach $fname (@hdrs) { } } -foreach $fname (`ls $ARGV[0]/*.c`, @privhdrs) { +foreach $fname (@srcs, @privhdrs) { open(INFILE, $fname) || die "Could open $fname\n";