diff --git a/ChangeLog b/ChangeLog index 3c845f000..758e6a1c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-12-09 Mike Kestner + + * generator/Makefile.am : new files. + * generator/MethodBody.cs : fix for length param code. + * generator/SizeTGen.cs : smarter size_t marshaling. + * generator/SSizeTGen.cs : smarter ssize_t marshaling. + * generator/SymbolTable.cs : use the new generatables. + 2004-12-08 John Luke * sources/README: update versions of the libs diff --git a/doc/ChangeLog b/doc/ChangeLog index 06cba8201..f39139535 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2004-12-09 Mike Kestner + + * en/Gtk/HTML*.xml : size_t marshaling updates. + 2004-12-08 John Luke * en/Gtk/IconLookupFlags.xml diff --git a/doc/en/Gtk/HTML.xml b/doc/en/Gtk/HTML.xml index a983e2a81..55da2eb62 100644 --- a/doc/en/Gtk/HTML.xml +++ b/doc/en/Gtk/HTML.xml @@ -277,7 +277,7 @@ namespace HtmlTest - + Method System.Void @@ -285,13 +285,13 @@ namespace HtmlTest - + Writes bytes of content from to . a a - a + a diff --git a/doc/en/Gtk/HTMLSaveReceiverFn.xml b/doc/en/Gtk/HTMLSaveReceiverFn.xml index 8b497d711..48ce16b6a 100644 --- a/doc/en/Gtk/HTMLSaveReceiverFn.xml +++ b/doc/en/Gtk/HTMLSaveReceiverFn.xml @@ -1,5 +1,5 @@ - + gtkhtml-sharp 0.0.0.0 diff --git a/doc/en/Gtk/HTMLStream.xml b/doc/en/Gtk/HTMLStream.xml index 00bbde3ae..703d95150 100644 --- a/doc/en/Gtk/HTMLStream.xml +++ b/doc/en/Gtk/HTMLStream.xml @@ -98,19 +98,19 @@ - + Method System.Void - + Write the HTML to . a - a + a diff --git a/doc/en/Gtk/HTMLStreamWriteFunc.xml b/doc/en/Gtk/HTMLStreamWriteFunc.xml index 6fd20fd05..f533c3551 100644 --- a/doc/en/Gtk/HTMLStreamWriteFunc.xml +++ b/doc/en/Gtk/HTMLStreamWriteFunc.xml @@ -1,5 +1,5 @@ - + gtkhtml-sharp 0.0.0.0 diff --git a/doc/en/Rsvg/Global.xml b/doc/en/Rsvg/Global.xml index 8a6d7c5e0..fd1e7d08d 100644 --- a/doc/en/Rsvg/Global.xml +++ b/doc/en/Rsvg/Global.xml @@ -242,7 +242,7 @@ - + Method System.Void @@ -250,13 +250,11 @@ - To be added a a - a To be added diff --git a/generator/Makefile.am b/generator/Makefile.am index b99f5261a..8f65e6c1b 100644 --- a/generator/Makefile.am +++ b/generator/Makefile.am @@ -41,6 +41,8 @@ sources = \ SignalHandler.cs \ Signature.cs \ SimpleGen.cs \ + SizeTGen.cs \ + SSizeTGen.cs \ Statistics.cs \ StringGen.cs \ StructBase.cs \ diff --git a/generator/MethodBody.cs b/generator/MethodBody.cs index 025cec3aa..072104ad5 100644 --- a/generator/MethodBody.cs +++ b/generator/MethodBody.cs @@ -52,7 +52,7 @@ namespace GtkSharp.Generation { string result = array.NullOk ? array.Name + " != null ? " : ""; result += CastFromInt (length.CSType) + array.Name + ".Length"; result += array.NullOk ? ": 0" : ""; - return result; + return length.Generatable.CallByName (result); } public string GetCallString (bool is_set) @@ -74,7 +74,7 @@ namespace GtkSharp.Generation { continue; } } else if (i > 0 && parameters [i - 1].IsString && p.IsLength) { - result[i] = CastFromInt (p.CSType) + parameters [i - 1].Name + ".Length"; + result[i] = igen.CallByName (CastFromInt (p.CSType) + parameters [i - 1].Name + ".Length"); continue; } else if (p.IsArray && p.MarshalType != p.CSType) { result[i] = (is_set && i == 0 ? "native_value" : "native_" + p.Name); diff --git a/generator/SSizeTGen.cs b/generator/SSizeTGen.cs new file mode 100644 index 000000000..c4fec6e3d --- /dev/null +++ b/generator/SSizeTGen.cs @@ -0,0 +1,98 @@ +// GtkSharp.Generation.SizeTGen.cs - The size_t Generatable. +// +// Author: Mike Kestner +// +// Copyright (c) 2004 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the GNU General Public +// License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + +namespace GtkSharp.Generation { + + using System; + + public class SSizeTGen : IGeneratable { + + string ctype; + string type; + + public string CName { + get { + return "ssize_t"; + } + } + + public string Name { + get { + return "long"; + } + } + + public string QualifiedName { + get { + return "long"; + } + } + + public string MarshalType { + get { + return "IntPtr"; + } + } + + public string MarshalReturnType { + get + { + return MarshalType; + } + } + + public string ToNativeReturnType { + get + { + return MarshalType; + } + } + + public string CallByName (string var_name) + { + return "new IntPtr (" + var_name + ")"; + } + + public virtual string FromNative(string var) + { + return "(long) " + var; + } + + public virtual string FromNativeReturn(string var) + { + return FromNative (var); + } + + public virtual string ToNativeReturn(string var) + { + return CallByName (var); + } + + public void Generate () + { + } + + public void Generate (GenerationInfo gen_info) + { + } + } +} + diff --git a/generator/SizeTGen.cs b/generator/SizeTGen.cs new file mode 100644 index 000000000..77a39a2de --- /dev/null +++ b/generator/SizeTGen.cs @@ -0,0 +1,99 @@ +// GtkSharp.Generation.SizeTGen.cs - The size_t Generatable. +// +// Author: Mike Kestner +// +// Copyright (c) 2004 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the GNU General Public +// License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + +namespace GtkSharp.Generation { + + using System; + + public class SizeTGen : IGeneratable { + + string ctype; + string type; + string ns = ""; + + public string CName { + get { + return "size_t"; + } + } + + public string Name { + get { + return "ulong"; + } + } + + public string QualifiedName { + get { + return "ulong"; + } + } + + public string MarshalType { + get { + return "UIntPtr"; + } + } + + public string MarshalReturnType { + get + { + return MarshalType; + } + } + + public string ToNativeReturnType { + get + { + return MarshalType; + } + } + + public string CallByName (string var_name) + { + return "new UIntPtr (" + var_name + ")"; + } + + public virtual string FromNative(string var) + { + return "(ulong) " + var; + } + + public virtual string FromNativeReturn(string var) + { + return FromNative (var); + } + + public virtual string ToNativeReturn(string var) + { + return CallByName (var); + } + + public void Generate () + { + } + + public void Generate (GenerationInfo gen_info) + { + } + } +} + diff --git a/generator/SymbolTable.cs b/generator/SymbolTable.cs index 0ad8e079d..338f4a9b7 100644 --- a/generator/SymbolTable.cs +++ b/generator/SymbolTable.cs @@ -29,7 +29,6 @@ namespace GtkSharp.Generation { static SymbolTable table = null; - Hashtable alias = new Hashtable (); Hashtable types = new Hashtable (); public static SymbolTable Table { @@ -43,9 +42,6 @@ namespace GtkSharp.Generation { public SymbolTable () { - Hashtable alias = new Hashtable (); - Hashtable types = new Hashtable (); - AddType (new SimpleGen ("void", "void")); AddType (new SimpleGen ("gboolean", "bool")); AddType (new SimpleGen ("gint", "int")); @@ -92,9 +88,9 @@ namespace GtkSharp.Generation { // but this should work for now AddType (new SimpleGen ("gsize", "uint")); AddType (new SimpleGen ("gssize", "int")); - AddType (new SimpleGen ("off_t", "System.UIntPtr")); - AddType (new SimpleGen ("size_t", "System.UIntPtr")); - AddType (new SimpleGen ("ssize_t", "System.IntPtr")); + AddType (new AliasGen ("off_t", "size_t")); + AddType (new SizeTGen ()); + AddType (new SSizeTGen ()); // FIXME: These ought to be handled properly. AddType (new SimpleGen ("GMemChunk", "IntPtr"));