glapi/gen: Add support for pointer types.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Mar 2012 10:47:22 +0000 (10:47 +0000)
committerDave Airlie <airlied@redhat.com>
Sun, 11 Mar 2012 16:50:29 +0000 (16:50 +0000)
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mapi/glapi/gen/gl_API.dtd
src/mapi/glapi/gen/gl_XML.py
src/mapi/glapi/gen/typeexpr.py

index 30c646c9244a467fc8ac3283f1ee3f8a3a7cd2ac..149a433ca7ad53c3b702793eba0646a456744718 100644 (file)
@@ -26,6 +26,7 @@
                    size                NMTOKEN #REQUIRED
                   float               (true | false) "false"
                   unsigned            (true | false) "false"
+                  pointer             (true | false) "false"
                    glx_name            NMTOKEN #IMPLIED>
 <!ATTLIST enum     name                NMTOKEN #REQUIRED
                    count               CDATA   #IMPLIED
index 4dc2e8fa7fbcea4e7d1ce26b16c3b7a5b9ca53dd..340a581f134b670a074e9b39b72fea6c9daf644b 100644 (file)
@@ -340,6 +340,7 @@ class gl_type( gl_item ):
                tn.size = int( element.nsProp( "size", None ), 0 )
                tn.integer = not is_attr_true( element, "float" )
                tn.unsigned = is_attr_true( element, "unsigned" )
+               tn.pointer = is_attr_true( element, "pointer" )
                tn.name = "GL" + self.name
                te.set_base_type_node( tn )
 
index 8ba7de486273567ef5ed81511e7c1cda08058803..7836b2739aa55378bbf91a867e88adfc23b183b7 100644 (file)
@@ -252,7 +252,7 @@ class type_expression:
 
 
        def get_stack_size(self):
-               tn = self.expr[ len(self.expr) - 1 ]
+               tn = self.expr[ -1 ]
 
                if tn.elements or tn.pointer:
                        return 4
@@ -263,12 +263,12 @@ class type_expression:
 
 
        def is_pointer(self):
-               tn = self.expr[ len(self.expr) - 1 ]
+               tn = self.expr[ -1 ]
                return tn.pointer
 
 
        def format_string(self):
-               tn = self.expr[ len(self.expr) - 1 ]
+               tn = self.expr[ -1 ]
                if tn.pointer:
                        return "%p"
                elif not tn.integer: