Lines Matching refs:self
30 def __init__(self, filename):
32 self.path = filename
33 self.dir = dirname(filename)
34 self.file = basename(filename)
37 self.root = parse(filename).getroot()
38 self.header = self.root.get('header')
39 self.ns = self.header + ':'
42 self.events = {}
45 if self.root.get('extension-xname', False):
46 self.is_ext = True
47 self.major_version = self.root.get('major-version')
48 self.minor_version = self.root.get('minor-version')
49 self.ext_xname = self.root.get('extension-xname')
50 self.ext_name = self.root.get('extension-name')
51 self.prefix = ('xcb', self.ext_name)
53 self.is_ext = False
54 self.ext_name = ''
55 self.prefix = ('xcb',)
57 def add_event(self, id, name, item):
58 self.events[id] = (name, item)
60 def get_event_by_opcode(self, opcode, is_ge_event):
61 for id, (name, event) in self.events.items():
82 def __init__(self, filename, output):
83 self.namespace = Namespace(filename)
84 self.output = output
86 self.imports = []
87 self.direct_imports = []
88 self.import_level = 0
89 self.types = {}
90 self.events = {}
91 self.errors = {}
92 self.all = []
95 self.namespaces = {}
97 self.namespaces[self.namespace.ext_name] = self.namespace
100 self.add_type('CARD8', '', ('uint8_t',), tcard8)
101 self.add_type('CARD16', '', ('uint16_t',), tcard16)
102 self.add_type('CARD32', '', ('uint32_t',), tcard32)
103 self.add_type('CARD64', '', ('uint64_t',), tcard64)
104 self.add_type('INT8', '', ('int8_t',), tint8)
105 self.add_type('INT16', '', ('int16_t',), tint16)
106 self.add_type('INT32', '', ('int32_t',), tint32)
107 self.add_type('INT64', '', ('int64_t',), tint64)
108 self.add_type('BYTE', '', ('uint8_t',), tbyte)
109 self.add_type('BOOL', '', ('uint8_t',), tbool)
110 self.add_type('char', '', ('char',), tchar)
111 self.add_type('float', '', ('float',), tfloat)
112 self.add_type('double', '', ('double',), tdouble)
113 self.add_type('void', '', ('void',), tvoid)
116 def register(self):
117 matcher.execute(self, self.namespace)
120 def resolve(self):
121 self.add_events_to_namespaces()
122 for (name, item) in self.all:
123 self.pads = 0
124 item.resolve(self)
127 def generate(self):
128 self.open()
130 for (name, item) in self.all:
133 self.close()
136 def add_import(self, name, namespace):
137 if self.import_level == 0:
138 self.direct_imports.append((name, namespace.header))
139 self.imports.append((name, namespace.header))
140 self.namespaces[namespace.ext_name] = namespace
142 def has_import(self, name):
143 for (name_, header) in self.imports:
149 def add_type(self, id, ns, name, item):
151 if key in self.types:
153 self.types[key] = (name, item)
154 if name[:-1] == self.namespace.prefix:
155 self.all.append((name, item))
157 def get_type_impl(self, id, idx):
159 if key in self.types:
160 return self.types[key][idx]
162 key = self.namespace.ns + id
163 if key in self.types:
164 return self.types[key][idx]
166 for key in self.types.keys():
168 return self.types[key][idx]
172 def get_type(self, id):
173 return self.get_type_impl(id, 1)
175 def get_type_name(self, id):
176 return self.get_type_impl(id, 0)
178 def get_namespace(self, ext_name):
179 return self.namespaces[ext_name]
182 def add_request(self, id, name, item):
183 if name[:-1] == self.namespace.prefix:
184 self.all.append((name, item))
187 def add_event(self, id, name, item):
188 self.events[id] = (name, item)
189 if name[:-1] == self.namespace.prefix:
190 self.all.append((name, item))
193 def add_events_to_namespaces(self):
195 for id, (name,item) in self.events.items():
203 namespace = self.namespaces[namespace_name]
209 def get_event(self, id):
210 return self.events[id][1]
213 def add_error(self, id, name, item):
214 self.errors[id] = (name, item)
215 if name[:-1] == self.namespace.prefix:
216 self.all.append((name, item))
218 def get_error(self, id):
219 return self.errors[id][1]