Standardize on the vi editing directives being on the first line.
[platform/upstream/busybox.git] / scripts / config / lkc.h
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4  * Released under the terms of the GNU GPL v2.0.
5  */
6
7 #ifndef LKC_H
8 #define LKC_H
9
10 #include "expr.h"
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #ifdef LKC_DIRECT_LINK
17 #define P(name,type,arg)        extern type name arg
18 #else
19 #include "lkc_defs.h"
20 #define P(name,type,arg)        extern type (*name ## _p) arg
21 #endif
22 #include "lkc_proto.h"
23 #undef P
24
25 #define SRCTREE "srctree"
26
27 int zconfparse(void);
28 void zconfdump(FILE *out);
29
30 extern int zconfdebug;
31 void zconf_starthelp(void);
32 FILE *zconf_fopen(const char *name);
33 void zconf_initscan(const char *name);
34 void zconf_nextfile(const char *name);
35 int zconf_lineno(void);
36 char *zconf_curname(void);
37
38 /* confdata.c */
39 extern const char conf_def_filename[];
40 extern char conf_filename[];
41
42 char *conf_get_default_confname(void);
43
44 /* kconfig_load.c */
45 void kconfig_load(void);
46
47 /* menu.c */
48 void menu_init(void);
49 void menu_add_menu(void);
50 void menu_end_menu(void);
51 void menu_add_entry(struct symbol *sym);
52 void menu_end_entry(void);
53 void menu_add_dep(struct expr *dep);
54 struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
55 void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
56 void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
57 void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
58 void menu_finalize(struct menu *parent);
59 void menu_set_type(int type);
60
61 /* util.c */
62 struct file *file_lookup(const char *name);
63 int file_write_dep(const char *name);
64
65 struct gstr {
66         size_t len;
67         char  *s;
68 };
69 struct gstr str_new(void);
70 struct gstr str_assign(const char *s);
71 void str_free(struct gstr *gs);
72 void str_append(struct gstr *gs, const char *s);
73 void str_printf(struct gstr *gs, const char *fmt, ...);
74 const char *str_get(struct gstr *gs);
75
76 /* symbol.c */
77 void sym_init(void);
78 void sym_clear_all_valid(void);
79 void sym_set_changed(struct symbol *sym);
80 struct symbol *sym_check_deps(struct symbol *sym);
81 struct property *prop_alloc(enum prop_type type, struct symbol *sym);
82 struct symbol *prop_get_symbol(struct property *prop);
83
84 static inline tristate sym_get_tristate_value(struct symbol *sym)
85 {
86         return sym->curr.tri;
87 }
88
89
90 static inline struct symbol *sym_get_choice_value(struct symbol *sym)
91 {
92         return (struct symbol *)sym->curr.val;
93 }
94
95 static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
96 {
97         return sym_set_tristate_value(chval, yes);
98 }
99
100 static inline bool sym_is_choice(struct symbol *sym)
101 {
102         return sym->flags & SYMBOL_CHOICE ? true : false;
103 }
104
105 static inline bool sym_is_choice_value(struct symbol *sym)
106 {
107         return sym->flags & SYMBOL_CHOICEVAL ? true : false;
108 }
109
110 static inline bool sym_is_optional(struct symbol *sym)
111 {
112         return sym->flags & SYMBOL_OPTIONAL ? true : false;
113 }
114
115 static inline bool sym_has_value(struct symbol *sym)
116 {
117         return sym->flags & SYMBOL_NEW ? false : true;
118 }
119
120 #ifdef __cplusplus
121 }
122 #endif
123
124 #endif /* LKC_H */