2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
// GtkSharp.Generation.ClassBase.cs - Common code between object
|
|
|
|
// and interface wrappers
|
|
|
|
//
|
|
|
|
// Authors: Rachel Hestilow <hestilow@ximian.com>
|
|
|
|
// Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2004-04-07 19:15:01 +00:00
|
|
|
// Copyright (c) 2002 Rachel Hestilow
|
|
|
|
// Copyright (c) 2001-2003 Mike Kestner
|
|
|
|
// Copyright (c) 2004 Novell, Inc.
|
2004-06-25 16:35:15 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the GNU General Public
|
|
|
|
// License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public
|
|
|
|
// License along with this program; if not, write to the
|
|
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
2012-11-04 15:19:05 +00:00
|
|
|
using System.Collections.Generic;
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
using System.IO;
|
|
|
|
using System.Xml;
|
|
|
|
|
2004-12-26 19:33:34 +00:00
|
|
|
public abstract class ClassBase : GenBase {
|
2012-11-04 16:26:26 +00:00
|
|
|
private IDictionary<string, Property> props = new Dictionary<string, Property> ();
|
|
|
|
private IDictionary<string, ObjectField> fields = new Dictionary<string, ObjectField> ();
|
|
|
|
private IDictionary<string, Method> methods = new Dictionary<string, Method> ();
|
2013-10-08 16:45:42 +00:00
|
|
|
private IDictionary<string, Constant> constants = new Dictionary<string, Constant>();
|
2012-11-04 15:19:05 +00:00
|
|
|
protected IList<string> interfaces = new List<string>();
|
|
|
|
protected IList<string> managed_interfaces = new List<string>();
|
|
|
|
protected IList<Ctor> ctors = new List<Ctor>();
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2017-10-04 00:13:35 +00:00
|
|
|
protected List<StructABIField> abi_fields = new List<StructABIField> ();
|
2017-08-31 11:45:26 +00:00
|
|
|
protected bool abi_fields_valid; // false if the instance structure contains a bitfield or fields of unknown types
|
|
|
|
|
2002-07-26 06:08:52 +00:00
|
|
|
private bool ctors_initted = false;
|
2012-11-04 15:19:05 +00:00
|
|
|
private Dictionary<string, Ctor> clash_map;
|
2004-10-29 20:33:07 +00:00
|
|
|
private bool deprecated = false;
|
|
|
|
private bool isabstract = false;
|
2018-03-13 12:56:11 +00:00
|
|
|
public bool nameConstructors {
|
|
|
|
get {
|
|
|
|
return Elem.GetAttributeAsBoolean("name_constructors");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
|
2012-11-04 16:26:26 +00:00
|
|
|
public IDictionary<string, Method> Methods {
|
2002-06-23 03:38:02 +00:00
|
|
|
get {
|
|
|
|
return methods;
|
|
|
|
}
|
2012-11-04 16:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public IDictionary<string, Property> Properties {
|
|
|
|
get {
|
|
|
|
return props;
|
|
|
|
}
|
|
|
|
}
|
2002-06-23 03:38:02 +00:00
|
|
|
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
public ClassBase Parent {
|
|
|
|
get {
|
|
|
|
string parent = Elem.GetAttribute("parent");
|
2004-04-29 21:21:57 +00:00
|
|
|
|
|
|
|
if (parent == "")
|
|
|
|
return null;
|
|
|
|
else
|
|
|
|
return SymbolTable.Table.GetClassGen(parent);
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
|
2017-10-03 13:18:08 +00:00
|
|
|
|
2012-10-21 16:10:34 +00:00
|
|
|
deprecated = elem.GetAttributeAsBoolean ("deprecated");
|
|
|
|
isabstract = elem.GetAttributeAsBoolean ("abstract");
|
2017-08-31 11:45:26 +00:00
|
|
|
abi_fields_valid = true;
|
2017-10-04 18:32:02 +00:00
|
|
|
string parent_type = Elem.GetAttribute("parent");
|
2004-10-29 20:33:07 +00:00
|
|
|
|
2017-08-31 11:45:26 +00:00
|
|
|
int num_abi_fields = 0;
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
foreach (XmlNode node in elem.ChildNodes) {
|
2002-06-26 13:10:48 +00:00
|
|
|
if (!(node is XmlElement)) continue;
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
XmlElement member = (XmlElement) node;
|
2017-08-31 11:45:26 +00:00
|
|
|
StructABIField abi_field = null;
|
|
|
|
|
|
|
|
// Make sure ABI fields are taken into account, even when hidden.
|
|
|
|
if (node.Name == "field") {
|
|
|
|
num_abi_fields += 1;
|
2017-10-04 18:32:02 +00:00
|
|
|
// Skip instance parent struct if present, taking into account
|
|
|
|
// bindinator broken behaviour concerning parent field (ie.
|
|
|
|
// marking it as pointer, somehow risky but good enough for now.)
|
|
|
|
if (num_abi_fields != 1 ||
|
|
|
|
parent_type == "" ||
|
|
|
|
(member.GetAttribute("type").Replace("*", "") != parent_type
|
|
|
|
)) {
|
2017-10-04 00:13:35 +00:00
|
|
|
abi_field = new StructABIField (member, this, "abi_info");
|
2017-08-31 11:45:26 +00:00
|
|
|
abi_fields.Add (abi_field);
|
|
|
|
}
|
2017-09-06 15:17:13 +00:00
|
|
|
} else if (node.Name == "union") {
|
2017-10-04 00:13:35 +00:00
|
|
|
abi_field = new UnionABIField (member, this, "abi_info");
|
2017-09-06 15:17:13 +00:00
|
|
|
abi_fields.Add (abi_field);
|
2017-08-31 11:45:26 +00:00
|
|
|
}
|
|
|
|
|
2012-10-21 16:10:34 +00:00
|
|
|
if (member.GetAttributeAsBoolean ("hidden"))
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
continue;
|
2004-10-29 20:33:07 +00:00
|
|
|
|
2002-10-26 08:03:16 +00:00
|
|
|
string name;
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
switch (node.Name) {
|
|
|
|
case "method":
|
2002-10-26 08:03:16 +00:00
|
|
|
name = member.GetAttribute("name");
|
2002-07-10 03:09:39 +00:00
|
|
|
while (methods.ContainsKey(name))
|
|
|
|
name += "mangled";
|
2005-01-24 18:25:02 +00:00
|
|
|
methods.Add (name, new Method (member, this));
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case "property":
|
2002-10-26 08:03:16 +00:00
|
|
|
name = member.GetAttribute("name");
|
|
|
|
while (props.ContainsKey(name))
|
|
|
|
name += "mangled";
|
|
|
|
props.Add (name, new Property (member, this));
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
break;
|
|
|
|
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
case "field":
|
2017-10-03 13:12:43 +00:00
|
|
|
// FIXME Generate callbacks.
|
|
|
|
if (member.GetAttributeAsBoolean ("is_callback"))
|
|
|
|
continue;
|
|
|
|
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
name = member.GetAttribute("name");
|
|
|
|
while (fields.ContainsKey (name))
|
|
|
|
name += "mangled";
|
2017-08-31 11:45:26 +00:00
|
|
|
|
|
|
|
var field = new ObjectField (member, this);
|
|
|
|
field.abi_field = abi_field;
|
|
|
|
fields.Add (name, field);
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
break;
|
|
|
|
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
case "implements":
|
2005-04-11 20:35:56 +00:00
|
|
|
ParseImplements (member);
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
break;
|
|
|
|
|
2002-07-26 06:08:52 +00:00
|
|
|
case "constructor":
|
2005-01-24 18:25:02 +00:00
|
|
|
ctors.Add (new Ctor (member, this));
|
2002-07-26 06:08:52 +00:00
|
|
|
break;
|
|
|
|
|
2013-10-08 16:45:42 +00:00
|
|
|
case "constant":
|
|
|
|
name = member.GetAttribute ("name");
|
|
|
|
constants.Add (name, new Constant (member));
|
|
|
|
break;
|
|
|
|
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-03 13:18:08 +00:00
|
|
|
public virtual bool CanGenerateABIStruct(LogWriter log) {
|
2017-10-03 13:07:17 +00:00
|
|
|
return (abi_fields_valid);
|
2017-08-31 11:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CheckABIStructParent(LogWriter log, out string cs_parent_struct) {
|
|
|
|
cs_parent_struct = null;
|
2017-10-03 13:07:17 +00:00
|
|
|
|
|
|
|
if (!CanGenerateABIStruct(log))
|
2017-08-31 11:45:26 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
var parent = SymbolTable.Table[Elem.GetAttribute("parent")];
|
|
|
|
string cs_parent = SymbolTable.Table.GetCSType(Elem.GetAttribute("parent"));
|
|
|
|
var parent_can_generate = true;
|
|
|
|
|
|
|
|
cs_parent_struct = null;
|
|
|
|
if (parent != null) {
|
|
|
|
// FIXME Add that information to ManualGen and use it.
|
|
|
|
if (parent.CName == "GInitiallyUnowned" || parent.CName == "GObject") {
|
2017-10-03 13:18:08 +00:00
|
|
|
cs_parent_struct = "GLib.Object";
|
2017-08-31 11:45:26 +00:00
|
|
|
} else {
|
|
|
|
parent_can_generate = false;
|
|
|
|
var _parent = parent as ClassBase;
|
|
|
|
|
|
|
|
if (_parent != null) {
|
|
|
|
string tmp;
|
|
|
|
parent_can_generate = _parent.CheckABIStructParent(log, out tmp);
|
|
|
|
}
|
|
|
|
|
2017-10-03 13:18:08 +00:00
|
|
|
if (parent_can_generate)
|
|
|
|
cs_parent_struct = cs_parent;
|
2017-08-31 11:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!parent_can_generate) {
|
|
|
|
log.Warn("Can't generate ABI structrure as the parent structure '" +
|
|
|
|
parent.CName + "' can't be generated.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cs_parent_struct = "";
|
|
|
|
}
|
|
|
|
return parent_can_generate;
|
|
|
|
}
|
|
|
|
|
2017-10-04 00:13:35 +00:00
|
|
|
protected void GenerateStructureABI (GenerationInfo gen_info) {
|
|
|
|
GenerateStructureABI(gen_info, null, "abi_info", CName);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void GenerateStructureABI (GenerationInfo gen_info, List<StructABIField> _fields,
|
|
|
|
string info_name, string structname)
|
2017-08-31 11:45:26 +00:00
|
|
|
{
|
|
|
|
string cs_parent_struct = null;
|
|
|
|
|
2017-10-04 00:13:35 +00:00
|
|
|
if (_fields == null)
|
|
|
|
_fields = abi_fields;
|
|
|
|
|
2017-08-31 11:45:26 +00:00
|
|
|
LogWriter log = new LogWriter (QualifiedName);
|
|
|
|
if (!CheckABIStructParent (log, out cs_parent_struct))
|
|
|
|
return;
|
|
|
|
|
|
|
|
StreamWriter sw = gen_info.Writer;
|
|
|
|
|
|
|
|
var _new = "";
|
|
|
|
if (cs_parent_struct != "")
|
2017-10-03 13:18:08 +00:00
|
|
|
_new = "new ";
|
|
|
|
|
|
|
|
sw.WriteLine ();
|
|
|
|
sw.WriteLine ("\t\t// Internal representation of the wrapped structure ABI.");
|
2017-10-04 00:13:35 +00:00
|
|
|
sw.WriteLine ("\t\tstatic GLib.AbiStruct _" + info_name + " = null;");
|
|
|
|
sw.WriteLine ("\t\tstatic public " + _new + "GLib.AbiStruct " + info_name + " {");
|
2017-10-03 13:18:08 +00:00
|
|
|
sw.WriteLine ("\t\t\tget {");
|
2017-10-04 00:13:35 +00:00
|
|
|
sw.WriteLine ("\t\t\t\tif (_" + info_name + " == null)");
|
2017-10-03 13:18:08 +00:00
|
|
|
|
|
|
|
// Generate Tests
|
2017-10-04 19:14:18 +00:00
|
|
|
var using_parent_fields = false;
|
|
|
|
if (_fields.Count > 0) {
|
|
|
|
sw.WriteLine ("\t\t\t\t\t_" + info_name + " = new GLib.AbiStruct (new List<GLib.AbiField>{ ");
|
|
|
|
|
|
|
|
if (gen_info.CAbiWriter != null) {
|
2017-10-04 20:23:52 +00:00
|
|
|
gen_info.CAbiWriter.WriteLine("\tg_print(\"\\\"sizeof({0})\\\": \\\"%\" G_GUINT64_FORMAT \"\\\"\\n\", (guint64) sizeof({0}));", structname);
|
2017-10-04 19:14:18 +00:00
|
|
|
gen_info.AbiWriter.WriteLine("\t\t\tConsole.WriteLine(\"\\\"sizeof({0})\\\": \\\"\" + {1}.{2}." + info_name + ".Size + \"\\\"\");", structname, NS, Name);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (cs_parent_struct != "") {
|
|
|
|
sw.WriteLine ("\t\t\t\t\t_" + info_name + " = new GLib.AbiStruct ({0}.{1}.Fields);", cs_parent_struct, info_name);
|
|
|
|
using_parent_fields = true;
|
|
|
|
} else {
|
|
|
|
sw.WriteLine ("\t\t\t\t\t_" + info_name + " = new GLib.AbiStruct (new List<GLib.AbiField>{ ");
|
|
|
|
using_parent_fields = false;
|
|
|
|
}
|
2017-10-03 13:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StructABIField prev = null;
|
|
|
|
StructABIField next = null;
|
|
|
|
|
|
|
|
StringWriter field_alignment_structures_writer = new StringWriter();
|
2017-10-04 00:13:35 +00:00
|
|
|
for(int i=0; i < _fields.Count; i++) {
|
|
|
|
var field = _fields[i];
|
|
|
|
next = _fields.Count > i +1 ? _fields[i + 1] : null;
|
2017-08-31 11:45:26 +00:00
|
|
|
|
2017-12-01 00:59:07 +00:00
|
|
|
|
2017-10-03 13:18:08 +00:00
|
|
|
prev = field.Generate(gen_info, "\t\t\t\t\t", prev, next, cs_parent_struct,
|
|
|
|
field_alignment_structures_writer);
|
2017-12-01 00:59:07 +00:00
|
|
|
if (field.IsPadding)
|
|
|
|
continue;
|
2017-10-03 13:18:08 +00:00
|
|
|
var union = field as UnionABIField;
|
2017-10-04 00:13:35 +00:00
|
|
|
if (union == null && gen_info.CAbiWriter != null && !field.IsBitfield) {
|
|
|
|
gen_info.AbiWriter.WriteLine("\t\t\tConsole.WriteLine(\"\\\"{0}.{3}\\\": \\\"\" + {1}.{2}." + info_name + ".GetFieldOffset(\"{3}\") + \"\\\"\");", structname, NS, Name, field.CName);
|
2017-10-04 20:23:52 +00:00
|
|
|
gen_info.CAbiWriter.WriteLine("\tg_print(\"\\\"{0}.{1}\\\": \\\"%\" G_GUINT64_FORMAT \"\\\"\\n\", (guint64) G_STRUCT_OFFSET({0}, {1}));", structname, field.CName);
|
2017-10-03 13:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-10-04 00:13:35 +00:00
|
|
|
if (_fields.Count > 0 && gen_info.CAbiWriter != null) {
|
2017-10-03 13:18:08 +00:00
|
|
|
gen_info.AbiWriter.Flush();
|
|
|
|
gen_info.CAbiWriter.Flush();
|
|
|
|
}
|
|
|
|
|
2017-10-04 19:14:18 +00:00
|
|
|
if (!using_parent_fields)
|
|
|
|
sw.WriteLine ("\t\t\t\t\t});");
|
2017-08-31 11:45:26 +00:00
|
|
|
sw.WriteLine ();
|
2017-10-04 00:13:35 +00:00
|
|
|
sw.WriteLine ("\t\t\t\treturn _" + info_name + ";");
|
2017-10-03 13:18:08 +00:00
|
|
|
sw.WriteLine ("\t\t\t}");
|
2017-08-31 11:45:26 +00:00
|
|
|
sw.WriteLine ("\t\t}");
|
|
|
|
sw.WriteLine ();
|
|
|
|
|
2017-10-03 13:18:08 +00:00
|
|
|
sw.WriteLine (field_alignment_structures_writer.ToString());
|
|
|
|
sw.WriteLine ("\t\t// End of the ABI representation.");
|
2017-08-31 11:45:26 +00:00
|
|
|
sw.WriteLine ();
|
|
|
|
}
|
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
public override bool Validate ()
|
|
|
|
{
|
2011-02-20 18:11:08 +00:00
|
|
|
LogWriter log = new LogWriter (QualifiedName);
|
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
foreach (string iface in interfaces) {
|
2005-08-09 15:59:30 +00:00
|
|
|
InterfaceGen igen = SymbolTable.Table[iface] as InterfaceGen;
|
|
|
|
if (igen == null) {
|
2011-02-20 18:11:08 +00:00
|
|
|
log.Warn ("implements unknown GInterface " + iface);
|
2005-08-05 20:34:45 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-08-09 15:59:30 +00:00
|
|
|
if (!igen.ValidateForSubclass ()) {
|
2011-02-20 18:11:08 +00:00
|
|
|
log.Warn ("implements invalid GInterface " + iface);
|
2005-08-05 20:34:45 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-31 11:45:26 +00:00
|
|
|
foreach (StructABIField abi_field in abi_fields) {
|
|
|
|
if (!abi_field.Validate(log))
|
|
|
|
abi_fields_valid = false;
|
|
|
|
}
|
2017-10-03 13:18:08 +00:00
|
|
|
if (abi_fields_valid)
|
|
|
|
foreach (StructABIField abi_field in abi_fields) {
|
|
|
|
abi_field.SetGetOffseName();
|
|
|
|
}
|
2017-08-31 11:45:26 +00:00
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
ArrayList invalids = new ArrayList ();
|
|
|
|
|
|
|
|
foreach (Property prop in props.Values) {
|
2011-02-20 18:11:08 +00:00
|
|
|
if (!prop.Validate (log))
|
2005-08-05 20:34:45 +00:00
|
|
|
invalids.Add (prop);
|
|
|
|
}
|
|
|
|
foreach (Property prop in invalids)
|
|
|
|
props.Remove (prop.Name);
|
|
|
|
invalids.Clear ();
|
|
|
|
|
|
|
|
foreach (ObjectField field in fields.Values) {
|
2011-02-20 18:11:08 +00:00
|
|
|
if (!field.Validate (log))
|
2005-08-05 20:34:45 +00:00
|
|
|
invalids.Add (field);
|
|
|
|
}
|
|
|
|
foreach (ObjectField field in invalids)
|
|
|
|
fields.Remove (field.Name);
|
|
|
|
invalids.Clear ();
|
|
|
|
|
|
|
|
foreach (Method method in methods.Values) {
|
2011-02-20 18:11:08 +00:00
|
|
|
if (!method.Validate (log))
|
2005-08-05 20:34:45 +00:00
|
|
|
invalids.Add (method);
|
|
|
|
}
|
|
|
|
foreach (Method method in invalids)
|
|
|
|
methods.Remove (method.Name);
|
|
|
|
invalids.Clear ();
|
|
|
|
|
2013-10-08 16:45:42 +00:00
|
|
|
foreach (Constant con in constants.Values) {
|
|
|
|
if (!con.Validate (log))
|
|
|
|
invalids.Add (con);
|
|
|
|
}
|
|
|
|
foreach (Constant con in invalids)
|
|
|
|
constants.Remove (con.Name);
|
|
|
|
invalids.Clear ();
|
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
foreach (Ctor ctor in ctors) {
|
2011-02-20 18:11:08 +00:00
|
|
|
if (!ctor.Validate (log))
|
2005-08-05 20:34:45 +00:00
|
|
|
invalids.Add (ctor);
|
|
|
|
}
|
|
|
|
foreach (Ctor ctor in invalids)
|
|
|
|
ctors.Remove (ctor);
|
|
|
|
invalids.Clear ();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-10-29 20:33:07 +00:00
|
|
|
public bool IsDeprecated {
|
|
|
|
get {
|
|
|
|
return deprecated;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsAbstract {
|
|
|
|
get {
|
|
|
|
return isabstract;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-02 15:23:27 +00:00
|
|
|
public abstract string AssignToName { get; }
|
|
|
|
|
|
|
|
public abstract string CallByName ();
|
|
|
|
|
2007-09-21 16:37:04 +00:00
|
|
|
public override string DefaultValue {
|
|
|
|
get {
|
|
|
|
return "null";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-13 17:44:48 +00:00
|
|
|
protected virtual bool IsNodeNameHandled (string name)
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
{
|
|
|
|
switch (name) {
|
|
|
|
case "method":
|
|
|
|
case "property":
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
case "field":
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
case "signal":
|
|
|
|
case "implements":
|
2002-07-26 06:08:52 +00:00
|
|
|
case "constructor":
|
|
|
|
case "disabledefaultconstructor":
|
2013-10-08 16:45:42 +00:00
|
|
|
case "constant":
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-22 18:35:37 +00:00
|
|
|
public void GenProperties (GenerationInfo gen_info, ClassBase implementor)
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
{
|
2004-11-18 20:31:22 +00:00
|
|
|
if (props.Count == 0)
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
return;
|
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
foreach (Property prop in props.Values)
|
|
|
|
prop.Generate (gen_info, "\t\t", implementor);
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
}
|
|
|
|
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
protected void GenFields (GenerationInfo gen_info)
|
|
|
|
{
|
2017-10-03 13:18:08 +00:00
|
|
|
foreach (ObjectField field in fields.Values) {
|
2005-08-05 20:34:45 +00:00
|
|
|
field.Generate (gen_info, "\t\t");
|
2017-10-03 13:18:08 +00:00
|
|
|
}
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
}
|
|
|
|
|
2013-10-08 16:45:42 +00:00
|
|
|
protected void GenConstants (GenerationInfo gen_info)
|
|
|
|
{
|
|
|
|
foreach (Constant con in constants.Values)
|
|
|
|
con.Generate (gen_info, "\t\t");
|
|
|
|
}
|
|
|
|
|
2005-04-11 20:35:56 +00:00
|
|
|
private void ParseImplements (XmlElement member)
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
{
|
|
|
|
foreach (XmlNode node in member.ChildNodes) {
|
|
|
|
if (node.Name != "interface")
|
|
|
|
continue;
|
|
|
|
XmlElement element = (XmlElement) node;
|
2012-10-21 16:10:34 +00:00
|
|
|
if (element.GetAttributeAsBoolean ("hidden"))
|
2007-12-06 17:23:28 +00:00
|
|
|
continue;
|
2005-04-11 20:35:56 +00:00
|
|
|
if (element.HasAttribute ("cname"))
|
|
|
|
interfaces.Add (element.GetAttribute ("cname"));
|
|
|
|
else if (element.HasAttribute ("name"))
|
|
|
|
managed_interfaces.Add (element.GetAttribute ("name"));
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-13 14:29:06 +00:00
|
|
|
protected bool IgnoreMethod (Method method, ClassBase implementor)
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
{
|
2007-08-13 14:29:06 +00:00
|
|
|
if (implementor != null && implementor.QualifiedName != this.QualifiedName && method.IsStatic)
|
|
|
|
return true;
|
|
|
|
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
string mname = method.Name;
|
2004-12-17 17:55:07 +00:00
|
|
|
return ((method.IsSetter || (method.IsGetter && mname.StartsWith("Get"))) &&
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
((props != null) && props.ContainsKey(mname.Substring(3)) ||
|
|
|
|
(fields != null) && fields.ContainsKey(mname.Substring(3))));
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
}
|
|
|
|
|
2012-11-04 15:19:05 +00:00
|
|
|
public void GenMethods (GenerationInfo gen_info, IDictionary<string, bool> collisions, ClassBase implementor)
|
|
|
|
{
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
if (methods == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
foreach (Method method in methods.Values) {
|
2007-08-13 14:29:06 +00:00
|
|
|
if (IgnoreMethod (method, implementor))
|
2017-10-03 13:18:08 +00:00
|
|
|
continue;
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
string oname = null, oprotection = null;
|
2012-11-04 15:19:05 +00:00
|
|
|
if (collisions != null && collisions.ContainsKey (method.Name)) {
|
2005-08-05 20:34:45 +00:00
|
|
|
oname = method.Name;
|
|
|
|
oprotection = method.Protection;
|
|
|
|
method.Name = QualifiedName + "." + method.Name;
|
|
|
|
method.Protection = "";
|
|
|
|
}
|
|
|
|
method.Generate (gen_info, implementor);
|
|
|
|
if (oname != null) {
|
|
|
|
method.Name = oname;
|
|
|
|
method.Protection = oprotection;
|
2002-06-23 03:38:02 +00:00
|
|
|
}
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Method GetMethod (string name)
|
|
|
|
{
|
2012-11-04 16:26:26 +00:00
|
|
|
Method m = null;
|
|
|
|
methods.TryGetValue (name, out m);
|
|
|
|
return m;
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
}
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
|
|
|
|
public Property GetProperty (string name)
|
|
|
|
{
|
2012-11-04 16:26:26 +00:00
|
|
|
Property prop = null;
|
|
|
|
props.TryGetValue (name, out prop);
|
|
|
|
return prop;
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
}
|
|
|
|
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
public Method GetMethodRecursively (string name)
|
|
|
|
{
|
|
|
|
return GetMethodRecursively (name, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual Method GetMethodRecursively (string name, bool check_self)
|
|
|
|
{
|
|
|
|
Method p = null;
|
|
|
|
if (check_self)
|
|
|
|
p = GetMethod (name);
|
|
|
|
if (p == null && Parent != null)
|
|
|
|
p = Parent.GetMethodRecursively (name, true);
|
|
|
|
|
2005-04-11 20:35:56 +00:00
|
|
|
if (check_self && p == null) {
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
foreach (string iface in interfaces) {
|
2003-05-19 02:45:17 +00:00
|
|
|
ClassBase igen = SymbolTable.Table.GetClassGen (iface);
|
2008-01-30 15:30:27 +00:00
|
|
|
if (igen == null)
|
|
|
|
continue;
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
p = igen.GetMethodRecursively (name, true);
|
|
|
|
if (p != null)
|
|
|
|
break;
|
|
|
|
}
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
}
|
|
|
|
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
return p;
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public virtual Property GetPropertyRecursively (string name)
|
|
|
|
{
|
|
|
|
ClassBase klass = this;
|
|
|
|
Property p = null;
|
|
|
|
while (klass != null && p == null) {
|
|
|
|
p = (Property) klass.GetProperty (name);
|
|
|
|
klass = klass.Parent;
|
|
|
|
}
|
2011-11-20 18:41:56 +00:00
|
|
|
if (p == null) {
|
|
|
|
foreach (string iface in interfaces) {
|
|
|
|
ClassBase igen = SymbolTable.Table.GetClassGen (iface);
|
|
|
|
if (igen == null)
|
|
|
|
continue;
|
|
|
|
p = igen.GetPropertyRecursively (name);
|
|
|
|
if (p != null)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
public bool Implements (string iface)
|
|
|
|
{
|
2005-04-11 20:35:56 +00:00
|
|
|
if (interfaces.Contains (iface))
|
|
|
|
return true;
|
|
|
|
else if (Parent != null)
|
|
|
|
return Parent.Implements (iface);
|
2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* parser/Gnome.metadata, Gtk.metadata: More conflict
fixes.
* parser/build.pl: Fully qualify all lib names. (Gtk+ packages
are now LFS-compliant in Debian...)
* parser/gapi2xml.pl: Fix for whitespace in fields, defines,
and docs.
* generator/BoxedGen.cs: Remove extraneous CallByName definition,
add "override" keyword to FromNative.
(Generate): Generate methods after fields.
* generator/ClassBase.cs: Change CallByName, FromNative to virtual.
(.ctor): Ignore "hidden" nodes. Set container on signal.
(GenSignals, GenMethods): Add "implementor" argument for interface
use.
(Get(Method|Signal|Property)Recursively): Rework to correctly
recurse interfaces.
(Implements): Added.
* generator/Ctor.cs (Initialize): Move clash initialization completely
out of Generate, so we can check for collisions.
* generator/Method.cs (GenerateDeclCommon): Check for duplicates,
for "new" keyword.
(Generate): Add "implementor" argument.
* generator/ObjectGen.cs (Generate): Initialize ctor clashes on
this and all parents, before generating.
(Ctors, InitializeCtors): Added.
* generator/Signal.cs: Store the container_type, check for
collisions.
* generator/StructGen.cs: Add "override" keyword to overriden methods.
* gtk/FileSelection.custom (ActionArea): Add "new" keyword.
svn path=/trunk/gtk-sharp/; revision=5782
2002-07-13 20:31:23 +00:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2012-11-04 15:19:05 +00:00
|
|
|
public IList<Ctor> Ctors { get { return ctors; } }
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2005-01-24 18:25:02 +00:00
|
|
|
bool HasStaticCtor (string name)
|
|
|
|
{
|
|
|
|
if (Parent != null && Parent.HasStaticCtor (name))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
foreach (Ctor ctor in Ctors)
|
|
|
|
if (ctor.StaticName == name)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-07-26 06:08:52 +00:00
|
|
|
private void InitializeCtors ()
|
|
|
|
{
|
|
|
|
if (ctors_initted)
|
|
|
|
return;
|
2003-07-23 07:16:46 +00:00
|
|
|
|
2005-01-24 18:25:02 +00:00
|
|
|
if (Parent != null)
|
|
|
|
Parent.InitializeCtors ();
|
|
|
|
|
2012-11-04 15:19:05 +00:00
|
|
|
var valid_ctors = new List<Ctor>();
|
|
|
|
clash_map = new Dictionary<string, Ctor>();
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2003-07-23 07:16:46 +00:00
|
|
|
foreach (Ctor ctor in ctors) {
|
2018-03-13 12:56:11 +00:00
|
|
|
if (nameConstructors) {
|
|
|
|
ctor.IsStatic = true;
|
|
|
|
if (Parent != null && Parent.HasStaticCtor (ctor.StaticName))
|
|
|
|
ctor.Modifiers = "new ";
|
|
|
|
} else if (clash_map.ContainsKey (ctor.Signature.Types)) {
|
2012-11-04 15:19:05 +00:00
|
|
|
Ctor clash = clash_map [ctor.Signature.Types];
|
2005-08-05 20:34:45 +00:00
|
|
|
Ctor alter = ctor.Preferred ? clash : ctor;
|
|
|
|
alter.IsStatic = true;
|
|
|
|
if (Parent != null && Parent.HasStaticCtor (alter.StaticName))
|
|
|
|
alter.Modifiers = "new ";
|
2005-01-24 18:25:02 +00:00
|
|
|
} else
|
2005-08-05 20:34:45 +00:00
|
|
|
clash_map [ctor.Signature.Types] = ctor;
|
|
|
|
|
|
|
|
valid_ctors.Add (ctor);
|
2003-07-23 07:16:46 +00:00
|
|
|
}
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2005-01-24 18:25:02 +00:00
|
|
|
ctors = valid_ctors;
|
2002-07-26 06:08:52 +00:00
|
|
|
ctors_initted = true;
|
|
|
|
}
|
|
|
|
|
2003-10-05 00:20:17 +00:00
|
|
|
protected virtual void GenCtors (GenerationInfo gen_info)
|
2002-07-26 06:08:52 +00:00
|
|
|
{
|
2005-01-24 18:25:02 +00:00
|
|
|
InitializeCtors ();
|
2003-07-23 07:16:46 +00:00
|
|
|
foreach (Ctor ctor in ctors)
|
2003-10-05 00:20:17 +00:00
|
|
|
ctor.Generate (gen_info);
|
2002-07-26 06:08:52 +00:00
|
|
|
}
|
|
|
|
|
2007-08-13 14:29:06 +00:00
|
|
|
public virtual void Finish (StreamWriter sw, string indent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void Prepare (StreamWriter sw, string indent)
|
|
|
|
{
|
|
|
|
}
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
}
|
|
|
|
}
|