X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_utils.mli;h=5dc4da25fa3d8b7c257b5658a6529c088496b4f9;hp=7bc0dde18272048248e56c44955f759e8c086d64;hb=7739d7f471f9575828bd32489695d92dde005a9c;hpb=04d8209077d2227eb1d42695ba71147f78987050 diff --git a/generator/generator_utils.mli b/generator/generator_utils.mli index 7bc0dde..5dc4da2 100644 --- a/generator/generator_utils.mli +++ b/generator/generator_utils.mli @@ -1,5 +1,5 @@ (* libguestfs - * Copyright (C) 2009-2010 Red Hat Inc. + * Copyright (C) 2009-2011 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,17 @@ (** Useful utility functions. *) +val errcode_of_ret : Generator_types.ret -> Generator_types.errcode +(** Map [ret] type to the error indication that the action returns, + eg. [errcode_of_ret RErr] => [`ErrorIsMinusOne] (meaning that + these actions return [-1]). + + Note that [RConstOptString] cannot return an error indication, and + this returns [`CannotReturnError]. Callers must deal with it. *) + +val string_of_errcode : [`ErrorIsMinusOne|`ErrorIsNULL] -> string +(** Return errcode as a string. Untyped for [`CannotReturnError]. *) + val uuidgen : unit -> string (** Generate a random UUID (used in tests). *) @@ -91,8 +102,26 @@ val seq_of_test : Generator_types.test -> Generator_types.seq val c_quote : string -> string (** Perform quoting on a string so it is safe to include in a C source file. *) -val pod2text : width:int -> string -> string -> string list -(** [pod2text ~width name longdesc] converts the POD in [longdesc] to - plain ASCII lines of text. This is the slowest part of - autogeneration, so the results are memoized into a temporary - file. *) +val pod2text : ?width:int -> ?trim:bool -> ?discard:bool -> string -> string -> string list + (** [pod2text ?width ?trim ?discard name longdesc] converts the POD in + [longdesc] to plain ASCII lines of text. + + [width] is the width in characters. If not specified, then + use the pod2text default. + + [trim] means trim the left margin (useful when including the + output inside comments, as in Java generator). + + [discard] means discard the first heading. + + This is the slowest part of autogeneration, so the results are + memoized into a temporary file. *) + +val action_compare : Generator_types.action -> Generator_types.action -> int + (** Compare the names of two actions, for sorting. *) + +val chars : char -> int -> string +(** [chars c n] creates a string containing character c repeated n times. *) + +val spaces : int -> string +(** [spaces n] creates a string of n spaces. *)