X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_ocaml.ml;h=860242c7e53f606ca9de7821a151b8aef9083fa4;hp=888a15274ecf02e90b2bdd103873e0756c682eaa;hb=692f127447d399db21c2e93026d4d2b0ac1839d1;hpb=14490c3e1aac61c6ac90f28828896683f64f0dc9 diff --git a/generator/generator_ocaml.ml b/generator/generator_ocaml.ml index 888a152..860242c 100644 --- a/generator/generator_ocaml.ml +++ b/generator/generator_ocaml.ml @@ -198,6 +198,7 @@ and generate_ocaml_c () = #include #include #include +#include #include #include @@ -400,6 +401,8 @@ copy_table (char * const * argv) pr " int %s = Int_val (%sv);\n" n n | Int64 n -> pr " int64_t %s = Int64_val (%sv);\n" n n + | Pointer (t, n) -> + pr " %s %s = (%s) (intptr_t) Int64_val (%sv);\n" t n t n ) args; (* Optional arguments. *) @@ -471,7 +474,7 @@ copy_table (char * const * argv) pr " free (%s);\n" n | StringList n | DeviceList n -> pr " ocaml_guestfs_free_strings (%s);\n" n; - | Bool _ | Int _ | Int64 _ -> () + | Bool _ | Int _ | Int64 _ | Pointer _ -> () ) args; List.iter ( function @@ -481,7 +484,7 @@ copy_table (char * const * argv) | Bool _ | Int _ | Int64 _ | Pathname _ | Device _ | Dev_or_Path _ | OptString _ | FileIn _ | FileOut _ | BufferIn _ | Key _ - | StringList _ | DeviceList _ -> () + | StringList _ | DeviceList _ | Pointer _ -> () ) optargs; pr " if (r == %s)\n" error_code; @@ -592,7 +595,7 @@ and generate_ocaml_function_type (ret, args, optargs) = | StringList _ | DeviceList _ -> pr "string array -> " | Bool _ -> pr "bool -> " | Int _ -> pr "int -> " - | Int64 _ -> pr "int64 -> " + | Int64 _ | Pointer _ -> pr "int64 -> " ) args; (match ret with | RErr -> pr "unit" (* all errors are turned into exceptions *)