Commit Graph

32 Commits

Author SHA1 Message Date
Andreas Rottmann
b95d92aca0 Bug 556489 – callback annotations
2008-01-03  Andreas Rottmann  <a.rottmann@gmx.at>

	Bug 556489 – callback annotations
	
	* giscanner/transformer.py 

	* tools/generate.c (write_callable_info): Write out the new scope,
	closure and destroy attributes.

	* giscanner/transformer.py (Transformer._type_is_callback): New
	method, checking if a given type is a callback.
	(Transformer._augment_callback_params): New method; adds
	information (closure, destroy) to callback parameters.
	(Transformer._handle_closure, Transformer._handle_destroy): New methods, 
	auxiliary to _augment_callback_params.
	(Transformer._create_function): Call _augment_callback_params().
	(Transformer._create_parameter): Handle scope option.

	(Transformer._create_typedef_callback): New method, creates a
	callback, and registers it in the typedef namespace
	(Transformer._create_typedef): Use _create_typedef_callback()
	instead of the plain _create_callback().

	* giscanner/ast.py (Parameter): Added callback-related fields.
	* giscanner/girwriter.py: Write out new Parameter fields.

	* girepository/girnode.h (GIrNodeParam): Added fields scope, 
	closure and destroy.
	* girepository/gtypelib.h (ArgBlob): Ditto.
	* girepository/girparser.c (start_parameter): Handle new fields.

	* girepository/girmodule.c (g_ir_module_build_typelib): Adjust
	arg_blob_size, bump major version due to this change.
	* girepository/girnode.c (g_ir_node_get_full_size_internal)
	(g_ir_node_build_typelib)
	* girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size
	adjustments.
	(g_ir_node_build_typelib): Fill in new ArgBlob flags from param. 

	* girepository/girepository.h (GIScope): New enumeration, listing
	the different possible scopes for callbacks.

	* girepository/ginfo.c (g_arg_info_get_scope)
	(g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for
	callback-related argument indices (callback scope, closure for a
	callback, destroy notification for a callback).

	* tests/scanner/: Added testcases for new features.

svn path=/trunk/; revision=998
2009-01-03 13:44:42 +00:00
Colin Walters
74e22b307c Bug 559705 – Missing association between static methods and classes
2008-11-25  Colin Walters  <walters@verbum.org>

        Bug 559705 – Missing association between static methods and classes

        * docs/typelib-format.txt:
        * girepository/ginfo.c (g_function_info_get_flags):
        * girepository/girmodule.c (g_ir_module_build_typelib):
        * girepository/girnode.c (g_ir_node_get_size),
        (g_ir_node_build_typelib):
        * girepository/girparser.c (start_function):
        * girepository/gtypelib.c (g_typelib_check_sanity),
        (validate_header), (validate_function_blob):
        * girepository/gtypelib.h:
        * giscanner/ast.py:
        * giscanner/girwriter.py:
        * giscanner/glibtransformer.py:
        * tests/scanner/foo-1.0-expected.gir:
        * tests/scanner/foo-1.0-expected.tgir:
        * tests/scanner/foo.h:


svn path=/trunk/; revision=972
2008-11-25 22:29:20 +00:00
Colin Walters
52072b6bbf Use sizeof() instead of hard-coding struct sizes
svn path=/trunk/; revision=946
2008-11-18 18:42:36 +00:00
Owen Taylor
05d5158001 Add "storage type" to the typelib data for enums
In order to set and get enum and flag fields in structures, we need
to know the integral type that the enumeration is stored as. We are already
computing that at compile time in order to compute struct offsets, so the
easiest thing to do is to save that in the typelib.

* docs/typelib-format.txt girepository/girnode.[ch] girepository/giroffsets.c
girepository/gtypelib.h: Add 'storage_type' to the typelib format for EnumBlob
and compute and save it at compile time.

* girepository/girepository.h girepository/ginfo.c:
Add g_enum_info_get_storage_type().

* girepository/gfield.c: Implement reading and writing enum and flags fields
based on the storage type.

http://bugzilla.gnome.org/show_bug.cgi?id=561296

svn path=/trunk/; revision=944
2008-11-18 12:29:10 +00:00
Owen Taylor
c10269cf2d Respect is_pointer in serialize_type()
Add a '*' to the serialization for the cases where we set is_pointer
in the type blob we write out depending on node->is_pointer. Don't
add the '*' in the cases where is_pointer is set or not set in a
fixed fashion.

http://bugzilla.gnome.org/show_bug.cgi?id=561087

svn path=/trunk/; revision=931
2008-11-16 21:20:26 +00:00
Owen Taylor
6cb96533b9 Bug 560825 – Add size and alignment to typelib
Include the size and alignment of structures and unions in the typelib,
and add getter methods to retrieve them from GIStructInfo/GIUnionInfo.

* docs/typelib-format.txt girepository/gtypelib.h girepository/girnode.c
girepository/girmodule.c girepository/gtypelib.c: Add size and alignment
to StructBlob and UnionBlob.

* girepository/ginfo.c girepository/girepository.h:
Add g_[struct|union]_get[size|alignment]().

* test/offsets/gen-gitestoffsets: Test overall structure size and alignment.

svn path=/trunk/; revision=930
2008-11-16 21:15:54 +00:00
Colin Walters
02020aeb20 Bug 557788 - Return types for constructors in generated typelib bogus
svn path=/trunk/; revision=920
2008-11-13 22:56:15 +00:00
Johan Dahlin
afe696cafd Change the element type from utf8 to filename Special case filename
2008-11-12  Johan Dahlin  <jdahlin@async.com.br>

        * girepository/girepository.c:
        Change the element type from utf8 to filename
        * girepository/girnode.c (g_ir_node_build_typelib):
        Special case filename equally to utf8 here.


svn path=/trunk/; revision=895
2008-11-12 12:59:01 +00:00
Owen Taylor
31a7f413d6 Bug 560252 - Compute field offsets before writing typelib
girnode.h: Store the total size and alignment for
 GIrNodeStruct/Boxed/Union.

giroffset.c: New file implementing computation of structure
 field offsets.

girnode.c: Compute structure field offsets before writing types
 into the typelib.

docs/typelib-format.txt: Document that a field offset of 0xFFFF
means "unknown". Also fix description of the discriminator_offset
field for unions.

svn path=/trunk/; revision=876
2008-11-11 05:10:36 +00:00
Owen Taylor
6d9212674a Bug 560250 - Fully parse included modules
For some things, like computing structure offsets to put into the typelib
we need more than just the aliases from included modules. Do a completel
parse of included modules and store in module->included_modules.

Also add g_ir_find_node() to find node information from within the
active set of modules and their includes.

svn path=/trunk/; revision=874
2008-11-11 00:48:17 +00:00
Colin Walters
832328d59a Bug 557786 - support fixed size arrays
svn path=/trunk/; revision=814
2008-10-25 15:20:54 +00:00
Johan Dahlin
696aa37e4e Be quiet, do not warn about unhandled members.
2008-10-24  Johan Dahlin  <johan@gnome.org>

        * girepository/girnode.c (g_ir_node_check_unhandled_members):
        Be quiet, do not warn about unhandled members.


svn path=/trunk/; revision=811
2008-10-24 11:33:33 +00:00
Tommi Komulainen
04c5badd69 Bug 557405 – Use 'allow-none' consistently
2008-10-22  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* docs/typelib-format.txt:
	* girepository/ginfo.c (g_arg_info_may_be_null):
	* girepository/girnode.c (g_ir_node_build_typelib):
	* girepository/girnode.h (struct _GIrNodeParam):
	* girepository/girparser.c (start_parameter):
	* girepository/girwriter.c (function_generate):
	* girepository/gtypelib.h (ArgBlob):
	* tests/errors.gir:
	* tests/function.gir:
	* tools/generate.c (write_callable_info): Use 'allow-none'
	consistently throughout

svn path=/trunk/; revision=782
2008-10-22 14:02:02 +00:00
Johan Bilien
727bb01805 Bug 557241 – "throws" flag for functions
2008-10-21  Johan Bilien  <jobi@via.ecp.fr>

	Bug 557241 – "throws" flag for functions

	* tests/scanner/drawable-1.0-expected.gir,
	tests/scanner/drawable-injected-1.0-expected.gir,
	tests/scanner/drawable.[ch]: add simple test for throwing
	function (has GError ** as last argument)

	* giscanner/ast.py: add a 'throws' flag to Function
	* giscanner/glibtransformer.py: if a function's last paramerter is
	a GError, set the 'throws' flag and remove that parameter
	* giscanner/girwriter.py: write out the 'throws' attribute
	* giscanner/girparser.py: support parsing the 'throws' attribute

	* tests/repository/gitestthrows.c: add a simple test to check the
	throws flag in a typelib and invoke the function

	* girepository/ginfo.c, girepository/girnode.[ch],
	girepository/girnode.h, girepository/girparser.c,
	girepository/girepository.h: Add and parse the GI_FUNCTION_THROWS flag

	* girepository/ginvoke.c: if a function throws, add a GError as last
	arguments, and propagate the error to the invoker.


svn path=/trunk/; revision=773
2008-10-21 17:04:11 +00:00
Colin Walters
c3330c06c7 Bug 557011 - Add g_object_info_get_abstract
svn path=/trunk/; revision=757
2008-10-20 17:04:17 +00:00
Tommi Komulainen
4fb5b001bb Bug 556543 – reduce compiler warnings
2008-10-16  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556543 – reduce compiler warnings

	* girepository/ginfo.c:
	* girepository/girepository.c (register_internal,
	count_interfaces, find_interface, find_namespace_version,
	parse_version, g_irepository_require):
	* girepository/girmodule.c (g_ir_module_build_typelib):
	* girepository/girnode.c (init_stats, dump_stats,
	_g_irnode_init_stats, _g_irnode_dump_stats,
	g_ir_node_can_have_member):
	* girepository/girparser.c (firstpass_end_element_handler,
	locate_gir, parse_basic, parse_type_internal, resolve_aliases,
	start_alias, start_type, end_type_top, parse_include, cleanup,
	post_filter):
	* girepository/gtypelib.c (validate_function_blob, validate_enum_blob):
	* giscanner/giscannermodule.c (directive_get_options,
	type_get_child_list):
	* giscanner/scannerlexer.l (parse_gtkdoc):
	* giscanner/scannerparser.y (ctype_free):
	* giscanner/sourcescanner.c:
	* giscanner/sourcescanner.h (gi_source_scanner_parse_macros):
	* tests/types/gitesttypes.c:
	* tools/compiler.c (main):
	* tools/generate.c (write_repository): Remove unused variables
	and code, add missing includes, declarations and case
	statements.

svn path=/trunk/; revision=730
2008-10-16 17:07:05 +00:00
Tommi Komulainen
cab23be329 Bug 556434 – unhandled interface/object/... member types
2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556434 – unhandled interface/object/... member types

	* girepository/girnode.c (g_ir_node_check_unhandled_members,
	g_ir_node_build_typelib): Check all
	interface/object/boxed/struct/union members are processed and
	abort if they are not. (Mostly callbacks in structs, but also
	fields in interfaces.)

svn path=/trunk/; revision=722
2008-10-15 22:28:53 +00:00
Tommi Komulainen
7d89fdf643 refactor common code for processing members to a function
2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* a/girepository/girnode.c (g_ir_node_build_members,
	g_ir_node_build_typelib): refactor common code for processing
	members to a function

svn path=/trunk/; revision=721
2008-10-15 22:28:41 +00:00
Colin Walters
8fc943f941 Merge branch 'bug552566-timet/wip'
svn path=/trunk/; revision=624
2008-09-23 18:20:25 +00:00
Colin Walters
450476b1a7 Don't add spurious * if type is pointer; the is_pointer flag is enough
svn path=/trunk/; revision=611
2008-09-16 19:44:30 +00:00
Colin Walters
8f09203dda Allow both union and struct to be boxed or not
* girepository/girnode.c: Allow gtype_name
	and gtype_init in struct and union.
	* girepository/girparser.c: Parse glib:
	boxed bits for both structure and union.
	* girepository/gtypelib.c: Don't barf
	if structure is boxed.
	* giscanner/girparser.py: Parse new XML
	format.
	* giscanner/girwriter.py: Write out new
	XML format.
	* giscanner/glibast.py: Define new classes
	which are both Boxed and Struct/Union, as
	well as an "Other" for everything else.
	* giscanner/glibtransformer.py: Handle
	boxed types specially; we try to merge
	them with a struct/union if one exists,
	otherwise fall back to generic boxed.
	* tests/*: Update.
	* tools/generate.c: Write out new format.

svn path=/trunk/; revision=575
2008-09-06 20:33:51 +00:00
Tor Lillqvist
fc1efcef59 Use binary mode for output file on Windows.
2008-08-28  Tor Lillqvist  <tml@novell.com>

	* tools/compiler.c (write_out_typelib): Use binary mode for output
	file on Windows.

	* girepository/girnode.c: Don't print NULL strings.

	* tests/invoke/Makefile.am
	* tests/scanner/Makefile.am: Use -no-undefined on Windows to
	convince libtool to build shared libraries.

	* tests/invoke/invoke.c: Don't needlessly include <dlfcn.h>. Use
	g_assert() instead of printing out expected errors.


svn path=/trunk/; revision=509
2008-08-28 16:55:37 +00:00
Colin Walters
a2678afc9c Add debug bit, tweak to use GUINT as correct.
svn path=/trunk/; revision=476
2008-08-23 21:30:06 +00:00
Colin Walters
6d34368cac Another debug print
svn path=/trunk/; revision=471
2008-08-23 16:46:58 +00:00
Colin Walters
71aacda759 Don't hardcode integers, use GITypeTag.
2008-08-22  Colin Walters  <walters@verbum.org>

	* girepository/girnode.c: Don't hardcode integers,
	use GITypeTag.

svn path=/trunk/; revision=465
2008-08-22 22:15:28 +00:00
Colin Walters
60adefcef2 Tweak to use UINT instead of INT. Not likely to matter. Add to
2008-08-21  Colin Walters  <walters@verbum.org>

	* girepository/girnode.c (write_string): Tweak to
	use UINT instead of INT.  Not likely to matter.
	* girepository/girmodule.c (g_ir_module_build_typelib):
	Add to header_offset as well for header strings
	to match what write_string does.
	* girepository/gtypelib.c: Replace is_name with
	validate_name, which more strongly validates and
	handles errors in a better way.  Update all callers.
	* giscanner/glibtransformer.py: Handle constructors
	better.

svn path=/trunk/; revision=439
2008-08-21 16:15:55 +00:00
Johan Dahlin
b3312fb83f Make enum serializing functions public. Clean up some whitespace.
2008-08-18  Johan Dahlin  <johan@gnome.org>

    * girepository/girepository.c (g_type_tag_to_string):
    * girepository/girepository.h:
    * girepository/girnode.c (g_ir_node_get_full_size_internal),
    (find_entry_node):
    * girepository/girnode.h:
    Make enum serializing functions public. Clean up some whitespace.


svn path=/trunk/; revision=394
2008-08-18 08:52:47 +00:00
Johan Dahlin
3e28196a98 Allow get_type to be None, set a get_type for GInitiallyUnowned too.
2008-08-13  Johan Dahlin  <johan@gnome.org>

    * girepository/girnode.c (g_ir_node_get_full_size_internal):
    * girepository/girparser.c (start_class):
    * giscanner/glibtransformer.py:
    Allow get_type to be None, set a get_type for GInitiallyUnowned too.


svn path=/trunk/; revision=362
2008-08-13 21:44:38 +00:00
Colin Walters
de7d01898e Record typedefs as <alias> elements. Also attempt to look up types in
2008-08-12  Colin Walters  <walters@verbum.org>

	* giscanner/transformer.py: Record typedefs as <alias> elements.
	  Also attempt to look up types in external namespaces.
	* giscanner/girwriter.py: Write them.
	* giscanner/glibtransformer.py: Rework resolver using real instanceof
	checks.  Resolve interface methods and properties.
	* tests/scanner/foo-object.h: Add a method with typedef.
	* tests/scanner/Foo-expected.gir: Update.
	* girepository/girnode.c: Debug tweaks.
	* girepository/girparser.c: Make a first pass through the XML where we
	record all the aliases.  This lets us resolve them as we go through the
	second pass.
	* gir/Makefile.am: Don't install gobject-2.0.gir; we want that to come
	from gir-repository.



svn path=/trunk/; revision=355
2008-08-13 16:10:09 +00:00
Colin Walters
0ed07b5934 Remove usage of (GAPI-oriented) TypeTag in favor of GITypeTag from
2008-08-12  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c, girepository/gtypelib.c,
	girepository/gtypelib.h, girepository/girnode.c:
	Remove usage of (GAPI-oriented) TypeTag in favor of
	GITypeTag from girepository.h.



svn path=/trunk/; revision=347
2008-08-12 15:34:27 +00:00
Johan Dahlin
33455bc3ef Rename metadata to typelib in variable names, comments and apis.
2008-08-09  Johan Dahlin  <johan@gnome.org>

    * *.[ch]:
    Rename metadata to typelib in variable names,
    comments and apis.


svn path=/trunk/; revision=339
2008-08-09 12:55:32 +00:00
Johan Dahlin
282a6c644e Move shared *.[ch] files to girepository from tools
2008-08-09  Johan Dahlin  <johan@gnome.org>

    * girepository/Makefile.am:
    * tools/Makefile.am:
    * tools/girmodule.c:
    * tools/girmodule.h:
    * tools/girnode.c:
    * tools/girnode.h:
    * tools/girparser.c:
    * tools/girparser.h:
    * tools/girwriter.c:
    * tools/girwriter.h:
    Move shared *.[ch] files to girepository from tools


svn path=/trunk/; revision=337
2008-08-09 12:46:48 +00:00