[Vala] Improvements to Vala GIR parser
- From: Calvin Walton <calvin walton gmail com>
- To: vala-list gnome org
- Subject: [Vala] Improvements to Vala GIR parser
- Date: Thu, 29 Jul 2010 21:14:44 -0400
Hi everyone,
I was playing around with using Vala's GIR format parser in combination
with the GIRepository library today, and I found that Vala's GIR parser
couldn't handle the GIR formatting used by gobject-introspection 0.9.2.
Assuming that I got my Git-fu correct, you'll find the following two
patches behind this email:
[PATCH 1/2] Add support for additional gobject-instrospection base types
[PATCH 2/2] Map GIRepository "record" type to Class instead of Struct
with which (and some experimental gobject-introspection libraries), you
can compile and run the following program:
valac --pkg GIRepository-2.0 test.vala
int main(string[] args)
{
var repo = GIRepository.IRepository.get_default();
GIRepository.Typelib typelib;
try {
typelib = repo.require("Gtk", "3.0", 0);
} catch (Error e) {
stderr.printf("%s\n", e.message);
return 1;
}
string ns = typelib.get_namespace();
stdout.printf("Typelib Namespace: %s\n", ns);
return 0;
}
--
Calvin Walton
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]