summaryrefslogtreecommitdiffstats
path: root/generator/README
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-09-11 09:25:12 +0100
committerRichard Jones <rjones@redhat.com>2010-09-11 12:04:44 +0100
commit04d8209077d2227eb1d42695ba71147f78987050 (patch)
treea2ed4a062f70fe258d0fd9b60020c24f6dc7459c /generator/README
parent264629b9f0ace1062b453b2d0ae55e48385189d3 (diff)
downloadlibguestfs-04d8209077d2227eb1d42695ba71147f78987050.tar.gz
libguestfs-04d8209077d2227eb1d42695ba71147f78987050.tar.xz
libguestfs-04d8209077d2227eb1d42695ba71147f78987050.zip
Split generator into separate source files.
'src/generator.ml' is no more. Instead the generator is logically split up over many different source files. Read generator/README for help and tips. We compile the generator down to bytecode, not native code. This means it will run more slowly, but is done for maximum portability.
Diffstat (limited to 'generator/README')
-rw-r--r--generator/README34
1 files changed, 34 insertions, 0 deletions
diff --git a/generator/README b/generator/README
new file mode 100644
index 00000000..dfbd1604
--- /dev/null
+++ b/generator/README
@@ -0,0 +1,34 @@
+This program generates a large amount of code and documentation for
+all the daemon actions.
+
+To add a new action there are only two files you need to change,
+'generator_actions.ml' to describe the interface, and
+daemon/<somefile>.c to write the implementation.
+
+After editing these files, build it (make -C generator) to regenerate
+all the output files. 'make' will rerun this automatically when
+necessary.
+
+IMPORTANT: This program should NOT print any warnings at compile time
+or run time. If it prints warnings, you should treat them as errors.
+
+OCaml tips:
+
+(1) In emacs, install tuareg-mode to display and format OCaml code
+correctly. 'vim' comes with a good OCaml editing mode by default.
+
+(2) Read the resources at http://ocaml-tutorial.org/
+
+(3) A module called 'Generator_foo' is defined in one or two files
+called 'generator_foo.mli' and 'generator_foo.ml' (NB: lowercase first
+letter). The *.mli file, if present, defines the public interface for
+the module. The *.ml file is the implementation. If the *.mli file
+is missing then everything is exported.
+
+Some notable files in this directory:
+
+generator_actions.ml The libguestfs API.
+generator_structs.ml Structures returned by the API.
+generator_c.ml Generate C API.
+generator_<lang>.ml Generate bindings for <lang>.
+generator_main.ml The main generator program.