#!/usr/bin/env python

fp = open('reference/elf.h')
out = open('tmp', 'w')

prefix = 'STT_'
set_name = 'st_info_type'

values = []

for line in fp:
    if line.startswith('#define %s' % prefix):
        toks = line.split()
        if len(toks) >= 4:
            (define, symbol, value) = toks[:3]
            comment = ' '.join(toks[4:-1])
            values.append((symbol, value, comment))

for (symbol, value, comment) in values:
    out.write('%s = %s\n' % (symbol, value))

out.write('\n%s = {\n' % set_name)
for (symbol, value, comment) in values:
    out.write('%s:"%s",\n' % (symbol, comment))
out.write('}')
