summaryrefslogtreecommitdiff
path: root/tools/generate.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a --version option to g-ir-compiler and g-ir-generate. Fixes #55Christoph Reiter2018-12-191-0/+9
|
* build: enable -WshadowChristoph Reiter2018-07-291-1/+1
|
* g-ir-generate: fix missing error handling for command line parsingChristoph Reiter2018-07-291-1/+6
| | | | The error arg was used but the result never checked.
* g-ir-{compiler,generate,inspect}: Call setlocale in main functionTing-Wei Lan2017-05-051-0/+4
| | | | | | It is required to correctly show translated messages on some locales. https://bugzilla.gnome.org/show_bug.cgi?id=760419
* Drop calls to g_type_init()Colin Walters2012-10-161-2/+0
| | | | And bump our GLib requirement.
* Add Emacs mode lines to C sourcesColin Walters2012-02-031-3/+2
|
* [GIRepository] Rename GTypelib to GITypelibJohan Dahlin2010-08-311-1/+1
| | | | | Keep a typedef for backwards compatibility, until the major bindings has moved over.
* Fix two compilation warningsColin Walters2010-07-191-1/+0
|
* [girepository] Actually verify header of loaded typelibs in ↵Colin Walters2010-07-141-83/+13
| | | | | | | | g_irepository_require Take a GError * for typelib loading code, validate the header. This fixes bizarre errors from gjs where g_irepository_require would happily load old typelibs.
* [girwriter] Refactor out of generate.cJohan Dahlin2010-06-071-1364/+5
| | | | | Move out the girwriter out of generate.c. Still a private API, but that will probably change in the future.
* [generate] Get rid of globalsJohan Dahlin2010-06-071-19/+20
| | | | | Get rid of all globals in gir generator, in preparation for moving all code into libgirepository
* [gtypelib.ch] Rename to gitypelib.chJohan Dahlin2010-05-311-1/+1
| | | | | Rename gtypelib.h -> gitypelib-internal.h and rename gtypelib.c to gitypelib.c
* [g-ir-generate] Write out array typeJohan Dahlin2010-05-271-0/+20
| | | | For GLib arrays, write out the array type to the tgir
* Support (out caller-allocates)Colin Walters2010-05-261-4/+2
| | | | | | | | | | | | | | | | | | | | | People have wanted support for marking (out) on functions of the form: /** * clutter_color_from_pixel: * @pixel: A pixel * @color: (out): Color to initialize with value of @pixel */ void clutter_color_from_pixel (guint32 pixel, ClutterColor *color); Where the caller is supposed to have allocated the argument; the C function just initializes it. This patch adds support for this argument passing style to introspection. In this case, we see the (out), and notice that there's only a single indirection (*) on the argument, and assume that this means (out caller-allocates). https://bugzilla.gnome.org/show_bug.cgi?id=604749
* Add support for foreign structsJohan Dahlin2010-03-251-0/+5
| | | | | | | | Foreign structs are special in the sense that there might be native bindings (for instance PyCairo for PyGI) that provides the same functionallity as the introspected variant. https://bugzilla.gnome.org/show_bug.cgi?id=610357
* Remove trailing whitespaceJohan Dahlin2010-03-251-89/+90
|
* Implement callbacks as part of struct fields. Fixes #557383Tomeu Vizoso2009-11-111-2/+16
| | | | | | gir: embed <callback> inside <field> typelib: if a field contains a callback, store it just after the FieldBlob girepository API: no additions
* Bug 576605 - Get rid of GI_SCOPE_TYPE_OBJECTAndreas Rottmann2009-03-271-3/+0
| | | | Remove support for (scope object) as it lacks a real use case.
* Bug 564016 - Include c:prefix in typelib, use it to optimize find_by_gtypeColin Walters2009-03-171-0/+4
| | | | | | | Parse the c:prefix from the .gir, include it in the header. Armed with this information, we can now optimize lookups of GTypes because we have the requirement that GTypes must start with the c:prefix. We do fall back though if a lookup fails.
* Bug 557383 - Virtual method supportColin Walters2009-03-051-2/+7
| | | | | | | | | | | | | | | | Broadly speaking, this change adds the concept of <vfunc> to the .gir. The typelib already had most of the infrastructure for virtual functions, though there is one API addition. The scanner assumes that any class callback slot that doesn't match a signal name is a virtual. In the .gir, we write out *both* the <method> wrapper and a <vfunc>. If we can determine an association between them (based on the names matching, or a new Virtual: annotation), then we notate that in the .gir. The typelib gains an association from the vfunc to the function, if it exists. This will be useful for bindings since they already know how to consume FunctionInfo.
* Bug 571548 - Generic attributesColin Walters2009-03-031-4/+38
| | | | | | | | We now support an extensible mechanism where arbitrary key-value pairs may be associated with almost all items, including objects, methods, and properties. These attributes appear in both the .gir and the .typelib.
* Add --all option to g-ir-generateAndreas Rottmann2009-02-271-1/+18
| | | | | | | | | Add --all option, which is intended to show some information not usually included in the GIR. Currently, it shows the size of structs and unions. Signed-off-by: Andreas Rottmann <a.rottmann@gmx.at>
* Bug 572434 - Associate interfaces with their C structuresColin Walters2009-02-251-5/+13
| | | | | | | | Similar to GObject class structs, we pair up GInterfaces with their C structures. Also, move some GLib-specific things into glibast.py, and make the naming more generic.
* Bug 551738 - Associate classes with their structsColin Walters2009-02-061-0/+13
| | | | | | | | | | | | | | | | | | | | | 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
* Bug 556489 – callback annotationsAndreas Rottmann2009-01-031-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Also generate new syntaxColin Walters2008-11-171-8/+3
| | | | svn path=/trunk/; revision=933
* Remove field offsets from g-ir-generate output and test inputsOwen Taylor2008-11-111-2/+0
| | | | | | | | | | | 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
* Bug 557786 - support fixed size arraysColin Walters2008-10-251-4/+7
| | | | svn path=/trunk/; revision=814
* Bug 556739 – transfer-ownership attribute should be mandatory in .girTommi Komulainen2008-10-231-14/+13
| | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 557379 – g-ir-generate not writing the 'abstract' attributeTommi Komulainen2008-10-221-0/+5
| | | | | | | | | | | | 2008-10-22 Tommi Komulainen <tommi.komulainen@iki.fi> * tests/scanner/drawable-1.0-expected.tgir: * tests/scanner/drawable-injected-1.0-expected.tgir: * tests/scanner/foo-1.0-expected.tgir: * tools/generate.c (write_object_info): write 'abstract' attribute for classes svn path=/trunk/; revision=785
* Bug 557405 – Use 'allow-none' consistentlyTommi Komulainen2008-10-221-2/+2
| | | | | | | | | | | | | | | | | | 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
* Write out throws attributeColin Walters2008-10-211-0/+5
| | | | svn path=/trunk/; revision=776
* Bug 556732 – generate gir files consistentlyTommi Komulainen2008-10-171-2/+2
| | | | | | | | | | | | | | | 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
* Bug 556732 – generate gir files consistentlyTommi Komulainen2008-10-171-5/+2
| | | | | | | | | | | | | | 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
* Bug 556732 – generate gir files consistentlyTommi Komulainen2008-10-171-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 556732 – generate gir files consistentlyTommi Komulainen2008-10-171-7/+3
| | | | | | | | | | | | | | | 2008-10-17 Tommi Komulainen <tommi.komulainen@iki.fi> Bug 556732 – generate gir files consistently * giscanner/girwriter.py (_write_property): write properties 'construct' attribute if set * tools/generate.c (write_property_info): write properties 'readable' and 'writable' attributes only if non-default * tests/object.gir: add writable="0" * tests/scanner/foo-1.0-expected.gir: add construct="1" svn path=/trunk/; revision=742
* Bug 556543 – reduce compiler warningsTommi Komulainen2008-10-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix up g-ir-generate for new include= syntaxColin Walters2008-10-161-1/+3
| | | | svn path=/trunk/; revision=726
* reduce code duplicationTommi Komulainen2008-10-151-16/+18
| | | | | | | | | | | 2008-10-15 Tommi Komulainen <tommi.komulainen@iki.fi> * tools/generate.c (write_type_name, write_type_info, write_type_info, write_object_info, write_object_info, write_interface_info, write_error_domain_info): reduce code duplication svn path=/trunk/; revision=718
* Bug 556174 – parse types for lists etc.Tommi Komulainen2008-10-151-64/+41
| | | | | | | | | | | | | | 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
* quote printf arguments so that we don't generate invalid XML by writingTommi Komulainen2008-10-151-1/+4
| | | | | | | | | | 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
* remove unused indent parameters, xmlwriter keeps track of necessaryTommi Komulainen2008-10-151-21/+17
| | | | | | | | | | | | | 2008-10-15 Tommi Komulainen <tommi.komulainen@iki.fi> * tools/generate.c (write_field_info, write_callable_info, write_function_info, write_callback_info, write_struct_info, write_constant_value, write_signal_info, write_vfunc_info, write_object_info, write_interface_info, write_union_info, write_repository): remove unused indent parameters, xmlwriter keeps track of necessary indentation svn path=/trunk/; revision=714
* Keep track of generated XML tree and handle indentation and closing tagsTommi Komulainen2008-10-151-94/+179
| | | | | | | | | | | | | | | | | | 2008-10-15 Tommi Komulainen <tommi.komulainen@iki.fi> * tools/generate.c (xml_element_new, xml_element_free, xml_start_element, xml_end_element, xml_end_element_unchecked, xml_open, xml_close): Keep track of generated XML tree and handle indentation and closing tags properly. (write_field_info, write_callable_info, write_function_info, write_callback_info, write_struct_info, write_value_info, write_constant_info, write_enum_info, write_signal_info, write_vfunc_info, write_property_info, write_object_info, write_interface_info, write_error_domain_info, write_union_info, write_repository): Use xml_start_element and xml_end_element to open/close tags. svn path=/trunk/; revision=713
* wrap all FILE access to go through simple xmlwriterTommi Komulainen2008-10-151-212/+259
| | | | | | | | | | | | | | | 2008-10-15 Tommi Komulainen <tommi.komulainen@iki.fi> * tools/generate.c (xml_printf, xml_open, xml_close, xml_free): (write_type_name, write_type_info, write_field_info, write_callable_info, write_function_info, write_callback_info, write_struct_info, write_value_info, write_constant_value, write_constant_info, write_enum_info, write_signal_info, write_vfunc_info, write_property_info, write_object_info, write_interface_info, write_error_domain_info, write_union_info, write_repository): wrap all FILE access to go through simple xmlwriter svn path=/trunk/; revision=712
* use "transfer-ownership" attribute for return valuesTommi Komulainen2008-10-121-2/+2
| | | | | | | | | 2008-10-12 Tommi Komulainen <tommi.komulainen@iki.fi> * tools/generate.c (write_callable_info): use "transfer-ownership" attribute for return values svn path=/trunk/; revision=692
* move "transfer" and "null-ok" attributes from <function> to <return-value>Tommi Komulainen2008-10-121-4/+6
| | | | | | | | | 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
* use "container" for container/shallow ownership transfer (not "shallow")Tommi Komulainen2008-10-121-2/+2
| | | | | | | | | | 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
* Bug 552858: versioningColin Walters2008-10-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 554632: Create type tag for GTypeColin Walters2008-10-021-26/+2
| | | | svn path=/trunk/; revision=641
* Use symbolic names for type tags instead of hardcoded integersColin Walters2008-09-231-8/+11
| | | | svn path=/trunk/; revision=626