Skip to content
  • Uli Schlachter's avatar
    Allow access to the original type in the XML · e79f6b01
    Uli Schlachter authored
    
    
    xcbgen 'helpfully' transforms things to C types already so that libxcb
    does not have to do so. Thus, even though the XML says that a field has
    type CARD8, xcbgen will claim uint8_t. This might be a bit weird, but is
    so far totally fine.
    
    However, the type mapping that xcbgen uses is not injective. All of
    CARD8, BYTE and BOOL get turned into uint8_t and the original type is
    lost.
    
    This is totally fine for libxcb, but programming languages other than C
    do have built in boolean types. My personal problem is with Rust, where
    providing a boolean for an integer argument causes a compiler error.
    This results in (relatively) ugly "0 / 1" instead of "false / true".
    
    This commit adds a new xml_type member to SimpleType. This type contains
    the original string that appeared in the XML file.
    
    Since libxcb creates instances of SimpleType itself and to avoid
    breaking the API, the new argument to SimpleType.__init__ defaults to
    None.
    
    Signed-off-by: default avatarUli Schlachter <psychon@znc.in>
    e79f6b01