From 981e545a698aee98ed9c11202fe9bc93242f3cec Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 24 Jan 2019 19:47:29 +0900 Subject: [PATCH 1/3] kconfig: rename zconf.l to lexer.l Use a more logical name. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 6 +++--- scripts/kconfig/{zconf.l => lexer.l} | 0 scripts/kconfig/lkc.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename scripts/kconfig/{zconf.l => lexer.l} (100%) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 181973509a05..9278519dbcf3 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -143,10 +143,10 @@ help: # =========================================================================== # object files used by all kconfig flavours -common-objs := confdata.o expr.o symbol.o preprocess.o zconf.lex.o zconf.tab.o +common-objs := confdata.o expr.o lexer.lex.o preprocess.o symbol.o zconf.tab.o -$(obj)/zconf.lex.o: $(obj)/zconf.tab.h -HOSTCFLAGS_zconf.lex.o := -I$(src) +$(obj)/lexer.lex.o: $(obj)/zconf.tab.h +HOSTCFLAGS_lexer.lex.o := -I$(src) HOSTCFLAGS_zconf.tab.o := -I$(src) # conf: Used for defconfig, oldconfig and related targets diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/lexer.l similarity index 100% rename from scripts/kconfig/zconf.l rename to scripts/kconfig/lexer.l diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 531ff7c57d92..d871539e4b45 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -90,7 +90,7 @@ void *xrealloc(void *p, size_t size); char *xstrdup(const char *s); char *xstrndup(const char *s, size_t n); -/* zconf.l */ +/* lexer.l */ int yylex(void); struct gstr { From 769a1c02267854c48852532e5d7b595afcfe8dd7 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 24 Jan 2019 19:47:30 +0900 Subject: [PATCH 2/3] kconfig: rename zconf.y to parser.y Use a more logical name. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 7 ++++--- scripts/kconfig/expr.h | 2 +- scripts/kconfig/lexer.l | 2 +- scripts/kconfig/{zconf.y => parser.y} | 0 4 files changed, 6 insertions(+), 5 deletions(-) rename scripts/kconfig/{zconf.y => parser.y} (100%) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 9278519dbcf3..7c5dc31c1d95 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -143,11 +143,12 @@ help: # =========================================================================== # object files used by all kconfig flavours -common-objs := confdata.o expr.o lexer.lex.o preprocess.o symbol.o zconf.tab.o +common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \ + symbol.o -$(obj)/lexer.lex.o: $(obj)/zconf.tab.h +$(obj)/lexer.lex.o: $(obj)/parser.tab.h HOSTCFLAGS_lexer.lex.o := -I$(src) -HOSTCFLAGS_zconf.tab.o := -I$(src) +HOSTCFLAGS_parser.tab.o := -I$(src) # conf: Used for defconfig, oldconfig and related targets hostprogs-y += conf diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 999edb60cd53..8dde65bc3165 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -172,7 +172,7 @@ struct symbol { * int "BAZ Value" * range 1..255 * - * Please, also check zconf.y:print_symbol() when modifying the + * Please, also check parser.y:print_symbol() when modifying the * list of property types! */ enum prop_type { diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l index b2d0a3b0bce9..c9df1c8b9824 100644 --- a/scripts/kconfig/lexer.l +++ b/scripts/kconfig/lexer.l @@ -15,7 +15,7 @@ #include #include "lkc.h" -#include "zconf.tab.h" +#include "parser.tab.h" #define YY_DECL static int yylex1(void) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/parser.y similarity index 100% rename from scripts/kconfig/zconf.y rename to scripts/kconfig/parser.y From 8741908b3e29d35a33eeab6de60175958db8e54b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 11 Mar 2019 01:13:15 +0900 Subject: [PATCH 3/3] kconfig: fix 'Save As' menu of xconfig The 'Save As' menu of xconfig is not working; it always saves the kernel configuration into the default file irrespective of the file chosen in the dialog box. The 'Save' menu always writes into the default file, but it would make more sense to write into the file previously chosen by 'Load' or 'Save As'. Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 42 +++++++++++++++++++++++++++++++++------- scripts/kconfig/qconf.h | 1 + 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 8be8a70c5542..ce7fc87a49a7 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1392,6 +1392,8 @@ ConfigMainWindow::ConfigMainWindow(void) conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); + configname = xstrdup(conf_get_configname()); + QAction *saveAsAction = new QAction("Save &As...", this); connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); QAction *searchAction = new QAction("&Find", this); @@ -1520,17 +1522,29 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); - if (s.isNull()) + QString str; + QByteArray ba; + const char *name; + + str = QFileDialog::getOpenFileName(this, "", configname); + if (str.isNull()) return; - if (conf_read(QFile::encodeName(s))) + + ba = str.toLocal8Bit(); + name = ba.data(); + + if (conf_read(name)) QMessageBox::information(this, "qconf", "Unable to load configuration!"); + + free(configname); + configname = xstrdup(name); + ConfigView::updateListAll(); } bool ConfigMainWindow::saveConfig(void) { - if (conf_write(NULL)) { + if (conf_write(configname)) { QMessageBox::information(this, "qconf", "Unable to save configuration!"); return false; } @@ -1541,10 +1555,24 @@ bool ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { - QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); - if (s.isNull()) + QString str; + QByteArray ba; + const char *name; + + str = QFileDialog::getSaveFileName(this, "", configname); + if (str.isNull()) return; - saveConfig(); + + ba = str.toLocal8Bit(); + name = ba.data(); + + if (conf_write(name)) { + QMessageBox::information(this, "qconf", "Unable to save configuration!"); + } + conf_write_autoconf(0); + + free(configname); + configname = xstrdup(name); } void ConfigMainWindow::searchConfig(void) diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 41df466e67d9..45bfe9b2b966 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -291,6 +291,7 @@ protected: class ConfigMainWindow : public QMainWindow { Q_OBJECT + char *configname; static QAction *saveAction; static void conf_changed(void); public: