Commit Graph

31 Commits

Author SHA1 Message Date
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
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
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
Bertrand Lorentz
c1e9a8c613 generator: Remove support for .custom files
We don't use any .custom file anymore, and nobody should. You can
do the same things with partial classes, and they're much nicer.
2012-08-05 18:29:18 +02: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
Gabriel Burt
1cd652998e 2009-07-13 Gabriel Burt <gabriel.burt@gmail.com>
* generator/GenBase.cs: Add AppendCustom override that you can pass the
	type name in, used to include .custom for Name + Adapter and Name +
	Implementor .custom files for interface gen.

	* generator/InterfaceGen.cs: Use the new AppendCustom override for the
	Name + Adapter.custom file, and add support for including custom file for
	the Name + Implementor interface; necessary to manually implement an
	interface method.

svn path=/trunk/gtk-sharp/; revision=137809
2009-07-13 18:55:08 +00:00
Christian Hoff
01ed1a5e3e 2009-03-19 Christian Hoff <christian_hoff@gmx.net>
* parser/gapi2xml.pl: Introduce a "parser_version" attribute.
	* generator/GenBase.cs: Implement a property to access the
	attribute's value.

svn path=/trunk/gtk-sharp/; revision=129807
2009-03-19 18:13:01 +00:00
Mike Kestner
3030c6d535 fix inconsistent line endings
svn path=/trunk/gtk-sharp/; revision=122798
2009-01-08 18:00:47 +00:00
Stephane Delcroix
a1f8ed79de 2008-09-30 Stephane Delcroix <sdelcroix@novell.com>
* generator/CallbackGen.cs:
	* generator/ClassGen.cs:
	* generator/EnumGen.cs:
	* generator/GenBase.cs:
	* generator/InterfaceGen.cs:
	* generator/Method.cs:
	* generator/OpaqueGen.cs:
	* generator/StructBase.cs:
	* generator/ObjectGen: check for the internal attribute
	* generator/Method.cs: check for the accessibility attribute;

svn path=/trunk/gtk-sharp/; revision=114497
2008-09-30 17:44:24 +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
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
Mike Kestner
d8fb820b89 2007-04-20 Mike Kestner <mkestner@novell.com>
* generator/CallbackGen.cs : switch to NativeCallbackSignature.
	* generator/GenBase.cs : add NativeCallbackType member.
	* generator/IGeneratable.cs : add NativeCallbackType member.
	* generator/ManagedCallString.cs : add guarded post call struct
	marshaling back to the native struct.
	* generator/NativeCallbackSignature.cs : new parallel to ImportSignature
	but using NativeCallbackType instead of MarshalType.
	* generator/Signal.cs : switch vm and sig marshaler callbacks to 
	NativeCallbackSignature. Perform guarding post call struct marshaling
	back to the native struct.
	* generator/Parameters.cs : add NativeCallbackType member.
	* generator/SimpleBase.cs : add NativeCallbackType member.
	* generator/StructBase.cs : add NativeCallbackType member using IntPtr
	to support NULL handling.
	* gtk/NodeCellDataFunc.cs : update native marshaler sig.

svn path=/trunk/gtk-sharp/; revision=76011
2007-04-20 15:38:47 +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
4f2d941b51 2004-12-27 Mike Kestner <mkestner@novell.com>
* generator/CallbackGen.cs : use ReturnValue and more of Parameter.
	* generator/GenBase.cs : remove unused NSElem prop.

svn path=/trunk/gtk-sharp/; revision=38115
2004-12-27 21:32:08 +00:00
Mike Kestner
d8aa13ac21 2004-12-26 Mike Kestner <mkestner@novell.com>
* generator/*Gen.cs : implement IGeneratable fully on GenBase
	with abstract methods where necessary to refactor a ton of redundant
	code.

svn path=/trunk/gtk-sharp/; revision=38091
2004-12-26 19:33:34 +00:00
Mike Kestner
f96454a364 2004-06-25 Mike Kestner <mkestner@ximian.com>
* generator/*.cs : add gpl license blurb and clean up (c)'s.
	* parser/* : ditto
	* doc/*.cs : ditto
	* doc/gen-handlerargs-docs.cs : add little scripty.

svn path=/trunk/gtk-sharp/; revision=30398
2004-06-25 16:35:15 +00:00
Mike Kestner
be9946dca2 2003-10-04 Mike Kestner <mkestner@ximian.com>
* generator/CallbackGen.cs : remove CloseWriter call.
	* generator/GenBase.cs : kill CreateWriter and CloseWriter.

svn path=/trunk/gtk-sharp/; revision=18616
2003-10-05 00:37:24 +00:00
Mike Kestner
460b3e5623 2003-10-04 Mike Kestner <mkestner@ximian.com>
* generator/AliasGen.cs : stub new Generate overload.
	* generator/BoxedGen.cs : implement new Generate overload.
	* generator/CallbackGen.cs (Generate):implement new overload.
	* generator/ClassBase.cs : implement new Generate overload and
	pass around the gen_info.
	* generator/ClassGen.cs : implement new Generate overload.
	* generator/Ctor.cs (Generate): s/sw/gen_info.
	* generator/EnumGen.cs : implement new Generate overload.
	* generator/GenBase.cs : expose NSElem, add gen_info param to
	AppendCustom. kill CreateWriter.
	(GenWrapper): add gen_info param and use it to open stream.
	* generator/GenerationInfo.cs : new class to pass around generation
	related information and perform tasks like opening streams.
	* generator/IGeneratable.cs : add Generate(gen_info) overload.
	* generator/InterfaceGen.cs : implement new Generate overload.
	* generator/ManualGen.cs : stub new Generate overload.
	* generator/Method.cs (Generate): accept gen_info. kill GenerateComments.
	* generator/ObjectGen.cs : implement new Generate overload.
	* generator/OpaqueGen.cs : implement new Generate overload.
	* generator/Parameters.cs (Initialize): s/sw/gen_info.
	* generator/Property.cs (Generate): accept gen_info.
	* generator/Signal.cs (Generate): accept gen_info.
	* generator/SimpleGen.cs : stub new Generate overload.
	* generator/StructBase.cs : s/sw/gen_info
	* generator/StructGen.cs : implement new Generate overload.

svn path=/trunk/gtk-sharp/; revision=18615
2003-10-05 00:20:17 +00:00
Mike Kestner
c9ef435827 2003-10-03 Mike Kestner <mkestner@ximian.com>
* generator/GenBase.cs : remove unused do_generate private member.

svn path=/trunk/gtk-sharp/; revision=18573
2003-10-03 22:27:47 +00:00
Mike Kestner
5b7aaf1c4f 2003-10-03 Mike Kestner <mkestner@ximian.com>
* generator/*.cs : Kill DoGenerate.

svn path=/trunk/gtk-sharp/; revision=18572
2003-10-03 22:20:40 +00:00
Mike Kestner
2efd85f9a5 2003-07-02 Shane Hyde <shane@enactive.org>
* generator/GenBase.cs : put #line directive after the
	#region so line numbers match up.

2003-07-02  Mike Kestner  <mkestner@speakeasy.net>

	* generator/StructBase.cs : remove doc comments

svn path=/trunk/gtk-sharp/; revision=15873
2003-07-02 18:13:24 +00:00
Mike Kestner
b6114fef1e 2003-05-18 Mike Kestner <mkestner@speakeasy.net>
* generator/CallbackGen.cs : use non-static symtab, kill doc comments
	* generator/ClassBase.cs : use non-static symtab
	* generator/CodeGenerator.cs : use non-static symtab
	* generator/EnumGen.cs : kill doc comments, don't gen using System here
	* generator/GenBase.cs : gen using System here for all types
	* generator/InterfaceGen.cs : don't gen using System here.
	* generator/Method.cs : use non-static symtab
	* generator/ObjectGen.cs : kill doc comments, use non-static symtab
	* generator/OpaqueGen.cs : don't gen using System here.
	* generator/Parameters.cs : use non static symtab.
	* generator/Parser.cs : use non static symtab. add SimpleGen's and
	ManualGen's
	* generator/Property.cs : use non static symtab
	* generator/SignalHandler.cs : use non static symtab
	* generator/StructBase.cs : use non static symtab
	* generator/SymbolTable.cs : major refactoring. now uses SimpleGen and
	ManualGen IGeneratables to simplify the method and prop code.  Is now
	instance based with a static prop to get the singleton instance, so that
	a this indexer can be provided to access the IGeneratables nicely. Gearing
	up to remove even more code from here by accessing IGeneratables directly.

svn path=/trunk/gtk-sharp/; revision=14687
2003-05-19 02:45:17 +00:00
Mike Kestner
9e325bd283 2003-05-07 Mike Kestner <mkestner@speakeasy.net>
* generator/ClassBase.cs (GenSignals): remove doc comment param
	* generator/GenBase.cs (CreateWriter): alter generated file comment
	* generator/InterfaceGen.cs (CreateWriter): remove doc comments
	* generator/ObjectGen.cs (Generate): use new GenSignals sig
	* generator/Signal.cs : make signal marshalers internal and remove
	doc comments.
	* generator/SignalHandler.cs : make signal marshalers internal and remove
	doc comments.
	* gnome/CanvasProxy.cs : use Gnome.voidObjectSignal since the gtk one is
	inaccessible now.

svn path=/trunk/gtk-sharp/; revision=14385
2003-05-08 04:44:13 +00:00
Mike Kestner
0a60bc2916 2003-02-23 Mike Kestner <mkestner@speakeasy.net>
* generator/GenBase.cs : quote the custom filenames in
	#file directives.

svn path=/trunk/gtk-sharp/; revision=11918
2003-02-24 05:20:04 +00:00
Mike Kestner
ccd555425e 2003-02-19 Mike Kestner <mkestner@speakeasy.net>
* generator/GenBase.cs : mark #line 1 for .customs
	* generator/SignalHandler.cs : fix for GObj retvals

svn path=/trunk/gtk-sharp/; revision=11714
2003-02-19 06:23:36 +00:00
Duncan Mak
fb60c23e4a 2003-01-05 Duncan Mak <duncan@ximian.com>
* generator/GenBase.cs (AppendCustom): Add #region to code from
	.custom files.

	* generator/*Gen.cs: Add #region markers.

svn path=/trunk/gtk-sharp/; revision=10188
2003-01-05 23:51:37 +00:00
Rachel Hestilow
e9d1e0b6dc 2002-08-19 Rachel Hestilow <hestilow@ximian.com>
* art/Makefile.in (clean): Change to avoid bugging out on generated/CVS.

	* glib/ObjectManager.cs: Added. Used to be auto-generated, but
	now it can infer names, and relies on per-namespace ObjectManager
	classes to inform it of oddly-named classes.

	* generator/IGeneratable.cs, GenBase.cs: New "DoGenerate" property.
	* generator/*Gen.cs: Honor DoGenerate.
	* generator/CodeGenerator.cs: Support including dependency files
	which will not be generated.
	* generator/ObjectGen.cs: Generate mapping file per-namespace, as one
	that calls back to the one in glib. Only generate if the name does
	not follow the normal conventions, otherwise, GtkSharp.ObjectManager
	can infer the name.
	* generator/Parser.cs: Accept 'generate' flag to pass on to the
	IGeneratables. Parse a new toplevel element, "symbol", which adds
	a type to the SymbolTable (instead of hard-coding it).
	* generator/SignalHandler.cs: Do not optimize signal handler creation,
   instead creating them in their own namespaces. Do not generate
	if the calling Signal told us not to.
	* generator/Signal.cs: Do not generate handlers if container's DoGenerate
	is false. Adjust to the marshaller name being in a sub-namespace.
	* generator/SymbolTable.cs (AddSimpleType, AddManualType): Used
	to add simple and manually wrapped types at runtime instead of
	compile-time.
	(FromNative): Remove hard-coded cases for manually wrapped types, use
	a generic case instead.

	* api: Added. Move api files and generation targets here.
	* source: Added. Move source parsing here.

	* generator/makefile: Move actual generation to api/.
	* glib/Makefile.in: Remove generated/* target.
	* glue/Makefile.am: Fix to include canvas-marshal. Move canvas stuff
	to GNOME target.

	* gnome/CanvasProxy.cs: Update to work with SignalHandlers being
	namespace-specific.

	* parser/Metadata.pm: Moved to GAPI/Metadata.pm, renamed, etc.
	* parser/gapi2xml.pl: Use GAPI::Metadata.
	* parser/makefile: Install scripts, remove source parse build target.
	Rename formatXML to gapi_format_xml.

svn path=/trunk/gtk-sharp/; revision=6818
2002-08-20 19:56:18 +00:00
Mike Kestner
5d67982de9 2002-06-21 Mike Kestner <mkestner@speakeasy.net>
* makefile : remove gdk.imaging from the build
	* gdk.imaging/* : kill
	* generated/BoxedGen.cs : XmlNode namespace handling. Use GenBase.
	* generated/CallbackGen.cs : XmlNode namespace handling.
	* generated/Ctor.cs : construct with libname not ns.
	* generated/EnumGen.cs : XmlNode namespace handling.
	* generated/GenBase.cs : XmlNode namespace handling. Make AppendCustom
	  an instance method so it can use the private fields instead of params.
	* generated/InterfaceGen.cs : XmlNode namespace handling.
	* generated/Method.cs : construct with libname not ns.
	* generated/ObjectGen.cs : XmlNode namespace handling.
	* generated/Parser.cs : Use new XmlNode namespace ctors.
	* generated/Signal.cs : Lose the namespace field.
	* generated/StructBase.cs : derive from ClassBase
	* generated/StructGen.cs : XmlNode namespace handling. Use GenBase.
	* generated/SymbolTable.cs : nuke GetDllName method.
	* generator/gtkapi.xml : Add library name to namespace node.
	* parser/build.pl : refactor for library name param
	* parser/gapi2xml.pl : add libname param handling
	* sample/Makefile.in : build linux on make install, but don't install.

svn path=/trunk/gtk-sharp/; revision=5400
2002-06-21 20:25:43 +00:00
Rachel Hestilow
3bb3c5e4ff 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
* glib/GException.cs: Added.

	* generator/Ctor.cs, Method.cs: Tag function as unsafe if it throws
	an exception. Call parms.HandleException.

	* generator/Paramaters.cs: Add property ThrowsException (based
	on a trailing GError**). If ThrowsException, mask GError in the
	signature, initialize a GError in Initialize, and add new method
	HandleException to throw an exception if error != null.

	* generator/SymbolTable.cs: Add gdk-pixbuf DLL, and GError type.

	* gdk.imaging, gdk.imaging/Makefile.in, gdk.imaging/makefile.win32:
	Added.

	* configure.in, Makefile, makefile.win32: Build gdk.imaging.

	* gtk/Makefile.in, gtk/makefile.win32: Link against gdk.imaging.

	* parser/gapi2xml.pl: Support namespace renaming.

	* parser/build.pl: Build gdk-pixbuf as gdk.imaging.

svn path=/trunk/gtk-sharp/; revision=5281
2002-06-14 18:27:04 +00:00
Rachel Hestilow
eea6465cf2 2002-06-09 Rachel Hestilow <hestilow@ximian.com>
* generator/GenBase.cs: new method AppendCustom, moved from ObjectGen.
	* generator/BoxedGen.cs, ObjectGen.cs, StructGen.cs:
	Call AppendCustom in Generate ();
	* generator/Method.cs, Parameters.cs: Add support for "out"
	parameters. Additionally, output an accessor instead of a
	regular method if it is an accessor-style function (ie GetStartIter).
	* generator/Property.cs: Add additional cast to Boxed, if necessary.
	* glue/textiter.c: New constructor for GtkTextIter.
	* glue/Makefile.am: Add textiter.c, build with Gtk+ cflags.
	* configure.in: Check for Gtk+ cflags.
	* parser/Metadata.pm, Gtk.metadata: Added.
	* parser/gapi2xml.pl: Call Metadata::fixup on the document.
	Also work around gtk's screwy boxed type name registration
	(GtkFoo -> GtkTypeFoo).
	* gtk/TextIter.custom: Added.

svn path=/trunk/gtk-sharp/; revision=5205
2002-06-10 12:34:09 +00:00
Mike Kestner
6d30cf0c3e refactoring to remove substantial code duplication thoughout the generator
2002-05-23  Mike Kestner <mkestner@speakeasy.net>

	* generator/BoxedGen.cs : Update for Static SymbolTable
	* generator/CallbackGen.cs : Use GenBase and Parameters classes
	* generator/CodeGenerator.cs : Update for Static SymbolTable
	* generator/Ctor.cs : code from StructBase using Parameters class
	* generator/EnumGen.cs : Use GenBase
	* generator/GenBase.cs : Abstract Stream Writer creation, stream
	  boilerplate, and common *Name properties
	* generator/IGeneratable.cs : Update for Static SymbolTable
	* generator/InterfaceGen.cs : Use GenBase
	* generator/Method.cs : code from StructBase using Parameters class
	* generator/ObjectGen.cs : Major refactoring. Use GenBase. Build
	  tables of Member generatables at construct time to facilitate
	  future name collision resolution logic.
	* generator/Parameters.cs : new generatable to abstract duplicated
	  parameter parsing logic.
	* generator/Parser.cs : Update for Static SymbolTable
	* generator/Property.cs : code from ObjectGen
	* generator/Signal.cs : code from ObjectGen
	* generator/SignalHandler.cs : Update for Static SymbolTable
	* generator/StructBase.cs : Update for Static SymbolTable
	* generator/StructGen.cs : Update for Static SymbolTable
	* generator/SymbolTable.cs : Make all methods and private members
	  static.  There is no reason to ever have multiple tables.

svn path=/trunk/gtk-sharp/; revision=4895
2002-05-23 23:43:25 +00:00