9 |
9 |
10 #ifndef LIBTU_MAP_H |
10 #ifndef LIBTU_MAP_H |
11 #define LIBTU_MAP_H |
11 #define LIBTU_MAP_H |
12 |
12 |
13 typedef struct _StringIntMap{ |
13 typedef struct _StringIntMap{ |
14 const char *string; |
14 const char *string; |
15 int value; |
15 int value; |
16 } StringIntMap; |
16 } StringIntMap; |
17 |
17 |
18 #define END_STRINGINTMAP {NULL, 0} |
18 #define END_STRINGINTMAP {NULL, 0} |
19 |
19 |
20 /* Return the index of str in map or -1 if not found. */ |
20 /* Return the index of str in map or -1 if not found. */ |
21 extern int stringintmap_ndx(const StringIntMap *map, const char *str); |
21 extern int stringintmap_ndx(const StringIntMap *map, const char *str); |
22 extern int stringintmap_value(const StringIntMap *map, const char *str, |
22 extern int stringintmap_value(const StringIntMap *map, const char *str, |
23 int dflt); |
23 int dflt); |
24 |
24 |
25 #endif /* LIBTU_MAP_H */ |
25 #endif /* LIBTU_MAP_H */ |