summaryrefslogtreecommitdiff
path: root/girepository/girmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Add directory index sectionwip/cmph-rebase3Colin Walters2010-12-021-2/+93
| | | | | | | | | | Use the internal perfect hashing API to add an index to the directory. To support this, add the notion of additional "sections" to the typelib. A section index is inserted between the header and the directory. https://bugzilla.gnome.org/show_bug.cgi?id=554943
* girepository: Consistently prefix internal functions with _Colin Walters2010-11-161-29/+29
| | | | | This should better avoid them being exported. Rename girepository-parser.la to girepository-internals.la for clarity.
* [GIRepository] Rename GTypelib to GITypelibJohan Dahlin2010-08-311-2/+2
| | | | | Keep a typedef for backwards compatibility, until the major bindings has moved over.
* Major rewriteColin Walters2010-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the first big changes in this rewrite is changing the Type object to have separate target_fundamental and target_giname properties, rather than just being strings. Previously in the scanner, it was awful because we used heuristics around strings. The ast.py is refactored so that not everything is a Node - that was a rather useless abstraction. Now, only things which can have a GIName are Node. E.g. Type and Field are no longer Node. More things were merged from glibast.py into ast.py, since it isn't a very useful split. transformer.py gains more intelligence and will e.g. turn GLib.List into a List() object earlier. The namespace processing is a lot cleaner now; since we parse the included .girs, we know the C prefix for each namespace, and have functions to parse both C type names (GtkFooBar) and symbols gtk_foo_bar into their symbols cleanly. Type resolution is much, much saner because we know Type(target_giname=Gtk.Foo) maps to the namespace Gtk. glibtransformer.py now just handles the XML processing from the dump, and a few miscellaneous things. The major heavy lifting now lives in primarytransformer.py, which is a combination of most of annotationparser.py and half of glibtransformer.py. annotationparser.py now literally just parses annotations; it's no longer in the business of e.g. guessing transfer too. finaltransformer.py is a new file which does post-analysis for "introspectability" mainly. girparser.c is fixed for some introspectable=0 processing.
* [gircompiler] Clean up parsingColin Walters2010-08-171-9/+27
| | | | | | | | | | | | | | We never actually include multiple modules in the compiler, so just nuke that. Also rather than passing around GIrModule consistently pass around a GIrTypelibBuild structure which has various things. This lets us maintain a stack there which we can walk for better error messages. Also, fix up the node lookup in giroffsets.c; previously it didn't really handle includes correctly. We really need to switch to always using Foo.Bar (i.e. GIName) names internally...
* [girepository] Actually verify header of loaded typelibs in ↵Colin Walters2010-07-141-1/+7
| | | | | | | | 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.
* Bump shared library version, typelib versionColin Walters2010-07-091-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=623774
* Attribute bug-fixesDavid Zeuthen2010-06-241-11/+20
| | | | | | | | | | | | | | | | | | Rectify an assumption that nodes are ordered according to offset - since this assumption was not true, attributes ended up being not ordered either and the bsearch() when looking up attributes failed mysteriously. Instead of making such assumptions, simply sort the list of nodes we want to extract attributes from. The total attribute size computation was wrong as we didn't properly descend into subnodes. This resulted in memory access violations when writing the typelib (because not enough data was allocated). Instead of having a separate function for this, just include the attribute size in the existing function. See https://bugzilla.gnome.org/show_bug.cgi?id=571548 Signed-off-by: David Zeuthen <davidz@redhat.com>
* [girepository] Use g_sliceJohan Dahlin2010-05-201-2/+2
| | | | | | Use g_slice to allocate instead of g_new(x, 1); It uses a memory pool internally and should be faster, especially for GBaseInfo/GRealInfo, structs which are tiny.
* [girepository] Remove trailing whitespaceJohan Dahlin2010-03-241-15/+15
|
* [g-ir-compiler] Slightly less lame error messagesColin Walters2010-02-111-0/+34
| | | | | | To make things really better we should track the line origin of element from the .gir file (and actually we need to do better checking in the scanner), but this is slightly less lame.
* Bug 564016 - Include c:prefix in typelib, use it to optimize find_by_gtypeColin Walters2009-03-171-4/+15
| | | | | | | 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 571548 - Generic attributesColin Walters2009-03-031-4/+84
| | | | | | | | 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 a parent parmeter to g_ir_node_build_typelibColin Walters2009-02-271-1/+1
| | | | This will be useful for later changes which need to inspect the parent.
* typelib building: Compress 5 arguments for g_ir_node_build_typelibColin Walters2009-02-201-2/+7
| | | | | This makes it easier to add more over time without changing lots of unrelated code.
* Bug 571373 - Consistently use sizeof () inside gtypelib and girmoduleColin Walters2009-02-181-17/+17
| | | | | This not only makes it easier to change these structures, it becomes clearer exactly what each magic number is just for reference.
* Bug 551738 - Associate classes with their structsColin Walters2009-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 559705 – Missing association between static methods and classesColin Walters2008-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 2008-11-25 Colin Walters <walters@verbum.org> Bug 559705 – Missing association between static methods and classes * docs/typelib-format.txt: * girepository/ginfo.c (g_function_info_get_flags): * girepository/girmodule.c (g_ir_module_build_typelib): * girepository/girnode.c (g_ir_node_get_size), (g_ir_node_build_typelib): * girepository/girparser.c (start_function): * girepository/gtypelib.c (g_typelib_check_sanity), (validate_header), (validate_function_blob): * girepository/gtypelib.h: * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibtransformer.py: * tests/scanner/foo-1.0-expected.gir: * tests/scanner/foo-1.0-expected.tgir: * tests/scanner/foo.h: svn path=/trunk/; revision=972
* Bug 560825 – Add size and alignment to typelibOwen Taylor2008-11-161-2/+2
| | | | | | | | | | | | | | | | Include the size and alignment of structures and unions in the typelib, and add getter methods to retrieve them from GIStructInfo/GIUnionInfo. * docs/typelib-format.txt girepository/gtypelib.h girepository/girnode.c girepository/girmodule.c girepository/gtypelib.c: Add size and alignment to StructBlob and UnionBlob. * girepository/ginfo.c girepository/girepository.h: Add g_[struct|union]_get[size|alignment](). * test/offsets/gen-gitestoffsets: Test overall structure size and alignment. svn path=/trunk/; revision=930
* Keep aliases and disguised_structures local to each module (#560419)Owen Taylor2008-11-121-2/+42
| | | | | | | | | | | | | When parsing, keep keep a separate hash tables of aliases and 'disguised' flags for each module, and store that on the module. After parsing an include merge the aliases/disguised flags to the including module. Remove 'prefix_aliases' flag and always prefix aliases/disguised structure types when parsing; this simplifies the code considerably. svn path=/trunk/; revision=904
* Bug 560250 - Fully parse included modulesOwen Taylor2008-11-111-0/+4
| | | | | | | | | | | For some things, like computing structure offsets to put into the typelib we need more than just the aliases from included modules. Do a completel parse of included modules and store in module->included_modules. Also add g_ir_find_node() to find node information from within the active set of modules and their includes. svn path=/trunk/; revision=874
* Export two private methods to avoid an compiler warningJohan Dahlin2008-10-241-3/+0
| | | | svn path=/trunk/; revision=810
* fix some build warnings.Lucas Rocha2008-10-221-1/+1
| | | | | | | | | 2008-10-22 Lucas Rocha <lucasr@gnome.org> * girepository/girmodule.c, girepository/gtypelib.c, girepository/girparser.[ch]: fix some build warnings. svn path=/trunk/; revision=783
* Bug 556543 – reduce compiler warningsTommi Komulainen2008-10-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 552858: versioningColin Walters2008-10-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Put dependencies in typelibs, resolve them when loadingColin Walters2008-08-301-3/+37
| | | | | | | | | | | | | | | | | | | * 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
* Revert change to increment header_size; we do that in write_string.Colin Walters2008-08-211-5/+1
| | | | | | | | | | 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
* Tweak to use UINT instead of INT. Not likely to matter. Add toColin Walters2008-08-211-2/+6
| | | | | | | | | | | | | | | | | 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
* Calculate size correctly, avoid use-after-free.Colin Walters2008-08-211-5/+14
| | | | | | | | | 2008-08-20 Colin Walters <walters@verbum.org> * girepository/girmodule.c (g_ir_module_build_typelib): Calculate size correctly, avoid use-after-free. svn path=/trunk/; revision=427
* Rename metadata to typelib in variable names, comments and apis.Johan Dahlin2008-08-091-6/+6
| | | | | | | | | | | 2008-08-09 Johan Dahlin <johan@gnome.org> * *.[ch]: Rename metadata to typelib in variable names, comments and apis. svn path=/trunk/; revision=339
* Move shared *.[ch] files to girepository from toolsJohan Dahlin2008-08-091-0/+215
2008-08-09 Johan Dahlin <johan@gnome.org> * girepository/Makefile.am: * tools/Makefile.am: * tools/girmodule.c: * tools/girmodule.h: * tools/girnode.c: * tools/girnode.h: * tools/girparser.c: * tools/girparser.h: * tools/girwriter.c: * tools/girwriter.h: Move shared *.[ch] files to girepository from tools svn path=/trunk/; revision=337