From e33710f1c38547da3d75b9e5c2181dfd59d77736 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Mon, 7 Jan 2002 23:30:01 +0000 Subject: [PATCH] 2002-01-07 Mike Kestner * generator/ObjectGen.cs : Make parent debug statement more helpful. * generator/Parser.cs : Add interface element case. * parser/gapi2xml.pl : Add interface types. * parser/gapi_pp.pl : Grab G_TYPE_INSTANCE_GET_INTERFACE defines. Grab struct declarations out of private headers. svn path=/trunk/gtk-sharp/; revision=1904 --- ChangeLog | 8 ++++++++ generator/ObjectGen.cs | 2 +- generator/Parser.cs | 3 +++ generator/api.xml | 2 +- parser/gapi2xml.pl | 19 +++++++++++++++++++ parser/gapi_pp.pl | 10 +++++++--- 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d257ef8cd..3db4a8af3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-01-07 Mike Kestner + + * generator/ObjectGen.cs : Make parent debug statement more helpful. + * generator/Parser.cs : Add interface element case. + * parser/gapi2xml.pl : Add interface types. + * parser/gapi_pp.pl : Grab G_TYPE_INSTANCE_GET_INTERFACE defines. Grab + struct declarations out of private headers. + 2002-01-06 Mike Kestner * */makefile : Add atk to the build. diff --git a/generator/ObjectGen.cs b/generator/ObjectGen.cs index 4c96dbe13..89fc6645c 100644 --- a/generator/ObjectGen.cs +++ b/generator/ObjectGen.cs @@ -74,7 +74,7 @@ namespace GtkSharp.Generation { sw.Write ("\tpublic class " + Name); if (cs_parent == "") { sw.WriteLine (" {"); - Console.WriteLine ("Unknown type " + parent); + Console.WriteLine ("Object " + Name + " Unknown parent " + parent); } else { sw.WriteLine (" : " + cs_parent + " {"); } diff --git a/generator/Parser.cs b/generator/Parser.cs index 0dc5a809d..99c296946 100644 --- a/generator/Parser.cs +++ b/generator/Parser.cs @@ -80,6 +80,9 @@ namespace GtkSharp.Generation { table.AddType (new EnumGen (ns_name, elem)); break; + case "interface": + break; + case "object": table.AddType (new ObjectGen (ns_name, elem)); break; diff --git a/generator/api.xml b/generator/api.xml index aeaa1e6fa..201b6cca4 100644 --- a/generator/api.xml +++ b/generator/api.xml @@ -1,2 +1,2 @@ - + diff --git a/parser/gapi2xml.pl b/parser/gapi2xml.pl index 5d33c7ae4..d2410b33b 100755 --- a/parser/gapi2xml.pl +++ b/parser/gapi2xml.pl @@ -108,6 +108,8 @@ while ($line = ) { $objects{$1} = $2 . $objects{$1}; } elsif ($line =~ /GTK_CHECK_CLASS_CAST.*,\s*(\w+),\s*(\w+)/) { $objects{$1} .= ":$2"; + } elsif ($line =~ /INSTANCE_GET_INTERFACE.*,\s*(\w+),\s*(\w+)/) { + $ifaces{$1} = $2; } else { print $line; } @@ -183,6 +185,23 @@ foreach $cbname (sort(keys(%fpdefs))) { } +############################################################## +# Parse the interfaces list. +############################################################## + +foreach $type (sort(keys(%ifaces))) { + + $iface = $ifaces{$type}; + ($inst, $dontcare) = split(/:/, delete $objects{$type}); + $ifacetype = delete $types{$iface}; + delete $types{$inst}; + + $ifacecnt++; + $iface_el = addNameElem($ns_elem, 'interface', $inst, $ns); + addFuncElems($iface_el, $inst); +} + + ############################################################## # Parse the classes by walking the objects list. ############################################################## diff --git a/parser/gapi_pp.pl b/parser/gapi_pp.pl index 4e7504748..c8c7c0840 100755 --- a/parser/gapi_pp.pl +++ b/parser/gapi_pp.pl @@ -15,7 +15,11 @@ foreach $dir (@ARGV) { } foreach $fname (@hdrs) { - next if ($fname =~ /test|private|internals|gtktextlayout/); + + if ($fname =~ /test|private|internals|gtktextlayout/) { + @privhdrs = (@privhdrs, $fname); + next; + } open(INFILE, $fname) || die "Could open $fname\n"; @@ -27,7 +31,7 @@ foreach $fname (@hdrs) { if ($line =~ /#\s*define\s+\w+\s*\D+/) { $def = $line; while ($line =~ /\\\n/) {$def .= ($line = );} - if ($def =~ /_CHECK_\w*CAST/) { + if ($def =~ /_CHECK_\w*CAST|INSTANCE_GET_INTERFACE/) { $def =~ s/\\\n//g; print $def; } @@ -49,7 +53,7 @@ foreach $fname (@hdrs) { } } -foreach $fname (`ls $ARGV[0]/*.c`) { +foreach $fname (`ls $ARGV[0]/*.c`, @privhdrs) { open(INFILE, $fname) || die "Could open $fname\n";