File: /usr/src/linux/scripts/tkparse.h

1     /*
2      * tkparse.h
3      */
4     
5     /*
6      * Token types (mostly statement types).
7      */
8     
9     enum e_token
10     {
11         token_UNKNOWN,
12         token_bool, 
13         token_choice_header,
14         token_choice_item,
15         token_comment, 
16         token_define_bool,
17         token_define_hex,
18         token_define_int,
19         token_define_string,
20         token_define_tristate,
21         token_dep_bool,
22         token_dep_mbool,
23         token_dep_tristate,
24         token_else, 
25         token_endmenu,
26         token_fi, 
27         token_hex,
28         token_if, 
29         token_int,
30         token_mainmenu_name, 
31         token_mainmenu_option, 
32         token_source,
33         token_string,
34         token_then,
35         token_tristate, 
36         token_unset,
37     };
38     
39     /*
40      * Operator types for conditionals.
41      */
42     
43     enum operator
44     {
45         op_eq,
46         op_neq,
47         op_and,
48         op_and1,
49         op_or,
50         op_bang,
51         op_lparen,
52         op_rparen,
53         op_constant,
54         op_variable,
55         op_true,
56         op_false,
57         op_nuked
58     };
59     
60     /*
61      * Conditions come in linked lists.
62      * Some operators take strings:
63      *
64      *   op_constant   "foo"
65      *   op_variable   "$ARCH", "$CONFIG_PMAC", "$CONFIG_EXPERIMENTAL"
66      *
67      * Most "$..." constructs refer to a variable which is defined somewhere
68      * in the script.  Note that it is legal to test variables which are never
69      * defined, such as variables that are meaningful only on other architectures.
70      */
71     
72     struct condition
73     {
74         struct condition *	next;
75         enum operator	op;
76         const char *	str;		/* op_constant */
77         int			nameindex;	/* op_variable */
78     };
79     
80     /*
81      * Dependency list for dep_bool, dep_mbool, dep_tristate
82      */
83     
84     struct dependency
85     {
86         char *		name;
87         struct dependency *	next;
88     };
89     
90     /*
91      * A statement from a config.in file
92      */
93     
94     struct kconfig
95     {
96         struct kconfig *	next;
97         enum e_token	token;
98         int			nameindex;
99         char *		label;
100         char *		value;
101         struct condition *	cond;
102         struct dependency *	depend;		/* token_dep_tristate */
103         struct kconfig *	cfg_parent;	/* token_choice_item */
104     
105         /* used only in tkgen.c */
106         int			menu_number;
107         int			menu_line;
108         struct kconfig *	menu_next;
109     };
110     
111     struct variable
112     {
113         char *	name;
114         char	defined;
115         char	global_written;
116     };
117     
118     extern struct variable vartable[];
119     extern int max_varnum;
120     
121     /*
122      * Prototypes
123      */
124     
125     extern void fix_conditionals ( struct kconfig * scfg );		/* tkcond.c */
126     extern void dump_tk_script   ( struct kconfig * scfg );		/* tkgen.c  */
127     extern int get_varnum        ( char * name );			/* tkparse.c */
128