summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile25
-rw-r--r--scripts/kconfig/conf.c2
-rw-r--r--scripts/kconfig/confdata.c136
-rw-r--r--scripts/kconfig/expr.c18
-rw-r--r--scripts/kconfig/expr.h6
-rw-r--r--scripts/kconfig/gconf.c30
-rw-r--r--scripts/kconfig/images.c34
-rw-r--r--scripts/kconfig/images.h33
-rw-r--r--scripts/kconfig/kconf_id.c52
-rw-r--r--scripts/kconfig/lkc.h25
-rw-r--r--scripts/kconfig/lxdialog/checklist.c15
-rw-r--r--scripts/kconfig/lxdialog/dialog.h15
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c15
-rw-r--r--scripts/kconfig/lxdialog/menubox.c15
-rw-r--r--scripts/kconfig/lxdialog/textbox.c15
-rw-r--r--scripts/kconfig/lxdialog/util.c15
-rw-r--r--scripts/kconfig/lxdialog/yesno.c15
-rw-r--r--scripts/kconfig/mconf.c2
-rw-r--r--scripts/kconfig/menu.c43
-rwxr-xr-xscripts/kconfig/merge_config.sh48
-rw-r--r--scripts/kconfig/nconf.c5
-rw-r--r--scripts/kconfig/nconf.gui.c5
-rw-r--r--scripts/kconfig/nconf.h5
-rw-r--r--scripts/kconfig/preprocess.c5
-rw-r--r--scripts/kconfig/qconf.cc4
-rw-r--r--scripts/kconfig/qconf.h2
-rwxr-xr-xscripts/kconfig/streamline_config.pl2
-rw-r--r--scripts/kconfig/symbol.c7
-rw-r--r--scripts/kconfig/tests/auto_submenu/Kconfig2
-rw-r--r--scripts/kconfig/tests/auto_submenu/__init__.py1
-rw-r--r--scripts/kconfig/tests/choice/Kconfig2
-rw-r--r--scripts/kconfig/tests/choice/__init__.py1
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/Kconfig2
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/__init__.py1
-rw-r--r--scripts/kconfig/tests/err_recursive_inc/__init__.py1
-rw-r--r--scripts/kconfig/tests/inter_choice/Kconfig2
-rw-r--r--scripts/kconfig/tests/inter_choice/__init__.py1
-rw-r--r--scripts/kconfig/tests/new_choice_with_dep/Kconfig2
-rw-r--r--scripts/kconfig/tests/new_choice_with_dep/__init__.py1
-rw-r--r--scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig2
-rw-r--r--scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py1
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/Kconfig2
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/__init__.py1
-rw-r--r--scripts/kconfig/util.c3
-rw-r--r--scripts/kconfig/zconf.l235
-rw-r--r--scripts/kconfig/zconf.y290
46 files changed, 499 insertions, 645 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 63b609243d03..ec204fa54c9a 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -142,23 +142,20 @@ help:
@echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
# ===========================================================================
-# Shared Makefile for the various kconfig executables:
-# conf: Used for defconfig, oldconfig and related targets
# object files used by all kconfig flavours
+common-objs := confdata.o expr.o symbol.o preprocess.o zconf.lex.o zconf.tab.o
-conf-objs := conf.o zconf.tab.o
-
-hostprogs-y := conf
-
-targets += zconf.lex.c
-
-# generated files seem to need this to find local include files
+$(obj)/zconf.lex.o: $(obj)/zconf.tab.h
HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src)
+# conf: Used for defconfig, oldconfig and related targets
+hostprogs-y += conf
+conf-objs := conf.o $(common-objs)
+
# nconf: Used for the nconfig target based on ncurses
hostprogs-y += nconf
-nconf-objs := nconf.o zconf.tab.o nconf.gui.o
+nconf-objs := nconf.o nconf.gui.o $(common-objs)
HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
@@ -169,7 +166,7 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg
# mconf: Used for the menuconfig target based on lxdialog
hostprogs-y += mconf
lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
-mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog))
+mconf-objs := mconf.o $(addprefix lxdialog/, $(lxdialog)) $(common-objs)
HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
$(foreach f, mconf.o $(lxdialog), \
@@ -181,7 +178,7 @@ $(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg
# qconf: Used for the xconfig target based on Qt
hostprogs-y += qconf
qconf-cxxobjs := qconf.o
-qconf-objs := zconf.tab.o
+qconf-objs := images.o $(common-objs)
HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
@@ -196,15 +193,13 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
# gconf: Used for the gconfig target based on GTK+
hostprogs-y += gconf
-gconf-objs := gconf.o zconf.tab.o
+gconf-objs := gconf.o images.o $(common-objs)
HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
$(obj)/gconf.o: $(obj)/.gconf-cfg
-$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
-
# check if necessary packages are available, and configure build flags
define filechk_conf_cfg
$(CONFIG_SHELL) $<
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 98e0c7a34699..da89ef788a8d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
*/
#include <ctype.h>
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 91d0a5c014ac..08ba146a83c5 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1,12 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
*/
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -74,6 +75,47 @@ static int make_parent_dir(const char *path)
return 0;
}
+static char depfile_path[PATH_MAX];
+static size_t depfile_prefix_len;
+
+/* touch depfile for symbol 'name' */
+static int conf_touch_dep(const char *name)
+{
+ int fd, ret;
+ const char *s;
+ char *d, c;
+
+ /* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */
+ if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path))
+ return -1;
+
+ d = depfile_path + depfile_prefix_len;
+ s = name;
+
+ while ((c = *s++))
+ *d++ = (c == '_') ? '/' : tolower(c);
+ strcpy(d, ".h");
+
+ /* Assume directory path already exists. */
+ fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ if (fd == -1) {
+ if (errno != ENOENT)
+ return -1;
+
+ ret = make_parent_dir(depfile_path);
+ if (ret)
+ return ret;
+
+ /* Try it again. */
+ fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ if (fd == -1)
+ return -1;
+ }
+ close(fd);
+
+ return 0;
+}
+
struct conf_printer {
void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
void (*print_comment)(FILE *, const char *, void *);
@@ -186,14 +228,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
conf_warning("symbol value '%s' invalid for %s",
p, sym->name);
return 1;
- case S_OTHER:
- if (*p != '"') {
- for (p2 = p; *p2 && !isspace(*p2); p2++)
- ;
- sym->type = S_STRING;
- goto done;
- }
- /* fall through */
case S_STRING:
if (*p++ != '"')
break;
@@ -212,7 +246,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
/* fall through */
case S_INT:
case S_HEX:
- done:
if (sym_string_valid(sym, p)) {
sym->def[def].val = xstrdup(p);
sym->flags |= def_flags;
@@ -363,7 +396,7 @@ load:
sym = sym_find(line + 2 + strlen(CONFIG_));
if (!sym) {
sym_add_change_count(1);
- goto setsym;
+ continue;
}
} else {
sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
@@ -393,17 +426,22 @@ load:
if (*p2 == '\r')
*p2 = 0;
}
- if (def == S_DEF_USER) {
- sym = sym_find(line + strlen(CONFIG_));
- if (!sym) {
+
+ sym = sym_find(line + strlen(CONFIG_));
+ if (!sym) {
+ if (def == S_DEF_AUTO)
+ /*
+ * Reading from include/config/auto.conf
+ * If CONFIG_FOO previously existed in
+ * auto.conf but it is missing now,
+ * include/config/foo.h must be touched.
+ */
+ conf_touch_dep(line + strlen(CONFIG_));
+ else
sym_add_change_count(1);
- goto setsym;
- }
- } else {
- sym = sym_lookup(line + strlen(CONFIG_), 0);
- if (sym->type == S_UNKNOWN)
- sym->type = S_OTHER;
+ continue;
}
+
if (sym->flags & def_flags) {
conf_warning("override: reassigning to symbol %s", sym->name);
}
@@ -416,7 +454,7 @@ load:
continue;
}
-setsym:
+
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->def[def].tri) {
@@ -669,7 +707,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym,
const char *str;
switch (sym->type) {
- case S_OTHER:
case S_UNKNOWN:
break;
case S_STRING:
@@ -906,24 +943,19 @@ static int conf_write_dep(const char *name)
return 0;
}
-static int conf_split_config(void)
+static int conf_touch_deps(void)
{
const char *name;
- char path[PATH_MAX+1];
- char *s, *d, c;
struct symbol *sym;
- int res, i, fd;
+ int res, i;
+
+ strcpy(depfile_path, "include/config/");
+ depfile_prefix_len = strlen(depfile_path);
name = conf_get_autoconfig_name();
conf_read_simple(name, S_DEF_AUTO);
sym_calc_value(modules_sym);
- if (make_parent_dir("include/config/foo.h"))
- return 1;
- if (chdir("include/config"))
- return 1;
-
- res = 0;
for_all_symbols(i, sym) {
sym_calc_value(sym);
if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
@@ -975,42 +1007,12 @@ static int conf_split_config(void)
* different from 'no').
*/
- /* Replace all '_' and append ".h" */
- s = sym->name;
- d = path;
- while ((c = *s++)) {
- c = tolower(c);
- *d++ = (c == '_') ? '/' : c;
- }
- strcpy(d, ".h");
-
- /* Assume directory path already exists. */
- fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
- if (fd == -1) {
- if (errno != ENOENT) {
- res = 1;
- break;
- }
-
- if (make_parent_dir(path)) {
- res = 1;
- goto out;
- }
-
- /* Try it again. */
- fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
- if (fd == -1) {
- res = 1;
- break;
- }
- }
- close(fd);
+ res = conf_touch_dep(sym->name);
+ if (res)
+ return res;
}
-out:
- if (chdir("../.."))
- return 1;
- return res;
+ return 0;
}
int conf_write_autoconf(int overwrite)
@@ -1028,7 +1030,7 @@ int conf_write_autoconf(int overwrite)
conf_write_dep("include/config/auto.conf.cmd");
- if (conf_split_config())
+ if (conf_touch_deps())
return 1;
out = fopen(".tmpconfig", "w");
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index e1a39e90841d..77ffff3a053c 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1,8 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
*/
+#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -980,7 +982,6 @@ enum string_value_kind {
k_string,
k_signed,
k_unsigned,
- k_invalid
};
union string_value {
@@ -1011,13 +1012,10 @@ static enum string_value_kind expr_parse_string(const char *str,
val->u = strtoull(str, &tail, 16);
kind = k_unsigned;
break;
- case S_STRING:
- case S_UNKNOWN:
+ default:
val->s = strtoll(str, &tail, 0);
kind = k_signed;
break;
- default:
- return k_invalid;
}
return !errno && !*tail && tail > str && isxdigit(tail[-1])
? kind : k_string;
@@ -1073,13 +1071,7 @@ tristate expr_calc_value(struct expr *e)
if (k1 == k_string || k2 == k_string)
res = strcmp(str1, str2);
- else if (k1 == k_invalid || k2 == k_invalid) {
- if (e->type != E_EQUAL && e->type != E_UNEQUAL) {
- printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2);
- return no;
- }
- res = strcmp(str1, str2);
- } else if (k1 == k_unsigned || k2 == k_unsigned)
+ else if (k1 == k_unsigned || k2 == k_unsigned)
res = (lval.u > rval.u) - (lval.u < rval.u);
else /* if (k1 == k_signed && k2 == k_signed) */
res = (lval.s > rval.s) - (lval.s < rval.s);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 7c329e179007..999edb60cd53 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -1,6 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
*/
#ifndef EXPR_H
@@ -62,7 +62,7 @@ struct symbol_value {
};
enum symbol_type {
- S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
+ S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING
};
/* enum values are used as index to symbol.def[] */
@@ -131,7 +131,7 @@ struct symbol {
struct expr_value implied;
};
-#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
+#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
#define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 36f578415c4a..5d4ecf309ee4 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -1,9 +1,6 @@
-/* Hey EMACS -*- linux-c -*- */
+// SPDX-License-Identifier: GPL-2.0
/*
- *
* Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info>
- * Released under the terms of the GNU GPL v2.0.
- *
*/
#ifdef HAVE_CONFIG_H
@@ -12,7 +9,7 @@
#include <stdlib.h>
#include "lkc.h"
-#include "images.c"
+#include "images.h"
#include <glade/glade.h>
#include <gtk/gtk.h>
@@ -78,8 +75,8 @@ static gchar **fill_row(struct menu *menu);
static void conf_changed(void);
/* Helping/Debugging Functions */
-
-const char *dbg_sym_flags(int val)
+#ifdef DEBUG
+static const char *dbg_sym_flags(int val)
{
static char buf[256];
@@ -108,9 +105,10 @@ const char *dbg_sym_flags(int val)
return buf;
}
+#endif
-void replace_button_icon(GladeXML * xml, GdkDrawable * window,
- GtkStyle * style, gchar * btn_name, gchar ** xpm)
+static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
+ GtkStyle *style, gchar *btn_name, gchar **xpm)
{
GdkPixmap *pixmap;
GdkBitmap *mask;
@@ -128,7 +126,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window,
}
/* Main Window Initialization */
-void init_main_window(const gchar * glade_file)
+static void init_main_window(const gchar *glade_file)
{
GladeXML *xml;
GtkWidget *widget;
@@ -190,7 +188,7 @@ void init_main_window(const gchar * glade_file)
gtk_widget_show(main_wnd);
}
-void init_tree_model(void)
+static void init_tree_model(void)
{
gint i;
@@ -220,7 +218,7 @@ void init_tree_model(void)
model1 = GTK_TREE_MODEL(tree1);
}
-void init_left_tree(void)
+static void init_left_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
GtkCellRenderer *renderer;
@@ -262,7 +260,7 @@ static void renderer_edited(GtkCellRendererText * cell,
const gchar * path_string,
const gchar * new_text, gpointer user_data);
-void init_right_tree(void)
+static void init_right_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree2_w);
GtkCellRenderer *renderer;
@@ -1212,8 +1210,8 @@ static GtkTreeIter found;
/*
* Find a menu in the GtkTree starting at parent.
*/
-GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent,
- struct menu *tofind)
+static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent,
+ struct menu *tofind)
{
GtkTreeIter iter;
GtkTreeIter *child = &iter;
@@ -1424,7 +1422,7 @@ static void display_list(void)
tree = tree2;
}
-void fixup_rootmenu(struct menu *menu)
+static void fixup_rootmenu(struct menu *menu)
{
struct menu *child;
static int menu_cnt = 0;
diff --git a/scripts/kconfig/images.c b/scripts/kconfig/images.c
index d4f84bd4a96b..b4fa0e4a63a5 100644
--- a/scripts/kconfig/images.c
+++ b/scripts/kconfig/images.c
@@ -1,9 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
*/
-static const char *xpm_load[] = {
+#include "images.h"
+
+const char *xpm_load[] = {
"22 22 5 1",
". c None",
"# c #000000",
@@ -33,7 +35,7 @@ static const char *xpm_load[] = {
"###############.......",
"......................"};
-static const char *xpm_save[] = {
+const char *xpm_save[] = {
"22 22 5 1",
". c None",
"# c #000000",
@@ -63,7 +65,7 @@ static const char *xpm_save[] = {
"..##################..",
"......................"};
-static const char *xpm_back[] = {
+const char *xpm_back[] = {
"22 22 3 1",
". c None",
"# c #000083",
@@ -91,7 +93,7 @@ static const char *xpm_back[] = {
"......................",
"......................"};
-static const char *xpm_tree_view[] = {
+const char *xpm_tree_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -118,7 +120,7 @@ static const char *xpm_tree_view[] = {
"......................",
"......................"};
-static const char *xpm_single_view[] = {
+const char *xpm_single_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -145,7 +147,7 @@ static const char *xpm_single_view[] = {
"......................",
"......................"};
-static const char *xpm_split_view[] = {
+const char *xpm_split_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -172,7 +174,7 @@ static const char *xpm_split_view[] = {
"......................",
"......................"};
-static const char *xpm_symbol_no[] = {
+const char *xpm_symbol_no[] = {
"12 12 2 1",
" c white",
". c black",
@@ -189,7 +191,7 @@ static const char *xpm_symbol_no[] = {
" .......... ",
" "};
-static const char *xpm_symbol_mod[] = {
+const char *xpm_symbol_mod[] = {
"12 12 2 1",
" c white",
". c black",
@@ -206,7 +208,7 @@ static const char *xpm_symbol_mod[] = {
" .......... ",
" "};
-static const char *xpm_symbol_yes[] = {
+const char *xpm_symbol_yes[] = {
"12 12 2 1",
" c white",
". c black",
@@ -223,7 +225,7 @@ static const char *xpm_symbol_yes[] = {
" .......... ",
" "};
-static const char *xpm_choice_no[] = {
+const char *xpm_choice_no[] = {
"12 12 2 1",
" c white",
". c black",
@@ -240,7 +242,7 @@ static const char *xpm_choice_no[] = {
" .... ",
" "};
-static const char *xpm_choice_yes[] = {
+const char *xpm_choice_yes[] = {
"12 12 2 1",
" c white",
". c black",
@@ -257,7 +259,7 @@ static const char *xpm_choice_yes[] = {
" .... ",
" "};
-static const char *xpm_menu[] = {
+const char *xpm_menu[] = {
"12 12 2 1",
" c white",
". c black",
@@ -274,7 +276,7 @@ static const char *xpm_menu[] = {
" .......... ",
" "};
-static const char *xpm_menu_inv[] = {
+const char *xpm_menu_inv[] = {
"12 12 2 1",
" c white",
". c black",
@@ -291,7 +293,7 @@ static const char *xpm_menu_inv[] = {
" .......... ",
" "};
-static const char *xpm_menuback[] = {
+const char *xpm_menuback[] = {
"12 12 2 1",
" c white",
". c black",
@@ -308,7 +310,7 @@ static const char *xpm_menuback[] = {
" .......... ",
" "};
-static const char *xpm_void[] = {
+const char *xpm_void[] = {
"12 12 2 1",
" c white",
". c black",
diff --git a/scripts/kconfig/images.h b/scripts/kconfig/images.h
new file mode 100644
index 000000000000..d8ff614bd087
--- /dev/null
+++ b/scripts/kconfig/images.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ */
+
+#ifndef IMAGES_H
+#define IMAGES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char *xpm_load[];
+extern const char *xpm_save[];
+extern const char *xpm_back[];
+extern const char *xpm_tree_view[];
+extern const char *xpm_single_view[];
+extern const char *xpm_split_view[];
+extern const char *xpm_symbol_no[];
+extern const char *xpm_symbol_mod[];
+extern const char *xpm_symbol_yes[];
+extern const char *xpm_choice_no[];
+extern const char *xpm_choice_yes[];
+extern const char *xpm_menu[];
+extern const char *xpm_menu_inv[];
+extern const char *xpm_menuback[];
+extern const char *xpm_void[];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IMAGES_H */
diff --git a/scripts/kconfig/kconf_id.c b/scripts/kconfig/kconf_id.c
deleted file mode 100644
index b3e0ea0ac732..000000000000
--- a/scripts/kconfig/kconf_id.c
+++ /dev/null
@@ -1,52 +0,0 @@
-
-static struct kconf_id kconf_id_array[] = {
- { "mainmenu", T_MAINMENU, TF_COMMAND },
- { "menu", T_MENU, TF_COMMAND },
- { "endmenu", T_ENDMENU, TF_COMMAND },
- { "source", T_SOURCE, TF_COMMAND },
- { "choice", T_CHOICE, TF_COMMAND },
- { "endchoice", T_ENDCHOICE, TF_COMMAND },
- { "comment", T_COMMENT, TF_COMMAND },
- { "config", T_CONFIG, TF_COMMAND },
- { "menuconfig", T_MENUCONFIG, TF_COMMAND },
- { "help", T_HELP, TF_COMMAND },
- { "---help---", T_HELP, TF_COMMAND },
- { "if", T_IF, TF_COMMAND|TF_PARAM },
- { "endif", T_ENDIF, TF_COMMAND },
- { "depends", T_DEPENDS, TF_COMMAND },
- { "optional", T_OPTIONAL, TF_COMMAND },
- { "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN },
- { "prompt", T_PROMPT, TF_COMMAND },
- { "tristate", T_TYPE, TF_COMMAND, S_TRISTATE },
- { "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE },
- { "bool", T_TYPE, TF_COMMAND, S_BOOLEAN },
- { "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN },
- { "int", T_TYPE, TF_COMMAND, S_INT },
- { "hex", T_TYPE, TF_COMMAND, S_HEX },
- { "string", T_TYPE, TF_COMMAND, S_STRING },
- { "select", T_SELECT, TF_COMMAND },
- { "imply", T_IMPLY, TF_COMMAND },
- { "range", T_RANGE, TF_COMMAND },
- { "visible", T_VISIBLE, TF_COMMAND },
- { "option", T_OPTION, TF_COMMAND },
- { "on", T_ON, TF_PARAM },
- { "modules", T_OPT_MODULES, TF_OPTION },
- { "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION },
- { "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION },
-};
-
-#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
-
-static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len)
-{
- int i;
-
- for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) {
- struct kconf_id *id = kconf_id_array+i;
- int l = strlen(id->name);
-
- if (len == l && !memcmp(str, id->name, len))
- return id;
- }
- return NULL;
-}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 9eb7c837cd8f..531ff7c57d92 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -1,6 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
*/
#ifndef LKC_H
@@ -30,10 +30,6 @@ static inline const char *CONFIG_prefix(void)
#undef CONFIG_
#define CONFIG_ CONFIG_prefix()
-#define TF_COMMAND 0x0001
-#define TF_PARAM 0x0002
-#define TF_OPTION 0x0004
-
enum conf_def_mode {
def_default,
def_yes,
@@ -42,17 +38,6 @@ enum conf_def_mode {
def_random
};
-#define T_OPT_MODULES 1
-#define T_OPT_DEFCONFIG_LIST 2
-#define T_OPT_ALLNOCONFIG_Y 4
-
-struct kconf_id {
- const char *name;
- int token;
- unsigned int flags;
- enum symbol_type stype;
-};
-
extern int yylineno;
void zconfdump(FILE *out);
void zconf_starthelp(void);
@@ -91,7 +76,9 @@ void menu_add_visibility(struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
-void menu_add_option(int token, char *arg);
+void menu_add_option_modules(void);
+void menu_add_option_defconfig_list(void);
+void menu_add_option_allnoconfig_y(void);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
@@ -103,6 +90,9 @@ void *xrealloc(void *p, size_t size);
char *xstrdup(const char *s);
char *xstrndup(const char *s, size_t n);
+/* zconf.l */
+int yylex(void);
+
struct gstr {
size_t len;
char *s;