kconfig/expr.h
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jun 10 22:10:40 2008 +0000 (2008-06-10)
changeset 552 4edbcdb17e3d
child 943 1cca90ce0481
permissions -rw-r--r--
Vampirise patches for gcc-4.3.{0,1} from gentoo. Absolutely untested...

/trunk/patches/gcc/4.3.0/275-gcc-x86-emit-cld.patch | 156 156 0 0 +
/trunk/patches/gcc/4.3.0/450-gcc4-noteGNUstack.patch | 198 198 0 0 +
/trunk/patches/gcc/4.3.0/550-gcc43-pr25343.patch | 21 21 0 0 +
/trunk/patches/gcc/4.3.0/375-gcc43-pr35440.patch | 59 59 0 0 +
/trunk/patches/gcc/4.3.0/125-gcc-trampolinewarn.patch | 35 35 0 0 +
/trunk/patches/gcc/4.3.0/475-gcc43-pr35705.patch | 21 21 0 0 +
/trunk/patches/gcc/4.3.0/700-204-uclibc-locale-wchar_fix.patch | 51 51 0 0 +
/trunk/patches/gcc/4.3.0/775-303-c99-complex-ugly-hack.patch | 14 14 0 0 +
/trunk/patches/gcc/4.3.0/575-sh-pr24836.patch | 28 28 0 0 +
/trunk/patches/gcc/4.3.0/675-203-uclibc-locale-no__x.patch | 224 224 0 0 +
/trunk/patches/gcc/4.3.0/400-gcc43-pr24170.patch | 61 61 0 0 +
/trunk/patches/gcc/4.3.0/100-gcc-4.1-alpha-mieee-default.patch | 34 34 0 0 +
/trunk/patches/gcc/4.3.0/825-305-libmudflap-susv3-legacy.patch | 49 49 0 0 +
/trunk/patches/gcc/4.3.0/175-gcc-4.1-cross-compile.patch | 44 44 0 0 +
/trunk/patches/gcc/4.3.0/850-306-libstdc++-namespace.patch | 38 38 0 0 +
/trunk/patches/gcc/4.3.0/200-gcc-netbsd-symbolic.patch | 14 14 0 0 +
/trunk/patches/gcc/4.3.0/750-301-missing-execinfo_h.patch | 13 13 0 0 +
/trunk/patches/gcc/4.3.0/225-gcc-sparc64-bsd.patch | 30 30 0 0 +
/trunk/patches/gcc/4.3.0/350-300-libstdc++-pic.patch | 56 56 0 0 +
/trunk/patches/gcc/4.3.0/500-gcc43-pr34571.patch | 35 35 0 0 +
/trunk/patches/gcc/4.3.0/300-gcc-3.4-libiberty-pic.patch | 12 12 0 0 +
/trunk/patches/gcc/4.3.0/625-103-uclibc-conf-noupstream.patch | 13 13 0 0 +
/trunk/patches/gcc/4.3.0/425-gcc4-ia64-noteGNUstack.patch | 96 96 0 0 +
/trunk/patches/gcc/4.3.0/325-gcc4-superh-default-multilib.patch | 25 25 0 0 +
/trunk/patches/gcc/4.3.0/725-205-uclibc-locale-update.patch | 355 355 0 0 ++
/trunk/patches/gcc/4.3.0/800-304-index_macro.patch | 27 27 0 0 +
/trunk/patches/gcc/4.3.0/600-gcc-ca-translation-typo.patch | 19 19 0 0 +
/trunk/patches/gcc/4.3.0/650-200-uclibc-locale.patch | 2794 2794 0 0 +++++++++++++++
/trunk/patches/gcc/4.3.0/525-gcc43-pr35982.patch | 23 23 0 0 +
/trunk/patches/gcc/4.3.0/150-gcc43-java-nomulti.patch | 47 47 0 0 +
/trunk/patches/gcc/4.3.0/250-904-flatten-switch-stmt-00.patch | 76 76 0 0 +
/trunk/patches/gcc/4.3.1/100-gcc-4.1-alpha-mieee-default.patch | 34 34 0 0 +
/trunk/patches/gcc/4.3.1/500-103-uclibc-conf-noupstream.patch | 13 13 0 0 +
/trunk/patches/gcc/4.3.1/175-gcc-4.1-cross-compile.patch | 44 44 0 0 +
/trunk/patches/gcc/4.3.1/400-gcc4-noteGNUstack.patch | 198 198 0 0 +
/trunk/patches/gcc/4.3.1/600-205-uclibc-locale-update.patch | 355 355 0 0 ++
/trunk/patches/gcc/4.3.1/725-306-libstdc++-namespace.patch | 38 38 0 0 +
/trunk/patches/gcc/4.3.1/350-gcc43-pr24170.patch | 61 61 0 0 +
/trunk/patches/gcc/4.3.1/300-gcc4-superh-default-multilib.patch | 25 25 0 0 +
/trunk/patches/gcc/4.3.1/575-204-uclibc-locale-wchar_fix.patch | 51 51 0 0 +
/trunk/patches/gcc/4.3.1/200-gcc-netbsd-symbolic.patch | 14 14 0 0 +
/trunk/patches/gcc/4.3.1/225-gcc-sparc64-bsd.patch | 30 30 0 0 +
/trunk/patches/gcc/4.3.1/450-gcc43-pr25343.patch | 21 21 0 0 +
/trunk/patches/gcc/4.3.1/625-301-missing-execinfo_h.patch | 13 13 0 0 +
/trunk/patches/gcc/4.3.1/325-300-libstdc++-pic.patch | 56 56 0 0 +
/trunk/patches/gcc/4.3.1/425-gcc43-pr34571.patch | 35 35 0 0 +
/trunk/patches/gcc/4.3.1/375-gcc4-ia64-noteGNUstack.patch | 96 96 0 0 +
/trunk/patches/gcc/4.3.1/125-gcc-trampolinewarn.patch | 35 35 0 0 +
/trunk/patches/gcc/4.3.1/275-gcc-3.4-libiberty-pic.patch | 12 12 0 0 +
/trunk/patches/gcc/4.3.1/650-303-c99-complex-ugly-hack.patch | 14 14 0 0 +
/trunk/patches/gcc/4.3.1/525-200-uclibc-locale.patch | 2794 2794 0 0 +++++++++++++++
/trunk/patches/gcc/4.3.1/550-203-uclibc-locale-no__x.patch | 224 224 0 0 +
/trunk/patches/gcc/4.3.1/150-gcc43-java-nomulti.patch | 47 47 0 0 +
/trunk/patches/gcc/4.3.1/700-305-libmudflap-susv3-legacy.patch | 49 49 0 0 +
/trunk/patches/gcc/4.3.1/675-304-index_macro.patch | 27 27 0 0 +
/trunk/patches/gcc/4.3.1/250-904-flatten-switch-stmt-00.patch | 76 76 0 0 +
/trunk/patches/gcc/4.3.1/475-sh-pr24836.patch | 28 28 0 0 +
57 files changed, 9058 insertions(+)
yann@1
     1
/*
yann@1
     2
 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
yann@1
     3
 * Released under the terms of the GNU GPL v2.0.
yann@1
     4
 */
yann@1
     5
yann@1
     6
#ifndef EXPR_H
yann@1
     7
#define EXPR_H
yann@1
     8
yann@1
     9
#ifdef __cplusplus
yann@1
    10
extern "C" {
yann@1
    11
#endif
yann@1
    12
yann@1
    13
#include <stdio.h>
yann@1
    14
#ifndef __cplusplus
yann@1
    15
#include <stdbool.h>
yann@1
    16
#endif
yann@1
    17
yann@1
    18
struct file {
yann@1
    19
	struct file *next;
yann@1
    20
	struct file *parent;
yann@1
    21
	char *name;
yann@1
    22
	int lineno;
yann@1
    23
	int flags;
yann@1
    24
};
yann@1
    25
yann@1
    26
#define FILE_BUSY		0x0001
yann@1
    27
#define FILE_SCANNED		0x0002
yann@1
    28
#define FILE_PRINTED		0x0004
yann@1
    29
yann@1
    30
typedef enum tristate {
yann@1
    31
	no, mod, yes
yann@1
    32
} tristate;
yann@1
    33
yann@1
    34
enum expr_type {
yann@1
    35
	E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
yann@1
    36
};
yann@1
    37
yann@1
    38
union expr_data {
yann@1
    39
	struct expr *expr;
yann@1
    40
	struct symbol *sym;
yann@1
    41
};
yann@1
    42
yann@1
    43
struct expr {
yann@1
    44
	enum expr_type type;
yann@1
    45
	union expr_data left, right;
yann@1
    46
};
yann@1
    47
yann@1
    48
#define E_OR(dep1, dep2)	(((dep1)>(dep2))?(dep1):(dep2))
yann@1
    49
#define E_AND(dep1, dep2)	(((dep1)<(dep2))?(dep1):(dep2))
yann@1
    50
#define E_NOT(dep)		(2-(dep))
yann@1
    51
yann@1
    52
struct expr_value {
yann@1
    53
	struct expr *expr;
yann@1
    54
	tristate tri;
yann@1
    55
};
yann@1
    56
yann@1
    57
struct symbol_value {
yann@1
    58
	void *val;
yann@1
    59
	tristate tri;
yann@1
    60
};
yann@1
    61
yann@1
    62
enum symbol_type {
yann@1
    63
	S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
yann@1
    64
};
yann@1
    65
yann@1
    66
enum {
yann@1
    67
	S_DEF_USER,		/* main user value */
yann@1
    68
	S_DEF_AUTO,
yann@1
    69
};
yann@1
    70
yann@1
    71
struct symbol {
yann@1
    72
	struct symbol *next;
yann@1
    73
	char *name;
yann@1
    74
	char *help;
yann@1
    75
	enum symbol_type type;
yann@1
    76
	struct symbol_value curr;
yann@1
    77
	struct symbol_value def[4];
yann@1
    78
	tristate visible;
yann@1
    79
	int flags;
yann@1
    80
	struct property *prop;
yann@1
    81
	struct expr *dep, *dep2;
yann@1
    82
	struct expr_value rev_dep;
yann@1
    83
};
yann@1
    84
yann@1
    85
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
yann@1
    86
yann@1
    87
#define SYMBOL_CONST		0x0001
yann@1
    88
#define SYMBOL_CHECK		0x0008
yann@1
    89
#define SYMBOL_CHOICE		0x0010
yann@1
    90
#define SYMBOL_CHOICEVAL	0x0020
yann@1
    91
#define SYMBOL_PRINTED		0x0040
yann@1
    92
#define SYMBOL_VALID		0x0080
yann@1
    93
#define SYMBOL_OPTIONAL		0x0100
yann@1
    94
#define SYMBOL_WRITE		0x0200
yann@1
    95
#define SYMBOL_CHANGED		0x0400
yann@1
    96
#define SYMBOL_AUTO		0x1000
yann@1
    97
#define SYMBOL_CHECKED		0x2000
yann@1
    98
#define SYMBOL_WARNED		0x8000
yann@1
    99
#define SYMBOL_DEF		0x10000
yann@1
   100
#define SYMBOL_DEF_USER		0x10000
yann@1
   101
#define SYMBOL_DEF_AUTO		0x20000
yann@1
   102
#define SYMBOL_DEF3		0x40000
yann@1
   103
#define SYMBOL_DEF4		0x80000
yann@1
   104
yann@1
   105
#define SYMBOL_MAXLENGTH	256
yann@1
   106
#define SYMBOL_HASHSIZE		257
yann@1
   107
#define SYMBOL_HASHMASK		0xff
yann@1
   108
yann@1
   109
enum prop_type {
yann@1
   110
	P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
yann@1
   111
};
yann@1
   112
yann@1
   113
struct property {
yann@1
   114
	struct property *next;
yann@1
   115
	struct symbol *sym;
yann@1
   116
	enum prop_type type;
yann@1
   117
	const char *text;
yann@1
   118
	struct expr_value visible;
yann@1
   119
	struct expr *expr;
yann@1
   120
	struct menu *menu;
yann@1
   121
	struct file *file;
yann@1
   122
	int lineno;
yann@1
   123
};
yann@1
   124
yann@1
   125
#define for_all_properties(sym, st, tok) \
yann@1
   126
	for (st = sym->prop; st; st = st->next) \
yann@1
   127
		if (st->type == (tok))
yann@1
   128
#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
yann@1
   129
#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
yann@1
   130
#define for_all_prompts(sym, st) \
yann@1
   131
	for (st = sym->prop; st; st = st->next) \
yann@1
   132
		if (st->text)
yann@1
   133
yann@1
   134
struct menu {
yann@1
   135
	struct menu *next;
yann@1
   136
	struct menu *parent;
yann@1
   137
	struct menu *list;
yann@1
   138
	struct symbol *sym;
yann@1
   139
	struct property *prompt;
yann@1
   140
	struct expr *dep;
yann@1
   141
	unsigned int flags;
yann@1
   142
	//char *help;
yann@1
   143
	struct file *file;
yann@1
   144
	int lineno;
yann@1
   145
	void *data;
yann@1
   146
};
yann@1
   147
yann@1
   148
#define MENU_CHANGED		0x0001
yann@1
   149
#define MENU_ROOT		0x0002
yann@1
   150
yann@1
   151
#ifndef SWIG
yann@1
   152
yann@1
   153
extern struct file *file_list;
yann@1
   154
extern struct file *current_file;
yann@1
   155
struct file *lookup_file(const char *name);
yann@1
   156
yann@1
   157
extern struct symbol symbol_yes, symbol_no, symbol_mod;
yann@1
   158
extern struct symbol *modules_sym;
yann@1
   159
extern struct symbol *sym_defconfig_list;
yann@1
   160
extern int cdebug;
yann@1
   161
struct expr *expr_alloc_symbol(struct symbol *sym);
yann@1
   162
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
yann@1
   163
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
yann@1
   164
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
yann@1
   165
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
yann@1
   166
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
yann@1
   167
struct expr *expr_copy(struct expr *org);
yann@1
   168
void expr_free(struct expr *e);
yann@1
   169
int expr_eq(struct expr *e1, struct expr *e2);
yann@1
   170
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
yann@1
   171
tristate expr_calc_value(struct expr *e);
yann@1
   172
struct expr *expr_eliminate_yn(struct expr *e);
yann@1
   173
struct expr *expr_trans_bool(struct expr *e);
yann@1
   174
struct expr *expr_eliminate_dups(struct expr *e);
yann@1
   175
struct expr *expr_transform(struct expr *e);
yann@1
   176
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
yann@1
   177
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
yann@1
   178
struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
yann@1
   179
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
yann@1
   180
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
yann@1
   181
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
yann@1
   182
yann@1
   183
void expr_fprint(struct expr *e, FILE *out);
yann@1
   184
struct gstr; /* forward */
yann@1
   185
void expr_gstr_print(struct expr *e, struct gstr *gs);
yann@1
   186
yann@1
   187
static inline int expr_is_yes(struct expr *e)
yann@1
   188
{
yann@1
   189
	return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
yann@1
   190
}
yann@1
   191
yann@1
   192
static inline int expr_is_no(struct expr *e)
yann@1
   193
{
yann@1
   194
	return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
yann@1
   195
}
yann@1
   196
#endif
yann@1
   197
yann@1
   198
#ifdef __cplusplus
yann@1
   199
}
yann@1
   200
#endif
yann@1
   201
yann@1
   202
#endif /* EXPR_H */