I read an interesting answer on how to convert a list of error code defines from the error code to the error string using a giant switch statement. I have a slightly different question though.
Given a large text file of thousands of register defines ie:
#define setup_register 0x01
I'd like to be able to take input from the command line like write setup_register 0xFF
. Then in my code I'd lookup what setup_register's address was (0x01) and write to it.
Is there a C way to get at the setup_register address? I suppose I could parse the file and create a new one, or do it manually, but that means it has to be done each time it changes.