Inside glibtransformer, we now look at structures ending in "Class" and
see if they have an associated GlibObject (i.e. a structure of the same
name without the "Class" suffix). If found, pair them up.
The .gir file for <class> gains an attribute denoting its associated
class struct. Any <record> many now have a glib:is-class-struct-for
annotation which tells which (if any) <class> for which it defines the
layout.
In the .typelib, we record the association between the class and
its structure. Generic structures however just have a boolean
saying whether they're a class struct. (Going from a generic class
struct to its class should not be necessary).
Finally, we expose GIRepository APIs to access both bits of information
from the .typelib.
svn path=/trunk/; revision=1088
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
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-10-17 Tommi Komulainen <tommi.komulainen@iki.fi>
Bug 556732 – generate gir files consistently
* tools/generate.c (write_callable_info): write 'direction'
attribute only if other than 'in' to be consistent with
girwriter.py
* tests/boxed.gir:
* tests/object.gir: remove direction="in" which is the default
svn path=/trunk/; revision=744
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-15 Tommi Komulainen <tommi.komulainen@iki.fi>
* tools/generate.c (xml_printf): quote printf arguments so that
we don't generate invalid XML by writing unescaped double quotes
and such in attributes
svn path=/trunk/; revision=715
2008-10-12 Tommi Komulainen <tommi.komulainen@iki.fi>
* tools/generate.c (write_callable_info): move "transfer" and
"null-ok" attributes from <function> to <return-value> element
svn path=/trunk/; revision=691
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
* 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
* 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-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-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 Colin Walters <walters@verbum.org>
* gobject-introspection-1.0.pc.in: Add g-ir-generate.
* tests/Makefile.am: Support $(DEBUG)
* tools/generate.c: Do immediate close tags if no
sub-elements.
svn path=/trunk/; revision=448