Commit Graph

658 Commits

Author SHA1 Message Date
Colin Walters
307843c55f Switch to nonrecursive make for core (i.e. not tests/)
This is cleaner and faster, and prepares us better for an incoming
import of CMPH.
2010-11-09 13:56:43 -05:00
Owen W. Taylor
ec76ea8628 Handle enumerations with the full range of signed and unsigned values
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
2010-11-01 17:25:45 -04:00
Owen W. Taylor
7fa7162361 Compute enumeration storage types more accurately
Previously we just were sloppy and didn't bother to accurately compute
signed/unsigned for enumeration types.  But since we expect bindings
to decode a field value or function return value from an integer to
an enumeration they have know whether an integer value is
0xffffffff or -1, so we need to do the full computation.

https://bugzilla.gnome.org/show_bug.cgi?id=629704
2010-11-01 16:38:51 -04:00
Colin Walters
aa154a1776 girepository: Use G_TYPE_TAG_IS_BASIC consistently
This is a preparatory patch for adding a new basic tag.
2010-10-26 10:04:46 -04:00
Colin Walters
3d7bb7feaf Fix regression in g_irepository_get_info
Commit f97cc8687469f25752f79275 broke the lookup in
g_irepository_get_info; the passed offset is 0-based, then
we convert it to 1-based (and then back to 0 later...which needs
to be fixed).
2010-10-21 15:01:07 -04:00
Colin Walters
54a1a7be49 girepository: Refactor lookup code
This is a cleanup patch in preparation for future indexing
patches.

The lookup code was a mess trying to mash in the 3 different
cases of name, GType, and index into one mega-function.

Split it up properly, and move the core typelib internal-scanning
bits into gitypelib.c where it belongs.
2010-10-18 12:04:08 -04:00
Colin Walters
8d9a983848 typelib: Don't fail on minor version
Previously we bombed out if the minor version didn't match what
we expected; this was silly since the whole point of the minor
version is to enumerate compatible changes.
2010-10-11 12:41:40 -04:00
Johan Dahlin
b31fdc5152 Improve documentation for g_registered_type_info_get_g_type 2010-10-06 14:27:49 -03:00
Colin Walters
795116b391 dumper: Make g_irepository_dump static when being used in dumper
Otherwise we'll bomb out if CFLAGS contains -Werror.
2010-10-01 12:44:08 -04:00
Colin Walters
26841c0b51 scanner: Don't link to -lgirepository when dumping
This helps us avoid a problematic case where in say jhbuild, using
a system (/usr/lib) glib, adding in -l girepository-1.0 will inject
-L /path/to/builddir, when we don't want that.

https://bugzilla.gnome.org/show_bug.cgi?id=630342
2010-09-30 13:47:25 -04:00
Tomeu Vizoso
9468bd36c9 Actually do something about fundamentals when parsing a .gir
https://bugzilla.gnome.org/show_bug.cgi?id=630710
2010-09-29 15:55:37 +02:00
Pavel Holejsovsky
508edb91ad Fix memory leak. 2010-09-25 11:32:28 -03:00
Pavel Holejsovsky
916798b704 Update annotations for GIRepository.Repository.
https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-15 09:48:46 -03:00
Pavel Holejsovsky
c664ffed5f Box GIBaseInfo structure.
This puts it into typelibs and allows to use it safely from scripts.

https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-15 09:48:44 -03:00
Colin Walters
6bc078f1ee typelib compiler: Passthrough <doc> at any point
This should have been in the previous commit.
2010-09-14 12:31:58 -04:00
Johan Dahlin
2e360c3fb7 [girepository] Add a missing include 2010-09-07 15:51:55 -03:00
Joe Marcus Clarke
09afe7361d [girepository] Support strict align platforms
Such as Sparc64.

https://bugzilla.gnome.org/show_bug.cgi?id=620769
2010-09-07 11:42:49 -03:00
Tomeu Vizoso
30922b36c1 Remove extra lines from the license comment 2010-09-06 11:23:01 +02:00
Steve Frécinaux
8548baf3b9 [VFuncBlob] Unknown struct offset should be 0xFFFF
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
2010-09-06 08:33:40 +02:00
Pavel Holejsovsky
bc6a8d2f23 [girepository] Document GIStructInfo & GIUnionInfo
https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-05 11:04:27 -03:00
Colin Walters
9a46475584 scanner: Fix previous rename-to handling commit 2010-09-03 18:17:28 -04:00
Colin Walters
f0eeec8cd8 scanner: Fix rename-to handling
We were writing the attributes backwards.  Also actually use
the attribute in the typelib generation.
2010-09-03 18:07:16 -04:00
Colin Walters
b18a6580d2 girepository: Call init_globals()
This fixes the search path initialization if g_irepository_require
is called first thing.
2010-09-02 17:43:23 -04:00
Colin Walters
36bf5dd721 girepository: Fix compatibility typedefs 2010-09-01 15:54:52 -04:00
Johan Dahlin
ce1779b8dd [GIRepository] Add missing transfer and skip 2010-08-31 17:50:44 -03:00
Johan Dahlin
14edb06326 [GIRepository] Rename GTypelib to GITypelib
Keep a typedef for backwards compatibility, until
the major bindings has moved over.
2010-08-31 17:37:10 -03:00
Johan Dahlin
9c80c84dc7 [GIRepository] Rename GArgument to GIArgument
Keep a typedef for backwards compatibility, until
the major bindings has moved over.
2010-08-31 17:35:57 -03:00
Johan Dahlin
180e1b61eb [girepository] Add a couple of missing transfer 2010-08-31 17:29:13 -03:00
Colin Walters
0449abe898 scanner: Avoid internal invalid Type instances from parents
We were adding a trailing ',' in the parent string, clean that up; and
don't attempt to create a Type from the empty string.
2010-08-31 16:05:57 -04:00
Colin Walters
35cb08a25e Major rewrite
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.
2010-08-31 16:05:56 -04:00
Colin Walters
f5ec6f6698 Use GLib types consistently
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.
2010-08-31 16:05:56 -04:00
Colin Walters
d853f196c1 Move alias target to <type>
This makes type parsing more uniform.

Delete the typedef for GSList in foo.h - that's not
supported anymore, or at least for now.
2010-08-31 16:05:56 -04:00
Steve Frécinaux
318843cead Fix warning when using g_irepository_enumerate_version()
The reason for the warning was that g_irepository_get_version() expects
the typelib to be already loaded, but enumerate_version() can be called
on typelibs that are not.
2010-08-18 22:45:19 +02:00
Steve Frécinaux
2b07f1ed31 Include the loaded version in g_irepository_enumerate_versions()
Logically speaking, the already loaded version of a namespace is part of
the currently available versions, and can be forgotten if we only
consider the versions available in GI_TYPELIB_PATH, as it could have
been loaded using g_irepository_require_private().

As a side effect, it meant that bindings relying on enumerate_version()
(like pygobject) were not able to require private versions through their
classical requirement scheme.

This patch fixes it by adding the loaded version to the unsorted list of
available versions returned by g_irepository_enumerate_versions()

This patch also uses g_list_prepend() instead of g_list_append() in that
function.

https://bugzilla.gnome.org/show_bug.cgi?id=625983
2010-08-18 20:07:18 +02:00
Colin Walters
62f1b65cc8 [gircompiler] Clean up parsing
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...
2010-08-17 13:14:51 -04:00
Colin Walters
9b1bb64e83 [girepository] Fix up error printing
We didn't show the right error message if we failed to find
the symbol; fix this by removing error printing from the
middle of the dumper, and add it correctly to the toplevel
dump entry point.
2010-08-17 13:12:52 -04:00
Colin Walters
f552f46f88 [girparser] Cleanly pass through c:include 2010-08-17 13:11:03 -04:00
Steve Frécinaux
439753a5b3 Do not leak typelibs with wrong header info.
Previously the typelibs that were loaded but whose header information
weren't right were just leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=625672
2010-08-03 23:42:08 +02:00
Steve Frécinaux
e3b7e76b86 Add new API g_typelib_require_private()
This is equivalent to g_typelib_require() but intended for use with
private typelibs, which get loaded from the provided directory.

https://bugzilla.gnome.org/show_bug.cgi?id=625672
2010-08-03 23:36:54 +02:00
Colin Walters
9771d87b4d Add BLOB_TYPE_FLAGS to BLOB_IS_REGISTERED_TYPE 2010-07-28 16:35:47 +02:00
Johan Dahlin
899718c93c [girepository-private] Add ffi declarations
Add declarations for the ffi closure api we're using, this silents
GCC warnings on systems with broken ffi headers.
2010-07-28 09:01:33 -03:00
Johan Dahlin
c93fbff870 [girepository] Update documentation 2010-07-28 08:52:45 -03:00
Johan Dahlin
ab9085eda3 [GIRepository] Rename g_irepository_enumerate
Rename it to g_irepository_enumerate_versions
2010-07-28 08:52:05 -03:00
Tomeu Vizoso
da698167a0 Add g_info_type_to_string (GIInfoType type) 2010-07-28 12:24:10 +02:00
Colin Walters
958b70d8b0 Add g_irepository_enumerate
This will be used for pygobject to enumerate namespaces.
2010-07-27 17:56:36 +02:00
Colin Walters
c0b26bf0a0 [girepository] Include path to file in typelib load failure error
This makes version conflicts more obvious.
2010-07-22 13:48:32 -04:00
Colin Walters
c8fb0f97a8 Fix two compilation warnings 2010-07-19 17:48:17 -04:00
Florian Müllner
5b5ab282a6 [girepository] Fix ordering in override_search_path
Entries in the GI_TYPELIB_PATH environment variable are added to the
global search path in reverse order - instead, add entries in the
same order in which they are specified.
2010-07-15 23:40:28 +02:00
Colin Walters
1b8bf7a4dc [girepository] Actually verify header of loaded typelibs in 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.
2010-07-14 11:59:11 -04:00
Colin Walters
3a310fd242 Don't include machine-dependent integral types in the typelib
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
2010-07-09 14:15:52 -04:00