summaryrefslogtreecommitdiff
path: root/girepository/girnode.c
Commit message (Collapse)AuthorAgeFilesLines
* girnode: remove wrongly added g_assert_not_reached(). Fixes #218Christoph Reiter2018-08-031-1/+1
| | | | | Added in 9535fc48. After the switch it calls _g_ir_node_build_typelib() again handling the other types.
* build: enable -Wswitch-defaultChristoph Reiter2018-07-291-0/+4
| | | | | | | In case the surrounding code handles missing cases break, otherwise add a g_assert_not_reached(). The generated parser code triggers this as well, so disable it there only.
* build: enable -WshadowChristoph Reiter2018-07-291-9/+9
|
* Use locale-independent functions to parse numbersEmmanuele Bassi2017-09-241-3/+3
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=788087
* girepository: Use constant time calculation for sections after Object fieldsSimon Feltman2015-10-101-41/+51
| | | | | | | | | | | | Add "n_field_callbacks" to ObjectBlob which represents the number of object fields which are also callbacks. This a allows a constant time computation for accessing sections after fields. Track writing of this field by passing an extra argument through the girnode writers recursive call structure. This essentally reverts a portion of commit 7027bb256d0d1ab which added a linear time computation for accessing sections after fields. Update typelib validator to also ensure n_field_callbacks is properly set. https://bugzilla.gnome.org/show_bug.cgi?id=700338
* girepository: Support GError exceptions on callbacksGarrett Regier2015-06-211-2/+5
| | | | | | | | | | | Generalize "throws" attribute to SignatureBlob which can be used by all callable blob types. Keep FunctionBlob and VFuncBlob throw attributes around and functional for compatibility. Refactor girwriter.c to write out throws attribute for all callable types. Based on a patch by Simon Feltman. https://bugzilla.gnome.org/show_bug.cgi?id=729543
* Parse and expose ownership transfer for instance parametersGiovanni Campagna2014-07-031-0/+3
| | | | | | | | | | | Knowing the ownership transfer for instance parameters is necessary for correct memory management of functions which "eat" their instance argument, such as g_dbus_method_invocation_return_*. Parse this information from the gir file and store in the typelib, and then provide new API on GICallableInfo to retrieve this. https://bugzilla.gnome.org/show_bug.cgi?id=729662
* girepository: ArgBlob: rename allow_none parameterRyan Lortie2014-05-061-5/+5
| | | | | | | | | Rename the "allow_none" parameter on internal/private structure ArgBlob to "nullable". This is a straight rename with no other changes. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* scanner: Support boolean constantsFlorian Müllner2013-11-291-2/+2
| | | | | | | | Aliasing TRUE or FALSE is not very common, but done occasionally for extra clarity. Namely G_SOURCE_REMOVE / G_SOURCE_CONTINUE are self-explanatory, unlike the "raw" booleans. https://bugzilla.gnome.org/show_bug.cgi?id=719566
* girnode: Fix a NULL pointer deference if a namespace can’t be foundPhilip Withnall2013-11-061-0/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=711541
* girepository: Remove C99ism and other updatesChun-wei Fan2012-10-271-5/+10
| | | | | | | | | | -Make code using libgirepository_internals relocatable on Windows, like what is done in the GTK+ stack, and the girepository DLL. -Remove C99isms -"interface" is a reserved keyword on certain compilers, so change that to "giinterface" https://bugzilla.gnome.org/show_bug.cgi?id=681820
* Add Emacs mode lines to C sourcesColin Walters2012-02-031-1/+2
|
* girepository: Add GI_VFUNC_THROWSColin Walters2012-02-031-0/+1
| | | | | | | | Virtual functions can definitely throw an error. Right now the scanner omits the GError parameter for them and adds throws="1", but g-ir-compiler ignores this. https://bugzilla.gnome.org/show_bug.cgi?id=669332
* Allow enums and bitfields to have static methodsTorsten Schönfeld2011-08-161-1/+17
| | | | | | | | | | | | | This uses the same backcompat machinery that was introduced for static methods for non-class types, so this change does not break users of the existing presentations. New libgirepository API: g_enum_info_get_n_methods g_enum_info_get_method https://bugzilla.gnome.org/show_bug.cgi?id=656499
* Switch to storing string form of error quarksDan Winship2011-08-121-0/+7
| | | | | | | | | | | | | | | | Instead of storing the name of the function to call to get the error quark, store the string form of the error quark, which we derive from the introspection binary during scanning. Update EnumBlob and GIEnumInfo to include the new information. This will allow determining a back-mapping from error quark to error domain without having to dlsym() and call all the known error quark functions. Based on earlier patches from Owen Taylor and Maxim Ermilov. https://bugzilla.gnome.org/show_bug.cgi?id=602516
* Deprecate ErrorDomainDan Winship2011-08-121-67/+5
| | | | | | | | | | | | | | The previous ErrorDomain blob was never actually scanned or used, and it was kind of a lame API conceptually. To keep some compatibility, rather than removing the enumeration values, rename them to _INVALID, and don't bump the typelib version. This should in theory allow a new libgirepository to read an old typelib. Based on a patch from Colin Walters https://bugzilla.gnome.org/show_bug.cgi?id=602516
* Fix accessing structure fields that are arraysGiovanni Campagna2011-06-081-1/+3
| | | | | | | | | | We need to distinguish inline arrays inside structures, and arrays that are pointers and annotations, and we can do it with g_type_info_is_pointer(), setting it to FALSE for fixed size arrays. As a side effect, (array fixed-size=N) on a pointer type has no longer the expected result. https://bugzilla.gnome.org/show_bug.cgi?id=646635
* Add support for the (skip) annotation on parameters or return valuesDavid Zeuthen2011-05-131-0/+2
| | | | | | | | This was discussed in bug 649657. https://bugzilla.gnome.org/show_bug.cgi?id=649657 Signed-off-by: David Zeuthen <davidz@redhat.com>
* GIrNode: fix lookup of cached type nodesGiovanni Campagna2011-02-211-11/+34
| | | | | | | | Different types of array have different type nodes, so they should produce different keys in the cache of already seen type nodes, to avoid turning a GByteArray into a reference to a GPtrArray. https://bugzilla.gnome.org/show_bug.cgi?id=642300
* girepository: Consistently prefix internal functions with _Colin Walters2010-11-161-173/+173
| | | | | 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/+1
| | | | | | | 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-1/+2
| | | | | | | | | | | | | 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
* girepository: Use G_TYPE_TAG_IS_BASIC consistentlyColin Walters2010-10-261-5/+3
| | | | This is a preparatory patch for adding a new basic tag.
* Use GLib types consistentlyColin Walters2010-08-311-27/+1
| | | | | | | | | 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.
* [gircompiler] Clean up parsingColin Walters2010-08-171-87/+74
| | | | | | | | | | | | | | 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...
* Don't include machine-dependent integral types in the typelibColin Walters2010-07-091-27/+0
| | | | | | | | | | | | | | | | | | | | 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
* Add support for non-GObject fundamental objectsJohan Dahlin2010-07-091-0/+21
| | | | | | | | | | | | | | 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
* Allow attributes on parameters and return valuesDavid Zeuthen2010-06-241-0/+16
| | | | | | | | | | | | | | | | | | 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>
* Attribute bug-fixesDavid Zeuthen2010-06-241-10/+4
| | | | | | | | | | | | | | | | | | 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>
* Support the (transfer) annotation for properties.Tomeu Vizoso2010-06-081-0/+2
| | | | | | | | | | | | * 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
* [gtypelib.ch] Rename to gitypelib.chJohan Dahlin2010-05-311-1/+1
| | | | | Rename gtypelib.h -> gitypelib-internal.h and rename gtypelib.c to gitypelib.c
* Support (out caller-allocates)Colin Walters2010-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | 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 GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso2010-05-041-0/+1
| | | | | | | | 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-1/+0
| | | | | | 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-0/+1
| | | | | | | | 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/+1
| | | | | | | | 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
* [typelib] Remove space/indent mismatchJohan Dahlin2010-03-251-7/+7
|
* Remove trailing whitespaceJohan Dahlin2010-03-251-1/+1
|
* [girepository] Remove trailing whitespaceJohan Dahlin2010-03-241-123/+123
|
* Fix Alignment Errors.Kedar Sovani2010-02-111-6/+13
| | | | | | Signed-off-by: Kedar Sovani <kedars@marvell.com> https://bugzilla.gnome.org/show_bug.cgi?id=606139
* [g-ir-compiler] Slightly less lame error messagesColin Walters2010-02-111-1/+1
| | | | | | 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.
* Implement callbacks as part of struct fields. Fixes #557383Tomeu Vizoso2009-11-111-6/+28
| | | | | | gir: embed <callback> inside <field> typelib: if a field contains a callback, store it just after the FieldBlob girepository API: no additions
* Sync the basic types array in girnode.c:serialize_type with GITypeTagDan Winship2009-07-061-3/+4
| | | | | | Fixes a crash compiling GIRepository-2.0.gir. http://bugzilla.gnome.org/show_bug.cgi?id=587823
* Name unions to enable compilation on SolarisTobias Mueller2009-06-241-8/+8
| | | | | Patch by Brian Cameron <brian.cameron@sun.com>. Fixes bug 578199.
* Bug 584423 – Add short/ushort supportMark Lee2009-06-221-0/+8
| | | | | | | | | 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 557383 - Virtual method supportColin Walters2009-03-051-0/+37
| | | | | | | | | | | | | | | | 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/+37
| | | | | | | | 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-37/+39
| | | | This will be useful for later changes which need to inspect the parent.
* Bug 572434 - Associate interfaces with their C structuresColin Walters2009-02-251-7/+12
| | | | | | | | 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.
* typelib building: Compress 5 arguments for g_ir_node_build_typelibColin Walters2009-02-201-89/+47
| | | | | This makes it easier to add more over time without changing lots of unrelated code.