Commit Graph

18 Commits

Author SHA1 Message Date
Thibault Saunier
4d513324cd Generate ABI compatible structures to avoid needing glue code. 2017-09-02 11:19:34 -03:00
Bertrand Lorentz
741360020c generator: Remove unused variable in FieldBase class 2013-10-10 23:44:24 +02:00
Stephan Sundermann
5f271e04fa generator: ignore private structs completely
Don't spam the log with these messages for private structs
(and don't count this in the statistics), as there are too
many. These kind of types are just empty structs marked as
hidden and private.
2013-10-09 20:28:38 +02:00
Stephan Sundermann
55ab3ab284 generator: fixed glue code for callbacks 2013-10-09 15:44:33 +02:00
Stephan Sundermann
972e6257fc generator: removed wrong glue code for structs 2013-10-09 15:35:36 +02:00
Stephan Sundermann
29a900e51e generator: added conversion for byref structs
The pointer from native is stored inside of a class which
wraps the structure. Fields can be accessed by marshalling
from and to the pointer. glib: Value.Update does now invoke
a private Update() method which is needed to update the new
structures.
2013-10-09 13:40:56 +02:00
Stephan Sundermann
fd2fb44f99 generator: readable&writable attribs to be backwards compat 2013-10-08 18:55:34 +02:00
Stephan Sundermann
edde96c5be generator: fixed writeable and readable detection 2013-10-08 18:46:44 +02:00
Bertrand Lorentz
4d19e5ac2a generator: Properly handle boolean attributes when parsing the XML
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.
2012-10-21 18:22:13 +02:00
Mike Kestner
2ba496479f Restructure log warnings in validation.
* 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.
2011-02-20 12:11:08 -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
Mike Kestner
8c8138e17e 2009-05-06 Mike Kestner <mkestner@novell.com>
* generator/FieldBase.cs: mangle compound typenames for glue.
	[Fixes #501329] Patch by Sebastian Dröge.

svn path=/trunk/gtk-sharp/; revision=133659
2009-05-06 14:58:39 +00:00
Christian Hoff
8996f860ad 2009-05-04 Christian Hoff <christian_hoff@gmx.net>
* generator/ClassField.cs: Derive from StructField.
	* generator/ObjectBase.cs: Implement validation mechanism for
	class structures. If the structure contains bitfields or fields
	of unknown types, we cannot generate it in managed code.
	* generator/GObjectVM.cs: Fall back to glue if the class structure
	cannot be generated.	[Fixes #498051]

svn path=/trunk/gtk-sharp/; revision=133514
2009-05-04 17:39:45 +00:00
Mike Kestner
fc06f3829a 2007-08-13 Mike Kestner <mkestner@novell.com>
* 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
2007-08-13 14:29:06 +00:00
Lluis Sanchez
fe3b98a79b 2005-12-21 Lluis Sanchez Gual <lluis@novell.com>
* generator/FieldBase.cs: Properly convert marshalled value 
	to native value.
	* generator/CallbackGen.cs: Added parens to the result of ToNativeReturn,
	since it may have problems with the cast.


svn path=/trunk/gtk-sharp/; revision=54671
2005-12-21 00:18:52 +00:00
Dan Winship
d37d940eb8 * parser/gapi2xml.pl (parseInitFunc): handle interface properties
as well as class properties

	* gtk/gtk-api-2.4.raw: 
	* gtk/gtk-api-2.6.raw: Regen (adding properties to GtkFileChooser).

	* generator/Property.cs (GenerateDecl): new method to generate
	just a property declaration (for an interface).
	(Generate): Add an "implementor" arg as with Method.Generate.

	* generator/InterfaceGen.cs (Generate): Generate properties. Also,
	validate methods *before* checking if they should be ignored,
	since certain Method properties aren't set until Validate-time.

	* generator/*.cs: misc minor changes/reorg for the above.

svn path=/trunk/gtk-sharp/; revision=47563
2005-07-22 18:35:37 +00:00
Dan Winship
b6d7f14268 * 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 14:28:55 +00:00
Dan Winship
5825f7f4fe Apply the parts of the generator reorganization from #69514 that
don't actually affect the generated output
	
	* generator/PropertyBase.cs: new base class for fields and
	properties (mostly containing code formerly in Property.cs).

	* generator/Property.cs: derive from PropertyBase

	* generator/FieldBase.cs: base class for fields (containing some
	code formerly in Field.cs)

	* generator/StructField.cs: class for struct fields (the rest of
	what used to be Field.cs)

	* generator/StructBase.cs: s/Field/StructField/

	* gnome/Gnome.metadata: hide a few funky _get_ methods that the
	generator is just now noticing, to preserve the old output.

svn path=/trunk/gtk-sharp/; revision=43896
2005-05-02 18:40:30 +00:00