X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_ocaml.ml;h=9db69dcf1f9a4d3b255bdae8ec7fb86b7cbc4c3c;hp=483d65a28a7213dae93b22c33ff8fb2d644b8bec;hb=ed74706d80394fef709ec0258fc5cf7d974ff8b1;hpb=6af1cd7245de0183404ea6aadda4c2f63f9f616b diff --git a/generator/generator_ocaml.ml b/generator/generator_ocaml.ml index 483d65a..9db69dc 100644 --- a/generator/generator_ocaml.ml +++ b/generator/generator_ocaml.ml @@ -102,6 +102,11 @@ val clear_progress_callback : t -> unit it offers exactly the same functionality. Calling [new guestfs ()] creates both the object and the handle. + The object and handle are closed either implicitly when the + object is garbage collected, or explicitly by calling the [g#close ()] + method. + + You can get the {!Guestfs.t} handle by calling [g#ocaml_handle]. Note that methods that take no parameters (except the implicit handle) get an extra unit [()] parameter. This is so you can create a @@ -112,6 +117,7 @@ class guestfs : unit -> object method close : unit -> unit method set_progress_callback : progress_cb -> unit method clear_progress_callback : unit -> unit + method ocaml_handle : t "; List.iter ( @@ -171,6 +177,7 @@ class guestfs () = method close () = close g method set_progress_callback = set_progress_callback g method clear_progress_callback () = clear_progress_callback g + method ocaml_handle = g "; List.iter ( @@ -373,7 +380,7 @@ copy_table (char * const * argv) pr " char *%s = guestfs_safe_strdup (g, String_val (%sv));\n" n n | OptString n -> pr " char *%s =\n" n; - pr " %sv != Val_int (0) ?" n; + pr " %sv != Val_int (0) ?\n" n; pr " guestfs_safe_strdup (g, String_val (Field (%sv, 0))) : NULL;\n" n | BufferIn n -> pr " size_t %s_size = caml_string_length (%sv);\n" n n;