Switch the hash tables used to store fields, properties and methods to
strong-type dictionaries, and make them private. Make the necessary
adjustments in the subclasses.
The additional type information makes the code a bit more safe
and readable.
At least one bug is fixed by this: in ObjectGen, an invalid child
property could still be generated, as it was not removed from the hash
table.
This should cause no real change to the generated code, except maybe in
the order of some members.
When a C function returns an array, we need to be able to determine its
length. This is done either through a parameter to that function, or
because the array is null-terminated. If we don't know about either of
those, we print out a warning and fail the validation for the return
value. This means the corresponding method will not be generated.
This fixes a crash when trying to generate a method for which this
information is missing.
This wasn't a problem until now because the parser doesn't handle array
return values, so they were always handled through fix-ups. But now we
can get a GAPI XML converted from GIR which contains the "array"
attribute for a return value but no other information.
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/CallbackGen.cs: connect return value count parameters
* generator/ManagedCallString.cs: out count params aren't special
* generator/MethodBody.cs: don't finish hidden params
* generator/Parameters.cs: explicit IsCount setting support, with
Parameters.GetCountParameter(name) interface. Clear IsCount
values during validation if they have no associated array. Any
remaining count params must be associated with a retval, so
hide them.
* generator/ReturnValue.cs: support array_length_param attribute to
associate a return value with a "count" param. Use new helper
methods to marshal these array retvals to IntPtr and back.
* glib/Marshaller.cs: support for byte[] marshaling to and from
IntPtr using a count and type in the from native direction.
* gtk/Gtk.metadata: mark TextBufferSerializeFunc return type as
an array with the length specific in the length param.
* cairo/Context.cs: add ctor (IntPtr, bool owned)
* cairo/cairo-api.xml: expose cairo_t as new ownable symbol type
* generator/HandleBase.cs: implement IOwnable
* generator/IOwnable.cs: new interface for wrapping ownable types
* generator/Makefile.am: add new files to build
* generator/OwnableGen.cs: SimpleBase subclass to expose IOwnable
* generator/Parameters.cs: use IOwnable.FromNative instead of HandleBase
* generator/Parser.cs: parse ownable symbol type
* generator/ReturnValue.cs: use IOwnable.FromNative instead of HandleBase
* gdk/Display.custom: rework signal connection
* gdk/Window.custom: rework signal connection
* generator/Signal.cs: generate for new API.
* glib/Object.cs: add (Add|Remove)SignalHandler methods and use
them for the Notify connections. Move to generic collections for
everything but the Data hash.
* glib/Signal.cs: kill Lookup methods and add delegate fields
* glib/ToggleRef.cs: remove Signals hash, it doesn't belong here.
* gtk/Clipboard.custom: rework signal connection
* gtk/ListStore.custom: rework signal connection
* gtk/TextView.custom: remove obsolete signal
* gtk/TreeModelAdapter.custom: rework signal connection
* gtk/TreeModelFilter.custom: rework signal connection
* gtk/TreeModelSort.custom: rework signal connection
* gtk/TreeStore.custom: rework signal connection
* gtk/Widget.custom: rework signal connection
* gtk/Window.custom: remove obsolete signal
* 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/InterfaceGen.cs: don't grab the StreamWriter for consume-only.
* generator/InterfaceVM.cs: don't bitch or fail validation when missing
target on consume-only.
* generator/ObjectBase.cs: support a target_method attr on vms to point the
callback invocations at when the names don't match.
* gio/Gio.metadata: marks a few more ifaces consume-only until somebody
complains they need to implement one of 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.
* cairo/Surface.cs: expose LookupSurface
* cairo/cairo-api.xml: add surface mapping
* gdk/*: updates and hobbling to get gdk building. lots of work
to come.
* generator/SymbolTable.cs : add GVariant type mapping.
* glib/Variant.cs: initial implementation of an opaque class to expose
the GVariant type from glib. We won't make any attempt to combine managed
references since there is no "toggle" ref capability. We'll do a one-to-one
ref_sink/unref pair on construction/dispose.
2010-11-21 Mike Kestner <mkestner@novell.com>
* removed the glade dir from the build since libglade is
no longer supported in gnome3. removed the gapi2-compat stuff
since it doesn't make much sense now. Removed the bootstrap
mechanism since we are unlikely to be releasing multiple API
versions from the same tree going forward. The build is now a
straight autogen.sh like most autotools projects.
* */Makefile.am: standardize on - options over / options for
consistency. Also assists with build on msys. [Fixes#550667]
svn path=/trunk/gtk-sharp/; revision=147125
* 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
* generator/Signal.cs: Return a GInterfaceAdapter in the signalargs's
accessor properties instead of trying to return the implementor as stored in
the arguments array.
svn path=/trunk/gtk-sharp/; revision=146744
* generator/ReturnValue.cs: support metadata override of default return
values. Based on a patch from Sebastian Dröge. [Fixes#541299]
svn path=/trunk/gtk-sharp/; revision=142516
* 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/IGeneratable.cs: Remove MarshalReturnType, ToNativeReturnType,
FromNativeReturn and ToNativeReturn as they never returned something else
than MarshalType, FromNative/AllocNative and CallByName, respectively.
* generator/Signal.cs: Use AllocNative for IManualMarshalers.
svn path=/trunk/gtk-sharp/; revision=139849
* configure.in.in: add new dir and autofu for it.
* Makefile.am: add new dir
* gapi/*: a small extension method library to add generation-related
api to GType in 2.0. Access it with -pkg:gapi-2.0-compat to pick up
the needed refs.
* generator/GObjectVM.cs: generate new GType getter methods.
* generator/ObjectGen.cs: generate new GType getter methods.
* glib/GType.cs: change a few props to methods to make them extension
method friendly for 2.0 compat.
* glib/Object.cs: use new GType getter methods.
* glib/Value.cs: use new GType getter methods.
* gtk/Widget.custom: use new GetClassPtr method.
svn path=/trunk/gtk-sharp/; revision=139609
* generator/InterfaceGen.cs: remove var keyword usage to fix build on
.Net 2.0. fix a couple mixed line endings as well.
svn path=/trunk/gtk-sharp/; revision=139109
* generator/gapi3-codegen.in, parser/gapi3-fixup.in, parser/gapi3-parser.in:
"svn add" a few missing files to resurrect the build.
svn path=/trunk/gtk-sharp/; revision=138603
* configure.in.in, Makefile.include: Bump up GAPI version to 3.0.
* bootstrap-2.14: Renamed to bootstrap-for-the-insane, added message
of doom. [Fixes#521449]
svn path=/trunk/gtk-sharp/; revision=138572