[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: Make IDL KeyedUnion keyvar an idl.Field
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330604775 0 # Node ID 5b850e935e37845ed0a7571447b81a5f0567861a # Parent 8dcccb97371f266174a91434264f3643d6ffde0e libxl: Make IDL KeyedUnion keyvar an idl.Field This is more logical than having keyvar_name and keyvar_type members. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r 8dcccb97371f -r 5b850e935e37 tools/libxl/gentest.py --- a/tools/libxl/gentest.py Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/gentest.py Thu Mar 01 12:26:15 2012 +0000 @@ -31,7 +31,7 @@ elif isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") - s += "switch (%s) {\n" % (parent + ty.keyvar_name) + s += "switch (%s) {\n" % (parent + ty.keyvar.name) for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None) s += "case %s:\n" % f.enumname diff -r 8dcccb97371f -r 5b850e935e37 tools/libxl/gentypes.py --- a/tools/libxl/gentypes.py Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/gentypes.py Thu Mar 01 12:26:15 2012 +0000 @@ -56,7 +56,7 @@ if isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") - s += "switch (%s) {\n" % (parent + ty.keyvar_name) + s += "switch (%s) {\n" % (parent + ty.keyvar.name) for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None) s += "case %s:\n" % f.enumname @@ -86,7 +86,7 @@ elif isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") - s += "switch (%s) {\n" % (parent + ty.keyvar_name) + s += "switch (%s) {\n" % (parent + ty.keyvar.name) for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None) s += "case %s:\n" % f.enumname diff -r 8dcccb97371f -r 5b850e935e37 tools/libxl/idl.py --- a/tools/libxl/idl.py Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/idl.py Thu Mar 01 12:26:15 2012 +0000 @@ -206,8 +206,9 @@ if not isinstance(keyvar_type, Enumeration): raise ValueError - self.keyvar_name = keyvar_name - self.keyvar_type = keyvar_type + kv_kwargs = dict([(x.lstrip('keyvar_'),y) for (x,y) in kwargs.items() if x.startswith('keyvar_')]) + + self.keyvar = Field(keyvar_type, keyvar_name, **kv_kwargs) for f in fields: # (name, enum, type) diff -r 8dcccb97371f -r 5b850e935e37 tools/libxl/idl.txt --- a/tools/libxl/idl.txt Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/idl.txt Thu Mar 01 12:26:15 2012 +0000 @@ -128,10 +128,9 @@ where the currently valid member of the union can be determined based upon another member in the containing type. - The KeyedUnion.keyvar_name must contain the name of the member of the + The KeyedUnion.keyvar contains an idl.type the member of the containing type which determines the valid member of the union. The - member referenced by KeyedUnion.keyvar_name has type - KeyedUnion.keyvar_type which must be an instance of the Enumeration type. + must be an instance of the Enumeration type. Standard Types -------------- _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |