diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-07-12 16:27:38 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-07-13 09:00:25 +0100 |
commit | 60805c92179bc193be2d125504b12d285ff7c74b (patch) | |
tree | 38441b5550fb51ada6b247d5919587d3aadaeaa1 /generator/generator_ocaml.ml | |
parent | 9286f556c6a9e6967fcac8aacdae3660821c4c7a (diff) | |
download | libguestfs-60805c92179bc193be2d125504b12d285ff7c74b.tar.gz libguestfs-60805c92179bc193be2d125504b12d285ff7c74b.tar.xz libguestfs-60805c92179bc193be2d125504b12d285ff7c74b.zip |
generator: Add c_optarg_prefix for each action.
This updates commit 9286f556c6a9e6967fcac8aacdae3660821c4c7a.
Diffstat (limited to 'generator/generator_ocaml.ml')
-rw-r--r-- | generator/generator_ocaml.ml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/generator/generator_ocaml.ml b/generator/generator_ocaml.ml index 9eb58302..f54ed2c3 100644 --- a/generator/generator_ocaml.ml +++ b/generator/generator_ocaml.ml @@ -409,7 +409,7 @@ copy_table (char * const * argv) (* The wrappers. *) List.iter ( fun { name = name; style = (ret, args, optargs as style); - c_function = c_function } -> + c_function = c_function; c_optarg_prefix = c_optarg_prefix } -> pr "/* Automatically generated wrapper for function\n"; pr " * "; generate_ocaml_prototype name style; @@ -497,15 +497,14 @@ copy_table (char * const * argv) (* Optional arguments. *) if optargs <> [] then ( - pr " struct guestfs_%s_argv optargs_s = { .bitmask = 0 };\n" name; - pr " struct guestfs_%s_argv *optargs = &optargs_s;\n" name; - let uc_name = String.uppercase name in + pr " struct %s optargs_s = { .bitmask = 0 };\n" c_function; + pr " struct %s *optargs = &optargs_s;\n" c_function; List.iter ( fun argt -> let n = name_of_optargt argt in let uc_n = String.uppercase n in pr " if (%sv != Val_int (0)) {\n" n; - pr " optargs_s.bitmask |= GUESTFS_%s_%s_BITMASK;\n" uc_name uc_n; + pr " optargs_s.bitmask |= %s_%s_BITMASK;\n" c_optarg_prefix uc_n; pr " optargs_s.%s = " n; (match argt with | OBool _ -> pr "Bool_val (Field (%sv, 0))" n |