Dear list(s), 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)[2]; 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'.[1] A short installation guide is at http://github.com/fengy-research/libyaml-glib 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 http://www.does-exist.info/yaml-glib/Documentation/libyaml-glib-1.0/index.htm More techy details are discussed under GYAMLBuilder, GYAMLBuildable, and GYAMLDocument. The attachment is a program that converts the standard invoice example into GObject objects. After the library is properly installed, compile with valac --pkg libyaml-glib-1.0 libyaml-glib-builder.vala -X -export-dynamic Your feedback is welcomed. Regards, Yu [1] http://bugzilla.gnome.org/show_bug.cgi?id=584400 [2] http://gore.svn.sourceforge.net/viewvc/gore/trunk/server/yaml_helper.c http://gore.svn.sourceforge.net/viewvc/gore/trunk/server/libyaml-wrapper.vala
Attachment:
libyaml-glib-builder.vala
Description: Text Data