If the parent already has a GType property, add a "new" keywords to hide
it.
This eliminates a lot of warnings when using classes derived from
Opaque. Closes issue #100.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
A static getter method would always generate a Handle parameter even
though some types do not have a Handle, for example structs.
Closes issue #99.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
For method with optional parameters, when generating the overload
without the optional parameters, mark the overload as static if the
original method is static.
There are two elements repeated in this expression:
(( ((A) || (B)) || (B)) && C)
We can simplify "(A || B) || B" to simply "A || B",
so the result is a bit more readable this way:
(A || B) && C
In a lot of places, we were only checking the presence of boolean
attributes, like "array", automatically assuming they were true. This
meant that we didn't allow setting them explicitly to false, which
apparently is needed for some bindings.
For all boolean attributes, we now use the GetAttributeAsBoolean method
added in the previous commit, to correctly check the value of the
attribute. As before, if the attribute is not present, it is considered
to be false.
Thanks to Stephan Sundermann for noticing this issue.
* generator/*.cs: Add a LogWriter class which formats warnings
consistently on the console. Supports the concept of non-fatal
validation warnings, since it doesn't rely on the unrolling of the
validation stack to associate a warning to a given type.
Main purpose was to add a non-fatal warning for missing element_type
attributes on list return values, though it results in cleaner log
output, and also updates some warning messages to be more helpful in
how to resolve them.
* generator/Method.cs: interface method declarations do not support or
need an override keyword, so block the generation of it when the implementor
and container_type indicate generation of the iface itself.
* generator/Method.cs: support win32_utf8_variant attribute on methods.
* glib/*.cs: support win32 utf8 variant methods.
* gtk/*.custom: support win32 utf8 variant methods.
* gtk/Gtk.metadata: mark some win32_utf8_variant methods.
[Fixes#550961] Adapted from a patch by Tor Lillqvist.
svn path=/trunk/gtk-sharp/; revision=147113
* glib/Global.cs: Kill the calling convention field again.
It breaks GLib 2.x compatibility in the generator and there is
probably no need to make the calling convention configurable.
* .cs, *.custom: Hardcode Cdecl calling convention instead of
using GLib's field.
svn path=/trunk/gtk-sharp/; revision=141283
* glib/Global.cs: Add a public constant field specifying the
calling convention used by GLib and depending libraries.
By now it's hardcoded to Cdecl as every non-Win32 runtime
should ignore this attribute.
* *.cs, *.custom: Use GLib.Global.CallingConvention for both
pinvokes and callbacks. Plugs a stack leak on Win32. All
pinvokes defaulted to StdCall and thus the stack was never
cleaned up.
svn path=/trunk/gtk-sharp/; revision=141175
* generator/Ctor.cs:
* generator/Method.cs:
* generator/MethodBase.cs: refactor the Protection from Method to
MethodBase, generate ctors with the correct proteciton too.
svn path=/trunk/gtk-sharp/; revision=120487
* generator/Property.cs (IsDeprecated): Allow "1" or "true".
* generator/Method.cs (.ctor): Allow "1" or "true".
* generator/ClassBase.cs: Allow a value of "true" to work the same
as "1" for the deprecated and abstract attributes.
svn path=/trunk/gtk-sharp/; revision=113238
* generator/Method.cs (GenerateBody): when generating value type
methods, we should demarshal the 'this' memory before any ref or
out parameters in the event that someone passes 'this' as a param.
That will ensure that an updated value coming back from the native
side ends up in the memory location.
svn path=/trunk/gtk-sharp/; revision=104166
* generator/MethodBase.cs: move Name stuff from subclasses.
Check for (G|S)et<UpperCaseLetter> in new Has props.
* generator/Method.cs:
* generator/VirtualMethod.cs: refactor out Name stuff. Use
new Has(G|S)etterName props.
* pango/Pango.metadata: workaround Has/Hash collision with
the old broken getter check. [Fixes#344954]
svn path=/trunk/gtk-sharp/; revision=90458
* generator/Method.cs: need to use on the Base method name to
lookup complements and determine if the method is a getter or setter
when an explicit interface method name is used.
svn path=/trunk/gtk-sharp/; revision=88726
* generator/*.cs : switch to IntPtr marshaling for struct types
in the managed to native direction.
* gtk/*.custom : adjust to new gapi struct pinvoke sigs.
svn path=/trunk/gtk-sharp/; revision=83961
in the context of "Gtk.TreeModel.GetNColumns"
* generator/CallbackGen.cs (GenWrapper): treat InterfaceGen return
values the same as ObjectGen
svn path=/trunk/gtk-sharp/; revision=48192
properties can't be set until Validate-time (eg, Method.IsGetter),
but it's annoying for every potential user of those properties to
have to make sure it has Validated the generatable first. So now
we add an explicit Validate() step after everything is loaded but
before anything is Generated, so that at Generation time,
everything can be assumed to have been Validated.
* generator/IGeneratable.cs: add "bool Validate()"
* generator/CodeGenerator.cs (Main): after loading all of the
generatables, DeAlias the SymbolTable, Validate() all the
generatables, and discard any invalid ones.
* generator/*.cs: Implement Validate() trivially in generatables
that didn't implement it before. Move Validate() calls from
Generate() to Validate(). Remove non-hierarchical Validate()
calls.
* generator/SymbolTable.cs: GPtrArray is IntPtr, not IntPtr[]
svn path=/trunk/gtk-sharp/; revision=48046
anonymous function pointer types in method signatures. Before, we
added a <callback> child to the <parameters> node, but the
generator just ignored it. Now we add the callback (with a made-up
name) to the toplevel node, and add an ordinary <param> node
referencing it to the <parameters> node. Also, if the last param
of the callback is a gpointer, rename it from "arg#" to "data" so
it will be treated correctly (as the user data passed from the
calling method). [Fixes#66241]
* art/art-api.raw:
* gdk/gdk-api-2.4.raw:
* gdk/gdk-api-2.6.raw: Regen
* generator/Parameters.cs (IsHidden): loosen the definition of
hideable user_data; it doesn't have to occur at the end of the
parameter list, as long as there's a callback arg before it.
* generator/MethodBody.cs (GetCallString): Use Parameters.IsHidden
to decide whether or not to squash user_data params, rather than
trying to duplicate its logic. As a side effect, this also causes
a handful of methods that take non-hidden IntPtr arguments to
start actually passing those arguments to C rather than always
passing IntPtr.Zero.
* generator/Method.cs (Equals, GetHashCode): Remove unnecessary
and possibly erroneous hashing overrides.
* gtk/Gtk.metadata: Hide Gtk.Container.ForeachFull, since it's
useless and wasn't in gtk# 1.0
* gtk/Menu.custom (Popup):
* gtk/TextIter.custom (ForwardFindChar, BackwardFindChar):
* gnome/App.custom (CreateMenusInterp, InsertMenusInterp,
CreateToolbarInterp):
* gnome/Client.custom (RequestInteractionInterp):
* gnome/Popup.custom (MenuDoPopupModal, MenuDoPopup): Add
[Obsolete] compat overloads for methods that have now lost a
useless IntPtr.
svn path=/trunk/gtk-sharp/; revision=47566
parameter should be hidden in the managed sig (eg, because it's
user_data, or it's the length of the preceding array/string, etc).
(VisibleCount): the number of parameters that will actually be
exposed in the managed signature.
(IsAccessor): test VisibleCount, not Count
(AccessorReturnType, AccessorName): deal with the fact that the
accessor parameter might not be the first one.
* generator/CallbackGen.cs:
* generator/Signature.cs: use Parameters.IsHidden.
* generator/Method.cs (Initialize): set is_set based on
VisibleCount, not Count.
(Validate): call base.Validate() before Initialize() so that
VisibleCount will be correct in Initialize.
* generator/MethodBody.cs (GetCallString, CallArrayLength,
Initialize): update to deal with accessors with multiple args.
* gtk/Clipboard.custom (SetText): implement as an Obsolete variant
of the Text property
* gtk/IconTheme.custom (SearchPath, SetSearchPath): obsolete
SetSearchPath, implement a setter on SearchPath instead.
* gtk/ListStore.custom (SetColumnTypes):
* gtk/TreeStore.custom (SetColumnTypes): implement as an Obsolete
variant of the ColumnTypes property.
* glade/XML.custom (CustomHandler): implement as a property
(SetCustomHandler): Mark this obsolete
* glade/Global.custom (SetCustomHandler): deprecate in favor of
XML.CustomHandler.
* gnomedb/Editor.custom (SetText): implement as an Obsolete
variant of the Text property
svn path=/trunk/gtk-sharp/; revision=43898
* gdk/Gdk.metadata : hide some manually implemented callback methods.
* gdk/*.custom : implement several methods containing persistent
callback parameters.
* generator/BoxedGen.cs : set gen_info.CurrentType in Generate.
* generator/ClassGen.cs : set gen_info.CurrentType in Generate.
* generator/Ctor.cs : set gen_info.CurrentMember in Generate.
* generator/GenerationInfo.cs : add CurrentMember and CurrentType.
* generator/Method.cs : set gen_info.CurrentMember in Generate.
* generator/MethodBody.cs : always generate null guarding for array
parameters, and add a nag for callback parameters without a scope attr.
* generator/ObjectGen.cs : set gen_info.CurrentType in Generate.
* generator/OpaqueGen.cs : set gen_info.CurrentType in Generate.
* generator/Parameters.cs : kill NullOk. add Scope property.
* generator/StructGen.cs : set gen_info.CurrentType in Generate.
* gtk/Gtk.metadata : kill a few null_ok attrs.
* pango/Pango.metadata : mark the callback params as call scope. kill
a couple null_ok attrs.
svn path=/trunk/gtk-sharp/; revision=42529
* generator/ClassBase.cs : use "as" instead of a cast in FromNative.
* generator/Method.cs : remove the if/else checks for Object retvals.
* glib/Object.cs : return null immediately for NULL in GetObject.
svn path=/trunk/gtk-sharp/; revision=41409
* generator/*.cs : refactoring of Parameters class. Added IEnumerable
to Parameters and gracefully handle elem == null instead of special
casing parms == null all over the place. Parameter logic is now Count
driven. [Fixes#71750]
svn path=/trunk/gtk-sharp/; revision=39594
* gda/Makefile.am : add new custom.
* gda/XmlConnection.custom : add backcompat static ctor.
* generator/ClassBase.cs : refactor lookup logic to here from Ctor
and improve the collision resolution.
* generator/Ctor.cs : refactor to use MethodBase.
* generator/Makefile.am : add new file.
* generator/MethodBase.cs : new base class for ctors and methods.
* generator/Method.cs : refactor to use MethodBase.
* generator/StructBase.cs : move some logic from here to Ctor.
* gnome/CanvasPathDef.custom : add backcompat static ctor.
* gnome/GPPath.custom : add backcompat static ctor.
* gnome/Makefile.am : add new custom.
* gtk/Gtk.metadata : mark a colliding Button ctor shared.
svn path=/trunk/gtk-sharp/; revision=39431
* generator/CodeGenerator.cs:
* generator/ManagedCallString.cs:
* generator/Property.cs: Remove unused vars
* generator/Method.cs (GetHashCode): have to implement this since
we're overriding Equals.
* generator/CallbackGen.cs: print a message when generating a
broken struct-returning callback. (Currently affects
GtkSharp.TextSegSplitFuncNative and
GtkSharp.TextSegCleanupFuncNative)
* gdk/glue/device.c:
* gdk/glue/dragcontext.c: Add missing prototypes
* gtk/Gtk.metadata: Mark SeparatorToolItem.Draw "new". Re-rename
CheckMenuItem.Toggled to EmitToggled rather than Toggle, since
that's a better description of what it does.
* gtk/CheckMenuItem.custom: implement a "Toggle" method that does
what the documentation claims it does.
* gtk/NodeStore.cs: remove unused var
* gnome/Gnome.metadata: mark DateEdit.Flags, Dialog.Default, and
PropertyBox.State "new". Hide GnomePixmapEntry.GnomeEntry and
GnomePixmapEntry.GtkEntry since they do exactly the same thing as
the methods of the same names inherited from GnomeFileEntry.
* gnome/glue/canvas-proxy.c:
* gnome/glue/canvas-proxy.h:
* gnome/glue/canvas-proxy-marshal.c:
* gnome/glue/canvas-proxy-marshal.h:
* gnome/glue/canvas-proxy-marshal.list: Remove unused code
* gnome/glue/Makefile.am (libgnomesharpglue_2_la_SOURCES): update
* panelapplet/PanelApplet.metadata: mark PanelApplet.Flags "new"
* sample/CanvasExample.cs:
* sample/CustomCellRenderer.cs:
* sample/CustomNotebook.cs:
* sample/DrawingSample.cs:
* sample/Fifteen.cs:
* sample/GladeTest.cs:
* sample/GtkDemo/DemoHyperText.cs:
* sample/GtkDemo/DemoPixbuf.cs:
* sample/ScribbleXInput.cs: remove unused vars, use
GLib.Timeout.Add rather than the deprecated Gtk.Timeout.Add
svn path=/trunk/gtk-sharp/; revision=38043
* generator/Makefile.am : add new file.
* generator/Method.cs : add Declaration property.
* generator/VirtualMethod.cs : new class to generate virtual
methods for Interfaces and objects. Unfinished.
svn path=/trunk/gtk-sharp/; revision=36292
* generator/Method.cs: Don't use the "unsafe" modifier for methods which
are part of an interface [fixes#58059].
svn path=/trunk/gtk-sharp/; revision=26843
* generator/Method.cs : for Opaque/Object retvals, if raw_ret is
NULL, return null instead of an object with a NULL handle.
svn path=/trunk/gtk-sharp/; revision=22847
like void Foobar (..., out int baz, ...) are turned into the more .NET like
signature int Foobar (...), this fixes bug 46392
* generator/Signature.cs: Ditto
* generator/MethodBody.cs: Ditto
* gtk/ListStore.custom: Ditto
* gtk/TextBuffer.custom: Ditto
* gtk/TreeStore.custom: Ditto
svn path=/trunk/gtk-sharp/; revision=22126