Ryujinx-GtkSharp/generator/ClassBase.cs

425 lines
10 KiB
C#
Raw Normal View History

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 19:15:19 +02:00
// GtkSharp.Generation.ClassBase.cs - Common code between object
// and interface wrappers
//
// Authors: Rachel Hestilow <hestilow@ximian.com>
// Mike Kestner <mkestner@speakeasy.net>
//
// Copyright (c) 2002 Rachel Hestilow
// Copyright (c) 2001-2003 Mike Kestner
// Copyright (c) 2004 Novell, Inc.
//
// 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 19:15:19 +02:00
namespace GtkSharp.Generation {
using System;
using System.Collections;
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 19:15:19 +02:00
using System.IO;
using System.Xml;
public abstract class ClassBase : GenBase {
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> ();
private IDictionary<string, Constant> constants = new Dictionary<string, Constant>();
protected IList<string> interfaces = new List<string>();
protected IList<string> managed_interfaces = new List<string>();
protected IList<Ctor> ctors = new List<Ctor>();
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
private bool ctors_initted = false;
private Dictionary<string, Ctor> clash_map;
private bool deprecated = false;
private bool isabstract = false;
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 19:15:19 +02:00
public IDictionary<string, Method> Methods {
get {
return methods;
}
}
public IDictionary<string, Property> Properties {
get {
return props;
}
}
public ClassBase Parent {
get {
string parent = Elem.GetAttribute("parent");
if (parent == "")
return null;
else
return SymbolTable.Table.GetClassGen(parent);
}
}
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
2002-07-30 Rachel Hestilow <hestilow@ximian.com> * generator/ClassBase.cs: Change hasDefaultConstructor to protected, adjust now that it is an attr and not a subnode. Also add virtual property AssignToName (for ctors). * generator/Ctor.cs: Add property ForceStatic. (Generate): Optimize return code a bit for the static case. * generator/Method.cs: Assign to a "raw_ret" pointer before calling FromNativeReturn. * generator/Parameters.cs: Change "out ref" to "out", not "ref". * generator/Property.cs: Fix to work correctly with all object and struct types (mostly just some if-cases added). * generator/SignalHandler.cs: Remove args_type and argfields (unused). (Generate): Initialize struct if necessary. * generator/StructBase.cs: Massive reworking to support methods, ctors, etc. * generator/SymbolTable.cs: Add GdkAtom and gconstpointer simple types. * glib/Boxed.cs: Accept both IntPtr and object ctors. Add access for both. * glib/Opaque.cs: Fix copy/pasted copyright notice, remove data and event fields. Fix docs. * glib/Value.cs: Work correctly with boxed properties. * gnome/Modules.cs: Use new struct ctors. * gnome/Program.custom: Remove Get, this is being generated now. * parser/Gdk.metadata: Fix the drawable classes to inherit correctly. * parser/Metadata.pm: Change per-class attributes to actually be attributes. * parser/Gtk.metadata: Add a dummy attribute value for disabledefaultctor. * parser/gapi2xml.pl: Add hacks for the (broken) Drawable and Bitmap typedefs. * sample/test/TestColorSelection.cs: Display color string in hex format, update to use IsNull instead of == null, and size dialog to look pretty. * sample/Size.cs: Added. svn path=/trunk/gtk-sharp/; revision=6264
2002-07-31 01:02:12 +02:00
deprecated = elem.GetAttributeAsBoolean ("deprecated");
isabstract = elem.GetAttributeAsBoolean ("abstract");
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 19:15:19 +02:00
foreach (XmlNode node in elem.ChildNodes) {
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 19:15:19 +02:00
XmlElement member = (XmlElement) node;
if (member.GetAttributeAsBoolean ("hidden"))
continue;
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 19:15:19 +02:00
switch (node.Name) {
case "method":
name = member.GetAttribute("name");
while (methods.ContainsKey(name))
name += "mangled";
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 19:15:19 +02:00
break;
case "property":
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 19:15:19 +02: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 16:28:55 +02:00
case "field":
name = member.GetAttribute("name");
while (fields.ContainsKey (name))
name += "mangled";
fields.Add (name, new ObjectField (member, this));
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 19:15:19 +02:00
case "implements":
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 19:15:19 +02:00
break;
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
case "constructor":
ctors.Add (new Ctor (member, this));
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
break;
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 19:15:19 +02:00
default:
break;
}
}
}
public override bool Validate ()
{
LogWriter log = new LogWriter (QualifiedName);
foreach (string iface in interfaces) {
InterfaceGen igen = SymbolTable.Table[iface] as InterfaceGen;
if (igen == null) {
log.Warn ("implements unknown GInterface " + iface);
return false;
}
if (!igen.ValidateForSubclass ()) {
log.Warn ("implements invalid GInterface " + iface);
return false;
}
}
ArrayList invalids = new ArrayList ();
foreach (Property prop in props.Values) {
if (!prop.Validate (log))
invalids.Add (prop);
}
foreach (Property prop in invalids)
props.Remove (prop.Name);
invalids.Clear ();
foreach (ObjectField field in fields.Values) {
if (!field.Validate (log))
invalids.Add (field);
}
foreach (ObjectField field in invalids)
fields.Remove (field.Name);
invalids.Clear ();
foreach (Method method in methods.Values) {
if (!method.Validate (log))
invalids.Add (method);
}
foreach (Method method in invalids)
methods.Remove (method.Name);
invalids.Clear ();
foreach (Constant con in constants.Values) {
if (!con.Validate (log))
invalids.Add (con);
}
foreach (Constant con in invalids)
constants.Remove (con.Name);
invalids.Clear ();
foreach (Ctor ctor in ctors) {
if (!ctor.Validate (log))
invalids.Add (ctor);
}
foreach (Ctor ctor in invalids)
ctors.Remove (ctor);
invalids.Clear ();
return true;
}
public bool IsDeprecated {
get {
return deprecated;
}
}
public bool IsAbstract {
get {
return isabstract;
}
}
public abstract string AssignToName { get; }
public abstract string CallByName ();
public override string DefaultValue {
get {
return "null";
}
}
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 19:15:19 +02: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 16:28:55 +02: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 19:15:19 +02:00
case "signal":
case "implements":
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
case "constructor":
case "disabledefaultconstructor":
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 19:15:19 +02:00
return true;
default:
return false;
}
}
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 19:15:19 +02: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 19:15:19 +02:00
return;
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 19:15:19 +02: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 16:28:55 +02:00
protected void GenFields (GenerationInfo gen_info)
{
foreach (ObjectField field in fields.Values)
field.Generate (gen_info, "\t\t");
* 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 16:28:55 +02:00
}
protected void GenConstants (GenerationInfo gen_info)
{
foreach (Constant con in constants.Values)
con.Generate (gen_info, "\t\t");
}
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 19:15:19 +02:00
{
foreach (XmlNode node in member.ChildNodes) {
if (node.Name != "interface")
continue;
XmlElement element = (XmlElement) node;
if (element.GetAttributeAsBoolean ("hidden"))
continue;
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 19:15:19 +02: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 19:15:19 +02: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 19:15:19 +02:00
string mname = method.Name;
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 16:28:55 +02: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 19:15:19 +02: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 19:15:19 +02:00
if (methods == null)
return;
foreach (Method method in methods.Values) {
if (IgnoreMethod (method, 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 19:15:19 +02:00
continue;
string oname = null, oprotection = null;
if (collisions != null && collisions.ContainsKey (method.Name)) {
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-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 19:15:19 +02:00
}
}
public Method GetMethod (string name)
{
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 19:15:19 +02:00
}
public Property GetProperty (string name)
{
Property prop = null;
props.TryGetValue (name, out prop);
return prop;
}
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);
if (check_self && p == null) {
foreach (string iface in interfaces) {
ClassBase igen = SymbolTable.Table.GetClassGen (iface);
if (igen == null)
continue;
p = igen.GetMethodRecursively (name, true);
if (p != null)
break;
}
}
return p;
}
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 19:41:56 +01: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;
}
}
return p;
}
public bool Implements (string iface)
{
if (interfaces.Contains (iface))
return true;
else if (Parent != null)
return Parent.Implements (iface);
else
return false;
}
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
public IList<Ctor> Ctors { get { return ctors; } }
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02: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-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
private void InitializeCtors ()
{
if (ctors_initted)
return;
if (Parent != null)
Parent.InitializeCtors ();
var valid_ctors = new List<Ctor>();
clash_map = new Dictionary<string, Ctor>();
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
foreach (Ctor ctor in ctors) {
if (clash_map.ContainsKey (ctor.Signature.Types)) {
Ctor clash = clash_map [ctor.Signature.Types];
Ctor alter = ctor.Preferred ? clash : ctor;
alter.IsStatic = true;
if (Parent != null && Parent.HasStaticCtor (alter.StaticName))
alter.Modifiers = "new ";
} else
clash_map [ctor.Signature.Types] = ctor;
valid_ctors.Add (ctor);
}
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
ctors = valid_ctors;
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
ctors_initted = true;
}
2003-10-05 02:20:17 +02:00
protected virtual void GenCtors (GenerationInfo gen_info)
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02:00
{
InitializeCtors ();
foreach (Ctor ctor in ctors)
2003-10-05 02:20:17 +02:00
ctor.Generate (gen_info);
2002-07-25 Rachel Hestilow <hestilow@ximian.com> [about 60% of the marshalling patch that I lost. The rest to come tomorrow.] * generator/BoxedGen.cs, StructGen.cs: Move most of this to StructBase, delete large chunks duplicated from ClassBase. * generator/IGeneratable.cs: Add MarshalReturnType, FromNativeReturn. * generator/ClassBase.cs: Move ctor stuff here. Add a CallByName overload with no parameters for the "self" reference. * generator/EnumGen.cs, CallbackGen.cs: Implement new MarshalReturnType, FromNativeReturn. * generator/Method.cs: Use container_type.MarshalType, CallByName, and SymbolTable.FromNativeReturn when generating call and import sigs. * generator/OpaqueGen.cs: Added. * generator/Property.cs: Handle boxed and opaques differently. * generator/SymbolTable.cs: Update for the opaque stuff and the new Return methods. Also change GetClassGen to simply call the as operator. * glib/Boxed.cs: Update for struct usage -- this is now a wrapper for the purposes of using with Value. * glib/Opaque.cs: Added. New base class for opaque structs. * glue/textiter.c, gtk/TextIter.custom: Remove. * gnome/Program.cs: Update for new struct marshalling. * parser/Metadata.pm: Use our own getChildrenByTagName. * parser/README: Update for new requirements (was out of sync with build.pl) * parser/gapi2xml.pl: Hide struct like const in field elements. * parser/gapi_pp.pl: Handle embedded union fields (poorly). * sample/test/TestColorSelection.cs: Comment out null color tests for now. svn path=/trunk/gtk-sharp/; revision=6186
2002-07-26 08:08:52 +02: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 19:15:19 +02:00
}
}