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.
13 typedef struct _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
,
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{\
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
,
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 */