Commit Graph

537 Commits

Author SHA1 Message Date
Chun-wei Fan
adc6f08ff7 girepository: Include config.h First in All Sources
This includes config.h in all the C-sources of girepository so that we can
get the correct export directive from config.h during compile time and
therefore export the symbols as necessary, like what GLib and GTK+ is
currently doing.

https://bugzilla.gnome.org/show_bug.cgi?id=732669
2014-07-07 09:24:12 +08:00
Giovanni Campagna
9921571eb0 Parse and expose ownership transfer for instance parameters
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
2014-07-03 10:31:17 +02:00
Philip Withnall
d2514073b9 gibaseinfo: Expand g_base_info_iterate_attributes() documentation
Clarify what an attribute is, in response to a question on
gir-devel-list.

https://bugzilla.gnome.org/show_bug.cgi?id=732078
2014-06-23 09:36:01 +01:00
Ryan Lortie
c0dab09f95 girepository: change giarginfo docs
Clarify the meaning of 'may be null' in the docs: it refers to the value
of the argument itself, not the reference to the argument.

https://bugzilla.gnome.org/show_bug.cgi?id=660879
2014-05-14 14:58:44 -04:00
Ryan Lortie
45e28fa698 compiler: girparser: parse 'nullable' attribute
Parse the 'nullable' attribute on parameters and function return types.

Additionally, tweak the meaning of the 'allow-none' attribute.  We now
only treat it as equivalent to 'nullable' for non-out parameters.  For
out parameters, we treat it to mean the same as the already-recognised
'optional' parameter (which we only recently started actually using).

https://bugzilla.gnome.org/show_bug.cgi?id=660879
2014-05-06 08:18:41 -04:00
Ryan Lortie
6d1df44ff7 girepository: ArgBlob: rename allow_none parameter
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
2014-05-06 08:18:41 -04:00
Simon Feltman
cf4fb6a0fe g-ir-compiler: Add support for callback fields on GObjects
Use ParseState enum instead of a boolean for the ParseContexts embedded_type
flag. This allows specific tracking of the embedded type currently being
parsed which can now either be STATE_STRUCT_FIELD or STATE_CLASS_FIELD (or
allow for future expansion). Add ParseState::STATE_NONE as the default for
this field.

Fix GObject FieldBlob validation to take into account the sizeof
CallbackBlobs (copied from the struct validator).

Add static g_object_info_get_field_offset which parallels
g_struct_info_get_field_offset which is needed since callback fields may
vary in size.

https://bugzilla.gnome.org/show_bug.cgi?id=725198
2014-02-27 13:51:18 -08:00
Rico Tzschichholz
90a99b4fcc giobjectinfo: Add missing transfer annotation to find_signal () 2014-01-23 17:19:41 +01:00
Ryan Lortie
f76e4ef683 typelib compiler: properly initialise memory
The typelib compiler was writing uninitialised memory to the output file.

There were two sources of this uninitialised memory: the hash writer included
some uninitialised memory in its output, and the bytes added after the hash
output for padding were also not being initialised.

Fix this by passing the padded size to the hash code writer function and
having that function initialise the entire memory region to zero before
writing.

https://bugzilla.gnome.org/show_bug.cgi?id=721177
2013-12-30 22:31:53 -05:00
Florian Müllner
eb6b6f4fd5 scanner: Support boolean constants
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
2013-11-29 18:45:31 +00:00
Philip Withnall
4dfcf7bc21 girnode: Fix a NULL pointer deference if a namespace can’t be found
https://bugzilla.gnome.org/show_bug.cgi?id=711541
2013-11-06 11:38:08 +00:00
Giovanni Campagna
67358cdaf4 GIVFuncInfo: allow retrieving the address of an interface vfunc
Don't assume that the parent of a GIVFuncInfo is a GIObjectInfo,
it could be a GIInterfaceInfo, if the vfunc is part of interface
instead of a class.

https://bugzilla.gnome.org/show_bug.cgi?id=688375
2013-10-22 23:33:44 +02:00
Dieter Verfaillie
bb7f8d57c2 docs: fix up reference docs a bit
- require GTK-Doc 1.19
      - remove sgml mode
      - automatically generate gi.types (needs GTK-Doc 1.19)
      - fix https://bugzilla.gnome.org/show_bug.cgi?id=700025
[WIP] - rearange sections a bit
[WIP] - add gi-building, gi-programming sections
[WIP] - mark missing docs with TODO, which is only marginaly
        better than nothing but at least can be grepped :)

https://bugzilla.gnome.org/show_bug.cgi?id=571648
2013-10-10 16:48:51 -04:00
Dieter Verfaillie
a50bfe5ec3 girepository: remove glib-compat
We depend on glib-2.0 >= 2.36.0, so no need to keep a 2.22.X
compatibility symbol around...
2013-10-09 12:48:46 -04:00
Dieter Verfaillie
c87579bbb6 giscanner: fix description field storage in .gir files
GTK-Doc description fields for tags can contain multiple lines and
even multiple paragraphs. Whitespace cannot be preserved in XML
attributes, so we move the "deprecated" description text into
a "<doc-deprecated />" element right next to where we already have
the "<doc />" element. Keep the "deprecated" attribute around for
backwards compatibility though, but set its value to "1" (analogous
to the "writable", "contruct", etc attributes) if the annotated
symbol is marked as deprecated.

While at it, add <doc-version /> and <doc-stability /> which
was not yet available in the .gir files...

This takes care of the "Since:", "Stability:" and "Deprecated:"
GTK-Doc tags. Nothing needs to be done for the "Returns:" tag as
as we already write a "<doc />" child element on "<return-value />".
2013-10-08 20:56:10 +02:00
Dieter Verfaillie
c9b088c24f giscanner: store code before and after comment block
so we can later use them to re-write source files containing
broken GTK-Doc comment blocks where /** is preceded by and/or
*/ is followed by code...
2013-10-08 20:56:07 +02:00
Simon Feltman
67ee43b667 Use case insensitive compare for signal "when" attribute
Update parser to use g_ascii_strcasecmp instead of strcmp. This fixes
incorrect flags being set when the incomming gir is using lowercase values
for the "when" attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=709462
2013-10-05 01:43:09 -07:00
Simon Kågedal Reimer
236d3375c6 g_irepository_dump: Update doc to match code
The input file no longer only consists of names of get_type-functions,
instead begins with either "get-type:" or "error-quark:".

https://bugzilla.gnome.org/show_bug.cgi?id=701639
2013-06-05 13:43:12 -04:00
Christian Persch
55efc6e90e Add printf attribute
This fixes a compiler warning when using -Wmissing-format-attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=698521
2013-05-05 22:56:21 +02:00
Colin Walters
273178600c typelib: Also ignore typelibs with empty c:prefix
As seen in xlib.gir at least; this is something we should probably ban
though.

https://bugzilla.gnome.org/697759
2013-04-15 09:26:38 -04:00
Colin Walters
2e4e98c978 girparser: Also honor legacy c:prefix
vala generates this, and we need to honor it now that we're using the
c:prefix as an optimization when searching for gtypes.

https://bugzilla.gnome.org/697759
2013-04-15 09:26:26 -04:00
Colin Walters
5bea9385b0 gitypelib: And another fix for empty strings 2013-04-08 15:32:15 -04:00
Colin Walters
d0462e6a3c typelib: Fix logic error in previous commit 2013-04-08 14:44:32 -04:00
Colin Walters
f84db0d30d typelib: Only malloc once during string iteration
Just more efficient.
2013-04-08 11:22:39 -04:00
Daniel Drake
33afebb2d7 Optimize g_irepository_find_by_gtype
When g_irepository_find_by_gtype() doesn't succeed on a simple prefix
match (the current 'fastpass' mechanism), it ends up taking a
considerable amount of CPU time, traversing the contents of all typelibs.

I imagine that the reasons to have the exhaustive search fallback are
not as strong as they used to be. For example, the case mentioned
(Clutter including Cogl) no longer seems to be true.

Also, typelibs (as generated by g-ir-scanner) now provide
comma-separated C prefix info for cases when the typelib includes
introspection info for multiple prefixes. For example, the Sugar typelib
has a c_prefix string of Sugar,EggSM,Gsm,Acme. So I imagine there are
not many remaining justified cases where the exhaustive search is needed.

With that in mind, I found two ways to optimize this function:

1. Support comma-separated C prefixes

2. Don't bother with an exhaustive search if we did find a typelib
   claiming support for the prefix. For example, if we're looking for
   GdkDeviceManagerXI2 (currently non-introspectable) and we already found
   typelib files providing the 'Gdk' prefix that didn't offer this, lets
   not bother with the exhaustive search, we aren't going to find anything.
2013-04-08 11:22:39 -04:00
Colin Walters
4779b03a21 girepository: Use g_atomic for refcounting
They could be freed in separate threads (e.g. language binding GC
thread).  But no particular reason to change other than noticing it
during code inspection for a different bug.

https://bugzilla.gnome.org/show_bug.cgi?id=688694
2013-04-02 12:10:33 -04:00
Giovanni Campagna
50638cf403 GIRepository: add API for extending library paths
Previously we would require applications that shipped with private
typelibs to add the private path to LD_LIBRARY_PATH, or to have a
launcher binary with the right RPATH.
Now they can just call GIRepository.prepend_library_path() before
they access the module.

https://bugzilla.gnome.org/show_bug.cgi?id=694485
2013-02-24 23:09:36 +01:00
Torsten Schönfeld
a7a47f4375 girepository: Document g_enum_info_get_error_domain
https://bugzilla.gnome.org/show_bug.cgi?id=693838
2013-02-15 14:34:32 +01:00
Jasper St. Pierre
ee4ee72ac3 girparser: Serialize and read back the instance_parameter
g-ir-doc-tool wants to use the instance parameter to read docs
and the parameter name, so it needs to be shuttled through the
GIR.

https://bugzilla.gnome.org/show_bug.cgi?id=693040
2013-02-01 19:37:21 -05:00
Jasper St. Pierre
06dfbc7dcb girparser: Clean up passthrough handling
Instead of remembering to have to set unknown_depth, smarten up
state_switch to do it for us.

https://bugzilla.gnome.org/show_bug.cgi?id=693040
2013-02-01 19:36:38 -05:00
Jasper St. Pierre
37791c8267 girparser: Move <doc> handling to passthrough
https://bugzilla.gnome.org/show_bug.cgi?id=693040
2013-02-01 19:20:35 -05:00
Martin Pitt
259c10f787 girepository: gchar is a signed type
gchar is signed, not unsigned. Add "guchar" alias as unsigned for completeness
(but usually it appears as guint8).

https://bugzilla.gnome.org/show_bug.cgi?id=691524
2013-01-11 10:09:25 +01:00
Torsten Schönfeld
f57dc1a133 build: Properly export g_interface_info_find_signal
It was missing from girepository.symbols.
2013-01-07 17:35:47 +01:00
Colin Walters
35091ec7df repo: Drop deprecated GStaticMutex usage
In favor of GOnce, since we just want initialize-once semantics.
2012-12-17 09:57:24 -05:00
Dieter Verfaillie
430826e825 docs: don't mark non GTK-Doc as being a GTK-Doc comment block
This patch silences another gtkdoc-mkdb warning.

https://bugzilla.gnome.org/show_bug.cgi?id=688418
2012-11-15 23:49:43 +01:00
Colin Walters
f4e33baf3b cmph: Remove leftover statement-without-effect
Compiler warning introduced from MSVC patches.
2012-10-30 18:23:09 -04:00
Colin Walters
b7555303b3 girepository: Use girepository.symbols for Unix builds too
Rather than having a regex for both builds, but *also* use a symbol
file for the MSVC build which would bitrot quickly, force us to update
the .symbols file by using it for Unix too.

Add some missing symbols.
2012-10-27 12:24:12 -04:00
Chun-wei Fan
671d1494f1 Add girepository.symbols
This is the listing of symbols to export from the main libgirepository
.dll/.so.  This is used for example to generate the .lib file from the
Windows DLL.

https://bugzilla.gnome.org/show_bug.cgi?id=681820
2012-10-27 12:06:10 -04:00
Chun-wei Fan
08da5d65ee girepository: Remove C99ism and other updates
-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
2012-10-27 12:06:09 -04:00
Chun-wei Fan
c449db7704 girffi.c: Don't include unistd.h unconditionally
It does not exist on all platforms

https://bugzilla.gnome.org/show_bug.cgi?id=681820
2012-10-27 12:06:09 -04:00
Chun-wei Fan
86b7d7cc99 cmph: Remove C99ism and other fixes
...So that it will compile on non-C99 compilers.  The changes are mainly
moving the variable declarations to the start of the resecptive blocks.

Also, replace the use of buflen in chd.c as it might not be defined for all
platforms, instead using packed_cr_size as it seems to represent the value
that is to be printed/displayed by the debugging output.

https://bugzilla.gnome.org/show_bug.cgi?id=681820
2012-10-27 12:06:09 -04:00
Colin Walters
5428e934b2 Drop calls to g_type_init()
And bump our GLib requirement.
2012-10-16 10:58:08 -04:00
Mark Nauwelaerts
1eb27e4bf8 ginvoke: support conversion of fundamental type GParamSpec values
https://bugzilla.gnome.org/show_bug.cgi?id=683265
2012-09-03 16:00:07 +02:00
Jasper St. Pierre
56048fc81c girepository: Fix leak in g_vfunc_info_get_address
We need to fix the struct info here.

https://bugzilla.gnome.org/show_bug.cgi?id=682647
2012-08-25 14:10:06 -03:00
Torsten Schönfeld
27f11b2e51 girepository: Add g_interface_info_find_signal
Add the convenience method g_interface_info_find_signal, mirroring
g_object_info_find_signal.

https://bugzilla.gnome.org/show_bug.cgi?id=682672
2012-08-25 19:06:58 +02:00
Jasper St. Pierre
3bcc0e43c6 girffi: Fix g_callable_info_prepare_closure for certain callables
Namely, those that are methods and those that throw GErrors.
We have very similar code in two places that calculate arg lengths and
argument types to stick into libffi. Merge, clean up, and correct both.

https://bugzilla.gnome.org/show_bug.cgi?id=673805
2012-08-20 15:01:59 -04:00
Jasper St. Pierre
d65cec7f15 gicallableinfo: Add two new convenience methods: is_method and can_throw_gerror
https://bugzilla.gnome.org/show_bug.cgi?id=673805
2012-08-20 15:01:59 -04:00
Jasper St. Pierre
d936489647 Fix build 2012-06-29 10:05:50 -04:00
Alan Knowles
849c7c2f66 fix GIArgument being exported as _Argument in .gir
https://bugzilla.gnome.org/show_bug.cgi?id=635128
2012-06-28 12:07:35 -04:00
Jasper St. Pierre
df10915ba5 givfuncinfo: Fix memory leak
The field info wasn't being freed after it was used
2012-05-25 16:36:46 -04:00