2004-12-20 Mike Kestner <mkestner@novell.com>
* gdk/Gdk.metadata : mark a couple array params. * generator/Field.cs : remove the MarshalAs hack. We have to do something much more evil since MarshalAs can't hang. * generator/ImportSignature.cs : deal with out LP(U)Gen params. * generator/LPGen.cs : moved from SSizeTGen and generalized. * generator/LPUGen.cs : moved from SizeTGen and generalized. * generator/Makefile.am : update sources. * generator/MethodBody.cs : deal with out LP(U)Gen params. * generator/Parameters.cs : deal with out LP(U)Gen params. * generator/SymbolTable.cs : make all longs and size_t types LP(U)Gens. svn path=/trunk/gtk-sharp/; revision=37999
This commit is contained in:
commit
b6b89a0633
12 changed files with 110 additions and 81 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2004-12-20 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* gdk/Gdk.metadata : mark a couple array params.
|
||||
* generator/Field.cs : remove the MarshalAs hack. We have to
|
||||
do something much more evil since MarshalAs can't hang.
|
||||
* generator/ImportSignature.cs : deal with out LP(U)Gen params.
|
||||
* generator/LPGen.cs : moved from SSizeTGen and generalized.
|
||||
* generator/LPUGen.cs : moved from SizeTGen and generalized.
|
||||
* generator/Makefile.am : update sources.
|
||||
* generator/MethodBody.cs : deal with out LP(U)Gen params.
|
||||
* generator/Parameters.cs : deal with out LP(U)Gen params.
|
||||
* generator/SymbolTable.cs : make all longs and size_t types LP(U)Gens.
|
||||
|
||||
2004-12-20 Dan Winship <danw@novell.com>
|
||||
|
||||
* generator/GUnicharGen.cs: generatable for gunichar, using
|
||||
|
|
|
@ -18,32 +18,6 @@
|
|||
<Interfaces />
|
||||
<Attributes />
|
||||
<Members>
|
||||
<Member MemberName="Alloc">
|
||||
<MemberSignature Language="C#" Value="public static int Alloc (Gdk.Colormap colormap, bool contiguous, out ulong planes, int nplanes, out ulong pixels, int npixels);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Int32</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="colormap" Type="Gdk.Colormap" />
|
||||
<Parameter Name="contiguous" Type="System.Boolean" />
|
||||
<Parameter Name="planes" Type="System.UInt64&" RefType="out" />
|
||||
<Parameter Name="nplanes" Type="System.Int32" />
|
||||
<Parameter Name="pixels" Type="System.UInt64&" RefType="out" />
|
||||
<Parameter Name="npixels" Type="System.Int32" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="colormap">a <see cref="T:Gdk.Colormap" /></param>
|
||||
<param name="contiguous">a <see cref="T:System.Boolean" /></param>
|
||||
<param name="planes">a <see cref="T:System.UInt64" /></param>
|
||||
<param name="nplanes">a <see cref="T:System.Int32" /></param>
|
||||
<param name="pixels">a <see cref="T:System.UInt64" /></param>
|
||||
<param name="npixels">a <see cref="T:System.Int32" /></param>
|
||||
<returns>a <see cref="T:System.Int32" /></returns>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Store">
|
||||
<MemberSignature Language="C#" Value="public static void Store (Gdk.Colormap colormap, Gdk.Color colors, int ncolors);" />
|
||||
<MemberType>Method</MemberType>
|
||||
|
@ -63,26 +37,6 @@
|
|||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Free">
|
||||
<MemberSignature Language="C#" Value="public static ulong Free (Gdk.Colormap colormap, int npixels, ulong planes);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.UInt64</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="colormap" Type="Gdk.Colormap" />
|
||||
<Parameter Name="npixels" Type="System.Int32" />
|
||||
<Parameter Name="planes" Type="System.UInt64" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="colormap">a <see cref="T:Gdk.Colormap" /></param>
|
||||
<param name="npixels">a <see cref="T:System.Int32" /></param>
|
||||
<param name="planes">a <see cref="T:System.UInt64" /></param>
|
||||
<returns>a <see cref="T:System.UInt64" /></returns>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName=".ctor">
|
||||
<MemberSignature Language="C#" Value="public Colors ();" />
|
||||
<MemberType>Constructor</MemberType>
|
||||
|
@ -94,5 +48,52 @@
|
|||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Alloc">
|
||||
<MemberSignature Language="C#" Value="public static int Alloc (Gdk.Colormap colormap, bool contiguous, ulong [] planes, int nplanes, ulong [] pixels, int npixels);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Int32</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="colormap" Type="Gdk.Colormap" />
|
||||
<Parameter Name="contiguous" Type="System.Boolean" />
|
||||
<Parameter Name="planes" Type="System.UInt64[]" />
|
||||
<Parameter Name="nplanes" Type="System.Int32" />
|
||||
<Parameter Name="pixels" Type="System.UInt64[]" />
|
||||
<Parameter Name="npixels" Type="System.Int32" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="colormap">a <see cref="T:Gdk.Colormap" /></param>
|
||||
<param name="contiguous">a <see cref="T:System.Boolean" /></param>
|
||||
<param name="planes">a <see cref="T:System.UInt64" /></param>
|
||||
<param name="nplanes">a <see cref="T:System.Int32" /></param>
|
||||
<param name="pixels">a <see cref="T:System.UInt64" /></param>
|
||||
<param name="npixels">a <see cref="T:System.Int32" /></param>
|
||||
<returns>a <see cref="T:System.Int32" /></returns>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Free">
|
||||
<MemberSignature Language="C#" Value="public static void Free (Gdk.Colormap colormap, ulong [] pixels, int npixels, ulong planes);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="colormap" Type="Gdk.Colormap" />
|
||||
<Parameter Name="pixels" Type="System.UInt64[]" />
|
||||
<Parameter Name="npixels" Type="System.Int32" />
|
||||
<Parameter Name="planes" Type="System.UInt64" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="colormap">a <see cref="T:Gdk.Colormap" /></param>
|
||||
<param name="pixels">a <see cref="T:System.UInt64" /></param>
|
||||
<param name="npixels">a <see cref="T:System.Int32" /></param>
|
||||
<param name="planes">a <see cref="T:System.UInt64" /></param>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
</Type>
|
||||
|
|
|
@ -1758,4 +1758,4 @@ class T
|
|||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
</Type>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
<attr path="/api/namespace/boxed[@cname='GdkRectangle']/method[@name='Intersect']/*/*[@name='dest']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GdkRectangle']/method[@name='Union']/*/*[@name='dest']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/callback[@cname='GdkPixbufDestroyNotify']/*/*[@type='guchar*']" name="array">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkColors_']/method[@name='Alloc']/*/*[@type='gulong*']" name="array">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkColors_']/method[@name='Free']/*/*[@name='pixels']" name="array">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkDrag_']/method[@name='Begin']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkDrag_']/method[@name='FindWindow']/*/*[@name='dest_window']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkDrag_']/method[@name='FindWindowForScreen']/*/*[@name='dest_window']" name="pass_as">out</attr>
|
||||
|
|
|
@ -201,12 +201,6 @@ namespace GtkSharp.Generation {
|
|||
} else if (IsPointer && CSType != "string") {
|
||||
// FIXME: probably some fields here which should be visible.
|
||||
sw.WriteLine ("\t\tprivate {0} {1};", CSType, Name);
|
||||
} else if (CSType == "long") {
|
||||
sw.WriteLine ("\t\t[MarshalAs (UnmanagedType.SysInt)]");
|
||||
sw.WriteLine ("\t\t{0} {1} {2};", Access, CSType, StudlyName);
|
||||
} else if (CSType == "ulong") {
|
||||
sw.WriteLine ("\t\t[MarshalAs (UnmanagedType.SysUInt)]");
|
||||
sw.WriteLine ("\t\t{0} {1} {2};", Access, CSType, StudlyName);
|
||||
} else if (Access != "public") {
|
||||
sw.WriteLine ("\t\t{0} {1} {2};", Access, CSType, Name);
|
||||
} else {
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace GtkSharp.Generation {
|
|||
parms [i] = "";
|
||||
if (p.CType == "GError**")
|
||||
parms [i] += "out ";
|
||||
else if (p.PassAs != "" && (!m_type.EndsWith ("IntPtr") || UsesHandle (p.Generatable)))
|
||||
else if (p.PassAs != "" && (!m_type.EndsWith ("IntPtr") || p.Generatable is LPGen || p.Generatable is LPUGen || UsesHandle (p.Generatable)))
|
||||
parms [i] += p.PassAs + " ";
|
||||
parms [i] += m_type + " " + p.Name;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// GtkSharp.Generation.SizeTGen.cs - The size_t Generatable.
|
||||
// GtkSharp.Generation.LPGen.cs - long/pointer Generatable.
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@novell.com>
|
||||
//
|
||||
|
@ -23,14 +23,18 @@ namespace GtkSharp.Generation {
|
|||
|
||||
using System;
|
||||
|
||||
public class SSizeTGen : IGeneratable {
|
||||
public class LPGen : IGeneratable {
|
||||
|
||||
string ctype;
|
||||
string type;
|
||||
|
||||
public LPGen (string ctype)
|
||||
{
|
||||
this.ctype = ctype;
|
||||
}
|
||||
|
||||
public string CName {
|
||||
get {
|
||||
return "ssize_t";
|
||||
return ctype;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,15 +57,13 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
public string MarshalReturnType {
|
||||
get
|
||||
{
|
||||
get {
|
||||
return MarshalType;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToNativeReturnType {
|
||||
get
|
||||
{
|
||||
get {
|
||||
return MarshalType;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// GtkSharp.Generation.SizeTGen.cs - The size_t Generatable.
|
||||
// GtkSharp.Generation.LPUGen.cs - unsugned long/pointer generatable.
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@novell.com>
|
||||
//
|
||||
|
@ -23,15 +23,18 @@ namespace GtkSharp.Generation {
|
|||
|
||||
using System;
|
||||
|
||||
public class SizeTGen : IGeneratable {
|
||||
public class LPUGen : IGeneratable {
|
||||
|
||||
string ctype;
|
||||
string type;
|
||||
string ns = "";
|
||||
|
||||
public LPUGen (string ctype)
|
||||
{
|
||||
this.ctype = ctype;
|
||||
}
|
||||
|
||||
public string CName {
|
||||
get {
|
||||
return "size_t";
|
||||
return ctype;
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,8 @@ sources = \
|
|||
IGeneratable.cs \
|
||||
ImportSignature.cs \
|
||||
InterfaceGen.cs \
|
||||
LPGen.cs \
|
||||
LPUGen.cs \
|
||||
ManagedCallString.cs \
|
||||
ManualGen.cs \
|
||||
MethodBody.cs \
|
||||
|
@ -42,8 +44,6 @@ sources = \
|
|||
SignalHandler.cs \
|
||||
Signature.cs \
|
||||
SimpleGen.cs \
|
||||
SizeTGen.cs \
|
||||
SSizeTGen.cs \
|
||||
Statistics.cs \
|
||||
StringGen.cs \
|
||||
StructBase.cs \
|
||||
|
|
|
@ -86,11 +86,13 @@ namespace GtkSharp.Generation {
|
|||
if (p.CType == "GError**") {
|
||||
result [i] += "out ";
|
||||
} else if (p.PassAs != "") {
|
||||
if (!p.MarshalType.EndsWith ("IntPtr"))
|
||||
if (p.Generatable is LPGen || !p.MarshalType.EndsWith ("IntPtr"))
|
||||
result [i] += p.PassAs + " ";
|
||||
|
||||
if (igen is EnumGen)
|
||||
call_parm = p.Name + "_as_int";
|
||||
else if (igen is LPUGen || igen is LPGen)
|
||||
call_parm = p.Name + "_as_ptr";
|
||||
else if (UsesHandle (igen)) {
|
||||
call_parm = p.PassAs + " " + call_parm.Replace (".Handle", "_handle");
|
||||
}
|
||||
|
@ -132,6 +134,9 @@ namespace GtkSharp.Generation {
|
|||
if (p.PassAs == "out" && gen is EnumGen)
|
||||
sw.WriteLine(indent + "\t\t\tint " + name + "_as_int;");
|
||||
|
||||
if (p.PassAs == "out" && (gen is LPGen || gen is LPUGen))
|
||||
sw.WriteLine(indent + "\t\t\t" + gen.MarshalType + " " + name + "_as_ptr;");
|
||||
|
||||
if (p.IsArray && p.MarshalType != p.CSType) {
|
||||
sw.WriteLine(indent + "\t\t\t{0}[] native_{1} = new {0} [{1}.Length];", p.MarshalType.TrimEnd('[', ']'), name);
|
||||
sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < {0}.Length; i++)", name);
|
||||
|
@ -166,12 +171,14 @@ namespace GtkSharp.Generation {
|
|||
for (int i = 0; i < parameters.Count; i++) {
|
||||
Parameter p = parameters [i];
|
||||
|
||||
if (p.PassAs == "out" && p.Generatable is EnumGen) {
|
||||
sw.WriteLine(indent + "\t\t\t" + p.Name + " = (" + p.CSType + ") " + p.Name + "_as_int;");
|
||||
}
|
||||
|
||||
IGeneratable gen = p.Generatable;
|
||||
|
||||
if (p.PassAs == "out" && gen is EnumGen)
|
||||
sw.WriteLine(indent + "\t\t\t" + p.Name + " = (" + p.CSType + ") " + p.Name + "_as_int;");
|
||||
|
||||
if (p.PassAs == "out" && (gen is LPGen || gen is LPUGen))
|
||||
sw.WriteLine(indent + "\t\t\t" + p.Name + " = (" + p.CSType + ") " + p.Name + "_as_ptr;");
|
||||
|
||||
if (p.PassAs == "out" && UsesHandle (gen))
|
||||
sw.WriteLine(indent + "\t\t\t" + p.Name + " = " + gen.FromNativeReturn (p.Name + "_handle") + ";");
|
||||
}
|
||||
|
|
|
@ -178,6 +178,9 @@ namespace GtkSharp.Generation {
|
|||
if (Generatable is SimpleGen && !(Generatable is ConstStringGen) && CType.EndsWith ("*") && !CSType.EndsWith ("IntPtr"))
|
||||
return "out";
|
||||
|
||||
if ((Generatable is LPGen || Generatable is LPUGen) && CType.EndsWith ("*"))
|
||||
return "out";
|
||||
|
||||
if (Generatable is EnumGen && CType.EndsWith ("*"))
|
||||
return "out";
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace GtkSharp.Generation {
|
|||
AddType (new SimpleGen ("gint", "int"));
|
||||
AddType (new SimpleGen ("guint", "uint"));
|
||||
AddType (new SimpleGen ("unsigned int", "uint"));
|
||||
AddType (new SimpleGen ("glong", "long"));
|
||||
AddType (new SimpleGen ("gshort", "short"));
|
||||
AddType (new SimpleGen ("gushort", "ushort"));
|
||||
AddType (new SimpleGen ("guint32", "uint"));
|
||||
|
@ -71,9 +70,6 @@ namespace GtkSharp.Generation {
|
|||
AddType (new SimpleGen ("guchar", "byte"));
|
||||
AddType (new SimpleGen ("unsigned char", "byte"));
|
||||
AddType (new SimpleGen ("short", "short"));
|
||||
AddType (new SimpleGen ("long", "long"));
|
||||
AddType (new SimpleGen ("ulong", "ulong"));
|
||||
AddType (new SimpleGen ("gulong", "ulong"));
|
||||
AddType (new SimpleGen ("GQuark", "int"));
|
||||
AddType (new SimpleGen ("int", "int"));
|
||||
AddType (new StringGen ("char"));
|
||||
|
@ -84,13 +80,21 @@ namespace GtkSharp.Generation {
|
|||
AddType (new SimpleGen ("GPtrArray", "IntPtr[]"));
|
||||
AddType (new ManualGen ("GType", "GLib.GType", "Val"));
|
||||
AddType (new SimpleGen ("GError", "IntPtr"));
|
||||
|
||||
// gsize is a system-specific typedef in glibconfig.h,
|
||||
// but this should work for now
|
||||
AddType (new SimpleGen ("gsize", "uint"));
|
||||
AddType (new SimpleGen ("gssize", "int"));
|
||||
AddType (new AliasGen ("off_t", "size_t"));
|
||||
AddType (new SizeTGen ());
|
||||
AddType (new SSizeTGen ());
|
||||
|
||||
// system specific integer types. these will break on any
|
||||
// platform where sizeof (long) != sizeof (pointer)
|
||||
AddType (new LPGen ("ssize_t"));
|
||||
AddType (new LPGen ("long"));
|
||||
AddType (new LPGen ("glong"));
|
||||
AddType (new LPUGen ("size_t"));
|
||||
AddType (new LPUGen ("ulong"));
|
||||
AddType (new LPUGen ("gulong"));
|
||||
AddType (new GUnicharGen ());
|
||||
|
||||
// FIXME: These ought to be handled properly.
|
||||
|
|
Loading…
Reference in a new issue