WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 26 of 32] tools: libxl: remove Reference meta-type fr

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 26 of 32] tools: libxl: remove Reference meta-type from IDL
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Mon, 18 Apr 2011 14:53:48 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Mon, 18 Apr 2011 07:23:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1303134802@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1303134802@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1303134403 -3600
# Node ID 5b9e0a43718a615660fb7cf300247c1bf649b84a
# Parent  fcf62b8dc42e85ee8a6365ec43d7e196efb94d6f
tools: libxl: remove Reference meta-type from IDL

It is tricky to map to language bindings and is now unused in any case.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r fcf62b8dc42e -r 5b9e0a43718a tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py   Mon Apr 18 14:46:13 2011 +0100
+++ b/tools/libxl/gentypes.py   Mon Apr 18 14:46:43 2011 +0100
@@ -78,13 +78,13 @@ def libxl_C_type_define(ty, indent = "")
         raise NotImplementedError("%s" % type(ty))
     return s.replace("\n", "\n%s" % indent)
 
-def libxl_C_type_destroy(ty, v, reference, indent = "    ", parent = None):
-    if reference:
+def libxl_C_type_destroy(ty, v, indent = "    ", parent = None):
+    if parent is None:
         deref = v + "->"
     else:
         deref = v + "."
         
-    if ty.passby == libxltypes.PASS_BY_REFERENCE and not reference:
+    if ty.passby == libxltypes.PASS_BY_REFERENCE and parent is not None:
         makeref = "&"
     else:
         makeref = ""
@@ -96,19 +96,15 @@ def libxl_C_type_destroy(ty, v, referenc
         for f in ty.fields:
             keyvar_expr = f.keyvar_expr % (parent + ty.keyvar_name)
             s += "if (" + keyvar_expr + ") {\n"
-            s += libxl_C_type_destroy(f.type, deref + f.name, False, indent + 
"    ", deref)
+            s += libxl_C_type_destroy(f.type, deref + f.name, indent + "    ", 
deref)
             s += "}\n"
-    elif isinstance(ty, libxltypes.Reference):
-        s += libxl_C_type_destroy(ty.ref_type, v, True, indent, v)
-        if ty.destructor_fn is not None:
-            s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)
     elif isinstance(ty, libxltypes.Struct) and (parent is None or 
ty.destructor_fn is None):
         for f in [f for f in ty.fields if not f.const]:
 
             if f.name is None: # Anonynous struct
-                s += libxl_C_type_destroy(f.type, deref, False, "", deref)
+                s += libxl_C_type_destroy(f.type, deref, "", deref)
             else:
-                s += libxl_C_type_destroy(f.type, deref + f.name, False, "", 
deref)
+                s += libxl_C_type_destroy(f.type, deref + f.name, "", deref)
     else:
         if ty.destructor_fn is not None:
             s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)
@@ -177,7 +173,7 @@ if __name__ == '__main__':
     for ty in [t for t in types if t.destructor_fn is not None and 
t.autogenerate_destructor]:
         f.write("void %s(%s *p)\n" % (ty.destructor_fn, ty.typename))
         f.write("{\n")
-        f.write(libxl_C_type_destroy(ty, "p", True))
+        f.write(libxl_C_type_destroy(ty, "p"))
         f.write("    memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n")
         f.write("}\n")
         f.write("\n")
diff -r fcf62b8dc42e -r 5b9e0a43718a tools/libxl/idl.txt
--- a/tools/libxl/idl.txt       Mon Apr 18 14:46:13 2011 +0100
+++ b/tools/libxl/idl.txt       Mon Apr 18 14:46:43 2011 +0100
@@ -64,13 +64,6 @@ libxltype.UInt
  The <N> for a given instance must be passed to the constructor and is
  then available in UInt.width
 
-libxltype.Reference
-
- Instances of this type represent a reference to another type
-
- The referant type must be passed to the constructor and is then
- available in Reference.ref_type
-
 Complex type-Classes
 --------------------
 
diff -r fcf62b8dc42e -r 5b9e0a43718a tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Mon Apr 18 14:46:13 2011 +0100
+++ b/tools/libxl/libxltypes.py Mon Apr 18 14:46:43 2011 +0100
@@ -163,24 +163,6 @@ class KeyedUnion(Aggregate):
             n, kve, ty = f
             self.fields.append(Field(ty, n, keyvar_expr=kve))
 
-class Reference(Type):
-    """A reference to another type"""
-    def __init__(self, ty, **kwargs):
-        self.ref_type = ty
-        
-        # Ugh
-        
-        kwargs.setdefault('destructor_fn', "free")
-        kwargs.setdefault('autogenerate_destructor', False)
-        kwargs.setdefault('passby', PASS_BY_VALUE)
-        
-        kwargs.setdefault('namespace', ty.namespace)
-
-        typename = ty.typename
-        if ty.namespace:
-            typename = typename[len(kwargs['namespace']):]
-        Type.__init__(self, typename + " *", **kwargs)
-
 #
 # Standard Types
 #

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>