annotate kconfig/expr.h @ 1339:a3844a8132bc draft

Isaac Dunham also reported that some diff implementations can't handle nonseekable input, so write to a temporary file instead of <(command). Use trap EXIT to make sure the temporary files get deleted.
author Rob Landley <rob@landley.net>
date Sun, 08 Jun 2014 14:01:37 -0500
parents 4d21d59f3206
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
1 /*
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
3 * Released under the terms of the GNU GPL v2.0.
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
4 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
5
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
6 #ifndef EXPR_H
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
7 #define EXPR_H
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
8
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
9 #ifdef __cplusplus
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
10 extern "C" {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
11 #endif
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
12
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
13 #include <stdio.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
14 #ifndef __cplusplus
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
15 #include <stdbool.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
16 #endif
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
17
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
18 struct file {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
19 struct file *next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
20 struct file *parent;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
21 char *name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
22 int lineno;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
23 int flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
24 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
25
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
26 #define FILE_BUSY 0x0001
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
27 #define FILE_SCANNED 0x0002
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
28 #define FILE_PRINTED 0x0004
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
29
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
30 typedef enum tristate {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
31 no, mod, yes
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
32 } tristate;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
33
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
34 enum expr_type {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
35 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
36 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
37
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
38 union expr_data {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
39 struct expr *expr;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
40 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
41 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
42
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
43 struct expr {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
44 enum expr_type type;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
45 union expr_data left, right;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
46 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
47
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
48 #define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
49 #define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
50 #define E_NOT(dep) (2-(dep))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
51
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
52 struct expr_value {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
53 struct expr *expr;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
54 tristate tri;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
55 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
56
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
57 struct symbol_value {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
58 void *val;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
59 tristate tri;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
60 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
61
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
62 enum symbol_type {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
63 S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
64 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
65
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
66 enum {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
67 S_DEF_USER, /* main user value */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
68 S_DEF_AUTO,
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
69 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
70
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
71 struct symbol {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
72 struct symbol *next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
73 char *name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
74 char *help;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
75 enum symbol_type type;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
76 struct symbol_value curr;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
77 struct symbol_value def[4];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
78 tristate visible;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
79 int flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
80 struct property *prop;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
81 struct expr *dep, *dep2;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
82 struct expr_value rev_dep;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
83 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
84
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
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)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
86
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
87 #define SYMBOL_CONST 0x0001
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
88 #define SYMBOL_CHECK 0x0008
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
89 #define SYMBOL_CHOICE 0x0010
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
90 #define SYMBOL_CHOICEVAL 0x0020
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
91 #define SYMBOL_PRINTED 0x0040
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
92 #define SYMBOL_VALID 0x0080
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
93 #define SYMBOL_OPTIONAL 0x0100
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
94 #define SYMBOL_WRITE 0x0200
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
95 #define SYMBOL_CHANGED 0x0400
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
96 #define SYMBOL_AUTO 0x1000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
97 #define SYMBOL_CHECKED 0x2000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
98 #define SYMBOL_WARNED 0x8000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
99 #define SYMBOL_DEF 0x10000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
100 #define SYMBOL_DEF_USER 0x10000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
101 #define SYMBOL_DEF_AUTO 0x20000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
102 #define SYMBOL_DEF3 0x40000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
103 #define SYMBOL_DEF4 0x80000
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
104
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
105 #define SYMBOL_MAXLENGTH 256
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
106 #define SYMBOL_HASHSIZE 257
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
107 #define SYMBOL_HASHMASK 0xff
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
108
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
109 enum prop_type {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
110 P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
111 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
112
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
113 struct property {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
114 struct property *next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
115 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
116 enum prop_type type;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
117 const char *text;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
118 struct expr_value visible;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
119 struct expr *expr;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
120 struct menu *menu;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
121 struct file *file;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
122 int lineno;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
123 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
124
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
125 #define for_all_properties(sym, st, tok) \
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
126 for (st = sym->prop; st; st = st->next) \
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
127 if (st->type == (tok))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
128 #define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
129 #define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
130 #define for_all_prompts(sym, st) \
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
131 for (st = sym->prop; st; st = st->next) \
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
132 if (st->text)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
133
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
134 struct menu {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
135 struct menu *next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
136 struct menu *parent;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
137 struct menu *list;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
138 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
139 struct property *prompt;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
140 struct expr *dep;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
141 unsigned int flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
142 //char *help;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
143 struct file *file;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
144 int lineno;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
145 void *data;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
146 };
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
147
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
148 #define MENU_CHANGED 0x0001
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
149 #define MENU_ROOT 0x0002
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
150
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
151 #ifndef SWIG
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
152
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
153 extern struct file *file_list;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
154 extern struct file *current_file;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
155 struct file *lookup_file(const char *name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
156
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
157 extern struct symbol symbol_yes, symbol_no, symbol_mod;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
158 extern struct symbol *modules_sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
159 extern struct symbol *sym_defconfig_list;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
160 extern int cdebug;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
161 struct expr *expr_alloc_symbol(struct symbol *sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
162 struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
163 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
164 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
165 struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
166 struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
167 struct expr *expr_copy(struct expr *org);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
168 void expr_free(struct expr *e);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
169 int expr_eq(struct expr *e1, struct expr *e2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
170 void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
171 tristate expr_calc_value(struct expr *e);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
172 struct expr *expr_eliminate_yn(struct expr *e);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
173 struct expr *expr_trans_bool(struct expr *e);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
174 struct expr *expr_eliminate_dups(struct expr *e);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
175 struct expr *expr_transform(struct expr *e);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
176 int expr_contains_symbol(struct expr *dep, struct symbol *sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
177 bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
178 struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
179 struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
180 void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
181 struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
182
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
183 void expr_fprint(struct expr *e, FILE *out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
184 struct gstr; /* forward */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
185 void expr_gstr_print(struct expr *e, struct gstr *gs);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
186
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
187 static inline int expr_is_yes(struct expr *e)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
188 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
189 return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
190 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
191
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
192 static inline int expr_is_no(struct expr *e)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
193 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
194 return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
195 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
196 #endif
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
197
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
198 #ifdef __cplusplus
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
199 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
200 #endif
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
201
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
202 #endif /* EXPR_H */