---
generator/generator_gobject.ml | 52 ++++++++++++++++++++--------------------
1 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/generator/generator_gobject.ml b/generator/generator_gobject.ml
index b01cdb3..2b151c6 100644
--- a/generator/generator_gobject.ml
+++ b/generator/generator_gobject.ml
@@ -27,7 +27,7 @@ open Generator_structs
open Generator_types
open Generator_utils
-let rec camel_of_name flags name =
+let camel_of_name flags name =
"Guestfs" ^
try
find_map (function CamelName n -> Some n | _ -> None) flags
@@ -37,11 +37,11 @@ let rec camel_of_name flags name =
a ^ String.uppercase (Str.first_chars b 1) ^ Str.string_after b 1
) "" (Str.split (regexp "_") name)
-and returns_error (ret:Generator_types.ret) = match ret with
+let returns_error = function
| RConstOptString _ -> false
| _ -> true
-and generate_gobject_proto name ?(single_line = true)
+let generate_gobject_proto name ?(single_line = true)
(ret, args, optargs) flags =
let spacer = if single_line then " " else "\n" in
let ptr_spacer = if single_line then "" else "\n" in
@@ -110,9 +110,9 @@ and generate_gobject_proto name ?(single_line = true)
if List.exists (function Cancellable -> true | _ -> false) flags then
pr ", GCancellable *cancellable";
if returns_error ret then pr ", GError **err";
- pr ")";
+ pr ")"
-and generate_gobject_header_static () =
+let generate_gobject_header_static () =
pr "
#ifndef GUESTFS_GOBJECT_H__
#define GUESTFS_GOBJECT_H__
@@ -174,7 +174,7 @@ GType guestfs_tristate_get_type(void);
"
-and generate_gobject_header_static_footer () =
+let generate_gobject_header_static_footer () =
pr "
G_END_DECLS
@@ -182,7 +182,7 @@ G_END_DECLS
#endif /* GUESTFS_GOBJECT_H__ */
"
-and generate_gobject_header_structs () =
+let generate_gobject_header_structs () =
pr "/* Structs */\n";
List.iter (
fun (typ, cols) ->
@@ -215,9 +215,9 @@ and generate_gobject_header_structs () =
) cols;
pr "};\n";
pr "GType guestfs_%s_get_type(void);\n\n" typ;
- ) structs;
+ ) structs
-and iter_optargs f =
+let iter_optargs f =
List.iter (
function
| name, (_, _, (_::_ as optargs)), _, flags,_, _, _ ->
@@ -225,7 +225,7 @@ and iter_optargs f =
| _ -> ()
)
-and generate_gobject_header_optarg name optargs flags =
+let generate_gobject_header_optarg name optargs flags =
let uc_name = String.uppercase name in
let camel_name = camel_of_name flags name in
let type_define = "GUESTFS_TYPE_" ^ uc_name in
@@ -272,24 +272,24 @@ and generate_gobject_header_optarg name optargs flags =
pr "GType guestfs_%s_get_type(void);\n" name;
pr "%s *guestfs_%s_new(void);\n" camel_name name;
- pr "\n";
+ pr "\n"
-and generate_gobject_header_optargs () =
+let generate_gobject_header_optargs () =
pr "/* Optional arguments */\n\n";
iter_optargs (
fun name optargs flags ->
generate_gobject_header_optarg name optargs flags
- ) all_functions;
+ ) all_functions
-and generate_gobject_header_methods () =
+let generate_gobject_header_methods () =
pr "/* Generated methods */\n";
List.iter (
fun (name, style, _, flags, _, _, _) ->
generate_gobject_proto name style flags;
pr ";\n";
- ) all_functions;
+ ) all_functions
-and generate_gobject_c_static () =
+let generate_gobject_c_static () =
pr "
#include <glib.h>
#include <glib-object.h>
@@ -399,7 +399,7 @@ cancelled_handler(gpointer data)
"
-and generate_gobject_c_structs () =
+let generate_gobject_c_structs () =
pr "/* Structs */\n\n";
List.iter (
fun (typ, cols) ->
@@ -423,7 +423,7 @@ and generate_gobject_c_structs () =
camel_name name name name;
) structs
-and generate_gobject_c_optarg name optargs flags =
+let generate_gobject_c_optarg name optargs flags =
let uc_name = String.uppercase name in
let camel_name = camel_of_name flags name in
let type_define = "GUESTFS_TYPE_" ^ uc_name in
@@ -584,17 +584,17 @@ and generate_gobject_c_optarg name optargs flags =
pr "guestfs_%s_new(void)\n" name;
pr "{\n";
pr " return GUESTFS_%s(g_object_new(%s, NULL));\n" uc_name type_define;
- pr "}\n\n";
+ pr "}\n\n"
-and generate_gobject_c_optargs () =
+let generate_gobject_c_optargs () =
pr "/* Optarg objects */\n\n";
iter_optargs (
fun name optargs flags ->
generate_gobject_c_optarg name optargs flags
- ) all_functions;
+ ) all_functions
-and generate_gobject_c_methods () =
+let generate_gobject_c_methods () =
pr "/* Generated methods */\n\n";
List.iter (
@@ -860,17 +860,17 @@ and generate_gobject_c_methods () =
);
pr "}\n\n";
- ) all_functions;
+ ) all_functions
-and generate_gobject_header () =
+let generate_gobject_header () =
generate_header CStyle GPLv2plus;
generate_gobject_header_static ();
generate_gobject_header_structs ();
generate_gobject_header_optargs ();
generate_gobject_header_methods ();
- generate_gobject_header_static_footer ();
+ generate_gobject_header_static_footer ()
-and generate_gobject_c () =
+let generate_gobject_c () =
generate_header CStyle GPLv2plus;
generate_gobject_c_static ();
generate_gobject_c_structs ();
--
1.7.7.5