[Libguestfs] [PATCH 2/2] generator: Generate copyright notice in generated POD fragments.

Richard W.M. Jones rjones at redhat.com
Tue Mar 18 13:31:50 UTC 2014


Using =begin comment ... =end comment.
---
 generator/c.ml          | 6 ++++++
 generator/docstrings.ml | 6 ++++--
 generator/fish.ml       | 6 ++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/generator/c.ml b/generator/c.ml
index 4b244a5..ee276dc 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -208,6 +208,8 @@ and generate_c_call_args ?handle ?(implicit_size_ptr = "&size")
 
 (* Generate the pod documentation for the C API. *)
 and generate_actions_pod () =
+  generate_header PODStyle GPLv2plus;
+
   List.iter (
     function
     | ({ once_had_no_optargs = false } as f) ->
@@ -342,6 +344,8 @@ and generate_actions_pod_back_compat_entry { name = name;
   pr "\n"
 
 and generate_structs_pod () =
+  generate_header PODStyle GPLv2plus;
+
   (* Structs documentation. *)
   List.iter (
     fun { s_name = typ; s_cols = cols } ->
@@ -391,6 +395,8 @@ and generate_structs_pod () =
   ) structs
 
 and generate_availability_pod () =
+  generate_header PODStyle GPLv2plus;
+
   (* Availability documentation. *)
   pr "=over 4\n";
   pr "\n";
diff --git a/generator/docstrings.ml b/generator/docstrings.ml
index 01a3671..904a9e5 100644
--- a/generator/docstrings.ml
+++ b/generator/docstrings.ml
@@ -58,7 +58,7 @@ let copyright_years =
 (* Generate a header block in a number of standard styles. *)
 type comment_style =
     CStyle | CPlusPlusStyle | HashStyle | OCamlStyle | HaskellStyle
-  | ErlangStyle | LuaStyle
+  | ErlangStyle | LuaStyle | PODStyle
 type license = GPLv2plus | LGPLv2plus
 
 let generate_header ?(extra_inputs = []) ?emacs_mode comment license =
@@ -70,7 +70,8 @@ let generate_header ?(extra_inputs = []) ?emacs_mode comment license =
     | OCamlStyle ->     pr "(* "; " *"
     | HaskellStyle ->   pr "{- "; "  "
     | ErlangStyle ->    pr "%% "; "% "
-    | LuaStyle ->       pr "-- "; "--" in
+    | LuaStyle ->       pr "-- "; "--"
+    | PODStyle ->       pr "=begin comment\n\n"; "" in
   pr "libguestfs generated file";
   (match emacs_mode with
   | None -> ()
@@ -122,5 +123,6 @@ let generate_header ?(extra_inputs = []) ?emacs_mode comment license =
    | HashStyle -> ()
    | OCamlStyle -> pr " *)\n"
    | HaskellStyle -> pr "-}\n"
+   | PODStyle -> pr "\n=end comment\n"
   );
   pr "\n"
diff --git a/generator/fish.ml b/generator/fish.ml
index fb3d0f6..db800ef 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -838,6 +838,8 @@ do_completion (const char *text, int start, int end)
 
 (* Generate the POD documentation for guestfish. *)
 and generate_fish_actions_pod () =
+  generate_header PODStyle GPLv2plus;
+
   let fishdoc_functions_sorted =
     List.filter is_documented fish_functions_sorted
   in
@@ -908,6 +910,8 @@ Guestfish will prompt for these separately.\n\n";
 
 (* Generate documentation for guestfish-only commands. *)
 and generate_fish_commands_pod () =
+  generate_header PODStyle GPLv2plus;
+
   List.iter (
     fun ({ name = name; longdesc = longdesc } as f) ->
       let aliases = get_aliases f in
@@ -1018,6 +1022,8 @@ and generate_fish_prep_options_c () =
   pr "};\n"
 
 and generate_fish_prep_options_pod () =
+  generate_header PODStyle GPLv2plus;
+
   List.iter (
     fun (name, shortdesc, args, longdesc) ->
       pr "=head2 B<-N %s> - %s\n" name shortdesc;
-- 
1.8.5.3




More information about the Libguestfs mailing list