Commit Graph

108 Commits

Author SHA1 Message Date
Colin Walters
5cfc7580a3 Add tests/repository which has some repository regression tests
svn path=/trunk/; revision=683
2008-10-12 16:36:29 +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
Johan Bilien
1b2aa59534 ignore non-UTF-8 string constants
2008-10-11  Johan Bilien  <jobi@litl.com>

	* giscanner/scannerparser.y: ignore non-UTF-8 string constants

2008-10-11  Johan Bilien  <jobi@litl.com>

	Bug 552347: Parse #defines constants

	* girepository/gtypelib.c: update the list of value_size
	with recently defined type tags
	* giscanner/scannerparser.y: brought back parsing of #defined, as
	present in older version
	* giscanner/giscannermodule.c: bind gi_source_scanner_append_filename
	* giscanner/girwriter.py: write out constant tags in the gir
	* giscanner/sourcescanner.py: add accessor for const_string
	* giscanner/transformer.py, giscanner/glibtransformer.py: handle
	constant

svn path=/trunk/; revision=673
2008-10-11 23:19:59 +00:00
Lucas Rocha
a0d5227db5 fix regression on invoke test case by making sure we load the global
2008-10-09  Lucas Rocha  <lucasr@gnome.org>

	* girepository/girepository.c (register_internal): fix regression on
	invoke test case by making sure we load the global module in the
	typelib when dealing with inline typelibs.
	* girepository/gtypelib.c: a couple of coding style fixes.

svn path=/trunk/; revision=661
2008-10-09 16:44:11 +00:00
Lucas Rocha
728beb0424 Bug 555294: Add support for multiple shared libraries per typelib.
2008-10-06  Lucas Rocha  <lucasr@gnome.org>

	Bug 555294: Add support for multiple shared libraries per typelib.

	* girepository/ginvoke.c (g_function_info_invoke),
	girepository/ginfo.c(g_registered_type_info_get_g_type): use
	g_typelib_symbol instead of g_module_symbol.
	* girepository/girepository.h: remove g_typelib_set_module and add
	g_typelib_symbol.
	* girepository/gtypelib.[ch] (find_some_symbol, _g_typelib_init,
	g_typelib_new_from_memory, g_typelib_new_from_const_memory,
	g_typelib_free, g_typelib_symbol): chnage GTypeLib to hold a list of
	modules instead of just one. The symbol lookup is now abstracted
	behind g_typelib_symbol which tries to find the passed symbol name in
	one of its modules.
	* giscanner/girwriter.py, tools/g-ir-scanner: change scanner to read
	and write shared_library attribute as a comma-separated list of libs.

svn path=/trunk/; revision=660
2008-10-07 21:25:01 +00:00
Colin Walters
ea99326529 Merge branch 'bug551744-boxed-ctors'
svn path=/trunk/; revision=654
2008-10-03 19:30:12 +00:00
Colin Walters
aceef77051 Use g_alloca, suggested by Havoc Pennington
svn path=/trunk/; revision=649
2008-10-02 21:24:24 +00:00
Colin Walters
ec679636ef Merge branch 'bug552961-methods/wip'
svn path=/trunk/; revision=647
2008-10-02 21:24:20 +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
bfb6271201 Strengthen check for interface vs basic types
Previously we were just checking "reserved", but to be more correct
we should check whether reserved2 is zero as well because it is
possible for offsets to have reserved = 0 but reserved2 != 0.

svn path=/trunk/; revision=620
2008-09-19 23:43:38 +00:00
Colin Walters
c760a31723 Validate the "this" argument for methods
svn path=/trunk/; revision=615
2008-09-19 14:55:20 +00:00
Colin Walters
4e4c8c137d Bug 522384: Use SHLIB_SUFFIX intead of G_MODULE_SUFFIX for Darwin
On Darwin, the suffix for installed shared libraries (.dylib) is
different from loadable modules (.so).  We use a bit of magic shell
script from Behdad Esfahbod to figure out the right suffix.

svn path=/trunk/; revision=612
2008-09-19 02:24:05 +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
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
dcd4fe622a Add back unresolved
svn path=/trunk/; revision=545
2008-08-30 20:31:16 +00:00
Colin Walters
5a14ec555c Fix conflict
svn path=/trunk/; revision=544
2008-08-30 20:31:14 +00:00
Colin Walters
74651b01bd Remove g_irepository_unregister, add GIRepositoryLoadFlags
svn path=/trunk/; revision=543
2008-08-30 20:31:12 +00:00
Colin Walters
e6a68106a2 Don't lose on NULL shlib
svn path=/trunk/; revision=542
2008-08-30 20:31:10 +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
2ee1470611 Add some assertions, blacklist a few more methods
* girepository/ginfo.c: Add some assertions regarding
	refcounts, just to be sure.
	* giscanner/glibtransformer.py: Blacklist a few more
	odd Gio methods.

svn path=/trunk/; revision=537
2008-08-30 02:31:53 +00:00
Colin Walters
ce86b80390 Don't crash if no shlib is embedded
* girepository/gtypelib.c: Don't crash if no
	shlib is embedded

svn path=/trunk/; revision=533
2008-08-29 20:42:51 +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
295fc99a40 More context information in validate
* girepository/gtypelib.c: Add more context
	during validate.

svn path=/trunk/; revision=525
2008-08-29 18:49:22 +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
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
Tor Lillqvist
0969efd5a5 Change type of bitfield fields from guint to the most suitable smaller
2008-08-28  Tor Lillqvist  <tml@novell.com>

	* girepository/gtypelib.h: Change type of bitfield fields from
	guint to the most suitable smaller type. This makes the struct
	sizes match the ones on Linux that the sanity check expects when
	using gcc -mms-bitfields on Windows.


svn path=/trunk/; revision=508
2008-08-28 10:24:35 +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
c9951bd099 Search $DATADIR/girepository instead of $DATADIR/gitypelibs; this naming
2008-08-26  Colin Walters  <walters@verbum.org>

	* girepository/girepository.c: Search
	$DATADIR/girepository instead of
	$DATADIR/gitypelibs; this naming makes
	it clearer that e.g. jgir can install
	.jars there.
	* gir/Makefile.am: Install there.

svn path=/trunk/; revision=502
2008-08-26 21:55:42 +00:00
Colin Walters
7805ca101f Also use G_MODULE_SUFFIX instead of hardcoding .so.
2008-08-26  Colin Walters  <walters@verbum.org>

	* girepository/gtypelib.c (_g_typelib_init): Also
	use G_MODULE_SUFFIX instead of hardcoding .so.

svn path=/trunk/; revision=501
2008-08-26 21:05:32 +00:00
Colin Walters
d6139fcb45 Free string in the right place.
2008-08-26  Colin Walters  <walters@verbum.org>

	* girepository/gtypelib.c (_g_typelib_init): Free
	string in the right place.

svn path=/trunk/; revision=500
2008-08-26 21:01:36 +00:00
Colin Walters
7f30a2502c Fix small memory leak
svn path=/trunk/; revision=499
2008-08-26 20:06:42 +00:00
Colin Walters
00fb846ad8 Handle both .la and .so names; this works better in the uninstalled
2008-08-26  Colin Walters  <walters@verbum.org>

	* girepository/gtypelib.c (_g_typelib_init): Handle
	both .la and .so names; this works better in the
	uninstalled library case.

svn path=/trunk/; revision=498
2008-08-26 20:04:38 +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
Colin Walters
92b476b8c1 Don't open shared library here; we already do it in gtypelib.c.
2008-08-24  Colin Walters  <walters@verbum.org>

	* girepository/girepository.c (g_irepository_require):
	Don't open shared library here; we already do it
	in gtypelib.c.

svn path=/trunk/; revision=483
2008-08-24 16:55:07 +00:00
Colin Walters
1ebc6cfb7a Add context stack so when we get an error we can print out nicely where it
2008-08-24  Colin Walters  <walters@verbum.org>

	* girepository/gtypelib.c: Add context stack so
	when we get an error we can print out nicely
	where it is.

svn path=/trunk/; revision=482
2008-08-24 16:51:43 +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