I have been playing around GLib and libyaml with vala for a couple of
months. While I don't see a clear future of the code, I would like to
post a link to my code in case it will be useful to others.
The library is written in VALA, but one can write applications and link
against it in the same way as against other traditional GLib libraries.
This library provides the geometry object builder for a simulation
program I was writing at IU. It includes two parts:
a) a native representation of YAML nodes in GLib data type.
GList <-> Sequence
GHashTable <-> Mapping
gchar * <-> Scalar
However, as the fundamental containers in GLib are type-unaware,
decorators(is it the correct name?) are added to store the
type-information, as well as extra document stream information.
GYAMLNodeSequence <-> Sequence
GYAMLNodeMapping <-> Mapping
GYAMLNodeScalar <-> Scalar
GYAMLNodeAnchor <-> Anchor
The corresponding data structures in libyaml are not used, as they do
not work nicely with vala.
this part is based on the yaml wrapper in gore (gore @ sourceforge);
b) an object builder that builds GObject from YAML,
The builder scans the YAML tree created by GYAMLParser, and builds
GYAMLBuildable objects from the document tree. GYAMLBuildable is
designed in such a way that it is compatible with GtkBuildable unless
the API is XML/YAML specific; nevertheless so far the interface is not
interchangeable with GtkBuildable, because one of the changes needed in
vala 'doen't make sense'.
A short installation guide is at
The code can be obtained via
git clone git://github.com/fengy-research/libyaml-glib.git
The draft documentation(compiled by valadoc) is temporarily available at
More techy details are discussed under GYAMLBuilder, GYAMLBuildable, and
The attachment is a program that converts the standard invoice example
into GObject objects. After the library is properly installed, compile
valac --pkg libyaml-glib-1.0 libyaml-glib-builder.vala -X -export-dynamic
Your feedback is welcomed.