Remove unused variables
[notion.git] / libtu / map.h
blob3a0db3956cfb25820345c4fff9b28e60035bbfec
1 /*
2 * libtu/map.h
4 * Copyright (c) Tuomo Valkonen 1999-2002.
6 * You may distribute and modify this library under the terms of either
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
8 */
10 #ifndef LIBTU_MAP_H
11 #define LIBTU_MAP_H
13 typedef struct _StringIntMap{
14 const char *string;
15 int value;
16 } StringIntMap;
18 #define END_STRINGINTMAP {NULL, 0}
20 /* Return the index of str in map or -1 if not found. */
21 extern int stringintmap_ndx(const StringIntMap *map, const char *str);
22 extern int stringintmap_value(const StringIntMap *map, const char *str,
23 int dflt);
24 extern const char *stringintmap_key(const StringIntMap *map,
25 int value, const char *dflt);
29 typedef void (*FunPtr)(void);
31 #define DECLFUNPTRMAP(NAME) \
32 typedef struct _String##NAME##Map{\
33 const char *string;\
34 NAME value;\
35 } String##NAME##Map
37 DECLFUNPTRMAP(FunPtr);
39 #define END_STRINGPTRMAP {NULL, NULL}
41 /* Return the index of str in map or -1 if not found. */
42 extern int stringfunptrmap_ndx(const StringFunPtrMap *map, const char *str);
43 extern FunPtr stringfunptrmap_value(const StringFunPtrMap *map, const char *str,
44 FunPtr dflt);
45 extern const char *stringfunptrmap_key(const StringFunPtrMap *map,
46 FunPtr value, const char *dflt);
49 #define STRINGFUNPTRMAP_NDX(MAP,STR) stringfunptrmap_ndx((StringFunPtrMap *)MAP, STR)
50 #define STRINGFUNPTRMAP_VALUE(TYPE,MAP,STR,DFLT) (TYPE)stringfunptrmap_value((StringFunPtrMap *)MAP, STR, (FunPtr)DFLT)
51 #define STRINGFUNPTRMAP_KEY(MAP,VALUE,DFLT) stringfunptrmap_key((StringFunPtrMap *)MAP, (FunPtr)VALUE, DFLT)
54 #endif /* LIBTU_MAP_H */