2004-11-18 Mike Kestner <mkestner@novell.com>

* generator/*Gen.cs : add ToNativeReturnType to deal with
	the g_free string nonsense in the virtual method case.

svn path=/trunk/gtk-sharp/; revision=36289
This commit is contained in:
Mike Kestner 2004-11-18 22:19:31 +00:00
parent 487929df7f
commit 6072350f1e
14 changed files with 98 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-11-18 Mike Kestner <mkestner@novell.com>
* generator/*Gen.cs : add ToNativeReturnType to deal with
the g_free string nonsense in the virtual method case.
2004-11-18 Mike Kestner <mkestner@novell.com>
* generator/AliasGen.cs : make this a SimpleGen.

View File

@ -67,6 +67,7 @@ namespace GtkSharp.Generation {
return "ref " + QualifiedName;
}
}
public virtual string MarshalReturnType {
get
{
@ -74,6 +75,13 @@ namespace GtkSharp.Generation {
}
}
public virtual string ToNativeReturnType {
get
{
return QualifiedName;
}
}
public string CallByName (string var_name)
{
return "ref " + var_name;

View File

@ -53,6 +53,13 @@ namespace GtkSharp.Generation {
}
}
public string ToNativeReturnType {
get
{
return MarshalType;
}
}
public string CallByName (string var_name)
{
return var_name + ".NativeDelegate";

View File

@ -165,6 +165,13 @@ namespace GtkSharp.Generation {
}
}
public virtual string ToNativeReturnType {
get
{
return "IntPtr";
}
}
public virtual string CallByName (string var_name)
{
return var_name + ".Handle";

View File

@ -59,12 +59,19 @@ namespace GtkSharp.Generation {
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(" + marshaler + "))] " + type;
}
}
public virtual string MarshalReturnType {
get {
return "[return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(" + marshaler + "))]";
}
}
public virtual string ToNativeReturnType {
get {
return "[return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(" + marshaler + "))]";
}
}
public string CallByName (string var_name)
{
return var_name;

View File

@ -35,6 +35,7 @@ namespace GtkSharp.Generation {
return "int";
}
}
public string MarshalReturnType {
get
{
@ -42,6 +43,13 @@ namespace GtkSharp.Generation {
}
}
public string ToNativeReturnType {
get
{
return MarshalType;
}
}
public string CallByName (string var_name)
{
return "(int) " + var_name;

View File

@ -75,6 +75,12 @@ namespace GtkSharp.Generation {
}
}
public string ToNativeReturnType {
get {
return "IntPtr";
}
}
public void Generate ()
{
}

View File

@ -29,6 +29,8 @@ namespace GtkSharp.Generation {
string MarshalReturnType {get;}
string ToNativeReturnType {get;}
string Name {get;}
string QualifiedName {get;}

View File

@ -71,6 +71,7 @@ namespace GtkSharp.Generation {
return "IntPtr";
}
}
public string MarshalReturnType {
get
{
@ -78,6 +79,13 @@ namespace GtkSharp.Generation {
}
}
public string ToNativeReturnType {
get
{
return "IntPtr";
}
}
public string CallByName (string var_name)
{
return var_name + "." + handle;

View File

@ -68,6 +68,13 @@ namespace GtkSharp.Generation {
}
}
public virtual string ToNativeReturnType {
get
{
return type;
}
}
public string CallByName (string var_name)
{
return var_name;

View File

@ -1,8 +1,10 @@
// GtkSharp.Generation.StringGen.cs - The String type Generatable.
//
// Author: Rachel Hestilow <rachel@nullenvoid.com>
// Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2003 Rachel Hestilow
// 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
@ -29,6 +31,12 @@ namespace GtkSharp.Generation {
{
}
public override string ToNativeReturnType {
get {
return "IntPtr";
}
}
public override string FromNativeReturn(String var)
{
return "GLib.Marshaller.PtrToStringGFree(" + var + ")";

View File

@ -69,6 +69,13 @@ namespace GtkSharp.Generation {
}
}
public override string ToNativeReturnType {
get
{
return QualifiedName;
}
}
public override string CallByName (string var_name)
{
return "ref " + var_name;

View File

@ -101,6 +101,8 @@ namespace GtkSharp.Generation {
AddType (new SimpleGen ("GArray", "IntPtr"));
AddType (new SimpleGen ("GByteArray", "IntPtr"));
AddType (new SimpleGen ("GData", "IntPtr"));
AddType (new SimpleGen ("GDestroyNotify", "IntPtr"));
AddType (new SimpleGen ("GIOChannel", "IntPtr"));
AddType (new SimpleGen ("GTypeModule", "GLib.Object"));
AddType (new SimpleGen ("GHashTable", "System.IntPtr"));
AddType (new SimpleGen ("va_list", "IntPtr"));
@ -220,6 +222,14 @@ namespace GtkSharp.Generation {
return gen.MarshalReturnType;
}
public string GetToNativeReturnType(string c_type)
{
IGeneratable gen = this[c_type];
if (gen == null)
return "";
return gen.ToNativeReturnType;
}
public string GetMarshalType(string c_type)
{
IGeneratable gen = this[c_type];

View File

@ -57,6 +57,7 @@ namespace GtkSharp.Generation {
return "IntPtr";
}
}
public string MarshalReturnType {
get
{
@ -64,6 +65,13 @@ namespace GtkSharp.Generation {
}
}
public string ToNativeReturnType {
get
{
return "IntPtr";
}
}
public string CallByName (string var_name)
{
return "GLib.Marshaller.DateTimeTotime_t (" + var_name + ")";