generator: Rename 'generator_*' as '*'.

This is a simple renaming of the files/modules.

Note that in OCaml, module names are derived from filenames by
capitalizing the first letter.  Thus the old module names had the form
"Generator_api_versions".  The new modules names have the form
"Api_versions".
This commit is contained in:
Richard W.M. Jones
2012-09-02 18:26:48 +01:00
parent 11d655ab83
commit d331fd70e2
38 changed files with 247 additions and 250 deletions

View File

@@ -16,41 +16,41 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
SOURCES = \
generator_types.ml \
generator_utils.mli \
generator_utils.ml \
generator_actions.mli \
generator_actions.ml \
generator_structs.mli \
generator_structs.ml \
generator_api_versions.mli \
generator_api_versions.ml \
generator_optgroups.ml \
generator_prepopts.mli \
generator_prepopts.ml \
generator_events.ml \
generator_pr.mli \
generator_pr.ml \
generator_docstrings.ml \
generator_checks.ml \
generator_c.ml \
generator_xdr.ml \
generator_daemon.ml \
generator_tests_c_api.ml \
generator_fish.ml \
generator_ocaml.ml \
generator_perl.ml \
generator_python.ml \
generator_ruby.ml \
generator_java.ml \
generator_haskell.ml \
generator_csharp.ml \
generator_php.ml \
generator_erlang.ml \
generator_gobject.ml \
generator_bindtests.ml \
generator_errnostring.ml \
generator_main.ml
types.ml \
utils.mli \
utils.ml \
actions.mli \
actions.ml \
structs.mli \
structs.ml \
api_versions.mli \
api_versions.ml \
optgroups.ml \
prepopts.mli \
prepopts.ml \
events.ml \
pr.mli \
pr.ml \
docstrings.ml \
checks.ml \
c.ml \
xdr.ml \
daemon.ml \
tests_c_api.ml \
fish.ml \
ocaml.ml \
perl.ml \
python.ml \
ruby.ml \
java.ml \
haskell.ml \
csharp.ml \
php.ml \
erlang.ml \
gobject.ml \
bindtests.ml \
errnostring.ml \
main.ml
SOURCES_ML = $(filter %.ml,$(SOURCES))
OBJECTS = $(SOURCES_ML:.ml=.cmo)

View File

@@ -2,8 +2,8 @@ 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.
'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
@@ -19,19 +19,19 @@ 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.
(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:
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.
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:

View File

@@ -18,8 +18,8 @@
(* Please read generator/README first. *)
open Generator_types
open Generator_utils
open Types
open Utils
(* Default settings for all action fields. So we copy and override
* this struct by writing '{ defaults with name = &c }'

View File

@@ -20,24 +20,24 @@
(** The libguestfs API. *)
val non_daemon_functions : Generator_types.action list
val non_daemon_functions : Types.action list
(** API actions which are implemented within the library itself. *)
val daemon_functions : Generator_types.action list
val daemon_functions : Types.action list
(** API actions which are implemented by the daemon. *)
val all_functions : Generator_types.action list
val all_functions : Types.action list
(** Concatenation of [non_daemon_functions] and [daemon_functions] lists. *)
val all_functions_sorted : Generator_types.action list
val all_functions_sorted : Types.action list
(** [all_functions] but sorted by name. *)
val test_functions : Generator_types.action list
val test_functions : Types.action list
(** Internal test functions used to test the language bindings. *)
val max_proc_nr : int
(** The largest procedure number used (also saved in [src/MAX_PROC_NR] and
used as the minor version number of the shared library). *)
val fish_commands : Generator_types.action list
val fish_commands : Types.action list
(** Non-API meta-commands available only in guestfish. *)

View File

@@ -18,7 +18,7 @@
(* Please read generator/README first. *)
open Generator_utils
open Utils
let hash = Hashtbl.create 13

View File

@@ -20,14 +20,14 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
let rec generate_bindtests () =
generate_header CStyle LGPLv2plus;

View File

@@ -20,15 +20,15 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_api_versions
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Api_versions
open Optgroups
open Actions
open Structs
open Events
(* Generate C API. *)

View File

@@ -18,9 +18,9 @@
(* Please read generator/README first. *)
open Generator_types
open Generator_utils
open Generator_actions
open Types
open Utils
open Actions
(* Check function names etc. for consistency. *)
let () =

View File

@@ -20,13 +20,13 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
let rec generate_csharp () =
generate_header CPlusPlusStyle LGPLv2plus;

View File

@@ -20,14 +20,14 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
(* Generate daemon/actions.h. *)
let generate_daemon_actions_h () =

View File

@@ -21,9 +21,9 @@
open Unix
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Types
open Utils
open Pr
(* Handling for function flags. *)
let progress_message =

View File

@@ -20,15 +20,15 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
open Events
let rec generate_erlang_erl () =
generate_header ErlangStyle LGPLv2plus;

View File

@@ -20,10 +20,10 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Types
open Utils
open Pr
open Docstrings
(* Generate the functions errno_to_string and string_to_errno which
* convert errno (eg. EINVAL) into string ("EINVAL") and back again,
@@ -179,7 +179,7 @@ let errnos = [
let () =
(* Check list is sorted and no duplicates. *)
let file = "generator/generator_errnostring.ml" in
let file = "generator/errnostring.ml" in
let check str =
let len = String.length str in
if len == 0 || len > 32 then

View File

@@ -18,7 +18,7 @@
(* Please read generator/README first. *)
open Generator_utils
open Utils
(* NB: DO NOT REORDER THESE, as doing so will change the ABI. Only
* add new event types at the end of the list.

View File

@@ -20,16 +20,16 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_prepopts
open Generator_c
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open Prepopts
open C
open Events
let doc_opttype_of = function
| OBool n -> "true|false"

View File

@@ -22,13 +22,13 @@
open Printf
open Generator_actions
open Generator_docstrings
open Generator_events
open Generator_pr
open Generator_structs
open Generator_types
open Generator_utils
open Actions
open Docstrings
open Events
open Pr
open Structs
open Types
open Utils
let camel_of_name { camel_name = camel_name } = "Guestfs" ^ camel_name

View File

@@ -20,13 +20,13 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
let rec generate_haskell_hs () =
generate_header HaskellStyle LGPLv2plus;

View File

@@ -20,14 +20,14 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
(* Generate Java bindings GuestFS.java file. *)
let rec generate_java_java () =

View File

@@ -21,27 +21,27 @@
open Unix
open Printf
open Generator_pr
open Generator_structs
open Generator_api_versions
open Pr
open Structs
open Api_versions
open Generator_c
open Generator_xdr
open Generator_daemon
open Generator_tests_c_api
open Generator_fish
open Generator_ocaml
open Generator_perl
open Generator_python
open Generator_ruby
open Generator_java
open Generator_haskell
open Generator_csharp
open Generator_php
open Generator_erlang
open Generator_gobject
open Generator_bindtests
open Generator_errnostring
open C
open Xdr
open Daemon
open Tests_c_api
open Fish
open Ocaml
open Perl
open Python
open Ruby
open Java
open Haskell
open Csharp
open Php
open Erlang
open Gobject
open Bindtests
open Errnostring
let perror msg = function
| Unix_error (err, _, _) ->

View File

@@ -20,15 +20,15 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
open Events
(* Generate the OCaml bindings interface. *)
let rec generate_ocaml_mli () =

View File

@@ -18,8 +18,8 @@
(* Please read generator/README first. *)
open Generator_types
open Generator_actions
open Types
open Actions
(* Create list of optional groups. *)
let optgroups =

View File

@@ -20,15 +20,15 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
open Events
(* Generate Perl xs code, a sort of crazy variation of C with macros. *)
let rec generate_perl_xs () =

View File

@@ -20,14 +20,14 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
let rec generate_php_h () =
generate_header CStyle LGPLv2plus;

View File

@@ -21,7 +21,7 @@
open Unix
open Printf
open Generator_utils
open Utils
(* Output channel, 'pr' prints to this. *)
let chan = ref Pervasives.stdout

View File

@@ -20,15 +20,15 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
open Events
(* Generate Python C module. *)
let rec generate_python_c () =

View File

@@ -20,15 +20,15 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Generator_c
open Generator_events
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
open C
open Events
(* Generate ruby bindings. *)
let rec generate_ruby_c () =

View File

@@ -18,8 +18,8 @@
(* Please read generator/README first. *)
open Generator_types
open Generator_utils
open Types
open Utils
type cols = (string * field) list

View File

@@ -20,7 +20,7 @@
(** Structures returned by the API. *)
type cols = (string * Generator_types.field) list
type cols = (string * Types.field) list
(** List of structure fields (called "columns"). *)
val structs : (string * cols) list

View File

@@ -20,13 +20,13 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
(* Generate the tests. *)
let rec generate_tests () =

View File

@@ -383,7 +383,7 @@ and test_init =
and seq = cmd list
and cmd = string list
(* Type of an action as declared in Generator_actions module. *)
(* Type of an action as declared in Actions module. *)
type action = {
name : string; (* name, not including "guestfs_" *)
style : style; (* args and return value *)

View File

@@ -26,7 +26,7 @@
open Unix
open Printf
open Generator_types
open Types
let errcode_of_ret = function
| RConstOptString _ ->
@@ -45,16 +45,14 @@ let string_of_errcode = function
(* Generate a uuidgen-compatible UUID (used in tests). However to
* avoid having the UUID change every time we rebuild the tests,
* generate it as a function of the contents of the
* generator_actions.ml file.
* generate it as a function of the contents of the actions.ml file.
*
* Originally I thought uuidgen was using RFC 4122, but it doesn't
* appear to.
*
* Note that the format must be 01234567-0123-0123-0123-0123456789ab
*)
*
* Note that the format must be 01234567-0123-0123-0123-0123456789ab *)
let uuidgen () =
let s = Digest.to_hex (Digest.file "generator/generator_actions.ml") in
let s = Digest.to_hex (Digest.file "generator/actions.ml") in
(* In util-linux <= 2.19, mkswap -U cannot handle the first byte of
* the UUID being zero, so we artificially rewrite such UUIDs.

View File

@@ -20,7 +20,7 @@
(** Useful utility functions. *)
val errcode_of_ret : Generator_types.ret -> Generator_types.errcode
val errcode_of_ret : Types.ret -> Types.errcode
(** Map [ret] type to the error indication that the action returns,
eg. [errcode_of_ret RErr] => [`ErrorIsMinusOne] (meaning that
these actions return [-1]).
@@ -37,7 +37,7 @@ val uuidgen : unit -> string
type rstructs_used_t = RStructOnly | RStructListOnly | RStructAndList
(** Return type of {!rstructs_used_by}. *)
val rstructs_used_by : Generator_types.action list -> (string * rstructs_used_t) list
val rstructs_used_by : Types.action list -> (string * rstructs_used_t) list
(** Returns a list of RStruct/RStructList structs that are returned
by any function. *)
@@ -93,13 +93,13 @@ val explode : string -> char list
val map_chars : (char -> 'a) -> string -> 'a list
(** Explode string, then map function over the characters. *)
val name_of_argt : Generator_types.argt -> string
val name_of_argt : Types.argt -> string
(** Extract argument name. *)
val name_of_optargt : Generator_types.optargt -> string
val name_of_optargt : Types.optargt -> string
(** Extract optional argument name. *)
val seq_of_test : Generator_types.test -> Generator_types.seq
val seq_of_test : Types.test -> Types.seq
(** Extract test sequence from a test. *)
val c_quote : string -> string
@@ -120,7 +120,7 @@ val pod2text : ?width:int -> ?trim:bool -> ?discard:bool -> string -> string ->
This is the slowest part of autogeneration, so the results are
memoized into a temporary file. *)
val action_compare : Generator_types.action -> Generator_types.action -> int
val action_compare : Types.action -> Types.action -> int
(** Compare the names of two actions, for sorting. *)
val chars : char -> int -> string
@@ -129,5 +129,5 @@ val chars : char -> int -> string
val spaces : int -> string
(** [spaces n] creates a string of n spaces. *)
val args_of_optargs : Generator_types.optargs -> Generator_types.args
val args_of_optargs : Types.optargs -> Types.args
(** Convert a list of optargs into an equivalent list of args *)

View File

@@ -20,13 +20,13 @@
open Printf
open Generator_types
open Generator_utils
open Generator_pr
open Generator_docstrings
open Generator_optgroups
open Generator_actions
open Generator_structs
open Types
open Utils
open Pr
open Docstrings
open Optgroups
open Actions
open Structs
(* Generate the protocol (XDR) file, 'guestfs_protocol.x' and
* indirectly 'guestfs_protocol.h' and 'guestfs_protocol.c'.

View File

@@ -2877,7 +2877,7 @@ To add a new API action there are two changes:
=item 1.
You need to add a description of the call (name, parameters, return
type, tests, documentation) to C<generator/generator_actions.ml>.
type, tests, documentation) to C<generator/actions.ml>.
There are two sorts of API action, depending on whether the call goes
through to the daemon in the appliance, or is serviced entirely by the
@@ -2923,13 +2923,12 @@ the OCaml description.
You can supply zero or as many tests as you want per API call. The
tests can either be added as part of the API description
(C<generator/generator_actions.ml>), or in some rarer cases you may
want to drop a script into C<tests/*/>. Note that adding
a script to C<tests/*/> is slower, so if possible use the
first method.
(C<generator/actions.ml>), or in some rarer cases you may want to drop
a script into C<tests/*/>. Note that adding a script to C<tests/*/>
is slower, so if possible use the first method.
The following describes the test environment used when you add an API
test in C<generator_actions.ml>.
test in C<actions.ml>.
The test environment has 4 block devices:
@@ -2959,10 +2958,10 @@ libguestfs appliance and block devices are reused between tests. So
don't try testing L</guestfs_kill_subprocess> :-x
Each test starts with an initial scenario, selected using one of the
C<Init*> expressions, described in C<generator/generator_types.ml>.
These initialize the disks mentioned above in a particular way as
documented in C<generator_types.ml>. You should not assume anything
about the previous contents of other disks that are not initialized.
C<Init*> expressions, described in C<generator/types.ml>. These
initialize the disks mentioned above in a particular way as documented
in C<types.ml>. You should not assume anything about the previous
contents of other disks that are not initialized.
You can add a prerequisite clause to any individual test. This is a
run-time check, which, if it fails, causes the test to be skipped.