P
psundara
Hi,
I'm facing a peculiar problem of finding a way to interpret header
information in a smart way.
I have this header file that is shared by many users, which contains,
among things, a few #define statements that associate GUIDs wih a
friendly name. For e.g. consider the file zoo.h:
....
#define tiger GUID1
#define lion GUID2
#define striped_cat tiger
....
This file can be updated - i.e. #define statements are
added/removed/modified.
Now, I want to accept the animal type as input from the user, switch
based on the GUID, and print animal specific information to the user.
Is it posible for me to have a user specify the animal type as name
(i.e. tiger, lion etc.) instead of GUID? It would make it very
convenient to the user.
I have a few ideas, but they don't seem to be very elegant:
1. Have the user specify name-to-GUID mappings in a separate file.
2. Parse zoo.h and do create a string-to-GUID internally. However this
is quite cumbersome as #define statements occur all over the place in
different formats.
Any pointers in this regard will be greatly appreciated!
Thanks,
Palani
I'm facing a peculiar problem of finding a way to interpret header
information in a smart way.
I have this header file that is shared by many users, which contains,
among things, a few #define statements that associate GUIDs wih a
friendly name. For e.g. consider the file zoo.h:
....
#define tiger GUID1
#define lion GUID2
#define striped_cat tiger
....
This file can be updated - i.e. #define statements are
added/removed/modified.
Now, I want to accept the animal type as input from the user, switch
based on the GUID, and print animal specific information to the user.
Is it posible for me to have a user specify the animal type as name
(i.e. tiger, lion etc.) instead of GUID? It would make it very
convenient to the user.
I have a few ideas, but they don't seem to be very elegant:
1. Have the user specify name-to-GUID mappings in a separate file.
2. Parse zoo.h and do create a string-to-GUID internally. However this
is quite cumbersome as #define statements occur all over the place in
different formats.
Any pointers in this regard will be greatly appreciated!
Thanks,
Palani