2 libcore: library for basic data structures and algorithms.
3 Copyright (C) 2005 IPD Goos, Universit"at Karlsruhe, Germany
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 Option management library. Enum extensions.
23 #ifndef _LC_OPTS_ENUM_T
24 #define _LC_OPTS_ENUM_T
28 #define _LC_OPT_DECL_ENUM(T, N) \
32 } lc_opt_enum_ ## N ## _items_t; \
36 const lc_opt_enum_ ## N ## _items_t *items; \
37 } lc_opt_enum_ ## N ## _var_t; \
39 int lc_opt_enum_ ## N ## _cb(const char *name, lc_opt_type_t type, void *data, size_t len, ...); \
40 int lc_opt_enum_ ## N ## _dump(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t len); \
41 int lc_opt_enum_ ## N ## _dump_vals(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t len); \
43 #define _LC_OPT_ENT_ENUM(N, name, desc, var) \
44 _LC_OPT_ENT(name, desc, lc_opt_type_enum, var, 0, lc_opt_enum_ ## N ## _cb, lc_opt_enum_ ## N ## _dump, lc_opt_enum_ ## N ## _dump_vals)
46 _LC_OPT_DECL_ENUM(int, int)
47 _LC_OPT_DECL_ENUM(unsigned, mask)
48 _LC_OPT_DECL_ENUM(void *, ptr)
49 _LC_OPT_DECL_ENUM(const void *, const_ptr)
51 #define LC_OPT_ENT_ENUM_INT(name, desc, var) _LC_OPT_ENT_ENUM(int, name, desc, var)
52 #define LC_OPT_ENT_ENUM_MASK(name, desc, var) _LC_OPT_ENT_ENUM(mask, name, desc, var)
53 #define LC_OPT_ENT_ENUM_PTR(name, desc, var) _LC_OPT_ENT_ENUM(ptr, name, desc, var)
54 #define LC_OPT_ENT_ENUM_CONST_PTR(name, desc, var) _LC_OPT_ENT_ENUM(const_ptr, name, desc, var)
59 } lc_opt_enum_func_ptr_items_t;
63 const lc_opt_enum_func_ptr_items_t *items;
64 } lc_opt_enum_func_ptr_var_t;
66 #define LC_OPT_ENT_ENUM_FUNC_PTR(name, desc, var) _LC_OPT_ENT_ENUM(func_ptr, name, desc, var)
68 int lc_opt_enum_func_ptr_cb(const char *name, lc_opt_type_t type, void *data, size_t len, ...);
69 int lc_opt_enum_func_ptr_dump(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t len);
70 int lc_opt_enum_func_ptr_dump_vals(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t len);