summaryrefslogtreecommitdiff
path: root/girepository/girparser.c
Commit message (Collapse)AuthorAgeFilesLines
* girepository: Consistently prefix internal functions with _Colin Walters2010-11-161-48/+48
| | | | | This should better avoid them being exported. Rename girepository-parser.la to girepository-internals.la for clarity.
* Add support for gunichar in typelibColin Walters2010-11-121-1/+2
| | | | | | | Some API such as gtk_text_iter_get_char returns an individual "gunichar"; we should support this. https://bugzilla.gnome.org/show_bug.cgi?id=633197
* Handle enumerations with the full range of signed and unsigned valuesOwen W. Taylor2010-11-011-5/+5
| | | | | | | | | | | | | The C compiler will pick an enumeration type that accomodates the specified values for the enumeration, so ignoring 64-bit enumerations, we can have enumeration values from MININT32 to MAXUINT32. To handle this properly: - Use gint64 for holding eumeration values when scanning - Add a 'unsigned_value' bit to ValueBlob so we can distinguish the int32 vs. uint32 cases in the typelib - Change the return value of g_value_info_get_value() to gint64. https://bugzilla.gnome.org/show_bug.cgi?id=629704
* Actually do something about fundamentals when parsing a .girTomeu Vizoso2010-09-291-0/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=630710
* typelib compiler: Passthrough <doc> at any pointColin Walters2010-09-141-1/+1
| | | | This should have been in the previous commit.
* [VFuncBlob] Unknown struct offset should be 0xFFFFSteve Frécinaux2010-09-061-1/+1
| | | | | | | | | | | | Documentation says about g_vfunc_get_offset(): "Obtain the offset of the function pointer in the class struct. The value 0xFFFF indicates that the struct offset is unknown." But g-ir-compiler did set the value to 0 when the offset is unknown. This patch fixes it. https://bugzilla.gnome.org/show_bug.cgi?id=628270
* scanner: Fix previous rename-to handling commitColin Walters2010-09-031-1/+1
|
* scanner: Fix rename-to handlingColin Walters2010-09-031-0/+5
| | | | | We were writing the attributes backwards. Also actually use the attribute in the typelib generation.
* Major rewriteColin Walters2010-08-311-38/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use GLib types consistentlyColin Walters2010-08-311-29/+29
| | | | | | | | | Rather than have the scanner/parser handle both e.g. "glong" and "long", simply use the GLib types everywhere. This commit adds TYPE_LONG_LONG and TYPE_LONG_DOUBLE to the scanner types; however, rather than add them to the typelib, they're just marked as not-introspectable.
* Move alias target to <type>Colin Walters2010-08-311-27/+72
| | | | | | | This makes type parsing more uniform. Delete the typedef for GSList in foo.h - that's not supported anymore, or at least for now.
* [gircompiler] Clean up parsingColin Walters2010-08-171-37/+60
| | | | | | | | | | | | | | 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...
* [girparser] Cleanly pass through c:includeColin Walters2010-08-171-0/+13
|
* Don't include machine-dependent integral types in the typelibColin Walters2010-07-091-13/+56
| | | | | | | | | | | | | | | | | | | | Previously we had both e.g. GI_TYPE_TAG_LONG and GI_TYPE_TAG_INT64, but in fact the typelib is already machine-specific, so it makes sense to just encode this as a fixed type. The .gir remains abstract. We also remove size_t from the typelib; one would never want to treat it differently than an integer. time_t is removed as well; while bindings like gjs had special handling to turn it into e.g. a JS Date object, I don't think we should encourage people to use these POSIX types in their API. Use GTimeVal or the like instead. Because the typelib is now really machine-specific, we need to remove the -expected.tgirs from git. (We could potentially add a check which wasn't just a literal diff later) https://bugzilla.gnome.org/show_bug.cgi?id=623774
* Remove trailing whitespaceJohan Dahlin2010-07-091-1/+1
|
* Add support for non-GObject fundamental objectsJohan Dahlin2010-07-091-0/+19
| | | | | | | | | | | | | | This patch adds support for instantiable fundamental object types, which are not GObject based. This is mostly interesting for being able to support GstMiniObject's which are extensivly used in GStreamer. Includes a big test case to the Everything module (inspired by GstMiniObject) which should be used by language bindings who wishes to test this functionallity. This patch increases the size of the typelib and breaks compatibility with older typelibs. https://bugzilla.gnome.org/show_bug.cgi?id=568913
* Move doc to toplevel element, write <any> for unknown containersColin Walters2010-07-081-0/+27
| | | | | | | | | Moving to <doc> allows us to better preserve whitespace. XML has no facility for whitespace-preserving attributes. Second, for arrays and lists, both types with unknown element_type can occur in the current scanner; it's least wrong if we write out an <any> type.
* Allow attributes on parameters and return valuesDavid Zeuthen2010-06-241-1/+8
| | | | | | | | | | | | | | | | | | Any annotation where the key has a dot in the name will go into the attribute list. For example * @arg: (foo.bar baz): some arg the parameter @arg will get the attribute with key foo.bar and value baz. This also works for. * Returns: (foo.bar2 baz2): the return value Also add tests for this new feature. See https://bugzilla.gnome.org/show_bug.cgi?id=571548 Signed-off-by: David Zeuthen <davidz@redhat.com>
* [girparser] Remove backtrace()Colin Walters2010-06-221-29/+0
| | | | | It's not useful; we never got good info from it, and modern operating systems ship with crash catching systems.
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-171-794/+687
| | | | | | | | | | | | | | | | | | This work allows us to move closer to replacing gtk-doc, among other things. We add a generic attribute "introspectable", and inside the typelib compiler if we see "introspectable=no", we don't put it in the typelib. This replaces the hackish pre-filter for varargs with a much more generic mechanism. The varargs is now handled in the scanner, and we emit introspectable=no for them. Add generic metadata to Node with references to file/line/column, which currently comes from symbols. Add scanner options --warn-all and --warn-error. https://bugzilla.gnome.org/show_bug.cgi?id=621570
* More explicitly document how we'll use the version= attribute on repositoryColin Walters2010-06-171-1/+6
| | | | | | I want to start bumping it on incompatible .gir changes. https://bugzilla.gnome.org/show_bug.cgi?id=621895
* Revert "Support introspectable=no attribute, add warnings framework"Johan Dahlin2010-06-171-686/+793
| | | | This reverts commit 074192b89c6afcdd7f062f03989972e44334b8bf.
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-161-793/+686
| | | | | | | | | | | | | | | | This work allows us to move closer to replacing gtk-doc, among other things. We add a generic attribute "introspectable", and inside the typelib compiler if we see "introspectable=no", we don't put it in the typelib. This replaces the hackish pre-filter for varargs with a much more generic mechanism. The varargs is now handled in the scanner, and we emit introspectable=no for them. Add generic metadata to Node with references to file/line/column, which currently comes from symbols. Add scanner options --Wall and --Werror.
* [girparser] Annotate return transfer for public APIJohan Dahlin2010-06-121-2/+2
|
* Use a default value for transfer-ownership in properties.Tomeu Vizoso2010-06-081-4/+7
|
* Support the (transfer) annotation for properties.Tomeu Vizoso2010-06-081-0/+42
| | | | | | | | | | | | * girepository/*: Add g_property_info_get_ownership_transfer() and write the transfer attribute of properties into the typelib. * giscanner/*: Parse the (transfer) annotation and write it into the .gir. * tools/generate.c: Read the transfer annotation for properties and write to the .tgir. https://bugzilla.gnome.org/show_bug.cgi?id=620484
* Philip, you didn't write all of thisJohan Dahlin2010-06-081-0/+1
|
* Fix marshalling of GStrv.GOBJECT_INTROSPECTION_0_6_13Tomeu Vizoso2010-06-021-0/+3
| | | | | | | | | | | | | | | | | | * gir/gimarshallingtests.[hc]: Add a test for GStrv in function args and as struct fields. * girepository/giroffsets.c: Correctly compute the size of structs with array fields * girepository/girparser.c: Set is_pointer to FALSE for arrays with fixed size that are inside structs. * giscanner/glibtransformer.py: Special case GStrv as arrays of utf8. * giscanner/annotationparser.py: Make full transfer the default for arrays of char* returned by functions. https://bugzilla.gnome.org/show_bug.cgi?id=620170
* [gtypelib.ch] Rename to gitypelib.chJohan Dahlin2010-05-311-1/+1
| | | | | Rename gtypelib.h -> gitypelib-internal.h and rename gtypelib.c to gitypelib.c
* [girparser] Don't hard require caller-allocates since it breaks parsingColin Walters2010-05-261-8/+3
| | | | | | We need to support parsing older .girs for inclusion purposes. (But we should probably have an explicit .gir version, and require the attribute for newer versions)
* Support (out caller-allocates)Colin Walters2010-05-261-7/+13
| | | | | | | | | | | | | | | | | | | | | 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
* girparser: backtrace_stderr: fix int/ssize_t format mismatchSimon McVittie2010-05-191-1/+1
| | | | | backtrace() is defined in terms of int, which differs from ssize_t on x86-64, and @size is also an int.
* Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso2010-05-041-15/+33
| | | | | | | | GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
* Revert "Add support for GArrays: add g_type_info_get_array_type() and ↵Tomeu Vizoso2010-05-031-33/+15
| | | | | | properly scan GArray args" This reverts commit 87291e08b0fd34b62e1ad9811c174108b38311a9.
* Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso2010-04-301-15/+33
| | | | | | | | GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
* Add support for foreign structsJohan Dahlin2010-03-251-0/+4
| | | | | | | | 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
* [girepository] Remove trailing whitespaceJohan Dahlin2010-03-241-228/+228
|
* Make error more verbose in parserBastien Nocera2009-12-091-4/+7
| | | | | | By printing the function when arguments are missing https://bugzilla.gnome.org/show_bug.cgi?id=604161
* Implement callbacks as part of struct fields. Fixes #557383Tomeu Vizoso2009-11-111-1/+19
| | | | | | gir: embed <callback> inside <field> typelib: if a field contains a callback, store it just after the FieldBlob girepository API: no additions
* Bug 584423 – Add short/ushort supportMark Lee2009-06-221-0/+2
| | | | | | | | | Add type tags for short and ushort, plus all of the requisite code needed to utilize them in libgirepository. Add support in the scanner's AST files. Add test functions to the everything library and the expected gir file. gtypelib.c constant validation fixed by Colin Walters <walters@verbum.org>
* Bug 585328 - Only set zero_terminated flag for types we know areSimon van der Linden2009-06-171-0/+6
| | | | | Rationalize our setting of the zero_terminated flag; we shouldn't set it if the gir doesn't say to.
* Bug 585584: Fix warnings in girparser backtrace functionality and compiler.cC. Scott Ananian2009-06-121-3/+6
|
* Make g-ir-compiler find files installed by make installHolger Hans Peter Freyther2009-06-111-2/+8
| | | | | | | | | | | When ./configure --prefix $HOME/some/where is used gobject-introspection will happily install the files into $HOME/some/where/data/gir-1.0 but it will refuse to find them. Apply the same trick as in girepository/girepository.c:init_globals to find the gir files. Unifiy the name gir-1.0 in GIR_SUFFIX and use it throughout the project, introduce GIR_DIR which holds the path to the gir files and update girparser and transformer.py to look into this path.
* Fix 'Could not find GIR file ...' error to use right filename.Dan Winship2009-03-281-10/+8
| | | | Also plug a leak; girname was previously only freed on error.
* Bug 576605 - Get rid of GI_SCOPE_TYPE_OBJECTAndreas Rottmann2009-03-271-2/+0
| | | | Remove support for (scope object) as it lacks a real use case.
* Bug 576323 - Fix inner constant parsing Signed-off-by: Didier 'Ptitjes ↵Didier 'Ptitjes2009-03-241-1/+1
| | | | | | <ptitjes@free.fr> Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 564016 - Include c:prefix in typelib, use it to optimize find_by_gtypeColin Walters2009-03-171-2/+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-1/+5
| | | | | | | | | | | | | | | | 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-1/+51
| | | | | | | | 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.
* Bug 572434 - Associate interfaces with their C structuresColin Walters2009-02-251-6/+9
| | | | | | | | 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.