Commit Graph

116 Commits

Author SHA1 Message Date
Stephan Sundermann
961b9ef348 glib: Add binding for GBytes
This patch adds bindings for GBytes https://developer.gnome.org/glib/stable/glib-Byte-Arrays.html

The code was first generated using gobject-introspection and then
refactored. The new type is also added to the generator SymbolTable.
2014-08-10 18:20:32 +02:00
Stephan Sundermann
b868b80dee glib,generator: map MainContext type and expose members
This is needed to reference a MainContext from
external bindings, which need to create a
MainContext using a Handle
2013-10-09 19:44:50 +02:00
Stephan Sundermann
6ab620d689 generator,glib: added GPollFD and GSource types
GSource type was already there (but was not mapped by
the generator yet) so then the autogenerated methods
have been added manually inside the class after the
custom methods.

Other Source-related class are also generated and added
(but not mapped in the SymbolTable) to glib.
2013-10-09 19:41:21 +02:00
Stephan Sundermann
9abde602ec glib: add GDate, GDateTime
Add GDate and GDateTime classes to glib, and map
them in the generator's SymbolTable.

(The types TimeZone and TimeVal are also added because
the Date* types depend on them, but there is no need
to map them in the generator.)

Also move the TODOs of other auto-generated classes
to a single TODO in the Makefile
2013-10-09 18:30:10 +02:00
Stephan Sundermann
112e2b9598 generator,glib: Added Mutex, RecMutex, Cond types
Bind these types manually and added generator support
for them.
2013-10-09 13:09:34 +02:00
Stephan Sundermann
747a4ad871 generator: Added conversion for unions
Also removed all assumptions for parameters when
ParserVersion >= 3
2013-10-08 20:22:16 +02:00
Stephan Sundermann
dc4e7f30b9 generator: Added long long conversion 2013-10-08 18:48:05 +02:00
Stephan Sundermann
c14277f391 generator: GThread type should be SimpleGen 2013-10-08 15:43:23 +02:00
Stephan Sundermann
4b470cadbb generator: Added GThread type 2013-10-08 15:41:14 +02:00
Andrés G. Aragoneses
9327d7d085 generator: fix possible unhandled KeyNotFoundException (regression)
This regression surfaced after 82a957bc9d [1],
when many collections were migrated to generic collections. HashTables
simply return null when queried for certain key, while Dictionary objects
throw KeyNotFoundException.

The regression could be noticed, more particularly, when trying to
compile the gtk3 branch of the gudevsharp project [2].

[1] 82a957bc9d
[2] https://github.com/mono/gudev-sharp/commits/gtk3
2013-08-23 22:09:06 +02:00
Andrés G. Aragoneses
4046a4c4bd generator: avoid double lookup in dictionary when DeAlias is called
We can avoid a double lookup in the types dictionary here because the
method TryGetValue() was just called before.
2013-08-23 22:09:06 +02:00
Andres G. Aragoneses
6cb03440c1 generator: generate all interfaces with the "I" prefix (.NET convention)
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.
2013-07-23 12:05:24 -05:00
Bertrand Lorentz
82a957bc9d generator: Switch a lot of collections to their generic counterpart
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.
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
b8b1cfa5d7 generator: Convert all .cs files to Unix line endings
There are no real code changes in this commit.
2012-11-03 15:20:06 +01:00
Age Bosma
240ff0995a Add support for GValueArray type 2011-09-26 13:54:48 +02:00
Age Bosma
d900b32e93 Add support for gintptr and guintptr types 2011-09-26 13:53:32 +02:00
Mike Kestner
88af56dd68 Implement GVariantType binding.
* generator/SymbolTable.cs: add GVariantType mapping.
* glib/Makefile.am: add file
* glib/Value.cs: add cast to VariantType.
* glib/VariantType.cs: hand binding for yet another ref counted glib
type system.
2011-02-11 13:52:13 -06:00
Mike Kestner
8459ac5560 Initial support for GVariant
* 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.
2011-01-22 12:52:38 -06:00
Christian Hoff
08b43fbd76 2009-08-13 Christian Hoff <christian_hoff@gmx.net>
* 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
2009-08-13 14:46:33 +00:00
Christian Hoff
291ee61b2d 2009-04-13 Christian Hoff <christian_hoff@gmx.net>
Add support for virtual methods(vm) to the generator.

	* parser/gapi2xml.pl: Generate a class_struct element with
	all members of the class structure. Dump the first (instance)
	parameter for signal and vm elements. Bump up parser version.
	* generator/GObjectVM.cs: Added. Support for GObject virtual methods.
	* generator/DefaultSignalHandler.cs: Signal specific part of vm
	generation.
	* generator/InterfaceVM.cs: New class for interface vms.
	* generator/ObjectBase.cs: Parse the class struct.

svn path=/trunk/gtk-sharp/; revision=131604
2009-04-13 17:44:48 +00:00
Mike Gorse
c9d658f381 2008-11-04 Mike Gorse <mgorse@novell.com>
* glib/PtrArray.cs, glib/glue/ptrarray.c, glib/Makefile.am,
	  glib/glue/Makefile.am, glib/gtype.cs, generator/SymbolTable.cs,
	  generator/ReturnValue.cs: Add PtrArray.
	* glib/Marshaller.cs: Add PtrArrayToArray.

	* atk/Atk.metadata: Specify GetTarget return type.

	* atk/Object.custom, atk/glue/object.c: Support overriding
	  RefRelationSet.

svn path=/trunk/gtk-sharp/; revision=117919
2008-11-04 20:17:00 +00:00
Mike Kestner
667b1462d6 2008-09-18 Mike Kestner <mkestner@novell.com>
* generator/LPGen.cs: remove WIN64LONGS hackery.
	* generator/LPUGen.cs: remove WIN64LONGS hackery.
	* generator/SymbolTable.cs: for WIN64LONGS, map them directly to
	  (u)int SimpleGens instead of using the LP generatables.

svn path=/trunk/gtk-sharp/; revision=113420
2008-09-18 14:23:29 +00:00
Mike Kestner
6a668a2cc8 2008-01-29 Mike Kestner <mkestner@novell.com>
* generator/VirtualMethod (CName): mangle the name.
	* generator/SymbolTable.cs (MangleName): add 'remove' and 'foreach'
	mappings.  Should probably just get a C# keyword list and map all of
	them instead of onesy twoseys.
	Fixes for tnymail binding generation.

svn path=/trunk/gtk-sharp/; revision=94286
2008-01-29 18:48:04 +00:00
Mike Kestner
9716ffe57e 2008-01-07 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs: map "unsigned long" to LPUGen.

svn path=/trunk/gtk-sharp/; revision=92413
2008-01-07 21:12:33 +00:00
Mike Kestner
209f353fc8 2007-12-06 Mike Kestner <mkestner@novell.com>
* * : update to 2.12 API.

svn path=/trunk/gtk-sharp/; revision=90823
2007-12-06 17:23:28 +00:00
Mike Kestner
385af2ab32 2007-12-04 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs: add goffset mapping.

svn path=/trunk/gtk-sharp/; revision=90770
2007-12-05 15:25:45 +00:00
Mike Kestner
e26a98a763 2007-12-04 Mike Kestner <mkestner@novell.com>
* configure.in.in: check for default off_t size
	* generator/SymbolTable.cs: map off_t based on configure check.
	* generator/Makefile.am: add OFF_T_FLAGS to compile.

svn path=/trunk/gtk-sharp/; revision=90727
2007-12-04 23:52:08 +00:00
Mark Probst
e1fd1b014c 2007-12-03 Mark Probst <mark.probst@gmail.com>
* generator/SymbolTable.cs: Added "where" to the list of mangled
	names.

svn path=/trunk/gtk-sharp/; revision=90559
2007-12-03 17:08:03 +00:00
Mike Kestner
86d29321c3 2007-11-12 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs: remove GCallback mapping.
	* glib/GCallback.cs: kill, bad idea.

svn path=/trunk/gtk-sharp/; revision=89519
2007-11-13 03:04:32 +00:00
Mike Kestner
1fa0231217 2007-10-24 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs: mappings for GCallback and GSourceFunc.
	* glib/GCallback.cs: GCallback declaration.
	* glib/Source.cs: GSourceFunc declaration.

svn path=/trunk/gtk-sharp/; revision=88126
2007-10-24 20:13:08 +00:00
Mike Kestner
2a7b706c5a 2007-10-22 Mike Kestner <mkestner@novell.com>
* configure.in.in: add a win64 check and a compiler define for
	handling win64 32bit longs.
	* generator/LPGen.cs: use int to marshal on win64.
	* generator/LPUGen.cs: use uint to marshal on win64.
	* generator/SymbolTable.cs: remove fixme.

svn path=/trunk/gtk-sharp/; revision=87922
2007-10-22 17:34:02 +00:00
Mike Kestner
9f780a56b2 2007-09-21 Mike Kestner <mkestner@novell.com>
* generator/*.cs: add DefaultValue prop for obtaining a
	sane value when we need to return a value but something bad has 
	happened such that we can't get a real value.  Needed for iface
	signal marshaling, among other places we're partially working 
	around it now.

svn path=/trunk/gtk-sharp/; revision=86157
2007-09-21 16:37:04 +00:00
Mike Kestner
2ac6bb5457 2006-05-10 Mike Kestner <mkestner@novell.com>
* bootstrap-2.10 : strap for the new 2.9.0 API.
	* generator/SymbolTable.cs : add GLib.InitiallyUnowned mapping.
	* glib/InitiallyUnowned.cs : new floating class "stub".
	* glib/Makefile.am : build new class.
	* gdk/gdk-api-2.10.raw: parse from 2.9.0
	* gtk/Gtk.metadata: cleanup conflicts in 2.10 API.
	* gtk/gtk-api-2.10.raw: parse from 2.9.0
	* pango/pango-api-2.10.raw: parse from 1.11.99
	* sources/Makefile.am : 2.10 parse setup and api-2.10 
	* sources/gtk_tree_model_signal_fix-2.10.patch : 2.10 patch.
	* sources/gtk-sharp-2.10-sources.xml : parse rules for 2.10

svn path=/trunk/gtk-sharp/; revision=60521
2006-05-10 17:13:30 +00:00
Mike Kestner
8be43289ae 2005-01-21 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs : alias off_t to ssize_t as it is
	signed according to harold.  [Fixes #77016]

svn path=/trunk/gtk-sharp/; revision=55887
2006-01-21 17:31:03 +00:00
Joe Shaw
5f89b3da2f 2005-08-23 Joe Shaw <joeshaw@novell.com>
* generator/SymbolTable.cs: Add "unsigned" as a type
	which maps to "uint".

svn path=/trunk/gtk-sharp/; revision=48754
2005-08-23 18:36:43 +00:00
Dan Winship
d6ec3f77ff * generator/ClassBase.cs (Validate): Don't fully validate the
parent class and interfaces (because we don't want to see the
	warnings about certain GtkWidget methods in every single library
	that defines a widget, etc). Instead, use the new
	ValidateForSubclass() method.
	(ValidateForSubclass): only validate the signals

	* generator/InterfaceGen.cs (ValidateForSubclass): for interfaces
	we need to validate the methods too.

	* generator/ObjectGen.cs (Generate): Check for interface method
	collisions against the class's own methods too, not just its other
	interfaces. Also, it's only a collision if the methods' signatures
	have the same types.

	* generator/Signal.cs (GenDefaultHandlerDelegate): Use
	"{0}_managed" rather than "obj" for the internal variable name, to
	avoid compile problems with signals that have a parameter named
	"obj".

	* generator/SymbolTable.cs (MangleName): mangle "internal" to
	"_internal".

svn path=/trunk/gtk-sharp/; revision=48184
2005-08-09 17:33:46 +00:00
Dan Winship
85d88fe1ca Change the way generatable validation works. Some generatable
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
2005-08-05 20:34:45 +00:00
Mike Kestner
fee353d525 2005-06-02 Mike Kestner <mkestner@novell.com>
* generator/ConstFilenameGen.cs : new generatable for filename encoded
	const string marshaling
	* generator/Makefile.am : add new file
	* generator/SymbolTable.cs : add new gfilename types.
	* glib/Marshaller.cs : add new filename-encoded string marshalers.
	* gtk/FileSelection.custom : use FilenamePtrToString to marshal.
	* gtk/Gtk.metadata : map the FileSelector filename types to my new
	imaginary gfilename type.  [Fixes #74963]

svn path=/trunk/gtk-sharp/; revision=45328
2005-06-02 14:16:52 +00:00
Dan Winship
f6f9fd0c79 * glib/Value.cs: Add a constructor and an explicit cast for
string[] (using a G_TYPE_STRV boxed value).

	* generator/SymbolTable.cs (SymbolTable): Map GStrv to string[].
	(The mapping relies on the above GLib.Value magic, so it only
	works correctly for properties, but that's ok, because GStrv isn't
	a real type anyway and only shows up in the api files for
	G_TYPE_STRV properties.) Makes the Gtk.AboutDialog Artists,
	Authors, and Documenters properties show up.

	* gtk/Gtk.metadata: hide
	AboutDialog.Get/SetArtists/Authors/Documenters, which can't be
	used to implement the Artists/Authors/Documenters properties,
	because the generated code doesn't know to NULL-terminate the
	arrays.

svn path=/trunk/gtk-sharp/; revision=45301
2005-06-01 17:58:28 +00:00
Dan Winship
a7d8b64f7a * generator/Parameters.cs (Parameters.Validate): If the parameters
end with "callback, gpointer, GDestroyNotify", then mark the
	callback as having "notified" Scope.
	(Parameters.IsHidden): Hide user_data and GDestroyNotify after a
	callback.
	(Parameter.Scope): make this settable
	(Parameter.IsDestroyNotify): new test

	* generator/MethodBody.cs (Initialize): Handle "notified" callback
	scope (using a GCHandle and GLib.DestroyHelper.NotifyHandler)

	* generator/CallbackGen.cs (GenWrapper): Add a static
	"GetManagedDelegate" method to the wrapper type, to translate a
	native delegate back to its corresponding managed delegate.
	(FromNative): use GetManagedDelegate.

	* generator/ReturnValue.cs (Validate): We handle callback return
	values now

	* generator/SymbolTable.cs: marshal GDestroyNotify as
	GLib.DestroyNotify

	* glib/DestroyNotify.cs: Moved from gtk

	* gtk/Gtk.metadata: globally change GtkDestroyNotify to
	GDestroyNotify, but then change back the ones that are exposed in
	the API. Un-hide lots of methods we can correctly autogenerate
	now.

	* gtk/DestroyHelper.cs: moved to glib

	* gtk/*.custom: remove methods that are autogenerated now, add
	Obsolete wrappers where needed, replace Gtk.DestroyHelper usage
	with GLib.DestroyHelper.

	* gdk/Gdk.metadata: 
	* gnome/Gnome.metadata: Turn Gdk.Drawable.SetData and
	Gnome.IconList.SetIconDataFull's GDestroyNotify args into
	gpointers so the generated API stays the same as it used to be.

	* rsvg/Handle.custom: implement deprecated SetSizeCallback

	* sample/GtkDemo/DemoIconView.cs (CreateSort): update for API
	changes

svn path=/trunk/gtk-sharp/; revision=44020
2005-05-04 11:47:25 +00:00
Mike Kestner
320977f58f 2005-03-10 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs : fix gssize and gsize, they aren't 32 bit
	like the docs say they are.

svn path=/trunk/gtk-sharp/; revision=41666
2005-03-10 22:15:07 +00:00
Mike Kestner
0b0700bae6 2005-03-04 Mike Kestner <mkestner@novell.com>
* generator/ImportSignature.cs : out param handling fix.
	* generator/Makefile.am : kill StringGen.cs.
	* generator/MethodBody.cs : simplify out param handling.
	* generator/StringGen.cs : kill it, now using MarshalGen.
	* generator/SymbolTable.cs : make non-const strings use an appropriate
	MarshalGen.  Non-const strings are now correctly marshaled as Utf8.
	* glib/Marshaller.cs : add some utf8-fu for strdup/free marshaling.
	Add a method to alloc/copy structs to native memory, unused yet.
	* gtk/Gtk.metadata : partially fix a broken delegate.

svn path=/trunk/gtk-sharp/; revision=41459
2005-03-04 18:59:09 +00:00
Mike Kestner
31a6de44ca 2005-01-31 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs : handle unsigned-*.
	* parser/gapi2xml.pl : handle const unsigned * parameters. Also fix
	a G_GNUC_PRINTF parsing bug exposed by a GMime.
	* */*-api.raw : regen.
	[Fixes #71825]


svn path=/trunk/gtk-sharp/; revision=39851
2005-01-31 15:23:41 +00:00
Mike Kestner
e068a811e3 2005-01-06 Mike Kestner <mkestner@novell.com>
* gnomevfs/gnomevfs-symbols.xml : FileSize is a long long.
	* generator/SymbolTable.cs : map longlong to C# long.

svn path=/trunk/gtk-sharp/; revision=38434
2005-01-06 16:10:35 +00:00
Mike Kestner
8d53021079 2004-12-27 Mike Kestner <mkestner@novell.com>
* generator/AliasGen.cs : derive from SimpleBase.
	* generator/ConstStringGen.cs : derive from SimpleBase.
	* generator/GObjectGen.cs : kill. now uses ManualGen.
	* generator/GStringGen.cs : kill. now uses MarshalGen.
	* generator/GUnicharGen.cs : kill. now uses MarshalGen.
	* generator/LPGen.cs : derive from SimpleGen.
	* generator/Makefile.am : update source files.
	* generator/ManualGen : make this general for handle types.
	* generator/MarshalGen : new CallByName/FromNative formatter class.
	* generator/SymbolTable.cs : needed some reorganizing and some
	restructuring of types to use MarshalGen.
	* generator/TimeTGen.cs : kill. now uses MarshalGen.

svn path=/trunk/gtk-sharp/; revision=38109
2004-12-27 17:38:52 +00:00
Mike Kestner
b6b89a0633 2004-12-20 Mike Kestner <mkestner@novell.com>
* gdk/Gdk.metadata : mark a couple array params.
	* generator/Field.cs : remove the MarshalAs hack. We have to
	do something much more evil since MarshalAs can't hang.
	* generator/ImportSignature.cs : deal with out LP(U)Gen params.
	* generator/LPGen.cs : moved from SSizeTGen and generalized.
	* generator/LPUGen.cs : moved from SizeTGen and generalized.
	* generator/Makefile.am : update sources.
	* generator/MethodBody.cs : deal with out LP(U)Gen params.
	* generator/Parameters.cs : deal with out LP(U)Gen params.
	* generator/SymbolTable.cs : make all longs and size_t types LP(U)Gens.

svn path=/trunk/gtk-sharp/; revision=37999
2004-12-20 22:08:43 +00:00
Dan Winship
a610fb9a79 * generator/GUnicharGen.cs: generatable for gunichar, using
GLib.Marshaller.CharToGUnichar and .GUnicharToChar [#70704]

        * generator/SymbolTable.cs (SymbolTable): add a GUnicharGen.

        * generator/Makefile.am (sources): add GUnicharGen.cs

        * parser/gapi2xml.pl (addPropElem): g_param_spec_unichar() has
        type "gunichar" not "unichar".

        * gtk/gtk-api.raw: Regen

        * glib/Marshaller.cs: Import CharToGUnichar's glue method by the
        right name

svn path=/trunk/gtk-sharp/; revision=37998
2004-12-20 22:05:21 +00:00
Mike Kestner
62977484e6 2004-12-09 Mike Kestner <mkestner@novell.com>
* generator/Makefile.am : new files.
	* generator/MethodBody.cs : fix for length param code.
	* generator/SizeTGen.cs : smarter size_t marshaling.
	* generator/SSizeTGen.cs : smarter ssize_t marshaling.
	* generator/SymbolTable.cs : use the new generatables.

svn path=/trunk/gtk-sharp/; revision=37509
2004-12-09 18:40:09 +00:00
Mike Kestner
089845650c 2004-12-06 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs : add off_t as an IntPtr.

svn path=/trunk/gtk-sharp/; revision=37247
2004-12-06 22:14:03 +00:00
Mike Kestner
84d8a42f96 2004-12-06 Mike Kestner <mkestner@novell.com>
* doc/en/*/*.xml : docs for new GValue members and size_t changes.
	* generator/SymbolTable.cs : add ssize_t and make size_t a UIntPtr
	instead of the current broken int mapping on 64 bit platforms.
	* gtkhtml/HTMLStream.custom : fix size_t related overload.
	[fixes #69574]

svn path=/trunk/gtk-sharp/; revision=37223
2004-12-06 19:37:03 +00:00