diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-11-09 17:48:42 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-11-09 21:21:49 +0000 |
commit | 29172e7c4878085a680812f7f3b8ad6ea5f1193c (patch) | |
tree | 093d47082f2e5b2a3efd625a0a2388f87c179e9d /generator/generator_ocaml.ml | |
parent | af2b0378bbb178a4e3db326ac3082d66170fcafc (diff) | |
download | libguestfs-29172e7c4878085a680812f7f3b8ad6ea5f1193c.tar.gz libguestfs-29172e7c4878085a680812f7f3b8ad6ea5f1193c.tar.xz libguestfs-29172e7c4878085a680812f7f3b8ad6ea5f1193c.zip |
ocaml: Fix bindings when a function takes more than 10 parameters.
If any function had more than 10 required + optional parameters, OCaml
bindings could not be generated. Currently there are no such
functions.
Diffstat (limited to 'generator/generator_ocaml.ml')
-rw-r--r-- | generator/generator_ocaml.ml | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/generator/generator_ocaml.ml b/generator/generator_ocaml.ml index 51bc3d66..4f7548c5 100644 --- a/generator/generator_ocaml.ml +++ b/generator/generator_ocaml.ml @@ -440,13 +440,23 @@ copy_table (char * const * argv) pr ")\n"; pr "{\n"; + (* CAMLparam<N> can only take up to 5 parameters. Further parameters + * have to be passed in groups of 5 to CAMLxparam<N> calls. + *) (match params with - | [p1; p2; p3; p4; p5] -> - pr " CAMLparam5 (%s);\n" (String.concat ", " params) | p1 :: p2 :: p3 :: p4 :: p5 :: rest -> pr " CAMLparam5 (%s);\n" (String.concat ", " [p1; p2; p3; p4; p5]); - pr " CAMLxparam%d (%s);\n" - (List.length rest) (String.concat ", " rest) + let rec loop = function + | [] -> () + | p1 :: p2 :: p3 :: p4 :: p5 :: rest -> + pr " CAMLxparam5 (%s);\n" + (String.concat ", " [p1; p2; p3; p4; p5]); + loop rest + | rest -> + pr " CAMLxparam%d (%s);\n" + (List.length rest) (String.concat ", " rest) + in + loop rest | ps -> pr " CAMLparam%d (%s);\n" (List.length ps) (String.concat ", " ps) ); |