[Piglit] [PATCH 11/29] glapi: Split enum value parsing to help function

Pauli Nieminen pauli.nieminen at linux.intel.com
Mon May 21 11:08:46 PDT 2012


No functional changes just preparing GLES parsing.

Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
---
 glapi/parse_glspec.py |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
index 1097e3c..9d7d523 100644
--- a/glapi/parse_glspec.py
+++ b/glapi/parse_glspec.py
@@ -459,20 +459,23 @@ class Api(object):
     #
     # 'CLIENT_ALL_ATTRIB_BITS': { 'value_int': 4294967295,
     #                             'value_str': "0xFFFFFFFF" }
+    def parse_enum(self, m):
+	name, value = m.groups()
+	if value.startswith('GL_'):
+	    value_rhs = value[3:]
+	    value_int = self.enums[value_rhs]['value_int']
+	else:
+	    value_int = decode_enum_value(value)
+	self.enums[name] = {
+		'value_str': value,
+		'value_int': value_int
+		}
+
     def read_enumext_spec(self, f):
         for line in filter_comments(f):
             m = ENUM_REGEXP.match(line)
-            if m:
-                name, value = m.groups()
-                if value.startswith('GL_'):
-                    value_rhs = value[3:]
-                    value_int = self.enums[value_rhs]['value_int']
-                else:
-                    value_int = decode_enum_value(value)
-                self.enums[name] = {
-                    'value_str': value,
-                    'value_int': value_int
-                    }
+	    if m:
+		self.parse_enum(m)
 
     # Convert the stored API into JSON.  To make diffing easier, all
     # dictionaries are sorted by key, and all sets are sorted by set
-- 
1.7.5.4



More information about the Piglit mailing list