[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 10/27] libxl: ocaml: generate string_of_* functions for enums
On Wed, 2013-11-06 at 17:49 +0000, Rob Hoes wrote: > Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> > Acked-by: David Scott <dave.scott@xxxxxxxxxxxxx> Acked-by:Ian Campbell <ian.campbell@xxxxxxxxxx> > > --- > v4: Now using v.valuename, as suggested by Ian. > --- > tools/ocaml/libs/xl/genwrap.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py > index bdae886..0f73e26 100644 > --- a/tools/ocaml/libs/xl/genwrap.py > +++ b/tools/ocaml/libs/xl/genwrap.py > @@ -162,6 +162,14 @@ def gen_ocaml_ml(ty, interface, indent=""): > s += "type %s = \n" % ty.rawname > for v in ty.values: > s += "\t | %s\n" % v.rawname > + > + if interface: > + s += "\nval string_of_%s : %s -> string\n" % (ty.rawname, > ty.rawname) > + else: > + s += "\nlet string_of_%s = function\n" % ty.rawname > + for v in ty.values: > + s += '\t| %s -> "%s"\n' % (v.rawname, v.valuename) > + > elif isinstance(ty, idl.Aggregate): > s += "" > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |