2005-03-07 Mike Kestner <mkestner@novell.com>

* generator/MethodBody.cs : remove an unused var.
	* generator/ReturnValue.cs : privatize a couple props. Refactor the
	SymbolTable lookup logic to be generatable based.

svn path=/trunk/gtk-sharp/; revision=41528
This commit is contained in:
Mike Kestner 2005-03-07 15:54:49 +00:00
parent 7dbba612c5
commit 24bbc054f2
3 changed files with 30 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2005-03-07 Mike Kestner <mkestner@novell.com>
* generator/MethodBody.cs : remove an unused var.
* generator/ReturnValue.cs : privatize a couple props. Refactor the
SymbolTable lookup logic to be generatable based.
2005-03-04 Mike Kestner <mkestner@novell.com> 2005-03-04 Mike Kestner <mkestner@novell.com>
* generator/ImportSignature.cs : out param handling fix. * generator/ImportSignature.cs : out param handling fix.

View File

@ -158,7 +158,6 @@ namespace GtkSharp.Generation {
IGeneratable gen = p.Generatable; IGeneratable gen = p.Generatable;
string name = p.Name;
if (p.PassAs == "out" && p.CSType != p.MarshalType && !(gen is StructBase || gen is ByRefGen)) if (p.PassAs == "out" && p.CSType != p.MarshalType && !(gen is StructBase || gen is ByRefGen))
sw.WriteLine(indent + "\t\t\t" + p.Name + " = " + gen.FromNative (p.Name + "_as_native") + ";"); sw.WriteLine(indent + "\t\t\t" + p.Name + " = " + gen.FromNative (p.Name + "_as_native") + ";");
} }

View File

@ -41,17 +41,28 @@ namespace GtkSharp.Generation {
public string CSType { public string CSType {
get { get {
return SymbolTable.Table.GetCSType (CType) + (IsArray ? "[]" : String.Empty); if (IGen == null)
return String.Empty;
return IGen.QualifiedName + (IsArray ? "[]" : String.Empty);
} }
} }
public string ElementType { string ElementType {
get { get {
return elem == null ? String.Empty : elem.GetAttribute("element_type"); return elem == null ? String.Empty : elem.GetAttribute("element_type");
} }
} }
public bool IsArray { IGeneratable igen;
IGeneratable IGen {
get {
if (igen == null)
igen = SymbolTable.Table [CType];
return igen;
}
}
bool IsArray {
get { get {
return elem == null ? false : elem.HasAttribute ("array"); return elem == null ? false : elem.HasAttribute ("array");
} }
@ -65,11 +76,13 @@ namespace GtkSharp.Generation {
public string MarshalType { public string MarshalType {
get { get {
return SymbolTable.Table.GetMarshalReturnType (CType) + (IsArray ? "[]" : String.Empty); if (IGen == null)
return String.Empty;
return IGen.MarshalReturnType + (IsArray ? "[]" : String.Empty);
} }
} }
public bool Owned { bool Owned {
get { get {
return elem.GetAttribute ("owned") == "true"; return elem.GetAttribute ("owned") == "true";
} }
@ -77,17 +90,21 @@ namespace GtkSharp.Generation {
public string ToNativeType { public string ToNativeType {
get { get {
return SymbolTable.Table.GetToNativeReturnType (CType) + (IsArray ? "[]" : String.Empty); if (IGen == null)
return String.Empty;
return IGen.ToNativeReturnType + (IsArray ? "[]" : String.Empty);
} }
} }
public string FromNative (string var) public string FromNative (string var)
{ {
if (IGen == null)
return String.Empty;
if (Owned) if (Owned)
var += ", true"; var += ", true";
else if (ElementType != String.Empty) else if (ElementType != String.Empty)
var += ", typeof (" + ElementType + ")"; var += ", typeof (" + ElementType + ")";
return SymbolTable.Table.FromNativeReturn (CType, var); return IGen.FromNativeReturn (var);
} }
public bool Validate () public bool Validate ()