def writeHandleType(api, filename):
    (uniqeHandles, duplicatedHandles) = splitUniqueAndDuplicatedEntries(api.handles)

    def genHandles():
        (yield ('\t%s\t= 0,' % uniqeHandles[0].getHandleType()))
        for handle in uniqeHandles[1:]:
            (yield ('\t%s,' % handle.getHandleType()))
        for duplicate in duplicatedHandles:
            (yield ('\t%s\t= %s,' % (duplicate.getHandleType(), duplicatedHandles[duplicate].getHandleType())))
        (yield ('\tHANDLE_TYPE_LAST\t= %s + 1' % uniqeHandles[(- 1)].getHandleType()))

    def genHandlesBlock():
        (yield 'enum HandleType')
        (yield '{')
        for line in indentLines(genHandles()):
            (yield line)
        (yield '};')
        (yield '')
    writeInlFile(filename, INL_HEADER, genHandlesBlock())
def writeHandleType(api, filename):
    (uniqeHandles, duplicatedHandles) = splitUniqueAndDuplicatedEntries(api.handles)

    def genHandles():
        (yield ('\t%s\t= 0,' % uniqeHandles[0].getHandleType()))
        for handle in uniqeHandles[1:]:
            (yield ('\t%s,' % handle.getHandleType()))
        for duplicate in duplicatedHandles:
            (yield ('\t%s\t= %s,' % (duplicate.getHandleType(), duplicatedHandles[duplicate].getHandleType())))
        (yield ('\tHANDLE_TYPE_LAST\t= %s + 1' % uniqeHandles[(- 1)].getHandleType()))

    def genHandlesBlock():
        (yield 'enum HandleType')
        (yield '{')
        for line in indentLines(genHandles()):
            (yield line)
        (yield '};')
        (yield )
    writeInlFile(filename, INL_HEADER, genHandlesBlock())