* generator/ClassBase.cs (Validate): Don't fully validate the

parent class and interfaces (because we don't want to see the
	warnings about certain GtkWidget methods in every single library
	that defines a widget, etc). Instead, use the new
	ValidateForSubclass() method.
	(ValidateForSubclass): only validate the signals

	* generator/InterfaceGen.cs (ValidateForSubclass): for interfaces
	we need to validate the methods too.

	* generator/ObjectGen.cs (Generate): Check for interface method
	collisions against the class's own methods too, not just its other
	interfaces. Also, it's only a collision if the methods' signatures
	have the same types.

	* generator/Signal.cs (GenDefaultHandlerDelegate): Use
	"{0}_managed" rather than "obj" for the internal variable name, to
	avoid compile problems with signals that have a parameter named
	"obj".

	* generator/SymbolTable.cs (MangleName): mangle "internal" to
	"_internal".

svn path=/trunk/gtk-sharp/; revision=48184
This commit is contained in:
Dan Winship 2005-08-09 17:33:46 +00:00
parent 9a71bd5ee2
commit d6ec3f77ff
7 changed files with 59 additions and 7 deletions

View File

@ -10,6 +10,19 @@
* generator/InterfaceGen.cs (ValidateForSubclass): for interfaces
we need to validate the methods too.
* generator/ObjectGen.cs (Generate): Check for interface method
collisions against the class's own methods too, not just its other
interfaces. Also, it's only a collision if the methods' signatures
have the same types.
* generator/Signal.cs (GenDefaultHandlerDelegate): Use
"{0}_managed" rather than "obj" for the internal variable name, to
avoid compile problems with signals that have a parameter named
"obj".
* generator/SymbolTable.cs (MangleName): mangle "internal" to
"_internal".
2005-08-09 Dan Winship <danw@novell.com>
* generator/OpaqueGen.cs (Generate): Tweak the generated Ref/Unref

View File

@ -1996,5 +1996,39 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="AddSelection">
<MemberSignature Language="C#" Value="public bool AddSelection (int i);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="i" Type="System.Int32" />
</Parameters>
<Docs>
<param name="i">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="AddSelection">
<MemberSignature Language="C#" Value="public bool AddSelection (int start_offset, int end_offset);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="start_offset" Type="System.Int32" />
<Parameter Name="end_offset" Type="System.Int32" />
</Parameters>
<Docs>
<param name="start_offset">To be added.</param>
<param name="end_offset">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>

View File

@ -177,7 +177,7 @@
<Docs>
<summary>Whether or not this <see cref="T:GLib.Opaque" /> wrapper owns the raw object.</summary>
<value>
<see langword="true" /> if the wrapper owns the raw object and will <see cref="M:GLib.Opaque.Unref"/> / <see cref="M:GLib.Opaque.Free"/> it when the wrapper is disposed.</value>
<see langword="true" /> if the wrapper owns the raw object and will <see cref="M:GLib.Opaque.Unref" /> / <see cref="M:GLib.Opaque.Free" /> it when the wrapper is disposed.</value>
<remarks>By default, this is set to <see langword="true" /> for opaque objects created with the no-argument constructor, and <see langword="false" /> for opaque objects created with the <see cref="T:System.IntPtr" /> constructor. Methods that return an opaque object can override this by setting the <see cref="M:GLib.Opaque.Owned" /> property accordingly to obey the memory-management conventions of the underlying C code.</remarks>
</Docs>
</Member>

View File

@ -1185,4 +1185,4 @@ public class MyWindow : Window
</Docs>
</Member>
</Members>
</Type>
</Type>

View File

@ -128,7 +128,7 @@ namespace GtkSharp.Generation {
return result;
}
public override void Generate (GenerationInfo gen_info)
{
gen_info.CurrentType = Name;
@ -202,14 +202,17 @@ namespace GtkSharp.Generation {
if (interfaces.Count != 0) {
Hashtable all_methods = new Hashtable ();
foreach (Method m in Methods.Values)
all_methods[m.Name] = m;
Hashtable collisions = new Hashtable ();
foreach (string iface in interfaces) {
ClassBase igen = table.GetClassGen (iface);
foreach (Method m in igen.Methods.Values) {
if (all_methods.Contains (m.Name))
Method collision = all_methods[m.Name] as Method;
if (collision != null && collision.Signature.Types == m.Signature.Types)
collisions[m.Name] = true;
else
all_methods[m.Name] = true;
all_methods[m.Name] = m;
}
}

View File

@ -346,10 +346,10 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\tstatic {0} {1};\n", Name + "VMDelegate", Name + "VMCallback");
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + Name.ToLower() + "_cb (" + isig.ToString () + ")");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\t{0} obj = GLib.Object.GetObject ({1}, false) as {0};", implementor != null ? implementor.Name : container_type.Name, parms[0].Name);
sw.WriteLine ("\t\t\t{0} {1}_managed = GLib.Object.GetObject ({1}, false) as {0};", implementor != null ? implementor.Name : container_type.Name, parms[0].Name);
sw.Write (call.Setup ("\t\t\t"));
sw.Write ("\t\t\t{0}", IsVoid ? "" : retval.CSType == retval.ToNativeType ? "return " : retval.CSType + " raw_ret = ");
sw.WriteLine ("obj.{0} ({1});", "On" + Name, call.ToString ());
sw.WriteLine ("{2}_managed.{0} ({1});", "On" + Name, call.ToString (), parms[0].Name);
sw.Write (call.Finish ("\t\t\t"));
if (!IsVoid && retval.CSType != retval.ToNativeType)
sw.WriteLine ("\t\t\treturn {0};", SymbolTable.Table.ToNativeReturn (retval.CType, "raw_ret"));

View File

@ -377,6 +377,8 @@ namespace GtkSharp.Generation {
return "read_only";
case "interface":
return "iface";
case "internal":
return "_internal";
default:
break;
}