Commit Graph

26 Commits

Author SHA1 Message Date
Mikkel Kruse Johnsen
7236eb3fa7 Upstream patches 2016-06-08 08:56:55 +02:00
Stephan Sundermann
5eea00f705 generator: new --gapidir flag to search for xml files 2013-10-09 20:00:14 +02:00
Bertrand Lorentz
99cb57e7aa generator: Add option to validate GAPI XML against an XSD schema
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.
2013-02-23 13:41:50 +01:00
Bertrand Lorentz
629a34aa4f generator: Improve handling of command-line parameters
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.
2012-11-25 15:05:17 +01: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
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
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
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
Mike Kestner
8fd87b2e0a 2005-01-08 Mike Kestner <mkestner@novell.com>
* configure.in : kill a ton of redundant stuff.
	* AssemblyInfo.cs.in : moved here, only need one.
	* Makefile.include : rules for building generated assemblies.
	* Makefile.am : removed gtk-sharp-2.0.pc handling.
	* */AssemblyInfo.cs.in : killed
	* */Makefile.am : refactored out a ton of rules to an include.
	* */*-pc.in : added Cflags entries pointing to the gapi files.
	* generator/CodeGenerator.cs : add -I: synonym --include.
	* gnomevfs/gnome-vfs-api.raw : remamed from gnomevfs-api.raw.
	* gtk/gtk-sharp-2.0.pc.in : moved here from top.
	* parser/gapi-fixup.cs : add --symbol arg to merge sym files.
	* sources/gtk-sharp-sources.xml : remamed gnome-vfs-api.raw.

svn path=/trunk/gtk-sharp/; revision=38551
2005-01-09 00:26:45 +00:00
Dan Winship
62258ca7c3 * generator/CallbackGen.cs:
* generator/CodeGenerator.cs: 
        * generator/ManagedCallString.cs:
        * generator/Property.cs: Remove unused vars

        * generator/Method.cs (GetHashCode): have to implement this since
        we're overriding Equals.

        * generator/CallbackGen.cs: print a message when generating a
        broken struct-returning callback. (Currently affects
        GtkSharp.TextSegSplitFuncNative and
        GtkSharp.TextSegCleanupFuncNative)

        * gdk/glue/device.c: 
        * gdk/glue/dragcontext.c: Add missing prototypes

        * gtk/Gtk.metadata: Mark SeparatorToolItem.Draw "new". Re-rename
        CheckMenuItem.Toggled to EmitToggled rather than Toggle, since
        that's a better description of what it does.

        * gtk/CheckMenuItem.custom: implement a "Toggle" method that does
        what the documentation claims it does.

        * gtk/NodeStore.cs: remove unused var

        * gnome/Gnome.metadata: mark DateEdit.Flags, Dialog.Default, and
        PropertyBox.State "new". Hide GnomePixmapEntry.GnomeEntry and
        GnomePixmapEntry.GtkEntry since they do exactly the same thing as
        the methods of the same names inherited from GnomeFileEntry.

        * gnome/glue/canvas-proxy.c:
        * gnome/glue/canvas-proxy.h:
        * gnome/glue/canvas-proxy-marshal.c:
        * gnome/glue/canvas-proxy-marshal.h:
        * gnome/glue/canvas-proxy-marshal.list: Remove unused code

        * gnome/glue/Makefile.am (libgnomesharpglue_2_la_SOURCES): update

        * panelapplet/PanelApplet.metadata: mark PanelApplet.Flags "new"

        * sample/CanvasExample.cs: 
        * sample/CustomCellRenderer.cs: 
        * sample/CustomNotebook.cs: 
        * sample/DrawingSample.cs:
        * sample/Fifteen.cs: 
        * sample/GladeTest.cs: 
        * sample/GtkDemo/DemoHyperText.cs: 
        * sample/GtkDemo/DemoPixbuf.cs: 
        * sample/ScribbleXInput.cs: remove unused vars, use
        GLib.Timeout.Add rather than the deprecated Gtk.Timeout.Add

svn path=/trunk/gtk-sharp/; revision=38043
2004-12-21 18:46:42 +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
9861569931 2004-03-18 Mike Kestner <mkestner@ximian.com>
* configure.in : expand atk/glue/Makefile
	* atk/Makefile.am : generate glue and build glue dir
	* atk/makefile.win32 : ditto
	* atk/glue/Makefile.am : build new glue
	* atk/glue/makefile.win32 : build new glue
	* atk/glue/vmglueheaders.h : new includes for vm glue
	* atk/glue/win32dll.c : win dll building code
	* generator/CodeGenerator.cs : add --gluelib-name and
	--glue-filename argument parsing.
	* generator/GenerationInfo.cs : add GluelibName, GlueFilename,
	GlueEnabled, GlueWriter, and CloseGlueWriter.
	* generator/ObjectGen.cs : Add VirtualMethod glue generation
	* generator/Statistics.cs : Add warning message for virtual
	method throttling.

svn path=/trunk/gtk-sharp/; revision=24292
2004-03-18 20:56:32 +00:00
Mike Kestner
65fec771bb 2003-10-06 Mike Kestner <mkestner@ximian.com>
* Makefile.in : add gtkhtml dir.
	* configure.in : expand gtkhtml/Makefile
	* api/Makefile.in : remove gtkhtml-api.xml
	* generator/CodeGenerator.cs : parse new --outdir, --customdir,
	and --assembly-name args.
	* generator/GenerationInfo.cs (Ctor): new (dir, dir,assembly) ctor
	* gtkhtml/HTMLStream.custom : moved here from gtk dir
	* gtkhtml/gtkhtml-api.xml : moved here from api dir
	* gtkhtml/Makefile.in : gen source and build dll
	* sources/gtk-sharp-sources.xml : write gtkhtml api to new dir

svn path=/trunk/gtk-sharp/; revision=18696
2003-10-07 05:52:23 +00:00
Mike Kestner
06a02e97b4 2003-10-06 Mike Kestner <mkestner@ximian.com>
* generator/CodeGenerator.cs (Main): use new ObjectGen.GenerateMappers.
	* generator/GenerationInfo.cs (Ctor): new (dir, assembly) ctor
	* generator/ObjectGen.cs : move hash management to Generate from Ctor,
	index it on dir, and make it hold new DirectoryInfo refs.  Refactor
	GenerateMapper. The object mappers are now assembly based instead of
	namespace based.

svn path=/trunk/gtk-sharp/; revision=18681
2003-10-06 18:18:49 +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
c17c41c4a8 2003-10-03 Mike Kestner <mkestner@ximian.com>
* api/gtk-symbols.xml : make GtkType a uint like GType.
	* generator/CodeGenerator.cs : adopt new parser semantics
	* generator/Parser.cs : move to single parser/multiple Parse. Remove
	DoGenerate hack and let the CodeGenerator control this. Return
	generatables instead of loading symboltable.
	* generator/SymbolTable : add AddTypes method. Revamp dealiasing code.

svn path=/trunk/gtk-sharp/; revision=18570
2003-10-03 22:11:47 +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
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
66c0ec1d43 2002-08-07 Mike Kestner <mkestner@speakeasy.net>
* generator/CodeGenerator.cs : call ObjectGen.GenerateMapper
	* generator/Method.cs : Remove the if null workaround
	* generator/ObjectGen.cs : build a hash of object types.
	(GenerateMapper): generate the GtkSharp.ObjectManager class.
	* glib/Object.cs : use ObjectManager.CreateObject.
	* glue/type.c : helper for typename lookup.

svn path=/trunk/gtk-sharp/; revision=6526
2002-08-08 04:48:41 +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
Mike Kestner
ff61ba7907 2002-03-29 Mike Kestner <mkestner@speakeasy.net>
* generator/SymbolTable.cs (Trim): revamp TrimEnd call.

svn path=/trunk/gtk-sharp/; revision=3501
2002-03-29 17:55:46 +00:00
Mike Kestner
95d51167de 2002-03-07 Mike Kestner <mkestner@speakeasy.net>
* generator/CodeGenerator.cs : Refactor generatable iteration.
	* generator/SymbolTable.cs : Add Generatables property to expose complex_types.Values.

svn path=/trunk/gtk-sharp/; revision=3008
2002-03-08 22:40:00 +00:00
Mike Kestner
ede9016e25 2002-02-19 Mike Kestner <mkestner@speakeasy.net>
* generator/Statistics.cs : New. Gathers stats about generation.
	* generator/*.cs : Hook in the stat counters.

svn path=/trunk/gtk-sharp/; revision=2491
2002-02-19 03:12:47 +00:00
Mike Kestner
02fa6a31e6 2002-01-05 Mike Kestner <mkestner@speakeasy.net>
* generator/*.cs : Move into GtkSharp.Generation namespace.
	* generator/CodeGenerator.cs (Main): Add usage check. Add SymbolTable.
	* generator/EnumGen.cs (QualifiedName): New.
	(Generate): Add SymbolTable to signature.
	* generator/IGeneratable : Add QualifiedName prop and update Generate
	  signature.
	* generator/Parser.cs : Switch from plain Hashtable to SymbolTable.
	(Parse): Replaces the Types property and returns a SymbolTable.
	* generator/StructBase.cs : New base class to derive struct and object
	  types. Initial implementation of protected GenField method and ctor.
	* generator/StructGen.cs : New non-object struct type generatable.
	* generator/SymbolTable.cs : New. Manages complex types hash and a
	  simple types hash.  Will provide generic lookup interface.

svn path=/trunk/gtk-sharp/; revision=1855
2002-01-05 12:45:55 +00:00
Mike Kestner
30e653825c This is an enormous commit of stuff that I've been working on for several
weeks.  I'll be posting an update to gtk-sharp-list in a bit to describe my
latest psychosis.

svn path=/trunk/gtk-sharp/; revision=1797
2002-01-04 02:02:28 +00:00