Commit Graph

193 Commits

Author SHA1 Message Date
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
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
88f221c38e Check constructor returns
svn path=/trunk/; revision=477
2008-08-23 21:30:09 +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
5daf51a580 Redo signature_offset to be cleaner and correct for vfuncs
svn path=/trunk/; revision=475
2008-08-23 21:30:01 +00:00
Colin Walters
4c2a09226b Remove duplicate start_boxed.
svn path=/trunk/; revision=474
2008-08-23 21:29:58 +00:00
Colin Walters
6d34368cac Another debug print
svn path=/trunk/; revision=471
2008-08-23 16:46: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
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
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
bfb52af903 Plug memory leak and avoid using freed memory. Resolve the whole module
2008-08-21  Johan Dahlin  <johan@gnome.org>

    * girepository/girepository.c (g_irepository_require):
    Plug memory leak and avoid using freed memory.
    Resolve the whole module path, here as well.


svn path=/trunk/; revision=441
2008-08-21 16:38:03 +00:00
Colin Walters
c66c06f048 Revert change to increment header_size; we do that in write_string.
2008-08-21  Colin Walters  <walters@verbum.org>

	* girepository/girmodule.c (g_ir_module_build_typelib):
	Revert change to increment header_size; we do that in
	write_string.

svn path=/trunk/; revision=440
2008-08-21 16:25:42 +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
a47d659cd1 Use g_module_build_path to resolve the shlib name
2008-08-21  Johan Dahlin  <johan@gnome.org>

    * girepository/gtypelib.c (_g_typelib_init):
    Use g_module_build_path to resolve the shlib name


svn path=/trunk/; revision=437
2008-08-21 14:21:00 +00:00
Colin Walters
3011ce4539 Fix one small leak in error case.
2008-08-21  Colin Walters  <walters@verbum.org>

	* girepository/girparser.c (g_irepository_require):
	Fix one small leak in error case.

svn path=/trunk/; revision=434
2008-08-21 13:26:53 +00:00