

def write_enum(self, fobj, name, value, type_='uint'):
    if isinstance(value, basestring):
        if (value.startswith('0x') and type_.startswith('u')):
            value += 'U'
        if ((len(value) > 12) and type_.startswith('u')):
            value += 'L'
    try:
        v = int(value)
        if (v < 0):
            type_ = 'int'
    except ValueError:
        pass
    if (isinstance(value, basestring) and ('"' in value)):
        type_ = 'const(char)*'
    fobj.write('enum {} {} = {};\n'.format(type_, name, value))

dataset/ETHPy150Open Dav1dde/glad/glad/lang/volt/generator.py VoltGenerator.write_enum/original