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

[Xen-changelog] [xen master] ocaml/gen: fix ocaml type/code generator from IDL



commit 7faae10654444174267b076ab994e06f9f08a080
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Fri Mar 3 12:19:21 2017 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Thu Mar 16 14:32:11 2017 +0000

    ocaml/gen: fix ocaml type/code generator from IDL
    
    This patch adds support for union members which have their own type name.
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: David Scott <dave@xxxxxxxxxx>
---
 tools/ocaml/libs/xl/genwrap.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py
index 1c8ad81..9a65d73 100644
--- a/tools/ocaml/libs/xl/genwrap.py
+++ b/tools/ocaml/libs/xl/genwrap.py
@@ -155,7 +155,7 @@ def gen_ocaml_keyedunions(ty, interface, indent, parent = 
None):
                 u.append("%s" % (f.name.capitalize()))
             elif isinstance(f.type, idl.Struct):
                 if f.type.rawname is not None:
-                    u.append("%s of %s" % (f.name.capitalize(), 
f.type.rawname.capitalize()))
+                    u.append("%s of %s.t" % (f.name.capitalize(), 
f.type.rawname.capitalize()))
                 elif f.type.has_fields():
                     u.append("%s of %s_%s" % (f.name.capitalize(), nparent, 
f.name))
                 else:
@@ -325,7 +325,7 @@ def c_val(ty, c, o, indent="", parent = None):
                 s += "\t\t    case %d:\n" % (n)
                 s += "\t\t        %s = %s;\n" % (parent + ty.keyvar.name, 
f.enumname)
                 (nparent,fexpr) = ty.member(c, f, False)
-                s += "%s" % c_val(f.type, fexpr, "Field(%s, 0)" % o, 
indent=indent+"\t\t        ")
+                s += "%s" % c_val(f.type, fexpr, "Field(%s, 0)" % o, 
parent=nparent, indent=indent+"\t\t        ")
                 s += "break;\n"
                 n += 1
         s += "\t\t    default: failwith_xl(ERROR_FAIL, \"variant handling bug 
%s%s (block)\"); break;\n" % (parent, ty.keyvar.name)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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