| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#ifndef MENUSELECT_H |
| 27 |
#define MENUSELECT_H |
| 28 |
|
| 29 |
#include "linkedlists.h" |
| 30 |
|
| 31 |
#define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts" |
| 32 |
#define OUTPUT_MAKEDEPS_DEFAULT "menuselect.makedeps" |
| 33 |
#define MENUSELECT_DEPS "build_tools/menuselect-deps" |
| 34 |
|
| 35 |
struct member; |
| 36 |
|
| 37 |
struct reference { |
| 38 |
|
| 39 |
const char *name; |
| 40 |
|
| 41 |
const char *displayname; |
| 42 |
|
| 43 |
struct member *member; |
| 44 |
|
| 45 |
unsigned char met:1; |
| 46 |
|
| 47 |
unsigned char autoselect:1; |
| 48 |
|
| 49 |
AST_LIST_ENTRY(reference) list; |
| 50 |
}; |
| 51 |
|
| 52 |
enum failure_types { |
| 53 |
NO_FAILURE = 0, |
| 54 |
SOFT_FAILURE = 1, |
| 55 |
HARD_FAILURE = 2, |
| 56 |
}; |
| 57 |
|
| 58 |
AST_LIST_HEAD_NOLOCK(reference_list, reference); |
| 59 |
|
| 60 |
struct member { |
| 61 |
|
| 62 |
const char *name; |
| 63 |
|
| 64 |
const char *displayname; |
| 65 |
|
| 66 |
const char *defaultenabled; |
| 67 |
|
| 68 |
const char *remove_on_change; |
| 69 |
|
| 70 |
const char *touch_on_change; |
| 71 |
const char *support_level; |
| 72 |
const char *replacement; |
| 73 |
const char *deprecated_in; |
| 74 |
const char *removed_in; |
| 75 |
|
| 76 |
const char *member_data; |
| 77 |
|
| 78 |
unsigned int enabled:1; |
| 79 |
|
| 80 |
unsigned int was_enabled:1; |
| 81 |
|
| 82 |
unsigned int depsfailed:2; |
| 83 |
|
| 84 |
unsigned int depsfailedold:2; |
| 85 |
|
| 86 |
unsigned int conflictsfailed:2; |
| 87 |
|
| 88 |
unsigned int was_defaulted:1; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
unsigned int build_deps_output:1; |
| 93 |
|
| 94 |
|
| 95 |
unsigned int explicitly_enabled_only:1; |
| 96 |
|
| 97 |
|
| 98 |
unsigned int is_separator:1; |
| 99 |
|
| 100 |
struct reference_list deps; |
| 101 |
|
| 102 |
struct reference_list conflicts; |
| 103 |
|
| 104 |
struct reference_list uses; |
| 105 |
|
| 106 |
AST_LIST_ENTRY(member) list; |
| 107 |
}; |
| 108 |
|
| 109 |
enum support_level_values { |
| 110 |
SUPPORT_CORE = 0, |
| 111 |
SUPPORT_EXTENDED = 1, |
| 112 |
SUPPORT_DEPRECATED = 2, |
| 113 |
SUPPORT_UNSPECIFIED = 3, |
| 114 |
SUPPORT_EXTERNAL = 4, |
| 115 |
SUPPORT_OPTION = 5, |
| 116 |
SUPPORT_COUNT = 6, |
| 117 |
}; |
| 118 |
|
| 119 |
AST_LIST_HEAD_NOLOCK(support_level_bucket, member); |
| 120 |
|
| 121 |
struct category { |
| 122 |
|
| 123 |
struct support_level_bucket buckets[SUPPORT_COUNT]; |
| 124 |
|
| 125 |
const char *name; |
| 126 |
|
| 127 |
const char *displayname; |
| 128 |
|
| 129 |
const char *remove_on_change; |
| 130 |
|
| 131 |
const char *touch_on_change; |
| 132 |
|
| 133 |
unsigned int positive_output:1; |
| 134 |
|
| 135 |
unsigned int exclusive:1; |
| 136 |
|
| 137 |
AST_LIST_HEAD_NOLOCK(, member) members; |
| 138 |
|
| 139 |
AST_LIST_ENTRY(category) list; |
| 140 |
}; |
| 141 |
|
| 142 |
extern AST_LIST_HEAD_NOLOCK(categories, category) categories; |
| 143 |
|
| 144 |
extern const char *menu_name; |
| 145 |
|
| 146 |
|
| 147 |
int run_menu(void); |
| 148 |
|
| 149 |
int count_categories(void); |
| 150 |
|
| 151 |
int count_members(struct category *cat); |
| 152 |
|
| 153 |
|
| 154 |
void toggle_enabled_index(struct category *cat, int index); |
| 155 |
|
| 156 |
void toggle_enabled(struct member *mem); |
| 157 |
|
| 158 |
|
| 159 |
void set_enabled(struct category *cat, int index); |
| 160 |
|
| 161 |
void clear_enabled(struct category *cat, int index); |
| 162 |
|
| 163 |
|
| 164 |
void set_all(struct category *cat, int val); |
| 165 |
|
| 166 |
|
| 167 |
static inline int strlen_zero(const char *s) |
| 168 |
{ |
| 169 |
return (!s || (*s == '\0')); |
| 170 |
} |
| 171 |
|
| 172 |
#if !defined(ast_strdupa) && defined(__GNUC__) |
| 173 |
#define ast_strdupa(s) \ |
| 174 |
(__extension__ \ |
| 175 |
({ \ |
| 176 |
const char *__old = (s); \ |
| 177 |
size_t __len = strlen(__old) + 1; \ |
| 178 |
char *__new = __builtin_alloca(__len); \ |
| 179 |
memcpy (__new, __old, __len); \ |
| 180 |
__new; \ |
| 181 |
})) |
| 182 |
#endif |
| 183 |
|
| 184 |
#endif |