[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3-RESEND 10/28] libxl: ocaml: generate string_of_* functions for enums



On Mon, 2013-10-21 at 14:32 +0100, Rob Hoes wrote:
> Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
> +        if interface:
> +            s += "\nval string_of_%s : %s -> string\n" % (ty.rawname, 
> ty.rawname)
> +        else:
> +            s += "\nlet string_of_%s = function\n" % ty.rawname
> +            n = len(ty.rawname) + 1
> +            for v in ty.values:
> +                s += '\t| %s -> "%s"\n' % (v.rawname, v.rawname[n:])

Is n here trying to strip the libxl_ prefix? Oh no, its the enum name
prefix.

v.valuename is unhelpfully upper-cased (this might be an error in id.py
TBH). But I think v.valuename.lower() (or whatever case munging ocaml
requires) would be fine here.

Or you could trivially add v.basename or something similar to
tools/libxl/idl.{txt,py} I think.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.