<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 15/09/17 22:27, Jason Ekstrand
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOFGe97TGfWp5uhtBN2cP-WN9D1RL7zUggXgscKWh0=ki9CZ7A@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Fri, Sep 15, 2017 at 7:10 AM,
Lionel Landwerlin <span dir="ltr"><<a
href="mailto:lionel.g.landwerlin@intel.com"
target="_blank" moz-do-not-send="true">lionel.g.landwerlin@intel.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">It will
be used to store extension numbers as well.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a
href="mailto:lionel.g.landwerlin@intel.com"
moz-do-not-send="true">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
src/vulkan/util/gen_enum_to_<wbr>str.py | 19
+++++++++----------<br>
1 file changed, 9 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/vulkan/util/gen_enum_to_<wbr>str.py
b/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
index d09e256965f..28bfbfde235 100644<br>
--- a/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
+++ b/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
@@ -98,19 +98,18 @@ H_TEMPLATE =
Template(textwrap.dedent(u"""\<br>
#endif"""),<br>
output_encoding='utf-8')<br>
<br>
-<br>
-class EnumFactory(object):<br>
+class NamedFactory(object):<br>
"""Factory for creating enums."""<br>
<br>
def __init__(self, type_):<br>
self.registry = {}<br>
self.type = type_<br>
<br>
- def __call__(self, name):<br>
+ def __call__(self, *args):<br>
try:<br>
- return self.registry[name]<br>
+ return self.registry[args[0]]<br>
except KeyError:<br>
- n = self.registry[name] = self.type(name)<br>
+ n = self.registry[args[0]] = self.type(*args)<br>
return n<br>
<br>
<br>
@@ -128,7 +127,7 @@ def xml_parser(filename):<br>
This parser is a memory efficient iterative XML
parser that returns a list<br>
of VkEnum objects.<br>
"""<br>
- efactory = EnumFactory(VkEnum)<br>
+ enum_factory = NamedFactory(VkEnum)<br>
<br>
with open(filename, 'rb') as f:<br>
context = iter(et.iterparse(f, events=('start',
'end')))<br>
@@ -142,19 +141,19 @@ def xml_parser(filename):<br>
if event == 'end' and elem.tag == 'enums':<br>
type_ = elem.attrib.get('type')<br>
if type_ == 'enum':<br>
- enum = efactory(elem.attrib['name'])<br>
+ enum = enum_factory(elem.attrib['<wbr>name'])<br>
enum.values.extend([e.attrib['<wbr>name']
for e in elem<br>
if e.tag ==
'enum'])<br>
elif event == 'end' and elem.tag ==
'extension':<br>
if elem.attrib['supported'] != 'vulkan':<br>
continue<br>
for e in elem.findall('.//enum[@<wbr>extends][@offset]'):<br>
- enum = efactory(e.attrib['extends'])<br>
- enum.values.append(e.attrib['<wbr>name'])<br>
+ enum = enum_factory(e.attrib['<wbr>extends'])<br>
+ enum.values.append(e.attrib['<wbr>name'],)<br>
</blockquote>
<div><br>
</div>
<div>There's an extra comma here I don't think you need.<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Fixed locally.<br>
<br>
<blockquote type="cite"
cite="mid:CAOFGe97TGfWp5uhtBN2cP-WN9D1RL7zUggXgscKWh0=ki9CZ7A@mail.gmail.com">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
root.clear()<br>
<br>
- return efactory.registry.values()<br>
+ return enum_factory.registry.values()<br>
<br>
<br>
def main():<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org"
moz-do-not-send="true">mesa-dev@lists.freedesktop.org</a><br>
<a
href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>