summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-10-02 15:42:14 +0100
committerRichard Jones <rjones@redhat.com>2009-10-13 17:53:20 +0100
commitd37f69795396ec2354eb2d8480d64b9e5bdafacc (patch)
tree0685bb56dd3032d4e413930f23f93aac323b4cd9 /Makefile.am
parentc6b8db6493dd633bf48b13daf72cdc9c078b5f9a (diff)
downloadlibguestfs-d37f69795396ec2354eb2d8480d64b9e5bdafacc.tar.gz
libguestfs-d37f69795396ec2354eb2d8480d64b9e5bdafacc.tar.xz
libguestfs-d37f69795396ec2354eb2d8480d64b9e5bdafacc.zip
inspector: Generate language bindings for OCaml.
This commit adds a generic mechanism for deriving language bindings for virt-inspector, and implements one concrete binding, for OCaml. The bindings are generated from the RELAX NG schema (virt-inspector.rng) which is supposed to be a correct and always up to date description of the XML that the virt-inspector program can generate. From the RNG we generate a set of types to describe the output of virt-inspector for the language, plus an XML parser, plus some glue code to actually run an external instance of virt-inspector and parse the resulting XML. At runtime, an external 'virt-inspector --xml <name>' command runs and the XML is parsed into language-specific structures. This has been tested on the four example files (inspector/example?.xml) The only particular difficulty about the OCaml binding is the use of Obj.magic, which is naughty but works because of the isomorphism between the representation of tuples and records in OCaml. This seems to cause no problems in my test program. Apart from this, the OCaml binding is straightforward and could be adapted easily for any other languages that want type-safe virt-inspector bindings. It's important to keep virt-inspector.rng up to date with changes to virt-inspector's XML output format.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am12
1 files changed, 6 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 90c51f1b..a7197d4b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,12 +20,15 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = gnulib/lib src daemon appliance fish po examples images \
gnulib/tests capitests regressions test-tool
-if HAVE_OCAML
-SUBDIRS += ocaml ocaml/examples
-endif
if HAVE_PERL
SUBDIRS += perl
endif
+if HAVE_INSPECTOR
+SUBDIRS += inspector
+endif
+if HAVE_OCAML
+SUBDIRS += ocaml ocaml/examples
+endif
if HAVE_PYTHON
SUBDIRS += python
endif
@@ -38,9 +41,6 @@ endif
if HAVE_HASKELL
SUBDIRS += haskell
endif
-if HAVE_INSPECTOR
-SUBDIRS += inspector
-endif
if HAVE_DF
SUBDIRS += df
endif