summaryrefslogtreecommitdiffstats
path: root/generator/generator_utils.mli
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2012-01-09 10:16:35 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-01-10 15:41:15 +0000
commitae41a597178ece16e976fa9bdd0319745ad1e87a (patch)
tree00a4f45ae638683c1318743219500c45b448f531 /generator/generator_utils.mli
parentafc9f277733ae4f9b7599d50f4114b2d32725049 (diff)
downloadlibguestfs-ae41a597178ece16e976fa9bdd0319745ad1e87a.tar.gz
libguestfs-ae41a597178ece16e976fa9bdd0319745ad1e87a.tar.xz
libguestfs-ae41a597178ece16e976fa9bdd0319745ad1e87a.zip
generator: Create a separate type for optional arguments
Previously, optional arguments had the same type as regular arguments, but were constrained by various runtime tests to be only Bool, Int, Int64 or String. This change makes the type of optional arguments stronger by giving them their own type. A convenience function, optargs_to_args is defined to convert optargs in the few places where they are genuinely treated identically to mandatory arguments. It also allows for future changes to optional arguments which do not affect mandatory arguments. RWMJ: - removed redundant parens - readded the check for > 64 optargs, but changed it to > 63 - changed the new function to args_of_optargs (cherry picked from commit 0a7b734d2f54d4e98882532da9887feb66c9824a)
Diffstat (limited to 'generator/generator_utils.mli')
-rw-r--r--generator/generator_utils.mli6
1 files changed, 6 insertions, 0 deletions
diff --git a/generator/generator_utils.mli b/generator/generator_utils.mli
index 5dc4da25..29f23f2b 100644
--- a/generator/generator_utils.mli
+++ b/generator/generator_utils.mli
@@ -96,6 +96,9 @@ val map_chars : (char -> 'a) -> string -> 'a list
val name_of_argt : Generator_types.argt -> string
(** Extract argument name. *)
+val name_of_optargt : Generator_types.optargt -> string
+(** Extract optional argument name. *)
+
val seq_of_test : Generator_types.test -> Generator_types.seq
(** Extract test sequence from a test. *)
@@ -125,3 +128,6 @@ val chars : char -> int -> string
val spaces : int -> string
(** [spaces n] creates a string of n spaces. *)
+
+val args_of_optargs : Generator_types.optargs -> Generator_types.args
+(** Convert a list of optargs into an equivalent list of args *)