Also:
* improving naming consistency
* obsolete old/broken stuff
* clean up tabs/space mix
NOTE: this removes the wrapper caches for Pattern and Surface as
there was no reliable way to clear them.
This is a merge from changes in Mono.Cairo in mono 3.2.
To be able to do this, Name property of GenBase class is now virtual, so
that it can be overriden in InterfaceGen with the new name.
Adapters, however, are still classes and then need special care as such
(cannot use the 'Name' property anymore), but this improves a bit the
readability of some parts of the code as the *Implementor and *Adapter
suffixes are now concentrated in just two new properties of GenBase and
not repeated all over the place.
What seemed to be a race condition (because of not happenning 100% of
the times) ended up being an early garbage collection of a delegate that
was still referenced by an unmanaged struct without having a managed
counterpart [1].
The consequence of this was a NullReferenceException happening in a line
which didn't have a dereference of a null object. The way to reproduce it
deterministically 100% of the times was setting the env var MONO_NO_SMP.
[1] http://www.mono-project.com/Interop_with_Native_Libraries#Memory_Boundaries
With automake version 1.13.2 (which comes in debian testing/jessie),
we were starting to get these warnings by default:
...
Running automake --foreign ...
atk/glue/Makefile.am:16: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gio/glue/Makefile.am:11: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gtk/glue/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gtk/gui-thread-check/profiler/Makefile.am:8: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
pango/glue/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/opaquetest/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/valtest/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Running autoconf ...
...
We simply follow the warning's recommendation of using AM_CPPFLAGS instead
(CPP meaning C PreProcessor, not C Plus Plus), as explained in
http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html
The deprecation of INCLUDES has been very long there already (since 2002,
therefore Automake 1.7), and we already depend on automake 1.10.
Refactoring: moving these methods from GLib.Object to ClassInitializer
brings some benefits:
* We can mark OverrideHandlers as private instead of internal.
* We reduce the number of parameters to zero by making them use fields.
* We can make the god GLib.Object class a bit smaller.
* We can make the ClassInitializer.Idx counter private instead of internal.
GObject upstream has started disabling support for installing interfaces
in GTypes after they have already been initialized (class_init) [1], so
we need to add GInterfaces a bit earlier (*before* class_init starts).
As GLib.Object.OverrideProperty() cannot to be called before class_init
(because it receives a GObjectClass, not a GType) or after (because
otherwise class_init would complain about properties of an interface not
being defined), then we need to call it during class_init.
[1] http://bugzilla.gnome.org/687659
A good side-effect of this fix is that we no longer use the hacky uint
field 'idx' to track the properties count for each class; now it gets
moved to the ClassInitializer class, and thus can be non-static, which
makes a bit more sense (we leave the old OverrideProperty overload for
backwards compatibility).
Simplest way to test this is launching the sample/treemodeldemo.exe and
sample/custom-scrollable.exe in Ubuntu 13.04 beta (which has GLib 2.36).
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=11510
The values handled by those two methods are null-terminated arrays of
strings, owned by the caller, so mark them as such.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
The gen-apidiff-html tool takes all apidiff files in a directory, merges
them and then applies mono-api.xsl to produce a nice HTML page that
shows the information about the API changes.
The various resources needed by the HTML page (images, CSS, javascript)
are added in the html/ directory.
This is all adapted from an older version of the tools in Mono git
master, under mcs/tools/corcompare.
Copy latest versions of mono-api-info.cs and mono-api-diff.cs from Mono
git master, along with associated classes. As a consequence,
mono-api-info.cs now depends on Mono.Cecil.
Do the necessary adaptation for our use case: we do API comparison
between version of our assemblies.
We switch the logic from DISABLE_GTHREAD_CHECK to ENABLE_GTHREAD_INIT
to make the define clearer, and so that it is actually needed when using
older versions of glib, not newer.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
The structure of a GAPI XML file is now defined by the XML schema in
gapi.xsd.
This XSD is now used by the generator to do a first sanity check on an
XML file before trying to generate code from it. Each generatable object
still does its own validation.
The XSD can also be seen as a documentation of the GAPI XML format, and
can be used by third-parties that produce GAPI XML to validate their
output.
This fix-up applies the element_type attribute to the method itself,
which is invalid. The correct fix-up that applies it to the return-type
is already there.
With a new --schema option, you can specify the path to an XSD file, and
all GAPI XML files will be validated against this schema, including the
files given through the --include option.
The third and fourth parameters of the Rectangle constructor are width
and height, but cairo_stroke_extents and cairo_fill_extents give right
and bottom coordinates.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
Bundle Options.cs from the Mono source tree, and use it to parse the
command-line options for gapi-codegen. This gives us clearer code,
descriptions for each option, and a nice "--help" output.
This does not change the options syntax, except that -I|--include needs
to specified for each file to include. Two Makefiles in sample/ are
updated for that change.
If a GList or a GSList had its element type set to a GInterface, and if
the elements were marked as owned, it would end up freeing those
elements with g_free(), which would lead to a crash.
They need to be unreffed with g_object_unref, but the criteria for that
was whether the element type is assignable to GLib.Object. This is not
true for GInterface types.
We now first check if the element type is an opaque. If not, and if it's
assignable to GLib.IWrapper, we then use g_object_unref.
From what I can see, all GLib.IWrapper subclasses that not opaque can be
unreffed with g_object_unref.
Fix-ups to improve the DBus.Address* method names.
For example, DBus.GetStream(string address ...) is clear enough and
better than DBus.AddressGetStream(string address ...).
Static methods corresponding to g_simple_async_report_* functions were
automatically grouped into the badly-named Simple class.
Add fix-ups to hide this Simple class, move the methods to
SimpleAsyncResult and rename them accordingly.
Don't generate a static field if it's not going to be used.
This fixes a compilation warning on the generated code for interfaces
that don't have virtual methods.