enum example_t
{
#py \
for line in open('values.txt'): \
print('EXAMPLE_' + line.strip() + ',')
EXAMPLE_Max,
EXAMPLE_Unknown
};
Or alternatively to stuff it in a comment: enum example_t
{
/* py
for line in open('values.txt'):
print('EXAMPLE_' + line.strip() + ',')
*/
EXAMPLE_Max,
EXAMPLE_Unknown
};
If anyones interested, heres the python script I use to preprocess the c/c++ files https://github.com/hartcw/cppy
https://g.co/kgs/Gyvg69