On 21 May 2012 11:08, Pauli Nieminen <[email protected]> wrote:
> No functional changes just preparing GLES parsing. > > Signed-off-by: Pauli Nieminen <[email protected]> > --- > 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) > Any particular reason you chose to keep "m = ENUM_REGEXP.match(line)" in the caller rather than moving it to parse_enum as well? It seems to me like parse_enum would be easier to comprehend if it converted an enum string to a dict entry, rather than converting a regular expression match to a dict entry. > > # 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 > > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
