projects
/
free-sw
/
xcb
/
proto
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove combine-adjacent tag on PolyPoint: it will not work for some forms of the...
[free-sw/xcb/proto]
/
src
/
size.py
diff --git
a/src/size.py
b/src/size.py
index
07e2f27
..
5ead8b2
100755
(executable)
--- a/
src/size.py
+++ b/
src/size.py
@@
-12,21
+12,17
@@
def AttributesUnion(base, **values):
class AnnotateSize(XMLFilterBase):
types = {
class AnnotateSize(XMLFilterBase):
types = {
- 'BYTE': 1,
- 'BOOL': 1,
- 'CARD8': 1,
- 'CARD16': 2,
- 'CARD32': 4,
- 'INT8': 1,
- 'INT16': 2,
- 'INT32': 4,
- 'float': 4,
- 'double': 8,
+ '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):
}
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
self.types[name] = size
- self.types[self.header[0] + ':' + name] = size
struct = None
union = None
struct = None
union = None
@@
-40,6
+36,10
@@
class AnnotateSize(XMLFilterBase):
elif self.union is not None:
self.totalsize = max(self.totalsize, size)
attrs = AttributesUnion(attrs, bytes=str(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':
elif name == 'xidtype':
self.setTypeSize(attrs['name'], 4)
elif name == 'typedef':
@@
-49,7
+49,7
@@
class AnnotateSize(XMLFilterBase):
setattr(self, name, attrs['name'])
self.totalsize = 0
setattr(self, name, attrs['name'])
self.totalsize = 0
- if len(self.header) == 1:
+ if len(self.header) == 1
or name == 'xcb'
:
XMLFilterBase.startElement(self, name, attrs)
def characters(self, content):
XMLFilterBase.startElement(self, name, attrs)
def characters(self, content):
@@
-57,7
+57,7
@@
class AnnotateSize(XMLFilterBase):
XMLFilterBase.characters(self, content)
def endElement(self, name):
XMLFilterBase.characters(self, content)
def endElement(self, name):
- if len(self.header) == 1:
+ if len(self.header) == 1
or name == 'xcb'
:
XMLFilterBase.endElement(self, name)
if name == 'xcb':
XMLFilterBase.endElement(self, name)
if name == 'xcb':