git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3acec39
)
Code cleanup.
author
Richard Jones
<rjones@redhat.com>
Fri, 10 Apr 2009 09:52:38 +0000
(10:52 +0100)
committer
Richard Jones
<rjones@redhat.com>
Fri, 10 Apr 2009 09:52:38 +0000
(10:52 +0100)
src/generator.ml
patch
|
blob
|
history
diff --git
a/src/generator.ml
b/src/generator.ml
index
31aa4c1
..
a4d4d46
100755
(executable)
--- a/
src/generator.ml
+++ b/
src/generator.ml
@@
-25,7
+25,7
@@
* After editing this file, run it (./src/generator.ml) to regenerate
* all the output files.
*
* After editing this file, run it (./src/generator.ml) to regenerate
* all the output files.
*
- * IMPORTANT: This script should
not
print any warnings. If it prints
+ * IMPORTANT: This script should
NOT
print any warnings. If it prints
* warnings, you should treat them as errors.
* [Need to add -warn-error to ocaml command line]
*)
* warnings, you should treat them as errors.
* [Need to add -warn-error to ocaml command line]
*)
@@
-617,10
+617,6
@@
let iteri f xs =
in
loop 0 xs
in
loop 0 xs
-(* 'pr' prints to the current output file. *)
-let chan = ref stdout
-let pr fs = ksprintf (output_string !chan) fs
-
let name_of_argt = function String n | OptString n | Bool n | Int n -> n
(* Check function names etc. for consistency. *)
let name_of_argt = function String n | OptString n | Bool n | Int n -> n
(* Check function names etc. for consistency. *)
@@
-712,11
+708,15
@@
let check_functions () =
in
loop proc_nrs
in
loop proc_nrs
+(* 'pr' prints to the current output file. *)
+let chan = ref stdout
+let pr fs = ksprintf (output_string !chan) fs
+
+(* Generate a header block in a number of standard styles. *)
type comment_style = CStyle | HashStyle | OCamlStyle
type license = GPLv2 | LGPLv2
type comment_style = CStyle | HashStyle | OCamlStyle
type license = GPLv2 | LGPLv2
-(* Generate a header block in a number of standard styles. *)
-let rec generate_header comment license =
+let generate_header comment license =
let c = match comment with
| CStyle -> pr "/* "; " *"
| HashStyle -> pr "# "; "#"
let c = match comment with
| CStyle -> pr "/* "; " *"
| HashStyle -> pr "# "; "#"
@@
-765,8
+765,10
@@
let rec generate_header comment license =
);
pr "\n"
);
pr "\n"
+(* Start of main code generation functions below this line. *)
+
(* Generate the pod documentation for the C API. *)
(* Generate the pod documentation for the C API. *)
-
and
generate_actions_pod () =
+
let rec
generate_actions_pod () =
List.iter (
fun (shortname, style, _, flags, _, longdesc) ->
let name = "guestfs_" ^ shortname in
List.iter (
fun (shortname, style, _, flags, _, longdesc) ->
let name = "guestfs_" ^ shortname in
@@
-842,8
+844,9
@@
and generate_structs_pod () =
) ["pv", pv_cols; "vg", vg_cols; "lv", lv_cols]
(* Generate the protocol (XDR) file, 'guestfs_protocol.x' and
) ["pv", pv_cols; "vg", vg_cols; "lv", lv_cols]
(* Generate the protocol (XDR) file, 'guestfs_protocol.x' and
- * indirectly 'guestfs_protocol.h' and 'guestfs_protocol.c'. We
- * have to use an underscore instead of a dash because otherwise
+ * indirectly 'guestfs_protocol.h' and 'guestfs_protocol.c'.
+ *
+ * We have to use an underscore instead of a dash because otherwise
* rpcgen generates incorrect code.
*
* This header is NOT exported to clients, but see also generate_structs_h.
* rpcgen generates incorrect code.
*
* This header is NOT exported to clients, but see also generate_structs_h.
@@
-2561,6
+2564,15
@@
let output_to filename =
let () =
check_functions ();
let () =
check_functions ();
+ if not (Sys.file_exists "configure.ac") then (
+ eprintf "\
+You are probably running this from the wrong directory.
+Run it from the top source directory using the command
+ src/generator.ml
+";
+ exit 1
+ );
+
let close = output_to "src/guestfs_protocol.x" in
generate_xdr ();
close ();
let close = output_to "src/guestfs_protocol.x" in
generate_xdr ();
close ();