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

* generator/CallbackGen.cs : remove an old workaround that put
	the native wrapper class into the implementor's *Sharp namespace.
	Use new ImportSignature sig.
	* generator/ImportSignature.cs : don't mangle the callback wrapper
	namespace any more. Remove impl_ns ctor param and field.
	* generator/MethodBase.cs : use new MethodBody and ImportSignature
	ctor sigs.
	* generator/MethodBody.cs : drop the impl_ns ctor param.
	* generator/Signal.cs : use new ImportSignature ctor sig.
	* generator/VirtualMethod.cs : use new ImportSignature ctor sig.

svn path=/trunk/gtk-sharp/; revision=46877
This commit is contained in:
Mike Kestner 2005-07-02 14:55:08 +00:00
parent 762a1576fd
commit f1336f2f2b
7 changed files with 28 additions and 24 deletions

View file

@ -1,3 +1,16 @@
2005-07-02 Mike Kestner <mkestner@novell.com>
* generator/CallbackGen.cs : remove an old workaround that put
the native wrapper class into the implementor's *Sharp namespace.
Use new ImportSignature sig.
* generator/ImportSignature.cs : don't mangle the callback wrapper
namespace any more. Remove impl_ns ctor param and field.
* generator/MethodBase.cs : use new MethodBody and ImportSignature
ctor sigs.
* generator/MethodBody.cs : drop the impl_ns ctor param.
* generator/Signal.cs : use new ImportSignature ctor sig.
* generator/VirtualMethod.cs : use new ImportSignature ctor sig.
2005-07-01 Mike Kestner <mkestner@novell.com> 2005-07-01 Mike Kestner <mkestner@novell.com>
* generator/Parameters.cs : init allow_complex_refs to true to fix * generator/Parameters.cs : init allow_complex_refs to true to fix

View file

@ -55,16 +55,16 @@ namespace GtkSharp.Generation {
return NS + "Sharp." + Name + "Wrapper.GetManagedDelegate (" + var + ")"; return NS + "Sharp." + Name + "Wrapper.GetManagedDelegate (" + var + ")";
} }
public string GenWrapper (string ns, GenerationInfo gen_info) public string GenWrapper (GenerationInfo gen_info)
{ {
string wrapper = Name + "Native"; string wrapper = Name + "Native";
string qualname = ns + "Sharp." + wrapper; string qualname = MarshalType;
isig = new ImportSignature (parms, NS); isig = new ImportSignature (parms);
StreamWriter sw = gen_info.OpenStream (qualname); StreamWriter sw = gen_info.OpenStream (qualname);
sw.WriteLine ("namespace " + ns + "Sharp {"); sw.WriteLine ("namespace " + NS + "Sharp {");
sw.WriteLine (); sw.WriteLine ();
sw.WriteLine ("\tusing System;"); sw.WriteLine ("\tusing System;");
sw.WriteLine (); sw.WriteLine ();
@ -160,7 +160,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("#endregion"); sw.WriteLine ("#endregion");
sw.WriteLine ("}"); sw.WriteLine ("}");
sw.Close (); sw.Close ();
return ns + "Sharp." + Name + "Wrapper"; return NS + "Sharp." + Name + "Wrapper";
} }
public override void Generate (GenerationInfo gen_info) public override void Generate (GenerationInfo gen_info)
@ -191,7 +191,7 @@ namespace GtkSharp.Generation {
sw.Close (); sw.Close ();
GenWrapper (NS, gen_info); GenWrapper (gen_info);
Statistics.CBCount++; Statistics.CBCount++;
} }

View file

@ -28,12 +28,10 @@ namespace GtkSharp.Generation {
public class ImportSignature { public class ImportSignature {
Parameters parameters; Parameters parameters;
string impl_ns;
public ImportSignature (Parameters parms, string impl_ns) public ImportSignature (Parameters parms)
{ {
parameters = parms; parameters = parms;
this.impl_ns = impl_ns;
} }
public override string ToString () public override string ToString ()
@ -44,18 +42,13 @@ namespace GtkSharp.Generation {
string[] parms = new string [parameters.Count]; string[] parms = new string [parameters.Count];
for (int i = 0; i < parameters.Count; i++) { for (int i = 0; i < parameters.Count; i++) {
Parameter p = parameters [i]; Parameter p = parameters [i];
string m_type = p.MarshalType;
if (p.Generatable is CallbackGen) {
string[] toks = p.MarshalType.Split ('.');
m_type = impl_ns + "Sharp." + toks [toks.Length - 1];
}
parms [i] = ""; parms [i] = "";
if (p.CType == "GError**") if (p.CType == "GError**")
parms [i] += "out "; parms [i] += "out ";
else if (p.PassAs != "") else if (p.PassAs != "")
parms [i] += p.PassAs + " "; parms [i] += p.PassAs + " ";
parms [i] += m_type + " " + p.Name; parms [i] += p.MarshalType + " " + p.Name;
} }
string import_sig = String.Join (", ", parms); string import_sig = String.Join (", ", parms);

View file

@ -47,7 +47,7 @@ namespace GtkSharp.Generation {
public MethodBody Body { public MethodBody Body {
get { get {
if (body == null) if (body == null)
body = new MethodBody (parms, container_type.NS); body = new MethodBody (parms);
return body; return body;
} }
} }
@ -62,7 +62,7 @@ namespace GtkSharp.Generation {
public ImportSignature ImportSignature { public ImportSignature ImportSignature {
get { get {
if (isig == null) if (isig == null)
isig = new ImportSignature (parms, container_type.NS); isig = new ImportSignature (parms);
return isig; return isig;
} }
} }

View file

@ -29,12 +29,10 @@ namespace GtkSharp.Generation {
public class MethodBody { public class MethodBody {
Parameters parameters; Parameters parameters;
private string impl_ns;
public MethodBody (Parameters parms, string impl_ns) {
public MethodBody (Parameters parms)
{
parameters = parms; parameters = parms;
this.impl_ns = impl_ns;
} }
private string CastFromInt (string type) private string CastFromInt (string type)
@ -138,7 +136,7 @@ namespace GtkSharp.Generation {
if (gen is CallbackGen) { if (gen is CallbackGen) {
CallbackGen cbgen = gen as CallbackGen; CallbackGen cbgen = gen as CallbackGen;
string wrapper = cbgen.GenWrapper(impl_ns, gen_info); string wrapper = cbgen.GenWrapper(gen_info);
switch (p.Scope) { switch (p.Scope) {
case "notified": case "notified":
sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper;", wrapper, name); sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper;", wrapper, name);

View file

@ -340,7 +340,7 @@ namespace GtkSharp.Generation {
private void GenDefaultHandlerDelegate (StreamWriter sw, ClassBase implementor) private void GenDefaultHandlerDelegate (StreamWriter sw, ClassBase implementor)
{ {
ImportSignature isig = new ImportSignature (parms, container_type.NS); ImportSignature isig = new ImportSignature (parms);
ManagedCallString call = new ManagedCallString (parms); ManagedCallString call = new ManagedCallString (parms);
sw.WriteLine ("\t\t[GLib.CDeclCallback]"); sw.WriteLine ("\t\t[GLib.CDeclCallback]");
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + isig.ToString () + ");\n"); sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + isig.ToString () + ");\n");

View file

@ -39,7 +39,7 @@ namespace GtkSharp.Generation {
this.elem = elem; this.elem = elem;
retval = new ReturnValue (elem ["return-type"]); retval = new ReturnValue (elem ["return-type"]);
parms = new Parameters (elem["parameters"]); parms = new Parameters (elem["parameters"]);
isig = new ImportSignature (parms, container_type.NS); isig = new ImportSignature (parms);
} }
public string CName { public string CName {