aboutsummaryrefslogtreecommitdiff
path: root/libxcb/xcb-proto
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-26 10:45:42 +0100
committermarha <marha@users.sourceforge.net>2012-01-26 10:45:42 +0100
commit40bdd8b27f5c730b8d0c9a189e89fb51a5400611 (patch)
tree23d7ead2d11ebc95c1d0a5e57cdb2ee5b358110b /libxcb/xcb-proto
parentffbc36adb7ea5781a93731212226c47f1d49da5e (diff)
parenteb4c088eb71f93b9639f4ff651523d794f1433f7 (diff)
downloadvcxsrv-40bdd8b27f5c730b8d0c9a189e89fb51a5400611.tar.gz
vcxsrv-40bdd8b27f5c730b8d0c9a189e89fb51a5400611.tar.bz2
vcxsrv-40bdd8b27f5c730b8d0c9a189e89fb51a5400611.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'libxcb/xcb-proto')
-rw-r--r--libxcb/xcb-proto/src/import.py66
-rw-r--r--libxcb/xcb-proto/src/size.py76
-rw-r--r--libxcb/xcb-proto/src/type.py74
3 files changed, 0 insertions, 216 deletions
diff --git a/libxcb/xcb-proto/src/import.py b/libxcb/xcb-proto/src/import.py
deleted file mode 100644
index eb58f5561..000000000
--- a/libxcb/xcb-proto/src/import.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-
-from xml.sax.saxutils import XMLFilterBase, XMLGenerator
-from xml.sax import make_parser
-import sys, os
-
-path = [os.path.curdir, 'extensions']
-def find_file_on_path(name):
- for d in path:
- test = os.path.join(d, name)
- if os.path.isfile(test):
- return test
- raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), name)
-
-seen = {}
-
-class ProcessImports(XMLFilterBase):
- def setContentHandler(self, handler):
- self.handler = handler
- XMLFilterBase.setContentHandler(self, handler)
-
- def ensure(self, name):
- if not seen.has_key(name):
- child = ProcessImports(make_parser())
- child.setContentHandler(self.handler)
- child.parse(find_file_on_path(name + '.xml'))
-
- def startDocument(self):
- pass
- def endDocument(self):
- pass
-
- inimport = None
-
- def startElement(self, name, attrs):
- assert self.inimport is None
- if name == 'import':
- self.inimport = ""
- return
- XMLFilterBase.startElement(self, name, attrs)
- if name == 'xcb':
- seen[attrs['header']] = True
- self.ensure('xproto')
-
- def characters(self, content):
- if self.inimport is not None:
- self.inimport += content
- else:
- XMLFilterBase.characters(self, content)
-
- def endElement(self, name):
- if name == 'import':
- self.ensure(self.inimport)
- self.inimport = None
- return
- XMLFilterBase.endElement(self, name)
-
-out = XMLGenerator()
-importer = ProcessImports(make_parser())
-importer.setContentHandler(out)
-out.startDocument()
-if len(sys.argv) > 1:
- importer.parse(sys.argv[1])
-else:
- importer.parse(sys.stdin)
-out.endDocument()
diff --git a/libxcb/xcb-proto/src/size.py b/libxcb/xcb-proto/src/size.py
deleted file mode 100644
index 5ead8b238..000000000
--- a/libxcb/xcb-proto/src/size.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-
-from xml.sax.saxutils import XMLFilterBase, XMLGenerator
-from xml.sax.xmlreader import AttributesImpl
-from xml.sax import make_parser
-import sys
-
-def AttributesUnion(base, **values):
- baseitems = dict(base)
- baseitems.update(values)
- return AttributesImpl(baseitems)
-
-class AnnotateSize(XMLFilterBase):
- types = {
- 'BYTE': 1, 'BOOL': 1,
- 'CARD8': 1, 'CARD16': 2, 'CARD32': 4,
- 'INT8': 1, 'INT16': 2, 'INT32': 4,
- 'char': 1, 'void': 1,
- 'float': 4, 'double': 8,
- 'XID': 4,
- }
- header = []
- def setTypeSize(self, name, size):
- assert not self.types.has_key(name), "size of " + name + " declared as both " + str(size) + " and " + str(self.types[name])
- self.types[name] = size
-
- struct = None
- union = None
- def startElement(self, name, attrs):
- if name == 'xcb':
- self.header.insert(0, attrs['header'])
- elif name == 'field':
- size = self.types.get(attrs['type'], 0)
- if self.struct is not None:
- self.totalsize += size
- elif self.union is not None:
- self.totalsize = max(self.totalsize, size)
- attrs = AttributesUnion(attrs, bytes=str(size))
- elif name == 'pad':
- assert self.union is None
- if self.struct is not None:
- self.totalsize += int(attrs['bytes'])
- elif name == 'xidtype':
- self.setTypeSize(attrs['name'], 4)
- elif name == 'typedef':
- self.setTypeSize(attrs['newname'], self.types[attrs['oldname']])
- elif name == 'struct' or name == 'union':
- assert self.struct is None and self.union is None
- setattr(self, name, attrs['name'])
- self.totalsize = 0
-
- if len(self.header) == 1 or name == 'xcb':
- XMLFilterBase.startElement(self, name, attrs)
-
- def characters(self, content):
- if len(self.header) == 1:
- XMLFilterBase.characters(self, content)
-
- def endElement(self, name):
- if len(self.header) == 1 or name == 'xcb':
- XMLFilterBase.endElement(self, name)
-
- if name == 'xcb':
- self.header.pop(0)
- elif name == 'struct' or name == 'union':
- assert getattr(self, name) is not None
- self.setTypeSize(getattr(self, name), self.totalsize)
- setattr(self, name, None)
- del self.totalsize
-
-annotator = AnnotateSize(make_parser())
-annotator.setContentHandler(XMLGenerator())
-if len(sys.argv) > 1:
- annotator.parse(sys.argv[1])
-else:
- annotator.parse(sys.stdin)
diff --git a/libxcb/xcb-proto/src/type.py b/libxcb/xcb-proto/src/type.py
deleted file mode 100644
index 83382325d..000000000
--- a/libxcb/xcb-proto/src/type.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-
-from xml.sax.saxutils import XMLFilterBase, XMLGenerator
-from xml.sax.xmlreader import AttributesImpl
-from xml.sax import make_parser
-import sys
-
-def AttributesUnion(base, **values):
- baseitems = dict(base)
- baseitems.update(values)
- return AttributesImpl(baseitems)
-
-class AnnotateType(XMLFilterBase):
- scopes = []
- map = dict([(name, [name]) for name in [
- 'BOOL', 'BYTE',
- 'CARD8', 'CARD16', 'CARD32',
- 'INT8', 'INT16', 'INT32',
- 'char', 'void',
- 'float', 'double',
- 'XID',
- ]])
- def startScope(self, name):
- self.scopes.insert(0, name)
- def declareType(self, name):
- assert ':' not in name
- qname = self.scopes[0] + ':' + name
- self.map.setdefault(name, []).insert(0, qname)
- def getQualifiedType(self, name):
- if ':' in name:
- return name
- names = self.map.get(name, [])
- return names[0]
- def endScope(self):
- self.scopes.pop(0)
-
- def startElement(self, name, attrs):
- attnames = []
- if name == 'xcb':
- self.startScope(attrs['header'])
- elif name in ['struct', 'union', 'xidtype', 'enum', 'event', 'eventcopy', 'error', 'errorcopy']:
- self.declareType(attrs['name'])
- attnames = ['name']
- if name.endswith('copy'):
- attnames.append('ref')
- elif name == 'typedef':
- self.declareType(attrs['newname'])
- attnames = ['oldname', 'newname']
- elif name == 'valueparam':
- attnames = ['value-mask-type']
- elif attrs.has_key('type'):
- attnames = ['type']
- newattrs = {}
- for attname in attnames:
- newattrs[attname] = self.getQualifiedType(attrs[attname])
- if newattrs:
- attrs = AttributesUnion(attrs, **newattrs)
- XMLFilterBase.startElement(self, name, attrs)
-
- def endElement(self, name):
- XMLFilterBase.endElement(self, name)
- if name == 'xcb':
- self.endScope()
-
-annotator = AnnotateType(make_parser())
-annotator.setContentHandler(XMLGenerator())
-if len(sys.argv) > 1:
- annotator.parse(sys.argv[1])
-else:
- annotator.parse(sys.stdin)
-
-for name,names in annotator.map.iteritems():
- if len(names) != 1:
- print "<!-- warning:", name, "has the following definitions:", names, "-->"