Files
libguestfs/generator
Richard W.M. Jones 2cc348448a generator: Share Common_utils code.
For a very long time we have maintained two sets of utility functions,
in mllib/common_utils.ml and generator/utils.ml.  This changes things
so that the same set of utility functions can be shared with both
directories.

It's not possible to use common_utils.ml directly in the generator
because it provides several functions that use modules outside the
OCaml stdlib.  Therefore we add some lightweight post-processing which
extracts the functions using only the stdlib:

  (*<stdlib>*)
  ...
  (*</stdlib>*)

and creates generator/common_utils.ml and generator/common_utils.mli
from that.  The effect is we only need to write utility functions
once.

As with other tools, we still have generator-specific utility
functions in generator/utils.ml.

Also in this change:

 - Use String.uppercase_ascii and String.lowercase_ascii in place
   of deprecated String.uppercase/String.lowercase.

 - Implement String.capitalize_ascii to replace deprecated
   String.capitalize.

 - Move isspace, isdigit, isxdigit functions to Char module.
2016-12-09 09:31:25 +00:00
..
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-01-02 21:19:51 +00:00
2016-01-02 21:19:51 +00:00
2016-01-02 21:19:51 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-01-02 21:19:51 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00
2016-12-09 09:31:25 +00:00

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,
'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.org/learn/

(3) A module called 'Foo' is defined in one or two files called
'foo.mli' and '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:

  actions.ml          The libguestfs API.
  structs.ml          Structures returned by the API.
  c.ml                Generate C API.
  <lang>.ml           Generate bindings for <lang>.
  main.ml             The main generator program.

Note about long descriptions:

When referring to another action, use the format C<guestfs_other>
(ie. the full name of the C function).  This will be replaced as
appropriate in other language bindings.  Apart from that, long
descriptions are just perldoc paragraphs.

Note about extending functions:

In general you cannot change the name, number of required arguments or
type of required arguments of a function, since this would break
backwards compatibility.

You may add another optional argument, *if* the function has >= 1
optional arguments already.  Add it at the end of the list.

You may add optional arguments to a function that doesn't have any.
However you *must* set the once_had_no_optargs flag to true, so that
the relevant backwards compatibility bindings can be added.