From d828b8ce5978fc5e6fe0c72a2db74835aebaea4b Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 10 Jan 2002 15:01:31 +0000 Subject: [PATCH] 2002-01-08 Mike Kestner * generator/StructBase.cs (GenField): Return a bool success indicator. * generator/ObjectGen.cs : Check the return of GenField. * generator/SymbolTable.cs : More fixage to simple_types. * parser/gapi2xml.pl : Fix multiline comment bug, and callback name hashing logic. Squash callbacks that aren't in the namespace. * sample/HelloWorld.cs : Clean out some debugging to make it closer to compiling. Not quite there yet. svn path=/trunk/gtk-sharp/; revision=1948 --- ChangeLog | 10 ++++++++++ generator/CallbackGen.cs | 1 + generator/ObjectGen.cs | 4 +++- generator/StructBase.cs | 7 ++++--- generator/SymbolTable.cs | 2 +- generator/api.xml | 2 +- parser/gapi2xml.pl | 7 ++++--- sample/HelloWorld.cs | 6 +----- 8 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e1349cb3..a15c2cc77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-01-08 Mike Kestner + + * generator/StructBase.cs (GenField): Return a bool success indicator. + * generator/ObjectGen.cs : Check the return of GenField. + * generator/SymbolTable.cs : More fixage to simple_types. + * parser/gapi2xml.pl : Fix multiline comment bug, and callback name + hashing logic. Squash callbacks that aren't in the namespace. + * sample/HelloWorld.cs : Clean out some debugging to make it closer to + compiling. Not quite there yet. + 2002-01-08 Mike Kestner * generator/CallbackGen.cs : Use name in QualName, not cname. diff --git a/generator/CallbackGen.cs b/generator/CallbackGen.cs index f0fbf31ae..2dea17840 100644 --- a/generator/CallbackGen.cs +++ b/generator/CallbackGen.cs @@ -59,6 +59,7 @@ namespace GtkSharp.Generation { if (!Directory.Exists("..\\" + ns.ToLower() + "\\generated")) { Directory.CreateDirectory("..\\"+ns.ToLower()+"\\generated"); } + String filename = "..\\" + ns.ToLower() + "\\generated\\" + Name + ".cs"; FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write); diff --git a/generator/ObjectGen.cs b/generator/ObjectGen.cs index 89fc6645c..3f6418899 100644 --- a/generator/ObjectGen.cs +++ b/generator/ObjectGen.cs @@ -86,7 +86,9 @@ namespace GtkSharp.Generation { switch (node.Name) { case "field": - // GenField(member, table, sw); + //if (!GenField(member, table, sw)) { + // Console.WriteLine("in object " + CName); + //} break; case "callback": diff --git a/generator/StructBase.cs b/generator/StructBase.cs index 35a28fc23..95eca64f4 100644 --- a/generator/StructBase.cs +++ b/generator/StructBase.cs @@ -21,7 +21,7 @@ namespace GtkSharp.Generation { this.elem = elem; } - protected void GenField (XmlElement field, SymbolTable table, StreamWriter sw) + protected bool GenField (XmlElement field, SymbolTable table, StreamWriter sw) { String c_type; @@ -35,8 +35,8 @@ namespace GtkSharp.Generation { String cs_type = table.GetCSType(c_type); if (cs_type == "") { - Console.WriteLine ("Unknown Type {0}", c_type); - return; + Console.WriteLine ("Field has unknown Type {0}", c_type); + return false; } sw.Write ("\t\t public " + cs_type); @@ -44,6 +44,7 @@ namespace GtkSharp.Generation { sw.Write ("[]"); } sw.WriteLine (" " + field.GetAttribute("cname") + ";"); + return true; } } diff --git a/generator/SymbolTable.cs b/generator/SymbolTable.cs index af340d088..dc1050e8c 100644 --- a/generator/SymbolTable.cs +++ b/generator/SymbolTable.cs @@ -56,7 +56,7 @@ namespace GtkSharp.Generation { simple_types.Add ("GClosure", "IntPtr"); simple_types.Add ("GArray", "IntPtr"); simple_types.Add ("GData", "IntPtr"); - simple_types.Add ("GTypeModule", "IntPtr"); + simple_types.Add ("GTypeModule", "GLib.Object"); simple_types.Add ("GSList", "IntPtr"); simple_types.Add ("GHashTable", "IntPtr"); simple_types.Add ("va_list", "IntPtr"); diff --git a/generator/api.xml b/generator/api.xml index 201b6cca4..d10bb9bb5 100644 --- a/generator/api.xml +++ b/generator/api.xml @@ -1,2 +1,2 @@ - + diff --git a/parser/gapi2xml.pl b/parser/gapi2xml.pl index d2410b33b..a65449065 100755 --- a/parser/gapi2xml.pl +++ b/parser/gapi2xml.pl @@ -61,7 +61,7 @@ while ($line = ) { $edef =~ /}\s*(\w+);/; $ename = $1; $edefs{$ename} = $edef; - } elsif ($line =~ /typedef\s+\w+\s*\**\s*\(\*(\w+)\)\s*\(/) { + } elsif ($line =~ /typedef\s+\w+\s*\**\s*\(\*\s*(\w+)\)\s*\(/) { $fname = $1; $fdef = ""; while ($line !~ /;/) { @@ -70,7 +70,7 @@ while ($line = ) { } $fdef .= $line; $fdef =~ s/\n\s+//g; - $fpdefs{$1} = $fdef; + $fpdefs{$fname} = $fdef; } elsif ($line =~ /struct\s+(\w+)/) { $sname = $1; $sdef = $line; @@ -78,8 +78,8 @@ while ($line = ) { $sdef .= $line; last if ($line =~ /^}/); } + $sdef =~ s!/\*.*?(\*/|\n)!!g; $sdef =~ s/\n\s*//g; - $sdef =~ s|/\*.*?\*/||g; $sdefs{$sname} = $sdef; } elsif ($line =~ /^(\w+)_class_init\b/) { $class = StudlyCaps($1); @@ -173,6 +173,7 @@ foreach $cname (sort(keys(%edefs))) { ############################################################## foreach $cbname (sort(keys(%fpdefs))) { + next if ($cbname !~ /$ns/); $cbcnt++; $fdef = $cb = $fpdefs{$cbname}; $cb_elem = addNameElem($ns_elem, 'callback', $cbname, $ns); diff --git a/sample/HelloWorld.cs b/sample/HelloWorld.cs index b12fa968e..0eb9164f0 100755 --- a/sample/HelloWorld.cs +++ b/sample/HelloWorld.cs @@ -17,8 +17,7 @@ namespace GtkSamples { public static int Main (string[] args) { Application.Init (ref args); - Window win = new Window ("Gtk# Hello World"); - win.DefaultSize = new Size (200, 150); + Gtk.Window win = new Gtk.Window ("Gtk# Hello World"); win.Deleted += new EventHandler (Window_Delete); win.Show (); Application.Run (); @@ -27,9 +26,6 @@ namespace GtkSamples { static void Window_Delete (object obj, EventArgs args) { - SimpleEventArgs sa = (SimpleEventArgs) args; - - Console.WriteLine(sa.Event.type); Application.Quit (); }