Commit Graph

52 Commits

Author SHA1 Message Date
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
Colin Walters
7db23628b0 Merge branch 'bug556331-includecleanup'
svn path=/trunk/; revision=724
2008-10-16 01:40:29 +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
Tommi Komulainen
a940cef8c7 handle "transfer-ownership" attribute
2008-10-12  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* girepository/girparser.c (start_return_value): handle
	"transfer-ownership" attribute

svn path=/trunk/; revision=690
2008-10-12 21:07:33 +00:00
Tommi Komulainen
25e43d53d1 use "container" for container/shallow ownership transfer (not "shallow")
2008-10-12  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* girepository/girparser.c (parse_param_transfer):
	* tools/generate.c (write_callable_info): use "container" for
	container/shallow ownership transfer (not "shallow")

svn path=/trunk/; revision=689
2008-10-12 21:07:28 +00:00
Tommi Komulainen
bc54751766 Refactor handling of transfer=none/shallow/full to separate function
2008-10-12  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* girepository/girparser.c (parse_param_transfer,
	start_parameter): Refactor handling of transfer=none/shallow/full
	to separate function

svn path=/trunk/; revision=688
2008-10-12 21:07:22 +00:00
Colin Walters
3be641f836 Bug 552858: versioning
This is a big patch.  You should probably remove your installation
	tree to be cleaner.

	* docs/typelib-format.txt: Add nsversion entry which holds
	version of namespace.
	* girepository/girepository.h: Add 'version' parameter to
	g_irepository_require.  This may be NULL.  Normally
	bindings should pass an explicit version though.
	* girepository/girepository.c: Lots of infrastructure to
	support versioning.  Add some more documentation.  Disallow
	some usage of NULL namespaces.
	* girepository/girmodule.c: Add version parameter.
	* girepository/gtypelib.c: Update header size.
	* giscanner/ast.py: Add version to Namespace.
	* giscanner/girparser.py: Parse version attribute from
	XML, pass to Namespace.
	* giscanner/girwriter.py: Write out version parameter.
	* giscanner/transformer.py: Clean up include registration.
	* tests/*: Add version attribute.
	* tests/invoke/invoke.c: Don't try looking up test before
	it's loaded in repository.
	* tools/generate.c: Output version parameter.
	* gir/Makefile.am: Add 2.0 version to .gir files.

svn path=/trunk/; revision=677
2008-10-12 04:51:48 +00:00
Colin Walters
d982b65391 Remove debug print
svn path=/trunk/; revision=644
2008-10-02 14:07:42 +00:00
Colin Walters
a99fdaf755 Merge branch 'bug552393-varargs'
svn path=/trunk/; revision=643
2008-10-02 14:07:38 +00:00
Colin Walters
b26d8d2dce Bug 554632: Create type tag for GType
svn path=/trunk/; revision=641
2008-10-02 13:25:46 +00:00
Colin Walters
9893df46cb Ensure we always have types for container nodes
svn path=/trunk/; revision=638
2008-09-29 19:03:46 +00:00
Colin Walters
ff654e2d4e Rework to use recursive XML
svn path=/trunk/; revision=637
2008-09-29 19:03:44 +00:00
Colin Walters
f32239577e Remove non-repository types from GIR
* giscanner/ast.py: The canonical name is 'utf8', not
	'string'.
	* giscanner/glibast.py: A few more glib type mappings.
	* girepository/girparser.c: We only parse repository types.
	* tests/*.gir: Update.

svn path=/trunk/; revision=628
2008-09-25 22:33:57 +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
0ab7337756 Bug 552065: Add deprecation information to GIR
* giscanner/ast.py: Add deprecation attributes.
	* giscanner/girwriter.py: Write out deprecation data.
	* girepository/girparser.c: Relax parsing; deprecated
	attribute now includes freeform string.
	* giscanner/scannerlexer.l: Parse Deprecated.
	* giscanner/transformer.py: Look for deprecated attribute
	on functions.
	* tests/scanner/*: Add a Deprecated test.

svn path=/trunk/; revision=603
2008-09-15 14:46:19 +00:00
Colin Walters
7a55bd25d9 Write out and parse full GObject property information (readable, writable, etc)
* girepository/girparser.c: Default to "readable" for properties.
	* giscanner/ast.py: Add readable, writable etc.
	* giscanner/girwriter.py: Writ them.
	* giscanner/glibtransformer.py: Inspect them.
	* tests/*: Update.

svn path=/trunk/; revision=587
2008-09-08 22:24:09 +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
Colin Walters
71473eb033 Look in c:type to determine pointer nature
* girepository/girparser.c: Look at c:type to determine
	whether or not an item is a pointer.

svn path=/trunk/; revision=571
2008-09-01 18:52:34 +00:00
Colin Walters
ae48f17999 Don't lose if we have no includedirs
* girepository/girparser.c: Don't lose if we
	have no includedirs

svn path=/trunk/; revision=551
2008-08-31 16:01:02 +00:00
Colin Walters
6e656b4498 Put dependencies in typelibs, resolve them when loading
* gir/Makefile.am: Dep on Makefile
	* girepository/ginfo.c: Print out a nicer error
	message if we failed to load something.
	* girepository/girepository.c: Clean up
	default typelib handling; remove global
	default_typelib variable.  Ensure we handle
	NULL repository in more places.
	Support dependency resolution.
	* tests/Makefile.am: Kill off gobject.gir,
	it conflicts with the real one.
	* tests/Object.gir: Depend on GObject.
	* tools/generate.c: Take --includedir
	argument to say which directories to search
	for typelibs.  Print out dependencies.

svn path=/trunk/; revision=541
2008-08-30 20:31:07 +00:00
Colin Walters
8baadb8611 Handle alias chains correctly
* girepository/girparser.c: Handle chains of aliases
	across modules by ensuring we fully qualify aliases
	from includes.

svn path=/trunk/; revision=531
2008-08-29 20:41:26 +00:00
Colin Walters
63bb95c0db Avoid searching aliases for basic types
* girepository/girparser.c: Don't search aliases
	for basic types.

svn path=/trunk/; revision=529
2008-08-29 20:06:10 +00:00
Colin Walters
da9249d559 Fix type parsing for both GLib case and GLib.List
* girepository/girparser.c: Rewrite type parsing
	to handle both GLib parsing case as well as correctly
	handling GLib.List and friends.  Don't try to treat
	e.g. ListStore as a List.

svn path=/trunk/; revision=527
2008-08-29 19:33:09 +00:00
Colin Walters
a633e4b1f3 Correctly handle GLib.List, GLib.Error etc
* girepository/girparser.c: Accept both List (for
	compiling GLib) and GLib.List (what the scanner
	generates).
	* tests/ - Update.
	* tools/generate.c: Generate canonical form.

svn path=/trunk/; revision=522
2008-08-29 18:19:26 +00:00
Colin Walters
b31a2ae395 Fix --includedir handling
* tests/scanner/Makefile.am: Pass the right
	--includedir args.  Add a Makefile dep.
	* tools/compiler.c: Pass includedirs down.
	* girepository/girparser.c: Actually put
	includedirs in context, pass down.  Fix
	locate_gir.

svn path=/trunk/; revision=514
2008-08-28 22:13:00 +00:00
Colin Walters
7fd9cd094d Expand aliases when generating typelibs
* gir/Makefile.am: Use --includedir
	* girepository/girparser.c: Recursively parse
	includes to pull in aliases and expand them.
	We need this to	avoid putting unknown names in
	the typelibs.
	* tools/compiler.c: Add --includedir option.

svn path=/trunk/; revision=512
2008-08-28 21:19:22 +00:00
Tor Lillqvist
2bb80a1209 Make g-ir-scanner work on Windows. Still problems with the typelib code.
2008-08-27  Tor Lillqvist  <tml@novell.com>

	Make g-ir-scanner work on Windows. Still problems with the typelib
	code. Changes okayed by jdahlin.

	* configure.ac: Check for Windows, set Automake conditional
	OS_WIN32. Change backslashes to forward slashes in pyexecdir to
	avoid shell quoting issues
	
	* girepository/Makefile.am: Use -no-undefined so that libtool
	agrees to build a shared library on Windows.

	* girepository/girparser.c (backtrace_stderr): No backtrace() on
	Windows. Empty implementation on Windows so far.

	* girepository/gtypelib.c (g_typelib_check_sanity): Give more
	informative error message for the assertion failures. Tell also
	what the expected size of the struct is. Check all sizes first and
	fail afterwards if at least one size was different from expected.

	* tools/Makefile.am: Reorder libraries into proper logical
	dependency order.

	* tools/generate.c: Don't include <dlfcn.h>, not used.

	* giscanner/Makefile.am: On Windows, link with the Python library,
	and install the module DLL as _giscanner.pyd. Remove the
	unnecessary import library and libtool library that libtool has
	installed.

	* giscanner/scannerlexer.l: Recognize the gcc __attribute__ syntax
	and just skip it. Recognize also two "l" suffixes for long long
	constants. Recognize also __inline__.

	* giscanner/grealpath.h (g_realpath): Implement on Windows, using
	GetFullPathName(). As such, GetFullPathName() does more than the
	UNIX realpath(). It also changes relative paths into absolute
	paths. But for our purposes that shouldn't matter.

	* giscanner/giscannermodule.c (pygi_source_scanner_parse_file): On
	Windows the file descriptor passed to us is from Python. Python
	Python2.5 uses the msvcr71.dll C library, while mingw-built code
	uses msvcrt.dll. On Windows, file descriptors are specific to
	which C library is used. So we must find out what underlying OS
	handle corresponds to the file descriptor Python passes us, and
	then make that into a file descriptor valid for the C library this
	code uses.

	* giscanner/sourcescanner.py (_parse): Don't need to bypass
	__attribute__ as the lexer now handles it. The definition as empty
	was ineffective for mingw anyway, as mingw's _mingw.h undefines
	__attribute__. Close the temp file before unlinking it.

	* giscanner/cgobject.py: Use correct library name for the gobject
	DLL on Windows.

	* gir/Makefile.am: Must pass the full basename of the DLLs on
	Windows to g-ir-scanner. It's a bit ugly that we have to "know"
	that the names of the GLib DLLs are like libglib-2.0-0.dll, but in
	reality they won't change, until there is a GLib 3, and then also
	the Unix code here needs changing.

	Must pass CPPFLAGS to g-ir-scanner when building GLib.gir so that
	libintl.h is found.


svn path=/trunk/; revision=503
2008-08-27 13:33:21 +00:00
Colin Walters
777cc726a4 Parse new implements syntax, drop gapi one. Update. Generate new syntax.
2008-08-25  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c: Parse new implements
	syntax, drop gapi one.
	* tests/object.gir: Update.
	* tools/generate.c: Generate new syntax.

svn path=/trunk/; revision=492
2008-08-25 15:22:39 +00:00
Johan Dahlin
ed13aae5f2 Refactor a couple of parsing functions to be simpler to follow. Avoid huge
2008-08-24  Johan Dahlin  <johan@gnome.org>

    * girepository/girparser.c (start_glib_boxed), (start_function),
    (start_field), (start_alias):
    Refactor a couple of parsing functions to be simpler to follow.
    Avoid huge ifs.


svn path=/trunk/; revision=481
2008-08-24 11:01:44 +00:00
Johan Dahlin
78f4434ef6 Remove left-over code, checking type of function.
2008-08-24  Johan Dahlin  <johan@gnome.org>

    * girepository/girparser.c (start_function):
    Remove left-over code, checking type of function.


svn path=/trunk/; revision=480
2008-08-24 10:43:02 +00:00
Colin Walters
4c2a09226b Remove duplicate start_boxed.
svn path=/trunk/; revision=474
2008-08-23 21:29:58 +00:00
Colin Walters
20b10e4542 Add debug print, fix includes
svn path=/trunk/; revision=470
2008-08-23 16:36:15 +00:00
Colin Walters
ca6a30f98a Ignore <include>. Parse them. Generate them. Process <include>
2008-08-22  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c: Ignore <include>.
	* giscanner/girparser.py: Parse them.
	* giscanner/girwriter.py: Generate them.
	* giscanner/transformer.py: Process <include>
	recursively.  Don't require full path for
	includes, look in {$XDG_DATA_DIRS}/gir.
	* tools/g-ir-scanner: Pass through includes.
	* Makefile.am: Remove extra --include
	args for scanner.
	* *-expected.gir: Add expected includes.

svn path=/trunk/; revision=467
2008-08-23 16:11:01 +00:00
Colin Walters
e4c8517aac Pass through recursive types. Avoid overwriting errors. Always write the
2008-08-22  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c: Pass through
	recursive types.  Avoid overwriting errors.
	* giscanner/xmlwriter.py: Always write the
	XML header.
	* tests/*.gir: Adjust.
	* tests/scanner/Makefile.am: Build typelibs,
	and generate XML from those.  Once we
	have a good diff mechanism...
	* tests/scanner/*-expected.gir: Add XML
	header.
	* tools/g-ir-scanner: Accept --typelib-xml
	option.
	* tools/generate.c: Better defaults for transfer.

svn path=/trunk/; revision=457
2008-08-22 20:05:23 +00:00
Johan Dahlin
9152ea35ab Remove compilation warnings
2008-08-21  Johan Dahlin  <johan@gnome.org>

    * girepository/girparser.c (resolve_aliases):
    Remove compilation warnings


svn path=/trunk/; revision=431
2008-08-21 08:20:07 +00:00
Colin Walters
4de606f07d And parse them.
2008-08-20  Colin Walters  <walters@verbum.org>

	* girepository/girparser.py: And parse them.

svn path=/trunk/; revision=425
2008-08-20 19:57:10 +00:00
Colin Walters
e47f68925e Avoid alias infloops.
2008-08-20  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c: Avoid alias infloops.

svn path=/trunk/; revision=420
2008-08-20 19:01:20 +00:00
Colin Walters
abcebee79f Union field parsing
2008-08-20  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c: Parse union fields.

svn path=/trunk/; revision=416
2008-08-20 15:05:46 +00:00
Johan Dahlin
bf5761db23 make it compile again...
svn path=/trunk/; revision=388
2008-08-16 21:57:59 +00:00
Johan Dahlin
5241ccb843 Reorder
svn path=/trunk/; revision=387
2008-08-16 21:55:06 +00:00
Johan Dahlin
27314af58e Clear up constant parsing
2008-08-14  Johan Dahlin  <johan@gnome.org>

    * girepository/girparser.c (start_field), (start_constant),
    (start_type), (end_element_handler):
    Clear up constant parsing

    * tests/object.gir:
    Update

    * tools/generate.c (write_callable_info), (write_function_info),
    (write_callback_info), (write_constant_info), (write_signal_info),
    (write_vfunc_info), (write_property_info), (write_object_info),
    (write_interface_info):
    Constants/Signals are handled now.


svn path=/trunk/; revision=377
2008-08-14 19:32:26 +00:00
Johan Dahlin
698bcf0af5 Don't require c:type. Test boxed.gir Update, remove parts we don't support
2008-08-14  Johan Dahlin  <johan@gnome.org>

    * girepository/girparser.c (start_type):
    Don't require c:type.
    * tests/Makefile.am:
    Test boxed.gir
    * tests/boxed.gir:
    Update, remove parts we don't support yet
    * tests/roundtrips.sh:
    Remove
    * tools/generate.c (write_type_info), (write_field_info),
    (write_callable_info), (write_struct_info):
    Make it emit proper gir.


svn path=/trunk/; revision=376
2008-08-14 19:07:34 +00:00
Colin Walters
c368516ae4 Comment data structures. Also squash pointers in resolve_type_name to
2008-08-14  Colin Walters  <walters@verbum.org>

	* giscanner/transformer.py: Comment data structures.
	Also squash pointers in resolve_type_name to correspond
	with what we do for params.
	* giscanner/glibtransformer.py: Print warnings in more
	situations.  Rework checks for method/constructor to
	look up in our GType database instead of just checking
	for *.   Avoid generating <record> for GObject which
	duplicate the <class>.
	* gir/Makefile.am: Generate glib-2.0.gir and gobject-2.0.gir
	in here.


svn path=/trunk/; revision=373
2008-08-14 16:09:06 +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
8c6c262f22 Handle 'any'. Add test for void *.
2008-08-12  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c: Handle 'any'.
	* tests/scanner/Foo-expected.gir, tests/scanner/foo-object.h:
	Add test for void *.


svn path=/trunk/; revision=351
2008-08-12 18:49:16 +00:00