Commit Graph

167 Commits

Author SHA1 Message Date
Owen Taylor
3b0bf76d21 girepository/girffi.c: Fix "Unexpected time for time_t" message.
svn path=/trunk/; revision=919
2008-11-13 21:38:42 +00:00
Colin Walters
fd1fe6c0b6 Remove processing msg
svn path=/trunk/; revision=915
2008-11-13 20:21:05 +00:00
Colin Walters
a610d8cbb4 Add new files from last commit
svn path=/trunk/; revision=913
2008-11-13 20:13:39 +00:00
Colin Walters
1ffeeab3d4 g_irepository_dump implementation
svn path=/trunk/; revision=911
2008-11-13 19:57:09 +00:00
Owen Taylor
7fa1ffa6e7 Bug 560419 – Cache includes when parsing
Keep track of all modules parsed within a GIrParser, and when a
module is referenced a second time, use the existing parsed copy
instead of reparsing.

svn path=/trunk/; revision=906
2008-11-12 17:17:15 +00:00
Owen Taylor
9a36a18939 Fix management of ParseContext.includes_modules (#560419)
Fix some trivial bugs in managing the list of include modules.
(Add to module's list twice, not initialized to NULL, not freed.)

svn path=/trunk/; revision=905
2008-11-12 17:17:08 +00:00
Owen Taylor
b1c6e64049 Keep aliases and disguised_structures local to each module (#560419)
When parsing, keep keep a separate hash tables of aliases and
'disguised' flags for each module, and store that on the module.

After parsing an include merge the aliases/disguised flags to the
including module.

Remove 'prefix_aliases' flag and always prefix aliases/disguised
structure types when parsing; this simplifies the code considerably.

svn path=/trunk/; revision=904
2008-11-12 17:17:01 +00:00
Owen Taylor
102e08428b Only allow one <namespace/> element per <repository/> (#560419)
The logic in girparser.c didn't work very well if there were multiple
<namespace/> nodes within a single <repository/> (context->namespace
was always the overall filename and not the the name specified in the
<namespace/> element for one thing; this would cause aliases to
be mis-prefixed in include modules.) Also check that the "name" in
the <namespace/> node matches the filename.

svn path=/trunk/; revision=902
2008-11-12 17:16:49 +00:00
Owen Taylor
0faf142d0a Add a GirParser object to hold the state of a compilation
Add a toplevel GirParser object to hold state that is global across
a compilation. Currently just holds the include path, but will
eventually also keep a cached list of parsed modules.

svn path=/trunk/; revision=901
2008-11-12 17:16:42 +00:00
Tommi Komulainen
092901f3ab Fix minor memory leak.
2008-11-12  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* girepository/girepository.c (find_namespace_latest): Fix
	minor memory leak.

svn path=/trunk/; revision=899
2008-11-12 14:42:13 +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
Johan Dahlin
bc1f9c5bbb Add a g_irepository_get_search_path, so we can access the search paths
2008-11-12  Johan Dahlin  <jdahlin@async.com.br>

        * girepository/girepository.c (g_irepository_get_search_path):
        * girepository/girepository.h:
        Add a g_irepository_get_search_path, so we can access the search
        paths from runtime.


svn path=/trunk/; revision=893
2008-11-12 12:40:34 +00:00
Johan Bilien
7bada628b9 Bug 560474 – g-ir-compiler crashes when compiling the glib gir
2008-11-12  Johan Bilien  <jobi@via.ecp.fr>

	Bug 560474 – g-ir-compiler crashes when compiling the glib gir

	* girepository/girparser.c: avoid freeing an uninitialized pointer


svn path=/trunk/; revision=891
2008-11-12 12:12:04 +00:00
Owen Taylor
744f3a3004 Bug 560404 – Prefix types when resolving aliases in included modules
* girepository/girparser.c: When resolving aliases in an included
module, prefix types before looking them up.

svn path=/trunk/; revision=889
2008-11-11 22:02:37 +00:00
Owen Taylor
7c221ce28b Compute field offsets and overall size for object structures
2008-11-11  Owen Taylor  <otaylor@redhat.com>

        Compute field offsets and overall size for object structures

        Bug 560326 – Fails to build Gtk-2.0.typelib with "Unexpected non-pointer
        field of type object in structure"

        Do basic computation of field offsets for objects and interfaces;
        this doesn't attempt to address all of the "mess" for virtual
        functions described in Bug 560281.

svn path=/trunk/; revision=888
2008-11-11 21:10:12 +00:00
Owen Taylor
ecc78cf338 Search provided include dirs before the default directories.
2008-11-11  Owen Taylor  <otaylor@redhat.com>

        * girepository/girparser.c: Search provided include dirs before
        the default directories.

svn path=/trunk/; revision=885
2008-11-11 15:25:59 +00:00
Owen Taylor
ac8db19d3f Include fully-qualified names in all error messages.
2008-11-11  Owen Taylor  <otaylor@redhat.com>

        * girepository/giroffsets.c: Include fully-qualified names in
        all error messages.

svn path=/trunk/; revision=884
2008-11-11 15:25:51 +00:00
Owen Taylor
9d4aa3bba3 Fail gracefully with an informative error message when recursion is
2008-11-11  Owen Taylor  <otaylor@redhat.com>

        * girepository/giroffsets.c: Fail gracefully with an informative
        error message when recursion is encountered when computing a
        structure size.

svn path=/trunk/; revision=882
2008-11-11 13:45:13 +00:00
Owen Taylor
01fda94550 girepository/girparser.c: Remove an unused variable.
svn path=/trunk/; revision=879
2008-11-11 05:11:05 +00:00
Owen Taylor
d680962438 Remove field offsets from g-ir-generate output and test inputs
Field offsets are a) architecture dependent so they shouldn't be part
of the architecture-independent gir format which is installed in
datadir. b) Are architecture-dependent so they shouldn't be in test
expected output. Remove field offsets from girs.
(Virtual function and discriminator offsets are not removed, as they
aren't fully hooked up to the field-offset computation machinery yet.)

svn path=/trunk/; revision=877
2008-11-11 05:10:47 +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
Owen Taylor
d041deae59 Split g_ir_ffi_get_ffi_type() out from ginvoke.c
Extract a function to convert GITypeTag to ffi_type from the internals
of ginvoke.c. This will be useful in figure out structure alignment.

Also fix handling of gsize and time_t to be portable. (Add a check
to configure.ac to figure out the width of time_t.)

svn path=/trunk/; revision=873
2008-11-11 00:04:45 +00:00
Owen Taylor
8c88777cfb Bug 560248 – "disguised structures"
Certain types like GIConv and GdkAtom are pointers internally but don't
look like pointers when referenced. They have the form.

 typedef struct _X *X;

Parse these as structures/records but mark them in the gir with a 'disguised'
attribute so that we know that they need special handling.

In the typelib treat them like any other structure.

svn path=/trunk/; revision=872
2008-11-10 23:58:49 +00:00
Colin Walters
b918bb5e8c Don't use nested scope local variable for error
svn path=/trunk/; revision=864
2008-11-05 22:09:44 +00:00
Tommi Komulainen
65b8727e57 Bug 557898 – Fails to build on OSX 10.4
2008-11-01  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* configure.ac: Check for $shrext_cmds that should be implicitly
	available if you're using libtool >= 2.0. If undefined, call
	libtool --config explicitly to get its value.
	* girepository/gtypelib.c: Remove special case for (non-)Darwin
	systems as unneeded.

svn path=/trunk/; revision=859
2008-11-01 18:21:55 +00:00
Johan Bilien
119c5034a1 Bug 558068 – when invoking a method, offset the in arguments by one, not
2008-10-27  Johan Bilien  <jobi@via.ecp.fr>

	Bug 558068 – when invoking a method, offset the in arguments by one,
	not the out

	* tests/invoke/invoke.c, tests/invoke/testfns.c,
	tests/invoke/testfns-1.0.gir: Add testing of method and constructor.
	* girepository/ginvoke.c: do not offset the index of given out
	arguments by one for methods, "this" is provided as in argument only.


svn path=/trunk/; revision=820
2008-10-27 15:03:18 +00:00
Colin Walters
310f119141 Bug 557791 – g_irepository_require() could return a GTypelib *
svn path=/trunk/; revision=816
2008-10-25 15:48:50 +00:00
Colin Walters
832328d59a Bug 557786 - support fixed size arrays
svn path=/trunk/; revision=814
2008-10-25 15:20:54 +00:00
Colin Walters
3944a895ce Bug 557076 - move typelibs to $libdir
svn path=/trunk/; revision=813
2008-10-25 14:59:25 +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
Johan Dahlin
b97c26b3ee Export two private methods to avoid an compiler warning
svn path=/trunk/; revision=810
2008-10-24 11:32:31 +00:00
Johan Dahlin
8d06e5c8e7 Only use SHLIB_SUFFIX on darwin, otherwise use G_MODULE_SUFFIX, we cannot
2008-10-24  Johan Dahlin  <johan@gnome.org>

        * girepository/gtypelib.c:
        Only use SHLIB_SUFFIX on darwin, otherwise use
        G_MODULE_SUFFIX, we cannot get shext_cmds from libtool 2.2.


svn path=/trunk/; revision=806
2008-10-24 11:19:49 +00:00
Lucas Rocha
294bf64206 Bug 557623 - Constructors shouldn't be flagged as methods.
2008-10-24  Lucas Rocha  <lucasr@gnome.org>

	Bug 557623 - Constructors shouldn't be flagged as methods.

	* girepository/ginfo.c (g_function_info_get_flags): ditto.

svn path=/trunk/; revision=805
2008-10-24 09:54:34 +00:00
Tommi Komulainen
2d0f1b3093 Bug 556739 – transfer-ownership attribute should be mandatory in .gir
2008-10-23  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* girepository/girparser.c (parse_param_transfer):
	* giscanner/transformer.py (_create_parameter, _create_return):
	* giscanner/girwriter.py (_write_return, _write_parameter):
	* tools/generate.c (write_callable_info): always write and
	require "transfer-ownership" for return-values and parameters

	* tests/boxed.gir:
	* tests/invoke/testfns-1.0.gir:
	* tests/object.gir:
	* tests/scanner/DrawableAdditions.xml:
	* tests/scanner/GtkFrob-1.0-expected.tgir:
	* tests/scanner/annotation-1.0-expected.tgir:
	* tests/scanner/drawable-1.0-expected.tgir:
	* tests/scanner/drawable-injected-1.0-expected.gir:
	* tests/scanner/drawable-injected-1.0-expected.tgir:
	* tests/scanner/foo-1.0-expected.tgir: Updated

svn path=/trunk/; revision=797
2008-10-23 17:42:25 +00:00
Johan Bilien
bb2b5e1ee3 Bug 557468 – Support for GI_TYPELIB_PATH
2008-10-23  Johan Bilien  <jobi@via.ecp.fr>

	Bug 557468 – Support for GI_TYPELIB_PATH

	* girepository/girepository.c: if the GI_TYPELIB_PATH is set, add the
	provided paths to the global search path.


svn path=/trunk/; revision=786
2008-10-23 09:10:04 +00:00
Lucas Rocha
9a32d9b093 fix some build warnings.
2008-10-22  Lucas Rocha  <lucasr@gnome.org>

	* girepository/girmodule.c, girepository/gtypelib.c,
	girepository/girparser.[ch]: fix some build warnings.

svn path=/trunk/; revision=783
2008-10-22 14:31:58 +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
Colin Walters
adc6a3e2ef Respect path ordering for unversioned requires
svn path=/trunk/; revision=778
2008-10-21 18:41:36 +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
0de03983be Bug 556732 – generate gir files consistently
2008-10-17  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556732 – generate gir files consistently

	* girepository/girparser.c (start_parameter):
	* tests/boxed.gir:
	* tests/invoke/testfns-1.0.gir:
	* tools/generate.c (write_callable_info): write
	'transfer-ownership' attribute consistently with both
	return-value and parameter elements

svn path=/trunk/; revision=745
2008-10-17 14:59:23 +00:00
Tommi Komulainen
0fa82c6a4c Bug 556732 – generate gir files consistently
2008-10-17  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556732 – generate gir files consistently

	* giscanner/ast.py (Field): add readable and writable properties
	* giscanner/girparser.py (_parse_field): copy 'readable' and
	'writable' attributes
	* giscanner/transformer.py (_create_member): create fields as
	read-write
	* giscanner/glibtransformer.py (_introspect_object,
	_pair_class_struct): make object instance and class fields
	read-only
	* giscanner/girwriter.py (_write_field):
	* tools/generate.c (write_field_info): write field 'readable'
	and 'writable' attributes only if non-default (read-only)
	* girepository/girparser.c (start_field): in the absence of
	attributes assume fields are read-only
	* tests/boxed.gir:
	* tests/struct.gir: remove redundant readable="1" from fields
	* tests/scanner/foo-1.0-expected.gir:
	* tests/scanner/utility-1.0-expected.gir: add writable="1" to
	all record and union fields

svn path=/trunk/; revision=743
2008-10-17 14:58:37 +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
e8c772bdb6 Bug 556541 – access union members through UnionBlob rather than
2008-10-16  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556541 – access union members through UnionBlob rather than
	StructBlob

	* girepository/ginfo.c (g_union_info_find_method): access union
	members through UnionBlob rather than StructBlob

svn path=/trunk/; revision=729
2008-10-16 17:07:00 +00:00
Colin Walters
7db23628b0 Merge branch 'bug556331-includecleanup'
svn path=/trunk/; revision=724
2008-10-16 01:40:29 +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
Tommi Komulainen
9153ef51ae Bug 556174 – parse types for lists etc.
2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556174 – parse types for lists etc.

	* girepository/girparser.c (end_type_recurse):
	* tests/boxed.gir:
	* tools/generate.c (write_type_info, write_field_info,
	write_callable_info, write_callable_info, write_constant_info,
	write_property_info): use nested <type>s for lists and hashes

svn path=/trunk/; revision=717
2008-10-15 22:08:26 +00:00
Tommi Komulainen
6e266d5f53 Bug 556400 – Fails to build on OS X 10.4
2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556400 – Fails to build on OS X 10.4

	* configure.ac: check for functions backtrace and backtrace_symbols
	* girepository/girparser.c (backtrace_stderr): Comment out
	implementation if the functions are not available.
	* gcov.mak (clean-gcov, clean-gcno): always call 'find' with a
	directory for better portability

svn path=/trunk/; revision=711
2008-10-15 20:44:29 +00:00