2002-06-23 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: Add accessors for methods and signals. Change GenSignals and GenMethods to public, as csc has a different idea of protected than mcs. Handle interface collisions in GenMethods. * generator/Method.cs: Add accessor Protection - "public" by default. * generator/ObjectGen.cs: Make sure wrapper's Signals hashtable only gets generated once. Generate a list of collisions for GenMethods. Remove dead foreach loop from Validate. * generator/Paramaters.cs (CreateSignature): Initialize last_param. * parser/Gtk.metadata: Add property & event collision renames for TextBuffer and OldEditable. * sample/makefile.win32: Reference atk-sharp.dll. * makefile.win32: Do not build gdk.imaging. svn path=/trunk/gtk-sharp/; revision=5420
This commit is contained in:
parent
948bb15432
commit
7fb558bea0
10 changed files with 157 additions and 26 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2002-06-23 Rachel Hestilow <hestilow@ximian.com>
|
||||
|
||||
* generator/ClassBase.cs: Add accessors for methods and signals.
|
||||
Change GenSignals and GenMethods to public, as csc has a different
|
||||
idea of protected than mcs. Handle interface collisions in
|
||||
GenMethods.
|
||||
|
||||
* generator/Method.cs: Add accessor Protection - "public" by default.
|
||||
|
||||
* generator/ObjectGen.cs: Make sure wrapper's Signals hashtable only
|
||||
gets generated once. Generate a list of collisions for GenMethods.
|
||||
Remove dead foreach loop from Validate.
|
||||
|
||||
* generator/Paramaters.cs (CreateSignature): Initialize last_param.
|
||||
|
||||
* parser/Gtk.metadata: Add property & event collision renames
|
||||
for TextBuffer and OldEditable.
|
||||
|
||||
* sample/makefile.win32: Reference atk-sharp.dll.
|
||||
|
||||
* makefile.win32: Do not build gdk.imaging.
|
||||
|
||||
2002-06-22 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* */makefile.win32 : add docs target
|
||||
|
|
|
@ -18,6 +18,18 @@ namespace GtkSharp.Generation {
|
|||
protected Hashtable methods = new Hashtable();
|
||||
protected ArrayList interfaces = null;
|
||||
|
||||
public Hashtable Methods {
|
||||
get {
|
||||
return methods;
|
||||
}
|
||||
}
|
||||
|
||||
public Hashtable Signals {
|
||||
get {
|
||||
return sigs;
|
||||
}
|
||||
}
|
||||
|
||||
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
|
||||
foreach (XmlNode node in elem.ChildNodes) {
|
||||
XmlElement member = (XmlElement) node;
|
||||
|
@ -89,13 +101,11 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
protected void GenSignals (StreamWriter sw)
|
||||
public void GenSignals (StreamWriter sw)
|
||||
{
|
||||
if (sigs == null)
|
||||
return;
|
||||
|
||||
sw.WriteLine("\t\tprivate Hashtable Signals = new Hashtable();");
|
||||
|
||||
foreach (Signal sig in sigs.Values) {
|
||||
if (sig.Validate ())
|
||||
sig.Generate (sw);
|
||||
|
@ -125,7 +135,7 @@ namespace GtkSharp.Generation {
|
|||
(props != null) && props.ContainsKey(mname.Substring(3)));
|
||||
}
|
||||
|
||||
public void GenMethods (StreamWriter sw)
|
||||
public void GenMethods (StreamWriter sw, Hashtable collisions)
|
||||
{
|
||||
if (methods == null)
|
||||
return;
|
||||
|
@ -135,7 +145,22 @@ namespace GtkSharp.Generation {
|
|||
continue;
|
||||
|
||||
if (method.Validate ())
|
||||
{
|
||||
String oname = null, oprotection = null;
|
||||
if (collisions != null && collisions.Contains (method.Name))
|
||||
{
|
||||
oname = method.Name;
|
||||
oprotection = method.Protection;
|
||||
method.Name = Name + "." + method.Name;
|
||||
method.Protection = "";
|
||||
}
|
||||
method.Generate (sw);
|
||||
if (oname != null)
|
||||
{
|
||||
method.Name = oname;
|
||||
method.Protection = oprotection;
|
||||
}
|
||||
}
|
||||
else
|
||||
Console.WriteLine(" in Object " + Name);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace GtkSharp.Generation {
|
|||
private string sig, isig, call;
|
||||
private string rettype, m_ret, s_ret;
|
||||
private string name, cname, safety;
|
||||
private string protection = "public";
|
||||
private bool is_get, is_set;
|
||||
|
||||
public Method (string libname, XmlElement elem, ClassBase container_type)
|
||||
|
@ -49,6 +50,15 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string Protection {
|
||||
get {
|
||||
return protection;
|
||||
}
|
||||
set {
|
||||
protection = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
if (!(o is Method))
|
||||
|
@ -249,8 +259,10 @@ namespace GtkSharp.Generation {
|
|||
GenerateImport (sw);
|
||||
if (comp != null && s_ret == comp.parms.AccessorReturnType)
|
||||
comp.GenerateImport (sw);
|
||||
|
||||
sw.Write("\t\tpublic ");
|
||||
|
||||
sw.Write("\t\t");
|
||||
if (protection != "")
|
||||
sw.Write("{0} ", protection);
|
||||
GenerateDeclCommon (sw);
|
||||
|
||||
if (is_get || is_set)
|
||||
|
|
|
@ -69,13 +69,43 @@ namespace GtkSharp.Generation {
|
|||
|
||||
GenCtors (sw);
|
||||
GenProperties (sw);
|
||||
GenSignals (sw);
|
||||
GenMethods (sw);
|
||||
|
||||
if (interfaces != null) {
|
||||
bool has_sigs = (sigs != null);
|
||||
if (!has_sigs) {
|
||||
foreach (string iface in interfaces) {
|
||||
ClassBase igen = SymbolTable.GetClassGen (iface);
|
||||
igen.GenMethods (sw);
|
||||
if (igen.Signals != null) {
|
||||
has_sigs = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (has_sigs)
|
||||
{
|
||||
sw.WriteLine("\t\tprivate Hashtable Signals = new Hashtable();");
|
||||
GenSignals (sw);
|
||||
}
|
||||
|
||||
GenMethods (sw, null);
|
||||
|
||||
if (interfaces != null) {
|
||||
Hashtable all_methods = new Hashtable ();
|
||||
Hashtable collisions = new Hashtable ();
|
||||
foreach (string iface in interfaces) {
|
||||
ClassBase igen = SymbolTable.GetClassGen (iface);
|
||||
foreach (Method m in igen.Methods.Values) {
|
||||
if (all_methods.Contains (m.Name))
|
||||
collisions[m.Name] = true;
|
||||
else
|
||||
all_methods[m.Name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string iface in interfaces) {
|
||||
ClassBase igen = SymbolTable.GetClassGen (iface);
|
||||
igen.GenMethods (sw, collisions);
|
||||
igen.GenSignals (sw);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,12 +146,8 @@ namespace GtkSharp.Generation {
|
|||
if (!method.Validate())
|
||||
return false;
|
||||
|
||||
if (interfaces != null) {
|
||||
foreach (string iface in interfaces) {
|
||||
if (SymbolTable.GetCSType(parent) == null)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (SymbolTable.GetCSType(parent) == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
DIRS=generator glib pango atk gdk gdk.imaging gtk sample
|
||||
DIRS=generator glib pango atk gdk gtk sample
|
||||
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
|
||||
CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe
|
||||
|
||||
|
|
|
@ -300,6 +300,17 @@
|
|||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
<rule>
|
||||
<class name="GtkTextBuffer">
|
||||
<method>GetInsert</method>
|
||||
</class>
|
||||
<data>
|
||||
<attribute target="method">
|
||||
<name>name</name>
|
||||
<value>GetInsertMark</value>
|
||||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
<rule>
|
||||
<class name="GtkItem">
|
||||
<signal>Select</signal>
|
||||
|
@ -741,6 +752,18 @@
|
|||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
<rule>
|
||||
<class name="GtkOldEditable">
|
||||
<method>Changed</method>
|
||||
</class>
|
||||
<data>
|
||||
<attribute target="method">
|
||||
<name>name</name>
|
||||
<value>Change</value>
|
||||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<class name="GtkAdjustment">
|
||||
<method>ValueChanged</method>
|
||||
|
|
|
@ -4,11 +4,11 @@ $file = "../generator/gtkapi.xml";
|
|||
|
||||
unlink ($file);
|
||||
|
||||
%srcs = ( "atk-1.0.0/atk" => "Atk:atk-1.0",
|
||||
"pango-1.0.0/pango" => "Pango:pango-1.0",
|
||||
"gtk+-2.0.0/gdk" => "Gdk:gdk-x11-2.0",
|
||||
"gtk+-2.0.0/gdk-pixbuf" => "Gdk:gdk_pixbuf-2.0",
|
||||
"gtk+-2.0.0/gtk" => "Gtk:gtk-x11-2.0");
|
||||
%srcs = ( "atk-1.0.2/atk" => "Atk:atk-1.0",
|
||||
"pango-1.0.2/pango" => "Pango:pango-1.0",
|
||||
"gtk+-2.0.3/gdk" => "Gdk:gdk-x11-2.0",
|
||||
"gtk+-2.0.3/gdk-pixbuf" => "Gdk:gdk_pixbuf-2.0",
|
||||
"gtk+-2.0.3/gtk" => "Gtk:gtk-x11-2.0");
|
||||
|
||||
foreach $dir (keys %srcs) {
|
||||
($ns, $lib) = split (/:/, $srcs{$dir});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
all: windows
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /r:../gdk/gdk-sharp.dll HelloWorld.cs
|
||||
$(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
|
||||
$(CSC) /unsafe /out:menu.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll Menu.cs
|
||||
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../atk/atk-sharp.dll /r:../gtk/gtk-sharp.dll /r:../gdk/gdk-sharp.dll HelloWorld.cs
|
||||
$(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../atk/atk-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
|
||||
$(CSC) /unsafe /out:menu.exe /r:../glib/glib-sharp.dll /r:../atk/atk-sharp.dll /r:../gtk/gtk-sharp.dll Menu.cs
|
||||
|
||||
docs:
|
||||
@echo "No docs to make."
|
||||
|
|
|
@ -300,6 +300,17 @@
|
|||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
<rule>
|
||||
<class name="GtkTextBuffer">
|
||||
<method>GetInsert</method>
|
||||
</class>
|
||||
<data>
|
||||
<attribute target="method">
|
||||
<name>name</name>
|
||||
<value>GetInsertMark</value>
|
||||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
<rule>
|
||||
<class name="GtkItem">
|
||||
<signal>Select</signal>
|
||||
|
@ -741,6 +752,18 @@
|
|||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
<rule>
|
||||
<class name="GtkOldEditable">
|
||||
<method>Changed</method>
|
||||
</class>
|
||||
<data>
|
||||
<attribute target="method">
|
||||
<name>name</name>
|
||||
<value>Change</value>
|
||||
</attribute>
|
||||
</data>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<class name="GtkAdjustment">
|
||||
<method>ValueChanged</method>
|
||||
|
|
Loading…
Reference in a new issue