open Generator_utils
open Generator_pr
open Generator_docstrings
+open Generator_api_versions
open Generator_optgroups
open Generator_actions
open Generator_structs
let next () =
if !comma then (
if single_line then pr ", "
- else
- pr ",\n%s%s"
- indent (spaces (String.length prefix + String.length name + 2))
+ else (
+ let namelen = String.length prefix + String.length name +
+ String.length suffix + 2 in
+ pr ",\n%s%s" indent (spaces namelen)
+ )
);
comma := true
in
| None -> ()
| Some txt -> pr "%s\n\n" txt
);
+ (match lookup_api_version name with
+ | Some version -> pr "(Added in %s)\n\n" version
+ | None -> ()
+ );
(* Handling of optional argument variants. *)
if optargs <> [] then (
pr "=head2 %s_va\n\n" name;
- pr " ";
- generate_prototype ~extern:false ~handle:"g"
+ generate_prototype ~extern:false ~indent:" " ~handle:"g"
~prefix:"guestfs_" ~suffix:"_va" ~optarg_proto:VA
shortname style;
pr "\n\n";
pr "This is the \"va_list variant\" of L</%s>.\n\n" name;
pr "See L</CALLS WITH OPTIONAL ARGUMENTS>.\n\n";
pr "=head2 %s_argv\n\n" name;
- pr " ";
- generate_prototype ~extern:false ~handle:"g"
+ generate_prototype ~extern:false ~indent:" " ~handle:"g"
~prefix:"guestfs_" ~suffix:"_argv" ~optarg_proto:Argv
shortname style;
pr "\n\n";
| Pathname n
| Dev_or_Path n
| FileIn n
- | FileOut n
- | Key n ->
+ | FileOut n ->
(* guestfish doesn't support string escaping, so neither do we *)
pr " fprintf (stderr, \" \\\"%%s\\\"\", %s);\n" n
+ | Key n ->
+ (* don't print keys *)
+ pr " fprintf (stderr, \" \\\"***\\\"\");\n"
| OptString n -> (* string option *)
pr " if (%s) fprintf (stderr, \" \\\"%%s\\\"\", %s);\n" n n;
pr " else fprintf (stderr, \" null\");\n"