diff --git a/xcbgen/state.py b/xcbgen/state.py index a8346bb..0dbecdc 100644 --- a/xcbgen/state.py +++ b/xcbgen/state.py @@ -100,12 +100,12 @@ class Module(object): self.add_type('INT16', '', ('int16_t',), tint16) self.add_type('INT32', '', ('int32_t',), tint32) self.add_type('INT64', '', ('int64_t',), tint64) - self.add_type('BYTE', '', ('uint8_t',), tcard8) - self.add_type('BOOL', '', ('uint8_t',), tcard8) + self.add_type('BYTE', '', ('uint8_t',), tbyte) + self.add_type('BOOL', '', ('uint8_t',), tbool) self.add_type('char', '', ('char',), tchar) self.add_type('float', '', ('float',), tfloat) self.add_type('double', '', ('double',), tdouble) - self.add_type('void', '', ('void',), tcard8) + self.add_type('void', '', ('void',), tvoid) # This goes out and parses the rest of the XML def register(self): diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py index 8a9d130..3afc812 100644 --- a/xcbgen/xtypes.py +++ b/xcbgen/xtypes.py @@ -192,12 +192,12 @@ class SimpleType(PrimitiveType): Any type which is typedef'ed to cardinal will be one of these. Public fields added: - none + xml_type is the original string describing the type in the XML ''' - def __init__(self, name, size): + def __init__(self, name, size, xml_type=None): PrimitiveType.__init__(self, name, size) self.is_simple = True - + self.xml_type = xml_type def resolve(self, module): self.resolved = True @@ -206,24 +206,27 @@ class SimpleType(PrimitiveType): # Cardinal datatype globals. See module __init__ method. -tcard8 = SimpleType(('uint8_t',), 1) -tcard16 = SimpleType(('uint16_t',), 2) -tcard32 = SimpleType(('uint32_t',), 4) -tcard64 = SimpleType(('uint64_t',), 8) -tint8 = SimpleType(('int8_t',), 1) -tint16 = SimpleType(('int16_t',), 2) -tint32 = SimpleType(('int32_t',), 4) -tint64 = SimpleType(('int64_t',), 8) -tchar = SimpleType(('char',), 1) -tfloat = SimpleType(('float',), 4) -tdouble = SimpleType(('double',), 8) +tcard8 = SimpleType(('uint8_t',), 1, 'CARD8') +tcard16 = SimpleType(('uint16_t',), 2, 'CARD16') +tcard32 = SimpleType(('uint32_t',), 4, 'CARD32') +tcard64 = SimpleType(('uint64_t',), 8, 'CARD64') +tint8 = SimpleType(('int8_t',), 1, 'INT8') +tint16 = SimpleType(('int16_t',), 2, 'INT16') +tint32 = SimpleType(('int32_t',), 4, 'INT32') +tint64 = SimpleType(('int64_t',), 8, 'INT64') +tchar = SimpleType(('char',), 1, 'char') +tfloat = SimpleType(('float',), 4, 'float') +tdouble = SimpleType(('double',), 8, 'double') +tbyte = SimpleType(('uint8_t',), 1, 'BYTE') +tbool = SimpleType(('uint8_t',), 1, 'BOOL') +tvoid = SimpleType(('uint8_t',), 1, 'void') class FileDescriptor(SimpleType): ''' Derived class which represents a file descriptor. ''' def __init__(self): - SimpleType.__init__(self, ('int'), 4) + SimpleType.__init__(self, ('int'), 4, 'fd') self.is_fd = True def fixed_size(self): @@ -240,7 +243,7 @@ class Enum(SimpleType): bits contains a list of (name, bitnum) tuples. items only appear if specified as a bit. bitnum is a number. ''' def __init__(self, name, elt): - SimpleType.__init__(self, name, 4) + SimpleType.__init__(self, name, 4, 'enum') self.values = [] self.bits = [] self.doc = None