[Xcb] [PATCH proto 1/7] xcbgen: fields get a parent reference
Christian Linhart
chris at demorecorder.com
Wed Sep 3 04:17:54 PDT 2014
Objects of type Field get a reference to their parent.
This is needed in the generator to differentiate
field handling dependend on properties of their parent.
---
xcbgen/expr.py | 1 +
xcbgen/xtypes.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/xcbgen/expr.py b/xcbgen/expr.py
index e4fb06e..51e738f 100644
--- a/xcbgen/expr.py
+++ b/xcbgen/expr.py
@@ -18,14 +18,15 @@ class Field(object):
self.field_type = field_type
self.field_name = field_name
self.enum = enum
self.visible = visible
self.wire = wire
self.auto = auto
self.isfd = isfd
+ self.parent = None
class Expression(object):
'''
Represents a mathematical expression for a list length or exprfield.
Public fields:
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 45d7568..8ecbaa2 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -72,14 +72,15 @@ class Type(object):
# We dump the _placeholder_byte if any fields are added.
for (idx, field) in enumerate(complex_type.fields):
if field == _placeholder_byte:
complex_type.fields[idx] = new_field
return
complex_type.fields.append(new_field)
+ new_field.parent = complex_type
def make_fd_of(self, module, complex_type, fd_name):
'''
Method for making a fd member of a structure.
'''
new_fd = Field(self, module.get_type_name('INT32'), fd_name, True, False, False, None, True)
# We dump the _placeholder_byte if any fields are added.
--
2.0.1
More information about the Xcb
mailing list